Forked from erikvold/gistUserScriptInstallLink.user.js
Last active
August 29, 2015 13:57
-
-
Save LouCypher/9351168 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Gist UserScript Install Link | |
// @author Erik Vold | |
// @namespace gistUserScriptInstallLink | |
// @include https://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 @original-title='View Raw']",doc,null,6,null), | |
userscript,raw; | |
for(var i=userscripts.snapshotLength-1;i>-1;i--){ | |
userscript = userscripts.snapshotItem(i); | |
userscript.innerHTML = 'install'; | |
raw = userscript.cloneNode(false); | |
raw.innerHTML = 'raw'; | |
raw.href = raw.href + "?"; | |
userscript.parentNode.insertBefore(raw,userscript); | |
} | |
})(document); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment