2 lines
46 KiB
JavaScript
2 lines
46 KiB
JavaScript
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("APlayer",[],t):"object"==typeof exports?exports.APlayer=t():e.APlayer=t()}("undefined"!=typeof self?self:this,function(){return function(e){function t(i){if(n[i])return n[i].exports;var a=n[i]={i:i,l:!1,exports:{}};return e[i].call(a.exports,a,a.exports,t),a.l=!0,a.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,i){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:i})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/",t(t.s=4)}([function(e,t,n){"use strict";var i,a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};i=function(){return this}();try{i=i||Function("return this")()||(0,eval)("this")}catch(e){"object"===("undefined"==typeof window?"undefined":a(window))&&(i=window)}e.exports=i},function(e,t,n){"use strict";function i(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}Object.defineProperty(t,"__esModule",{value:!0});var a=/mobile/i.test(window.navigator.userAgent),o={secondToTime:function(e){var t=function(e){return e<10?"0"+e:""+e},n=Math.floor(e/3600),i=Math.floor((e-3600*n)/60),a=Math.floor(e-3600*n-60*i);return(n>0?[n,i,a]:[i,a]).map(t).join(":")},getElementViewLeft:function(e){var t=e.offsetLeft,n=e.offsetParent,i=document.body.scrollLeft+document.documentElement.scrollLeft;if(document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement)for(;null!==n&&n!==e;)t+=n.offsetLeft,n=n.offsetParent;else for(;null!==n;)t+=n.offsetLeft,n=n.offsetParent;return t-i},getElementViewTop:function(e){for(var t=e.offsetTop,n=e.offsetParent,i=0;null!==n;)t+=n.offsetTop,n=n.offsetParent;return i=document.body.scrollTop+document.documentElement.scrollTop,t-i},isMobile:a,storage:{set:function(e,t){localStorage.setItem(e,t)},get:function(e){return localStorage.getItem(e)}},nameMap:{dragStart:a?"touchstart":"mousedown",dragMove:a?"touchmove":"mousemove",dragEnd:a?"touchend":"mouseup"},randomOrder:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:(void 0).options.audio.length;return function(e){for(var t=e.length-1;t>=0;t--){var n=Math.floor(Math.random()*(t+1)),i=e[n];e[n]=e[t],e[t]=i}return e}([].concat(i(Array(e))).map(function(e,t){return t}))}};t.default=o},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var a=n(11),o=i(a),r=n(12),l=i(r),s=n(13),u=i(s),c=n(14),p=i(c),d=n(15),h=i(d),f=n(16),y=i(f),m=n(17),v=i(m),g=n(18),w=i(g),b=n(19),M=i(b),T=n(20),x=i(T),k=n(21),L=i(k),_=n(22),q=i(_),E={play:o.default,pause:l.default,volumeUp:u.default,volumeDown:p.default,volumeOff:h.default,orderRandom:y.default,orderList:v.default,menu:w.default,loopAll:M.default,loopOne:x.default,loopNone:L.default,loading:q.default};t.default=E},function(e,t,n){"use strict";e.exports=n(26)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),n(5);var i=n(6),a=function(e){return e&&e.__esModule?e:{default:e}}(i);console.log("\n %c APlayer v1.9.0 97165f0 %c http://aplayer.js.org \n\n","color: #fadfa3; background: #030307; padding:5px 0;","background: #fadfa3; padding:5px 0;"),t.default=a.default},function(e,t){},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(7),l=i(r),s=n(1),u=i(s),c=n(2),p=i(c),d=n(23),h=i(d),f=n(24),y=i(f),m=n(28),v=i(m),g=n(29),w=i(g),b=n(30),M=i(b),T=n(32),x=i(T),k=n(33),L=i(k),_=n(34),q=i(_),E=[],O=function(){function e(t){if(a(this,e),this.options=(0,h.default)(t),this.container=this.options.container,this.playIndex=0,this.paused=!0,this.playedPromise=l.default.resolve(),this.mode="normal",this.randomOrder=u.default.randomOrder(this.options.audio.length),this.container.classList.add("aplayer"),this.options.lrcType&&this.container.classList.add("aplayer-withlrc"),this.options.audio.length>1&&this.container.classList.add("aplayer-withlist"),u.default.isMobile&&this.container.classList.add("aplayer-mobile"),this.arrow=this.container.offsetWidth<=300,this.arrow&&this.container.classList.add("aplayer-arrow"),this.options.mini&&this.setMode("mini"),this.container=this.options.container,2===this.options.lrcType||!0===this.options.lrcType)for(var n=this.container.getElementsByClassName("aplayer-lrc-content"),i=0;i<n.length;i++)this.options.audio[i]&&(this.options.audio[i].lrc=n[i].innerHTML);this.template=new y.default({container:this.container,options:this.options,randomOrder:this.randomOrder}),this.template.info.offsetWidth<200&&this.template.time.classList.add("aplayer-time-narrow"),this.options.lrcType&&(this.lrc=new M.default({container:this.template.lrc,async:3===this.options.lrcType,content:this.options.audio.map(function(e){return e.lrc}),player:this})),this.events=new q.default,this.user=new w.default(this),this.bar=new v.default(this.template),this.controller=new x.default(this),this.timer=new L.default(this),this.initAudio(),"random"===this.options.order?this.switchAudio(this.randomOrder[0]):this.switchAudio(0),this.options.autoplay&&this.play(),E.push(this)}return o(e,[{key:"initAudio",value:function(){var e=this;this.audio=document.createElement("audio"),this.audio.preload=this.options.preload;for(var t=0;t<this.events.audioEvents.length;t++)!function(t){e.audio.addEventListener(e.events.audioEvents[t],function(n){e.events.trigger(e.events.audioEvents[t],n)})}(t);this.on("play",function(){e.paused&&e.play()}),this.on("pause",function(){e.paused||e.pause()}),this.on("timeupdate",function(){if(!e.disableTimeupdate){e.bar.set("played",e.audio.currentTime/e.audio.duration,"width"),e.lrc&&e.lrc.update();var t=u.default.secondToTime(e.audio.currentTime);e.template.ptime.innerHTML!==t&&(e.template.ptime.innerHTML=t)}}),this.on("durationchange",function(){1!==e.audio.duration&&(e.template.dtime.innerHTML=u.default.secondToTime(e.audio.duration))}),this.on("progress",function(){var t=e.audio.buffered.length?e.audio.buffered.end(e.audio.buffered.length-1)/e.audio.duration:0;e.bar.set("loaded",t,"width")}),this.on("error",function(){e.notice("An audio error has occurred.")}),this.on("ended",function(){"none"===e.options.loop?"list"===e.options.order?e.playIndex<e.options.audio.length-1?(e.switchAudio((e.playIndex+1)%e.options.audio.length),e.play()):(e.switchAudio((e.playIndex+1)%e.options.audio.length),e.pause()):"random"===e.options.order&&(e.randomOrder.indexOf(e.playIndex)<e.randomOrder.length-1?(e.switchAudio(e.nextRandomNum()),e.play()):(e.switchAudio(e.nextRandomNum()),e.pause())):"one"===e.options.loop?(e.switchAudio(e.playIndex),e.play()):"all"===e.options.loop&&("list"===e.options.order?e.switchAudio((e.playIndex+1)%e.options.audio.length):"random"===e.options.order&&e.switchAudio(e.nextRandomNum()),e.play())}),this.volume(this.user.get("volume"),!0)}},{key:"switchAudio",value:function(e){var t=this;this.handlePlayPromise(function(){t.events.trigger("switchaudio",e),void 0!==e&&(t.playIndex=e);var n=t.options.audio[t.playIndex];n.cover?t.template.pic.style.backgroundImage="url('"+n.cover+"')":t.template.pic.style.backgroundImage="",t.theme(),t.template.title.innerHTML=n.name,t.template.author.innerHTML=n.artist?" - "+n.artist:"";var i=t.container.getElementsByClassName("aplayer-list-light")[0];i&&i.classList.remove("aplayer-list-light"),t.container.querySelectorAll(".aplayer-list li")[t.playIndex].classList.add("aplayer-list-light"),t.template.list.scrollTop=33*t.playIndex,t.hls&&(t.hls.destroy(),t.hls=null);var a=n.type;t.options.customAudioType&&t.options.customAudioType[a]?"[object Function]"===Object.prototype.toString.call(t.options.customAudioType[a])?t.options.customAudioType[a](t.audio,n,t):console.error("Illegal customType: "+a):(a&&"auto"!==a||(a=/m3u8(#|\?|$)/i.exec(n.url)?"hls":"normal"),"hls"===a?Hls.isSupported()?(t.hls=new Hls,t.hls.loadSource(n.url),t.hls.attachMedia(t.audio)):t.audio.canPlayType("application/x-mpegURL")||t.audio.canPlayType("application/vnd.apple.mpegURL")?t.audio.src=n.url:t.notice("Error: HLS is not supported."):"normal"===a&&(t.audio.src=n.url)),t.seek(0);var o=void 0;return t.paused||(o=l.default.resolve(t.audio.play()).catch(function(e){console.error(e),t.pause()})),t.lrc&&t.lrc.switch(t.playIndex),1!==t.audio.duration&&(t.template.dtime.innerHTML=t.audio.duration?u.default.secondToTime(t.audio.duration):"00:00"),o})}},{key:"theme",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.options.audio[this.playIndex].theme,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.playIndex;this.options.audio[t].theme=e,this.template.listCurs[t].style.backgroundColor=e,t===this.playIndex&&(this.template.pic.style.backgroundColor=e,this.template.played.style.background=e,this.template.thumb.style.background=e,this.template.volume.style.background=e)}},{key:"seek",value:function(e){e=Math.max(e,0),this.audio.duration&&(e=Math.min(e,this.audio.duration)),this.audio.currentTime=e,isNaN(this.audio.duration)?this.bar.set("played",0,"width"):this.bar.set("played",e/this.audio.duration,"width"),this.template.ptime.innerHTML=u.default.secondToTime(e)}},{key:"play",value:function(){var e=this;this.handlePlayPromise(function(){e.paused&&(e.paused=!1,e.template.button.classList.remove("aplayer-play"),e.template.button.classList.add("aplayer-pause"),e.template.button.innerHTML="",setTimeout(function(){e.template.button.innerHTML=p.default.pause},100));var t=l.default.resolve(e.audio.play()).catch(function(t){console.error(t),e.pause()});if(e.timer.enable("loading"),e.options.mutex)for(var n=0;n<E.length;n++)e!==E[n]&&E[n].pause();return t})}},{key:"pause",value:function(){var e=this;this.handlePlayPromise(function(){e.paused||(e.paused=!0,e.template.button.classList.remove("aplayer-pause"),e.template.button.classList.add("aplayer-play"),e.template.button.innerHTML="",setTimeout(function(){e.template.button.innerHTML=p.default.play},100)),e.audio.pause(),e.timer.disable("loading")})}},{key:"switchVolumeIcon",value:function(){this.volume()>=.95?this.template.volumeButton.innerHTML=p.default.volumeUp:this.volume()>0?this.template.volumeButton.innerHTML=p.default.volumeDown:this.template.volumeButton.innerHTML=p.default.volumeOff}},{key:"volume",value:function(e,t){return e=parseFloat(e),isNaN(e)||(e=Math.max(e,0),e=Math.min(e,1),this.bar.set("volume",e,"height"),t||this.user.set("volume",e),this.audio.volume=e,this.audio.muted&&(this.audio.muted=!1),this.switchVolumeIcon()),this.audio.muted?0:this.audio.volume}},{key:"on",value:function(e,t){this.events.on(e,t)}},{key:"toggle",value:function(){this.template.button.classList.contains("aplayer-play")?this.play():this.template.button.classList.contains("aplayer-pause")&&this.pause()}},{key:"isMultiple",value:function(){return this.options.audio.length>1}},{key:"nextRandomNum",value:function(){if(this.isMultiple()){var e=this.randomOrder.indexOf(this.playIndex);return e===this.randomOrder.length-1?this.randomOrder[0]:this.randomOrder[e+1]}return 0}},{key:"addAudio",value:function(e){this.events.trigger("addaudio",e);var t=!this.isMultiple();this.options.audio=this.options.audio.concat(e);for(var n="",i=0;i<e.length;i++)n+='<li><span class="aplayer-list-cur" style="background: '+(e[i].theme||this.options.theme)+';"></span><span class="aplayer-list-index">'+(this.options.audio.length-e.length+i+1)+'</span><span class="aplayer-list-title">'+e[i].name+'</span><span class="aplayer-list-author">'+e[i].artist+"</span></li>";this.template.listOl.innerHTML+=n,t&&this.isMultiple()&&(this.container.classList.add("aplayer-withlist"),this.audio.loop=!1);var a=this.container.querySelectorAll(".aplayer-list li").length;this.template.list.style.height=33*a-1+"px",this.template.listOl.style.height=33*a-1+"px",this.randomOrder=u.default.randomOrder(this.options.audio.length)}},{key:"removeAudio",value:function(e){if(this.events.trigger("removeaudio",e),this.options.audio[e]&&this.options.audio.length>1){var t=this.container.querySelectorAll(".aplayer-list li");this.options.audio.splice(e,1),e===this.playIndex&&(this.options.audio[e+1]?this.switchAudio(e):this.switchAudio(e-1)),this.playIndex>e&&this.playIndex--,t[e].remove();for(var n=e;n<t.length;n++)t[n].getElementsByClassName("aplayer-list-index")[0].textContent=n;1===this.options.audio.length&&this.container.classList.remove("aplayer-withlist"),this.template.list.style.height=parseInt(this.template.list.style.height,10)-33+"px",this.template.listOl.style.height=parseInt(this.template.listOl.style.height,10)-33+"px"}}},{key:"destroy",value:function(){E.splice(E.indexOf(this),1),this.pause(),this.container.innerHTML="",this.audio.src="",this.timer.destroy(),this.events.trigger("destroy")}},{key:"setMode",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"normal";this.mode=e,"mini"===e?this.container.classList.add("aplayer-narrow"):"normal"===e&&this.container.classList.remove("aplayer-narrow")}},{key:"notice",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2e3,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.8;this.template.notice.innerHTML=e,this.template.notice.style.opacity=i,this.noticeTime&&clearTimeout(this.noticeTime),this.events.trigger("notice_show",e),n&&(this.noticeTime=setTimeout(function(){t.template.notice.style.opacity=0,t.events.trigger("notice_hide")},n))}},{key:"handlePlayPromise",value:function(e){this.playedPromise=this.playedPromise.then(e).catch(function(e){console.error(e)})}}],[{key:"version",get:function(){return"1.9.0"}}]),e}();t.default=O},function(e,t,n){"use strict";(function(t){function n(){}function i(e,t){return function(){e.apply(t,arguments)}}function a(e){if(!(this instanceof a))throw new TypeError("Promises must be constructed via new");if("function"!=typeof e)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],c(e,this)}function o(e,t){for(;3===e._state;)e=e._value;if(0===e._state)return void e._deferreds.push(t);e._handled=!0,a._immediateFn(function(){var n=1===e._state?t.onFulfilled:t.onRejected;if(null===n)return void(1===e._state?r:l)(t.promise,e._value);var i;try{i=n(e._value)}catch(e){return void l(t.promise,e)}r(t.promise,i)})}function r(e,t){try{if(t===e)throw new TypeError("A promise cannot be resolved with itself.");if(t&&("object"===(void 0===t?"undefined":p(t))||"function"==typeof t)){var n=t.then;if(t instanceof a)return e._state=3,e._value=t,void s(e);if("function"==typeof n)return void c(i(n,t),e)}e._state=1,e._value=t,s(e)}catch(t){l(e,t)}}function l(e,t){e._state=2,e._value=t,s(e)}function s(e){2===e._state&&0===e._deferreds.length&&a._immediateFn(function(){e._handled||a._unhandledRejectionFn(e._value)});for(var t=0,n=e._deferreds.length;t<n;t++)o(e,e._deferreds[t]);e._deferreds=null}function u(e,t,n){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof t?t:null,this.promise=n}function c(e,t){var n=!1;try{e(function(e){n||(n=!0,r(t,e))},function(e){n||(n=!0,l(t,e))})}catch(e){if(n)return;n=!0,l(t,e)}}var p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},d=setTimeout;a.prototype.catch=function(e){return this.then(null,e)},a.prototype.then=function(e,t){var i=new this.constructor(n);return o(this,new u(e,t,i)),i},a.prototype.finally=function(e){var t=this.constructor;return this.then(function(n){return t.resolve(e()).then(function(){return n})},function(n){return t.resolve(e()).then(function(){return t.reject(n)})})},a.all=function(e){return new a(function(t,n){function i(e,r){try{if(r&&("object"===(void 0===r?"undefined":p(r))||"function"==typeof r)){var l=r.then;if("function"==typeof l)return void l.call(r,function(t){i(e,t)},n)}a[e]=r,0==--o&&t(a)}catch(e){n(e)}}if(!e||void 0===e.length)throw new TypeError("Promise.all accepts an array");var a=Array.prototype.slice.call(e);if(0===a.length)return t([]);for(var o=a.length,r=0;r<a.length;r++)i(r,a[r])})},a.resolve=function(e){return e&&"object"===(void 0===e?"undefined":p(e))&&e.constructor===a?e:new a(function(t){t(e)})},a.reject=function(e){return new a(function(t,n){n(e)})},a.race=function(e){return new a(function(t,n){for(var i=0,a=e.length;i<a;i++)e[i].then(t,n)})},a._immediateFn="function"==typeof t&&function(e){t(e)}||function(e){d(e,0)},a._unhandledRejectionFn=function(e){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",e)},e.exports=a}).call(t,n(8).setImmediate)},function(e,t,n){"use strict";function i(e,t){this._id=e,this._clearFn=t}var a=Function.prototype.apply;t.setTimeout=function(){return new i(a.call(setTimeout,window,arguments),clearTimeout)},t.setInterval=function(){return new i(a.call(setInterval,window,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},i.prototype.unref=i.prototype.ref=function(){},i.prototype.close=function(){this._clearFn.call(window,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},n(9),t.setImmediate=setImmediate,t.clearImmediate=clearImmediate},function(e,t,n){"use strict";(function(e,t){!function(e,n){function i(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),n=0;n<t.length;n++)t[n]=arguments[n+1];var i={callback:e,args:t};return u[s]=i,l(s),s++}function a(e){delete u[e]}function o(e){var t=e.callback,i=e.args;switch(i.length){case 0:t();break;case 1:t(i[0]);break;case 2:t(i[0],i[1]);break;case 3:t(i[0],i[1],i[2]);break;default:t.apply(n,i)}}function r(e){if(c)setTimeout(r,0,e);else{var t=u[e];if(t){c=!0;try{o(t)}finally{a(e),c=!1}}}}if(!e.setImmediate){var l,s=1,u={},c=!1,p=e.document,d=Object.getPrototypeOf&&Object.getPrototypeOf(e);d=d&&d.setTimeout?d:e,"[object process]"==={}.toString.call(e.process)?function(){l=function(e){t.nextTick(function(){r(e)})}}():function(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=n,t}}()?function(){var t="setImmediate$"+Math.random()+"$",n=function(n){n.source===e&&"string"==typeof n.data&&0===n.data.indexOf(t)&&r(+n.data.slice(t.length))};e.addEventListener?e.addEventListener("message",n,!1):e.attachEvent("onmessage",n),l=function(n){e.postMessage(t+n,"*")}}():e.MessageChannel?function(){var e=new MessageChannel;e.port1.onmessage=function(e){r(e.data)},l=function(t){e.port2.postMessage(t)}}():p&&"onreadystatechange"in p.createElement("script")?function(){var e=p.documentElement;l=function(t){var n=p.createElement("script");n.onreadystatechange=function(){r(t),n.onreadystatechange=null,e.removeChild(n),n=null},e.appendChild(n)}}():function(){l=function(e){setTimeout(r,0,e)}}(),d.setImmediate=i,d.clearImmediate=a}}("undefined"==typeof self?void 0===e?void 0:e:self)}).call(t,n(0),n(10))},function(e,t,n){"use strict";function i(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function o(e){if(p===setTimeout)return setTimeout(e,0);if((p===i||!p)&&setTimeout)return p=setTimeout,setTimeout(e,0);try{return p(e,0)}catch(t){try{return p.call(null,e,0)}catch(t){return p.call(this,e,0)}}}function r(e){if(d===clearTimeout)return clearTimeout(e);if((d===a||!d)&&clearTimeout)return d=clearTimeout,clearTimeout(e);try{return d(e)}catch(t){try{return d.call(null,e)}catch(t){return d.call(this,e)}}}function l(){m&&f&&(m=!1,f.length?y=f.concat(y):v=-1,y.length&&s())}function s(){if(!m){var e=o(l);m=!0;for(var t=y.length;t;){for(f=y,y=[];++v<t;)f&&f[v].run();v=-1,t=y.length}f=null,m=!1,r(e)}}function u(e,t){this.fun=e,this.array=t}function c(){}var p,d,h=e.exports={};!function(){try{p="function"==typeof setTimeout?setTimeout:i}catch(e){p=i}try{d="function"==typeof clearTimeout?clearTimeout:a}catch(e){d=a}}();var f,y=[],m=!1,v=-1;h.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];y.push(new u(e,t)),1!==y.length||m||o(s)},u.prototype.run=function(){this.fun.apply(null,this.array)},h.title="browser",h.browser=!0,h.env={},h.argv=[],h.version="",h.versions={},h.on=c,h.addListener=c,h.once=c,h.off=c,h.removeListener=c,h.removeAllListeners=c,h.emit=c,h.prependListener=c,h.prependOnceListener=c,h.listeners=function(e){return[]},h.binding=function(e){throw new Error("process.binding is not supported")},h.cwd=function(){return"/"},h.chdir=function(e){throw new Error("process.chdir is not supported")},h.umask=function(){return 0}},function(e,t){e.exports='<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 16 31"><path d="M15.552 15.168q0.448 0.32 0.448 0.832 0 0.448-0.448 0.768l-13.696 8.512q-0.768 0.512-1.312 0.192t-0.544-1.28v-16.448q0-0.96 0.544-1.28t1.312 0.192z"></path></svg>'},function(e,t){e.exports='<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 17 32"><path d="M14.080 4.8q2.88 0 2.88 2.048v18.24q0 2.112-2.88 2.112t-2.88-2.112v-18.24q0-2.048 2.88-2.048zM2.88 4.8q2.88 0 2.88 2.048v18.24q0 2.112-2.88 2.112t-2.88-2.112v-18.24q0-2.048 2.88-2.048z"></path></svg>'},function(e,t){e.exports='<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 28 32"><path d="M13.728 6.272v19.456q0 0.448-0.352 0.8t-0.8 0.32-0.8-0.32l-5.952-5.952h-4.672q-0.48 0-0.8-0.352t-0.352-0.8v-6.848q0-0.48 0.352-0.8t0.8-0.352h4.672l5.952-5.952q0.32-0.32 0.8-0.32t0.8 0.32 0.352 0.8zM20.576 16q0 1.344-0.768 2.528t-2.016 1.664q-0.16 0.096-0.448 0.096-0.448 0-0.8-0.32t-0.32-0.832q0-0.384 0.192-0.64t0.544-0.448 0.608-0.384 0.512-0.64 0.192-1.024-0.192-1.024-0.512-0.64-0.608-0.384-0.544-0.448-0.192-0.64q0-0.48 0.32-0.832t0.8-0.32q0.288 0 0.448 0.096 1.248 0.48 2.016 1.664t0.768 2.528zM25.152 16q0 2.72-1.536 5.056t-4 3.36q-0.256 0.096-0.448 0.096-0.48 0-0.832-0.352t-0.32-0.8q0-0.704 0.672-1.056 1.024-0.512 1.376-0.8 1.312-0.96 2.048-2.4t0.736-3.104-0.736-3.104-2.048-2.4q-0.352-0.288-1.376-0.8-0.672-0.352-0.672-1.056 0-0.448 0.32-0.8t0.8-0.352q0.224 0 0.48 0.096 2.496 1.056 4 3.36t1.536 5.056zM29.728 16q0 4.096-2.272 7.552t-6.048 5.056q-0.224 0.096-0.448 0.096-0.48 0-0.832-0.352t-0.32-0.8q0-0.64 0.704-1.056 0.128-0.064 0.384-0.192t0.416-0.192q0.8-0.448 1.44-0.896 2.208-1.632 3.456-4.064t1.216-5.152-1.216-5.152-3.456-4.064q-0.64-0.448-1.44-0.896-0.128-0.096-0.416-0.192t-0.384-0.192q-0.704-0.416-0.704-1.056 0-0.448 0.32-0.8t0.832-0.352q0.224 0 0.448 0.096 3.776 1.632 6.048 5.056t2.272 7.552z"></path></svg>'},function(e,t){e.exports='<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 28 32"><path d="M13.728 6.272v19.456q0 0.448-0.352 0.8t-0.8 0.32-0.8-0.32l-5.952-5.952h-4.672q-0.48 0-0.8-0.352t-0.352-0.8v-6.848q0-0.48 0.352-0.8t0.8-0.352h4.672l5.952-5.952q0.32-0.32 0.8-0.32t0.8 0.32 0.352 0.8zM20.576 16q0 1.344-0.768 2.528t-2.016 1.664q-0.16 0.096-0.448 0.096-0.448 0-0.8-0.32t-0.32-0.832q0-0.384 0.192-0.64t0.544-0.448 0.608-0.384 0.512-0.64 0.192-1.024-0.192-1.024-0.512-0.64-0.608-0.384-0.544-0.448-0.192-0.64q0-0.48 0.32-0.832t0.8-0.32q0.288 0 0.448 0.096 1.248 0.48 2.016 1.664t0.768 2.528z"></path></svg>'},function(e,t){e.exports='<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 28 32"><path d="M13.728 6.272v19.456q0 0.448-0.352 0.8t-0.8 0.32-0.8-0.32l-5.952-5.952h-4.672q-0.48 0-0.8-0.352t-0.352-0.8v-6.848q0-0.48 0.352-0.8t0.8-0.352h4.672l5.952-5.952q0.32-0.32 0.8-0.32t0.8 0.32 0.352 0.8z"></path></svg>'},function(e,t){e.exports='<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 32 32"><path d="M22.667 4l7 6-7 6 7 6-7 6v-4h-3.653l-3.76-3.76 2.827-2.827 2.587 2.587h2v-8h-2l-12 12h-6v-4h4.347l12-12h3.653v-4zM2.667 8h6l3.76 3.76-2.827 2.827-2.587-2.587h-4.347v-4z"></path></svg>'},function(e,t){e.exports='<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 32 32"><path d="M0.622 18.334h19.54v7.55l11.052-9.412-11.052-9.413v7.549h-19.54v3.725z"></path></svg>'},function(e,t){e.exports='<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 22 32"><path d="M20.8 14.4q0.704 0 1.152 0.48t0.448 1.12-0.48 1.12-1.12 0.48h-19.2q-0.64 0-1.12-0.48t-0.48-1.12 0.448-1.12 1.152-0.48h19.2zM1.6 11.2q-0.64 0-1.12-0.48t-0.48-1.12 0.448-1.12 1.152-0.48h19.2q0.704 0 1.152 0.48t0.448 1.12-0.48 1.12-1.12 0.48h-19.2zM20.8 20.8q0.704 0 1.152 0.48t0.448 1.12-0.48 1.12-1.12 0.48h-19.2q-0.64 0-1.12-0.48t-0.48-1.12 0.448-1.12 1.152-0.48h19.2z"></path></svg>'},function(e,t){e.exports='<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 29 32"><path d="M9.333 9.333h13.333v4l5.333-5.333-5.333-5.333v4h-16v8h2.667v-5.333zM22.667 22.667h-13.333v-4l-5.333 5.333 5.333 5.333v-4h16v-8h-2.667v5.333z"></path></svg>'},function(e,t){e.exports='<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 33 32"><path d="M9.333 9.333h13.333v4l5.333-5.333-5.333-5.333v4h-16v8h2.667v-5.333zM22.667 22.667h-13.333v-4l-5.333 5.333 5.333 5.333v-4h16v-8h-2.667v5.333zM17.333 20v-8h-1.333l-2.667 1.333v1.333h2v5.333h2z"></path></svg>'},function(e,t){e.exports='<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 29 32"><path d="M2.667 7.027l1.707-1.693 22.293 22.293-1.693 1.707-4-4h-11.64v4l-5.333-5.333 5.333-5.333v4h8.973l-8.973-8.973v0.973h-2.667v-3.64l-4-4zM22.667 17.333h2.667v5.573l-2.667-2.667v-2.907zM22.667 6.667v-4l5.333 5.333-5.333 5.333v-4h-10.907l-2.667-2.667h13.573z"></path></svg>'},function(e,t){e.exports='<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 32 32"><path d="M4 16c0-6.6 5.4-12 12-12s12 5.4 12 12c0 1.2-0.8 2-2 2s-2-0.8-2-2c0-4.4-3.6-8-8-8s-8 3.6-8 8 3.6 8 8 8c1.2 0 2 0.8 2 2s-0.8 2-2 2c-6.6 0-12-5.4-12-12z"></path></svg>'},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t={container:e.element||document.getElementsByClassName("aplayer")[0],mini:e.narrow||!1,autoplay:!1,mutex:!0,lrcType:e.showlrc||e.lrc||0,preload:"auto",theme:"#b7daff",loop:"all",order:"list",volume:.7,listFolded:!1,listMaxHeight:e.listmaxheight,audio:e.music};for(var n in t)t.hasOwnProperty(n)&&!e.hasOwnProperty(n)&&(e[n]=t[n]);return"[object Array]"!==Object.prototype.toString.call(e.audio)&&(e.audio=[e.audio]),e.audio.map(function(e){return e.name=e.name||e.title,e.artist=e.artist||e.author,e.cover=e.cover||e.pic,e.type=e.type||"normal",e}),e.audio.length<=1&&"one"===e.loop&&(e.loop="all"),e}},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(2),l=i(r),s=n(25),u=i(s),c=function(){function e(t){a(this,e),this.container=t.container,this.options=t.options,this.randomOrder=t.randomOrder,this.init()}return o(e,[{key:"init",value:function(){var e=void 0;e="random"===this.options.order?this.options.audio[this.randomOrder[0]].cover:this.options.audio[0].cover,this.container.innerHTML=(0,u.default)({options:this.options,icons:l.default,cover:e}),this.lrc=this.container.querySelector(".aplayer-lrc-contents"),this.ptime=this.container.querySelector(".aplayer-ptime"),this.info=this.container.querySelector(".aplayer-info"),this.time=this.container.querySelector(".aplayer-time"),this.barWrap=this.container.querySelector(".aplayer-bar-wrap"),this.button=this.container.querySelector(".aplayer-button"),this.list=this.container.querySelector(".aplayer-list"),this.listOl=this.container.querySelector(".aplayer-list ol"),this.listCurs=this.container.querySelectorAll(".aplayer-list-cur"),this.played=this.container.querySelector(".aplayer-played"),this.loaded=this.container.querySelector(".aplayer-loaded"),this.thumb=this.container.querySelector(".aplayer-thumb"),this.volume=this.container.querySelector(".aplayer-volume"),this.volumeBar=this.container.querySelector(".aplayer-volume-bar"),this.volumeButton=this.container.querySelector(".aplayer-time button"),this.volumeBarWrap=this.container.querySelector(".aplayer-volume-bar-wrap"),this.loop=this.container.querySelector(".aplayer-icon-loop"),this.order=this.container.querySelector(".aplayer-icon-order"),this.menu=this.container.querySelector(".aplayer-icon-menu"),this.pic=this.container.querySelector(".aplayer-pic"),this.title=this.container.querySelector(".aplayer-title"),this.author=this.container.querySelector(".aplayer-author"),this.dtime=this.container.querySelector(".aplayer-dtime"),this.notice=this.container.querySelector(".aplayer-notice")}}]),e}();t.default=c},function(e,t,n){var i=n(3);e.exports=function(e){"use strict";e=e||{};var t="",n=e.cover,a=i.$escape,o=e.options,r=e.icons,l=i.$each;e.$value,e.$index;return t+='<div class="aplayer-body">\n <div class="aplayer-pic" style="',n&&(t+="background-image: url("",t+=a(n),t+="");"),t+="background-color: ",t+=a(o.theme),t+=';">\n <div class="aplayer-button aplayer-play">',t+=r.play,t+='</div>\n </div>\n <div class="aplayer-info">\n <div class="aplayer-music">\n <span class="aplayer-title"></span>\n <span class="aplayer-author"></span>\n </div>\n <div class="aplayer-lrc">\n <div class="aplayer-lrc-contents" style="transform: translateY(0); -webkit-transform: translateY(0);"></div>\n </div>\n <div class="aplayer-controller">\n <div class="aplayer-bar-wrap">\n <div class="aplayer-bar">\n <div class="aplayer-loaded" style="width: 0"></div>\n <div class="aplayer-played" style="width: 0; background: ',t+=a(o.theme),t+=';">\n <span class="aplayer-thumb" style="background: ',t+=a(o.theme),t+=';">\n <span class="aplayer-loading-icon">',t+=r.loading,t+='</span>\n </span>\n </div>\n </div>\n </div>\n <div class="aplayer-time">\n <span class="aplayer-time-inner">\n <span class="aplayer-ptime">00:00</span> / <span class="aplayer-dtime">00:00</span>\n </span>\n <div class="aplayer-volume-wrap">\n <button type="button" class="aplayer-icon aplayer-icon-volume-down">\n ',t+=r.volumeDown,t+='\n </button>\n <div class="aplayer-volume-bar-wrap">\n <div class="aplayer-volume-bar">\n <div class="aplayer-volume" style="height: 80%; background: ',t+=a(o.theme),t+=';"></div>\n </div>\n </div>\n </div>\n ',o.audio.length>1&&(t+='\n <button type="button" class="aplayer-icon aplayer-icon-order">\n ',"list"===o.order?t+=r.orderList:"random"===o.order&&(t+=r.orderRandom),t+="\n </button>\n "),t+='\n <button type="button" class="aplayer-icon aplayer-icon-loop">\n ',"one"===o.loop?t+=r.loopOne:"all"===o.loop?t+=r.loopAll:"none"===o.loop&&(t+=r.loopNone),t+='\n </button>\n <button type="button" class="aplayer-icon aplayer-icon-menu">\n ',t+=r.menu,t+='\n </button>\n </div>\n </div>\n </div>\n <div class="aplayer-notice"></div>\n</div>\n<div class="aplayer-list',o.listFolded&&(t+=" aplayer-list-hide"),t+='"',o.listMaxHeight&&(t+=' style="max-height: ',t+=a(o.listMaxHeight),t+='"'),t+=">\n <ol",o.listMaxHeight&&(t+=' style="max-height: ',t+=a(o.listMaxHeight),t+='"'),t+=">\n ",l(o.audio,function(e,n){t+='\n <li>\n <span class="aplayer-list-cur" style="background-color: ',t+=a(e.theme||o.theme),t+=';"></span>\n <span class="aplayer-list-index">',t+=a(n+1),t+='</span>\n <span class="aplayer-list-title">',t+=a(e.name),t+='</span>\n <span class="aplayer-list-author">',t+=a(e.artist),t+="</span>\n </li>\n "}),t+="\n </ol>\n</div>"}},function(e,t,n){"use strict";(function(t){function i(e){return"string"!=typeof e&&(e=void 0===e||null===e?"":"function"==typeof e?i(e.call(e)):JSON.stringify(e)),e}function a(e){var t=""+e,n=l.exec(t);if(!n)return e;var i="",a=void 0,o=void 0,r=void 0;for(a=n.index,o=0;a<t.length;a++){switch(t.charCodeAt(a)){case 34:r=""";break;case 38:r="&";break;case 39:r="'";break;case 60:r="<";break;case 62:r=">";break;default:continue}o!==a&&(i+=t.substring(o,a)),o=a+1,i+=r}return o!==a?i+t.substring(o,a):i}var o=n(27),r=Object.create(o?t:window),l=/["&'<>]/;r.$escape=function(e){return a(i(e))},r.$each=function(e,t){if(Array.isArray(e))for(var n=0,i=e.length;n<i;n++)t(e[n],n);else for(var a in e)t(e[a],a)},e.exports=r}).call(t,n(0))},function(e,t,n){"use strict";(function(t){e.exports=!1;try{e.exports="[object process]"===Object.prototype.toString.call(t.process)}catch(e){}}).call(t,n(0))},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=function(){function e(t){i(this,e),this.elements={},this.elements.volume=t.volume,this.elements.played=t.played,this.elements.loaded=t.loaded}return a(e,[{key:"set",value:function(e,t,n){t=Math.max(t,0),t=Math.min(t,1),this.elements[e].style[n]=100*t+"%"}},{key:"get",value:function(e,t){return parseFloat(this.elements[e].style[t])/100}}]),e}();t.default=o},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(1),r=function(e){return e&&e.__esModule?e:{default:e}}(o),l=function(){function e(t){i(this,e),this.storageName={volume:"aplayer-volume"},this.default={volume:t.options.volume||.7},this.data={},this.init()}return a(e,[{key:"init",value:function(){for(var e in this.storageName){var t=this.storageName[e];this.data[e]=parseFloat(r.default.storage.get(t)||this.default[e])}}},{key:"get",value:function(e){return this.data[e]}},{key:"set",value:function(e,t){this.data[e]=t,r.default.storage.set(this.storageName[e],t)}}]),e}();t.default=l},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=n(31),r=function(e){return e&&e.__esModule?e:{default:e}}(o),l=function(){function e(t){i(this,e),this.container=t.container,this.async=t.async,this.player=t.player,this.content=t.content,this.parsed=[],this.index=0,this.current=[]}return a(e,[{key:"update",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.player.audio.currentTime;if(this.index>this.current.length-1||e<this.current[this.index][0]||!this.current[this.index+1]||e>=this.current[this.index+1][0])for(var t=0;t<this.current.length;t++)e>=this.current[t][0]&&(!this.current[t+1]||e<this.current[t+1][0])&&(this.index=t,this.container.style.transform="translateY("+16*-this.index+"px)",this.container.style.webkitTransform="translateY("+16*-this.index+"px)",this.container.getElementsByClassName("aplayer-lrc-current")[0].classList.remove("aplayer-lrc-current"),this.container.getElementsByTagName("p")[t].classList.add("aplayer-lrc-current"))}},{key:"switch",value:function(e){var t=this;if(!this.parsed[e])if(this.async){this.parsed[e]=[["00:00","Loading"]];var n=new XMLHttpRequest;n.onreadystatechange=function(){e===t.player.playIndex&&4===n.readyState&&(n.status>=200&&n.status<300||304===n.status?t.parsed[e]=t.parse(n.responseText):(t.player.notice("LRC file request fails: status "+n.status),t.parsed[e]=[["00:00","Not available"]]),t.container.innerHTML=(0,r.default)({lyrics:t.parsed[e]}),t.update(0),t.current=t.parsed[e])};var i=this.content[e];n.open("get",i,!0),n.send(null)}else this.content[e]?this.parsed[e]=this.parse(this.content[e]):this.parsed[e]=[["00:00","Not available"]];this.container.innerHTML=(0,r.default)({lyrics:this.parsed[e]}),this.update(0),this.current=this.parsed[e]}},{key:"parse",value:function(e){if(e){e=e.replace(/([^\]^\n])\[/g,function(e,t){return t+"\n["});for(var t=e.split("\n"),n=[],i=t.length,a=0;a<i;a++){var o=t[a].match(/\[(\d{2}):(\d{2})(\.(\d{2,3}))?]/g),r=t[a].replace(/.*\[(\d{2}):(\d{2})(\.(\d{2,3}))?]/g,"").replace(/<(\d{2}):(\d{2})(\.(\d{2,3}))?>/g,"").replace(/^\s+|\s+$/g,"");if(o)for(var l=o.length,s=0;s<l;s++){var u=/\[(\d{2}):(\d{2})(\.(\d{2,3}))?]/.exec(o[s]),c=60*u[1],p=parseInt(u[2]),d=u[4]?parseInt(u[4])/(2===(u[4]+"").length?100:1e3):0,h=c+p+d;n.push([h,r])}}return n.sort(function(e,t){return e[0]-t[0]}),n}return[]}}]),e}();t.default=l},function(e,t,n){var i=n(3);e.exports=function(e){"use strict";e=e||{};var t="",n=i.$each,a=e.lyrics,o=(e.$value,e.$index,i.$escape);return n(a,function(e,n){t+="\n <p",0===n&&(t+=' class="aplayer-lrc-current"'),t+=">",t+=o(e[1]),t+="</p>\n"}),t}},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(1),l=i(r),s=n(2),u=i(s),c=function(){function e(t){a(this,e),this.player=t,this.initPlayButton(),this.initList(),this.initPlayBar(),this.player.isMultiple()&&this.initOrderButton(),this.initLoopButton(),this.initMenuButton(),l.default.isMobile||this.initVolumeButton()}return o(e,[{key:"initPlayButton",value:function(){var e=this;this.player.template.pic.addEventListener("click",function(){e.player.toggle()})}},{key:"initList",value:function(){var e=this;this.player.template.list.addEventListener("click",function(t){var n=void 0;n="LI"===t.target.tagName.toUpperCase()?t.target:t.target.parentElement;var i=parseInt(n.getElementsByClassName("aplayer-list-index")[0].innerHTML)-1;i!==e.player.playIndex?(e.player.switchAudio(i),e.player.play()):e.player.toggle()})}},{key:"initPlayBar",value:function(){var e=this,t=function(t){var n=((t.clientX||t.changedTouches[0].clientX)-l.default.getElementViewLeft(e.player.template.barWrap))/e.player.template.barWrap.clientWidth;n=Math.max(n,0),n=Math.min(n,1),e.player.bar.set("played",n,"width"),e.player.lrc&&e.player.lrc.update(n*e.player.audio.duration),e.player.template.ptime.innerHTML=l.default.secondToTime(n*e.player.audio.duration)},n=function n(i){document.removeEventListener(l.default.nameMap.dragEnd,n),document.removeEventListener(l.default.nameMap.dragMove,t);var a=((i.clientX||i.changedTouches[0].clientX)-l.default.getElementViewLeft(e.player.template.barWrap))/e.player.template.barWrap.clientWidth;a=Math.max(a,0),a=Math.min(a,1),e.player.bar.set("played",a,"width"),e.player.seek(e.player.bar.get("played","width")*e.player.audio.duration),e.player.disableTimeupdate=!1};this.player.template.barWrap.addEventListener(l.default.nameMap.dragStart,function(){e.player.disableTimeupdate=!0,document.addEventListener(l.default.nameMap.dragMove,t),document.addEventListener(l.default.nameMap.dragEnd,n)})}},{key:"initVolumeButton",value:function(){var e=this;this.player.template.volumeButton.addEventListener("click",function(){e.player.audio.muted?(e.player.audio.muted=!1,e.player.switchVolumeIcon(),e.player.bar.set("volume",e.player.volume(),"height")):(e.player.audio.muted=!0,e.player.switchVolumeIcon(),e.player.bar.set("volume",0,"height"))});var t=function(t){var n=1-((t.clientY||t.changedTouches[0].clientY)-l.default.getElementViewTop(e.player.template.volumeBar))/e.player.template.volumeBar.clientHeight;n=Math.max(n,0),n=Math.min(n,1),e.player.volume(n)},n=function n(i){e.player.template.volumeBarWrap.classList.remove("aplayer-volume-bar-wrap-active"),document.removeEventListener(l.default.nameMap.dragEnd,n),document.removeEventListener(l.default.nameMap.dragMove,t);var a=1-((i.clientY||i.changedTouches[0].clientY)-l.default.getElementViewTop(e.player.template.volumeBar))/e.player.template.volumeBar.clientHeight;a=Math.max(a,0),a=Math.min(a,1),e.player.volume(a)};this.player.template.volumeBarWrap.addEventListener(l.default.nameMap.dragStart,function(){e.player.template.volumeBarWrap.classList.add("aplayer-volume-bar-wrap-active"),document.addEventListener(l.default.nameMap.dragMove,t),document.addEventListener(l.default.nameMap.dragEnd,n)})}},{key:"initOrderButton",value:function(){var e=this;this.player.template.order.addEventListener("click",function(){"list"===e.player.options.order?(e.player.options.order="random",e.player.template.order.innerHTML=u.default.orderRandom):"random"===e.player.options.order&&(e.player.options.order="list",e.player.template.order.innerHTML=u.default.orderList)})}},{key:"initLoopButton",value:function(){var e=this;this.player.template.loop.addEventListener("click",function(){e.player.isMultiple()?"one"===e.player.options.loop?(e.player.options.loop="none",e.player.template.loop.innerHTML=u.default.loopNone):"none"===e.player.options.loop?(e.player.options.loop="all",e.player.template.loop.innerHTML=u.default.loopAll):"all"===e.player.options.loop&&(e.player.options.loop="one",e.player.template.loop.innerHTML=u.default.loopOne):"one"===e.player.options.loop||"all"===e.player.options.loop?(e.player.options.loop="none",e.player.template.loop.innerHTML=u.default.loopNone):"none"===e.player.options.loop&&(e.player.options.loop="all",e.player.template.loop.innerHTML=u.default.loopAll)})}},{key:"initMenuButton",value:function(){var e=this;this.player.template.list.style.height=33*this.player.options.audio.length-1+"px",this.player.template.listOl.style.height=33*this.player.options.audio.length-1+"px",this.player.template.menu.addEventListener("click",function(){e.player.template.list.classList.contains("aplayer-list-hide")?e.player.template.list.classList.remove("aplayer-list-hide"):e.player.template.list.classList.add("aplayer-list-hide")})}}]),e}();t.default=c},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=function(){function e(t){i(this,e),this.player=t,window.requestAnimationFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(e){window.setTimeout(e,1e3/60)}}(),this.types=["loading"],this.init()}return a(e,[{key:"init",value:function(){var e=this;this.types.map(function(t){return e["init"+t+"Checker"](),t})}},{key:"initloadingChecker",value:function(){var e=this,t=0,n=0,i=!1;this.loadingChecker=setInterval(function(){e.enableloadingChecker&&(n=e.player.audio.currentTime,i||n!==t||e.player.audio.paused||(e.player.container.classList.add("aplayer-loading"),i=!0),i&&n>t&&!e.player.audio.paused&&(e.player.container.classList.remove("aplayer-loading"),i=!1),t=n)},100)}},{key:"enable",value:function(e){this["enable"+e+"Checker"]=!0,"fps"===e&&this.initfpsChecker()}},{key:"disable",value:function(e){this["enable"+e+"Checker"]=!1}},{key:"destroy",value:function(){var e=this;this.types.map(function(t){return e["enable"+t+"Checker"]=!1,e[t+"Checker"]&&clearInterval(e[t+"Checker"]),t})}}]),e}();t.default=o},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=function(){function e(){i(this,e),this.events={},this.audioEvents=["abort","canplay","canplaythrough","durationchange","emptied","ended","error","loadeddata","loadedmetadata","loadstart","mozaudioavailable","pause","play","playing","progress","ratechange","seeked","seeking","stalled","suspend","timeupdate","volumechange","waiting"],this.playerEvents=["destroy","switchaudio","addaudio","removeaudio","notice_show","notice_hide"]}return a(e,[{key:"on",value:function(e,t){this.type(e)&&"function"==typeof t&&(this.events[e]||(this.events[e]=[]),this.events[e].push(t))}},{key:"trigger",value:function(e,t){if(this.events[e]&&this.events[e].length)for(var n=0;n<this.events[e].length;n++)this.events[e][n](t)}},{key:"type",value:function(e){return-1!==this.playerEvents.indexOf(e)?"player":-1!==this.audioEvents.indexOf(e)?"audio":(console.error("Unknown event name: "+e),null)}}]),e}();t.default=o}]).default});
|
|
//# sourceMappingURL=APlayer.min.js.map
|