Forked from LouCypher/gistUserScriptInstallLink.user.js
Last active
December 9, 2019 07:18
-
-
Save surkin/ffbcaeb5afa6f155a8d6 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 https://gist.github.com/* | |
// @version 0.9 | |
// @license GPL version 3 or any later version; http://www.gnu.org/copyleft/gpl.html | |
// @description This userscript will add an 'Install' link to all userscript files (which end with .user.js by necessity). | |
// @downloadURL https://gist.github.com/surkin/ffbcaeb5afa6f155a8d6/raw/e62b203f2ef9233b1894552b7b53408115434051/gistUserScriptInstallLink.user.js | |
// @grant none | |
// ==/UserScript== | |
(function (doc) { | |
var userscripts = doc.evaluate("//a[contains(substring(@href,string-length(@href)-9),'.user.js') and @original-title='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