-
Notifications
You must be signed in to change notification settings - Fork 52
/
index.html
382 lines (336 loc) · 11.8 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
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
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>simplyCountdown.js | A Tiny and dead simple Javascript Countdown Library</title>
<meta name="author" content="Vincent Loy"/>
<meta name="keywords" content="Vincent Loy, Javascript, Javascript Library, Javascript Countdown, jQuery Countdown, JS, JS Countdown, Countdown, Countup"/>
<meta name="description" content="simplyCountdown.js is an easy to use Javascript Countdown Library. You can easly customize it with your own CSS and versatile parameters."/>
<link href='http://fonts.googleapis.com/css?family=Lato:300,400italic' rel='stylesheet'
type='text/css'>
<link rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.3.0/css/font-awesome.min.css"/>
<link rel="stylesheet" href="css/simplyCountdown.theme.losange.css"/>
<link rel="stylesheet" href="css/simplyCountdown.theme.default.css"/>
<link rel="stylesheet" href="css/demo-only/prism.css"/>
<link rel="stylesheet" href="css/demo.css"/>
</head>
<body>
<header class="row center-xs">
<div class="header-content">
<h1>simplyCountdown.js</h1>
<h2>A Tiny Javascript Countdown Library</h2>
<div class="repo-buttons">
<a href="https://github.com/VincentLoy/simplyCountdown.js" class="button">
<i class="fa fa-github"></i> <span>View on GitHub</span>
</a>
<a href="https://github.com/VincentLoy/simplyCountdown.js/archive/master.zip"
class="button">
<i class="fa fa-download"></i> <span>Download Sources</span>
</a>
</div>
</div>
</header>
<main class="container">
<section class="intro">
<h2>Why another countdown ?</h2>
<p>
I developed this little library in a boring day. I regularly use this kind of
Javascript's
libraries to display countdowns on websites and this one exactly meets the needs that I
have.
It is perfect to make 'under construction' pages, etc.
</p>
<p>
This is a very (very) basic Javascript CountDown.
</p>
</section>
<section class="getting-started">
<h2>Getting Started</h2>
<h3>install via yarn, npm, <a
href="https://github.com/VincentLoy/simplyCountdown.js/archive/master.zip">direct
download</a></h3>
<pre>
<code class="language-console">
$ npm install simplycountdown.js
// or
$ yarn add simplycountdown.js
</code>
</pre>
<h3>Insert simplyCountdown to your HTML</h3>
<pre>
<code class="language-html">
<link rel="stylesheet" href="css/simplyCountdown.theme.default.css"/>
<script src="dist/simplyCountdown.min.js"></script>
</code>
</pre>
<pre>
<code class="language-javascript">
// This is an example with default parameters
// You'll always have to call simplyCountdown using ID's, no classes.
simplyCountdown('[CSS-SELECTOR]', {
year: 2015, // required
month: 6, // required
day: 28, // required
hours: 0, // Default is 0 [0-23] integer
minutes: 0, // Default is 0 [0-59] integer
seconds: 0, // Default is 0 [0-59] integer
words: { //words displayed into the countdown
days: { singular: 'day', plural: 'days' },
hours: { singular: 'hour', plural: 'hours' },
minutes: { singular: 'minute', plural: 'minutes' },
seconds: { singular: 'second', plural: 'seconds' }
},
plural: true, //use plurals
inline: false, //set to true to get an inline basic countdown like : 24 days, 4 hours, 2 minutes, 5 seconds
inlineClass: 'simply-countdown-inline', //inline css span class in case of inline = true
// in case of inline set to false
enableUtc: false,
onEnd: function () {
// your code
return;
},
refresh: 1000, //default refresh every 1s
sectionClass: 'simply-section', //section css class
amountClass: 'simply-amount', // amount css class
wordClass: 'simply-word', // word css class
zeroPad: false,
countUp: false, // enable count up if set to true
});
// Also, you can init with already existing Javascript Object.
let myElement = document.querySelector('.my-countdown');
simplyCountdown(myElement, { /* options */ });
let multipleElements = document.querySelectorAll('.my-countdown');
simplyCountdown(multipleElements, { /* options */ });
</code>
</pre>
<h3>You can use it with jQuery too (not required)</h3>
<pre>
<code class="language-javascript">
// jQuery Example
$('[SELECTOR]').simplyCountdown({
year: 2015, // required
month: 6, // required
day: 28, // required
...
});
</code>
</pre>
</section>
<section class="custom">
<h2>Easy to customize</h2>
<p>
You can easly customize the countdown using the css theme starter file or create your
own like so :
</p>
<div class="note">
<p>
<i class="fa fa-info"></i> The following theme template works with default
class in parameters
</p>
</div>
<pre>
<code class="language-css">
/**
* Project : simply-countdown
* File : simplyCountdown.theme.custom
* Author : Your Name <your-mail[at]example.com>
*/
.simply-countdown {
/* The countdown */
}
.simply-countdown > .simply-section {
/* coutndown blocks */
}
.simply-countdown > .simply-section > div {
/* countdown block inner div */
}
.simply-countdown > .simply-section .simply-amount,
.simply-countdown > .simply-section .simply-word {
/* amounts and words */
}
.simply-countdown > .simply-section .simply-amount {
/* amounts */
}
.simply-countdown > .simply-section .simply-word {
/* words */
}
</code>
</pre>
</section>
<section class="examples">
<h2>Examples</h2>
<h3>Default</h3>
<p>Displayed whithout jQuery - UTC enabled</p>
<div class="simply-countdown simply-countdown-one"></div>
<h3>Custom</h3>
<p>Displayed with jQuery - UTC disabled</p>
<div class="simply-countdown-losange" id="simply-countdown-losange"></div>
<h3>Inline</h3>
<p>Display a simple inline countdown</p>
<div class="simply-countdown-inline"></div>
<h3>countup</h3>
<p>countup Enabled option</p>
<div class="simply-countdown simply-countdown-countup" id="simply-countdown-countup"></div>
</section>
<section class="changelog">
<h2>Changelog</h2>
<h3>1.7.0</h3>
<ul>
<li>
Countdowns can be initialized directly with HTML elements with variables like
<ul>
<li>document.getElementById</li>
<li>document.querySelector</li>
<li>document.querySelectorAll</li>
<li>...etc</li>
</ul>
</li>
</ul>
<h3>1.6.0</h3>
<ul>
<li>
Compatibility with languages like german for plurals
(<a href="https://github.com/VincentLoy/simplyCountdown.js/pull/15" target="_blank">PR #15</a>),
Thanks to <a href="https://github.com/q30t" target="_blank">q30t</a>
</li>
<li>
Update readme
</li>
</ul>
<h3>1.5.0</h3>
<ul>
<li>Add countUp option (<a href="https://github.com/VincentLoy/simplyCountdown.js/issues/10" target="_blank">Resolve #10</a>)</li>
<li>Upgrade yarn dev dependencies</li>
<li>Some minor code reformatting</li>
</ul>
<h3>1.4.0</h3>
<ul>
<li>Remove bower support</li>
<li>migrate from LESS to SASS (scss) / for demo and themes</li>
<li>migrate lib from ES5 to a really basic ES6</li>
<li>Remove JSLint support</li>
<li>
Add ESLint support based on customized
<a href="https://www.npmjs.com/package/eslint-config-airbnb-base", target="_blank">airbnb rules</a>
</li>
</ul>
<h3>1.3.2</h3>
<ul>
<li>
add zeroPad parameter
</li>
<li>
fixed Flash of Unstyled Content
</li>
</ul>
<h3>1.3.1</h3>
<ul>
<li>
clean some code
</li>
<li>
add refresh parameter
</li>
</ul>
<h3>1.3.0</h3>
<ul>
<li>
Add onEnd callback
</li>
</ul>
<h3>1.2.0</h3>
<ul>
<li>
<a href="https://github.com/VincentLoy/simplyCountdown.js/issues/4"
rel="nofollow noopener"
target="_blank">
Resolve #4
</a> - Add UTC support adding enableUtc parameter
</li>
</ul>
<h3>1.1.1</h3>
<ul>
<li>
<a href="https://github.com/VincentLoy/simplyCountdown.min.js/issues/3"
rel="nofollow noopener"
target="_blank">
Resolve #3
</a> - Remove ID Only compatibility
</li>
</ul>
<h3>1.1.0</h3>
<ul>
<li>
Add hours, minutes, seconds in available settings to set the target Date
</li>
</ul>
<h3>1.0.1</h3>
<ul>
<li>
Fix console error when not using jQuery
</li>
</ul>
<h3>1.0.0</h3>
<ul>
<li>initial release</li>
</ul>
</section>
</main>
<footer>
<p>
Made with ❤ by
<a href="https://github.com/VincentLoy"
target="_blank">
Vincent Loy
</a>
</p>
</footer>
<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/0.0.1/prism.min.js"></script>
<script src="dev/simplyCountdown.js"></script>
<script>
/**
* WARNING: I set this coundtown to be running until the end of times.
* So when you'll init the plugin, follow how it's done in plugin documentation.
* e.g : instead of "month: d.getMonth() + 1" put "month: 10" for October.
*/
var d = new Date(),
countUpDate = new Date();
d.setDate(d.getDate() + 365);
// default example
simplyCountdown('.simply-countdown-one', {
year: d.getFullYear(),
month: d.getMonth() + 1,
day: d.getDate(),
enableUtc: true
});
// inline example
simplyCountdown('.simply-countdown-inline', {
year: d.getFullYear(),
month: d.getMonth() + 1,
day: d.getDate(),
inline: true
});
//jQuery example
$('#simply-countdown-losange').simplyCountdown({
year: d.getFullYear(),
month: d.getMonth() + 1,
day: d.getDate(),
enableUtc: false
});
// direct element injection & Count Up Example
var countUp = document.querySelector('.simply-countdown-countup');
simplyCountdown(countUp, {
year: countUpDate.getFullYear(),
month: countUpDate.getMonth() + 1,
day: countUpDate.getDate(),
hours: countUpDate.getHours(),
minutes: countUpDate.getMinutes(),
seconds: countUpDate.getSeconds(),
countUp: true
});
</script>
</body>
</html>