<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Flag of 64th Competition</title> | |
</head> | |
<body> | |
<main style="font-family:Monaco,Consolas,'Lucida Console','Courier New',serif">Loading ...</main> | |
<script>(function () { | |
var now = new Date().toUTCString() | |
var main = document.getElementsByTagName('main')[0] | |
var ua = 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) HEICORE/49.1.2623.213 Safari/537.36' | |
fetch('flag.txt', {method: 'POST', headers: {'If-Unmodified-Since': now, 'User-Agent': ua}}).then(function (res) { | |
if (res.ok) { | |
res.text().then(function (text) { | |
main.innerText = 'The flag is "' + text + '".' | |
}) | |
} else { | |
var lastModified = res.headers.get('Last-Modified') | |
setInterval(function () { | |
var diff = (new Date(lastModified).getTime() - Date.now()) / 1000 | |
var diffSeconds = Math.floor(diff % 86400), diffDays = Math.floor(diff / 86400) | |
main.innerText = 'Not yet! The competition will start after ' + diffDays + ' days and ' + diffSeconds + ' seconds.' | |
}, 1000) | |
} | |
}) | |
})()</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment