Merge pull request #251 from dmitmel/master

[pull] master from dmitmel:master
This commit is contained in:
pull[bot] 2021-05-08 14:52:09 +00:00 committed by GitHub
commit ece2d929fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 119 additions and 0 deletions

View 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.

View File

@ -0,0 +1,17 @@
// ==UserScript==
// @name GitHub icon vertical alignment fix
// @version 2
// @grant GM_addStyle
// @match https://github.com/*
// @match https://gist.github.com/*
// @run-at document-start
// ==/UserScript==
(() => {
'use strict';
GM_addStyle(`
.btn-sm .octicon {
vertical-align: middle;
}
`);
})();

View File

@ -0,0 +1,19 @@
// ==UserScript==
// @name GitHub line-height
// @version 2
// @grant GM_addStyle
// @match https://github.com/*
// @match https://gist.github.com/*
// @run-at document-start
// ==/UserScript==
(() => {
'use strict';
const LINE_HEIGHT = '1.2';
GM_addStyle(`
.blob-num, .blob-code, .markdown-body .highlight pre, .markdown-body pre,
.cm-s-github-light .CodeMirror-lines, textarea.file-editor-textarea {
line-height: ${LINE_HEIGHT};
}
`);
})();

View File

@ -0,0 +1,19 @@
// ==UserScript==
// @name GitHub tab size 4
// @version 2
// @grant GM_addStyle
// @match https://github.com/*
// @match https://gist.github.com/*
// @run-at document-start
// ==/UserScript==
(() => {
'use strict';
const TAB_SIZE = '4';
GM_addStyle(`
* {
-moz-tab-size: ${TAB_SIZE} !important;
tab-size: ${TAB_SIZE} !important;
}
`);
})();

View 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);
}
})();

View 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();
}
})();

View File

@ -0,0 +1,30 @@
// ==UserScript==
// @name YouTube screenshotter
// @version 2
// @grant GM_addElement
// @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');
};
}
GM_addElement('script', {
textContent: `(${main.toString()})();`,
});
})();