From ef2745ec5f7f7a94da8875997c00eb93db556778 Mon Sep 17 00:00:00 2001 From: SuperSaltyGamer Date: Mon, 17 Jul 2023 19:35:51 +0300 Subject: [PATCH] [applemusic] Fix dock styles and scrolling --- dist/applemusic.user.js | 182 ++++++++++++++++----------------- src/applemusic/main.ts | 2 +- src/applemusic/modules/info.ts | 12 ++- src/applemusic/style.css | 10 +- 4 files changed, 101 insertions(+), 105 deletions(-) diff --git a/dist/applemusic.user.js b/dist/applemusic.user.js index 818547a..c1a69c1 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.6.0 +// @version 1.6.1 // @author SuperSaltyGamer // @run-at document-start // @match https://music.apple.com/* @@ -12,15 +12,15 @@ // @updateURL https://notabug.org/SuperSaltyGamer/ame/raw/main/dist/applemusic.user.js // ==/UserScript== -(function(la){typeof define=="function"&&define.amd?define(la):la()})(function(){"use strict";const la=new Map;function Ro(e,t){return new Promise((r,n)=>{const o=la.get(e);if(o){r(o.clone());return}GM.xmlHttpRequest({method:(t==null?void 0:t.method)??"GET",url:e,headers:Object.fromEntries(new Headers(t==null?void 0:t.headers)),responseType:"blob",onload(i){if(i.status!==404&&(i.status<200||i.status>299)){n(new Error(`Fetching "${e}" responded with an erroneous status code.`));return}const a=i.responseHeaders.split(`\r -`).slice(0,-1).map(s=>s.split(": ")),l=new Response(i.response,{headers:Object.fromEntries(a),status:i.status,statusText:i.statusText});Object.defineProperty(l,"url",{value:e}),la.set(e,l.clone()),r(l)},onerror(){n(new TypeError("Network request errored."))},ontimeout(){n(new TypeError("Network request timed out."))}})})}function OA(e){for(var t=[],r=0;r=48&&a<=57||a>=65&&a<=90||a>=97&&a<=122||a===95){o+=e[i++];continue}break}if(!o)throw new TypeError("Missing parameter name at ".concat(r));t.push({type:"NAME",index:r,value:o}),r=i;continue}if(n==="("){var l=1,s="",i=r+1;if(e[i]==="?")throw new TypeError('Pattern cannot start with "?" at '.concat(i));for(;i)?(?!\?)/g,n=0,o=r.exec(e.source);o;)t.push({name:o[1]||n++,prefix:"",suffix:"",modifier:"",pattern:""}),o=r.exec(e.source);return e}function AA(e,t,r){var n=e.map(function(o){return sp(o,t,r).source});return new RegExp("(?:".concat(n.join("|"),")"),lp(r))}function $A(e,t,r){return PA(TA(e,r),t,r)}function PA(e,t,r){r===void 0&&(r={});for(var n=r.strict,o=n===void 0?!1:n,i=r.start,a=i===void 0?!0:i,l=r.end,s=l===void 0?!0:l,u=r.encode,c=u===void 0?function(_e){return _e}:u,f=r.delimiter,h=f===void 0?"/#?":f,d=r.endsWith,y=d===void 0?"":d,g="[".concat(Eo(y),"]|$"),b="[".concat(Eo(h),"]"),C=a?"^":"",T=0,A=e;T-1:Y===void 0;o||(C+="(?:".concat(b,"(?=").concat(g,"))?")),ue||(C+="(?=".concat(b,"|").concat(g,")"))}return new RegExp(C,lp(r))}function sp(e,t,r){return e instanceof RegExp?kA(e,t):Array.isArray(e)?AA(e,t,r):$A(e,t,r)}let Lr=unsafeWindow;Lr.wrappedJSObject&&(Lr=Lr.wrappedJSObject);const IA=typeof cloneInto=="function"?cloneInto:e=>e,xA=typeof exportFunction=="function"?exportFunction:e=>e;function MA(e){return IA(e,Lr,{cloneFunctions:!0,wrapReflectors:!0})}function NA(e){return xA(e,Lr)}function DA(e,t){return t??(t=Lr),function(...r){return e.call(t,...MA(r))}}const Wf=[],HA=DA(Lr.history.pushState,Lr.history);Lr.history.pushState=NA(LA);function LA(e,t,r){HA(e,t,r),up()}addEventListener("popstate",()=>{up()});function up(){for(const e of Wf){const t=e.matcher(location.pathname)?e.onCallbacks:e.offCallbacks;for(const r of t)r()}}function cp(e){let t=Wf.find(r=>r.pattern===e);return t||(t={pattern:e,matcher:RA(e),onCallbacks:[],offCallbacks:[]},Wf.push(t),t)}function FA(e,t,r=!1){const n=cp(e),o=n.matcher(location.pathname);n.onCallbacks.push(t),o&&t()}function jA(e,t,r=!1){const n=cp(e),o=n.matcher(location.pathname);n.offCallbacks.push(t),o||t()}function js(e){return new Promise(t=>{setTimeout(t,e)})}function Nt(e){const t=document.createElement("div");return t.innerHTML=e,t.firstElementChild}function Vs(e,t,r=5e3,n=document){return new Promise(o=>{let i=0,a=0;i=setTimeout(()=>{clearInterval(a),o(null)},r),a=setInterval(()=>{let l=n.querySelector(t??e);l&&(t&&(l=n.querySelector(e),!l)||(o(l),clearTimeout(i),clearInterval(a)))},10)})}function VA(e,t){new MutationObserver(n=>{for(const o of n)for(const i of Array.from(o.addedNodes))if(i instanceof Element&&i.matches(e)){t(i);return}}).observe(document.body,{childList:!0,subtree:!0})}const fp="/:country/album/:slug?/:id";function ko(e,t=!1){FA(fp,e,t)}function Bs(e,t=!1){jA(fp,e,t)}let Ws=null;function sa(e,t){return Nt(` +(function(ca){typeof define=="function"&&define.amd?define(ca):ca()})(function(){"use strict";const ca=new Map;function ko(e,t){return new Promise((r,n)=>{const o=ca.get(e);if(o){r(o.clone());return}GM.xmlHttpRequest({method:(t==null?void 0:t.method)??"GET",url:e,headers:Object.fromEntries(new Headers(t==null?void 0:t.headers)),responseType:"blob",onload(i){if(i.status!==404&&(i.status<200||i.status>299)){n(new Error(`Fetching "${e}" responded with an erroneous status code.`));return}const a=i.responseHeaders.split(`\r +`).slice(0,-1).map(s=>s.split(": ")),l=new Response(i.response,{headers:Object.fromEntries(a),status:i.status,statusText:i.statusText});Object.defineProperty(l,"url",{value:e}),ca.set(e,l.clone()),r(l)},onerror(){n(new TypeError("Network request errored."))},ontimeout(){n(new TypeError("Network request timed out."))}})})}function $A(e){for(var t=[],r=0;r=48&&a<=57||a>=65&&a<=90||a>=97&&a<=122||a===95){o+=e[i++];continue}break}if(!o)throw new TypeError("Missing parameter name at ".concat(r));t.push({type:"NAME",index:r,value:o}),r=i;continue}if(n==="("){var l=1,s="",i=r+1;if(e[i]==="?")throw new TypeError('Pattern cannot start with "?" at '.concat(i));for(;i)?(?!\?)/g,n=0,o=r.exec(e.source);o;)t.push({name:o[1]||n++,prefix:"",suffix:"",modifier:"",pattern:""}),o=r.exec(e.source);return e}function DA(e,t,r){var n=e.map(function(o){return dp(o,t,r).source});return new RegExp("(?:".concat(n.join("|"),")"),hp(r))}function HA(e,t,r){return LA(IA(e,r),t,r)}function LA(e,t,r){r===void 0&&(r={});for(var n=r.strict,o=n===void 0?!1:n,i=r.start,a=i===void 0?!0:i,l=r.end,s=l===void 0?!0:l,u=r.encode,c=u===void 0?function(_e){return _e}:u,f=r.delimiter,h=f===void 0?"/#?":f,d=r.endsWith,y=d===void 0?"":d,g="[".concat(Ao(y),"]|$"),b="[".concat(Ao(h),"]"),C=a?"^":"",T=0,A=e;T-1:Y===void 0;o||(C+="(?:".concat(b,"(?=").concat(g,"))?")),ue||(C+="(?=".concat(b,"|").concat(g,")"))}return new RegExp(C,hp(r))}function dp(e,t,r){return e instanceof RegExp?NA(e,t):Array.isArray(e)?DA(e,t,r):HA(e,t,r)}let Lr=unsafeWindow;Lr.wrappedJSObject&&(Lr=Lr.wrappedJSObject);const FA=typeof cloneInto=="function"?cloneInto:e=>e,jA=typeof exportFunction=="function"?exportFunction:e=>e;function VA(e){return FA(e,Lr,{cloneFunctions:!0,wrapReflectors:!0})}function BA(e){return jA(e,Lr)}function WA(e,t){return t??(t=Lr),function(...r){return e.call(t,...VA(r))}}const qf=[],zA=WA(Lr.history.pushState,Lr.history);Lr.history.pushState=BA(UA);function UA(e,t,r){zA(e,t,r),vp()}addEventListener("popstate",()=>{vp()});function vp(){for(const e of qf){const t=e.matcher(location.pathname)?e.onCallbacks:e.offCallbacks;for(const r of t)r()}}function mp(e){let t=qf.find(r=>r.pattern===e);return t||(t={pattern:e,matcher:xA(e),onCallbacks:[],offCallbacks:[]},qf.push(t),t)}function GA(e,t,r=!1){const n=mp(e),o=n.matcher(location.pathname);n.onCallbacks.push(t),o&&t()}function YA(e,t,r=!1){const n=mp(e),o=n.matcher(location.pathname);n.offCallbacks.push(t),o||t()}function Ws(e){return new Promise(t=>{setTimeout(t,e)})}function Nt(e){const t=document.createElement("div");return t.innerHTML=e,t.firstElementChild}function zs(e,t,r=5e3,n=document){return new Promise(o=>{let i=0,a=0;i=setTimeout(()=>{clearInterval(a),o(null)},r),a=setInterval(()=>{let l=n.querySelector(t??e);l&&(t&&(l=n.querySelector(e),!l)||(o(l),clearTimeout(i),clearInterval(a)))},10)})}function KA(e,t){new MutationObserver(n=>{for(const o of n)for(const i of Array.from(o.addedNodes))if(i instanceof Element&&i.matches(e)){t(i);return}}).observe(document.body,{childList:!0,subtree:!0})}const yp="/:country/album/:slug?/:id";function Po(e,t=!1){GA(yp,e,t)}function Us(e,t=!1){YA(yp,e,t)}let Gs=null;function fa(e,t){return Nt(` - `)}async function ua(e,t){if(!Ws&&(Ws=await Vs(".navigation__scrollable-container","amp-chrome-player"),!Ws))return;let r=document.querySelector("#ame-sidebar");r||(r=Nt(` + `)}async function ha(e,t){if(!Gs&&(Gs=await zs(".navigation__scrollable-container","amp-chrome-player"),!Gs))return;let r=document.querySelector("#ame-sidebar");r||(r=Nt(`