lights on/off play/pause hotkeys (re)added

This commit is contained in:
x
2026-01-24 11:24:00 +01:00
parent fc7d38e3f1
commit f2b14739e3

View File

@@ -44,12 +44,14 @@ window.requestAnimFrame = (function () {
if (elem = document.querySelector("#my-video")) {
video = new v0ck(elem);
/* Listener moved to global keybindings
document.addEventListener("keydown", e => {
if (e.key === " " && e.target.tagName !== "INPUT" && e.target.tagName !== "TEXTAREA") {
video[video.paused ? 'play' : 'pause']();
document.querySelector('.v0ck_overlay').classList[video.paused ? 'remove' : 'add']('v0ck_hidden');
}
});
*/
@@ -515,7 +517,20 @@ window.requestAnimFrame = (function () {
"ArrowRight": clickOnElementBinding("#prev"),
"d": clickOnElementBinding("#prev"),
"r": clickOnElementBinding("#random, #nav-random"),
" ": clickOnElementBinding("#f0ck-image")
"l": () => {
const toggle = document.querySelector("#togglebg");
if (toggle) toggle.click();
},
" ": () => {
if (video && typeof video.play === 'function') { // Check if video wrapper exists/is valid
video[video.paused ? 'play' : 'pause']();
const overlay = document.querySelector('.v0ck_overlay');
if (overlay) overlay.classList[video.paused ? 'remove' : 'add']('v0ck_hidden');
} else {
const img = document.querySelector("#f0ck-image");
if (img) img.click();
}
}
};
document.addEventListener("keydown", e => {
if (e.key in keybindings && e.target.tagName !== "INPUT" && e.target.tagName !== "TEXTAREA") {