Skip to content

Instantly share code, notes, and snippets.

@blubbll
Last active November 10, 2018 22:20
Show Gist options
  • Save blubbll/f4fe5a61053ea57ab8a3f166c791ce2b to your computer and use it in GitHub Desktop.
Save blubbll/f4fe5a61053ea57ab8a3f166c791ce2b to your computer and use it in GitHub Desktop.
GitHub Userscript for rawgit instead of rawgit. (https://rawgit.com/)
//GitHub raw to RawGit. enjoy.
//Example:
//https://github.com/lokesh/color-thief/raw/master/dist/color-thief.min.js
//becomes
//https://rawgit.com/lokesh/color-thief/master/dist/color-thief.min.js
var rawgitURL = 'http://rawgit.com';
//If this Button exists (raw button)
if (typeof document.getElementById("raw-url") != "undefined"){
//Set href of element by getting the original source and appending rawgit
document.getElementById("raw-url").setAttribute("href",
rawgitURL +
document.getElementById("raw-url").getAttribute("href")
.replace('/raw', '')); //fix url
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment