forked from puhnastiy/PhoneJS-KitchenSink
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
66 lines (57 loc) · 2.14 KB
/
app.js
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
window.KitchenSink = window.KitchenSink || {};
$(function() {
// Uncomment the line below to disable platform-specific look and feel and to use the Generic theme for all devices
// DevExpress.devices.current({ platform: "generic" });
document.addEventListener("deviceready", onDeviceReady, false);
KitchenSink.app = new DevExpress.framework.html.HtmlApplication({
namespace: KitchenSink,
commandMapping: KitchenSink.config.commandMapping,
navigationType: KitchenSink.config.navigationType,
navigation: getNavigationItems()
});
KitchenSink.app.router.register(":view/:id", { view: "Home", id: undefined });
function showMenu(e) {
KitchenSink.app.viewShown.remove(showMenu);
if (e.viewInfo.viewName !== "Home")
return;
setTimeout(function() {
$(".nav-button").trigger("dxclick");
}, 1000);
}
function getNavigationItems() {
if(DevExpress.devices.current().platform === "win8") {
KitchenSink.config.navigation.push({
"title": "Panorama",
"action": "#Panorama",
"icon": "favorites"
},
{
"title": "Pivot",
"action": "#Pivot",
"icon": "favorites"
});
}
return KitchenSink.config.navigation;
}
function onDeviceReady() {
document.addEventListener("backbutton", onBackButton, false);
}
function onBackButton() {
if(KitchenSink.app.canBack()) {
KitchenSink.app.back();
} else {
switch(DevExpress.devices.current().platform) {
case "tizen":
tizen.application.getCurrentApplication().exit();
break;
case "android":
navigator.app.exitApp();
break;
case "win8":
window.external.Notify("DevExpress.ExitApp");
break;
}
}
}
KitchenSink.app.viewShown.add(showMenu);
});