1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
|
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(ZteFrameWork){
var menuID = ZteFrameWork.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<liTages.length;i++){
if(!$(liTages[i]).hasClass("divider")){
var aLink = {};
if($(liTages[i]).hasClass("dropdown")){//???????????
var _litages=$(liTages[i]);
aLink.html='<div class="box boxOperation">'+_litages.prop("outerHTML")+"</div>";
}else{
var aLinkTag = $("a", liTages[i]);
aLink.id = aLinkTag.attr("id");
var aLinkContent = aLinkTag.html();
aLinkTag.empty().html('<div class="box boxOperation"></div>');
$(".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<pageNo;i++){
newData.push({array:[]});
}
for(var j=0;j<queryViewData.length;j++){
newData[Math.floor(j/pageSize)].array.push(queryViewData[j]);
}
return newData;
}
var moreOperationItems = [];
var generateOperationItems = function(){
for(var i=0;i<moreOperationItems.length;i++){
var itemHtml = '<div id="page_' + i + '" class="item moreButtonsTag">' +
'<div class="col-xs-12" style="padding-right: 20px;">' +
"</div>" +
"</div>";
$(".carousel-inner").append(itemHtml);
}
for(var i=0;i<moreOperationItems.length;i++){
for(var j=0;j<moreOperationItems[i].array.length;j++){
var buttonHtml = '<div class="moreButton boxPadding">' + moreOperationItems[i].array[j].html + '</div>';
$(".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");
}
|