-
-
Notifications
You must be signed in to change notification settings - Fork 49
/
index.html
436 lines (422 loc) · 13.6 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
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
<!DOCTYPE html>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, user-scalable=no"
/>
<link rel="stylesheet" href="assets/css/main.css" />
<noscript
><link rel="stylesheet" href="assets/css/noscript.css"
/></noscript>
<script src="js/vue.min.js" language="JavaScript"></script>
<script src="js/jquery-3.4.1.min.js"></script>
<script src="js/html2canvas.min.js" async="async"></script>
<style>
img {
border-radius: 10px;
}
</style>
</head>
<body class="is-preload">
<!-- Loader -->
<link rel="stylesheet" href="assets/css/loader.css" />
<div class="loader">
<div class="container">
<h1>🍊</h1>
<p>摇匀</p>
<p>再喝</p>
</div>
</div>
<!-- Wrapper -->
<div id="wrapper">
<!-- Main -->
<section id="main">
<!-- Screenshot Button -->
<span
style="
display: flex;
position: fixed;
top: 2em;
right: 2em;
opacity: 0.65;
font-size: 0.8em;
"
v-show="backButton"
><button class="button small" @click="screenShot" id="screenshot">
保存网页截图
</button></span
>
<!-- Welcome Message and Contacts -->
<header v-show="Contacts">
<span class="avatar"
><img
src="images/avatar.jpg"
alt=""
style="width: 122px; height: 122px"
/></span>
<h1>Untitled</h1>
<transition-group name="fade">
<div v-show="defaults" key="text">
<p>Lorem</p>
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit.
Inventore facere accusamus quae nesciunt at fuga dicta vitae
quidem reiciendis. Quos blanditiis corporis vel iusto
reprehenderit ratione distinctio fugiat quae sed.
</p>
<button
class="button small fit"
@click="showAbout"
v-bind:disabled="onTransition==1"
>
Click!
</button>
</div>
<div
v-for="item in contacts"
v-if="item.show"
key="item.name"
v-html="item.content"
></div>
<button
class="button small"
key="button"
@click="hideContact(true)"
style="opacity: 0.55"
v-show="backButton"
>
返回
</button>
</transition-group>
</header>
<hr />
<footer v-show="Contacts">
<ul class="icons">
<li v-for="item in contacts">
<a @click="showContact(item.name)" :class="item.icon"
>{{item.desc}}</a
>
</li>
</ul>
</footer>
<!-- Page container -->
<header v-show="info">
<transition-group name="fade">
<h1 key="title">{{ title }}</h1>
<p key="text" v-for="text in texts">{{ text }}</p>
<div v-html="html" key="html"></div>
<img
v-bind:src="img"
key="img"
style="width: 95%; height: auto"
v-for="img in imgs"
/>
<div key="buttons">
<button
class="button small"
v-bind:disabled="(nowPage < startPage || onTransition==1)"
@click="navigate(-1)"
>
上一页
</button>
<button
class="button small"
v-bind:disabled="(nowPage >= endPage - 2 || onTransition==1)"
@click="navigate(1)"
>
下一页
</button>
</div>
<hr key="br" />
<button
@click="returnToContact"
key="button"
class="button fit"
v-bind:disabled="onTransition==1"
>
返回
</button>
</transition-group>
</header>
</section>
<!-- Footer -->
<footer id="footer"></footer>
</div>
<!-- Scripts -->
<script>
if ("addEventListener" in window) {
window.addEventListener("load", function () {
document.body.className = document.body.className.replace(
/\bis-preload\b/,
""
);
});
document.body.className += navigator.userAgent.match(/(MSIE|rv:11\.0)/)
? " is-ie"
: "";
}
</script>
<!-- Vuejs -->
<script language="javascript">
var mainsec = new Vue({
el: "#main",
data: {
title: "", // The title of one page
html: "", // HTML text of one page
texts: [], // Pure texts of one page
imgs: [], // Image url of a page's images
startPage: 1, // First page of the website
endPage: 3, // The last page of the website
defaults: 1, // Show welcome message
Contacts: 1, // Detect if to show contacts
info: 0, // If to show designed pages
deg: 0, // Main section rotate deg
backButton: false,
/* Change things below this line */
//Contact info
/**
* 有关下方icon的优化
* 因下方icon可以挂上用户自己的站点,所以做了如下修改
* jump为true,会直接跳转链接,链接为用户自定义的content字段
* jump为false,则是与原来一样。
*/
contacts: [
{
name: "Wechat",
icon: "icon brands fa-weixin",
desc: "微信",
content: "<img src='images/demoQR.png' class='qr' />",
show: false,
jump: false,
},
{
name: "QQ",
icon: "icon brands fa-qq",
desc: "QQ",
content:
"<img src='images/demoQR.png' class='qr' /><h2>QQ:XXXXXX</h2>",
show: false,
jump: false,
},
{
name: "Github",
icon: "icon brands fa-github",
desc: "Github",
content: "https://github.com/Jiaocz/Personal-page",
show: false,
jump: true,
},
],
//Pages content
page: [
{
title: "Page 1",
texts: [
"Lorem ipsum dolor sit amet consectetur adipisicing elit. Inventore facere accusamus quae nesciunt at fuga dicta vitae quidem reiciendis. Quos blanditiis corporis vel iusto reprehenderit ratione distinctio fugiat quae sed.",
],
html: "",
imgs: ["images/bg.jpg"],
},
{
title: "Page 2",
texts: ["Some text", "And some text"],
html: "<h2>HTML Support</h2>",
imgs: [""],
},
{
title: "Page 3",
texts: ["Multi images"],
imgs: ["images/bg.jpg", "images/demoQR.png"],
html: "",
},
{
title: "Page 4",
texts: ["Another Demo"],
html: '<a onclick="todonate()" style="color:#fff; background-color:#f0a1a8; border-radius: 0.3em; padding: 0.2em; cursor: pointer;"><<u>Donate!</u>></a><br /><p style="color:#ccc; font-size:0.7em;">Last updated: Apr. 14, 2021<p>',
imgs: [""],
},
{
title: "Eastern egg page!",
texts: ["Can only access with ?page=#"],
html: "<a href='https://github.com/Jiaocz/Personal-page' target='_blank'>Origin project</a>",
},
],
/* Change ends here */
nowPage: 0, // Pointer to current page
onTransition: 0, //If the transition animation is on
},
methods: {
showContact: function (name) {
let num = 0;
for (let i = 0; i < this.contacts.length; i++) {
if (this.contacts[i].name == name) {
num = i;
break;
}
}
if (this.contacts[num].jump == true) {
window.open(this.contacts[num].content);
return;
}
this.hideContact(false);
this.defaults = 0;
clearTimeout(this.timer);
this.timer = setTimeout(() => {
this.contacts[num].show = true;
this.backButton = true;
}, 500);
},
hideContact: function (neededDefault = true) {
for (i = 0; i < this.contacts.length; i++) {
this.contacts[i].show = false;
}
clearTimeout(this.timer);
if (neededDefault == true) {
this.backButton = false;
this.timer = setTimeout(() => {
this.defaults = 1;
}, 500);
}
},
showAbout: function () {
this.rotateCard(-360, 1, "Y");
var that = this;
setTimeout(function () {
that.info = 1;
that.Contacts = 0;
}, 400);
},
returnToContact: function () {
this.rotateCard(360, 1, "Y");
var that = this;
setTimeout(function () {
that.info = 0;
that.Contacts = 1;
}, 400);
},
rotateCard: function (deg, time, axis) {
this.onTransition = 1;
this.deg += deg;
var ele = document.getElementById("main");
ele.style.transition = "transform " + time + "s 0s";
ele.style.transform = "rotate" + axis + "(" + this.deg + "deg)";
var that = this;
setTimeout(function () {
that.onTransition = 0;
}, time * 1000);
},
loadPage: function () {
this.title = this.page[this.nowPage].title;
this.texts = this.page[this.nowPage].texts;
this.html = this.page[this.nowPage].html;
this.imgs = this.page[this.nowPage].imgs;
},
navigate: function (m) {
if (m == 1) {
this.nowPage++;
this.rotateCard(-360, 1, "Y");
setTimeout("mainsec.loadPage()", 400);
}
if (m == -1) {
this.nowPage--;
this.rotateCard(+360, 1, "Y");
setTimeout("mainsec.loadPage()", 400);
}
},
screenShot: function () {
var button = document.getElementById("screenshot");
button.disabled = true;
button.innerHTML = "截图中…";
html2canvas(document.body).then((canvas) => {
var w = window.open();
w.document.title = "保存截图";
var i = w.document.createElement("img");
w.document.body.appendChild(i);
i.src = canvas.toDataURL("image/jpg");
w.alert("长按图片或直接保存图片即可");
button.innerHTML = "保存网页截图";
button.disabled = false;
});
},
},
mounted: function () {
this.loadPage();
this.startPage = 1;
this.endPage = this.page.length;
},
});
</script>
<style>
.fade-enter-active,
.fade-leave-active {
transition: all 0.5s;
}
.fade-enter,
.fade-leave-to {
opacity: 0;
transform: scale(0%, 0%);
}
.qr {
text-align: center;
width: 80%;
height: 80%;
}
</style>
<script>
let FirstTriggered = true;
function loaded() {
timeout = FirstTriggered ? 1200 : 0;
var page = getQueryVariable("page");
if (page >= mainsec.startPage && page <= mainsec.endPage && page) {
var m = mainsec;
mainsec.nowPage = page - 1;
setTimeout(function () {
m.rotateCard(-360, 1, "Y");
setTimeout(function () {
m.loadPage();
m.info = 1;
m.Contacts = 0;
}, 400);
}, timeout);
}
if (FirstTriggered) {
$("body").on("dblclick", "img", function () {
window.open(this.src);
});
}
if (
getQueryVariable("showContacts") ||
getQueryVariable("showcontacts")
) {
var url;
var browser = navigator.userAgent.toLowerCase();
if (mainsec.info == 1) {
mainsec.returnToContact();
}
if (browser.match(/MicroMessenger/i) == "micromessenger") {
//微信浏览器
url = "https://u.wechat.com/EO3JtzoXctOZXiAG8tvYHuI";
setTimeout(function () {
mainsec.showContact("Wechat");
}, 1500);
} else if (
browser.indexOf(" qq") != -1 &&
browser.indexOf("mqqbrowser") != -1
) {
//qq内置浏览器
url =
"https://qm.qq.com/cgi-bin/qm/qr?k=OZm0covTGqrELIwI0XKV6LxlKsCcLIsm";
setTimeout(function () {
mainsec.showContact("QQ");
}, 1500);
}
}
FirstTriggered = false;
}
</script>
<script src="js/common.js"></script>
</body>
</html>