2563.js 2.8 KB

12
  1. (globalThis.webpackChunksakurairo_scripts=globalThis.webpackChunksakurairo_scripts||[]).push([[2563],{4052:(e,t,a)=>{a.r(t),a.d(t,{aplayerInit:()=>i,destroyAllAplayer:()=>c,pauseAllPlayer:()=>d});a(9138),a(1531),a(3678),a(4145);var s=a(3875),r=a(4237),l=a(4351);let o=[];function n(e,t){const a={container:e,audio:t,mini:null,fixed:null,autoplay:!1,mutex:!0,lrcType:3,listFolded:1,preload:"auto",theme:"#2980b9",loop:"all",order:"list",volume:null,listMaxHeight:null,customAudioType:null,storageName:"metingjs"};if(t.length){t[0].lrc||(a.lrcType=0);const r={};for(const t in a){const s=t.toLowerCase();(e.dataset.hasOwnProperty(s)||e.dataset.hasOwnProperty(t)||null!==a[t])&&(r[t]=e.dataset[s]||e.dataset[t]||a[t],"true"!==r[t]&&"false"!==r[t]||(r[t]="true"==r[t]))}o.push(new s.A(r))}for(let e=0;e<o.length;e++)try{o[e].lrc.hide()}catch(e){console.log(e)}let r=1;document.querySelector(".aplayer.aplayer-fixed").addEventListener("click",(()=>{if(1==r)for(let e=0;e<o.length;e++)try{o[e].lrc.show()}catch(e){console.log(e)}r=2}));let l=0,n=document.querySelector(".aplayer.aplayer-fixed .aplayer-body"),c=document.querySelector(".aplayer-miniswitcher");n&&n.classList.add("ap-hover"),c&&c.addEventListener("click",(()=>{0==l?(n&&n.classList.remove("ap-hover"),document.getElementById("secondary")&&document.getElementById("secondary").classList.add("active"),l=1):(n&&n.classList.add("ap-hover"),document.getElementById("secondary")&&document.getElementById("secondary").classList.remove("active"),l=0)}))}function c(){try{for(let e=0;e<o.length;e++)o[e].destroy();o=[]}catch(e){console.warn(e)}}function d(){const e=[];try{for(const t of o)t.paused||e.push(t),t.pause()}catch(e){console.warn(e)}return e}function i(){let e;_iro.ext_shared_lib?(0,r.loadCSS)("https://s.nmxc.ltd/aplayer/dist/APlayer.min.css"):Promise.resolve().then(a.bind(a,7629)),"string"==typeof meting_api?e=new URL(meting_api):(e=new URL(_iro.meting_api_url),e.searchParams.set("_wpnonce",_iro.nonce)),c();const t=document.getElementsByClassName("aplayer");for(let a=0;a<t.length;a++){const s=t[a];if(s.dataset.id){const t=s.dataset.api?new URL(s.dataset.api):e,a=t.searchParams;a.set("server",s.dataset.server),a.set("type",s.dataset.type),a.set("id",s.dataset.id),fetch(t.toString()).then((async e=>{e.ok?n(s,await e.json()):console.warn(`(APlayer) HTTP ${e.status}:${e.statusText}`)})).catch(console.error)}else if(s.dataset.url){const e=[{name:s.dataset.name||s.dataset.title||"Audio name",artist:s.dataset.artist||s.dataset.author||"Audio artist",url:s.dataset.url,cover:s.dataset.cover||s.dataset.pic,lrc:s.dataset.lrc,type:s.dataset.type||"auto"}];n(s,e)}}(0,l.E)("pauseAllPlayer",d),(0,l.E)("destroyAllAplayer",c),(0,l.E)("loadAPlayer",u),(0,l.E)("getAPlayers",(()=>o))}function u(e){const t=document.getElementsByClassName("aplayer");for(const a of t)n(a,e)}}}]);
  2. //# sourceMappingURL=2563.js.map