This repository has been archived by the owner on Jul 17, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.html
104 lines (92 loc) · 2.89 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
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>←_← →_→</title>
<link rel="shortcut icon" type="image/x-icon" href="laji.png">
<style>
body {
position: relative;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
cursor: url('laji.png'), default;
margin: 0;
}
.mouse {
position: absolute;
width: 30px;
height: 30px;
background: url('laji.png') center right no-repeat;
-webkit-transition: -webkit-transform 2s ease-in-out;
transition: -webkit-transform 2s ease-in-out;
transition: transform 2s ease-in-out;
transition: transform 2s ease-in-out, -webkit-transform 2s ease-in-out;
}
</style>
</head>
<body>
<script>
'use strict';
(function () {
var length = parseInt(_('n')) || 666;
var timeout = parseInt(_('t')) || 50;
var bgImg = _('b');
var height = 30;
var width = 30;
var index = 0;
function _(key) {
var result = null;
var tmp = [];
location.search.substr(1).split('&').forEach(function (v) {
tmp = v.split('=');
if (tmp[0] === key) {
result = decodeURIComponent(tmp[1]);
}
});
return result;
}
function update(element) {
var cW = document.body.clientWidth / 2 - width / 2;
var cH = document.body.clientHeight / 2 - height / 2;
var mL = Math.floor(Math.random() * (cW * 2 + 1) - cW);
var mT = Math.floor(Math.random() * (cH * 2 + 1) - cH);
element.style.transform = 'translate(' + mL + 'px, ' + mT + 'px)';
}
if (bgImg) {
var img = new Image();
img.src = bgImg;
img.onload = function () {
var style = document.createElement('style');
width = img.width;
height = img.height;
style.textContent = 'body { cursor: url(' + bgImg + '), default;}.mouse { width: ' + width + 'px; height: ' + height + 'px; background-image: url(' + bgImg + ');}';
document.head.appendChild(style);
};
}
var _loop = function _loop() {
var $mouse = document.createElement('div');
$mouse.classList = 'mouse';
$mouse.style.transitionDelay = index * 25 + 'ms';
$mouse.addEventListener('transitionend', function () {
update($mouse);
}, false);
setTimeout(function () {
document.body.appendChild($mouse);
update($mouse);
}, index * timeout);
};
for (; index < length; index++) {
_loop();
}
})();
</script>
</body>
</html>