TamperMonkey userscript not working

See original GitHub issue

This was working, but it looks like Google have changed their page causing the script to fail when trying to add the button.

Example link: https://www.google.co.uk/search?q=sega+power+strip&num=40&tbm=isch

Output from console:

Uncaught TypeError: Cannot set property 'innerText' of null
    at addButton (userscript.html?id=cd697653-4be5-43f7-b18b-1d1540ce687a:51)
    at addedNodes.forEach (userscript.html?id=cd697653-4be5-43f7-b18b-1d1540ce687a:81)
    at NodeList.forEach (<anonymous>)
    at mutations.forEach (userscript.html?id=cd697653-4be5-43f7-b18b-1d1540ce687a:80)
    at Array.forEach (<anonymous>)
    at MutationObserver (userscript.html?id=cd697653-4be5-43f7-b18b-1d1540ce687a:77)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
jeffrzcommented, Mar 12, 2018

It looks like when openButton is cloned in the extension, it no longer contains the class “._WKw”. This makes the querySelector call return a null result which kills the innerText property access. Adjusting the querySelector ought to fix it.

When I recompiled the extension with the line changed to “button.querySelector(‘a’).innerText = localizedViewImage;” it worked just fine.

1reaction
devuntcommented, Mar 17, 2018

Fixed by #66.

Read more comments on GitHub >

github_iconTop Results From Across the Web

My tampermonkey script isn't working in the webapp part of ...
Make sure your userscript is actually executed. You can use console.log to check if it's executed or check the Tampermonkey panel if it's ......
Read more >
TamperMonkey script does not run - Reddit
Visit the page where the script is supposed to run, then click on the tampermonkey icon next to the address bar. Is the...
Read more >
Tampermonkey • FAQ
Q202: Tampermonkey missing, there is no icon and no script is running. Where are my scripts and what happened? A202: In order to...
Read more >
[Firefox] Tampermonkey doesn't load my script sometimes. #750
I have script that is injected to a web page using the Tampermonkey extension. The page should be loaded as usual, then the...
Read more >
Tamper Monkey Scripts Stopped Working - Help!
I've recently had all my scripts on Tamper Monkey stopped working. I've been troubleshooting all the suggestions on the API forum but ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found