forked from SSShooter/MyDiary
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcalendar.html
More file actions
151 lines (150 loc) · 4.65 KB
/
calendar.html
File metadata and controls
151 lines (150 loc) · 4.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Calendar</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>
<!-- 自定义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: 28px;
position: fixed;
width: 100vw;
background-color: #fff;
}
#logo{
color: #5A95BA;
margin: 5px auto;
}
/*以上公用 以下本文件专用*/
#main{
min-height: 100vh;
padding-top:88px;
padding-bottom: 44px;
border-top: 1px solid #5A95BA;
}
.app{
background-color: #5A95BA;
overflow: hidden;
}
.center {
width: 50%;
height: 50%;
overflow: auto;
margin: auto;
position: absolute;
top: 0; left: 0; bottom: 0; right: 0;
}
#main .show-date{
height: 100vw;
width: 100vw;
background-color: #FFF;
color: #5A95BA;
text-align: center;
padding: 20px 0;
position: relative;
}
#main .show-date .date{
font-size: 90px;
line-height: 90px;
font-weight: bold;
}
#main .show-date .month,#main .show-date .day{
font-size: 20px;
line-height: 30px;
}
.app{
display: none;
}
/*animate.css duration*/
.center {
animation-duration: .5s;
}
</style>
</head>
<body>
<div class="app">
<header>
<div class="text-center">
<div class="btn-group btn-group-sm">
<button type="button" class="btn btn-default" onClick="location.replace('entries.html')">Entries</button>
<button type="button" class="btn btn-default active">Calendar</button>
<button type="button" class="btn btn-default" onClick="location.replace('diary.html')">Diary</button>
</div>
</div>
<p id="logo" class="center-block">Diary</p>
</header>
<div id="main">
<div class="show-date" id="card">
<div class="center">
<div class="month"></div>
<div class="date"></div>
<div class="day"></div>
</div>
</div>
</div>
</div>
<script type="text/javascript" src="js/common.js"></script>
<script type="text/javascript" src="lib/alloy_finger.js"></script>
<script type="text/javascript">
$(".app").fadeIn('slow');
if(localStorage.theme === 'mitsuha'){
$('head').append('<link rel="stylesheet" type="text/css" href="css/mitsuha.calendar.css"><link rel="stylesheet" type="text/css" href="css/mitsuha.bs.css">');
}
// animate.css 拓展
$.fn.extend({
animateCss: function (animationName, fn) {
var animationEnd = 'webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend';
this.addClass('animated ' + animationName).one(animationEnd, function() {
$(this).removeClass('animated ' + animationName);
if(fn)fn();
});
}
});
var thisday2card = function(day){
var d = day;
var monthEnglish = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];
var dayEnglish = ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];
var month = d.getMonth();
var date = d.getDate();
var day = d.getDay();
$('.month').html(monthEnglish[month]);
$('.date').html(date);
$('.day').html(dayEnglish[day]);
}
thisday2card(new Date());
var card = document.getElementById("card"),
today = new Date(),
thisday = today;
new AlloyFinger(card, {
touchStart:function(evt) {
console.log('touch start');
},
swipe:function(evt){
if(evt.direction==="Left"){
thisday = new Date(thisday.getTime()+1000*60*60*24);
$('.center').animateCss('fadeOutLeft',function(){
thisday2card(thisday);
$('.center').animateCss('fadeInRight');
});
}else if(evt.direction==="Right"){
thisday = new Date(thisday.getTime()-1000*60*60*24);
$('.center').animateCss('fadeOutRight',function(){
thisday2card(thisday);
$('.center').animateCss('fadeInLeft');
});
}
}
});
</script>
</body>
</html>