2021-05-08 12:53:40 +00:00
|
|
|
// ==UserScript==
|
|
|
|
// @name GitHub line-height
|
2021-05-08 19:00:21 +00:00
|
|
|
// @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 19:00:21 +00:00
|
|
|
|
2021-05-08 12:53:40 +00:00
|
|
|
const LINE_HEIGHT = '1.2';
|
2021-05-08 19:00:21 +00:00
|
|
|
|
|
|
|
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
|
|
|
})();
|