Browse Source

Add connect clause?

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

3
main.meta.js

@ -1,7 +1,7 @@
// ==UserScript== // ==UserScript==
// @name PNGExtraEmbed // @name PNGExtraEmbed
// @namespace https://coom.tech/ // @namespace https://coom.tech/
// @version 0.65 // @version 0.66
// @description uhh // @description uhh
// @author You // @author You
// @match https://boards.4channel.org/* // @match https://boards.4channel.org/*
@ -14,4 +14,5 @@
// @connect 4chan.org // @connect 4chan.org
// @connect 4channel.org // @connect 4channel.org
// @connect i.4cdn.org // @connect i.4cdn.org
// @connect *
// ==/UserScript== // ==/UserScript==

13
main.user.js

@ -1,7 +1,7 @@
// ==UserScript== // ==UserScript==
// @name PNGExtraEmbed // @name PNGExtraEmbed
// @namespace https://coom.tech/ // @namespace https://coom.tech/
// @version 0.65 // @version 0.66
// @description uhh // @description uhh
// @author You // @author You
// @match https://boards.4channel.org/* // @match https://boards.4channel.org/*
@ -14,6 +14,7 @@
// @connect 4chan.org // @connect 4chan.org
// @connect 4channel.org // @connect 4channel.org
// @connect i.4cdn.org // @connect i.4cdn.org
// @connect *
// ==/UserScript== // ==/UserScript==
(() => { (() => {
var __create = Object.create; var __create = Object.create;
@ -10619,10 +10620,6 @@
resolved_promise.then(flush); resolved_promise.then(flush);
} }
} }
function tick() {
schedule_update();
return resolved_promise;
}
function add_render_callback(fn) { function add_render_callback(fn) {
render_callbacks.push(fn); render_callbacks.push(fn);
} }
@ -14233,9 +14230,7 @@
$$invalidate(3, isAudio = type.mime.startsWith("audio/")); $$invalidate(3, isAudio = type.mime.startsWith("audio/"));
$$invalidate(2, isImage = type.mime.startsWith("image/")); $$invalidate(2, isImage = type.mime.startsWith("image/"));
if (hovering) { if (hovering) {
await tick(); setTimeout(recompute, 10);
recompute();
await tick();
} }
} }
async function bepis() { async function bepis() {
@ -14268,7 +14263,6 @@
dims = [~~(iw * scale), ~~(ih * scale)]; dims = [~~(iw * scale), ~~(ih * scale)];
$$invalidate(9, hoverElem.style.width = `${dims[0]}px`, hoverElem); $$invalidate(9, hoverElem.style.width = `${dims[0]}px`, hoverElem);
$$invalidate(9, hoverElem.style.height = `${dims[1]}px`, hoverElem); $$invalidate(9, hoverElem.style.height = `${dims[1]}px`, hoverElem);
$$invalidate(7, hovering = true);
} }
async function hoverStart(ev) { async function hoverStart(ev) {
if ($settings.dh) if ($settings.dh)
@ -14281,6 +14275,7 @@
if (!contracted) if (!contracted)
return; return;
recompute(); recompute();
$$invalidate(7, hovering = true);
if (isVideo) { if (isVideo) {
try { try {
await hoverVideo.play(); await hoverVideo.play();

6
src/Embedding.svelte

@ -56,9 +56,7 @@
isImage = type.mime.startsWith('image/') isImage = type.mime.startsWith('image/')
if (hovering) { if (hovering) {
// reset hovering to recompute proper image coordinates // reset hovering to recompute proper image coordinates
await tick(); setTimeout(recompute, 10);
recompute();
await tick();
} }
} }
@ -102,7 +100,6 @@
hoverElem.style.width = `${dims[0]}px` hoverElem.style.width = `${dims[0]}px`
hoverElem.style.height = `${dims[1]}px` hoverElem.style.height = `${dims[1]}px`
hovering = true
} }
async function hoverStart(ev?: MouseEvent) { async function hoverStart(ev?: MouseEvent) {
@ -115,6 +112,7 @@
if (!contracted) return if (!contracted) return
recompute(); recompute();
hovering = true
if (isVideo){ if (isVideo){
try { try {

Loading…
Cancel
Save