Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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