some hotkeys from zev
This commit is contained in:
parent
17f2f729ee
commit
2c5a051376
|
@ -18,8 +18,8 @@
|
||||||
</div>
|
</div>
|
||||||
{{ if and .HonkCSRF (not .IsPreview) }}
|
{{ if and .HonkCSRF (not .IsPreview) }}
|
||||||
<div class="info" id="refreshbox">
|
<div class="info" id="refreshbox">
|
||||||
<p><button class="refresh">refresh</button><span></span>
|
<p><button id="honkrefresher" class="refresh">refresh</button><span></span>
|
||||||
<button class="scrolldown">scroll down</button>
|
<button id="newerscroller" class="scrolldown">scroll down</button>
|
||||||
</div>
|
</div>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
<div id="honksonpage">
|
<div id="honksonpage">
|
||||||
|
|
|
@ -416,6 +416,50 @@ function fillcheckin() {
|
||||||
}, gpsoptions)
|
}, gpsoptions)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function scrollnexthonk() {
|
||||||
|
var honks = document.getElementsByClassName("honk");
|
||||||
|
for (var i = 0; i < honks.length; i++) {
|
||||||
|
var h = honks[i];
|
||||||
|
var b = h.getBoundingClientRect();
|
||||||
|
if (b.top > 1.0) {
|
||||||
|
h.scrollIntoView();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function scrollprevioushonk() {
|
||||||
|
var honks = document.getElementsByClassName("honk");
|
||||||
|
for (var i = 1; i < honks.length; i++) {
|
||||||
|
var b = honks[i].getBoundingClientRect();
|
||||||
|
if (b.top > -1.0) {
|
||||||
|
honks[i-1].scrollIntoView();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
document.addEventListener("keydown", function(e) {
|
||||||
|
if (e.target instanceof HTMLInputElement || e.target instanceof HTMLTextAreaElement)
|
||||||
|
return;
|
||||||
|
|
||||||
|
switch (e.code) {
|
||||||
|
case "KeyR":
|
||||||
|
refreshhonks(document.getElementById("honkrefresher"));
|
||||||
|
break;
|
||||||
|
case "KeyS":
|
||||||
|
oldestnewest(document.getElementById("newerscroller"));
|
||||||
|
break;
|
||||||
|
case "KeyJ":
|
||||||
|
scrollnexthonk();
|
||||||
|
break;
|
||||||
|
case "KeyK":
|
||||||
|
scrollprevioushonk();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
function addemu(elem) {
|
function addemu(elem) {
|
||||||
const data = elem.alt
|
const data = elem.alt
|
||||||
const box = document.getElementById("honknoise");
|
const box = document.getElementById("honknoise");
|
||||||
|
|
Loading…
Reference in New Issue