APlayer-Typecho/assets/APlayer.min.js
METO a52dc90c8f 🍰 2.0.2,日常更新 APlayer, MetingJS
- MetingJS 1.4.0 暴露接口,方便 pjax 回调
 - APlayer 1.6.1 优化了部分 UI
2017-11-16 21:26:55 +08:00

3 lines
38 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()}(this,function(){return function(e){function t(n){if(a[n])return a[n].exports;var i=a[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var a={};return t.m=e,t.c=a,t.i=function(e){return e},t.d=function(e,a,n){t.o(e,a)||Object.defineProperty(e,a,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var a=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(a,"a",a),a},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=1)}([function(e,t,a){var n=a(2);"string"==typeof n&&(n=[[e.i,n,""]]);var i={};i.transform=void 0;a(4)(n,i);n.locals&&(e.exports=n.locals)},function(e,t,a){"use strict";function n(e){if(Array.isArray(e)){for(var t=0,a=Array(e.length);t<e.length;t++)a[t]=e[t];return a}return Array.from(e)}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var r=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}();a(0);var l=[],o=function(){function e(t){function a(e){for(var t=e.offsetLeft,a=e.offsetParent,n=void 0;null!==a;)t+=a.offsetLeft,a=a.offsetParent;return n=document.body.scrollLeft+document.documentElement.scrollLeft,t-n}function n(e){for(var t=e.offsetTop,a=e.offsetParent,n=void 0;null!==a;)t+=a.offsetTop,a=a.offsetParent;return n=document.body.scrollTop+document.documentElement.scrollTop,t-n}var r=this;i(this,e);var o={play:["0 0 16 31","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"],pause:["0 0 17 32","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"],"volume-up":["0 0 28 32","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"],"volume-down":["0 0 28 32","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"],"volume-off":["0 0 28 32","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"],circulation:["0 0 29 32","M25.6 9.92q1.344 0 2.272 0.928t0.928 2.272v9.28q0 1.28-0.928 2.24t-2.272 0.96h-22.4q-1.28 0-2.24-0.96t-0.96-2.24v-9.28q0-1.344 0.96-2.272t2.24-0.928h8v-3.52l6.4 5.76-6.4 5.76v-3.52h-6.72v6.72h19.84v-6.72h-4.8v-4.48h6.080z"],random:["0 0 33 31","M29.867 9.356l-5.003 5.003c-0.094 0.094-0.235 0.141-0.36 0.141-0.266 0-0.5-0.219-0.5-0.5v-3.002h-4.002c-2.079 0-3.064 1.423-3.94 3.111-0.453 0.875-0.844 1.782-1.219 2.673-1.735 4.033-3.768 8.223-8.849 8.223h-3.502c-0.281 0-0.5-0.219-0.5-0.5v-3.002c0-0.281 0.219-0.5 0.5-0.5h3.502c2.079 0 3.064-1.423 3.94-3.111 0.453-0.875 0.844-1.782 1.219-2.673 1.735-4.033 3.768-8.223 8.849-8.223h4.002v-3.002c0-0.281 0.219-0.5 0.5-0.5 0.141 0 0.266 0.063 0.375 0.156l4.987 4.987c0.094 0.094 0.141 0.235 0.141 0.36s-0.047 0.266-0.141 0.36zM10.262 14.781c-0.907-1.892-1.907-3.783-4.268-3.783h-3.502c-0.281 0-0.5-0.219-0.5-0.5v-3.002c0-0.281 0.219-0.5 0.5-0.5h3.502c2.783 0 4.831 1.298 6.41 3.518-0.876 1.344-1.517 2.798-2.142 4.268zM29.867 23.363l-5.003 5.003c-0.094 0.094-0.235 0.141-0.36 0.141-0.266 0-0.5-0.235-0.5-0.5v-3.002c-4.643 0-7.504 0.547-10.396-3.518 0.86-1.344 1.501-2.798 2.126-4.268 0.907 1.892 1.907 3.783 4.268 3.783h4.002v-3.002c0-0.281 0.219-0.5 0.5-0.5 0.141 0 0.266 0.063 0.375 0.156l4.987 4.987c0.094 0.094 0.141 0.235 0.141 0.36s-0.047 0.266-0.141 0.36z"],order:["0 0 32 32","M0.622 18.334h19.54v7.55l11.052-9.412-11.052-9.413v7.549h-19.54v3.725z"],single:["0 0 38 32","M2.072 21.577c0.71-0.197 1.125-0.932 0.928-1.641-0.221-0.796-0.333-1.622-0.333-2.457 0-5.049 4.108-9.158 9.158-9.158h5.428c0.056-0.922 0.221-1.816 0.482-2.667h-5.911c-3.158 0-6.128 1.23-8.361 3.463s-3.463 5.203-3.463 8.361c0 1.076 0.145 2.143 0.431 3.171 0.164 0.59 0.7 0.976 1.284 0.976 0.117 0 0.238-0.016 0.357-0.049zM21.394 25.613h-12.409v-2.362c0-0.758-0.528-1.052-1.172-0.652l-5.685 3.522c-0.644 0.4-0.651 1.063-0.014 1.474l5.712 3.69c0.637 0.411 1.158 0.127 1.158-0.63v-2.374h12.409c3.158 0 6.128-1.23 8.361-3.463 1.424-1.424 2.44-3.148 2.99-5.029-0.985 0.368-2.033 0.606-3.125 0.691-1.492 3.038-4.619 5.135-8.226 5.135zM28.718 0c-4.985 0-9.026 4.041-9.026 9.026s4.041 9.026 9.026 9.026 9.026-4.041 9.026-9.026-4.041-9.026-9.026-9.026zM30.392 13.827h-1.728v-6.822c-0.635 0.576-1.433 1.004-2.407 1.285v-1.713c0.473-0.118 0.975-0.325 1.506-0.62 0.532-0.325 0.975-0.665 1.329-1.034h1.3v8.904z"],menu:["0 0 22 32","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"]};this.getSVG=function(e){return'\n <svg xmlns:xlink="http://www.w3.org/1999/xlink" height="100%" version="1.1" viewBox="'+o[e][0]+'" width="100%">\n <use xlink:href="#aplayer-'+e+'"></use>\n <path class="aplayer-fill" d="'+o[e][1]+'" id="aplayer-'+e+'"></path>\n </svg>\n '},this.isMobile=/mobile/i.test(window.navigator.userAgent),this.isMobile&&(t.autoplay=!1);var s={element:document.getElementsByClassName("aplayer")[0],autoplay:!1,mutex:!0,theme:"#b7daff",mode:"circulation"};for(var p in s)s.hasOwnProperty(p)&&!t.hasOwnProperty(p)&&(t[p]=s[p]);this.option=t,this.audios=[],this.mode=t.mode,this.element=this.option.element,this.secondToTime=function(e){if(isNaN(e))return"00:00";var t=function(e){return e<10?"0"+e:""+e},a=parseInt(e/60),n=parseInt(e-60*a),i=parseInt(a/60),r=parseInt(e/60-60*parseInt(e/60/60));return e>=3600?t(i)+":"+t(r)+":"+t(n):t(a)+":"+t(n)},this.updateBar=function(e,t,a){t=t>0?t:0,t=t<1?t:1,m[e+"Bar"].style[a]=100*t+"%"};var u=["play","pause","canplay","playing","ended","error"];this.event={};for(var c=0;c<u.length;c++)this.event[u[c]]=[];this.trigger=function(e){for(var t=0;t<r.event[e].length;t++)r.event[e][t]()},this.playIndex=0,this.multiple="[object Array]"===Object.prototype.toString.call(t.music),this.multiple||(this.option.music=[this.option.music]),this.music=this.option.music[this.playIndex],this.option.music.length>1&&this.element.classList.add("aplayer-withlist"),this.multiple||"circulation"===this.mode||"order"===this.mode||(this.mode="circulation"),this.getRandomOrder();for(var d='\n <div class="aplayer-pic" '+(this.music.pic?"style=\"background-image: url('"+this.music.pic+"');\"":"")+'>\n <div class="aplayer-button aplayer-play">\n <button type="button" class="aplayer-icon aplayer-icon-play">\n '+this.getSVG("play")+'\n </button>\n </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-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: '+this.option.theme+';">\n <span class="aplayer-thumb" style="border: 1px solid '+this.option.theme+';"></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" '+(this.isMobile?'style="display: none;"':"")+">\n "+this.getSVG("volume-down")+'\n </button>\n <div class="aplayer-volume-bar-wrap">\n <div class="aplayer-volume-bar">\n <div class="aplayer-volume" style="height: 100%; background: '+this.option.theme+';"></div>\n </div>\n </div>\n </div>\n <button type="button" class="aplayer-icon aplayer-icon-mode">\n '+this.getSVG(this.mode)+'\n </button>\n <button type="button" class="aplayer-icon aplayer-icon-menu">\n '+this.getSVG("menu")+'\n </button>\n </div>\n </div>\n </div>\n <div class="aplayer-list" '+(this.option.listmaxheight?'style="max-height: '+this.option.listmaxheight:"")+'">\n <ol>',y=0;y<this.option.music.length;y++)d+='\n <li>\n <span class="aplayer-list-cur" style="background: '+this.option.theme+';"></span>\n <span class="aplayer-list-index">'+(y+1)+'</span>\n <span class="aplayer-list-title">'+this.option.music[y].title+'</span>\n <span class="aplayer-list-author">'+this.option.music[y].author+"</span>\n </li>";d+="\n </ol>\n </div>",this.element.innerHTML=d,this.element.offsetWidth<300&&(this.element.getElementsByClassName("aplayer-icon-mode")[0].style.display="none"),this.ptime=this.element.getElementsByClassName("aplayer-ptime")[0],this.element.getElementsByClassName("aplayer-info")[0].offsetWidth<200&&this.element.getElementsByClassName("aplayer-time")[0].classList.add("aplayer-time-narrow");var m={};m.barWrap=this.element.getElementsByClassName("aplayer-bar-wrap")[0],this.button=this.element.getElementsByClassName("aplayer-button")[0],this.button.addEventListener("click",function(e){r.toggle()});var h=this.element.getElementsByClassName("aplayer-list")[0];h.addEventListener("click",function(e){var t=void 0;t="LI"===e.target.tagName.toUpperCase()?e.target:e.target.parentElement;var a=parseInt(t.getElementsByClassName("aplayer-list-index")[0].innerHTML)-1;a!==r.playIndex?(r.setMusic(a),r.play()):r.toggle()}),m.playedBar=this.element.getElementsByClassName("aplayer-played")[0],m.loadedBar=this.element.getElementsByClassName("aplayer-loaded")[0];var f=this.element.getElementsByClassName("aplayer-thumb")[0],g=void 0;m.barWrap.addEventListener("click",function(e){var t=e||window.event;g=m.barWrap.clientWidth;var n=(t.clientX-a(m.barWrap))/g;isNaN(r.audio.duration)?r.updateBar("played",0,"width"):(r.updateBar("played",n,"width"),r.element.getElementsByClassName("aplayer-ptime")[0].innerHTML=r.secondToTime(n*r.audio.duration),r.audio.currentTime=parseFloat(m.playedBar.style.width)/100*r.audio.duration)}),f.addEventListener("mouseover",function(){f.style.background=r.option.theme}),f.addEventListener("mouseout",function(){f.style.background="#fff"});var v=function(e){var t=e||window.event,n=(t.clientX-a(m.barWrap))/g;n=n>0?n:0,n=n<1?n:1,r.updateBar("played",n,"width"),r.element.getElementsByClassName("aplayer-ptime")[0].innerHTML=r.secondToTime(n*r.audio.duration)},b=function e(){document.removeEventListener("mouseup",e),document.removeEventListener("mousemove",v),isNaN(r.audio.duration)?r.updateBar("played",0,"width"):(r.audio.currentTime=parseFloat(m.playedBar.style.width)/100*r.audio.duration,r.playedTime=setInterval(function(){r.updateBar("played",r.audio.currentTime/r.audio.duration,"width"),r.element.getElementsByClassName("aplayer-ptime")[0].innerHTML=r.secondToTime(r.audio.currentTime),r.trigger("playing")},100))};f.addEventListener("mousedown",function(){g=m.barWrap.clientWidth,clearInterval(r.playedTime),document.addEventListener("mousemove",v),document.addEventListener("mouseup",b)}),m.volumeBar=this.element.getElementsByClassName("aplayer-volume")[0];var A=this.element.getElementsByClassName("aplayer-volume-bar")[0];this.volumeicon=this.element.getElementsByClassName("aplayer-time")[0].getElementsByTagName("button")[0];this.element.getElementsByClassName("aplayer-volume-bar-wrap")[0].addEventListener("click",function(e){var t=e||window.event,a=(35-t.clientY+n(A))/35;a=a>0?a:0,a=a<1?a:1,r.volume(a)}),this.volumeicon.addEventListener("click",function(){r.audio.muted?(r.audio.muted=!1,r.volumeicon.className=1===r.audio.volume?"aplayer-icon aplayer-icon-volume-up":"aplayer-icon aplayer-icon-volume-down",1===r.audio.volume?(r.volumeicon.className="aplayer-icon aplayer-icon-volume-up",r.volumeicon.innerHTML=r.getSVG("volume-up")):(r.volumeicon.className="aplayer-icon aplayer-icon-volume-down",r.volumeicon.innerHTML=r.getSVG("volume-down")),r.updateBar("volume",r.audio.volume,"height")):(r.audio.muted=!0,r.volumeicon.className="aplayer-icon aplayer-icon-volume-off",r.volumeicon.innerHTML=r.getSVG("volume-off"),r.updateBar("volume",0,"height"))});var x=this.element.getElementsByClassName("aplayer-icon-mode")[0];x.addEventListener("click",function(){r.multiple?"random"===r.mode?r.mode="single":"single"===r.mode?r.mode="order":"order"===r.mode?r.mode="circulation":"circulation"===r.mode&&(r.mode="random"):"circulation"===r.mode?r.mode="order":r.mode="circulation",x.innerHTML=r.getSVG(r.mode),r.audio.loop=!(r.multiple||"order"===r.mode)}),h.style.height=h.offsetHeight+"px",this.element.getElementsByClassName("aplayer-icon-menu")[0].addEventListener("click",function(){h.classList.contains("aplayer-list-hide")?h.classList.remove("aplayer-list-hide"):h.classList.add("aplayer-list-hide")}),"random"===this.mode?this.setMusic(this.randomOrder[0]):this.setMusic(0),l.push(this)}return r(e,[{key:"setMusic",value:function(e){var t=this;void 0!==e&&(this.playIndex=e);var a=this.playIndex;this.music=this.option.music[a],this.music.pic?this.element.getElementsByClassName("aplayer-pic")[0].style.backgroundImage="url('"+this.music.pic+"')":this.element.getElementsByClassName("aplayer-pic")[0].style.backgroundImage="",this.element.getElementsByClassName("aplayer-title")[0].innerHTML=this.music.title,this.element.getElementsByClassName("aplayer-author")[0].innerHTML=" - "+this.music.author,this.element.getElementsByClassName("aplayer-list-light")[0]&&this.element.getElementsByClassName("aplayer-list-light")[0].classList.remove("aplayer-list-light"),this.element.getElementsByClassName("aplayer-list")[0].getElementsByTagName("li")[a].classList.add("aplayer-list-light"),!this.isMobile&&this.audio&&(this.pause(),this.audio.currentTime=0),this.element.getElementsByClassName("aplayer-list")[0].scrollTop=33*a,this.isMobile&&this.audio?(this.audio.src=this.music.url,this.play()):!this.isMobile&&this.audios[a]?(this.audio=this.audios[a],this.audio.volume=parseInt(this.element.getElementsByClassName("aplayer-volume")[0].style.height)/100,this.audio.currentTime=0):(this.audio=document.createElement("audio"),this.audio.src=this.music.url,this.audio.preload=this.option.preload?this.option.preload:"auto",this.audio.addEventListener("play",function(){if(t.button.classList.contains("aplayer-play")){if(t.button.classList.remove("aplayer-play"),t.button.classList.add("aplayer-pause"),t.button.innerHTML="",setTimeout(function(){t.button.innerHTML='\n <button type="button" class="aplayer-icon aplayer-icon-pause">'+t.getSVG("pause")+" </button>"},100),t.option.mutex)for(var e=0;e<l.length;e++)t!=l[e]&&l[e].pause();t.playedTime&&clearInterval(t.playedTime),t.playedTime=setInterval(function(){t.updateBar("played",t.audio.currentTime/t.audio.duration,"width"),t.ptime.innerHTML=t.secondToTime(t.audio.currentTime),t.trigger("playing")},100),t.trigger("play")}}),this.audio.addEventListener("pause",function(){t.button&&(t.button.classList.contains("aplayer-pause")||t.ended)&&(t.ended=!1,t.button.classList.remove("aplayer-pause"),t.button.classList.add("aplayer-play"),t.button.innerHTML="",setTimeout(function(){t.button.innerHTML='\n <button type="button" class="aplayer-icon aplayer-icon-play">'+t.getSVG("play")+" </button>"},100),clearInterval(t.playedTime),t.trigger("pause"))}),this.audio.addEventListener("durationchange",function(){1!==t.audio.duration&&(t.element.getElementsByClassName("aplayer-dtime")[0].innerHTML=t.secondToTime(t.audio.duration))}),this.audio.addEventListener("progress",function(){var e=t.audio.buffered.length?t.audio.buffered.end(t.audio.buffered.length-1)/t.audio.duration:0;t.updateBar("loaded",e,"width")}),this.audio.addEventListener("error",function(){t.element.getElementsByClassName("aplayer-author")[0].innerHTML=" - Error happens ╥﹏╥",t.trigger("pause")}),this.audio.addEventListener("canplay",function(){t.trigger("canplay")}),this.ended=!1,this.audio.addEventListener("ended",function(){t.multiple?0!==t.audio.currentTime&&("random"===t.mode?t.setMusic(t.nextRandomNum()):"single"===t.mode?t.setMusic(t.playIndex):"order"===t.mode?t.playIndex<t.option.music.length-1?t.setMusic(++t.playIndex):(t.ended=!0,t.pause(),t.trigger("ended")):"circulation"===t.mode&&(t.playIndex<t.option.music.length-1?t.setMusic(++t.playIndex):t.setMusic(0))):"order"===t.mode&&(t.ended=!0,t.pause(),t.trigger("ended"))}),this.audio.volume=parseInt(this.element.getElementsByClassName("aplayer-volume")[0].style.height)/100,this.audio.loop=!(this.multiple||"order"===this.mode),this.audios[a]=this.audio),1!==this.audio.duration&&(this.element.getElementsByClassName("aplayer-dtime")[0].innerHTML=this.audio.duration?this.secondToTime(this.audio.duration):"00:00"),this.option.autoplay&&!this.isMobile&&this.play(),this.option.autoplay=!0}},{key:"play",value:function(e){"[object Number]"===Object.prototype.toString.call(e)&&(this.audio.currentTime=e),this.audio.paused&&this.audio.play()}},{key:"pause",value:function(){this.audio.paused||this.audio.pause()}},{key:"volume",value:function(e){this.updateBar("volume",e,"height"),this.audio.volume=e,this.audio.muted&&(this.audio.muted=!1),1===e?(this.volumeicon.className="aplayer-icon aplayer-icon-volume-up",this.volumeicon.innerHTML=this.getSVG("volume-up")):(this.volumeicon.className="aplayer-icon aplayer-icon-volume-down",this.volumeicon.innerHTML=this.getSVG("volume-down"))}},{key:"on",value:function(e,t){"function"==typeof t&&this.event[e].push(t)}},{key:"toggle",value:function(){this.button.classList.contains("aplayer-play")?this.play():this.button.classList.contains("aplayer-pause")&&this.pause()}},{key:"getRandomOrder",value:function(){function e(e,t){return null==t&&(t=e,e=0),e+Math.floor(Math.random()*(t-e+1))}this.multiple&&(this.randomOrder=function(t){for(var a,n=t.length,i=new Array(n),r=0;r<n;r++)a=e(0,r),a!==r&&(i[r]=i[a]),i[a]=t[r];return i}([].concat(n(Array(this.option.music.length))).map(function(e,t){return t})))}},{key:"nextRandomNum",value:function(){if(this.multiple){var e=this.randomOrder.indexOf(this.playIndex);return e===this.randomOrder.length-1?this.randomOrder[0]:this.randomOrder[e+1]}return 0}}]),e}();e.exports=o},function(e,t,a){t=e.exports=a(3)(void 0),t.push([e.i,".aplayer-withlist.aplayer .aplayer-info {\n border-bottom: 1px solid #e9e9e9; }\n\n.aplayer-withlist.aplayer .aplayer-list {\n display: block; }\n\n.aplayer-withlist.aplayer .aplayer-icon-menu {\n display: inline !important; }\n\n.aplayer {\n font-family: Arial, Helvetica, sans-serif;\n margin: 5px;\n -webkit-box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 1px 5px 0 rgba(0, 0, 0, 0.12);\n box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 1px 5px 0 rgba(0, 0, 0, 0.12);\n border-radius: 2px;\n overflow: hidden;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n line-height: initial; }\n .aplayer * {\n -webkit-box-sizing: content-box;\n box-sizing: content-box; }\n .aplayer .aplayer-icon {\n width: 15px;\n height: 15px;\n border: none;\n background-color: transparent;\n outline: none;\n cursor: pointer;\n opacity: .8;\n vertical-align: middle;\n padding: 0;\n font-size: 12px;\n margin: 0;\n display: inline; }\n .aplayer .aplayer-icon .aplayer-fill {\n -webkit-transition: all .2s ease-in-out;\n transition: all .2s ease-in-out; }\n .aplayer .aplayer-pic {\n position: relative;\n float: left;\n height: 66px;\n width: 66px;\n background-image: url("+a(6)+");\n background-size: cover;\n -webkit-transition: all 0.3s ease;\n transition: all 0.3s ease; }\n .aplayer .aplayer-pic .aplayer-button {\n position: absolute;\n border-radius: 50%;\n opacity: 0.8;\n cursor: pointer;\n text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);\n -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);\n box-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);\n background: rgba(0, 0, 0, 0.2);\n -webkit-transition: all 0.1s ease;\n transition: all 0.1s ease; }\n .aplayer .aplayer-pic .aplayer-button:hover {\n opacity: 1; }\n .aplayer .aplayer-pic .aplayer-button .aplayer-fill {\n fill: #fff; }\n .aplayer .aplayer-pic .aplayer-hide {\n display: none; }\n .aplayer .aplayer-pic .aplayer-play {\n width: 26px;\n height: 26px;\n border: 2px solid #fff;\n bottom: 50%;\n right: 50%;\n margin: 0 -15px -15px 0; }\n .aplayer .aplayer-pic .aplayer-play .aplayer-icon-play {\n position: absolute;\n top: 3px;\n left: 4px;\n height: 20px;\n width: 20px; }\n .aplayer .aplayer-pic .aplayer-pause {\n width: 16px;\n height: 16px;\n border: 2px solid #fff;\n bottom: 4px;\n right: 4px; }\n .aplayer .aplayer-pic .aplayer-pause .aplayer-icon-pause {\n position: absolute;\n top: 2px;\n left: 2px;\n height: 12px;\n width: 12px; }\n .aplayer .aplayer-info {\n margin-left: 66px;\n padding: 14px 7px 0 10px;\n height: 66px;\n -webkit-box-sizing: border-box;\n box-sizing: border-box; }\n .aplayer .aplayer-info .aplayer-music {\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n margin: 0 0 13px 5px;\n -webkit-user-select: text;\n -moz-user-select: text;\n -ms-user-select: text;\n user-select: text;\n cursor: default;\n padding-bottom: 2px; }\n .aplayer .aplayer-info .aplayer-music .aplayer-title {\n font-size: 14px; }\n .aplayer .aplayer-info .aplayer-music .aplayer-author {\n font-size: 12px;\n color: #666; }\n .aplayer .aplayer-info .aplayer-controller {\n position: relative;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex; }\n .aplayer .aplayer-info .aplayer-controller .aplayer-bar-wrap {\n margin: 0 0 0 5px;\n padding: 4px 0;\n cursor: pointer !important;\n -webkit-box-flex: 1;\n -ms-flex: 1;\n flex: 1; }\n .aplayer .aplayer-info .aplayer-controller .aplayer-bar-wrap .aplayer-bar {\n position: relative;\n height: 2px;\n width: 100%;\n background: #cdcdcd; }\n .aplayer .aplayer-info .aplayer-controller .aplayer-bar-wrap .aplayer-bar .aplayer-loaded {\n position: absolute;\n left: 0;\n top: 0;\n bottom: 0;\n background: #aaa;\n height: 2px;\n -webkit-transition: all 0.5s ease;\n transition: all 0.5s ease; }\n .aplayer .aplayer-info .aplayer-controller .aplayer-bar-wrap .aplayer-bar .aplayer-played {\n position: absolute;\n left: 0;\n top: 0;\n bottom: 0;\n height: 2px; }\n .aplayer .aplayer-info .aplayer-controller .aplayer-bar-wrap .aplayer-bar .aplayer-played .aplayer-thumb {\n position: absolute;\n top: 0;\n right: 5px;\n margin-top: -4px;\n margin-right: -10px;\n height: 8px;\n width: 8px;\n border-radius: 50%;\n background: #fff;\n cursor: pointer !important; }\n .aplayer .aplayer-info .aplayer-controller .aplayer-time {\n position: relative;\n right: 0;\n bottom: 3px;\n height: 17px;\n color: #999;\n font-size: 11px;\n padding-left: 7px; }\n .aplayer .aplayer-info .aplayer-controller .aplayer-time .aplayer-time-inner {\n vertical-align: middle; }\n .aplayer .aplayer-info .aplayer-controller .aplayer-time .aplayer-icon {\n cursor: pointer;\n -webkit-transition: all 0.2s ease;\n transition: all 0.2s ease; }\n .aplayer .aplayer-info .aplayer-controller .aplayer-time .aplayer-icon .aplayer-fill {\n fill: #666; }\n .aplayer .aplayer-info .aplayer-controller .aplayer-time .aplayer-icon.aplayer-icon-mode {\n margin-right: 4px; }\n .aplayer .aplayer-info .aplayer-controller .aplayer-time .aplayer-icon:hover .aplayer-fill {\n fill: #000; }\n .aplayer .aplayer-info .aplayer-controller .aplayer-time .aplayer-icon.aplayer-icon-menu {\n display: none; }\n .aplayer .aplayer-info .aplayer-controller .aplayer-time.aplayer-time-narrow .aplayer-icon-mode {\n display: none; }\n .aplayer .aplayer-info .aplayer-controller .aplayer-time.aplayer-time-narrow .aplayer-icon-menu {\n display: none; }\n .aplayer .aplayer-info .aplayer-controller .aplayer-volume-wrap {\n position: relative;\n display: inline-block;\n margin-left: 3px;\n cursor: pointer !important; }\n .aplayer .aplayer-info .aplayer-controller .aplayer-volume-wrap:hover .aplayer-volume-bar-wrap {\n display: block; }\n .aplayer .aplayer-info .aplayer-controller .aplayer-volume-wrap .aplayer-volume-bar-wrap {\n display: none;\n position: absolute;\n bottom: 15px;\n right: -3px;\n width: 25px;\n height: 40px;\n z-index: 99; }\n .aplayer .aplayer-info .aplayer-controller .aplayer-volume-wrap .aplayer-volume-bar-wrap .aplayer-volume-bar {\n position: absolute;\n bottom: 0;\n right: 10px;\n width: 5px;\n height: 35px;\n background: #aaa; }\n .aplayer .aplayer-info .aplayer-controller .aplayer-volume-wrap .aplayer-volume-bar-wrap .aplayer-volume-bar .aplayer-volume {\n position: absolute;\n bottom: 0;\n right: 0;\n width: 5px;\n -webkit-transition: all 0.1s ease;\n transition: all 0.1s ease; }\n .aplayer .aplayer-list {\n overflow: auto;\n -webkit-transition: all 0.5s ease;\n transition: all 0.5s ease;\n will-change: height;\n display: none; }\n .aplayer .aplayer-list.aplayer-list-hide {\n height: 0 !important; }\n .aplayer .aplayer-list::-webkit-scrollbar {\n width: 5px; }\n .aplayer .aplayer-list::-webkit-scrollbar-track {\n background-color: #f9f9f9; }\n .aplayer .aplayer-list::-webkit-scrollbar-thumb {\n border-radius: 3px;\n background-color: #eee; }\n .aplayer .aplayer-list::-webkit-scrollbar-thumb:hover {\n background-color: #ccc; }\n .aplayer .aplayer-list ol {\n list-style-type: none;\n margin: 0;\n padding: 0; }\n .aplayer .aplayer-list ol li {\n position: relative;\n height: 32px;\n line-height: 32px;\n padding: 0 10px;\n font-size: 12px;\n border-top: 1px solid #e9e9e9;\n cursor: pointer;\n -webkit-transition: all 0.2s ease;\n transition: all 0.2s ease;\n overflow: hidden; }\n .aplayer .aplayer-list ol li:first-child {\n border-top: none; }\n .aplayer .aplayer-list ol li:hover {\n background: #efefef; }\n .aplayer .aplayer-list ol li.aplayer-list-light {\n background: #e9e9e9; }\n .aplayer .aplayer-list ol li.aplayer-list-light .aplayer-list-cur {\n display: inline-block; }\n .aplayer .aplayer-list ol li .aplayer-list-cur {\n display: none;\n width: 3px;\n height: 22px;\n position: absolute;\n left: 0;\n top: 5px;\n cursor: pointer; }\n .aplayer .aplayer-list ol li .aplayer-list-index {\n color: #666;\n margin-right: 12px;\n cursor: pointer;\n width: 20px;\n float: left; }\n .aplayer .aplayer-list ol li .aplayer-list-author {\n color: #666;\n float: right;\n cursor: pointer; }\n\n@-webkit-keyframes aplayer-roll {\n 0% {\n left: 0; }\n 100% {\n left: -100%; } }\n\n@keyframes aplayer-roll {\n 0% {\n left: 0; }\n 100% {\n left: -100%; } }\n",""])},function(e,t){function a(e,t){var a=e[1]||"",i=e[3];if(!i)return a;if(t&&"function"==typeof btoa){var r=n(i);return[a].concat(i.sources.map(function(e){return"/*# sourceURL="+i.sourceRoot+e+" */"})).concat([r]).join("\n")}return[a].join("\n")}function n(e){return"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(e))))+" */"}e.exports=function(e){var t=[];return t.toString=function(){return this.map(function(t){var n=a(t,e);return t[2]?"@media "+t[2]+"{"+n+"}":n}).join("")},t.i=function(e,a){"string"==typeof e&&(e=[[null,e,""]]);for(var n={},i=0;i<this.length;i++){var r=this[i][0];"number"==typeof r&&(n[r]=!0)}for(i=0;i<e.length;i++){var l=e[i];"number"==typeof l[0]&&n[l[0]]||(a&&!l[2]?l[2]=a:a&&(l[2]="("+l[2]+") and ("+a+")"),t.push(l))}},t}},function(e,t,a){function n(e,t){for(var a=0;a<e.length;a++){var n=e[a],i=m[n.id];if(i){i.refs++;for(var r=0;r<i.parts.length;r++)i.parts[r](n.parts[r]);for(;r<n.parts.length;r++)i.parts.push(u(n.parts[r],t))}else{for(var l=[],r=0;r<n.parts.length;r++)l.push(u(n.parts[r],t));m[n.id]={id:n.id,refs:1,parts:l}}}}function i(e,t){for(var a=[],n={},i=0;i<e.length;i++){var r=e[i],l=t.base?r[0]+t.base:r[0],o=r[1],s=r[2],p=r[3],u={css:o,media:s,sourceMap:p};n[l]?n[l].parts.push(u):a.push(n[l]={id:l,parts:[u]})}return a}function r(e,t){var a=f(e.insertInto);if(!a)throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");var n=b[b.length-1];if("top"===e.insertAt)n?n.nextSibling?a.insertBefore(t,n.nextSibling):a.appendChild(t):a.insertBefore(t,a.firstChild),b.push(t);else{if("bottom"!==e.insertAt)throw new Error("Invalid value for parameter 'insertAt'. Must be 'top' or 'bottom'.");a.appendChild(t)}}function l(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e);var t=b.indexOf(e);t>=0&&b.splice(t,1)}function o(e){var t=document.createElement("style");return e.attrs.type="text/css",p(t,e.attrs),r(e,t),t}function s(e){var t=document.createElement("link");return e.attrs.type="text/css",e.attrs.rel="stylesheet",p(t,e.attrs),r(e,t),t}function p(e,t){Object.keys(t).forEach(function(a){e.setAttribute(a,t[a])})}function u(e,t){var a,n,i,r;if(t.transform&&e.css){if(!(r=t.transform(e.css)))return function(){};e.css=r}if(t.singleton){var p=v++;a=g||(g=o(t)),n=c.bind(null,a,p,!1),i=c.bind(null,a,p,!0)}else e.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(a=s(t),n=y.bind(null,a,t),i=function(){l(a),a.href&&URL.revokeObjectURL(a.href)}):(a=o(t),n=d.bind(null,a),i=function(){l(a)});return n(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;n(e=t)}else i()}}function c(e,t,a,n){var i=a?"":n.css;if(e.styleSheet)e.styleSheet.cssText=x(t,i);else{var r=document.createTextNode(i),l=e.childNodes;l[t]&&e.removeChild(l[t]),l.length?e.insertBefore(r,l[t]):e.appendChild(r)}}function d(e,t){var a=t.css,n=t.media;if(n&&e.setAttribute("media",n),e.styleSheet)e.styleSheet.cssText=a;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(a))}}function y(e,t,a){var n=a.css,i=a.sourceMap,r=void 0===t.convertToAbsoluteUrls&&i;(t.convertToAbsoluteUrls||r)&&(n=A(n)),i&&(n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(i))))+" */");var l=new Blob([n],{type:"text/css"}),o=e.href;e.href=URL.createObjectURL(l),o&&URL.revokeObjectURL(o)}var m={},h=function(e){var t;return function(){return void 0===t&&(t=e.apply(this,arguments)),t}}(function(){return window&&document&&document.all&&!window.atob}),f=function(e){var t={};return function(a){return void 0===t[a]&&(t[a]=e.call(this,a)),t[a]}}(function(e){return document.querySelector(e)}),g=null,v=0,b=[],A=a(5);e.exports=function(e,t){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");t=t||{},t.attrs="object"==typeof t.attrs?t.attrs:{},t.singleton||(t.singleton=h()),t.insertInto||(t.insertInto="head"),t.insertAt||(t.insertAt="bottom");var a=i(e,t);return n(a,t),function(e){for(var r=[],l=0;l<a.length;l++){var o=a[l],s=m[o.id];s.refs--,r.push(s)}if(e){n(i(e,t),t)}for(var l=0;l<r.length;l++){var s=r[l];if(0===s.refs){for(var p=0;p<s.parts.length;p++)s.parts[p]();delete m[s.id]}}}};var x=function(){var e=[];return function(t,a){return e[t]=a,e.filter(Boolean).join("\n")}}()},function(e,t){e.exports=function(e){var t="undefined"!=typeof window&&window.location;if(!t)throw new Error("fixUrls requires window.location");if(!e||"string"!=typeof e)return e;var a=t.protocol+"//"+t.host,n=a+t.pathname.replace(/\/[^\/]*$/,"/");return e.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,function(e,t){var i=t.trim().replace(/^"(.*)"$/,function(e,t){return t}).replace(/^'(.*)'$/,function(e,t){return t});if(/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/)/i.test(i))return e;var r;return r=0===i.indexOf("//")?i:0===i.indexOf("/")?a+i:n+i.replace(/^\.\//,""),"url("+JSON.stringify(r)+")"})}},function(e,t){e.exports="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAIBAQEBAQIBAQECAgICAgQDAgICAgUEBAMEBgUGBgYFBgYGBwkIBgcJBwYGCAsICQoKCgoKBggLDAsKDAkKCgr/2wBDAQICAgICAgUDAwUKBwYHCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgr/wgARCABCAEIDAREAAhEBAxEB/8QAHQABAQACAgMBAAAAAAAAAAAAAAgHCQEFAgQGCv/EABYBAQEBAAAAAAAAAAAAAAAAAAACAf/aAAwDAQACEAMQAAAA3cAAAAAHiQxj5wvLXdAAEfk64+HxV9LSOQARaaZIY0P0AWqw9wAEimr+WOTb9SsDsgADBBPpnkoAAAHQELmwY5AAAAAAAAAAP//EADEQAAAGAQMCAwcDBQAAAAAAAAECAwQFBgcACBEJEgoTIRQVICIwQVEkMWEyQnGDkf/aAAgBAQABPwD6Z1CJJmUUOAFIAmOYw8AUAARERH7AAByI63fdf/Zhtqqc1P4siLNmQ9elEI+be0CNVGCj11FOzylppRMWfm/hJMygmHW1bxGG13PlBkMoZRwBlXHFZjpgY51c3NXWnYBop5ZFOHT+PTN7GYAUARBRPgC8G7tY7yLj/LVKjck4su0VY69MtiuYidg36bpo8SH+9NVMRKYPsPryA+g8D8W/FCY3dbpaB0xWlhfxtLm6s9vec1ol4du5ka62ckaM4QqpPmSTfPTCCwlEDCigJdeJave27AnS/jdm9RdwFZlJexQy9IoEGzKgUkcwc8rrJoJF7UUSehe83Hef05MbXhJ87YkJgDJe2Ve9skruvdD2FOsrckWdxIsWjYzhMBDtWIVQglOUORJyAmDTLHUJ0+upRQ65gtmSFxjuaNOs7FRWXyR0Rb45j7wRlWKIfK19rbEWRXSTACGOQh+NFHkvw3fKNEwt15ajAWuxoou8y7bTwUCgJDib3hGTizsiX7cFBZA7jt/JkNeJIsk3P9XnIDCWk1F0IiArzGMSP+yDf3Ykt2F/2LKn/wAn10ULFN1jq0YCeQMkq2Uc5DbsXApH48xs4RWRWSN+SnIYQHXVBTsOJpfCW/ZCsvJ2t4Cvb6YyFERyJlXSUDIxika6lESFARUMyBQq5ifdLzNV2dhLRAsrNWZhtIxsizSdx0gyVA6LpuqQFE1UzB6GIchimAfuAh8PUZ2KTW4PcXts3Y0A8qNgw1lZgd+0hgRBVeCdu0fa1ROr+xW4pgqYvqJ0jrgGvE4dOrPcFunkt/NHpL+doFmgY9OzSUWgZYK6+ZoA1H2opeRSbqpkSORYfkA3eQ2vDydN/cVmzfBQt2EpjuYhcb47lgnT2aUYKIIy7tNI5WzNmJygLkTKHA5zk5IQhNdVCAdZtyVtz2HyTyabwWV8mPnOQmMVLOo9WRrMREruHjZQ6AkP5CqizYh+DhqmVOt0KpRdHp0I2jIiFjW7CJjWZO1Fo1RTKmkiQv2KQhSlAPwHw8BrqiRDGb6au4GOfsyrJmw1Yz+V+TEj1lCf8OQhtZLc2d9t42XdP7Dl8mKJD5fg2LWzT1TfnbSDSuRVaSkXbNk59TN1XJzpJeaX5ikE/GtuPTI2gbXMnhmvF9Rsrm1JRS8cymrhkGWnlWLZcSCuRuD9woVDzewneYgAJgLx8eVccwGX8XWXE1sA4xVqrr6GkvL/AKgbum6jdQQ/kCqCIfyGttG3Df8AyOa9s2N9xmD4yGgdrDOZQdZXaW5s6bXpJSGGIjwZsyfqG5zI9irgFwKBDJaIHaQC888B9DgOR+t//8QAGhEAAwEAAwAAAAAAAAAAAAAAAQIwABFBUP/aAAgBAgEBPwCnOBh1lisCuUeT/8QAFBEBAAAAAAAAAAAAAAAAAAAAYP/aAAgBAwEBPwAj/9k="}])});
//# sourceMappingURL=APlayer.min.js.map