Add remote easter egg
This commit is contained in:
parent
ee2e92a9a5
commit
b281ebe408
@ -12,6 +12,7 @@
|
||||
</head>
|
||||
|
||||
<body class="scrollbar">
|
||||
<img id="remote" src="/static/img/remote.png" style="display: none;" onclick="flipRemote();" />
|
||||
<div class="root">
|
||||
{{template "body" .}}
|
||||
</div>
|
||||
|
@ -286,4 +286,14 @@ span.svmsg {
|
||||
|
||||
#colorSubmit:disabled {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#remote {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: 0;
|
||||
margin: 1em auto;
|
||||
width: 50px;
|
||||
z-index: 999;
|
||||
}
|
BIN
static/img/remote.png
Normal file
BIN
static/img/remote.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
BIN
static/img/remote_active.png
Normal file
BIN
static/img/remote_active.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 9.1 KiB |
@ -1,8 +1,38 @@
|
||||
/// <reference path="./jquery.js" />
|
||||
|
||||
let konamiCode = ["ArrowUp", "ArrowUp", "ArrowDown", "ArrowDown", "ArrowLeft", "ArrowRight", "ArrowLeft", "ArrowRight", "b", "a"]
|
||||
let lastKeys = []
|
||||
|
||||
// Make this on all pages so video page also doesn't do this
|
||||
$(document).on("keydown", function (e) {
|
||||
checkKonami(e);
|
||||
|
||||
if (e.which === 8 && !$(e.target).is("input, textarea")) {
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
function checkKonami(e) {
|
||||
lastKeys.push(e.key);
|
||||
if (lastKeys.length > 10) {
|
||||
lastKeys.shift();
|
||||
}
|
||||
|
||||
if (lastKeys.length === konamiCode.length) {
|
||||
for (let i = 0; i < lastKeys.length; i++) {
|
||||
if (lastKeys[i] != konamiCode[i]) {
|
||||
console.log(i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
$("#remote").css("display", "");
|
||||
}
|
||||
}
|
||||
|
||||
function flipRemote() {
|
||||
$("#remote").attr("src", "/static/img/remote_active.png");
|
||||
setTimeout(() => {
|
||||
$("#remote").attr("src", "/static/img/remote.png");
|
||||
}, Math.round(Math.random() * 10000) + 1000);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user