Last active
October 15, 2018 09:07
-
-
Save nenadom/8925aac4122b4cee75d8ed13034f49dc to your computer and use it in GitHub Desktop.
Bookmarklet for compact view on GitHub Pull request file changes.
This file contains 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
javascript:+function () { | |
/** | |
* Bookmarklet for compact view on GitHub Pull request file changes. | |
*/ | |
'use strict'; | |
let d, s, sh, id; | |
id = '__toggleCompactStyles__'; | |
d = document, s = d.getElementById(id); | |
if (!s) { | |
s = d.createElement('style'); | |
s.id = id; | |
d.head.appendChild(s); | |
} | |
sh = s.sheet; | |
if (sh.cssRules.length) { | |
sh.deleteRule(1); sh.deleteRule(0); | |
} else { | |
d.querySelectorAll('.file.open > .file-header.js-file-header > .file-actions > button').forEach(btn => { btn.click() }); | |
sh.insertRule('.file { margin: -2px 0 0 !important; }', 0); | |
sh.insertRule('.file-header { padding: 0 10px }', 1); | |
} | |
}(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment