From dd9f5183586bb98b3ba71221b68b4e156290f0b6 Mon Sep 17 00:00:00 2001 From: xing Date: Mon, 27 Jun 2022 04:11:07 +0000 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=20'tes.user.js'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tes.user.js | 44 -------------------------------------------- 1 file changed, 44 deletions(-) delete mode 100644 tes.user.js diff --git a/tes.user.js b/tes.user.js deleted file mode 100644 index b17f48d..0000000 --- a/tes.user.js +++ /dev/null @@ -1,44 +0,0 @@ -// ==UserScript== -// @name osu! full background link -// @version 1.0.1 -// @grant none -// @match https://osu.ppy.sh/* -// ==/UserScript== - -const observer = new MutationObserver(mutations => { - const meta = document.querySelector(".beatmapset-info__box.beatmapset-info__box--meta:not(.bg-link-added)"); - if (meta) { - meta.classList.add("bg-link-added"); - - const beatmapId = window.location.pathname.split("/")[2]; - - const link = document.createElement("h3"); - link.className = "beatmapset-info__header"; - - const a = document.createElement("a"); - a.href = `https://assets.ppy.sh/beatmaps/${beatmapId}/covers/raw.jpg`; - a.innerHTML = "Background"; - link.append(a); - meta.prepend(link); - } - - const items = document.querySelectorAll(".beatmapset-panel__menu:not(.bg-link-added)"); - items.forEach(e => { - e.classList.add("bg-link-added"); - const downloadLink = e.querySelector("a"); - const beatmapId = downloadLink.pathname.split("/")[2]; - - const a = document.createElement("a"); - a.href = `https://assets.ppy.sh/beatmaps/${beatmapId}/covers/raw.jpg`; - a.className = "beatmapset-panel__menu-item"; - const icon = document.createElement("span"); - icon.className = "fas fa-image"; - a.append(icon); - downloadLink.before(a); - }) -}); - -observer.observe(document, { - childList: true, - subtree: true -}); \ No newline at end of file