HandyImage icon indicating copy to clipboard operation
HandyImage copied to clipboard

R hotkey is sometimes broken

Open armorfid opened this issue 11 months ago • 8 comments

On some sites (not all), when I press the R key to disable the script, it stays active and the image keeps getting resized, no matter how many times I press R.

Example: https://rule34.xxx/index.php?page=post&s=view&id=7728062

Chrome 133.0.6943.59

armorfid avatar Feb 09 '25 17:02 armorfid

Works fine for me in Chrome, check your other extensions and userscripts and then the browser console for messages

Image

Owyn avatar Feb 09 '25 17:02 Owyn

Okay apparently I was still on v2023.08.29, and auto updates were disabled for some reason... My bad!

armorfid avatar Feb 09 '25 17:02 armorfid

Okay so the bug is definitely still present, although it's very random. I haven't figured out how to steadily reproduce it, it just comes and goes. Happens even with all other extensions and other scripts disabled. Since I was using a really old version of Handy Image, and this began recently, I assume it's something with Chrome or Tampermonkey.

When it happens, even if I select "Re-Load page normally" in the TM menu, it stills resizes the reloaded page and "Re-Load page normally" stays in the menu, as if it doesn't remember that I just used that option. When the bug appears, if I try opening the F12 console, then pressing R, the bug disappears and it reloads correctly...

armorfid avatar Feb 09 '25 20:02 armorfid

It uses sessionStorage cookie to prevent itself from resizing the image, might be your other extensions or scripts cleaning it up

Owyn avatar Feb 09 '25 20:02 Owyn

As mentioned, I tried disabling every extension other than Tampermonkey and any other applicable scripts, but it still occurs sometimes. I haven't touched any cookie-related browser settings either. Probably a Chrome bug I guess?

armorfid avatar Feb 09 '25 21:02 armorfid

I have tried opening 10+ tabs in chrome and using R in all of them - all worked fine

Owyn avatar Feb 10 '25 12:02 Owyn

Yeah it's really random, might work fine for 10 minutes then it starts happening all of a sudden, then it might fix itself after a minute, or keep going forever until Chrome is restarted. At least now I can temporarily fix it by pressing R while the F12 console is open. I strongly suspect a Chrome bug.

armorfid avatar Feb 10 '25 14:02 armorfid

That's the website doing it itself with javascript - it's clearing sessionstorage used to store the script's mark "don't run the script"

Image

The easiest fix for you would be to turn off JavaScript for that specific website (no functionality would be lost it seems), you can do that if you have Chrome

Image

, or with a noscript extension in firefox

Image

sankakucomplex also uses JavaScript to block adblocking and redirect you, so blocking it there is also a good idea.

Owyn avatar Feb 20 '25 18:02 Owyn

I think what's happening is that HandyImage kills their getPrevNext() mid-execution by deleting its <script> tag from the page, preventing it from writing the lastRefresh key after clearing storage, thus causing their script to re-clear storage when pressing R because of their isNaN check.

A fix that seems to work for me:

case "rule34.xxx":
    sessionStorage.setItem("lastRefresh", Date.now());
case "rule34.us":

This tricks their script into avoiding storage clearing. It's not ideal, but it's better than turning off JS (which breaks many site features like commenting and adding to favorites)

armorfid avatar Jul 20 '25 16:07 armorfid

Ok, added your fix

Owyn avatar Jul 20 '25 17:07 Owyn