Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
var console = unsafeWindow.console;
// a function that loads jQuery and calls a callback function when jQuery has finished loading
function addJQuery(callback) {
var script = document.createElement("script");
script.setAttribute("src", "");
script.addEventListener('load', function() {
var script = document.createElement("script");
script.textContent = "(" + callback.toString() + ")();";
}, false);
// the guts of this userscript
function main() {
console.log("There are " + $('a').length + " links on this page.");
// load jQuery and execute the main function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.