~jadedctrl/jam-xwx-moe

~jadedctrl/jam-xwx-moe/pleroma-fe/flikaĵoj/0001-Montri-as-bildosignoj-pligrandigitaj-dum-surmuso.patch
 ..
0 From 3bb46525ac6c38a6fa079173b682f349163e6a0d Mon Sep 17 00:00:00 2001
1 From: Jaidyn Ann <10477760+JadedCtrl@users.noreply.github.com>
2 Date: Sun, 27 Aug 2023 17:03:29 -0500
3 Subject: [PATCH] =?UTF-8?q?Montri=C4=9Das=20bildosignoj=20pligrandigitaj,?=
4 =?UTF-8?q?=20dum=20surmuso?=
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 Prenita de BloatFE…
10 https://git.freesoftwareextremist.com/bloat/tree/static/fluoride.js
11 ---
12 src/App.js | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
13 1 file changed, 78 insertions(+), 1 deletion(-)
14
15 diff --git a/src/App.js b/src/App.js
16 index b7eb2f72..a59d8672 100644
17 --- a/src/App.js
18 +++ b/src/App.js
19 @@ -42,13 +42,19 @@ export default {
20 GlobalNoticeList
21 },
22 data: () => ({
23 - mobileActivePanel: 'timeline'
24 + mobileActivePanel: 'timeline',
25 + emojiHover: null,
26 + emojiHoverLastUpdate: 0,
27 + imgX: 0,
28 + imgY: 0
29 }),
30 created () {
31 // Load the locale from the storage
32 const val = this.$store.getters.mergedConfig.interfaceLanguage
33 this.$store.dispatch('setOption', { name: 'interfaceLanguage', value: val })
34 window.addEventListener('resize', this.updateMobileState)
35 +
36 + document.addEventListener('scroll', this.updateEmojiHover)
37 },
38 unmounted () {
39 window.removeEventListener('resize', this.updateMobileState)
40 @@ -130,6 +136,77 @@ export default {
41 updateMobileState () {
42 this.$store.dispatch('setLayoutWidth', windowWidth())
43 this.$store.dispatch('setLayoutHeight', windowHeight())
44 + },
45 +
46 + setPos (el, cx, cy, mw, mh) {
47 + const h = el.clientHeight
48 + const w = el.clientWidth
49 + let left, top
50 + if (cx < mw / 2) {
51 + if (w + cx + 20 < mw) {
52 + left = cx + 20
53 + } else {
54 + left = (mw - w)
55 + }
56 + } else {
57 + if (cx - w - 20 > 0) {
58 + left = cx - w - 20
59 + } else {
60 + left = 0
61 + }
62 + }
63 + top = (cy - (h / 2))
64 + if (top < 0) {
65 + top = 0
66 + } else if (top + h > mh) {
67 + top = (mh - h)
68 + }
69 + el.style.left = left + 'px'
70 + el.style.top = top + 'px'
71 + },
72 +
73 + handleEmojiHover (a) {
74 + const setPos = this.setPos
75 + a.onmouseenter = function (e) {
76 + const mw = document.documentElement.clientWidth
77 + const mh = document.documentElement.clientHeight - 24
78 + const img = document.createElement('img')
79 + img.id = 'img-preview'
80 + img.style['z-index'] = 3
81 + img.style.position = 'fixed'
82 + img.style.width = '5em'
83 + img.src = e.target.getAttribute('src')
84 + this.emojiHover = img
85 + setPos(this.emojiHover, this.imgX, this.imgY, mw, mh)
86 + document.body.appendChild(img)
87 + }
88 + a.onmouseleave = function (e) {
89 + const img = document.getElementById('img-preview')
90 + if (img) {
91 + document.body.removeChild(img)
92 + }
93 + this.emojiHover = null
94 + }
95 + a.onmousemove = function (e) {
96 + if (!this.emojiHover) {
97 + return
98 + }
99 + const mw = document.documentElement.clientWidth
100 + const mh = document.documentElement.clientHeight - 24
101 + this.imgX = e.clientX
102 + this.imgY = e.clientY
103 + setPos(this.emojiHover, this.imgX, this.imgY, mw, mh)
104 + }
105 + },
106 +
107 + updateEmojiHover () {
108 + if (Date() - this.emojiHoverLastUpdate > 5000) {
109 + const links = document.querySelectorAll('.emoji img')
110 + for (let j = 0; j < links.length; j++) {
111 + this.handleEmojiHover(links[j])
112 + }
113 + this.emojiHoverLastUpdate = Date()
114 + }
115 }
116 }
117 }
118 --
119 2.41.0
120