Repository navigation
Expand file tree
/
Copy pathapp.js
More file actions
196 lines (140 loc) · 5.46 KB
/
Copy pathapp.js
File metadata and controls
196 lines (140 loc) · 5.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
8000
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
/****************************************************************************/
/** Initialize Mobile Page/Splash Screen **/
/****************************************************************************/
var App = App || {};
(function (App, $, iScroll, window) {
"use strict";
$("#splashScreen").one("pageinit", function (event) {
//$.mobile.page.prototype.options.domCache = false;
App.Mobile(App, $, iScroll, window);
});
}(App, $, iScroll, window));
App.Mobile = (function (App, $, iScroll, window) {
"use strict";
App.Pages = App.Pages || {};
// You can put your apps variable here
// to be used in your function
/****************************************************************************/
/** Function/Routine To Bind Page Functions **/
/****************************************************************************/
App.Pages.Kernel = function (event) {
var that = this,
eventType = event.type,
pageName = $(this).attr("data-app-jspage");
console.log("Kernel: "+pageName+", "+eventType);
if (App && App.Pages && pageName && App.Pages[pageName] && App.Pages[pageName][eventType]) {
App.Pages[pageName][eventType].call(that);
}
};
/****************************************************************************/
/** Function/Routine Get jQuery Page Event **/
/****************************************************************************/
App.Pages.Events = (function () {
$("div[data-app-jspage]").on(
'pagebeforecreate pagecreate pagebeforeload pagebeforeshow pageshow pagebeforechange pagechange pagebeforehide pagehide pageinit',
App.Pages.Kernel
);
}());
/****************************************************************************/
/** Function/Routine For Screen Resolution **/
/****************************************************************************/
App.Dimensions = (function () {
var width, height, headerHeight, footerHeight, contentHeight;
return {
get:function () {
width = $(window).width();
height = $(window).height();
headerHeight = $("header", $.mobile.activePage).height() || 0;
footerHeight = $("footer", $.mobile.activePage).height() || 0;
contentHeight = height - headerHeight - footerHeight;
return {
width:width,
height:contentHeight
};
}
};
}());
/****************************************************************************/
/** Function/Routine For #splashScreen **/
/****************************************************************************/
App.Pages.splashScreen = (function () {
var timeHandle = null,
$splash = $("#splashContent"),
changePg = function () {
$.mobile.changePage("#loginPage");
};
return {
pageshow:function () {
// set the CSS height dynamically
// height will give us a taller hit target region
var dim = App.Dimensions.get();
$splash.css('height', dim.height);
// if the user taps, clicks, or swipes go to the next page
$splash.on("tap click swiperight swipeleft swipe", changePg);
// wait 3 seconds
timeHandle = setTimeout(function () {
changePg();
timeHandle = null;
}, 3000);
},
pagehide:function () {
// if the timer hasn't been cleared already, clear it
if (timeHandle) {
clearTimeout(timeHandle);
timeHandle = null;
}
}
};
}());
/****************************************************************************/
/** Function/Routine For #loginPage **/
/****************************************************************************/
App.Pages.loginPage = (function () {
// add function/routine for loginPage
$('#cmdLogMasuk').on("tap click",function(){
$.mobile.changePage("#page1");
});
return {
pageshow:function () {
},
pagehide:function () {
}
};
}());
/****************************************************************************/
/** Function/Routine For #page1 **/
/****************************************************************************/
App.Pages.page1 = (function () {
// add function for page1
return {
pageshow:function () {
},
pagehide:function () {
}
};
}());
/****************************************************************************/
/** Function/Routine For #page2 **/
/****************************************************************************/
App.Pages.page2 = (function () {
// add function for page2
return {
pageshow:function () {
},
pagehide:function () {
}
};
}());
/****************************************************************************/
/** Function/Routine For #page3 **/
/****************************************************************************/
App.Pages.page3 = (function () {
// add function for page3
return {
pageshow:function () {
},
pagehide:function () {
}
};
}());
}); // your application scripts end here ..