Created
March 14, 2011 15:33
-
-
Save SignpostMarv/869319 to your computer and use it in GitHub Desktop.
github.com raw diff link greasemonkey script
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 github.com raw diff link | |
// @namespace github.com | |
// @description Appends raw diff link | |
// @include https://github.com/*/*/commit/* | |
// ==/UserScript== | |
var | |
file = document.getElementsByClassName('file')[0], | |
code = file.getElementsByTagName('code')[0], | |
li = code.parentNode.parentNode, | |
loc = window.location + '', | |
rawlink = document.createElement('a') | |
; | |
if(window.location.hash != ''){ | |
loc = loc.replace(window.location.hash,''); | |
} | |
rawlink.setAttribute('hotkey', 'r'); | |
rawlink.appendChild(document.createTextNode('view diff')); | |
rawlink.setAttribute('href',loc + '.diff'); | |
rawlink.setAttribute('style','margin-left:1em;'); | |
li.appendChild(rawlink); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment