mirror of
https://github.com/keanuplayz/dotfiles.git
synced 2024-08-15 02:33:12 +00:00
[web] add my userscripts
This commit is contained in:
parent
1b38e41eec
commit
50440e632a
8 changed files with 164 additions and 0 deletions
1
web/userscripts/README.md
Normal file
1
web/userscripts/README.md
Normal file
|
@ -0,0 +1 @@
|
|||
[Tampermonkey](https://www.tampermonkey.net/) ([Firefox extension](https://addons.mozilla.org/en-US/firefox/addon/tampermonkey/), [Chrome extension](https://chrome.google.com/webstore/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo)) is recommended for loading these as it supports installing and updating userscripts from a remote URL.
|
32
web/userscripts/github-icon-vertical-align.user.js
Normal file
32
web/userscripts/github-icon-vertical-align.user.js
Normal file
|
@ -0,0 +1,32 @@
|
|||
// ==UserScript==
|
||||
// @name GitHub icon vertical alignment fix
|
||||
// @version 1
|
||||
// @grant none
|
||||
// @match https://github.com/*
|
||||
// @match https://gist.github.com/*
|
||||
// @run-at document-start
|
||||
// ==/UserScript==
|
||||
|
||||
(() => {
|
||||
'use strict';
|
||||
|
||||
function addStylesheet() {
|
||||
let style = document.createElement('style');
|
||||
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();
|
||||
});
|
||||
}
|
||||
})();
|
34
web/userscripts/github-line-height.user.js
Normal file
34
web/userscripts/github-line-height.user.js
Normal file
|
@ -0,0 +1,34 @@
|
|||
// ==UserScript==
|
||||
// @name GitHub line-height
|
||||
// @version 1
|
||||
// @grant none
|
||||
// @match https://github.com/*
|
||||
// @match https://gist.github.com/*
|
||||
// @run-at document-start
|
||||
// ==/UserScript==
|
||||
|
||||
(() => {
|
||||
'use strict';
|
||||
|
||||
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();
|
||||
});
|
||||
}
|
||||
})();
|
34
web/userscripts/github-tab-size.user.js
Normal file
34
web/userscripts/github-tab-size.user.js
Normal file
|
@ -0,0 +1,34 @@
|
|||
// ==UserScript==
|
||||
// @name GitHub tab size 4
|
||||
// @version 1
|
||||
// @grant none
|
||||
// @match https://github.com/*
|
||||
// @match https://gist.github.com/*
|
||||
// @run-at document-start
|
||||
// ==/UserScript==
|
||||
|
||||
(() => {
|
||||
'use strict';
|
||||
|
||||
const TAB_SIZE = '4';
|
||||
|
||||
function addStylesheet() {
|
||||
let style = document.createElement('style');
|
||||
style.append(
|
||||
'* {\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();
|
||||
});
|
||||
}
|
||||
})();
|
16
web/userscripts/steamcommunity-com-linkfilter.user.js
Normal file
16
web/userscripts/steamcommunity-com-linkfilter.user.js
Normal file
|
@ -0,0 +1,16 @@
|
|||
// ==UserScript==
|
||||
// @name steamcommunity.com linkfilter disabler
|
||||
// @version 1
|
||||
// @grant none
|
||||
// @run-at document-start
|
||||
// @match https://steamcommunity.com/linkfilter/*
|
||||
// ==/UserScript==
|
||||
|
||||
(() => {
|
||||
'use strict';
|
||||
let searchParams = new URLSearchParams(window.location.search);
|
||||
let url = searchParams.get('url');
|
||||
if (url) {
|
||||
window.location.replace(url);
|
||||
}
|
||||
})();
|
17
web/userscripts/twitter-s-param-remover.user.js
Normal file
17
web/userscripts/twitter-s-param-remover.user.js
Normal file
|
@ -0,0 +1,17 @@
|
|||
// ==UserScript==
|
||||
// @name twitter ?s=20 remover
|
||||
// @version 1
|
||||
// @grant none
|
||||
// @match https://twitter.com/*
|
||||
// @run-at document-start
|
||||
// ==/UserScript==
|
||||
|
||||
(() => {
|
||||
'use strict';
|
||||
let searchParams = new URLSearchParams(window.location.search);
|
||||
let strangeValue = searchParams.get('s');
|
||||
if (/[0-9]+/.test(strangeValue)) {
|
||||
searchParams.delete('s');
|
||||
window.location.search = searchParams.toString();
|
||||
}
|
||||
})();
|
30
web/userscripts/youtube-screenshot.user.js
Normal file
30
web/userscripts/youtube-screenshot.user.js
Normal file
|
@ -0,0 +1,30 @@
|
|||
// ==UserScript==
|
||||
// @name YouTube screenshotter
|
||||
// @version 1
|
||||
// @grant none
|
||||
// @match https://www.youtube.com/*
|
||||
// @run-at document-end
|
||||
// ==/UserScript==
|
||||
|
||||
(() => {
|
||||
'use strict';
|
||||
|
||||
function main() {
|
||||
window.__userscript__takeScreenshot = function (video, imageType = 'image/png') {
|
||||
if (!(video instanceof HTMLVideoElement)) {
|
||||
throw new Error('Assertion failed: video instanceof HTMLVideoElement');
|
||||
}
|
||||
|
||||
let canvas = document.createElement('canvas');
|
||||
canvas.width = video.videoWidth;
|
||||
canvas.height = video.videoHeight;
|
||||
let ctx = canvas.getContext('2d');
|
||||
ctx.drawImage(video, 0, 0, video.videoWidth, video.videoHeight);
|
||||
window.open(canvas.toDataURL(imageType), '_blank');
|
||||
};
|
||||
}
|
||||
|
||||
let script = document.createElement('script');
|
||||
script.append('(' + main + ')();');
|
||||
(document.body || document.head || document.documentElement).appendChild(script);
|
||||
})();
|
Loading…
Reference in a new issue