forked from SSShooter/MyDiary
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
358 lines (351 loc) · 9.65 KB
/
index.html
File metadata and controls
358 lines (351 loc) · 9.65 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
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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Home</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<!-- 新 Bootstrap 核心 CSS 文件 -->
<link rel="stylesheet" href="bootstrap/bootstrap.min.css">
<!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
<script src="lib/jquery.min.js"></script>
<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
<script src="bootstrap/bootstrap.min.js"></script>
<link rel="stylesheet" type="text/css" href="icon/iconfont.css">
<!-- 自定义bs -->
<link rel="stylesheet" type="text/css" href="css/custombs.css">
<link rel="stylesheet" type="text/css" href="css/animate.min.css">
<style type="text/css">
header{
/*padding for导航栏*/
padding-top: 22px;
height: 88px;
position: fixed;
width: 100vw;
background-color: #5A95BA;
color: #fff;
}
header img{
float: left;
height: 100%;
padding: 10px 10px;
}
header .name{
float: left;
padding: 10px 10px;
}
header .name span{
display: block;
}
header .name .nickname{
font-weight: bold;
font-size: 25px;
line-height: 25px;
}
#main{
min-height: 100vh;
box-sizing: border-box;
padding-top:89px;
padding-bottom: 44px;
}
#main .item{
border-bottom: 1px #ccc solid;
padding: 10px 30px 10px 0;
margin-left: 30px;
line-height: 50px;
font-size: 18px;
color: rgb(92,115,136);
}
.item > .iconfont{
font-size: 18px;
margin-right: 10px;
}
.item .total, .total > .iconfont{
font-size: 10px;
}
footer{
position: fixed;
width: 100vw;
height: 44px;
background-color: #fff;
border-top: 1px #CACACA solid;
bottom: 0;
}
footer input{
border: none;
border-radius: 10px;
background-color: #5A95BA;
color: #fff;
width: 70%;
vertical-align:middle;
position: relative;
margin-left: 10px;
margin-top: 6px;
line-height: 28px;
padding-left: 28px;
}
footer .iconfont{
vertical-align: middle;
line-height: 44px;
font-size: 25px;
color: #5A95BA;
}
footer .icon-search{
position: absolute;
color: #fff;
left: 10px;
}
footer .icon-setting{
position: absolute;
right: 10px;
}
#search-result{
display: none;
background-color: rgba(0,0,0,.5);
position: absolute;
height: calc(100vh - 44px);
width: 100vw;
top: 0;left: 0;
padding-top: 20px;
overflow: scroll;
}
#search-result .item{
height: 80px;
background-color: #fff;
border-radius: 6px;
margin-bottom: 10px;
color: #5A95BA;
}
.date-and-week{
padding-top: 10px;
height: 60px;
width: 60px;
text-align: center;
}
.date-and-week .date{
font-size: 40px;
line-height: 40px;
margin-bottom: 0;
}
.content{
padding-top: 14px;
}
.content p{
margin-bottom: 0;
}
.content .create_time{
font-size: 10px;
}
.content .description{
font-size: 10px;
}
.state{
padding-right: 10px;
padding-top: 14px;
}
.state i{
margin: 0 2px;
}
.state p{
text-align: right;
font-size: 20px;
}
#setting-div{
height: 60px;
width: 100vw;
background-color: #5A95BA;
position: fixed;
bottom: 0;
display: none;
color: #fff;
line-height: 60px;
}
#setting-div .iconfont{
text-align: center;
font-size: 30px;
width: 32%;
display: inline-block;
}
#setting-mask{
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100vw;
background-color: rgba(0,0,0,.5);
display: none;
}
/*table居中法*/
.table {
display: table;
height:100%;
pointer-events:none;/* This makes sure that we can still click outside of the modal to close it */
}
.table-cell {
display: table-cell;
vertical-align: middle;
pointer-events:none;
}
.modal-content{
pointer-events: all;
}
input[type="radio"]{
display: none;
}
.checkbox label{
opacity: .5;
}
.checkbox label.checked{
opacity: 1;
}
strong{
display: inline-block;
margin-bottom: 5px;
}
</style>
</head>
<body>
<div class="pop-up" id="newfolder">
<div class="pop-up-box clearfix">
<div class="checkbox">
<strong>folder type</strong>
<label name="diary" class="checked" for="diary"><i class="iconfont icon-book"></i>diary<input type="radio" id="diary" checked="checked" value="diary"></label>
<label name="list" for="list"><i class="iconfont icon-alert"></i>list<input type="radio" id="list" value="list"></label>
<label name="address" for="address"><i class="iconfont icon-phone"></i>address book<input type="radio" id="address" value="address"></label>
</div>
<div class="form-group">
<strong>folder name</strong>
<input type="text" name="folder_name" class="form-control">
</div>
<button type="submit" class="btn btn-default pull-right" id="submitNewFolder">Submit</button>
</div>
</div>
<div id="setting-mask"></div>
<div class="app">
<header>
<img src="img/avatar.png" alt="avatar" class="img-circle">
<div class="name">
<span class="nickname">立花 瀧</span>
<span class="realname">たちばな たき</span>
</div>
</header>
<div id="main"></div>
<div id="search-result" class="container">
</div>
<footer>
<input type="text" name="search" id="search" />
<i class="iconfont icon-search"></i>
<i class="iconfont icon-setting" id="setting"></i>
</footer>
</div>
<div id="setting-div">
<i class="iconfont icon-tianjia" id="new" data-toggle="modal" data-poptarget="newfolder"></i>
<i class="iconfont icon-zhuti" id="theme" onclick="changeTheme()"></i>
<i class="iconfont icon-about" id="about" onClick="location='about.html'"></i>
</div>
<script src="js/common.js"></script>
<script src="lib/velocity.min.js"></script>
<script type="text/javascript" src="js/indexeddb.js"></script>
<script type="text/javascript">
var data = [
{type:"phone",count:0 ,icon:"phone",name:"緊急時以外かけちゃダメ"},
{type:"diary",count:0 ,icon:"book",name:"Diary"},
{type:"diary",count:0 ,icon:"book",name:"みつはのにっき"},
{type:"list" ,count:0,icon:"alert",name:"ゼッタイ禁止"},
{type:"list" ,count:0,icon:"alert",name:"行きたいおみせメモ"}
];
if(localStorage.theme === 'mitsuha'){
$('head').append('<link rel="stylesheet" type="text/css" href="css/mitsuha.home.css"><link rel="stylesheet" type="text/css" href="css/mitsuha.bs.css">');
}
$('#new').popUpPop('newfolder');
getDataAll("menu", process);
function process(rowdata){
var data = rowdata.data;
var monthDivision;
console.log(data);
for(var i = 0;i<data.length;i++){
console.log(data[i].type + ' ' + data[i].folder_id);
var item = '<div class="item" id="'+ data[i].type+'_'+data[i].folder_id +'"><i class="iconfont icon-'+ data[i].icon +'"></i><span>'+ data[i].name +'</span><span class="total pull-right">'+ data[i].count +'<i class="iconfont icon-xiayige"></i></span></div>';
$("#main").append(item);
}
}
$('#main').on('click','.item',function(){
var type = $(this).attr('id');
var folder_name = $(this).children('span').first().html();
type = type.split("_");
if (type[0]==='diary') {
location = 'entries.html';
}else if(type[0]==='list'){
location = 'list.html';
}else{
location = 'address.html';
}
localStorage.setItem('folder', type[1]);
localStorage.setItem('folder_name', folder_name);
});
$('#search').on('input',function(e){
var input_content = $(this).val();
if(input_content){
$('#search-result').fadeIn();
var items = '';
searchString($(this).val(),function(data){
for(var i = 0;i<data.length;i++){
var item = '<div id="'+data[i].id+'" data-toggle="modal" data-target="#myModal" class="item"><div class="date-and-week pull-left"><p class="date">'+data[i].date+'</p><p class="week">'+data[i].day+'</p></div><div class="content pull-left"><p class="create_time">'+data[i].time+'</p><p class="title">'+data[i].title+'</p><p class="description">'+data[i].description+'</p></div><div class="state pull-right"><i class="iconfont icon-qing"></i><i class="iconfont icon-smile-copy"></i><i class="iconfont icon-biaoqian"></i></div></div>';
items+=item;
}
$("#search-result").html(items);
});
}else{
$('#search-result').fadeOut();
}
});
$('#setting').click(function(){
$('#setting-mask').fadeIn();
$('#setting-div').fadeIn();
});
$('#setting-mask').on('touchstart',function(e){
e.preventDefault();//禁止滚动
});
$('#setting-mask').on('touchend',function(e){
$('#setting-mask').fadeOut();
$('#setting-div').fadeOut();
});
function changeTheme() {
if (localStorage.theme === 'mitsuha') {
localStorage.setItem('theme','taki');
}else{
localStorage.setItem('theme','mitsuha');
}
location.reload();
}
$(function() {
$('label').click(function(){
var radioId = $(this).attr('name');
$('label').removeAttr('class') && $(this).attr('class', 'checked');
$('input[type="radio"]').removeAttr('checked') && $('#' + radioId).attr('checked', 'checked');
});
});
$('#submitNewFolder').click(function() {
var type = $('input[type="radio"]:checked').attr('value');
var name = $('input[name="folder_name"]').val();
var icon;
if (type==='diary') {
icon = 'book';
}else if (type==='list'){
icon = 'alert';
}else{
icon = 'phone';
}
if(name){
var newdata = {type:type, count:0 ,icon:icon, name:name};
console.log(newdata);
addData('menu', newdata, function(){
alert('添加成功');
location.reload();
});
}else{
alert('请输入文件夹名');
}
});
</script>
</body>
</html>