44 lines
1.3 KiB
JavaScript
44 lines
1.3 KiB
JavaScript
// ==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
|
|
}); |