diff --git a/mozilla/firefox/userContent.css b/web/firefox/userContent.css similarity index 100% rename from mozilla/firefox/userContent.css rename to web/firefox/userContent.css diff --git a/web/userscripts/README.md b/web/userscripts/README.md new file mode 100644 index 0000000..c118d98 --- /dev/null +++ b/web/userscripts/README.md @@ -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. diff --git a/web/userscripts/github-icon-vertical-align.user.js b/web/userscripts/github-icon-vertical-align.user.js new file mode 100644 index 0000000..eb24152 --- /dev/null +++ b/web/userscripts/github-icon-vertical-align.user.js @@ -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; + } + `); +})(); diff --git a/web/userscripts/github-line-height.user.js b/web/userscripts/github-line-height.user.js new file mode 100644 index 0000000..70b1aca --- /dev/null +++ b/web/userscripts/github-line-height.user.js @@ -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}; + } + `); +})(); diff --git a/web/userscripts/github-tab-size.user.js b/web/userscripts/github-tab-size.user.js new file mode 100644 index 0000000..1dd581b --- /dev/null +++ b/web/userscripts/github-tab-size.user.js @@ -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; + } + `); +})(); diff --git a/web/userscripts/steamcommunity-com-linkfilter.user.js b/web/userscripts/steamcommunity-com-linkfilter.user.js new file mode 100644 index 0000000..324e011 --- /dev/null +++ b/web/userscripts/steamcommunity-com-linkfilter.user.js @@ -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); + } +})(); diff --git a/web/userscripts/twitter-s-param-remover.user.js b/web/userscripts/twitter-s-param-remover.user.js new file mode 100644 index 0000000..42fb6bd --- /dev/null +++ b/web/userscripts/twitter-s-param-remover.user.js @@ -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(); + } +})(); diff --git a/web/userscripts/youtube-screenshot.user.js b/web/userscripts/youtube-screenshot.user.js new file mode 100644 index 0000000..e2c2f29 --- /dev/null +++ b/web/userscripts/youtube-screenshot.user.js @@ -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()})();`, + }); +})();