dotfiles/web/userscripts/github-line-height.user.js

35 lines
855 B
JavaScript
Raw Normal View History

2021-05-08 12:53:40 +00:00
// ==UserScript==
// @name GitHub line-height
// @version 3
// @grant none
2021-05-08 12:53:40 +00:00
// @match https://github.com/*
// @match https://gist.github.com/*
// @run-at document-start
// ==/UserScript==
(() => {
'use strict';
2021-05-08 12:53:40 +00:00
const LINE_HEIGHT = '1.2';
function addStylesheet() {
let style = document.createElement('style');
style.append(
'.blob-num, .blob-code, .markdown-body .highlight pre, .markdown-body pre, \n',
'.cm-s-github-light .CodeMirror-lines, textarea.file-editor-textarea {\n',
` line-height: ${LINE_HEIGHT};\n`,
'}\n',
);
document.head.appendChild(style);
}
if (document.readyState !== 'loading') {
addStylesheet();
} else {
document.addEventListener('readystatechange', () => {
if (document.readyState === 'loading') return;
addStylesheet();
});
}
2021-05-08 12:53:40 +00:00
})();