Skip to content

Instantly share code, notes, and snippets.

@erikvold
Created January 19, 2010 10:51
Show Gist options
  • Save erikvold/280845 to your computer and use it in GitHub Desktop.
Save erikvold/280845 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Gist UserScript Install Link
// @author Erik Vold
// @namespace gistUserScriptInstallLink
// @include http://gist.github.com/*
// @version 0.1
// @license GPL version 3 or any later version; http://www.gnu.org/copyleft/gpl.html
// @datecreated 2010-01-28
// @lastupdated 2010-01-28
// @description This userscript will add an 'Install' link to all userscript files (which end with .user.js by necessity).
// ==/UserScript==
(function(doc){
var userscripts = doc.evaluate("//a[contains(substring(@href,string-length(@href)-9),'.user.js') and text()='raw']",doc,null,6,null),
userscript;
alert(userscripts.snapshotLength);
for(var i=userscripts.snapshotLength-1;i>-1;i--){
userscript = userscripts.snapshotItem(i);
}
})(document);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment