mirror of
https://notabug.org/SuperSaltyGamer/ame
synced 2026-01-15 16:22:56 -03:00
[applemusic] Fix full sized cover
This commit is contained in:
4
dist/applemusic.user.js
vendored
4
dist/applemusic.user.js
vendored
@@ -1,7 +1,7 @@
|
||||
// ==UserScript==
|
||||
// @namespace ame-applemusic
|
||||
// @name Ame (Apple Music)
|
||||
// @version 1.8.0
|
||||
// @version 1.8.1
|
||||
// @author SuperSaltyGamer
|
||||
// @run-at document-start
|
||||
// @match https://music.apple.com/*
|
||||
@@ -79,7 +79,7 @@ ${Array.from(v).join(", ")}">${u.attributes.name}</a>, </span>
|
||||
`)),await ha(222)}}const ih=da("Search Covers",`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" slot="app-icon">
|
||||
<path d="M24 44q-4.1 0-7.75-1.575-3.65-1.575-6.375-4.3-2.725-2.725-4.3-6.375Q4 28.1 4 24q0-4.25 1.6-7.9 1.6-3.65 4.375-6.35 2.775-2.7 6.5-4.225Q20.2 4 24.45 4q3.95 0 7.5 1.325T38.175 9q2.675 2.35 4.25 5.575Q44 17.8 44 21.65q0 5.4-3.15 8.525T32.5 33.3h-3.75q-.9 0-1.55.7t-.65 1.55q0 1.35.725 2.3.725.95.725 2.2 0 1.9-1.05 2.925T24 44Zm0-20Zm-11.65 1.3q1 0 1.75-.75t.75-1.75q0-1-.75-1.75t-1.75-.75q-1 0-1.75.75t-.75 1.75q0 1 .75 1.75t1.75.75Zm6.3-8.5q1 0 1.75-.75t.75-1.75q0-1-.75-1.75t-1.75-.75q-1 0-1.75.75t-.75 1.75q0 1 .75 1.75t1.75.75Zm10.7 0q1 0 1.75-.75t.75-1.75q0-1-.75-1.75t-1.75-.75q-1 0-1.75.75t-.75 1.75q0 1 .75 1.75t1.75.75Zm6.55 8.5q1 0 1.75-.75t.75-1.75q0-1-.75-1.75t-1.75-.75q-1 0-1.75.75t-.75 1.75q0 1 .75 1.75t1.75.75ZM24 41q.55 0 .775-.225.225-.225.225-.725 0-.7-.725-1.3-.725-.6-.725-2.65 0-2.3 1.5-4.05t3.8-1.75h3.65q3.8 0 6.15-2.225Q41 25.85 41 21.65q0-6.6-5-10.625T24.45 7q-7.3 0-12.375 4.925T7 24q0 7.05 4.975 12.025Q16.95 41 24 41Z" />
|
||||
</svg>
|
||||
`);ih.addEventListener("click",()=>{const e=document.querySelector("h1.headings__title");if(!e)return;const r=Array.from(document.querySelectorAll(".headings__subtitles > a")).map(i=>i.innerText).join(" "),n=e.innerText.replace(" - Single","").replace(" - EP","");open(`https://covers.musichoarders.xyz?artist=${encodeURIComponent(r)}&album=${encodeURIComponent(n)}`,"_blank")}),addEventListener("mousedown",async e=>{if(e.button!==2)return;const t=e.target;if(!t.matches(".artwork-component__image:not(.ame-fullsized)"))return;t.classList.add("ame-fullsized");const r=document.head.querySelector("meta[property='og:image']");if(!r)return;const n=t.parentElement.querySelectorAll("source");for(const i of Array.from(n))i.srcset=dA(r.content)},{passive:!0});function dA(e){return e.replace(/is\d-ssl/,"a1").replace("image/thumb","r40").split("/").slice(0,-1).join("/")}const Og=da("Copy Authorization",`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" slot="app-icon">
|
||||
`);ih.addEventListener("click",()=>{const e=document.querySelector("h1.headings__title");if(!e)return;const r=Array.from(document.querySelectorAll(".headings__subtitles > a")).map(i=>i.innerText).join(" "),n=e.innerText.replace(" - Single","").replace(" - EP","");open(`https://covers.musichoarders.xyz?artist=${encodeURIComponent(r)}&album=${encodeURIComponent(n)}`,"_blank")}),addEventListener("mousedown",async e=>{if(e.button!==2)return;const t=e.target;if(!t.matches(".artwork-component__image:not(.ame-fullsized)"))return;t.classList.add("ame-fullsized");const r=document.querySelector(".artwork__radiosity source");if(!r)return;const n=t.parentElement.querySelectorAll("source");for(const i of Array.from(n))i.srcset=dA(r.srcset)},{passive:!0});function dA(e){return e.split(" ",2)[0].replace(/is\d-ssl/,"a1").replace("image/thumb","r40").split("/").slice(0,-1).join("/")}const Og=da("Copy Authorization",`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" slot="app-icon">
|
||||
<path d="M24 43.95q-7-1.75-11.5-8.125T8 21.85V9.95l16-6 16 6v11.9q0 7.6-4.5 13.975T24 43.95Zm0-3.1q5.75-1.9 9.375-7.175T37 21.85v-9.8l-13-4.9-13 4.9v9.8q0 6.55 3.625 11.825Q18.25 38.95 24 40.85ZM24 24Z" />
|
||||
</svg>
|
||||
`);Og.addEventListener("click",async()=>{GM.setClipboard(await ql())});const vA=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" slot="app-icon">
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ==UserScript==
|
||||
// @namespace ame-applemusic
|
||||
// @name Ame (Apple Music)
|
||||
// @version 1.8.0
|
||||
// @version 1.8.1
|
||||
// @author SuperSaltyGamer
|
||||
// @run-at document-start
|
||||
// @match https://music.apple.com/*
|
||||
|
||||
@@ -22,15 +22,16 @@ addEventListener("mousedown", async e => {
|
||||
if (!imgEl.matches(".artwork-component__image:not(.ame-fullsized)")) return;
|
||||
imgEl.classList.add("ame-fullsized");
|
||||
|
||||
const metaEl = document.head.querySelector<HTMLMetaElement>("meta[property='og:image']");
|
||||
if (!metaEl) return;
|
||||
const refSrcEl = document.querySelector<HTMLSourceElement>(".artwork__radiosity source");
|
||||
if (!refSrcEl) return;
|
||||
|
||||
const srcEls = imgEl.parentElement!.querySelectorAll<HTMLSourceElement>("source");
|
||||
for (const srcEl of Array.from(srcEls)) srcEl.srcset = transformCover(metaEl.content);
|
||||
for (const srcEl of Array.from(srcEls)) srcEl.srcset = transformCover(refSrcEl.srcset);
|
||||
}, { passive: true });
|
||||
|
||||
function transformCover(url: string): string {
|
||||
return url
|
||||
.split(" ", 2)[0]
|
||||
.replace(/is\d-ssl/, "a1")
|
||||
.replace("image/thumb", "r40")
|
||||
.split("/")
|
||||
|
||||
Reference in New Issue
Block a user