From f0b211f269df2b0bb10d5552d14aeb8991a750ed Mon Sep 17 00:00:00 2001 From: seshukm Date: Fri, 20 Jan 2017 17:43:08 +0530 Subject: GUI Code refactor GUI Code refactor for the sun release code. Issue-Id : CLIENT-11 Change-Id: I771cc25ff3c8ff7a4e939ce7baef7dd94a67974b Signed-off-by: seshukm --- .../src/main/webapp/common/js/moreOperation.js | 332 ++++++++++----------- 1 file changed, 166 insertions(+), 166 deletions(-) (limited to 'openo-portal/portal-common/src/main/webapp/common/js/moreOperation.js') diff --git a/openo-portal/portal-common/src/main/webapp/common/js/moreOperation.js b/openo-portal/portal-common/src/main/webapp/common/js/moreOperation.js index 8078f54b..59e781a0 100644 --- a/openo-portal/portal-common/src/main/webapp/common/js/moreOperation.js +++ b/openo-portal/portal-common/src/main/webapp/common/js/moreOperation.js @@ -1,166 +1,166 @@ -/* - * Copyright 2016, CMCC Technologies Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -var resetSelectedItem=function(menuAlink){ - if(menuAlink.children('div.boxOperation').length>0){ - $(".box.boxOperation", $(".carousel-inner")).removeClass("moreButtonSelected"); - menuAlink.children('div.boxOperation').addClass('moreButtonSelected'); - }else if(menuAlink.parents('div.boxOperation').length>0){ - $(".box.boxOperation", $(".carousel-inner")).removeClass("moreButtonSelected"); - menuAlink.parents('div.boxOperation').addClass('moreButtonSelected'); - } -} -var reSelected=function(){ - if(openoFrameWork){ - var menuID = openoFrameWork.getLocationHash(); - var menuAlink = $('#'+ menuID,$('#pageableDiv')); - if(menuAlink.length>0){ - resetSelectedItem(menuAlink); - }else{ - menuAlink = $('#'+ menuID,$('.hor-menu')); - if(!!menuAlink.attr("defaultchildmenuid")&&menuAlink.attr("defaultchildmenuid").length>0){ - menuAlink = $('#'+ menuAlink.attr("defaultchildmenuid"),$('#pageableDiv')); - if(menuAlink.length>0){ - resetSelectedItem(menuAlink); - } - } - } - } -} -var inter=null; - -var clearMoreOperations=function(){ - $('#pageableDiv').removeClass("moreOpen"); - $('#pageableDiv').addClass("moreClose"); - $('.col-xs-12',$('#pageableDiv')).removeClass("moreOpen"); - $('.col-xs-12',$('#pageableDiv')).addClass("moreClose"); - $(".carousel-inner").children().remove(); - if (inter) { - clearInterval(inter); - }; -} - -var moreOperations = function(html){ - $('#pageableDiv').removeClass("moreClose"); - $('#pageableDiv').addClass("moreOpen"); - $('.col-xs-12',$('#pageableDiv')).removeClass("moreClose"); - $('.col-xs-12',$('#pageableDiv')).addClass("moreOpen"); - showArrow(); - $(".carousel-inner").children().remove(); - inter=setInterval(reSelected, 200); - var moreViewData=[]; - var div = document.createElement('div'); - //div.innerHTML = html; - $(div).append(html); - var liTages =$("ul:first",div).children(); //div.getElementsByTagName('li') - for(var i=0;i"; - }else{ - var aLinkTag = $("a", liTages[i]); - aLink.id = aLinkTag.attr("id"); - var aLinkContent = aLinkTag.html(); - aLinkTag.empty().html('
'); - $(".box", aLinkTag).html(aLinkContent); - aLink.html = aLinkTag.prop("outerHTML"); - } - moreViewData.push(aLink); - } - } - - var transformQueryViewData = function(queryViewData, pageSize){ - var newData = []; - var pageNo = Math.floor(queryViewData.length / pageSize) + 1; - if(queryViewData.length % pageSize == 0){ - pageNo--; - } - for(var i=0;i' + - '
' + - "
" + - ""; - $(".carousel-inner").append(itemHtml); - } - for(var i=0;i'; - $(".col-xs-12", $("#page_" + i + ".item")).append(buttonHtml); - } - } - } - - //moreOperationItems = transformQueryViewData(moreViewData, 14); - - var moreOperationPageSize = 14; - var windowWidth = $(window).width(); - if(windowWidth >= 1367 && windowWidth < 1441){ - moreOperationPageSize = 12; - }else if(windowWidth >= 1281 && windowWidth < 1367){ - moreOperationPageSize = 11; - }else if(windowWidth >= 1025 && windowWidth < 1281){ - moreOperationPageSize = 10; - }else if(windowWidth >= 920 && windowWidth < 1281){ - moreOperationPageSize = 9; - }else if(windowWidth >= 820 && windowWidth < 920){ - moreOperationPageSize = 8; - }else if(windowWidth >= 680 && windowWidth < 820){ - moreOperationPageSize = 7; - }else if(windowWidth >= 540 && windowWidth < 680){ - moreOperationPageSize = 4; - }else if(windowWidth >= 390 && windowWidth < 540){ - moreOperationPageSize = 3; - }else if(windowWidth < 390){ - moreOperationPageSize = 2; - } - - moreOperationItems = transformQueryViewData(moreViewData, moreOperationPageSize); - generateOperationItems(); - - $(".box.boxOperation").click(function(){ - $(".box.boxOperation", $(".carousel-inner")).removeClass("moreButtonSelected"); - $(this).addClass("moreButtonSelected"); - }); - - $($(".item", $(".carousel-inner"))[0]).addClass("active"); - - if($(".item.moreButtonsTag").length < 2){ - hideArrow(); - } -} - -var showArrow = function(){ - $(".carousel-control").show(); - $(".boxOperation").removeClass("boxOperationOnePage"); -} - -var hideArrow = function(){ - $(".carousel-control").hide(); - $(".boxOperation").addClass("boxOperationOnePage"); -} +/* + * Copyright 2016, CMCC Technologies Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +var resetSelectedItem=function(menuAlink){ + if(menuAlink.children('div.boxOperation').length>0){ + $(".box.boxOperation", $(".carousel-inner")).removeClass("moreButtonSelected"); + menuAlink.children('div.boxOperation').addClass('moreButtonSelected'); + }else if(menuAlink.parents('div.boxOperation').length>0){ + $(".box.boxOperation", $(".carousel-inner")).removeClass("moreButtonSelected"); + menuAlink.parents('div.boxOperation').addClass('moreButtonSelected'); + } +} +var reSelected=function(){ + if(openoFrameWork){ + var menuID = openoFrameWork.getLocationHash(); + var menuAlink = $('#'+ menuID,$('#pageableDiv')); + if(menuAlink.length>0){ + resetSelectedItem(menuAlink); + }else{ + menuAlink = $('#'+ menuID,$('.hor-menu')); + if(!!menuAlink.attr("defaultchildmenuid")&&menuAlink.attr("defaultchildmenuid").length>0){ + menuAlink = $('#'+ menuAlink.attr("defaultchildmenuid"),$('#pageableDiv')); + if(menuAlink.length>0){ + resetSelectedItem(menuAlink); + } + } + } + } +} +var inter=null; + +var clearMoreOperations=function(){ + $('#pageableDiv').removeClass("moreOpen"); + $('#pageableDiv').addClass("moreClose"); + $('.col-xs-12',$('#pageableDiv')).removeClass("moreOpen"); + $('.col-xs-12',$('#pageableDiv')).addClass("moreClose"); + $(".carousel-inner").children().remove(); + if (inter) { + clearInterval(inter); + }; +} + +var moreOperations = function(html){ + $('#pageableDiv').removeClass("moreClose"); + $('#pageableDiv').addClass("moreOpen"); + $('.col-xs-12',$('#pageableDiv')).removeClass("moreClose"); + $('.col-xs-12',$('#pageableDiv')).addClass("moreOpen"); + showArrow(); + $(".carousel-inner").children().remove(); + inter=setInterval(reSelected, 200); + var moreViewData=[]; + var div = document.createElement('div'); + //div.innerHTML = html; + $(div).append(html); + var liTages =$("ul:first",div).children(); //div.getElementsByTagName('li') + for(var i=0;i"; + }else{ + var aLinkTag = $("a", liTages[i]); + aLink.id = aLinkTag.attr("id"); + var aLinkContent = aLinkTag.html(); + aLinkTag.empty().html('
'); + $(".box", aLinkTag).html(aLinkContent); + aLink.html = aLinkTag.prop("outerHTML"); + } + moreViewData.push(aLink); + } + } + + var transformQueryViewData = function(queryViewData, pageSize){ + var newData = []; + var pageNo = Math.floor(queryViewData.length / pageSize) + 1; + if(queryViewData.length % pageSize == 0){ + pageNo--; + } + for(var i=0;i' + + '
' + + "
" + + ""; + $(".carousel-inner").append(itemHtml); + } + for(var i=0;i'; + $(".col-xs-12", $("#page_" + i + ".item")).append(buttonHtml); + } + } + } + + //moreOperationItems = transformQueryViewData(moreViewData, 14); + + var moreOperationPageSize = 14; + var windowWidth = $(window).width(); + if(windowWidth >= 1367 && windowWidth < 1441){ + moreOperationPageSize = 12; + }else if(windowWidth >= 1281 && windowWidth < 1367){ + moreOperationPageSize = 11; + }else if(windowWidth >= 1025 && windowWidth < 1281){ + moreOperationPageSize = 10; + }else if(windowWidth >= 920 && windowWidth < 1281){ + moreOperationPageSize = 9; + }else if(windowWidth >= 820 && windowWidth < 920){ + moreOperationPageSize = 8; + }else if(windowWidth >= 680 && windowWidth < 820){ + moreOperationPageSize = 7; + }else if(windowWidth >= 540 && windowWidth < 680){ + moreOperationPageSize = 4; + }else if(windowWidth >= 390 && windowWidth < 540){ + moreOperationPageSize = 3; + }else if(windowWidth < 390){ + moreOperationPageSize = 2; + } + + moreOperationItems = transformQueryViewData(moreViewData, moreOperationPageSize); + generateOperationItems(); + + $(".box.boxOperation").click(function(){ + $(".box.boxOperation", $(".carousel-inner")).removeClass("moreButtonSelected"); + $(this).addClass("moreButtonSelected"); + }); + + $($(".item", $(".carousel-inner"))[0]).addClass("active"); + + if($(".item.moreButtonsTag").length < 2){ + hideArrow(); + } +} + +var showArrow = function(){ + $(".carousel-control").show(); + $(".boxOperation").removeClass("boxOperationOnePage"); +} + +var hideArrow = function(){ + $(".carousel-control").hide(); + $(".boxOperation").addClass("boxOperationOnePage"); +} -- cgit 1.2.3-korg