Skip to content

Instantly share code, notes, and snippets.

@simonrob
simonrob / GM_addStyle.js
Last active February 21, 2024 09:57
A drop-in replacement for GM_addStyle
/* GM_addStyle(): A drop-in replacement for the standard GM_addStyle for use where this function is not natively supported.
Add as a requirement in the Userscript header:
// @require https://gist.githubusercontent.com/raw/51e2fe655d4d602744ca37fa124869bf/GM_addStyle.js
Usage example:
GM_addStyle('p { color: red; }');
*/
/**
* GM_addStyle
@simonrob
simonrob / waitForKeyElements.js
Last active March 15, 2024 14:57 — forked from double-beep/waitForKeyElements.js
A utility function, for Greasemonkey scripts, that detects and handles AJAXed content.
/* waitForKeyElements(): The improved utility function for userscripts - now with MutationObservers and no jQuery!
Usage example:
waitForKeyElements(
'div.comments',
element => console.log('Look! A new element appeared!', element)
);
// -----------------------------------------------------------------

Keybase proof

I hereby claim:

  • I am simonrob on github.
  • I am simonrobinson (https://keybase.io/simonrobinson) on keybase.
  • I have a public key whose fingerprint is 40CF 84F0 4721 D1B4 EC76 96B5 BD29 1593 D30F 5C51

To claim this, I am signing this object: