From d3cc69013bba60ec1704958289e61e8538556b3c Mon Sep 17 00:00:00 2001 From: SuperSaltyGamer Date: Sat, 4 Feb 2023 16:44:00 +0200 Subject: [PATCH] [applemusic] Update dist to v1.4.0 --- dist/applemusic.user.js | 94 ++++++++++++++++++++++++++--------------- src/applemusic/main.ts | 2 +- 2 files changed, 60 insertions(+), 36 deletions(-) diff --git a/dist/applemusic.user.js b/dist/applemusic.user.js index 84b3d06..5a963b0 100644 --- a/dist/applemusic.user.js +++ b/dist/applemusic.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @namespace ame-applemusic // @name Ame (Apple Music) -// @version 1.3.3 +// @version 1.4.0 // @author SuperSaltyGamer // @run-at document-start // @match https://music.apple.com/* @@ -12,21 +12,21 @@ // @updateURL https://notabug.org/SuperSaltyGamer/ame/raw/main/dist/applemusic.user.js // ==/UserScript== -(function(C){typeof define=="function"&&define.amd?define(C):C()})(function(){"use strict";const C=new Map;function I(t,e){return new Promise((a,n)=>{const r=C.get(t);if(r){a(r.clone());return}GM.xmlHttpRequest({method:(e==null?void 0:e.method)??"GET",url:t,headers:Object.fromEntries(new Headers(e==null?void 0:e.headers)),responseType:"blob",onload(c){const o=c.responseHeaders.split(`\r -`).slice(0,-1).map(u=>u.split(": ")),s=new Response(c.response,{headers:Object.fromEntries(o),status:c.status,statusText:c.statusText});Object.defineProperty(s,"url",{value:t}),C.set(t,s.clone()),a(s)},onerror(){n(new TypeError("Network request errored."))},ontimeout(){n(new TypeError("Network request timed out."))}})})}function i1(t){for(var e=[],a=0;a=48&&o<=57||o>=65&&o<=90||o>=97&&o<=122||o===95){r+=t[c++];continue}break}if(!r)throw new TypeError("Missing parameter name at ".concat(a));e.push({type:"NAME",index:a,value:r}),a=c;continue}if(n==="("){var s=1,u="",c=a+1;if(t[c]==="?")throw new TypeError('Pattern cannot start with "?" at '.concat(c));for(;c)?(?!\?)/g,n=0,r=a.exec(t.source);r;)e.push({name:r[1]||n++,prefix:"",suffix:"",modifier:"",pattern:""}),r=a.exec(t.source);return t}function m1(t,e,a){var n=t.map(function(r){return W(r,e,a).source});return new RegExp("(?:".concat(n.join("|"),")"),G(a))}function v1(t,e,a){return d1(s1(t,a),e,a)}function d1(t,e,a){a===void 0&&(a={});for(var n=a.strict,r=n===void 0?!1:n,c=a.start,o=c===void 0?!0:c,s=a.end,u=s===void 0?!0:s,i=a.encode,h=i===void 0?function(Q){return Q}:i,d=a.delimiter,l=d===void 0?"/#?":d,v=a.endsWith,_=v===void 0?"":v,R="[".concat(x(_),"]|$"),g="[".concat(x(l),"]"),p=o?"^":"",N=0,L=t;N-1:y===void 0;r||(p+="(?:".concat(g,"(?=").concat(R,"))?")),j||(p+="(?=".concat(g,"|").concat(R,")"))}return new RegExp(p,G(a))}function W(t,e,a){return t instanceof RegExp?h1(t,e):Array.isArray(t)?m1(t,e,a):v1(t,e,a)}let A=unsafeWindow;A.wrappedJSObject&&(A=A.wrappedJSObject);const p1=typeof cloneInto=="function"?cloneInto:t=>t,f1=typeof exportFunction=="function"?exportFunction:t=>t;function g1(t){return p1(t,A,{cloneFunctions:!0,wrapReflectors:!0})}function b1(t){return f1(t,A)}function w1(t,e){return e??(e=A),function(...a){return t.call(e,...g1(a))}}const k=[],Z1=w1(A.history.pushState,A.history);A.history.pushState=b1(A1);function A1(t,e,a){Z1(t,e,a),X()}addEventListener("popstate",()=>{X()});function X(){for(const t of k){const e=t.matcher(location.pathname)?t.onCallbacks:t.offCallbacks;for(const a of e)a()}}function Y(t){let e=k.find(a=>a.pattern===t);return e||(e={pattern:t,matcher:l1(t),onCallbacks:[],offCallbacks:[]},k.push(e),e)}function E1(t,e,a=!1){const n=Y(t),r=n.matcher(location.pathname);n.onCallbacks.push(e),r&&e()}function M1(t,e,a=!1){const n=Y(t),r=n.matcher(location.pathname);n.offCallbacks.push(e),r||e()}function S(t){return new Promise(e=>{setTimeout(e,t)})}function b(t){const e=document.createElement("div");return e.innerHTML=t,e.firstElementChild}function T(t,e,a=5e3,n=document){return new Promise(r=>{let c=0,o=0;c=setTimeout(()=>{clearInterval(o),r(null)},a),o=setInterval(()=>{let s=n.querySelector(e??t);s&&(e&&(s=n.querySelector(t)),s&&(r(s),clearTimeout(c),clearInterval(o)))},10)})}function y1(t,e){new MutationObserver(n=>{for(const r of n)for(const c of Array.from(r.addedNodes))if(c instanceof Element&&c.matches(t)){e(c);return}}).observe(document.body,{childList:!0,subtree:!0})}const K="/:country/album/:slug/:id";function V(t,e=!1){E1(K,t,e)}function B(t,e=!1){M1(K,t,e)}let H=null;function q(t,e){return b(` -