ponyTown/public/reset.html

64 lines
1.4 KiB
HTML
Raw Normal View History

2019-09-07 21:23:46 +03:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<title>Pony Town (reset)</title>
<style>
body {
background: #333;
}
div {
position: fixed;
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
}
a {
color: #d88856;
font: normal 16px sans-serif;
text-align: center;
padding: 30px;
}
</style>
</head>
<body>
<div>
<a href="/">go back to the game</a>
</div>
<script>
function unregisterServiceWorker() {
if ('serviceWorker' in navigator && typeof navigator.serviceWorker.getRegistrations === 'function') {
return navigator.serviceWorker.getRegistrations()
.then(rs => rs.forEach(r => r.unregister()))
.catch(e => console.error(e));
}
}
function reloadResources() {
if (typeof fetch === 'function') {
return fetch('/', { cache: 'reload' })
.then(x => x.text())
.then(x => /script src="([^"]+)"/.exec(x)[1])
.then(x => fetch(x, { cache: 'reload' }))
.then(x => x.text())
.catch(e => console.error(e));
}
}
localStorage.clear();
Promise.resolve()
.then(unregisterServiceWorker)
.then(reloadResources)
.then(() => location.href = '/');
</script>
</body>
</html>