Created
April 29, 2025 19:42
-
-
Save mesmere/9cad7725de2b3fe0a75c61e138f19ae4 to your computer and use it in GitHub Desktop.
Mobile browser userscripts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==UserScript== | |
| // @name Twitter mobile file browser unlocked | |
| // @namespace http://tampermonkey.net/ | |
| // @version 2025-04-29 | |
| // @author mesmere | |
| // @description Open the full file browser instead of just the recent media panel when attaching an image/video. | |
| // @match https://twitter.com/* | |
| // @match https://x.com/* | |
| // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw== | |
| // @grant window.onurlchange | |
| // @run-at document-idle | |
| // @license MIT | |
| // ==/UserScript== | |
| function attempt(remainingElems = 2) { | |
| if (window.location.href.match(/^https:\/\/(twitter|x)\.com\/compose\/post$/) === null) { | |
| return; | |
| } | |
| const fileInputElems = document.querySelectorAll("input[type=file]"); | |
| for (const fileInputElem of fileInputElems) { | |
| // Mobile browser file-picker behavior is determined by the HTMLInputElement.accept property. | |
| fileInputElem.accept = ""; | |
| } | |
| // There are two separate file inputs on the page and one can load a long time before the other. | |
| if (fileInputElems.length < remainingElems) { | |
| window.setTimeout(attempt, 200, remainingElems - fileInputElems.length); | |
| } | |
| } | |
| attempt(); | |
| window.addEventListener("urlchange", attempt); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==UserScript== | |
| // @name Hide Youtube Mobile Top Comment | |
| // @namespace http://tampermonkey.net/ | |
| // @version 2025-03-18 | |
| // @author mesmere | |
| // @description Hide the top comment to avoid spoilers. | |
| // @match https://m.youtube.com/* | |
| // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw== | |
| // @grant window.onurlchange | |
| // @run-at document-idle | |
| // @license MIT | |
| // ==/UserScript== | |
| function attempt() { | |
| if (window.location.href.match(/^https:\/\/m.youtube.com\/watch.+/) === null) { | |
| return; | |
| } | |
| const cep = document.querySelector(".ytm-comments-entry-point-teaser-content [role=text]"); | |
| if (cep) { | |
| cep.innerText = "The top comment is hidden. Tap to view."; | |
| } else { | |
| window.setTimeout(attempt, 200); | |
| } | |
| } | |
| attempt(); | |
| window.addEventListener("urlchange", attempt); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment