Skip to content

Instantly share code, notes, and snippets.

@brianbolger
Last active August 29, 2015 14:11
Show Gist options
  • Save brianbolger/7506e6f32e8aee60bc80 to your computer and use it in GitHub Desktop.
Save brianbolger/7506e6f32e8aee60bc80 to your computer and use it in GitHub Desktop.
Tampermonkey script to load jQuery to a page
addJQuery(main);
function addJQuery(callback)
{
var script = document.createElement("script");
script.setAttribute("src", "https://code.jquery.com/jquery-1.11.1.min.js");
script.addEventListener('load', function() {
var script = document.createElement("script");
script.textContent = "window.jQ=jQuery.noConflict(true);(" + callback.toString() + ")();";
document.body.appendChild(script);
}, false);
document.body.appendChild(script);
}
function main()
{
alert("jQuery loaded & ready!");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment