~jadedctrl/jam-xwx-moe
Showing details for patch 303cb6d76cfaff5acaa1c54b75069ddd932b6511.
diff -rN -u old-jam-xwx-moe/pleroma-fe/0001-Montri-as-bildosignoj-pligrandigitaj-dum-surmuso.patch new-jam-xwx-moe/pleroma-fe/0001-Montri-as-bildosignoj-pligrandigitaj-dum-surmuso.patch --- old-jam-xwx-moe/pleroma-fe/0001-Montri-as-bildosignoj-pligrandigitaj-dum-surmuso.patch 1970-01-01 00:00:00.000000000 +0000 +++ new-jam-xwx-moe/pleroma-fe/0001-Montri-as-bildosignoj-pligrandigitaj-dum-surmuso.patch 2024-11-22 22:17:27.615313662 +0000 @@ -0,0 +1,121 @@ +From 3bb46525ac6c38a6fa079173b682f349163e6a0d Mon Sep 17 00:00:00 2001 +From: Jaidyn Ann <10477760+JadedCtrl@users.noreply.github.com> +Date: Sun, 27 Aug 2023 17:03:29 -0500 +Subject: [PATCH] =?UTF-8?q?Montri=C4=9Das=20bildosignoj=20pligrandigitaj,?= + =?UTF-8?q?=20dum=20surmuso?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Prenita de BloatFE… +https://git.freesoftwareextremist.com/bloat/tree/static/fluoride.js +--- + src/App.js | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++++- + 1 file changed, 78 insertions(+), 1 deletion(-) + +diff --git a/src/App.js b/src/App.js +index b7eb2f72..a59d8672 100644 +--- a/src/App.js ++++ b/src/App.js +@@ -42,13 +42,19 @@ export default { + GlobalNoticeList + }, + data: () => ({ +- mobileActivePanel: 'timeline' ++ mobileActivePanel: 'timeline', ++ emojiHover: null, ++ emojiHoverLastUpdate: 0, ++ imgX: 0, ++ imgY: 0 + }), + created () { + // Load the locale from the storage + const val = this.$store.getters.mergedConfig.interfaceLanguage + this.$store.dispatch('setOption', { name: 'interfaceLanguage', value: val }) + window.addEventListener('resize', this.updateMobileState) ++ ++ document.addEventListener('scroll', this.updateEmojiHover) + }, + unmounted () { + window.removeEventListener('resize', this.updateMobileState) +@@ -130,6 +136,77 @@ export default { + updateMobileState () { + this.$store.dispatch('setLayoutWidth', windowWidth()) + this.$store.dispatch('setLayoutHeight', windowHeight()) ++ }, ++ ++ setPos (el, cx, cy, mw, mh) { ++ const h = el.clientHeight ++ const w = el.clientWidth ++ let 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' ++ }, ++ ++ handleEmojiHover (a) { ++ const setPos = this.setPos ++ a.onmouseenter = function (e) { ++ const mw = document.documentElement.clientWidth ++ const mh = document.documentElement.clientHeight - 24 ++ const img = document.createElement('img') ++ img.id = 'img-preview' ++ img.style['z-index'] = 3 ++ img.style.position = 'fixed' ++ img.style.width = '5em' ++ img.src = e.target.getAttribute('src') ++ this.emojiHover = img ++ setPos(this.emojiHover, this.imgX, this.imgY, mw, mh) ++ document.body.appendChild(img) ++ } ++ a.onmouseleave = function (e) { ++ const img = document.getElementById('img-preview') ++ if (img) { ++ document.body.removeChild(img) ++ } ++ this.emojiHover = null ++ } ++ a.onmousemove = function (e) { ++ if (!this.emojiHover) { ++ return ++ } ++ const mw = document.documentElement.clientWidth ++ const mh = document.documentElement.clientHeight - 24 ++ this.imgX = e.clientX ++ this.imgY = e.clientY ++ setPos(this.emojiHover, this.imgX, this.imgY, mw, mh) ++ } ++ }, ++ ++ updateEmojiHover () { ++ if (Date() - this.emojiHoverLastUpdate > 5000) { ++ const links = document.querySelectorAll('.emoji img') ++ for (let j = 0; j < links.length; j++) { ++ this.handleEmojiHover(links[j]) ++ } ++ this.emojiHoverLastUpdate = Date() ++ } + } + } + } +-- +2.41.0 + 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 1970-01-01 00:00:00.000000000 +0000 +++ new-jam-xwx-moe/pleroma-fe/emoji_zoom.js 2024-11-22 22:17:27.615313662 +0000 @@ -0,0 +1,84 @@ +// @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