mobile_maincontainer_wev8.js
3.42 KB
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
$(document).ready(function(){
initInfoDate();
initCenterMenuCount();
initCenterMenuEvent();
initMenuSystemEvent();
initFooterMenuEvent();
});
function slidePageViewLeft(){
slidePageView("left");
}
function slidePageViewRight(){
slidePageView("right");
}
function slidePageView(direction){
lockFramePage();
var $mainContainer = $("#main-container");
if($mainContainer.hasClass("effected")){
resetPageViewSlide();
setTimeout(releaseFramePage, 500);
}else{
$(".page-slide").hide();
$("#"+direction+"-slide-page").show();
$mainContainer[0].className = "main-container"; // clear
$mainContainer.addClass("effected").addClass("effect-" + direction);
setTimeout( function() {
var eventtype = "click";
$(document.body).on(eventtype, function(evt){
if(hasParentClass(evt.target, "page-view")) {
resetPageViewSlide();
$(document.body).off(eventtype);
setTimeout(releaseFramePage, 500);
}
});
}, 25);
}
}
function resetPageViewSlide(){
$("#main-container")[0].className = "main-container"; // clear
}
function initInfoDate(){
var str = "";
var _date = new Date();
str += _date.getFullYear() + "年";
str += (parseInt(_date.getMonth()) + 1) + "月";
str += _date.getDate() + "日";
str += " ";
var Week = ['日','一','二','三','四','五','六'];
str += "星期" + Week[_date.getDay()];
$("#right-page-header .info-date").html(str);
}
function initCenterMenuCount(){
$("#left-page-center .center-menu ul li").each(function(){
var $that = $(this);
var url = $that.attr("count");
if(!url){
return;
}
$.get(url, null, function(responseText){
try{
var data = $.parseJSON(responseText);
var count = parseInt(data["count"]) || 0;
var $menuRemind = $(".menu-remind", $that);
if(count > 0){
if(count > 99){
count = "99+";
}
if($menuRemind.length == 0){
$menuRemind = $("<div class=\"menu-remind\"></div>");
$that.append($menuRemind);
}
$menuRemind.html(count);
}else{
if($menuRemind.length > 0){
$menuRemind.remove();
}
}
}catch(e){}
});
});
}
function initCenterMenuEvent(){
$("#left-page-center .center-menu ul li").click(function(evt){
if(!$(this).hasClass("selected")){
$(this).siblings(".selected").removeClass("selected");
$(this).addClass("selected");
var url = $(this).attr("url");
//var menuName = $(".menu-text", $(this)).html();
setTimeout(function(){
if(url && url != ""){
//$("#middlePageName_top").html(menuName);
openNewPage(url);
}
}, 200);
}
resetPageViewSlide();
var eventtype = "click";
$(document.body).off(eventtype);
setTimeout(releaseFramePage, 500);
});
}
function removeAllFrame(){
$("#mobileFrameContainer iframe").remove();
$(".st-menu iframe:not(.lazy-frame)").remove();
}
function openNewPage(url){
removeAllFrame();
$("#loading").show();
var $frame = $("<iframe class=\"mobileFrame activeFrame\" frameborder=\"0\" scrolling=\"auto\"></iframe>");
$("#mobileFrameContainer").append($frame);
$frame[0].onload = function(){
$("#loading").hide();
resetActiveFrame();
giveCurrFrameAId(this);
refreshWebHead();
};
$frame[0].src = url;
}
function initMenuSystemEvent(){
$("#menu-system").on("click", function(){
location.href = "/logout.do";
});
}
function initFooterMenuEvent(){
$("#menu-home").click(function(){
$("#left-page-center .center-menu ul li").first().trigger("click");
});
}