Browse Source

Fix image hover, again...

pull/46/head
coomdev 2 years ago
parent
commit
e2061b962d
  1. 2
      main.meta.js
  2. 6
      main.user.js
  3. 8
      src/Embedding.svelte

2
main.meta.js

@ -1,7 +1,7 @@
// ==UserScript==
// @name PNGExtraEmbed
// @namespace https://coom.tech/
// @version 0.132
// @version 0.133
// @description uhh
// @author You
// @match https://boards.4channel.org/*

6
main.user.js

@ -1,7 +1,7 @@
// ==UserScript==
// @name PNGExtraEmbed
// @namespace https://coom.tech/
// @version 0.132
// @version 0.133
// @description uhh
// @author You
// @match https://boards.4channel.org/*
@ -16006,10 +16006,10 @@
dispatch("fileinfo", { type });
if (hovering) {
setTimeout(async () => {
while (dims[0] == 0 && dims[1] == 0) {
do {
hoverUpdate();
await new Promise((_) => setTimeout(_, 20));
}
} while (dims[0] == 0 && dims[1] == 0);
}, 20);
}
}

8
src/Embedding.svelte

@ -117,10 +117,10 @@
if (hovering) {
// reset hovering to recompute proper image coordinates
setTimeout(async () => {
while (dims[0] == 0 && dims[1] == 0) {
do {
hoverUpdate()
await new Promise(_ => setTimeout(_, 20));
}
await new Promise((_) => setTimeout(_, 20))
} while (dims[0] == 0 && dims[1] == 0)
}, 20)
}
}
@ -231,7 +231,7 @@
lastev = lastev || ev
if ($settings.dh) return
if (!contracted) return
recompute(); // yeah I gave up
recompute() // yeah I gave up
const [sw, sh] = [visualViewport.width, visualViewport.height]
// shamelessly stolen from 4chanX
if (dims[0] == 0 && dims[1] == 0) recompute()

Loading…
Cancel
Save