~jadedctrl/jam-xwx-moe
Showing details for patch 2ab2e4de54f35ab23ce6bf53b1e7e259d22e4134.
diff -rN -u old-jam-xwx-moe/pleroma-fe/emoji_zoom.js new-jam-xwx-moe/pleroma-fe/emoji_zoom.js --- old-jam-xwx-moe/pleroma-fe/emoji_zoom.js 2024-11-22 17:24:40.291242128 +0000 +++ new-jam-xwx-moe/pleroma-fe/emoji_zoom.js 1970-01-01 00:00:00.000000000 +0000 @@ -1,84 +0,0 @@ -// @license magnet:?xt=urn:btih:90dc5c0be029de84e523b9b3922520e79e0e6f08&dn=cc0.txt CC0 -// Pligrandigas bildosignojn je Pleroma. -// Prenita de BloatFE kaj redaktita por PleromaFE, el… -// https://git.freesoftwareextremist.com/bloat/tree/static/fluoride.js - -const function setPos(el, cx, cy, mw, mh) { - var h = el.clientHeight; - var w = el.clientWidth; - var left, top; - if (cx < mw/2) { - if (w + cx + 20 < mw) { - left = cx + 20; - } else { - left = (mw - w); - } - } else { - if (cx - w - 20 > 0) { - left = cx - w - 20; - } else { - left = 0; - } - } - top = (cy - (h/2)); - if (top < 0) { - top = 0; - } else if (top + h > mh) { - top = (mh - h); - } - el.style.left = left + "px"; - el.style.top = top + "px"; -} - -var imgPrev = null; -var imgX = 0; -var imgY = 0; -const function handleImgPreview(a) { - a.onmouseenter = function(e) { - var mw = document.documentElement.clientWidth; - var mh = document.documentElement.clientHeight - 24; - imgX = e.clientX; - imgY = e.clientY; - var img = document.createElement("img"); - img.id = "img-preview"; - img.style["z-index"] = 3; - img.style["position"] = "fixed"; - img.src = e.target.getAttribute("src"); - img.style["width"] = "5em"; - imgPrev = img; - setPos(imgPrev, imgX, imgY, mw, mh); - document.body.appendChild(img); - } - a.onmouseleave = function(e) { - var img = document.getElementById("img-preview"); - if (img) - document.body.removeChild(img); - imgPrev = null; - } - a.onmousemove = function(e) { - if (!imgPrev) - return; - var mw = document.documentElement.clientWidth; - var mh = document.documentElement.clientHeight - 24; - imgX = e.clientX; - imgY = e.clientY; - setPos(imgPrev, imgX, imgY, mw, mh); - } -} - -emojis_updated_last = 0 -const function updateEmojiHover() { - if (Date() - emojis_updated_last > 5000) { - var links = document.querySelectorAll(".emoji img"); - for (var j = 0; j < links.length; j++) { - handleImgPreview(links[j]); - } - console.log("Updated!") - emojis_updated_last = Date(); - } -} - -document.addEventListener("DOMContentLoaded", updateEmojiHover); -document.addEventListener("scroll", updateEmojiHover); - -// @license-end