Questions tagged [greasemonkey-4]

Greasemonkey 4 is a major milestone, breaking most of the Greasemonkey scripts for earlier versions (although a polyfill restores some compatibility).

Note that for maximum compatibility of existing scripts, Greasemonkey recommends that you switch to Tampermonkey or Violentmonkey:

As mentioned in the main post, Greasemonkey 4 is changing how it runs user scripts. Many user scripts will continue to run as expected, but this will break some scripts. If you rely on such scripts, you might want to install Violentmonkey or Tampermonkey, both of which provide better compatibility for existing scripts.


Additional references:

97 questions
1
vote
1 answer

Greasemonkey throws "DOMException: The operation is insecure." on document.implementation.createHTMLDocument().open()

FF 84.0.2, GM 4.10.0 The code can be seen at GitLab. The relevant part is: ... const doc = document.implementation.createHTMLDocument('http://www.w3.org/1999/xhtml', 'html'); console.debug("DOC CREATED") doc.open() // <--…
1
vote
1 answer

How to login to neopets.com through GM userscript

I created a userscript which starts at the Neopets login page and autofills the username and password. I am having trouble getting the script to click the giant green "LOG IN"…
1
vote
1 answer

Custom event addEventListener not working when extending EventTarget class in Greasemonkey script

This script works when pasted in a developer console under FireFox, but does not work when run as a Greasemonkey script, and I'm not entirely sure why. There was no documentation or much discussion around "extends EventTarget" and "dispatchEvent." …
pp19dd
  • 3,625
  • 2
  • 16
  • 21
1
vote
0 answers

greasemonkey script not works vs enhancer for youtube works

I'm a bit disturbed, when i tried this code in youtube website var str = "My String", el = document.querySelector("h1"); el.innerHTML = str; It's work with "custom script" in the firefox's module "Enhancer for Youtube" but doesn't work when i put…
norwood
  • 11
  • 1
1
vote
1 answer

Greasemonkey: How to remove random url parts?

I need to change images like this…
1
vote
1 answer

Is it possible to use GM_xmlhttpRequest to my data form using greasemonkey/tampermonkey?

I am currently working on GM_getvalue but it only saves data on the local storage. I wanted to save the inputted values to my server where send.php is located. This is my code: var $ = unsafeWindow.jQuery; $(document).ready(function() { …
1
vote
0 answers

Read a local json file(e.g. from c: drive) for rest service data input

In greasemonkey javascript i need to read a JSON data file from local drive(e.g c: drive). How i can read ? tried to use :- GM_getResourceText // ==UserScript== // @name #### // @version 1 // @grant GM.xmlHttpRequest //…
1
vote
1 answer

What happens to 'this' between two calls of .each()?

The following code in a GM script in FF 68.0.1: let input = $( 'input#id' ); input.each( function(){console.debug(this)} ); input.each( debugn(this) ); function debugn( message ) { console.debug(message) } prints first: as…
Gerold Broser
  • 14,080
  • 5
  • 48
  • 107
1
vote
4 answers

How to make a script redirect only once every time an appropriate page loads?

I'm writing a Tampermonkey script that I want to use to redirect from youtube.com/* to a YouTube channel address. window.addEventListener ("load", LocalMain, false); function LocalMain () { …
1
vote
1 answer

Firefox doesn't respect Object.defineProperty() from a Greasemonkey script?

I'm writing a userscript to prevent a website to set document.body.innerHTML, this is a typical sign of a website detecting adblock: (function() { 'use strict'; console.log("Loading ..."); Object.defineProperty(document.body,…
1
vote
2 answers

GM.xmlHttpRequest : Could not understand the URL

I wanted to try ACQUA userscript for stackoverflow but I got an error : Script error: Error: "GM.xmlHttpRequest : Could not understand the URL : https://acqua.kmi.open.ac.uk/predict TypeError: URL is not a constructor I think it is…
user2226755
  • 12,494
  • 5
  • 50
  • 73
1
vote
1 answer

Specific Website content removal via Greasemonkey

I know similar questions have been asked countless times, I've been reading through them for a while now, but I can't seem to get it to work for my case, I've read through the following and tried to apply those solutions to my case, all from Stack…
Edwin
  • 21
  • 4
1
vote
1 answer

Whole-word matching with jQuery and contains()

I'm writing a Greasemonkey script to selectively hide elements containing nasty stuff (a personal web sanitizer, if you will). Here's what I've got so far: //custom contains function which is case-insensitive $.extend($.expr[":"], { "containsNC":…
1
vote
1 answer

greasemonkey - run script when html and css is loaded

As the title says, I want to wait until the html is parsed, and all stylesheets are loaded, because I need to use currentsyle. However, I do not want to wait for images. So I cannot use load event, as that waits for images. And I can't use the…
user234683
  • 323
  • 3
  • 8
1
vote
0 answers

Permission denied to access object when trying to call Greasemonkey-4 injected function

I want to add debug function to the page that allows me to click N times given element as one liner JS console call. I have following short script: // ==UserScript== // @name Click given button N times // @version 1 //…
Antoniossss
  • 31,590
  • 6
  • 57
  • 99