-
Notifications
You must be signed in to change notification settings - Fork 8
/
index.html
278 lines (244 loc) · 13.7 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
<!doctype html>
<html lang="en">
<head>
<title>Yume Nikki Online Project</title>
<meta charset="utf-8">
<meta name="description" content="Play multiplayer Yume Nikki and Yume Nikki fangames for free! Ad-free and no registration required.">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="manifest" href="/manifest.json"/>
<link rel="stylesheet" href="nexus.css">
</head>
<body>
<div id="nexus">
<div id="siteLogo" class="fade fadeUp fadeSlow">
<img src="images/logo_yno.png" />
</div>
<div id="doors"></div>
<div id="footerIconContainer" class="fade nopointer">
<a href="https://ynoproject.net/discord" target="_blank" class="iconLink" title="Discord">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="48" height="48">
<path d="M19.229,6.012c-0.903-0.73-2.015-1.246-2.872-1.572c-0.307-0.117-0.653-0.076-0.923,0.111C15.162,4.737,15,5.045,15,5.374 C15,5.72,14.72,6,14.374,6c-1.573,0-3.176,0-4.749,0C9.28,6,9,5.72,9,5.375c0-0.329-0.162-0.638-0.433-0.824 C8.296,4.364,7.95,4.323,7.643,4.441c-0.86,0.329-1.978,0.85-2.894,1.59C3.831,6.882,2,11.861,2,16.165 c0,0.076,0.019,0.15,0.057,0.216c1.265,2.233,4.714,2.817,5.499,2.842c0.005,0.001,0.009,0.001,0.014,0.001 c0.139,0,0.286-0.056,0.351-0.18l0.783-1.485c-0.646-0.164-1.313-0.359-2.04-0.617c-0.521-0.185-0.792-0.757-0.607-1.277 s0.759-0.791,1.277-0.607c3.527,1.254,5.624,1.253,9.345-0.005c0.523-0.175,1.091,0.104,1.268,0.627s-0.104,1.091-0.627,1.268 c-0.728,0.246-1.392,0.434-2.035,0.594l0.793,1.503c0.065,0.124,0.213,0.18,0.351,0.18c0.005,0,0.009,0,0.014-0.001 c0.786-0.025,4.235-0.61,5.499-2.843C21.981,16.315,22,16.241,22,16.164C22,11.861,20.169,6.882,19.229,6.012z M9.04,13.988 c-0.829,0-1.5-0.893-1.5-1.996c0-1.102,0.671-1.996,1.5-1.996c0.832-0.11,1.482,0.893,1.5,1.996 C10.54,13.095,9.869,13.988,9.04,13.988z M14.996,14.012c-0.829,0-1.5-0.895-1.5-2s0.671-2,1.5-2s1.5,0.895,1.5,2 S15.825,14.012,14.996,14.012z" fill="#ffffff" />
</svg>
</a>
<a href="https://tumblr.com/ynoproject" target="_blank" class="iconLink" title="Tumblr">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 180" width="48" height="48">
<path d="M63.6,159.3c-24,0-41.8-12.3-41.8-41.8V70.3H0V44.7C24,38.5,34,17.9,35.1,0H60v40.6h29v29.7H60v41.1 c0,12.3,6.2,16.6,16.1,16.6h14.1v31.3H63.6z" fill="#ffffff" />
</svg>
</a>
<a href="https://twitter.com/ynoproject" target="_blank" class="iconLink" title="Twitter">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 209" width="48" height="48">
<path d="M256,25.4500259 C246.580841,29.6272672 236.458451,32.4504868 225.834156,33.7202333 C236.678503,27.2198053 245.00583,16.9269929 248.927437,4.66307685 C238.779765,10.6812633 227.539325,15.0523376 215.57599,17.408298 C205.994835,7.2006971 192.34506,0.822 177.239197,0.822 C148.232605,0.822 124.716076,24.3375931 124.716076,53.3423116 C124.716076,57.4586875 125.181462,61.4673784 126.076652,65.3112644 C82.4258385,63.1210453 43.7257252,42.211429 17.821398,10.4359288 C13.3005011,18.1929938 10.710443,27.2151234 10.710443,36.8402889 C10.710443,55.061526 19.9835254,71.1374907 34.0762135,80.5557137 C25.4660961,80.2832239 17.3681846,77.9207088 10.2862577,73.9869292 C10.2825122,74.2060448 10.2825122,74.4260967 10.2825122,74.647085 C10.2825122,100.094453 28.3867003,121.322443 52.413563,126.14673 C48.0059695,127.347184 43.3661509,127.988612 38.5755734,127.988612 C35.1914554,127.988612 31.9009766,127.659938 28.694773,127.046602 C35.3777973,147.913145 54.7742053,163.097665 77.7569918,163.52185 C59.7820257,177.607983 37.1354036,186.004604 12.5289147,186.004604 C8.28987161,186.004604 4.10888474,185.75646 0,185.271409 C23.2431033,200.173139 50.8507261,208.867532 80.5109185,208.867532 C177.116529,208.867532 229.943977,128.836982 229.943977,59.4326002 C229.943977,57.1552968 229.893412,54.8901664 229.792282,52.6381454 C240.053257,45.2331635 248.958338,35.9825545 256,25.4500259" fill="#ffffff" />
</svg>
</a>
<a href="https://github.com/ynoproject" target="_blank" class="iconLink" title="GitHub">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="48" height="48">
<path d="M10.9,2.1c-4.6,0.5-8.3,4.2-8.8,8.7c-0.5,4.7,2.2,8.9,6.3,10.5C8.7,21.4,9,21.2,9,20.8v-1.6c0,0-0.4,0.1-0.9,0.1 c-1.4,0-2-1.2-2.1-1.9c-0.1-0.4-0.3-0.7-0.6-1C5.1,16.3,5,16.3,5,16.2C5,16,5.3,16,5.4,16c0.6,0,1.1,0.7,1.3,1c0.5,0.8,1.1,1,1.4,1 c0.4,0,0.7-0.1,0.9-0.2c0.1-0.7,0.4-1.4,1-1.8c-2.3-0.5-4-1.8-4-4c0-1.1,0.5-2.2,1.2-3C7.1,8.8,7,8.3,7,7.6c0-0.4,0-0.9,0.2-1.3 C7.2,6.1,7.4,6,7.5,6c0,0,0.1,0,0.1,0C8.1,6.1,9.1,6.4,10,7.3C10.6,7.1,11.3,7,12,7s1.4,0.1,2,0.3c0.9-0.9,2-1.2,2.5-1.3 c0,0,0.1,0,0.1,0c0.2,0,0.3,0.1,0.4,0.3C17,6.7,17,7.2,17,7.6c0,0.8-0.1,1.2-0.2,1.4c0.7,0.8,1.2,1.8,1.2,3c0,2.2-1.7,3.5-4,4 c0.6,0.5,1,1.4,1,2.3v2.6c0,0.3,0.3,0.6,0.7,0.5c3.7-1.5,6.3-5.1,6.3-9.3C22,6.1,16.9,1.4,10.9,2.1z" fill="#ffffff" />
</svg>
</a>
</div>
</div>
<div id="background" class="fade fadeSlow"></div>
<template>
<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg" width="24" height="24">
<path d="M 9 4 A 1 1 90 0 0 9 9 A 1 1 90 0 0 9 4 M 5 17 C 5 12 6 10 9 10 C 12 10 13 12 13 17 Q 9 19 5 17 M 5 0 A 1 1 90 0 0 5 5 A 1 1 90 0 0 5 0 M 1 13 C 1 8 2 6 5 6 C 5.375 6 5.5 6 6.25 6.125 C 6 7.75 7.5 9.25 8.75 9.25 Q 8.875 9.5 8.875 9.75 C 7.125 9.75 5.25 10.75 5 13.875 Q 2.625 13.875 1 13 M 13 0 A 1 1 90 0 1 13 5 A 1 1 90 0 1 13 0 M 17 13 C 17 8 16 6 13 6 C 12.625 6 12.5 6 11.75 6.125 C 12 7.75 10.5 9.25 9.25 9.25 Q 9.125 9.5 9.125 9.75 C 10.875 9.75 12.75 10.75 13 13.875 Q 15.375 13.875 17 13" />
</svg>
</template>
<svg xmlns="http://www.w3.org/2000/svg" width="0" height="0">
<defs>
<linearGradient id="baseGradient" x1="0%" y1="0%" x2="0%" y2="100%">
<stop stop-color="rgba(217, 179, 228, 1)" offset="0%"></stop>
<stop stop-color="rgba(205, 163, 214, 1)" offset="43.75%"></stop>
<stop stop-color="rgba(194, 146, 200, 1)" offset="56.25%"></stop>
<stop stop-color="rgba(182, 130, 186, 1)" offset="68.75%"></stop>
<stop stop-color="rgba(172, 115, 173, 1)" offset="81.25%"></stop>
<stop stop-color="rgba(159, 98, 158, 1)" offset="87.5%"></stop>
<stop stop-color="rgba(148, 87, 144, 1)" offset="93.75%"></stop>
<stop stop-color="rgba(137, 87, 131, 1)" offset="100%"></stop>
</linearGradient>
<linearGradient id="altGradient" x1="0%" y1="0%" x2="0%" y2="100%">
<stop stop-color="rgba(123, 82, 134, 1)" offset="0%"></stop>
<stop stop-color="rgba(110, 65, 120, 1)" offset="43.75%"></stop>
<stop stop-color="rgba(99, 48, 105, 1)" offset="56.25%"></stop>
<stop stop-color="rgba(86, 30, 91, 1)" offset="68.75%"></stop>
<stop stop-color="rgba(75, 12, 76, 1)" offset="81.25%"></stop>
<stop stop-color="rgba(62, 0, 61, 1)" offset="87.5%"></stop>
<stop stop-color="rgba(50, 0, 45, 1)" offset="93.75%"></stop>
<stop stop-color="rgba(37, 0, 31, 1)" offset="100%"></stop>
</linearGradient>
<filter id="dropShadow">
<feDropShadow dx="1" dy="1" stdDeviation="0.2" flood-color="rgba(0, 0, 0, 1)"></feDropShadow>
</filter>
</defs>
</svg>
<svg id="zoom" xmlns="http://www.w3.org/2000/svg">
<rect id="bg" width="100%" height="100%" fill="black" mask="url(#zoomMask)" />
<mask id="zoomMask">
<rect id="maskBg" width="100%" height="100%" fill="black" />
<circle id="circle" fill="black" />
</mask>
</svg>
<script>
const gameIds = [
'yume',
'2kki',
'flow',
'unevendream',
'deepdreams',
'prayers',
'someday',
'amillusion',
'braingirl',
'muma',
'genie',
'mikan',
'ultraviolet',
'sheawaits',
'oversomnia',
'tsushin',
'nostalgic',
'oneshot',
'if',
'unaccomplished'
];
const nexus = document.getElementById('nexus');
const doorsContainer = document.getElementById('doors');
setTimeout(() => {
document.getElementById('siteLogo').classList.add('fadeIn');
document.getElementById('background').classList.add('fadeIn');
}, 0);
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('./service-worker.js');
}
gameIds.forEach((gameId, g) => {
const door = document.createElement('div');
door.classList.add('door');
door.classList.add('fade');
door.dataset.gameId = gameId;
const playerCountContainer = document.createElement('div');
playerCountContainer.classList.add('playerCountContainer');
const doorImgContainer = document.createElement('div');
doorImgContainer.classList.add('doorImgContainer');
const doorImg = document.createElement('img');
doorImg.classList.add('doorImg');
doorImg.src = `images/door_${gameId}.gif`;
const doorShadowImg = document.createElement('img');
doorShadowImg.classList.add('doorShadowImg');
doorShadowImg.src = 'images/door_shadow.png';
doorImgContainer.append(doorImg);
doorImgContainer.append(doorShadowImg);
const logoContainer = document.createElement('div');
logoContainer.classList.add('logoContainer');
const logo = document.createElement('img');
logo.classList.add('logo');
logo.src = `images/logo_${gameId}.png`;
logoContainer.append(logo);
door.append(playerCountContainer);
door.append(doorImgContainer);
door.append(logoContainer);
doorsContainer.append(door);
setTimeout(() => door.classList.add('fadeIn'), 75 * g + 750);
});
const doors = document.querySelectorAll('.door');
for (let door of doors) {
const playerCountContainer = door.querySelector('.playerCountContainer');
const playerCountLabel = document.createElement('label');
playerCountLabel.classList.add('unselectable');
playerCountLabel.textContent = '?';
fetchAndUpdatePlayerCount(door.dataset.gameId, playerCountLabel);
playerCountContainer.appendChild(document.getElementsByTagName('template')[0].content.cloneNode(true));
playerCountContainer.appendChild(playerCountLabel);
door.onclick = function () {
if (!this.classList.contains('active')) {
door.classList.add('active');
doDoorAnim(nexus, door);
}
};
}
setTimeout(() => {
const footerIconContainer = document.getElementById('footerIconContainer');
footerIconContainer.classList.add('fadeIn');
footerIconContainer.classList.remove('nopointer');
}, 75 * doors.length + 750);
window.setInterval(() => doors.forEach(door => fetchAndUpdatePlayerCount(door.dataset.gameId, door.querySelector('.playerCountContainer label'))), 60000);
function fetchAndUpdatePlayerCount(gameId, playerCountLabel) {
fetch(`https://connect.ynoproject.net/${gameId}/api/players`)
.then(response => response.text())
.then(count => !isNaN(count) && (playerCountLabel.textContent = count))
.catch(err => console.error(err));
}
window.onresize = function () { setTimeout(onResize, 0); };
function onResize() {
document.getElementById('zoom').style.height = document.body.offsetHeight;
}
setTimeout(onResize, 0);
function doDoorAnim(nexus, door) {
const zoom = document.getElementById('zoom');
const circle = document.getElementById('circle');
const initialRadius = Math.max(nexus.offsetWidth, nexus.offsetHeight) * 0.75;
const rect = door.getBoundingClientRect();
const centerX = ((rect.x + door.offsetWidth / 2) / nexus.offsetWidth) * 100;
const centerY = ((rect.y + door.offsetHeight / 2) / nexus.offsetHeight) * 100;
circle.setAttribute('r', initialRadius);
circle.setAttribute('cx', `${centerX}%`);
circle.setAttribute('cy', `${centerY}%`);
circle.style.transformOrigin = `calc(${centerX}% + 64px) calc(${centerY}% + 8px)`;
const cssAnim = document.createElement('style');
cssAnim.type = 'text/css';
const rules = document.createTextNode(`
@keyframes maskAnim {
from {
fill: black;
}
to {
fill: white;
}
}
@keyframes zoomAnim {
from {
r: ${initialRadius};
transform: rotate(0deg);
}
to {
r: 128px;
transform: rotate(360deg);
}
}
`);
cssAnim.appendChild(rules);
document.querySelector('head').appendChild(cssAnim);
zoom.classList.add('active');
playAudio('door_effect.wav');
const gameId = door.dataset.gameId;
window.setTimeout(() => {
playAudio(`door_${gameId}.wav`, 0.5);
const doorImg = door.querySelector('.doorImg');
doorImg.src = doorImg.src.replace('door_', 'door_open_');
window.setTimeout(() => {
// wait for page navigation
window.onpagehide = () => {
// wait for document to be hidden
// must be done here to not respond to switching tabs
window.onpagehide = null;
document.onvisibilitychange = () => {
// make sure the document is being hidden
if (document.visibilityState !== 'hidden')
return;
document.onvisibilitychange = null;
zoom.classList.remove('active');
cssAnim.remove();
doorImg.src = doorImg.src.replace('_open', '');
door.classList.remove('active');
};
};
window.location.href = `/${gameId}/`;
}, 1500);
}, 1000);
}
function playAudio(filename, volume) {
const audio = new Audio(`audio/${filename}`);
audio.volume = volume || 1;
audio.play();
}
</script>
</body>
</html>