forked from jojoee/add2calendar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
146 lines (124 loc) · 3.5 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
<!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;
padding-top: 60px;
}
.event-wrap {
border: 1px solid #eee;
padding: 6px;
margin: 6px;
clear: both;
}
.title {
font-family: monospace;
padding-bottom: 12px;
}
.event-box {
padding: 6px;
}
</style>
</head>
<body>
<div class="wrap">
<div class="event-wrap">
<div class="title">
Single event
</div>
<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">
Multi events
</div>
<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',
start : startDate,
end : endDate,
location : 'Bangkok, Thailand',
description : 'Welcome everyone to simple plugin that allow you to add event to calendar easily.'
};
var singleEvent = new Add2Calendar(singleEventArgs);
// 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 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'
}
];
// widget 1 - normal
var multiEvents = new Add2Calendar(multiEventsArgs);
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>