Last active
September 15, 2021 11:58
-
-
Save justdanpo/cd7e195e4b2673d9db338478d23e294e to your computer and use it in GitHub Desktop.
gist.github.com updateable raw links
This file contains hidden or 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.github.com updateable raw links | |
// @namespace https://gist.github.com/justdanpo | |
// @version 0.3 | |
// @description gist.github.com updateable raw links | |
// @author den_po | |
// @match https://gist.github.com/* | |
// @grant none | |
// @run-at document-end | |
// ==/UserScript== | |
(function() { | |
document.querySelectorAll('div.file-actions > a').forEach(function(node) { | |
if (node.text.trim() == 'Raw') { | |
var newNode = node.cloneNode(); | |
newNode.href = newNode.href.replace(/\/raw\/.+?\//, '/raw/'); | |
newNode.text = 'Raw updateable'; | |
node.parentNode.appendChild(newNode); | |
} | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment