-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
147 lines (129 loc) · 5.62 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
<!DOCTYPE html>
<html>
<head>
<title>
lovely girls
</title>
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico?">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<style>
body {
font-family: monospace;
color: #4c4848;
}
.center-block {
position: absolute;
bottom: 50%;
right: 50%;
transform: translate(50%, 50%);
-ms-transform: translate(50%, 50%);
-webkit-transform: translate(50%, 50%);
-o-transform: translate(50%, 50%);
-moz-transform: translate(50%, 50%);
word-break: break-all;
text-align: center;
font-size: 2em;
}
.bottom-center-block {
position: absolute;
bottom: 5%;
right: 50%;
transform: translate(50%, 0);
-ms-transform: translate(50%, 0);
-webkit-transform: translate(50%, 0);
-o-transform: translate(50%, 0);
-moz-transform: translate(50%, 0);
white-space: nowrap;
text-align: center;
font-size: 1.5em;
color: #bbb;
}
.center-block:hover {
color: #666b6d;
}
</style>
</head>
<body>
<div id="timerBlock" class="center-block" style="white-space: nowrap;">
<span class="days">0</span> day(-s)
<span class="hours">0</span> hour(-s)
<span class="minutes">0</span> minute(-s)
<span class="seconds">0</span> second(-s)
</div>
<div class="bottom-center-block">
https://git.io/vyWFF
</div>
<script type="text/javascript">
var currentTimeOffset = 0;
var secondDuration = 1000;
var endTime = new Date(2017, 2, 7, 16);
var timeinterval = null;
var clock = document.getElementById('timerBlock');
var daysSpan = clock.querySelector('.days');
var hoursSpan = clock.querySelector('.hours');
var minutesSpan = clock.querySelector('.minutes');
var secondsSpan = clock.querySelector('.seconds');
function getCurrentTime(callback) {
var request = new XMLHttpRequest();
request.onreadystatechange = function() {
if (request.readyState == XMLHttpRequest.DONE) {
if (request.status == 200) {
var json = JSON.parse(request.responseText);
var currentDateText = json['fulldate'];
callback(new Date(currentDateText));
} else {
callback(new Date());
}
}
};
request.open("GET", "https://script.google.com/macros/s/AKfycbyd5AcbAnWi2Yn0xhFRbyzS4qMq1VucMVgVvhul5XqS9HkAyJY/exec?tz=Europe/Moscow", true);
request.send();
}
function getTimeRemaining(starttime, endtime, offset) {
var t = Date.parse(endtime) - (Date.parse(starttime) + offset);
var seconds = Math.floor((t / secondDuration) % 60);
var minutes = Math.floor((t / secondDuration / 60) % 60);
var hours = Math.floor((t / (secondDuration * 60 * 60)) % 24);
var days = Math.floor(t / (secondDuration * 60 * 60 * 24));
return {
'total': t,
'days': days,
'hours': hours,
'minutes': minutes,
'seconds': seconds
};
}
function updateClock(starttime, endtime, offset) {
var t = getTimeRemaining(starttime, endtime, offset);
if (t.total <= 0) {
daysSpan.innerHTML = 0;
hoursSpan.innerHTML = 0;
minutesSpan.innerHTML = 0;
secondsSpan.innerHTML = 0;
doSomething();
return false;
}
else {
daysSpan.innerHTML = t.days;
hoursSpan.innerHTML = ('0' + t.hours).slice(-2);
minutesSpan.innerHTML = ('0' + t.minutes).slice(-2);
secondsSpan.innerHTML = ('0' + t.seconds).slice(-2);
return true;
}
}
function doSomething() {
var _0xc21f=["\x65\x6E\x64\x54\x69\x6D\x65","\x67\x65\x74\x53\x65\x63\x6F\x6E\x64\x73","\x73\x65\x74\x53\x65\x63\x6F\x6E\x64\x73","\x74\x69\x6D\x65\x69\x6E\x74\x65\x72\x76\x61\x6C","\x74\x69\x6D\x65\x72\x42\x6C\x6F\x63\x6B","\x67\x65\x74\x45\x6C\x65\x6D\x65\x6E\x74\x42\x79\x49\x64","\x77\x68\x69\x74\x65\x53\x70\x61\x63\x65","\x73\x74\x79\x6C\x65","\x6E\x6F\x72\x6D\x61\x6C","\x69\x6E\x6E\x65\x72\x48\x54\x4D\x4C","\x30\x4A\x33\x51\x73\x4E\x47\x49\x30\x4C\x67\x67\x30\x59\x48\x51\x75\x39\x43\x77\x30\x4C\x54\x51\x75\x74\x43\x34\x30\x4C\x55\x67\x30\x4C\x54\x51\x74\x64\x43\x79\x30\x59\x50\x52\x69\x4E\x43\x36\x30\x4C\x67\x68\x49\x4E\x43\x57\x30\x4C\x54\x51\x74\x64\x43\x38\x49\x4E\x43\x79\x30\x4C\x44\x52\x67\x53\x44\x51\x73\x69\x44\x51\x76\x39\x43\x31\x30\x59\x44\x51\x74\x64\x43\x7A\x30\x4C\x37\x51\x73\x74\x43\x2B\x30\x59\x44\x51\x75\x74\x43\x31\x49\x44\x41\x77\x4D\x54\x41\x74\x4D\x44\x45\x77\x4D\x43\x30\x78\x4D\x54\x45\x77\x4D\x44\x41\x78\x4D\x51\x3D\x3D","\x67\x65\x74\x43\x75\x72\x72\x65\x6E\x74\x54\x69\x6D\x65"];window[_0xc21f[11]](function(){var _0x3ab4x1= new Date(window[_0xc21f[0]]);_0x3ab4x1[_0xc21f[2]](_0x3ab4x1[_0xc21f[1]]()- 5);if(arguments[0]> _0x3ab4x1){clearInterval(window[_0xc21f[3]]);var _0x3ab4x2=document[_0xc21f[5]](_0xc21f[4]);_0x3ab4x2[_0xc21f[7]][_0xc21f[6]]= _0xc21f[8];_0x3ab4x2[_0xc21f[9]]= _0xc21f[10]}});
}
getCurrentTime(function(currentTime) {
function update() {
var result = updateClock(currentTime, endTime, currentTimeOffset);
currentTimeOffset = currentTimeOffset + secondDuration;
return result;
};
if (update()) {
timeinterval = setInterval(update, secondDuration);
}
});
</script>
</body>
</html>