Last active
March 25, 2020 10:01
-
-
Save jasonsyoung/d569af9e12c1c25a6e8556c06dd6b766 to your computer and use it in GitHub Desktop.
GitHub UI Improvements user script
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 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