添加 'tes.user.js'
This commit is contained in:
parent
baaf65c494
commit
be57260c21
44
tes.user.js
Normal file
44
tes.user.js
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
// ==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
|
||||||
|
});
|
Loading…
Reference in New Issue
Block a user