mirror of
https://github.com/keanuplayz/dotfiles.git
synced 2024-08-15 02:33:12 +00:00
[userscripts] use the available helper functions
This commit is contained in:
parent
50440e632a
commit
92361f9a54
4 changed files with 28 additions and 73 deletions
|
@ -1,7 +1,7 @@
|
||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name GitHub icon vertical alignment fix
|
// @name GitHub icon vertical alignment fix
|
||||||
// @version 1
|
// @version 2
|
||||||
// @grant none
|
// @grant GM_addStyle
|
||||||
// @match https://github.com/*
|
// @match https://github.com/*
|
||||||
// @match https://gist.github.com/*
|
// @match https://gist.github.com/*
|
||||||
// @run-at document-start
|
// @run-at document-start
|
||||||
|
@ -9,24 +9,9 @@
|
||||||
|
|
||||||
(() => {
|
(() => {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
GM_addStyle(`
|
||||||
function addStylesheet() {
|
.btn-sm .octicon {
|
||||||
let style = document.createElement('style');
|
vertical-align: middle;
|
||||||
style.append(
|
}
|
||||||
//
|
`);
|
||||||
'.btn-sm .octicon {\n',
|
|
||||||
' vertical-align: middle;\n',
|
|
||||||
'}\n',
|
|
||||||
);
|
|
||||||
document.head.appendChild(style);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (document.readyState !== 'loading') {
|
|
||||||
addStylesheet();
|
|
||||||
} else {
|
|
||||||
document.addEventListener('readystatechange', () => {
|
|
||||||
if (document.readyState === 'loading') return;
|
|
||||||
addStylesheet();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
})();
|
})();
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name GitHub line-height
|
// @name GitHub line-height
|
||||||
// @version 1
|
// @version 2
|
||||||
// @grant none
|
// @grant GM_addStyle
|
||||||
// @match https://github.com/*
|
// @match https://github.com/*
|
||||||
// @match https://gist.github.com/*
|
// @match https://gist.github.com/*
|
||||||
// @run-at document-start
|
// @run-at document-start
|
||||||
|
@ -9,26 +9,11 @@
|
||||||
|
|
||||||
(() => {
|
(() => {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const LINE_HEIGHT = '1.2';
|
const LINE_HEIGHT = '1.2';
|
||||||
|
GM_addStyle(`
|
||||||
function addStylesheet() {
|
.blob-num, .blob-code, .markdown-body .highlight pre, .markdown-body pre,
|
||||||
let style = document.createElement('style');
|
.cm-s-github-light .CodeMirror-lines, textarea.file-editor-textarea {
|
||||||
style.append(
|
line-height: ${LINE_HEIGHT};
|
||||||
'.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();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
})();
|
})();
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name GitHub tab size 4
|
// @name GitHub tab size 4
|
||||||
// @version 1
|
// @version 2
|
||||||
// @grant none
|
// @grant GM_addStyle
|
||||||
// @match https://github.com/*
|
// @match https://github.com/*
|
||||||
// @match https://gist.github.com/*
|
// @match https://gist.github.com/*
|
||||||
// @run-at document-start
|
// @run-at document-start
|
||||||
|
@ -9,26 +9,11 @@
|
||||||
|
|
||||||
(() => {
|
(() => {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const TAB_SIZE = '4';
|
const TAB_SIZE = '4';
|
||||||
|
GM_addStyle(`
|
||||||
function addStylesheet() {
|
* {
|
||||||
let style = document.createElement('style');
|
-moz-tab-size: ${TAB_SIZE} !important;
|
||||||
style.append(
|
tab-size: ${TAB_SIZE} !important;
|
||||||
'* {\n',
|
}
|
||||||
` -moz-tab-size: ${TAB_SIZE} !important;\n`,
|
`);
|
||||||
` tab-size: ${TAB_SIZE} !important;\n`,
|
|
||||||
'}\n',
|
|
||||||
);
|
|
||||||
document.head.appendChild(style);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (document.readyState !== 'loading') {
|
|
||||||
addStylesheet();
|
|
||||||
} else {
|
|
||||||
document.addEventListener('readystatechange', () => {
|
|
||||||
if (document.readyState === 'loading') return;
|
|
||||||
addStylesheet();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
})();
|
})();
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name YouTube screenshotter
|
// @name YouTube screenshotter
|
||||||
// @version 1
|
// @version 2
|
||||||
// @grant none
|
// @grant GM_addElement
|
||||||
// @match https://www.youtube.com/*
|
// @match https://www.youtube.com/*
|
||||||
// @run-at document-end
|
// @run-at document-end
|
||||||
// ==/UserScript==
|
// ==/UserScript==
|
||||||
|
@ -24,7 +24,7 @@
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
let script = document.createElement('script');
|
GM_addElement('script', {
|
||||||
script.append('(' + main + ')();');
|
textContent: `(${main.toString()})();`,
|
||||||
(document.body || document.head || document.documentElement).appendChild(script);
|
});
|
||||||
})();
|
})();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue