wheeler fix
All checks were successful
fetch npm modules / f0ck the f0cker (push) Successful in 20s

This commit is contained in:
schrumpel 2023-11-28 20:08:32 +01:00
parent 0e793ecde5
commit d9ced4a896

View File

@ -46,19 +46,44 @@
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")) {
const f0ckimagescroll = document.querySelector("#image-scroll");
let isImageExpanded = false;
console.log("entry point - image unclicked")
f0ckimage.addEventListener("click", async e => {
e.preventDefault();
const img = await imgSize(f0ckimage);
if(img.width > img.height)
return;
f0ckimagescroll.hasAttribute("style")
? f0ckimagescroll.removeAttribute("style")
: f0ckimagescroll.setAttribute("style", "overflow-y: scroll");
f0ckimage.hasAttribute("style")
? f0ckimage.removeAttribute("style")
: 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;");
console.log("img clicked");
if (isImageExpanded) {
isImageExpanded = false;
f0ckimagescroll.removeAttribute("style");
f0ckimage.removeAttribute("style");
console.log("image is not expanded")
window.addEventListener('wheel', wheelEventListener);
} 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>
@ -236,14 +261,6 @@
// </mediakeys>
// <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>
})();