-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathslither-container.html
122 lines (109 loc) · 3.04 KB
/
slither-container.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
<!DOCTYPE html>
<html>
<head>
<style>
html, body {
height: 100%;
margin: 0;
}
html {
width: 100%;
}
body {
text-align: center;
vertical-align: middle;
background-color: black;
overflow: hidden;
}
.brpanel {
position: fixed;
bottom: 2px;
right: 2px;
opacity: 0.4;
background-color: transparent;
user-select: none;
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
}
.clock {
font-weight: bold;
font-size: 200%;
color: red;
cursor: default;
}
.fsbutton {
font-weight: bold;
font-size: 130%;
color: lightgray;
cursor: pointer;
border: 0;
}
.slither-frame {
border: 0;
}
</style>
</head>
<body>
<div class="brpanel">
<div class="clock" id="clock">12:00 AM</div>
<div class="fsbutton" id="fsbutton">FULLSCREEN</div>
</div>
<iframe class="slither-frame" id="slither" src="https://slither.io/"></iframe>
<script type="text/javascript">
var iframe = document.getElementById("slither");
iframe.onblur = function () {
iframe.focus()
};
window.onresize = function () {
var min = Math.min(window.innerHeight, window.innerWidth);
iframe.width = min;
iframe.height = min;
};
window.onresize();
var fsbutton = document.getElementById("fsbutton");
fsbutton.onclick = function () {
if (document.fullscreen || document.webkitIsFullScreen || document.mozFullScreen) {
var efs = document.exitFullscreen
|| document.webkitExitFullscreen
|| document.mozCancelFullScreen
|| document.msExitFullscreen
;
efs.call(document);
} else {
var el = document.documentElement;
var rfs = el.requestFullscreen
|| el.webkitRequestFullScreen
|| el.mozRequestFullScreen
|| el.msRequestFullscreen
;
rfs.call(el);
}
fsbutton.blur();
iframe.focus();
};
var clock = document.getElementById('clock');
function setClock() {
var d = new Date();
var nhour = d.getHours(), nmin = d.getMinutes(), ap;
if (nhour == 0) {
ap = " AM";
nhour = 12;
} else if (nhour < 12) {
ap = " AM";
} else if (nhour == 12) {
ap = " PM";
} else if (nhour > 12) {
ap = " PM";
nhour -= 12;
}
if (nmin <= 9) {
nmin = "0" + nmin;
}
clock.innerText = "" + nhour + ":" + nmin + ap;
}
setClock();
setInterval(setClock, 1000);
</script>
</body>
</html>