forked from aOrz/Wordpress-Mobile-Application
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
134 lines (129 loc) · 4.11 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
126
127
128
129
130
131
132
133
134
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
<title>首页</title>
<link href="css/mui.min.css" rel="stylesheet" />
<link rel="stylesheet" href="css/mystyle.css" />
</head>
<body>
<div id="content">
<my-header v-bind:title="title_name" lefticon="mui-action-menu mui-icon-bars" righticon="mui-icon-search"></my-header>
<div class="mui-content" style="width: 40%;">
<ul class="mui-table-view menu" v-show="ishide">
<li class="mui-table-view-cell">
<a class="mui-navigate-right" v-on:click="reload" data-name="">
首页
</a>
</li>
<li v-for="item in category" class="mui-table-view-cell">
<a class="mui-navigate-right" v-on:click="reload" :data-name="item.name" :data-catid="item.catid">
{{item.name}}
</a>
</li>
</ul>
</div>
</div>
<script src="js/mui.min.js"></script>
<script src="js/vue.min.js"></script>
<script type="text/javascript" src="js/app.js"></script>
<script type="text/javascript" charset="utf-8">
mui.init({
swipeBack: false,
statusBarBackground: '#f7f7f7',
gestureConfig: {
doubletap: true
},
subpages: [{
id: 'list.html',
url: 'list.html',
createNew: false,
styles: {
top: '45px',
bottom: '8%',
bounce: 'vertical'
}
},
{
id: 'nav_bar.html',
url: 'nav_bar.html',
styles: {
top: '92%',
bottom: 0,
height: '8%',
bounce: 'vertical'
}
}],
preloadPages: [{
url: 'tags.html',
id: 'tags'
}]
});
var mv = new Vue({
el: '#content',
data: {
ishide: 0,
category: app.category,
title_name: app.name
},
methods: {
reload: function(event) {
var catid = event.target.dataset.catid;
var name = event.target.dataset.name;
this.title_name = name || app.name;
var list = plus.webview.getWebviewById('list.html');
mui.fire(list, 'reload', {
page: 1,
context: 'embed',
'filter[cat]': catid,
});
var nav_bar = plus.webview.getWebviewById('nav_bar.html');
mui.fire(nav_bar, 'updateCatid', {
catid: catid
});
}
}
})
var menu = document.getElementById('lefticon');
function hasClass(obj, cls) {
return obj.className.match(new RegExp('(\\s|^)' + cls + '(\\s|$)'));
}
function removeClass(obj, cls) {
if(hasClass(obj, cls)) {
var reg = new RegExp('(\\s|^)' + cls + '(\\s|$)');
obj.className = obj.className.replace(reg, ' ');
}
}
window.addEventListener('menu:close', function(event) {
mv.ishide = 0;
removeClass(menu, 'trans')
if(!hasClass(menu, 'transback')) menu.className += " " + 'transback';
})
window.addEventListener('menu:open', function(event) {
mv.ishide = 1;
if(hasClass(menu, 'transback')) removeClass(menu, 'transback')
if(!hasClass(menu, 'trans')) menu.className += " " + 'trans';
})
window.addEventListener('title', function(event) {
console.log(JSON.stringify(event.detail))
mv.title_name = event.detail.title_name;
})
mui.plusReady(function() {
var list = plus.webview.getWebviewById('list.html')
document.getElementById('lefticon').addEventListener('tap', function() {
if(!list) {
list = plus.webview.getWebviewById('list.html')
}
mui.fire(list, 'menu')
})
})
document.getElementById('righticon').addEventListener('tap', function() {
mui.openWindow({
url: 'tags.html',
id: 'tags'
})
})
</script>
</body>
</html>