-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathindex.html
190 lines (155 loc) · 4.76 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
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
<!DOCTYPE html>
<html lang="en-US" prefix="og: http://ogp.me/ns#">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>Add2Calendar</title>
<link rel="stylesheet" href="css/add2calendar.css">
<style>
* {
margin: 0;
padding: 0;
}
body {
background-color: #fff;
}
.wrap {
margin: 0 auto;
max-width: 600px;
}
.event-wrap {
border: 1px solid #eee;
padding: 6px;
margin: 6px;
clear: both;
}
.title {
font-family: monospace;
padding-bottom: 12px;
}
.event-box {
padding: 6px;
}
.event-code {
overflow: auto;
}
</style>
</head>
<body>
<div class="wrap">
<div class="event-wrap">
<div class="title">
Single event
</div>
<pre class="event-code"><code id="single-event-code"></code></pre>
<div class="event-box" id="single-normal"></div>
<div class="event-box" id="single-set-lang"></div>
<div class="event-box" id="single-set-button-text"></div>
<div class="event-box" id="single-reset-option"></div>
</div>
<div class="event-wrap">
<div class="title">
Single event with isAllDay
</div>
<pre class="event-code"><code id="single-event-with-isallday-code"></code></pre>
<div class="event-box" id="single-event-with-isallday"></div>
</div>
<div class="event-wrap">
<div class="title">
Multi events
</div>
<pre class="event-code"><code id="multi-normal-code"></code></pre>
<div class="event-box" id="multi-normal"></div>
<div class="event-box" id="multi-set-lang"></div>
<div class="event-box" id="multi-set-button-text"></div>
<div class="event-box" id="multi-reset-option"></div>
</div>
<div>
<script src="js/add2calendar.js"></script>
<script>
/*================================ Single Event
*/
var startDate,
endDate;
var tmp = new Date();
tmp.setDate(tmp.getDate() + 7); // next 7 days
startDate = tmp.toString();
tmp.setDate(tmp.getDate() + 1); // next 8 days
endDate = tmp.toString();
var singleEventArgs = {
title : 'Add2Calendar plugin event ;,/?:@&=+$# contains special characters',
start : startDate,
end : endDate,
location : 'Bangkok, Thailand',
description : 'Welcome everyone to simple plugin that ;,/?:@&=+$#.'
};
var singleEvent = new Add2Calendar(singleEventArgs);
// code
document.getElementById('single-event-code').innerHTML = JSON.stringify(singleEvent.eventData, '', 2)
// widget 1 - normal
singleEvent.createWidget('#single-normal', function() {
console.log('#single-normal widget has been created');
});
// widget 2 - custom lang
singleEvent.setOption({ lang: 'cn' });
singleEvent.createWidget('#single-set-lang');
// widget 3 - custom button text
singleEvent.setOption({ buttonText: 'Custom button text' });
singleEvent.createWidget('#single-set-button-text');
// widget 4 - reset option
singleEvent.resetOption();
singleEvent.createWidget('#single-reset-option');
/*================================ Multiple events
*/
var singleEventWithIsAllDayArgs = {
title : 'Single event with isAllDay',
start : startDate,
end : endDate,
description : 'my description',
isAllDay : true,
};
var singleEventWithIsAllDay = new Add2Calendar(singleEventWithIsAllDayArgs);
// code
document.getElementById('single-event-with-isallday-code').innerHTML = JSON.stringify(singleEventWithIsAllDay.eventData, '', 2)
// widget 1 - normal
singleEventWithIsAllDay.createWidget('#single-event-with-isallday', function() {
console.log('#single-event-with-isallday widget has been created');
});
/*================================ Multiple events
*/
var multiEventsArgs = [
{
title : 'Add2Calendar plugin event 1',
start : 'July 27, 2016 10:30',
end : 'July 27, 2016 19:30',
location : 'Bangkok, Thailand',
description : 'Event description 1'
},
{
title : 'Add2Calendar plugin event 2',
start : 'July 28, 2016 10:30',
end : 'July 29, 2016 19:20',
location : 'Bangkok, Thailand',
description : 'Event description 2'
}
];
var multiEvents = new Add2Calendar(multiEventsArgs);
// code
document.getElementById('multi-normal-code').innerHTML = JSON.stringify(multiEvents.eventData, '', 2)
// widget 1 - normal
multiEvents.createWidget('#multi-normal', function() {
console.log('#multi-normal widget has been created');
});
// widget 2 - custom lang
multiEvents.setOption({ lang: 'cn' });
multiEvents.createWidget('#multi-set-lang');
// widget 3 - custom button text
multiEvents.setOption({ buttonText: 'Custom button text' });
multiEvents.createWidget('#multi-set-button-text');
// widget 4 - reset option
multiEvents.resetOption();
multiEvents.createWidget('#multi-reset-option');
</script>
</body>
</html>