From aa5082394da0305d7be87be1f2a3a9502e3305c5 Mon Sep 17 00:00:00 2001 From: 17ms <79069176+17ms@users.noreply.github.com> Date: Wed, 8 Mar 2023 02:09:52 +0200 Subject: [PATCH] prevent interference with text inputs, greasyfork version bump --- visual/4c-gallery.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/visual/4c-gallery.js b/visual/4c-gallery.js index cd56f4c..2e8a796 100644 --- a/visual/4c-gallery.js +++ b/visual/4c-gallery.js @@ -6,7 +6,7 @@ // @namespace Violentmonkey Scripts // @match *://boards.4chan*.org/*/thread/* // @exclude *://boards.4chan*.org/*/catalog -// @version 1.0 +// @version 1.1 // ==/UserScript== // Shortcuts: decrease size, increase size, previous image, next image, jump to the source hash (i.e. post) @@ -110,9 +110,17 @@ const preloadImgs = async () => { await img.decode() imgs.push(img) } + + if (imgs.length > 0) { + imgElem.src = imgs[0].src + } } const keyUpEvent = async (e) => { + if (["input", "textarea"].includes(e.target.tagName.toLowerCase())) { + return + } + if (e.key === keys[0]) { sizeDown(document.getElementById("drGallery")) } else if (e.key === keys[1]) {