Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save anfedorov/1100396 to your computer and use it in GitHub Desktop.
Save anfedorov/1100396 to your computer and use it in GitHub Desktop.
This userscript is meant to be an example on how to use jQuery in a userscript on Google Chrome.
// ==UserScript==
// @name helpers
// @namespace anfedorov
// @include *
// @author Andrey Fedorov
// @description
// ==/UserScript==
function load(library) {
var script = document.createElement("script");
script.setAttribute("src", library);
document.body.appendChild(script);
}
function load_jQuery(callback) {
var script = document.createElement("script");
script.setAttribute("src", "http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js");
document.body.appendChild(script);
}
jQuery("a.q1[href*=item=]").map(
function () {
$(this).attr(
'href',
"http://theunderminejournal.com/item.php?realm=A-Aerie%20Peak&item=" + $(this).attr('href').match("/item=([0-9]+)$")[1]
);
}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment