forked from dcloudio/casecode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
125 lines (120 loc) · 3.18 KB
/
index.html
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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>36氪 | 关注互联网创业</title>
<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<link rel="stylesheet" href="css/mui.min.css">
<link rel="stylesheet" href="css/app.css" />
<style>
html,
body {
min-height: 100%;
background-color: #efeff4;
}
</style>
</head>
<body>
<header class="mui-bar mui-bar-nav" style="position: static;">
<h1 id="title" class="mui-title kr-title"><span class="kr-logo">36Kr</span></h1>
<a id="setting" class="mui-icon mui-icon-gear mui-pull-right"></a>
</header>
<div class="mui-content"></div>
<script type="text/javascript" charset="UTF-8" src="js/mui.min.js"></script>
<script type="text/javascript" charset="UTF-8" src="js/app.js"></script>
<script>
//预加载
mui.init({
preloadPages: [{
"id": "setting",
"url": "/setting.html",
"styles": {
"popGesture": "hide"
}
}, {
"id": "about",
"url": "/about.html",
"styles": {
"popGesture": "hide"
}
}, { //内置浏览器
"id": "browser_main",
"url": "/browser.html",
"styles": {
"popGesture": "hide"
},
"subpages": [{
"id": "browser",
"url": "",
"styles": {
"top": "0px",
"bottom": "44px"
}
}]
}, {
"id": "detail_main",
"url": "/detail_main.html",
"styles": {
"popGesture": "hide"
},
"subpages": [{
"id": "detail",
"url": "/detail.html",
"styles": {
"popGesture": "hide"
}
}]
}]
});
mui.plusReady(function() {
//关闭splash界面
//plus.navigator.closeSplashscreen();
//创建子窗口
plus.webview.currentWebview().append(plus.webview.create('list.html', 'list', {
top: "44px",
bottom: "0px"
}));
if (mui.os.stream) {
//创建桌面快捷方式
if (mui.isFunction(plus.navigator.createShortcut)) {
var shortcut = plus.storage.getItem("SHORTCUT");
if (!shortcut) {
plus.navigator.createShortcut({
name: "36氪资讯",
icon: "img/icon.png"
});
plus.storage.setItem("SHORTCUT", "true");
}
}
//向服务器发送激活请求,后续可删除
plus.runtime.getProperty(plus.runtime.appid, function(info) {
mui.get('http://stream.dcloud.net.cn/collect/data', {
appid: plus.runtime.appid,
version: info.version,
logtype: 2,
imei: plus.device.imei
});
});
}
});
//右上角设置按钮点击事件
var setting_view = null;
document.getElementById("setting").addEventListener('tap', function() {
if (!setting_view) {
setting_view = plus.webview.getWebviewById('setting');
}
setting_view.show('slide-in-bottom', 200);
});
//首页退出事件
mui.back = function() {
mui.confirm('确定退出应用?', '提示', ['确定', '取消'], function(e) {
if (e.index === 0) {
plus.runtime.quit();
}
});
};
</script>
</body>
</html>