Forked from SignpostMarv/github-commit-diff-link.user.js
Last active
December 21, 2015 18:19
-
-
Save nathan-osman/6346593 to your computer and use it in GitHub Desktop.
Adds a "View Diff" button to commit pages.
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 container = document.getElementById('toc').getElementsByClassName('explain')[0], | |
loc = window.location + '', | |
link = document.createElement('a'); | |
if(window.location.hash != '') | |
loc = loc.replace(window.location.hash, ''); | |
link.setAttribute('hotkey', 'r'); | |
link.appendChild(document.createTextNode('View Diff')); | |
link.setAttribute('href', loc + '.diff'); | |
link.setAttribute('class', 'minibutton'); | |
container.appendChild(link); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment