{"version":3,"sources":["DPlayer.js"],"names":["_classCallCheck","instance","Constructor","TypeError","_typeof","Symbol","iterator","obj","constructor","_createClass","defineProperties","target","props","i","length","descriptor","enumerable","configurable","writable","Object","defineProperty","key","protoProps","staticProps","prototype","DPlayer","option","_this","this","svg","play","pause","volume-up","volume-down","volume-off","loop","full","setting","right","comment","comment-off","send","getSVG","type","isMobile","navigator","userAgent","match","autoplay","defaultOption","element","document","getElementsByClassName","theme","defaultKey","hasOwnProperty","secondToTime","second","add0","num","min","parseInt","sec","updateBar","percentage","direction","style","eventTypes","event","trigger","_i","value","_this2","danmaku","classList","add","innerHTML","video","pic","url","audio","bezel","addEventListener","remove","ptime","playButton","shouldpause","toggle","paused","getElementViewLeft","actualLeft","offsetLeft","current","offsetParent","elementScrollLeft","fullscreenElement","mozFullScreenElement","webkitFullscreenElement","body","scrollLeft","documentElement","playedBar","loadedBar","bar","barWidth","dan","time","currentTime","danIndex","lastPlayPos","currentPlayPos","bufferingDetected","setTime","playedTime","setInterval","duration","item","parseFloat","danmakuIn","text","color","e","window","clientWidth","clientX","width","thumbMove","thumbUp","removeEventListener","clearInterval","volumeBar","volumeEle","volumeBarWrapWrap","volumeBarWrap","volumeicon","vWidth","switchVolumeIcon","volume","volumeMove","muted","volumeUp","hideTime","hideController","clearTimeout","setTimeout","played","closeSetting","closeComment","danOpacity","settingHTML","original","speed","settingIcon","settingBox","mask","contains","settingEvent","openSetting","loopEle","loopToggle","checked","speedEle","speedItem","_loop","playbackRate","dataset","danmakuBar","danmakuBarWrapWrap","danmakuBarWrap","danmakuSettingBox","dWidth","danmakuMove","items","opacity","danmakuUp","buffered","end","ended","danContainer","itemHeight","danWidth","danHeight","itemY","danTunnel","top","bottom","danItemRight","ele","getBoundingClientRect","danSpeed","offsetWidth","getTunnel","tmp","_loop2","splice","v","j","danRight","push","_ret3","offsetHeight","createElement","appendChild","transform","removeChild","console","error","xhr","XMLHttpRequest","onreadystatechange","readyState","status","JSON","parse","responseText","sort","a","b","log","open","api","id","commentInput","commentIcon","commentBox","commentSettingIcon","commentSettingBox","commentSendIcon","htmlEncode","str","replace","sendComment","alert","danmakuData","token","player","author","querySelector","stringify","closeCommentSetting","toggleCommentSetting","disableHide","openComment","focus","sele","fill","keyCode","resetAnimation","cancelFullScreen","mozCancelFullScreen","webkitCancelFullScreen","requestFullscreen","mozRequestFullScreen","webkitRequestFullscreen","preventDefault","menu","left","clientY","name","func","module","exports"],"mappings":"AAAA,YAMA,SAASA,iBAAgBC,EAAUC,GAAe,KAAMD,YAAoBC,IAAgB,KAAM,IAAIC,WAAU,qCAJhH,GAAIC,SAA4B,kBAAXC,SAAoD,gBAApBA,QAAOC,SAAwB,SAAUC,GAAO,aAAcA,IAAS,SAAUA,GAAO,MAAOA,IAAyB,kBAAXF,SAAyBE,EAAIC,cAAgBH,OAAS,eAAkBE,IAEtOE,aAAe,WAAc,QAASC,GAAiBC,EAAQC,GAAS,IAAK,GAAIC,GAAI,EAAGA,EAAID,EAAME,OAAQD,IAAK,CAAE,GAAIE,GAAaH,EAAMC,EAAIE,GAAWC,WAAaD,EAAWC,aAAc,EAAOD,EAAWE,cAAe,EAAU,SAAWF,KAAYA,EAAWG,UAAW,GAAMC,OAAOC,eAAeT,EAAQI,EAAWM,IAAKN,IAAiB,MAAO,UAAUb,EAAaoB,EAAYC,GAAiJ,MAA9HD,IAAYZ,EAAiBR,EAAYsB,UAAWF,GAAiBC,GAAab,EAAiBR,EAAaqB,GAAqBrB,OAJhiB,WASI,GAPMuB,GAAA,WAOF,QAPEA,GAOUC,GASR,GAAIC,GAAQC,IAEZ5B,iBAAgB4B,KAlBlBH,GAQEG,KAAKC,KACDC,MAAS,YAAa,uJACtBC,OAAU,YAAa,4LACvBC,aAAc,YAAa,qsCAC3BC,eAAgB,YAAa,wfAC7BC,cAAe,YAAa,yMAC5BC,MAAS,YAAa,sbACtBC,MAAS,YAAa,irBACtBC,SAAY,YAAa,2zGACzBC,OAAU,YAAa,oFACvBC,SAAY,YAAa,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QwB,UAAUS,OAAO,mBAC9BvD,KAAKyC,QAAQ,aAnLjBhD,IAAK,KACLkD,MAAO,SAyLR2L,EAAMC,GACe,kBAATA,IACPvO,KAAKwC,MAAM8L,GAAM5D,KAAK6D,OApoC5B1O,IAyoCgB,oBAAX2O,SAAoD,mBAAnBA,QAAOC,QAC/CD,OAAOC,QAAU5O,EAGjBiG,OAAOjG,QAAUA","file":"DPlayer.min.js","sourcesContent":["(() => {\n\n class DPlayer {\n /**\n * DPlayer constructor function\n *\n * @param {Object} option - See README\n * @constructor\n */\n constructor(option) {\n this.svg = {\n 'play': ['0 0 16 32', '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'],\n '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'],\n 'volume-up': ['0 0 21 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'],\n 'volume-down': ['0 0 21 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'],\n 'volume-off': ['0 0 21 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'],\n 'loop': ['0 0 32 32', 'M1.882 16.941c0 4.152 3.221 7.529 7.177 7.529v1.882c-4.996 0-9.060-4.222-9.060-9.412s4.064-9.412 9.060-9.412h7.96l-3.098-3.098 1.331-1.331 5.372 5.37-5.37 5.372-1.333-1.333 3.1-3.098h-7.962c-3.957 0-7.177 3.377-7.177 7.529zM22.94 7.529v1.882c3.957 0 7.177 3.377 7.177 7.529s-3.221 7.529-7.177 7.529h-7.962l3.098-3.098-1.331-1.331-5.37 5.37 5.372 5.372 1.331-1.331-3.1-3.1h7.96c4.998 0 9.062-4.222 9.062-9.412s-4.064-9.412-9.060-9.412z'],\n 'full': ['0 0 32 33', 'M6.667 28h-5.333c-0.8 0-1.333-0.533-1.333-1.333v-5.333c0-0.8 0.533-1.333 1.333-1.333s1.333 0.533 1.333 1.333v4h4c0.8 0 1.333 0.533 1.333 1.333s-0.533 1.333-1.333 1.333zM30.667 28h-5.333c-0.8 0-1.333-0.533-1.333-1.333s0.533-1.333 1.333-1.333h4v-4c0-0.8 0.533-1.333 1.333-1.333s1.333 0.533 1.333 1.333v5.333c0 0.8-0.533 1.333-1.333 1.333zM30.667 12c-0.8 0-1.333-0.533-1.333-1.333v-4h-4c-0.8 0-1.333-0.533-1.333-1.333s0.533-1.333 1.333-1.333h5.333c0.8 0 1.333 0.533 1.333 1.333v5.333c0 0.8-0.533 1.333-1.333 1.333zM1.333 12c-0.8 0-1.333-0.533-1.333-1.333v-5.333c0-0.8 0.533-1.333 1.333-1.333h5.333c0.8 0 1.333 0.533 1.333 1.333s-0.533 1.333-1.333 1.333h-4v4c0 0.8-0.533 1.333-1.333 1.333z'],\n 'setting': ['0 0 32 28', 'M28.633 17.104c0.035 0.21 0.026 0.463-0.026 0.76s-0.14 0.598-0.262 0.904c-0.122 0.306-0.271 0.581-0.445 0.825s-0.367 0.419-0.576 0.524c-0.209 0.105-0.393 0.157-0.55 0.157s-0.332-0.035-0.524-0.105c-0.175-0.052-0.393-0.1-0.655-0.144s-0.528-0.052-0.799-0.026c-0.271 0.026-0.541 0.083-0.812 0.17s-0.502 0.236-0.694 0.445c-0.419 0.437-0.664 0.934-0.734 1.493s0.009 1.092 0.236 1.598c0.175 0.349 0.148 0.699-0.079 1.048-0.105 0.14-0.271 0.284-0.498 0.432s-0.476 0.284-0.747 0.406-0.555 0.218-0.851 0.288c-0.297 0.070-0.559 0.105-0.786 0.105-0.157 0-0.306-0.061-0.445-0.183s-0.236-0.253-0.288-0.393h-0.026c-0.192-0.541-0.52-1.009-0.982-1.402s-1-0.589-1.611-0.589c-0.594 0-1.131 0.197-1.611 0.589s-0.816 0.851-1.009 1.375c-0.087 0.21-0.218 0.362-0.393 0.458s-0.367 0.144-0.576 0.144c-0.244 0-0.52-0.044-0.825-0.131s-0.611-0.197-0.917-0.327c-0.306-0.131-0.581-0.284-0.825-0.458s-0.428-0.349-0.55-0.524c-0.087-0.122-0.135-0.266-0.144-0.432s0.057-0.397 0.197-0.694c0.192-0.402 0.266-0.86 0.223-1.375s-0.266-0.991-0.668-1.428c-0.244-0.262-0.541-0.432-0.891-0.511s-0.681-0.109-0.995-0.092c-0.367 0.017-0.742 0.087-1.127 0.21-0.244 0.070-0.489 0.052-0.734-0.052-0.192-0.070-0.371-0.231-0.537-0.485s-0.314-0.533-0.445-0.838c-0.131-0.306-0.231-0.62-0.301-0.943s-0.087-0.59-0.052-0.799c0.052-0.384 0.227-0.629 0.524-0.734 0.524-0.21 0.995-0.555 1.415-1.035s0.629-1.017 0.629-1.611c0-0.611-0.21-1.144-0.629-1.598s-0.891-0.786-1.415-0.996c-0.157-0.052-0.288-0.179-0.393-0.38s-0.157-0.406-0.157-0.616c0-0.227 0.035-0.48 0.105-0.76s0.162-0.55 0.275-0.812 0.244-0.502 0.393-0.72c0.148-0.218 0.31-0.38 0.485-0.485 0.14-0.087 0.275-0.122 0.406-0.105s0.275 0.052 0.432 0.105c0.524 0.21 1.070 0.275 1.637 0.197s1.070-0.327 1.506-0.747c0.21-0.209 0.362-0.467 0.458-0.773s0.157-0.607 0.183-0.904c0.026-0.297 0.026-0.568 0-0.812s-0.048-0.419-0.065-0.524c-0.035-0.105-0.066-0.227-0.092-0.367s-0.013-0.262 0.039-0.367c0.105-0.244 0.293-0.458 0.563-0.642s0.563-0.336 0.878-0.458c0.314-0.122 0.62-0.214 0.917-0.275s0.533-0.092 0.707-0.092c0.227 0 0.406 0.074 0.537 0.223s0.223 0.301 0.275 0.458c0.192 0.471 0.507 0.886 0.943 1.244s0.952 0.537 1.546 0.537c0.611 0 1.153-0.17 1.624-0.511s0.803-0.773 0.996-1.297c0.070-0.14 0.179-0.284 0.327-0.432s0.301-0.223 0.458-0.223c0.244 0 0.511 0.035 0.799 0.105s0.572 0.166 0.851 0.288c0.279 0.122 0.537 0.279 0.773 0.472s0.423 0.402 0.563 0.629c0.087 0.14 0.113 0.293 0.079 0.458s-0.070 0.284-0.105 0.354c-0.227 0.506-0.297 1.039-0.21 1.598s0.341 1.048 0.76 1.467c0.419 0.419 0.934 0.651 1.546 0.694s1.179-0.057 1.703-0.301c0.14-0.087 0.31-0.122 0.511-0.105s0.371 0.096 0.511 0.236c0.262 0.244 0.493 0.616 0.694 1.113s0.336 1 0.406 1.506c0.035 0.297-0.013 0.528-0.144 0.694s-0.266 0.275-0.406 0.327c-0.542 0.192-1.004 0.528-1.388 1.009s-0.576 1.026-0.576 1.637c0 0.594 0.162 1.113 0.485 1.559s0.747 0.764 1.27 0.956c0.122 0.070 0.227 0.14 0.314 0.21 0.192 0.157 0.323 0.358 0.393 0.602v0zM16.451 19.462c0.786 0 1.528-0.149 2.227-0.445s1.305-0.707 1.821-1.231c0.515-0.524 0.921-1.131 1.218-1.821s0.445-1.428 0.445-2.214c0-0.786-0.148-1.524-0.445-2.214s-0.703-1.292-1.218-1.808c-0.515-0.515-1.122-0.921-1.821-1.218s-1.441-0.445-2.227-0.445c-0.786 0-1.524 0.148-2.214 0.445s-1.292 0.703-1.808 1.218c-0.515 0.515-0.921 1.118-1.218 1.808s-0.445 1.428-0.445 2.214c0 0.786 0.149 1.524 0.445 2.214s0.703 1.297 1.218 1.821c0.515 0.524 1.118 0.934 1.808 1.231s1.428 0.445 2.214 0.445v0z'],\n 'right': ['0 0 32 32', 'M22 16l-10.105-10.6-1.895 1.987 8.211 8.613-8.211 8.612 1.895 1.988 8.211-8.613z'],\n 'comment': ['0 0 32 32', 'M27.128 0.38h-22.553c-2.336 0-4.229 1.825-4.229 4.076v16.273c0 2.251 1.893 4.076 4.229 4.076h4.229v-2.685h8.403l-8.784 8.072 1.566 1.44 7.429-6.827h9.71c2.335 0 4.229-1.825 4.229-4.076v-16.273c0-2.252-1.894-4.076-4.229-4.076zM28.538 19.403c0 1.5-1.262 2.717-2.819 2.717h-8.36l-0.076-0.070-0.076 0.070h-11.223c-1.557 0-2.819-1.217-2.819-2.717v-13.589c0-1.501 1.262-2.718 2.819-2.718h19.734c1.557 0 2.819-0.141 2.819 1.359v14.947zM9.206 10.557c-1.222 0-2.215 0.911-2.215 2.036s0.992 2.035 2.215 2.035c1.224 0 2.216-0.911 2.216-2.035s-0.992-2.036-2.216-2.036zM22.496 10.557c-1.224 0-2.215 0.911-2.215 2.036s0.991 2.035 2.215 2.035c1.224 0 2.215-0.911 2.215-2.035s-0.991-2.036-2.215-2.036zM15.852 10.557c-1.224 0-2.215 0.911-2.215 2.036s0.991 2.035 2.215 2.035c1.222 0 2.215-0.911 2.215-2.035s-0.992-2.036-2.215-2.036z'],\n 'comment-off': ['0 0 32 32', 'M27.090 0.131h-22.731c-2.354 0-4.262 1.839-4.262 4.109v16.401c0 2.269 1.908 4.109 4.262 4.109h4.262v-2.706h8.469l-8.853 8.135 1.579 1.451 7.487-6.88h9.787c2.353 0 4.262-1.84 4.262-4.109v-16.401c0-2.27-1.909-4.109-4.262-4.109v0zM28.511 19.304c0 1.512-1.272 2.738-2.841 2.738h-8.425l-0.076-0.070-0.076 0.070h-11.311c-1.569 0-2.841-1.226-2.841-2.738v-13.696c0-1.513 1.272-2.739 2.841-2.739h19.889c1.569 0 2.841-0.142 2.841 1.37v15.064z'],\n 'send': ['0 0 32 32', 'M13.725 30l3.9-5.325-3.9-1.125v6.45zM0 17.5l11.050 3.35 13.6-11.55-10.55 12.425 11.8 3.65 6.1-23.375-32 15.5z']\n };\n this.getSVG = (type) => {\n return `\n \n \n \n \n `;\n };\n \n this.isMobile = navigator.userAgent.match(/(iPad)|(iPhone)|(iPod)|(android)|(webOS)/i);\n // compatibility: some mobile browsers don't suppose autoplay\n if (this.isMobile) {\n option.autoplay = false;\n }\n \n // default options\n const defaultOption = {\n element: document.getElementsByClassName('dplayer')[0],\n autoplay: false,\n theme: '#b7daff',\n loop: false\n };\n for (let defaultKey in defaultOption) {\n if (defaultOption.hasOwnProperty(defaultKey) && !option.hasOwnProperty(defaultKey)) {\n option[defaultKey] = defaultOption[defaultKey];\n }\n }\n \n this.option = option;\n this.loop = option.loop;\n \n /**\n * Parse second to 00:00 format\n *\n * @param {Number} second\n * @return {String} 00:00 format\n */\n this.secondToTime = (second) => {\n const add0 = (num) => {\n return num < 10 ? '0' + num : '' + num;\n };\n const min = parseInt(second / 60);\n const sec = parseInt(second - min * 60);\n return add0(min) + ':' + add0(sec);\n };\n \n /**\n * Update progress bar, including loading progress bar and play progress bar\n *\n * @param {String} type - Point out which bar it is, should be played loaded or volume\n * @param {Number} percentage\n * @param {String} direction - Point out the direction of this bar, Should be height or width\n */\n this.updateBar = (type, percentage, direction) => {\n percentage = percentage > 0 ? percentage : 0;\n percentage = percentage < 1 ? percentage : 1;\n this[type + 'Bar'].style[direction] = percentage * 100 + '%';\n };\n \n // define DPlayer events\n this.eventTypes = ['play', 'pause', 'canplay', 'playing', 'ended', 'error'];\n this.event = {};\n for (let i = 0; i < this.eventTypes.length; i++) {\n this.event[this.eventTypes[i]] = [];\n }\n this.trigger = (type) => {\n for (let i = 0; i < this.event[type].length; i++) {\n this.event[type][i]();\n }\n }\n }\n \n /**\n * AutoLink initialization function\n */\n init() {\n this.element = this.option.element;\n if (!this.option.danmaku) {\n this.element.classList.add('dplayer-no-danmaku');\n }\n \n this.element.innerHTML = `\n
\n
\n \n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n
\n
\n
\n
\n \n
\n \n
\n
\n
\n \n
\n
\n
\n
\n 0:00 / 0:00\n
\n
\n
\n \n
\n \n
\n
\n \n \n \n
\n
\n \n \n \n \n \n \n \n \n
\n
\n \n \n
\n
\n
\n \n
\n
\n \n
\n
\n
\n
\n
\n \n
\n
\n
\n
\n
\n
关于作者
\n
关于 DPlayer 播放器
\n
\n `;\n \n // get this audio object\n this.audio = this.element.getElementsByClassName('dplayer-video')[0];\n\n this.bezel = this.element.getElementsByClassName('dplayer-bezel-icon')[0];\n this.bezel.addEventListener('animationend', () => {\n this.bezel.classList.remove('dplayer-bezel-transition');\n });\n\n this.ptime = this.element.getElementsByClassName('dplayer-ptime')[0];\n \n // play and pause button\n this.playButton = this.element.getElementsByClassName('dplayer-play-icon')[0];\n this.shouldpause = true;\n this.toggle = () => {\n if (this.audio.paused) {\n this.play();\n }\n else {\n this.pause();\n }\n };\n this.playButton.addEventListener('click', this.toggle);\n this.element.getElementsByClassName('dplayer-video-wrap')[0].addEventListener('click', this.toggle);\n this.element.getElementsByClassName('dplayer-controller-mask')[0].addEventListener('click', this.toggle);\n \n \n /**\n * control play progress\n */\n // get element's view position\n const getElementViewLeft = (element) => {\n let actualLeft = element.offsetLeft;\n let current = element.offsetParent;\n let elementScrollLeft;\n if (!document.fullscreenElement && !document.mozFullScreenElement && !document.webkitFullscreenElement) {\n while (current !== null) {\n actualLeft += current.offsetLeft;\n current = current.offsetParent;\n }\n }\n else {\n while (current !== null && current !== this.element) {\n actualLeft += current.offsetLeft;\n current = current.offsetParent;\n }\n }\n elementScrollLeft = document.body.scrollLeft + document.documentElement.scrollLeft;\n return actualLeft - elementScrollLeft;\n };\n \n const getElementViewTop = (element) => {\n let actualTop = element.offsetTop;\n let current = element.offsetParent;\n let elementScrollTop;\n if (!document.fullscreenElement && !document.mozFullScreenElement && !document.webkitFullscreenElement) {\n while (current !== null) {\n actualTop += current.offsetTop;\n current = current.offsetParent;\n }\n }\n else {\n while (current !== null && current !== this.element) {\n actualTop += current.offsetTop;\n current = current.offsetParent;\n }\n }\n elementScrollTop = document.body.scrollTop + document.documentElement.scrollTop;\n return actualTop - elementScrollTop;\n };\n \n this.playedBar = this.element.getElementsByClassName('dplayer-played')[0];\n this.loadedBar = this.element.getElementsByClassName('dplayer-loaded')[0];\n this.bar = this.element.getElementsByClassName('dplayer-bar-wrap')[0];\n let barWidth;\n\n if (this.option.danmaku) {\n this.audio.addEventListener('seeked', () => {\n for (let i = 0; i < this.dan.length; i++) {\n if (this.dan[i].time >= this.audio.currentTime) {\n this.danIndex = i;\n return;\n }\n this.danIndex = this.dan.length;\n }\n });\n }\n\n let lastPlayPos = 0;\n let currentPlayPos = 0;\n let bufferingDetected = false;\n this.setTime = () => {\n if (this.option.danmaku) {\n this.playedTime = setInterval(() => {\n // whether the video is buffering\n currentPlayPos = this.audio.currentTime;\n if (!bufferingDetected\n && currentPlayPos < (lastPlayPos + 0.01)\n && !this.audio.paused) {\n this.element.classList.add('dplayer-loading');\n bufferingDetected = true;\n }\n if (bufferingDetected\n && currentPlayPos > (lastPlayPos + 0.01)\n && !this.audio.paused) {\n this.element.classList.remove('dplayer-loading');\n bufferingDetected = false;\n }\n lastPlayPos = currentPlayPos;\n\n this.updateBar('played', this.audio.currentTime / this.audio.duration, 'width');\n this.ptime.innerHTML = this.secondToTime(this.audio.currentTime);\n this.trigger('playing');\n \n const item = this.dan[this.danIndex];\n if (item && this.audio.currentTime >= parseFloat(item.time)) {\n this.danmakuIn(item.text, item.color, item.type);\n this.danIndex++;\n }\n }, 100);\n }\n else {\n this.playedTime = setInterval(() => {\n // whether the video is buffering\n currentPlayPos = this.audio.currentTime;\n if (!bufferingDetected\n && currentPlayPos < (lastPlayPos + 0.01)\n && !this.audio.paused) {\n this.element.classList.add('dplayer-loading');\n bufferingDetected = true\n }\n if (bufferingDetected\n && currentPlayPos > (lastPlayPos + 0.01)\n && !this.audio.paused) {\n this.element.classList.remove('dplayer-loading');\n bufferingDetected = false\n }\n lastPlayPos = currentPlayPos;\n\n this.updateBar('played', this.audio.currentTime / this.audio.duration, 'width');\n this.ptime.innerHTML = this.secondToTime(this.audio.currentTime);\n this.trigger('playing');\n }, 100);\n }\n };\n \n this.bar.addEventListener('click', (event) => {\n const e = event || window.event;\n barWidth = this.bar.clientWidth;\n let percentage = (e.clientX - getElementViewLeft(this.bar)) / barWidth;\n percentage = percentage > 0 ? percentage : 0;\n percentage = percentage < 1 ? percentage : 1;\n this.updateBar('played', percentage, 'width');\n this.audio.currentTime = parseFloat(this.playedBar.style.width) / 100 * this.audio.duration;\n });\n \n const thumbMove = (event) => {\n const e = event || window.event;\n let percentage = (e.clientX - getElementViewLeft(this.bar)) / barWidth;\n percentage = percentage > 0 ? percentage : 0;\n percentage = percentage < 1 ? percentage : 1;\n this.updateBar('played', percentage, 'width');\n this.element.getElementsByClassName('dplayer-ptime')[0].innerHTML = this.secondToTime(percentage * this.audio.duration);\n };\n \n const thumbUp = () => {\n document.removeEventListener('mouseup', thumbUp);\n document.removeEventListener('mousemove', thumbMove);\n this.audio.currentTime = parseFloat(this.playedBar.style.width) / 100 * this.audio.duration;\n this.setTime();\n };\n \n this.bar.addEventListener('mousedown', () => {\n barWidth = this.bar.clientWidth;\n clearInterval(this.playedTime);\n document.addEventListener('mousemove', thumbMove);\n document.addEventListener('mouseup', thumbUp);\n });\n \n \n /**\n * control volume\n */\n this.volumeBar = this.element.getElementsByClassName('dplayer-volume-bar-inner')[0];\n const volumeEle = this.element.getElementsByClassName('dplayer-volume')[0];\n const volumeBarWrapWrap = this.element.getElementsByClassName('dplayer-volume-bar-wrap')[0];\n const volumeBarWrap = this.element.getElementsByClassName('dplayer-volume-bar')[0];\n const volumeicon = this.element.getElementsByClassName('dplayer-volume-icon')[0];\n const vWidth = 35;\n const switchVolumeIcon = () => {\n if (this.audio.volume >= 0.8) {\n volumeicon.innerHTML = this.getSVG('volume-up');\n }\n else if (this.audio.volume > 0) {\n volumeicon.innerHTML = this.getSVG('volume-down');\n }\n else {\n volumeicon.innerHTML = this.getSVG('volume-off');\n }\n };\n const volumeMove = (event) => {\n const e = event || window.event;\n let percentage = (e.clientX - getElementViewLeft(volumeBarWrap) - 5.5) / vWidth;\n percentage = percentage > 0 ? percentage : 0;\n percentage = percentage < 1 ? percentage : 1;\n this.updateBar('volume', percentage, 'width');\n this.audio.volume = percentage;\n if (this.audio.muted) {\n this.audio.muted = false;\n }\n switchVolumeIcon();\n };\n const volumeUp = () => {\n document.removeEventListener('mouseup', volumeUp);\n document.removeEventListener('mousemove', volumeMove);\n volumeEle.classList.remove('dplayer-volume-active');\n };\n \n volumeBarWrapWrap.addEventListener('click', (event) => {\n const e = event || window.event;\n let percentage = (e.clientX - getElementViewLeft(volumeBarWrap) - 5.5) / vWidth;\n percentage = percentage > 0 ? percentage : 0;\n percentage = percentage < 1 ? percentage : 1;\n this.updateBar('volume', percentage, 'width');\n this.audio.volume = percentage;\n if (this.audio.muted) {\n this.audio.muted = false;\n }\n switchVolumeIcon();\n });\n volumeBarWrapWrap.addEventListener('mousedown', () => {\n document.addEventListener('mousemove', volumeMove);\n document.addEventListener('mouseup', volumeUp);\n volumeEle.classList.add('dplayer-volume-active');\n });\n volumeicon.addEventListener('click', () => {\n if (this.audio.muted) {\n this.audio.muted = false;\n switchVolumeIcon();\n this.updateBar('volume', this.audio.volume, 'width');\n }\n else {\n this.audio.muted = true;\n volumeicon.innerHTML = this.getSVG('volume-off');\n this.updateBar('volume', 0, 'width');\n }\n });\n\n\n /**\n * auto hide controller\n */\n let hideTime = 0;\n const hideController = () => {\n this.element.classList.remove('dplayer-hide-controller');\n clearTimeout(hideTime);\n hideTime = setTimeout(() => {\n if (this.audio.played.length) {\n this.element.classList.add('dplayer-hide-controller');\n closeSetting();\n closeComment();\n }\n }, 2000);\n };\n this.element.addEventListener('mousemove', hideController);\n this.element.addEventListener('click', hideController);\n \n \n /***\n * setting\n */\n this.danOpacity = 0.7;\n const settingHTML = {\n 'original': `\n
\n 洗脑循环\n
\n \n \n
\n
\n
\n 速度\n
`\n + this.getSVG('right')\n + `
\n
\n
\n 弹幕透明度\n
\n
\n
\n \n
\n
\n
\n
`,\n 'speed': `\n
\n 0.5\n
\n
\n 0.75\n
\n
\n 正常\n
\n
\n 1.25\n
\n
\n 1.5\n
\n
\n 2\n
`\n };\n \n // toggle setting box\n const settingIcon = this.element.getElementsByClassName('dplayer-setting-icon')[0];\n const settingBox = this.element.getElementsByClassName('dplayer-setting-box')[0];\n const mask = this.element.getElementsByClassName('dplayer-mask')[0];\n settingBox.innerHTML = settingHTML.original;\n \n const closeSetting = () => {\n if (settingBox.classList.contains('dplayer-setting-box-open')) {\n settingBox.classList.remove('dplayer-setting-box-open');\n mask.classList.remove('dplayer-mask-show');\n setTimeout(() => {\n settingBox.classList.remove('dplayer-setting-box-narrow');\n settingBox.innerHTML = settingHTML.original;\n settingEvent();\n }, 300);\n }\n };\n const openSetting = () => {\n settingBox.classList.add('dplayer-setting-box-open');\n mask.classList.add('dplayer-mask-show');\n };\n \n mask.addEventListener('click', () => {\n closeSetting();\n });\n settingIcon.addEventListener('click', () => {\n openSetting();\n });\n \n const settingEvent = () => {\n // loop control\n const loopEle = this.element.getElementsByClassName('dplayer-setting-loop')[0];\n const loopToggle = loopEle.getElementsByClassName('dplayer-toggle-setting-input')[0];\n \n loopToggle.checked = this.loop;\n \n loopEle.addEventListener('click', () => {\n loopToggle.checked = !loopToggle.checked;\n if (loopToggle.checked) {\n this.loop = true;\n this.audio.loop = this.loop;\n }\n else {\n this.loop = false;\n this.audio.loop = this.loop;\n }\n closeSetting();\n });\n loopToggle.addEventListener('change', () => {\n if (loopToggle.checked) {\n this.loop = true;\n this.audio.loop = this.loop;\n }\n else {\n this.loop = false;\n this.audio.loop = this.loop;\n }\n closeSetting();\n });\n \n // speed control\n const speedEle = this.element.getElementsByClassName('dplayer-setting-speed')[0];\n speedEle.addEventListener('click', () => {\n settingBox.classList.add('dplayer-setting-box-narrow');\n settingBox.innerHTML = settingHTML.speed;\n \n const speedItem = settingBox.getElementsByClassName('dplayer-setting-speed-item');\n for (let i = 0; i < speedItem.length; i++) {\n speedItem[i].addEventListener('click', () => {\n this.audio.playbackRate = speedItem[i].dataset.speed;\n closeSetting();\n });\n }\n });\n\n if (this.option.danmaku) {\n // danmaku opacity\n this.danmakuBar = this.element.getElementsByClassName('dplayer-danmaku-bar-inner')[0];\n const danmakuBarWrapWrap = this.element.getElementsByClassName('dplayer-danmaku-bar-wrap')[0];\n const danmakuBarWrap = this.element.getElementsByClassName('dplayer-danmaku-bar')[0];\n const danmakuSettingBox = this.element.getElementsByClassName('dplayer-setting-danmaku')[0];\n const dWidth = 130;\n this.updateBar('danmaku', this.danOpacity, 'width');\n\n const danmakuMove = (event) => {\n const e = event || window.event;\n let percentage = (e.clientX - getElementViewLeft(danmakuBarWrap)) / dWidth;\n percentage = percentage > 0 ? percentage : 0;\n percentage = percentage < 1 ? percentage : 1;\n this.updateBar('danmaku', percentage, 'width');\n const items = this.element.getElementsByClassName('dplayer-danmaku-item');\n for (let i = 0; i < items.length; i++) {\n items[i].style.opacity = percentage;\n }\n this.danOpacity = percentage;\n };\n const danmakuUp = () => {\n document.removeEventListener('mouseup', danmakuUp);\n document.removeEventListener('mousemove', danmakuMove);\n danmakuSettingBox.classList.remove('dplayer-setting-danmaku-active');\n };\n\n danmakuBarWrapWrap.addEventListener('click', (event) => {\n const e = event || window.event;\n let percentage = (e.clientX - getElementViewLeft(danmakuBarWrap)) / dWidth;\n percentage = percentage > 0 ? percentage : 0;\n percentage = percentage < 1 ? percentage : 1;\n this.updateBar('danmaku', percentage, 'width');\n const items = this.element.getElementsByClassName('dplayer-danmaku-item');\n for (let i = 0; i < items.length; i++) {\n items[i].style.opacity = percentage;\n }\n this.danOpacity = percentage;\n });\n danmakuBarWrapWrap.addEventListener('mousedown', () => {\n document.addEventListener('mousemove', danmakuMove);\n document.addEventListener('mouseup', danmakuUp);\n danmakuSettingBox.classList.add('dplayer-setting-danmaku-active');\n });\n }\n };\n settingEvent();\n \n \n /**\n * audio events\n */\n // show audio time: the metadata has loaded or changed\n this.audio.addEventListener('durationchange', () => {\n if (this.audio.duration !== 1) { // compatibility: Android browsers will output 1 at first\n this.element.getElementsByClassName('dplayer-dtime')[0].innerHTML = this.secondToTime(this.audio.duration);\n }\n });\n \n // show audio loaded bar: to inform interested parties of progress downloading the media\n this.audio.addEventListener('progress', () => {\n const percentage = this.audio.buffered.length ? this.audio.buffered.end(this.audio.buffered.length - 1) / this.audio.duration : 0;\n this.updateBar('loaded', percentage, 'width');\n });\n \n // audio download error: an error occurs\n this.audio.addEventListener('error', () => {\n this.element.getElementsByClassName('dplayer-ptime')[0].innerHTML = `Error happens ╥﹏╥`;\n this.trigger('pause');\n });\n \n // audio can play: enough data is available that the media can be played\n this.audio.addEventListener('canplay', () => {\n this.trigger('canplay');\n });\n \n // music end\n this.ended = false;\n this.audio.addEventListener('ended', () => {\n this.updateBar('played', 1, 'width');\n if (!this.loop) {\n this.ended = true;\n this.pause();\n this.trigger('ended');\n }\n });\n \n // control volume\n this.audio.volume = parseInt(this.element.getElementsByClassName('dplayer-volume-bar-inner')[0].style.width) / 100;\n \n // loop\n this.audio.loop = this.loop;\n \n // set duration time\n if (this.audio.duration !== 1) { // compatibility: Android browsers will output 1 at first\n this.element.getElementsByClassName('dplayer-dtime')[0].innerHTML = this.audio.duration ? this.secondToTime(this.audio.duration) : '00:00';\n }\n\n\n /**\n * danmaku display\n */\n const danContainer = this.element.getElementsByClassName('dplayer-danmaku')[0];\n const itemHeight = 30;\n let danWidth;\n let danHeight;\n let itemY;\n let danTunnel = {\n right: {},\n top: {},\n bottom: {}\n };\n\n const danItemRight = (ele) => {\n return danContainer.getBoundingClientRect().right - ele.getBoundingClientRect().right;\n };\n\n const danSpeed = (ele) => {\n return (danWidth + ele.offsetWidth) / 5;\n };\n\n const getTunnel = (ele, type) => {\n const tmp = danWidth / danSpeed(ele);\n\n for (let i = 0; ; i++) {\n let item = danTunnel[type][i + ''];\n if (item && item.length) {\n for (let j = 0; j < item.length; j++) {\n const danRight = danItemRight(item[j]) - 10;\n if (danRight <= 640 - (tmp * danSpeed(item[j])) || danRight <= 0) {\n break;\n }\n if (j === item.length - 1) {\n danTunnel[type][i + ''].push(ele);\n ele.addEventListener('animationend', () => {\n danTunnel[type][i + ''].splice(0, 1);\n });\n return i % itemY;\n }\n }\n }\n else {\n danTunnel[type][i + ''] = [ele];\n ele.addEventListener('animationend', () => {\n danTunnel[type][i + ''].splice(0, 1);\n });\n return i % itemY;\n }\n }\n };\n\n this.danmakuIn = (text, color, type) => {\n danWidth = danContainer.offsetWidth;\n danHeight = danContainer.offsetHeight;\n itemY = danHeight / itemHeight;\n let item = document.createElement(`div`);\n item.classList.add(`dplayer-danmaku-item`);\n item.classList.add(`dplayer-danmaku-${type}`);\n item.innerHTML = text;\n item.style.opacity = this.danOpacity;\n\n // insert\n danContainer.appendChild(item);\n\n // adjust\n item.style.color = color;\n switch (type) {\n case 'right':\n item.style.top = itemHeight * getTunnel(item, type) + 'px';\n item.style.width = (item.offsetWidth + 1) + 'px';\n item.style.transform = `translateX(-${danWidth}px)`;\n item.addEventListener('animationend', () => {\n danContainer.removeChild(item);\n });\n break;\n case 'top':\n item.style.top = itemHeight * getTunnel(item, type) + 'px';\n item.addEventListener('animationend', () => {\n danContainer.removeChild(item);\n });\n break;\n case 'bottom':\n item.style.bottom = itemHeight * getTunnel(item, type) + 'px';\n item.addEventListener('animationend', () => {\n danContainer.removeChild(item);\n });\n break;\n default:\n console.error(`Can't handled danmaku type: ${type}`);\n }\n\n // move\n item.classList.add(`dplayer-danmaku-move`);\n };\n\n // danmaku\n if (this.option.danmaku) {\n this.danIndex = 0;\n const xhr = new XMLHttpRequest();\n xhr.onreadystatechange = () => {\n if (xhr.readyState === 4) {\n if (xhr.status >= 200 && xhr.status < 300 || xhr.status === 304) {\n this.dan = JSON.parse(xhr.responseText).danmaku.sort((a, b) => a.time - b.time);\n\n // autoplay\n if (this.option.autoplay && !this.isMobile) {\n this.play();\n }\n else if (this.isMobile) {\n this.pause();\n }\n }\n else {\n console.log('Request was unsuccessful: ' + xhr.status);\n }\n }\n };\n xhr.open('get', this.option.danmaku.api + '?id=' + this.option.danmaku.id, true);\n xhr.send(null);\n }\n else {\n // autoplay\n if (this.option.autoplay && !this.isMobile) {\n this.play();\n }\n else if (this.isMobile) {\n this.pause();\n }\n }\n\n\n /**\n * comment\n */\n const commentInput = this.element.getElementsByClassName('dplayer-comment-input')[0];\n const commentIcon = this.element.getElementsByClassName('dplayer-comment-icon')[0];\n const commentBox = this.element.getElementsByClassName('dplayer-comment-box')[0];\n const commentSettingIcon = this.element.getElementsByClassName('dplayer-comment-setting-icon')[0];\n const commentSettingBox = this.element.getElementsByClassName('dplayer-comment-setting-box')[0];\n const commentSendIcon = this.element.getElementsByClassName('dplayer-send-icon')[0];\n\n const htmlEncode = (str) => {\n return str.replace(/&/g, \"&\")\n .replace(//g, \">\")\n .replace(/\"/g, \""\")\n .replace(/'/g, \"'\")\n .replace(/\\//g, \"/\");\n };\n\n const sendComment = () => {\n // text can't be empty\n if (!commentInput.value.replace(/^\\s+|\\s+$/g, '')) {\n alert('要输入弹幕内容啊喂!');\n return;\n }\n\n const danmakuData = {\n token: this.option.danmaku.token,\n player: this.option.danmaku.id,\n author: 'DIYgod',\n time: this.audio.currentTime,\n text: commentInput.value,\n color: this.element.querySelector('input[name=\"dplayer-danmaku-color\"]:checked').value,\n type: this.element.querySelector('input[name=\"dplayer-danmaku-type\"]:checked').value\n };\n const xhr = new XMLHttpRequest();\n xhr.onreadystatechange = () => {\n if (xhr.readyState === 4) {\n if (xhr.status >= 200 && xhr.status < 300 || xhr.status === 304) {\n console.log('Post danmaku: ', JSON.parse(xhr.responseText));\n }\n else {\n console.log('Request was unsuccessful: ' + xhr.status);\n }\n }\n };\n xhr.open('post', this.option.danmaku.api, true);\n xhr.send(JSON.stringify(danmakuData));\n\n commentInput.value = '';\n closeComment();\n this.dan.splice(this.danIndex, 0, danmakuData);\n this.danIndex++;\n this.danmakuIn(htmlEncode(danmakuData.text), danmakuData.color, danmakuData.type);\n };\n\n const closeCommentSetting = () => {\n if (commentSettingBox.classList.contains('dplayer-comment-setting-open')) {\n commentSettingBox.classList.remove('dplayer-comment-setting-open');\n }\n };\n const toggleCommentSetting = () => {\n if (commentSettingBox.classList.contains('dplayer-comment-setting-open')) {\n commentSettingBox.classList.remove('dplayer-comment-setting-open');\n }\n else {\n commentSettingBox.classList.add('dplayer-comment-setting-open');\n }\n };\n\n let disableHide = 0;\n const closeComment = () => {\n if (commentBox.classList.contains('dplayer-comment-box-open')) {\n commentBox.classList.remove('dplayer-comment-box-open');\n mask.classList.remove('dplayer-mask-show');\n clearInterval(disableHide);\n this.element.classList.remove('dplayer-show-controller');\n closeCommentSetting();\n }\n };\n const openComment = () => {\n commentBox.classList.add('dplayer-comment-box-open');\n mask.classList.add('dplayer-mask-show');\n disableHide = setInterval(() => {\n clearTimeout(hideTime);\n }, 1000);\n this.element.classList.add('dplayer-show-controller');\n };\n\n mask.addEventListener('click', () => {\n closeComment();\n });\n commentIcon.addEventListener('click', () => {\n openComment();\n setTimeout(() => {\n commentInput.focus();\n }, 300);\n });\n commentSettingIcon.addEventListener('click', () => {\n toggleCommentSetting();\n });\n\n // comment setting box\n this.element.getElementsByClassName('dplayer-comment-setting-color')[0].addEventListener('click', () => {\n const sele = this.element.querySelector('input[name=\"dplayer-danmaku-color\"]:checked+span');\n if (sele) {\n commentSettingIcon.getElementsByClassName('dplayer-fill')[0].style.fill = this.element.querySelector('input[name=\"dplayer-danmaku-color\"]:checked').value;\n }\n });\n\n commentInput.addEventListener('click', () => {\n closeCommentSetting();\n });\n commentInput.addEventListener('keydown', (e) => {\n const event = e || window.event;\n if (event.keyCode === 13) {\n sendComment();\n }\n });\n\n commentSendIcon.addEventListener('click', sendComment);\n \n \n /**\n * full screen\n */\n const resetAnimation = () => {\n danWidth = danContainer.offsetWidth;\n const items = this.element.getElementsByClassName('dplayer-danmaku-item');\n for (let i = 0; i < items.length; i++) {\n items[i].style.transform = `translateX(-${danWidth}px)`;\n }\n };\n \n this.element.addEventListener('fullscreenchange', () => {\n resetAnimation();\n });\n this.element.addEventListener('mozfullscreenchange', () => {\n resetAnimation();\n });\n this.element.addEventListener('webkitfullscreenchange', () => {\n resetAnimation();\n });\n this.element.getElementsByClassName('dplayer-full-icon')[0].addEventListener('click', () => {\n if (!document.fullscreenElement && !document.mozFullScreenElement && !document.webkitFullscreenElement) {\n if (this.element.requestFullscreen) {\n this.element.requestFullscreen();\n }\n else if (this.element.mozRequestFullScreen) {\n this.element.mozRequestFullScreen();\n }\n else if (this.element.webkitRequestFullscreen) {\n this.element.webkitRequestFullscreen();\n }\n }\n else {\n if (document.cancelFullScreen) {\n document.cancelFullScreen();\n }\n else if (document.mozCancelFullScreen) {\n document.mozCancelFullScreen();\n }\n else if (document.webkitCancelFullScreen) {\n document.webkitCancelFullScreen();\n }\n }\n resetAnimation();\n });\n\n /**\n * hot key\n */\n document.addEventListener('keydown', (e) => {\n const event = e || window.event;\n let percentage;\n switch (event.keyCode) {\n case 32:\n event.preventDefault();\n this.toggle();\n break;\n case 37:\n event.preventDefault();\n this.audio.currentTime = this.audio.currentTime -5;\n break;\n case 39:\n event.preventDefault();\n this.audio.currentTime = this.audio.currentTime + 5;\n break;\n case 38:\n event.preventDefault();\n percentage = this.audio.volume + 0.1;\n percentage = percentage > 0 ? percentage : 0;\n percentage = percentage < 1 ? percentage : 1;\n this.updateBar('volume', percentage, 'width');\n this.audio.volume = percentage;\n if (this.audio.muted) {\n this.audio.muted = false;\n }\n switchVolumeIcon();\n break;\n case 40:\n event.preventDefault();\n percentage = this.audio.volume - 0.1;\n percentage = percentage > 0 ? percentage : 0;\n percentage = percentage < 1 ? percentage : 1;\n this.updateBar('volume', percentage, 'width');\n this.audio.volume = percentage;\n if (this.audio.muted) {\n this.audio.muted = false;\n }\n switchVolumeIcon();\n break;\n }\n });\n\n /**\n * right key\n */\n this.menu = this.element.getElementsByClassName('dplayer-menu')[0];\n this.element.addEventListener('contextmenu', (e) => {\n const event = e || window.event;\n event.preventDefault();\n this.menu.style.left = event.clientX - this.element.getBoundingClientRect().left + 'px';\n this.menu.style.top = event.clientY - this.element.getBoundingClientRect().top + 'px';\n this.menu.classList.add('dplayer-menu-show');\n\n mask.classList.add('dplayer-mask-show');\n mask.addEventListener('click', () => {\n mask.classList.remove('dplayer-mask-show');\n this.menu.classList.remove('dplayer-menu-show');\n });\n });\n }\n \n /**\n * Play music\n */\n play() {\n if (this.audio.paused) {\n this.shouldpause = false;\n\n this.bezel.innerHTML = this.getSVG('play');\n this.bezel.classList.add('dplayer-bezel-transition');\n\n this.playButton.innerHTML = this.getSVG('pause');\n\n this.audio.play();\n if (this.playedTime) {\n clearInterval(this.playedTime);\n }\n this.setTime();\n this.element.classList.add('dplayer-playing');\n this.trigger('play');\n }\n }\n \n /**\n * Pause music\n */\n pause() {\n if (!this.shouldpause || this.ended) {\n this.shouldpause = true;\n this.element.classList.remove('dplayer-loading');\n\n this.bezel.innerHTML = this.getSVG('pause');\n this.bezel.classList.add('dplayer-bezel-transition');\n\n this.ended = false;\n this.playButton.innerHTML = this.getSVG('play');\n this.audio.pause();\n clearInterval(this.playedTime);\n this.element.classList.remove('dplayer-playing');\n this.trigger('pause');\n }\n }\n \n /**\n * attach event\n */\n on(name, func) {\n if (typeof func === 'function') {\n this.event[name].push(func);\n }\n }\n }\n\n if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') {\n module.exports = DPlayer;\n }\n else {\n window.DPlayer = DPlayer;\n }\n})();"],"sourceRoot":"/source/"}