Created
January 29, 2010 06:04
-
-
Save erikvold/289492 to your computer and use it in GitHub Desktop.
This userscript will add an 'Install' link to all userscript files (which end with .user.js by necessity).
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 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,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 = "view-source:" + raw.href; | |
userscript.parentNode.insertBefore(raw,userscript); | |
} | |
})(document); |
franky714oc
commented
Jul 9, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment