bijij / ViewImage

Extension to re-implement the "View Image" and "Search by image" buttons into google images.
MIT License
780 stars 106 forks source link

Fails to get the visit button: Cannot read properties of null (reading 'cloneNode') #242

Closed ner00 closed 2 years ago

ner00 commented 2 years ago

Describe the bug Just stopped working out of the blue, I'd been using it fine for the past couple years; I'm not exactly sure if it stopped working today or during the week. I've tried in different computers and browsers, using both Firefox and Chrome. I typically just use Firefox, but to make sure it wasn't down to the browser I also tested it on Chrome, which gave a bit more info on the console per the screenshot:

Cannot read properties of null (reading 'cloneNode') and it points to content-script.js, line 134

Seems there is probably a new element or naming convention that doesn't fall into the current 3 switch cases.

To Reproduce Search anything on Google Images.

Expected behavior I would expect it to show the usual "View Image" button.

Screenshots imagem

imagem

System Information

kevingjs commented 2 years ago

Same

ner00 commented 2 years ago

I looked into this closer and it's just that the Visit button has a new class name; this is the PR to fix the issue: https://github.com/bijij/ViewImage/pull/243

In the meantime, I also updated the script to be used with extensions such as GreaseMonkey, TamperMonkey, etc. You can grab the script here: https://gist.github.com/ner00/ec9ae47e202b8e99f19be44a5af6baf3

NOTE: The script linked above will not work if the extension is running at the same time. While the extension isn't updated, you can disable it and use the script instead.

For those who might not know how to install custom scripts to run in your browser, like an extension, follow this:

  1. Make sure to disable or uninstall the View Image extension in your browser (go to settings, find the section with extensions, and disable or uninstall it).

    • Firefox addons URL: about:addons
    • Chrome extensions URL: chrome://extensions/
  2. Install an extension that allows to add custom scripts, most popular are Tampermonkey and Greasemonkey (choose one):

  3. Install the script mentioned, which can be installed directly by clicking here: https://gist.github.com/ner00/ec9ae47e202b8e99f19be44a5af6baf3/raw/viewimage.user.js

MereMoon commented 2 years ago

Thanks ner00. Tried it and it works. Was nervous because this is the first time I've tried something like this but I'm glad it worked.

Edit: The script seems to require refreshing to bring the button back several times and certain searches won't work in the tabs. It seems to be completely random when the button will show up at all. When you're on the main search image page, you can refresh and the button will sometimes appear but when you right click to open the search in a new tab, the button often does not show up at all. Refreshing in the new tab, the button will show up for a split second but then disappear.

ner00 commented 2 years ago
  1. Make sure to disable or uninstall the View Image extension in your browser (go to settings, find the section with extensions, and disable or uninstall it).

@MereMoon Did you really disable or uninstall the original View Image extension like I said? It will do what you report if you haven't disabled it because both scripts will clash with each other.

I've been using it in Chrome and Firefox for the past 2 hours and it has been working as expected (note: I'm using Tampermonkey, if that makes any difference)

MereMoon commented 2 years ago

@ner00 I was under the assumption that we had to disable when installing the script and then reactivate it. I have turned it off and now it is working as it should. Thank you.

hooraytheweird commented 2 years ago

A tiny note, and this might be user error, but I have to secondary click (right-click) and click "open link in new tab" to make this work. If I just click on the "view image" link it redirects me to the page. I'm using this topographical map as an example, but it's all images, not just ones from government websites.

https://user-images.githubusercontent.com/105181147/170851718-daccdb69-8f41-4a11-8fed-e80857f182e7.mp4

ner00 commented 2 years ago

A tiny note, and this might be user error, but I have to secondary click (right-click) and click "open link in new tab" to make this work. If I just click on the "view image" link it redirects me to the page. I'm using this topographical map as an example, but it's all images, not just ones from government websites.

I'm assuming you're speaking about the updated script I shared above. I cannot reproduce your issue.

https://user-images.githubusercontent.com/2269603/170866771-6a70c26f-15fe-490c-bd6b-c8ca5a3dc443.mp4

The behavior of your browser is unusual for a couple reasons, I'm unsure how much of it has to do with macOS, which I cannot test on. Hovering over any link (View Image is a link), should immediately show the URL in the bottom-left corner of the browser, but in your example you hover multiple times and that doesn't happen. The other thing is, Chrome on Windows, and Linux, iirc, when opening a new tab, the new tab gains focus automatically, regardless of being opened via context-menu or direct click - this is different from Firefox - which gives focus to the new tab only when the click is direct and not spawned via context-menu; in any case, these are just observations that are probably inconsequential.

At first glance, what seems to be happening in your example, is that clicking the View Image button does exactly what the Visit button does, which would kind of make sense to some degree since the View Image is a cloned object from the Visit button, but with changes to the name of the button and the target URL - this is essentially what the script or extension does.

What does not correlate with what I mentioned is for it to work when opening in a new tab, something which would not work correctly if the View Image button hadn't loaded the correct target URL for the image. And so, I can't understand how the same button/link can lead to two separate target URLs, one by clicking on it directly and another by right-clicking and opening in a new tab, that's just impossible - it can't be done.

Since I cannot reproduce this issue, can you maybe try disabling every extension you may have to make sure there is no interference? Also, if you can, please post a screenshot of the element inspection (right-click, inspect element), like so:

chrome_k1d0GODJbe

MereMoon commented 2 years ago

Hello, I wanted to give an update as of 6/1

Both methods have now stopped working even after I have refreshed Firefox. As a question could any sort of firewall protection such as Avast cause trouble with the add on?

devilbear commented 2 years ago

It's no longer working for me, either, on Windows 8 in Firefox (with no Avast or other external firewall; that's all handled on a router level and has not been updated or changed in any way since the last time the extension worked).

MereMoon commented 2 years ago

It's no longer working for me, either, on Windows 8 in Firefox (with no Avast or other external firewall; that's all handled on a router level and has not been updated or changed in any way since the last time the extension worked).

While the extension is still not working, you can still view images but you have to do it the old fashion way (I'm working from Windows 11): clt-shift-right click View image in new tab

And it will bring up the full version after you do this from the Google preview viewer. So you can still bring up the original images but something is happening to prevent the extensions to work. Hope this gets fixed soon.

lica98 commented 2 years ago

not working for me either, just when I thought I had this issue fixed 😕

btw does anyone know how to view the images that are displayed after the reverse image search without visiting the sites themselves? like before it used to let you show the image but now it automatically takes you to the site image

MereMoon commented 2 years ago

not working for me either, just when I thought I had this issue fixed 😕

btw does anyone know how to view the images that are displayed after the reverse image search without visiting the sites themselves? like before it used to let you show the image but now it automatically takes you to the site image

Go to the image in the Google preview viewer. Clt-shift-right click on the image and then click Open Image in New Tab. It will bring up the original image and bypass the site. Do this on the larger preview window image and not directly on the smaller thumbnails or it will bring up a smaller version of the actual image.

Example

bijij commented 2 years ago

I've just released version 3.6.3 with the fix for this included, thanks for the PR! It should roll out to webstores over the next few hours. (Except a week for chrome possibly unfortunately)

onmyouji commented 2 years ago

Just updated to 3.6.3 but it still doesn't work. I'm running Firefox 101.0 (64-bit).

Any Firefox users here?

Gummomarx commented 2 years ago

Just updated to 3.6.3 but it still doesn't work. I'm running Firefox 101.0 (64-bit).

Ditto all that.

devilbear commented 2 years ago

Same here in Firefox, and it seems to be making the image results page get stuck in a loading loop for 20+ seconds after the page has actually loaded, in which clicking on things doesn't work until the loading cycle stops. (Happening on every attempt, but doesn't happen with extension disabled.) But still no View Image button appears.

affinage commented 2 years ago

Same here, Firefox 99.0.1 @ mac os 10.13.4, no View Image button

ner00 commented 2 years ago

Fixed the custom script mentioned here, update directly by clicking here.

As for the official extension, thanks for the update @bijij, unfortunately Google changed the Visit text span class today lol Also created a PR for that now.

bijij commented 2 years ago

Fixed the custom script mentioned here, update directly by clicking here.

As for the official extension, thanks for the update @bijij, unfortunately Google changed the Visit text span class today lol Also created a PR for that now.

If google's going to repeatedly change class IDs we might be in for a few weeks of this game. unforunate. I'll bump to 3.6.4 then.

ner00 commented 2 years ago

If google's going to repeatedly change class IDs we might be in for a few weeks of this game. unforunate. I'll bump to 3.6.4 then.

Yeah, sure. It's odd that they haven't touched much of it in a long while and in a span of a week they changed 2 class names.

affinage commented 2 years ago

Can confirm, works now with 3.6.4

Gummomarx commented 2 years ago

Can confirm, works now with 3.6.4

Ditto.

MereMoon commented 2 years ago

If google's going to repeatedly change class IDs we might be in for a few weeks of this game. unforunate. I'll bump to 3.6.4 then.

Yeah, sure. It's odd that they haven't touched much of it in a long while and in a span of a week they changed 2 class names.

A lot of add-ons seem to have stopped working and I've noticed they tend to be the ones most used to override unnecessary changes Google implemented on users. View image, some ad blockers messed up and the return likes/dislikes is also not working.

Edit: Likes/Dislikes IS working. It just turns out when I refreshed Firefiox to update the view image, Firefox auto deleted it from my add-ons so I had no idea it was missing.

ner00 commented 2 years ago

Firefox auto deleted it from my add-ons so I had no idea it was missing

Same, so weird... had to reinstall mine too and I explicitly remember disabling the Tampermonkey script and reinstalling the extension from Mozilla's FF Addon website, no clue why it disappeared on its own... its working though, so fingers crossed for them not to mess it up again.

noosemanAL commented 2 years ago

same, chrome just updated to Version 102.0.5005.63 (Official Build) (64-bit) and View image fails to show

ner00 commented 2 years ago

I've just released version 3.6.3 with the fix for this included, thanks for the PR! It should roll out to webstores over the next few hours. (Except a week for chrome possibly unfortunately)

Comment from the dev, Chrome Web Store is slow af to vet and push updates. Temporary workaround: https://github.com/bijij/ViewImage/issues/242#issuecomment-1139210812

noosemanAL commented 2 years ago

I grabbed script, working On Friday, June 3, 2022, 12:18:10 PM CDT, ner0 @.***> wrote:

I've just released version 3.6.3 with the fix for this included, thanks for the PR! It should roll out to webstores over the next few hours. (Except a week for chrome possibly unfortunately)

Comment from the dev, Chrome Web Store is slow af to vet and push updates. Temporary workaround: #242 (comment)

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

lica98 commented 2 years ago

not working for me either, just when I thought I had this issue fixed 😕 btw does anyone know how to view the images that are displayed after the reverse image search without visiting the sites themselves? like before it used to let you show the image but now it automatically takes you to the site image

Go to the image in the Google preview viewer. Clt-shift-right click on the image and then click Open Image in New Tab. It will bring up the original image and bypass the site. Do this on the larger preview window image and not directly on the smaller thumbnails or it will bring up a smaller version of the actual image.

Example

that works only if you're in the normal image search and not the reverse image search

in reverse image search you can either open the thumbnail or visit the original site, not possible to preview the original image without visiting the site

ner00 commented 2 years ago

that works only if you're in the normal image search and not the reverse image search

in reverse image search you can either open the thumbnail or visit the original site, not possible to preview the original image without visiting the site

There seems to be some misunderstanding, View Image only ever worked in Google Images, but that certainly includes reverse image search. Taking your example, you either click the All sizes - Medium - Large links that take you to Google Images results, or you click the Visually similar images image group which likewise will take you to Google Images and both will allow you to browse all the images and click the View Image button.

chrome_SvzI41cUZZ

If you are explicitly talking about the results of every site listed in the search result - with 64 by XXpx thumbnails - then no, that's not possible without following every site individually since Google does not link the full resolution images, and that would not only be out of scope of this extension but would also require permission to access the whole internet and not just Google.

lica98 commented 2 years ago

that works only if you're in the normal image search and not the reverse image search in reverse image search you can either open the thumbnail or visit the original site, not possible to preview the original image without visiting the site

There seems to be some misunderstanding, View Image only ever worked in Google Images, but that certainly includes reverse image search. Taking your example, you either click the All sizes - Medium - Large links that take you to Google Images results, or you click the Visually similar images image group which likewise will take you to Google Images and both will allow you to browse all the images and click the View Image button.

chrome_SvzI41cUZZ

If you are explicitly talking about the results of every site listed in the search result - with 64 by XXpx thumbnails - then no, that's not possible without following every site individually since Google does not link the full resolution images, and that would not only be out of scope of this extension but would also require permission to access the whole internet and not just Google.

yeah I'm talking about the image that is shown exactly next to the website, before when you clicked that image it showed you a preview like on normal image search but now when you click on it it takes you directly to the website (this changed a year ago maybe)

the problem with visiting the site is that sometimes that image isn't even found on the site or it is in a different size than the one listed in google and "all sizes" doesn't always appear (and when it does it doesn't always include every single size listed in the results) (if all sizes doesn't appear what I usually do is open the 64x image in a new tab and google search that image, sometimes it gives you "all sizes" after that)

kiwichick888 commented 2 years ago

Using Firefox 101.0.1 (64-bit)

The fix from ner00 didn't work for me, unfortunately.

I did the following:

  1. Disabled View Image addon.
  2. Installed Greasemonkey for Firefox.
  3. Installed the script using the direct install link.

I also did a restart of Firefox after each of these steps and the View Image button is still not present.

Gummomarx commented 2 years ago

Stopped working here this morning on Firefox 101.0.1 (64-bit).

bijij commented 2 years ago

Should be fixed up now for firefox, again chrome is pending review. hopefully doesn't take too long.

Gummomarx commented 2 years ago

Working now - thanks very much for your efforts.

MereMoon commented 2 years ago

Hello, giving an update that the button doesn't seem to be working on my end again. I removed and reinstalled the extension and the results are the same as before. Should I just use the go around?

Update: Refreshed Firefox again. Button is now working. Thank you again for continuing to update everything as it does feel like Google is trying to 'work around' this.

ner00 commented 2 years ago

@MereMoon That's strange, I just tried it (removed, close, reinstalled) and it worked on both Chrome and Firefox just fine. Make sure the extension installed is v3.6.5, and also:

  • If you previously used the UserScript with Tampermonkey, make sure to disable it or uninstall it since if both are used concurrently they will interfere with each other;

  • Make sure to close the browser and return to the list of installed extensions, one time mine disappeared mysteriously after re-installation;

  • Make sure you're not on a private tab (would need specific permissions for those);

  • When in Google Images, press CTRL+F5 - or SHIFT+F5 in macOS - to reload the page/cache.

MereMoon commented 2 years ago

@MereMoon That's strange, I just tried it (removed, close, reinstalled) and it worked on both Chrome and Firefox just fine. Make sure the extension installed is v3.6.5, and also:

  • If you previously used the UserScript with Tampermonkey, make sure to disable it or uninstall it since if both are used concurrently they will interfere with each other;
  • Make sure to close the browser and return to the list of installed extensions, one time mine disappeared mysteriously after re-installation;
  • Make sure you're not on a private tab (would need specific permissions for those);
  • When in Google Images, press CTRL+F5 - or SHIFT+F5 in macOS - to reload the page/cache.

I made an update to my previous post that refreshing Firefox seems to do the trick. If it doesn't work after an update, it seems the only way to make certain it does so is to do a complete refresh of the browser which unfortunately will uninstall any add-ons and extensions you previous had but once it is reinstalled, everything works as it should.

I'm going to keep an eye on how long this new update lasts because I do have a feeling Google is trying to nix any go-arounds to the whole tedious 'you must visit the page to see the image' thing they implemented. To think all of this started over Getty getting petty that effected EVERY image you see on Google even if they aren't even owned by Getty.

kiwichick888 commented 2 years ago

Should be fixed up now for firefox, again chrome is pending review. hopefully doesn't take too long.

Thanks, it's working for me in FF 101.0.1 (64-bit)

ner00 commented 2 years ago

I had some issues at times but on those rare occasion force-refreshing the page (CTRL+F5) has always worked form me, before the nuclear option I would probably clear the Web Content (without clearing history, cookies, etc). Haven't had completely refresh the browser, but I guess it can be up to each individual system at times.

As for Google's recent switcharoo, it is weird by the frequency alone, although I wouldn't immediately attribute any meaning to it. The Getty mess was about 3-4 years ago, and having third-party extensions exempts Google entirely, at worst copyright-holders like Getty, or Google by extension (no pun), would just target the extension itself.

Also, it seems that Josh hardened it this time around by including the span object to the list of elements to look for, so maybe it'll be alright.

MereMoon commented 2 years ago

I had some issues at times but on those rare occasion force-refreshing the page (CTRL+F5) has always worked form me, before the nuclear option I would probably clear the Web Content (without clearing history, cookies, etc). Haven't had completely refresh the browser, but I guess it can be up to each individual system at times.

As for Google's recent switcharoo, it is weird by the frequency alone, although I wouldn't immediately attribute any meaning to it. The Getty mess was about 3-4 years ago, and having third-party extensions exempts Google entirely, at worst copyright-holders like Getty, or Google by extension (no pun), would just target the extension itself.

Also, it seems that Josh hardened it this time around by including the span object to the list of elements to look for, so maybe it'll be alright.

Okay, update at 0219 for an observation; the button will vanish at random but will pop back up if you click on another image in results. Interesting observation on how it's working.