Skip to content

Instantly share code, notes, and snippets.

@nenadom
Last active October 15, 2018 09:07
Show Gist options
  • Save nenadom/8925aac4122b4cee75d8ed13034f49dc to your computer and use it in GitHub Desktop.
Save nenadom/8925aac4122b4cee75d8ed13034f49dc to your computer and use it in GitHub Desktop.
Bookmarklet for compact view on GitHub Pull request file changes.
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