Skip to content

Instantly share code, notes, and snippets.

@jasonsyoung
Last active March 25, 2020 10:01
Show Gist options
  • Save jasonsyoung/d569af9e12c1c25a6e8556c06dd6b766 to your computer and use it in GitHub Desktop.
Save jasonsyoung/d569af9e12c1c25a6e8556c06dd6b766 to your computer and use it in GitHub Desktop.
GitHub UI Improvements user script
// ==UserScript==
// @name GitHub UI Improvements
// @namespace https://gist.github.com/jasonsyoung/d569af9e12c1c25a6e8556c06dd6b766
// @match https://github.com/*/*
// @match https://gist.github.com/*
// @author jasonsyoung
// @description Widens any page with code or repository listing to 95%, adds the FuraCode Nerd Font Mono as the preferred font for these code areas, else fallback. More to come!
// @version 0.2
// ==/UserScript==
(function () {
const css = `.repository-content * { font-family: 'FuraCode Nerd Font Mono Retina','FuraCode Nerd Font Mono','FuraCode NF Mono',SFMono-Regular,Consolas,Liberation Mono,Menlo,monospace !important; }`;
const style = document.createElement('style');
style.innerHTML = css;
let interval = setInterval(function () {
if (document.querySelector('.repository-content')) {
widen()
} else {
window.console.log('repository content not found yet');
document.head.removeChild(style);
}
}, 1000);
function widen() {
let container = document.querySelector('main > div.container-lg');
if (!container.classList.contains('tamper-modified')) {
container.style.maxWidth = '95%';
document.head.appendChild(style);
}
}
window.addEventListener('onbeforeunload', function() {
clearInterval(interval)
}, false);
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment