Merge remote-tracking branch 'origin/dev'
All checks were successful
fetch npm modules / f0ck the f0cker (push) Successful in 19s

merging dev to master, wheelr
This commit is contained in:
schrumpel 2023-11-28 20:17:58 +01:00
commit 68724890fd

View File

@ -46,19 +46,44 @@
i.src = e.src; i.src = e.src;
}); });
// <wheeler>
const wheelEventListener = function(event) {
if (event.target.closest('.media-object')) {
if (event.deltaY < 0) {
document.getElementById('prev').click();
} else if (event.deltaY > 0) {
document.getElementById('next').click();
}
}
};
window.addEventListener('wheel', wheelEventListener);
// </wheeler>
if(f0ckimage = document.querySelector("img#f0ck-image")) { if(f0ckimage = document.querySelector("img#f0ck-image")) {
const f0ckimagescroll = document.querySelector("#image-scroll"); const f0ckimagescroll = document.querySelector("#image-scroll");
let isImageExpanded = false;
console.log("entry point - image unclicked")
f0ckimage.addEventListener("click", async e => { f0ckimage.addEventListener("click", async e => {
e.preventDefault(); e.preventDefault();
const img = await imgSize(f0ckimage); const img = await imgSize(f0ckimage);
if(img.width > img.height) console.log("img clicked");
return; if (isImageExpanded) {
f0ckimagescroll.hasAttribute("style") isImageExpanded = false;
? f0ckimagescroll.removeAttribute("style") f0ckimagescroll.removeAttribute("style");
: f0ckimagescroll.setAttribute("style", "overflow-y: scroll"); f0ckimage.removeAttribute("style");
f0ckimage.hasAttribute("style") console.log("image is not expanded")
? f0ckimage.removeAttribute("style") window.addEventListener('wheel', wheelEventListener);
: f0ckimage.setAttribute("style", "max-height: none; height: auto; width: 100%; position: absolute; left: 0; border: var(--img-border-width) solid var(--img-border-color); border-top: none; border-bottom: none;"); } else {
if (img.width > img.height) return;
isImageExpanded = true;
window.removeEventListener('wheel', wheelEventListener);
f0ckimagescroll.setAttribute("style", "overflow-y: scroll");
f0ckimage.setAttribute("style", "max-height: none; height: auto; width: 100%; position: absolute; left: 0; border: var(--img-border-width) solid var(--img-border-color); border-top: none; border-bottom: none;");
}
}); });
} }
// </image-responsive> // </image-responsive>
@ -236,14 +261,6 @@
// </mediakeys> // </mediakeys>
// <scroller> // <scroller>
window.addEventListener('wheel', function(event) {
if (event.target.closest('.media-object')) {
if (event.deltaY < 0) {
document.getElementById('prev').click();
} else if (event.deltaY > 0) {
document.getElementById('next').click();
}
}
});
// </scroller> // </scroller>
})(); })();