-
Notifications
You must be signed in to change notification settings - Fork 6
/
test.html
344 lines (294 loc) · 11.8 KB
/
test.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
<!--
##########################################
Deemo 复刻
「古树旋律游戏界面复刻」
##########################################
Designed by Mashiro.
所有素材版权为雷亞遊戲(Rayark Inc.)所有。
https://github.com/mashirozx/deemo
-->
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="UTF-8">
<title>Deemo 复刻 - by Mashiro</title>
<meta charset="utf-8">
<meta name="description" content="「Deemo 曲绘集 Online」">
<meta name="keywords" content="Deemo, 复刻, Mashiro, 曲封">
<meta name="viewport" content="width=device-width,user-scalable=no,maximum-scale=1">
<meta property="og:url" content="https://deemo.shino.cc">
<meta property="og:image" content="/apple-touch-icon.png">
<meta property="og:type" content="website">
<meta property="og:title" content="Deemo 复刻 - by Mashiro">
<meta property="og:site_name" content="deemo.shino.cc">
<meta property="og:description" content="Deemo 复刻 - by Mashiro">
<meta property="og:locale" content="zh_CN">
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
<link rel="manifest" href="/site.webmanifest">
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5">
<meta name="msapplication-TileColor" content="#da532c">
<meta name="theme-color" content="#ffffff">
<link rel="stylesheet" href="style.css">
<style>
html,
body {
background-color: #fff;
}
mashiro,
.bt {
opacity: 0
}
</style>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-100439904-6"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag('js', new Date());
gtag('config', 'UA-100439904-6');
</script>
</head>
<body>
<mashiro>
<div class="slideshow-container">
@python-work-area
<a class="prev" onclick="plusSlides(-1)">❮</a>
<a class="next" onclick="plusSlides(1)">❯</a>
</div>
<div class="dear-alice">To the lovely, lonely stranger<br>And my dearest brother,<br>Hans.
<p>-Alice</p>
</div>
<div class="signature">Crafted with <img src="src/love.svg" style="height:0.8em;width:0.8em" alt="love" /> by <a href="https://2heng.xin" target="_blank">Mashiro</a></div>
<div class="photo bt">
<a href="javascript:screenshot();">
<div class="pop"><img src="src/camera.svg" class="css-1bgbwga" data-reactid="50"></div>
</a>
</div>
<div class="iplayer bt">
<div class="speaker" id="speaker"></div>
<img src="src/pause.svg" style="width:0;height:0;">
</div>
<div class="random bt">
<a href="javascript:randomClick();">
<div class="pop"><img src="src/sand-clock.svg" class="sand-clock" data-reactid="50"></div>
</a>
</div>
<div class="github bt">
<a href="https://github.com/mashirozx/deemo" target="_blank">
<div class="pop"><img src="src/github.svg" class="css-1bgbwga" data-reactid="50"></div>
</a>
</div>
<div class="weibo bt">
<a href="https://weibo.com/2960337711" target="_blank">
<div class="pop"><img src="src/weibo.svg" class="css-1bgbwga" data-reactid="50"></div>
</a>
</div>
<div class="wordpress bt">
<a href="https://2heng.xin/" target="_blank">
<div class="pop"><img src="src/wordpress.svg" class="css-1bgbwga" data-reactid="50"></div>
</a>
</div>
<div id="screenshot" class="overlay">
<div class="save bt">
<a href="javascript:downloadCanvas();">
<div class="pop"><img src="src/save.svg" class="css-1bgbwga" data-reactid="50"></div>
</a>
</div>
<div class="popup">
<a class="close" href="#">×</a>
<div id="scerrn-content"></div>
</div>
</div>
<div id="message" class="overlay">
<div class="popup normal">
<a class="close" href="#">×</a>
<div class="content">
<p>建议用屏幕宽度大于1100px的电脑访问。手机的话把屏幕<img src="src/rotate.svg" style="height:1em;width:1em" />试试?</p>
<p>正常视图是这样的~</p>
<img src="src/Capture.png" style="width:100%">
</div>
</div>
</div>
</mashiro>
<audio loop="loop" id="player">
<source src="src/Riin - Alice good night.mp3" type="audio/mpeg">
</audio>
<script src="src/main.js"></script>
<script>
"use strict";
if (screen.width <= 1100) {
location.href = "#message";
}
var slideIndex = 1;
var imgTargets = document.getElementsByClassName("deemo-draw");
Pace.on('done', function() {
document.getElementsByTagName("mashiro")[0].style.opacity = "1";
true ? randomSlide() : showSlides(slideIndex);
for (var i = 0; i < document.getElementsByClassName("bt").length; i++) {
document.getElementsByClassName("bt")[i].style.opacity = "1";
}
});
// Timeout
var int = self.setInterval("randomSlide()", 6000);
function plusSlides(n) {
showSlides(slideIndex += n);
try {
int = window.clearInterval(int);
document.getElementsByClassName("sand-clock")[0].style.transform = "rotate(0deg)";
randomFlag = 1;
} catch (err) {}
}
function showSlides() {
var i;
var slides = document.getElementsByClassName("mySlides");
// control
if (slideIndex == 0) {
slideIndex = imgTargets.length;
} else if (slideIndex == imgTargets.length + 1) {
slideIndex = 1;
}
// title
document.title = (slideIndex) + '/' + slides.length + ' | Deemo 复刻 - by Mashiro';
// load
lazyload(slideIndex - 1);
// hide
for (i = 0; i < slides.length; i++) {
slides[i].style.opacity = 0;
}
// check load condition
imgLoad((slideIndex - 1), function() {
// display
slides[slideIndex - 1].style.opacity = 1;
});
// preload
//if (slideIndex < imgTargets.length) {
// lazyload(slideIndex - 1 + 1);
//}
//if (slideIndex > 1) {
// lazyload(slideIndex - 1 - 1);
//}
}
// check picture load condition
function imgLoad(n, callback) {
var timer = setInterval(function() {
if (imgTargets[n].complete) {
callback(imgTargets[n]);
clearInterval(timer);
}
}, 50)
}
function lazyload(n) {
try {
imgTargets[n].setAttribute("src", imgTargets[n].getAttribute("data-src"));
} catch (err) {
console.log("error = " + n);
}
}
// Random
function randomSlide() {
var rand = Math.floor(Math.random() * (imgTargets.length + 1));
showSlides(slideIndex = rand);
}
var randomFlag = 0;
function randomClick() {
if (randomFlag == 1) {
int = self.setInterval("randomSlide()", 6000);
document.getElementsByClassName("sand-clock")[0].style.transform = "rotate(20deg)";
randomSlide();
randomFlag = 0;
} else {
int = window.clearInterval(int);
document.getElementsByClassName("sand-clock")[0].style.transform = "rotate(0deg)";
randomFlag = 1;
}
}
function saveFile(url) {
var date = new Date();
var filename = "deemo-";
filename = filename + date.getTime();
filename = filename + ".png";
var xhr = new XMLHttpRequest();
xhr.responseType = 'blob';
xhr.onload = function() {
var a = document.createElement('a');
a.href = window.URL.createObjectURL(xhr.response);
a.download = filename;
a.style.display = 'none';
document.body.appendChild(a);
a.click();
//a = null;
};
xhr.open('GET', url);
xhr.send();
}
function downloadCanvas() {
var src = document.getElementsByTagName("canvas");
var img = src[src.length - 1].toDataURL("image/png");
saveFile(img);
}
function screenshot() {
var sholdHide = new Array("photo", "iplayer", "random", "weibo", "github", "wordpress", "signature", "prev", "next");
for (var i = 0; i < sholdHide.length; i++) document.getElementsByClassName(sholdHide[i])[0].style.visibility = 'hidden';
let opt = {
async: true,
useCORS: true
};
html2canvas(document.body, opt).then(function(canvas) {
document.getElementById("scerrn-content").appendChild(canvas);
location.href = "#screenshot";
});
for (var i = 0; i < sholdHide.length; i++) document.getElementsByClassName(sholdHide[i])[0].style.visibility = 'visible';
}
// Player
function hasClass(el, className) {
if (el.classList)
var e = el.classList.contains(className);
else
var e = new RegExp('(^| )' + className + '( |$)', 'gi').test(el.className);
return e;
}
function addClass(el, className) {
if (el.classList)
el.classList.add(className);
else
el.className += ' ' + className;
}
function removeClass(el, className) {
if (el.classList)
el.classList.remove(className);
else
el.className = el.className.replace(new RegExp('(^|\\b)' + className.split(' ').join('|') + '(\\b|$)', 'gi'), ' ');
}
var getaudio = document.getElementById("player");
var audiostatus = 'off';
var speaker = document.getElementById("speaker");
speaker.addEventListener("click", function() {
// on touchend?
if (!hasClass(speaker, "speakerplay")) {
if (audiostatus == 'off') {
addClass(speaker, 'speakerplay');
getaudio.load();
getaudio.play();
audiostatus = 'on';
return false;
} else if (audiostatus == 'on') {
addClass(speaker, 'speakerplay');
getaudio.play()
}
} else if (hasClass(speaker, "speakerplay")) {
getaudio.pause();
removeClass(speaker, 'speakerplay');
audiostatus = 'on';
}
});
document.getElementById("player").addEventListener("ended", function() {
removeClass(speaker, 'speakerplay');
audiostatus = 'off';
});
</script>
</body>
</html>