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
2
votes
1 answer

How to define multi-line @description metadata?

None of the following works: // @description ...text1... // @description ...text2... Only text2 is displayed. // @description ...text1... ...text2... Only text1 is displayed. // @description ...text1... // …
Gerold Broser
  • 14,080
  • 5
  • 48
  • 107
2
votes
1 answer

How do I take text contained in web page and make it part of the page title?

I desperately need help with writing a Tampermonkey/Greasemonkey script that takes part of the information within the web page and makes it part of the page (and window) title. A client's name is part of the target (internal) web page, and clearly…
kwantum
  • 59
  • 6
2
votes
0 answers

Why is 'window.location.href' returning "about:blank" in this userscript?

This very simple userscript has been getting the best of me: // ==UserScript== // @name TEMP // @match https://*.facebook.com/ // @match https://*.facebook.com/?* // @grant none // @run-at document-start //…
Marc.2377
  • 7,807
  • 7
  • 51
  • 95
2
votes
1 answer

@grant GM functions from @require'd script

I'm writing a series of Greasemonkey scripts. Those scripts share most of their features, so I thought useful to extract the common features. In common.js are common features, and they call GM_functions (e.g. GM.xmlHttpRequest). Each userscript…
OoDeLally
  • 552
  • 1
  • 5
  • 21
2
votes
1 answer

Syntax differences between Tampermonkey and Greasemonkey?

I've been trying to transfer a lot of my Tampermonkey (in Google Chrome) userscripts to Greasemonkey in FireFox. Unfortunately, it seems that they don't work properly when I transfer them into Greasemonkey - I'm assuming there are syntactical…
theCrabNebula
  • 731
  • 2
  • 13
  • 29
2
votes
1 answer

How do I replace unsafeWindow when migrating a pre-Firefox 30 Greasemonkey script to GM4+?

I'm trying to get a reference to the version of jQuery that exists on my webpage in a Greasemonkey script that worked until Firefox 30. In comments below my definition are the two other references I could find, but I just get ReferenceError: $ is…
NobleUplift
  • 5,631
  • 8
  • 45
  • 87
2
votes
0 answers

Greasemonkey 4.x: working with multiple .js files

I'm working on a user script that's growing in size and getting a little bit hard to manage, so I was thinking of moving some functionality to a separate .js file (or files). AFAIK, (since GM 4.0) you can't really access your script's location on…
Cren7ist
  • 41
  • 2
2
votes
1 answer

Greasemonkey: "GM_xmlhttpRequest is not defined" with the new update

Why this simple Greasemonkey script is not working for me https://jsfiddle.net/pghnsw8z/1/ ? I mean that instead of getting successful response I get error while making an ajax call. // ==UserScript== // @name _Starter AJAX request in GM, TM,…
Peter
  • 21
  • 1
  • 3
2
votes
0 answers

jQuery-UI dialog box 'x' button image is missing (Userscript in Greasemonkey 4.1beta4)

I use Greasemonkey 4.1beta4 (latest beta) in FF57. With the following script (for reference, here is the full script) the dialog box is indeed created, but unfortunately it has an empty gray square where the close icon should be: //…
darkred
  • 591
  • 5
  • 28
1
vote
2 answers

Can I @require an ES6 module in greasemonkey?

TLDR; Is it possible to load an ES6 module into the sandboxed DOM of GreaseMonkey in a way that is similar to doing a @require? Going a little nuts here. I've been writing a GM script in Firefox to "enhance" a certain website with custom…
DanielSmedegaardBuus
  • 977
  • 1
  • 10
  • 18
1
vote
0 answers

Userscript not capturing ctrlKey keydown event

The following userscript is not capturing the ctrlKey event. // ==UserScript== // @name CtrlKey alert // @namespace CtrlKey alert // @include * // @run-at document-start // ==/UserScript== document.addEventListener( "keydown", …
1
vote
1 answer

How can I use greasemonkey to change vue.js app model / template?

My target is to change / extend the template of a production vue.js app with a greasemonkey script in a third-party website. (so I have no access to the site / app sources) It is possible to get access to the Vue instance in the browser console…
1
vote
1 answer

What makes those two invocations of addEventListener differ, resulting in one having an effect and the other not?

I was trying to write a Greasemonkey script that hooks to onclick of a specific element. Here's the code that doesn't work (seems to be ignored silently, has no observable effect): img = document.evaluate('//img [@title="Play / Pause"]',…
d33tah
  • 10,999
  • 13
  • 68
  • 158
1
vote
0 answers

Wait until a node is available without using an interval or fixed retry time

Is there a smarter solution to wait until a node exists without using an interval or a fixed retry time? Currently, I do such like this: let interval = setInterval(function () { let neededElement = document.querySelector("small > time"); if…
1
vote
1 answer

How to interact with elements of the tab opened with GM_openInTab

I am opening a new tab using GM_openInTab inside my tampermonkey script, but I am not able to interact with the elements of this new tab using my code. I simply want to click a button in the newly opened tab as soon as it opens and close it…