-
Notifications
You must be signed in to change notification settings - Fork 3.9k
/
Copy pathamp-date-countdown.amp.html
143 lines (136 loc) · 4.97 KB
/
amp-date-countdown.amp.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
<!doctype html>
<html ⚡ lang="en">
<head>
<meta charset="utf-8">
<title>amp-date-countdown example</title>
<link rel="canonical" href="amps.html">
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">
<style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript>
<style amp-custom>
amp-date-countdown {
display: block;
}
h1{
color: #396;
font-weight: 100;
font-size: 20px;
}
#clockdiv{
font-family: sans-serif;
color: #fff;
display: inline-block;
font-weight: 100;
text-align: center;
font-size: 20px;
background: #00ECB9;
padding: 20px;
}
#clockdiv > div{
padding: 10px;
border-radius: 3px;
background: #00BF96;
display: inline-block;
}
#clockdiv div > span{
padding: 15px;
border-radius: 3px;
background: #00816A;
display: inline-block;
}
.smalltext{
padding-top: 5px;
font-size: 16px;
}
.date-count-down {
color: blue;
}
.date-count-down span{
color: red;
}
#sample2 {
visibility: hidden;
}
</style>
<script async custom-element="amp-date-countdown" src="https://cdn.ampproject.org/v0/amp-date-countdown-0.1.js"></script>
<script async custom-template="amp-mustache" src="https://cdn.ampproject.org/v0/amp-mustache-latest.js"></script>
<script async custom-element="amp-animation" src="https://cdn.ampproject.org/v0/amp-animation-0.1.js"></script>
<script async src="https://cdn.ampproject.org/v0.js"></script>
</head>
<body>
<amp-animation id="hide-timeout-event" layout="nodisplay">
<script type="application/json">
{
"duration": "1s",
"fill": "both",
"selector": "#ampdate, #sample",
"keyframes": { "visibility": "hidden"}
}
</script>
</amp-animation>
<amp-animation id="show-timeout-event" layout="nodisplay">
<script type="application/json">
{
"duration": "1s",
"fill": "both",
"selector": "#sample2",
"keyframes": { "visibility": "visible"}
}
</script>
</amp-animation>
<h1 id="sample">
When Timer hits 0, will hide the timer itself and hide this message.
</h1>
<h1 id="sample2">
When Timer hits 0, will hide the timer itself and display this message.
</h1>
<amp-date-countdown id="ampdate" end-date="2018-03-15T10:48:20+08:00" on="timeout: hide-timeout-event.start, show-timeout-event.start" height="235" width="400" when-ended="stop" locale='en'>
<template type="amp-mustache">
<h1>Countdown Clock</h1>
<div id="clockdiv">
{{#d}}
<div>
<span class="d">{{d}}</span>
<div class="smalltext">{{days}}</div>
</div>
{{/d}}
{{#h}}
<div>
<span class="h">{{h}}</span>
<div class="smalltext">{{hours}}</div>
</div>
{{/h}}
<div>
<span class="m">{{m}}</span>
<div class="smalltext">{{minutes}}</div>
</div>
<div>
<span class="s">{{s}}</span>
<div class="smalltext">{{seconds}}</div>
</div>
</div>
<div class="date-count-down">
{{#d}} {{dd}} <span>{{days}}</span> {{/d}}
{{#hh}} {{h}} <span>{{hours}}</span> {{/hh}}
{{#mm}} {{mm}} <span>{{minutes}}</span> {{/mm}}
{{ss}} <span>{{seconds}}</span>
</div>
<div>
{{dd}} : {{hh}} : {{mm}} : {{ss}}
</div>
</template>
</amp-date-countdown>
<template type="amp-mustache" id="myTemplate">
<div class="date-count-down">
{{#d}} {{d}} <span>{{days}}</span> {{/d}}
{{h}} <span>{{hours}}</span>
{{m}} <span>{{minutes}}</span>
{{s}} <span>{{seconds}}</span>
</div>
</template>
<!-- Should support the `template` attribute to reference <template> by ID. -->
<amp-date-countdown timestamp-ms="1521880470000" offset-seconds="1521880470" when-ended="stop" locale='zh-tw' height="50" width="360" template="myTemplate">
</amp-date-countdown>
<amp-date-countdown timestamp-seconds="1521880470" offset-seconds="1521880470" when-ended="continue" locale='de' height="50" width="360" template="myTemplate">
</amp-date-countdown>
</body>
</html>