From 3f064c33363144a067b94416d307968cbb192d66 Mon Sep 17 00:00:00 2001 From: Noz Date: Tue, 20 Feb 2024 22:56:10 -0500 Subject: [PATCH] [handle_pixel] better zoom logic --- ext/handle_pixel/script.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/ext/handle_pixel/script.js b/ext/handle_pixel/script.js index 264b6422..dd738cf5 100644 --- a/ext/handle_pixel/script.js +++ b/ext/handle_pixel/script.js @@ -38,9 +38,17 @@ document.addEventListener('DOMContentLoaded', () => { }); $("img.shm-main-image").click(function(e) { - switch(shm_cookie_get("ui-image-zoom")) { - case "full": zoom("both"); break; - default: zoom("full"); break; + var val = $(".shm-zoomer")[0].value; + var cookie = shm_cookie_get("ui-image-zoom"); + + if (val == "full" && cookie == "full"){ + zoom("both", false); + } + else if (val != "full"){ + zoom("full", false); + } + else { + zoom(cookie, false); } });