-
Notifications
You must be signed in to change notification settings - Fork 1
/
page.html
136 lines (117 loc) · 4.43 KB
/
page.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
<!doctype html>
<html lang="en">
<head>
<title>One Tiny Game</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, shrink-to-fit=no, minimum-scale=1.0">
<meta name="description" content="">
<link rel="shortcut icon" href="icon.png">
<link rel="apple-touch-icon" href="icon.png">
<script defer data-domain="one.fserb.com" src="https://metaphora.co/plausible.js"></script>
<style>
/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}main{display:block}h1{font-size:2em;margin:.67em 0}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{border-style:none;padding:0}[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring,button:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:.35em .75em .625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none}
html {
scroll-snap-type: block proximity;
width: 100%;
}
body {
display: flex;
margin: 20px;
font-family: verdana;
background-color: #F2F0E5;
overflow: auto;
}
h1 {
color: #212123;
font-size: 250%;
line-height: 1em;
margin: 0 0 0.4em 0;
}
h6 {
color: #212123;
font-size: 50%;
margin: 0 0 0.5em 0;
}
a {
color: #212123;
}
.space, .gamespace {
float: left;
margin: 20px;
scroll-snap-align: start;
scroll-margin-top: 20px;
}
.game, .play, .space, .gamespace {
display: flex;
width: 400px;
aspect-ratio: 1 / 1;
}
.space {
font-size: 2.4em;
padding: 0.5em;
box-sizing: border-box;
flex-direction: column;
justify-content: flex-end;
}
.play {
background-color: #646365;
border: none;
}
@media (max-width: 480px) {
body {
margin: 20px 0;
}
.space, .gamespace {
margin: 20px 0;
}
.game, .play, .space, .gamespace {
width: 100vw;
}
.space {
font-size: 10vw;
}
}
</style>
</head>
<body>
<div id="area">
<div class="space">
<h1>one tiny game</h1>
<h6>by <a href="https://fserb.com">fserb</a>
on <a href="https://twitter.com/onetinygame">twitter</a>
and <a href="https://github.com/fserb/one">github</a></h6>
</div>
<img class="game" src="rope/base.png">
<img class="game" src="trap/base.png">
<img class="game" src="wow/base.png">
</div>
<script type="module">
const area = document.getElementById("area");
for (const g of document.getElementsByClassName("game")) {
const sp = g.getAttribute("src").lastIndexOf("/");
const name = g.getAttribute("src").substring(0, sp);
const main = document.createElement("div");
main.classList.add("gamespace");
const a = document.createElement("a");
a.href = "./" + name;
a.target = "_blank";
a.addEventListener("click", ev => {
ev.stopImmediatePropagation();
ev.preventDefault();
for (const ifr of document.getElementsByClassName("play")) {
ifr.parentNode.replaceChild(ifr.other, ifr);
}
const iframe = document.createElement("iframe");
iframe.width = iframe.height = 400;
iframe.classList.add("play");
iframe.other = a;
iframe.src = "./" + name;
main.replaceChild(iframe, a);
});
area.replaceChild(main, g);
main.appendChild(a);
a.appendChild(g);
}
</script>
</body>
</html>