Skip to content

Instantly share code, notes, and snippets.

@erikvold
Created June 14, 2010 10:06
Show Gist options
  • Select an option

  • Save erikvold/437513 to your computer and use it in GitHub Desktop.

Select an option

Save erikvold/437513 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 jQuery For Chrome Example
// @namespace jQueryForChromeExample
// @include *
// @version 0.1
// @author Erik Vergobbi Vold
// @license GPL version 3 or any later version; http://www.gnu.org/copyleft/gpl.html
// @description This userscript is meant to be an example on how to use jQuery in a userscript on Google Chrome.
// ==/UserScript==
var script = document.createElement("script");
script.setAttribute("src", "http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js");
script.setAttribute("async", "true");
script.onload = function() {alert("There are " + $('a').length + " links on this page.");};
document.body.appendChild(script);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment