Owyn / HandyImage

browser userscript (extension) which Shows just fullsize Image with hotkeys & without pop-ups on many image-hosting sites
https://greasyfork.org/scripts/109-handy-image
273 stars 58 forks source link

[fix] support for "pictwn.com" and "outletpic.com" #577

Closed OldManYellsAtCode closed 8 months ago

OldManYellsAtCode commented 8 months ago

Issue #540 seems to be back. For "pictwn.com" or "outletpic.com" HandyImage just shows a 1x1 placeholder image.

I'm using a new Chrome profile with no extensions other than Tampermonkey (and the default Google Docs Offline).

Samples:


Looking at the page with the "Continue to Image..." button, I see a 1x1 image element, with attributes matching what HandyImage is looking for:

Outletpic: <img src="/images/1x1.png" class="picview" alt="1x1.png" onload="scaleImgz(this)" style="width:1px;border:none;">

Pictwn: <img src="/images/1x1.png" class="picview" alt="1x1.png" style="width:1px;border:none;">

I don't know if this will help but I did some tinkering.

First I changed HandyImage to not pick up the 1x1 image (in the section for pictwn):

diff --git a/HandyImage.user.js b/HandyImage.user.js
index d5d7405..4f345ee 100644
--- a/HandyImage.user.js
+++ b/HandyImage.user.js
@@ -2116,7 +2116,7 @@ function makeworld()
        case "meetimgz.com":
                j = true;
                dp=true;
-               i = q('img.picview');
+               i = q("img.picview[alt!='1x1.png']");
                if(i)
                {
                        if(!i.getAttribute("src") || !i.getAttribute("src").length)

Then I noticed that the "Continue to Image..." button was a <input type="submit"> button and wouldn't match the [type='button'] and button queries HandyImage does, so in the Javascript console I did a query for input[type='submit'] buttons:

> var f = document.querySelectorAll("input[type='submit']");
undefined
> f
NodeList(5) [input.j8jl, input.j8jl, input.j8jl, input.j8jl, input.j8jl]

Then I ran the button-clicking loop from HandyImage:

        if(f.length)
        {
            let n;
            for(n=f.length-1; n >= 0; n--)
            {
                if(window.getComputedStyle(f[n]).visibility != "hidden" && f[n].offsetWidth != 0 && f[n].value.indexOf("eply") == -1 && f[n].value.indexOf("Log") == -1)
                {
                    f[n].removeAttribute("disabled");
                    f[n].click();
                    i = 1;
                    break;
                }
            }
        }

Running the loop a second time in the console triggered HandyImage to display the right image.

Owyn commented 8 months ago

your sample images say "File Not Found" tho

OldManYellsAtCode commented 8 months ago

They work for me. I'd provide screenshots, but the ads are NSFW.

How about the images in the sample gallery from #540?

https://outletpic.com/?fld_hash=4v3tke67&op=gallery&per_page=15&page=19

Or maybe the pre-redirect URLs for my samples?

https://usefto.com/nxovdtbwess8/tumblr_o4uk4iIIqE1ujcnkeo7_1280.jpg.html

https://imgtown.net/ia23jim9skex/IM032x04.jpg.html

Owyn commented 8 months ago

fixed now