Created
June 7, 2018 04:34
-
-
Save jaywick/c80b5a0ead48bb0216d02d2c767251ae to your computer and use it in GitHub Desktop.
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 PR Helpers | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description Additional tools for reviewing PRs | |
// @author @jayw | |
// @match https://YOURGITTHINGY/*/*/pull/*/files* | |
// @grant none | |
// ==/UserScript== | |
(function () { | |
'use strict'; | |
document.querySelector(".diffbar-item.diffstat").innerHTML += [ | |
`<button type="button" class="btn btn-sm" id="btn-toggle-whitespace">Toggle Whitespace</button>`, | |
`<button type="button" class="btn btn-sm" id="btn-collapse-expand">Collapse/Expand</button>`, | |
`<button type="button" class="btn btn-sm" id="btn-expand-hunks">Expand Hunks</button>`].join('\n'); | |
document.querySelector('#btn-toggle-whitespace').onclick = () => { | |
if (window.location.href.includes('?w=1')) { | |
window.location.href = window.location.href.replace('?w=1', '') | |
} else { | |
window.location.href += '?w=1'; | |
} | |
} | |
document.querySelector('#btn-collapse-expand').onclick = () => document.querySelectorAll('.js-details-target').forEach(x => x.click()); | |
document.querySelector('#btn-expand-hunks').onclick = () => document.querySelectorAll('.js-expand').forEach(x => x.click()); | |
console.log('loaded github pr helpers'); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment