Skip to content

Instantly share code, notes, and snippets.

@jasonk
Last active September 30, 2019 21:15
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasonk/24bd00ff72b686f0b8a098290ef754bf to your computer and use it in GitHub Desktop.
Save jasonk/24bd00ff72b686f0b8a098290ef754bf to your computer and use it in GitHub Desktop.
TamperMonkey Utility Scripts

TamperMonkey Utility Scripts

To use, include them in your TamperMonkey script, like so:

// @require https://gist.githubusercontent.com/jasonk/24bd00ff72b686f0b8a098290ef754bf/raw/tampermonkey-utils.js
// @require https://gist.githubusercontent.com/jasonk/24bd00ff72b686f0b8a098290ef754bf/raw/tampermonkey-cleanup.js

Note that tampermonkey-utils.js must be loaded before any of the others are loaded.

if ( ! TMU ) throw new Error( 'You must require "tampermonkey-utils.js" first!' );
TMU.cleanup = {};
TMU.cleanup.nuke = function( /* arguments */ ) {
Array.from( arguments ).forEach( selector => {
TMU.find( selector ).forEach( el => {
console.log( 'EL', el );
} );
document.querySelectorAll( selector )
console.log( 'SELECTOR', selector );
} );
};
var TMU = {};
TMU.find = function( selector ) {
return Array.from( document.querySelectorAll( selector ) );
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment