-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcountdown.html
79 lines (66 loc) · 1.92 KB
/
countdown.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
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>Countdown</title>
<link rel="stylesheet" href="./css/app-countdown.css">
<link rel="stylesheet" href="./css/fireworks.css">
<link rel="stylesheet" href="./js/widgets/css/Countdown.css">
<script src="//ajax.googleapis.com/ajax/libs/dojo/1.10.3/dojo/dojo.js"
data-dojo-config="
async: true,
packages: [{
name: 'widgets',
location: location.pathname.replace(/\/[^/]+$/, '') + '/js/widgets'
}]"></script>
</head>
<body>
<div class="nav">
<a class="hoverHighlight" href="./index.html">< Back</a> | Countdown
</div>
<div id="countdown"></div>
<aside id="library">
<img src="lib/fireworks/images/big-glow.png" id="big-glow" />
<img src="lib/fireworks/images/small-glow.png" id="small-glow" />
</aside>
<script src="lib/fireworks/js/requestanimframe.js"></script>
<script src="lib/fireworks/js/fireworks.js"></script>
<script>
require([
"widgets/Countdown",
"dojo/domReady!"
], function(Countdown) {
var countdown = new Countdown({
goalTime: 5 // seconds
}, "countdown");
countdown.startup();
startDemo();
function startDemo () {
countdown.startCountdown();
}
// react to launch event
countdown.on("launch", function () {
launchFireworks();
resetDemo();
});
function launchFireworks () {
for (var i = 0; i < 10; i++) {
document.dispatchEvent(new MouseEvent("mouseup", {
bubbles: true,
cancelable: true,
view: window,
target: window
}));
}
}
function resetDemo () {
// restart countdown after a pause
setTimeout(function () {
countdown.resetCountdown();
startDemo();
}, 3000);
}
});
</script>
</body>
</html>