Last active
November 29, 2025 15:12
-
-
Save mdashlw/34a35fadc275b2ad62b5c9f67d2ea281 to your computer and use it in GitHub Desktop.
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 booru-image-view-file-names | |
| // @namespace Violentmonkey Scripts | |
| // @match https://derpibooru.org/* | |
| // @match https://trixiebooru.org/* | |
| // @grant none | |
| // @version 1.0 | |
| // @author mdashlw | |
| // @description 4/10/2024, 1:47:21 PM | |
| // @run-at document-start | |
| // ==/UserScript== | |
| function runAfterDom(fn) { | |
| if (document.readyState === "loading") { | |
| document.addEventListener("readystatechange", fn, { once: true }); | |
| } else { | |
| fn(); | |
| } | |
| } | |
| if (window.location.pathname.startsWith("/images/")) { | |
| const imageId = window.location.pathname.split("/")[2]; | |
| if (!isNaN(imageId)) { | |
| fetch(`/api/v1/json/images/${imageId}`) | |
| .then((response) => response.json()) | |
| .then(({ image }) => { | |
| if (image.hidden_from_users || !image.name) { | |
| return; | |
| } | |
| runAfterDom(() => { | |
| const extrameta = document.querySelector("#extrameta"); | |
| if (!extrameta) { | |
| return; | |
| } | |
| const filenameEl = document.createElement("span"); | |
| filenameEl.style.paddingLeft = "12px"; | |
| filenameEl.textContent = image.name; | |
| extrameta.appendChild(filenameEl); | |
| }); | |
| }); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment