Comparing version 0.0.6 to 0.0.7
@@ -1,2 +0,2 @@ | ||
window.DanmuJs=function(t){var e={};function n(o){if(e[o])return e[o].exports;var i=e[o]={i:o,l:!1,exports:{}};return t[o].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(o,i,function(e){return t[e]}.bind(null,i));return o},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=2)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o={createDom:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"div",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",i=document.createElement(t);return i.className=o,i.innerHTML=e,Object.keys(n).forEach(function(e){var o=e,r=n[e];"video"===t||"audio"===t?r&&i.setAttribute(o,r):i.setAttribute(o,r)}),i},hasClass:function(t,e){return t.classList?Array.prototype.some.call(t.classList,function(t){return t===e}):!!t.className.match(new RegExp("(\\s|^)"+e+"(\\s|$)"))},addClass:function(t,e){t.classList?e.replace(/(^\s+|\s+$)/g,"").split(/\s+/g).forEach(function(e){e&&t.classList.add(e)}):o.hasClass(t,e)||(t.className+=" "+e)},removeClass:function(t,e){t.classList?e.split(/\s+/g).forEach(function(e){t.classList.remove(e)}):o.hasClass(t,e)&&e.split(/\s+/g).forEach(function(e){var n=new RegExp("(\\s|^)"+e+"(\\s|$)");t.className=t.className.replace(n," ")})},toggleClass:function(t,e){e.split(/\s+/g).forEach(function(e){o.hasClass(t,e)?o.removeClass(t,e):o.addClass(t,e)})},findDom:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,e=arguments[1],n=void 0;try{n=t.querySelector(e)}catch(o){e.startsWith("#")&&(n=t.getElementById(e.slice(1)))}return n},deepCopy:function(t,e){if("Object"===o.typeOf(e)&&"Object"===o.typeOf(t))return Object.keys(e).forEach(function(n){"Object"!==o.typeOf(e[n])||e[n]instanceof Node?"Array"===o.typeOf(e[n])?t[n]="Array"===o.typeOf(t[n])?t[n].concat(e[n]):e[n]:t[n]=e[n]:t[n]?o.deepCopy(t[n],e[n]):t[n]=e[n]}),t},typeOf:function(t){return Object.prototype.toString.call(t).match(/([^\s.*]+)(?=]$)/g)[0]},copyDom:function(t){if(t&&1===t.nodeType){var e=document.createElement(t.tagName);return Array.prototype.forEach.call(t.attributes,function(t){e.setAttribute(t.name,t.value)}),t.innerHTML&&(e.innerHTML=t.innerHTML),e}return""},formatTime:function(t){var e=Math.floor(t);return 1e3*e+(t-e)}};e.default=o,t.exports=e.default},function(t,e,n){"use strict";var o=n(13)();t.exports=function(t){return t!==o&&null!==t}},function(t,e,n){t.exports=n(3)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o,i=n(4),r=(o=i)&&o.__esModule?o:{default:o};n(25),e.default=r.default,t.exports=e.default},function(t,n,o){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,n,o){return n&&t(e.prototype,n),o&&t(e,o),e}}(),r=u(o(5)),a=u(o(21)),s=u(o(0));function u(t){return t&&t.__esModule?t:{default:t}}var c=function(){function t(n){var o=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.config=s.default.deepCopy({overlap:!1,area:{start:0,end:1},comments:[]},n),this.hideArr=[],(0,r.default)(this);var i=this;if(this.config.comments.forEach(function(t){t.duration=t.duration<5e3?5e3:t.duration,t.mode||(t.mode="scroll")}),!this.config.container||1!==this.config.container.nodeType)return this.emit("error","container id can't be empty"),!1;if(this.container=this.config.container,this.config.containerStyle){var u=this.config.containerStyle;Object.keys(u).forEach(function(t){i.container.style[t]=u[t]})}this.player=this.config.player,s.default.addClass(this.container,"danmu"),this.bulletBtn=new a.default(this),["touchend","click","dblclick"].forEach(function(t){o.container.addEventListener(t,function(){if(e.preventDefault(),e.stopPropagation(),i.player){var n=void 0;document.createEvent?(n=document.createEvent("Event")).initEvent(t,!0,!0):n=new Event(t),i.player.dispatchEvent(n)}},!1)}),this.emit("ready")}return i(t,[{key:"start",value:function(){this.bulletBtn.main.start()}},{key:"pause",value:function(){this.bulletBtn.main.pause()}},{key:"play",value:function(){this.bulletBtn.main.play()}},{key:"stop",value:function(){this.bulletBtn.main.stop()}},{key:"sendComment",value:function(t){t&&t.id&&t.duration&&(t.el||t.txt)&&(t.duration=t.duration<5e3?5e3:t.duration,this.bulletBtn.main.data.push(t))}},{key:"setCommentID",value:function(t,e){var n=this.container.getBoundingClientRect();t&&e&&(this.bulletBtn.main.data.some(function(n){return n.id===t&&(n.id=e,!0)}),this.bulletBtn.main.queue.some(function(o){return o.id===t&&(o.id=e,o.pauseMove(n),o.startMove(n),!0)}))}},{key:"setCommentDuration",value:function(t,e){var n=this.container.getBoundingClientRect();t&&e&&(e=e<5e3?5e3:e,this.bulletBtn.main.data.some(function(n){return n.id===t&&(n.duration=e,!0)}),this.bulletBtn.main.queue.some(function(o){return o.id===t&&(o.duration=e,o.pauseMove(n),o.startMove(n),!0)}))}},{key:"setAllDuration",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"scroll",e=arguments[1],n=this.container.getBoundingClientRect();e&&(e=e<5e3?5e3:e,this.bulletBtn.main.data.forEach(function(n){t===n.mode&&(n.duration=e)}),this.bulletBtn.main.queue.forEach(function(o){t===o.mode&&(o.duration=e,o.pauseMove(n),o.startMove(n))}))}},{key:"hide",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"scroll";this.hideArr.indexOf(t)<0&&this.hideArr.push(t),this.bulletBtn.main.queue.filter(function(e){return t===e.mode||"color"===t&&e.color}).forEach(function(t){return t.remove()})}},{key:"show",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"scroll",e=this.hideArr.indexOf(t);e>-1&&this.hideArr.splice(e,1)}}]),t}();n.default=c,t.exports=n.default},function(t,e,n){"use strict";var o,i,r,a,s,u,c,l=n(6),f=n(20),h=Function.prototype.apply,d=Function.prototype.call,p=Object.create,m=Object.defineProperty,v=Object.defineProperties,g=Object.prototype.hasOwnProperty,b={configurable:!0,enumerable:!1,writable:!0};i=function(t,e){var n,i;return f(e),i=this,o.call(this,t,n=function(){r.call(i,t,n),h.call(e,this,arguments)}),n.__eeOnceListener__=e,this},s={on:o=function(t,e){var n;return f(e),g.call(this,"__ee__")?n=this.__ee__:(n=b.value=p(null),m(this,"__ee__",b),b.value=null),n[t]?"object"==typeof n[t]?n[t].push(e):n[t]=[n[t],e]:n[t]=e,this},once:i,off:r=function(t,e){var n,o,i,r;if(f(e),!g.call(this,"__ee__"))return this;if(!(n=this.__ee__)[t])return this;if("object"==typeof(o=n[t]))for(r=0;i=o[r];++r)i!==e&&i.__eeOnceListener__!==e||(2===o.length?n[t]=o[r?0:1]:o.splice(r,1));else o!==e&&o.__eeOnceListener__!==e||delete n[t];return this},emit:a=function(t){var e,n,o,i,r;if(g.call(this,"__ee__")&&(i=this.__ee__[t]))if("object"==typeof i){for(n=arguments.length,r=new Array(n-1),e=1;e<n;++e)r[e-1]=arguments[e];for(i=i.slice(),e=0;o=i[e];++e)h.call(o,this,r)}else switch(arguments.length){case 1:d.call(i,this);break;case 2:d.call(i,this,arguments[1]);break;case 3:d.call(i,this,arguments[1],arguments[2]);break;default:for(n=arguments.length,r=new Array(n-1),e=1;e<n;++e)r[e-1]=arguments[e];h.call(i,this,r)}}},u={on:l(o),once:l(i),off:l(r),emit:l(a)},c=v({},u),t.exports=e=function(t){return null==t?p(c):v(Object(t),u)},e.methods=s},function(t,e,n){"use strict";var o=n(7),i=n(15),r=n(16),a=n(17);(t.exports=function(t,e){var n,r,s,u,c;return arguments.length<2||"string"!=typeof t?(u=e,e=t,t=null):u=arguments[2],null==t?(n=s=!0,r=!1):(n=a.call(t,"c"),r=a.call(t,"e"),s=a.call(t,"w")),c={value:e,configurable:n,enumerable:r,writable:s},u?o(i(u),c):c}).gs=function(t,e,n){var s,u,c,l;return"string"!=typeof t?(c=n,n=e,e=t,t=null):c=arguments[3],null==e?e=void 0:r(e)?null==n?n=void 0:r(n)||(c=n,n=void 0):(c=e,e=n=void 0),null==t?(s=!0,u=!1):(s=a.call(t,"c"),u=a.call(t,"e")),l={get:e,set:n,configurable:s,enumerable:u},c?o(i(c),l):l}},function(t,e,n){"use strict";t.exports=n(8)()?Object.assign:n(9)},function(t,e,n){"use strict";t.exports=function(){var t,e=Object.assign;return"function"==typeof e&&(e(t={foo:"raz"},{bar:"dwa"},{trzy:"trzy"}),t.foo+t.bar+t.trzy==="razdwatrzy")}},function(t,e,n){"use strict";var o=n(10),i=n(14),r=Math.max;t.exports=function(t,e){var n,a,s,u=r(arguments.length,2);for(t=Object(i(t)),s=function(o){try{t[o]=e[o]}catch(t){n||(n=t)}},a=1;a<u;++a)e=arguments[a],o(e).forEach(s);if(void 0!==n)throw n;return t}},function(t,e,n){"use strict";t.exports=n(11)()?Object.keys:n(12)},function(t,e,n){"use strict";t.exports=function(){try{return Object.keys("primitive"),!0}catch(t){return!1}}},function(t,e,n){"use strict";var o=n(1),i=Object.keys;t.exports=function(t){return i(o(t)?Object(t):t)}},function(t,e,n){"use strict";t.exports=function(){}},function(t,e,n){"use strict";var o=n(1);t.exports=function(t){if(!o(t))throw new TypeError("Cannot use null or undefined");return t}},function(t,e,n){"use strict";var o=n(1),i=Array.prototype.forEach,r=Object.create;t.exports=function(t){var e=r(null);return i.call(arguments,function(t){o(t)&&function(t,e){var n;for(n in t)e[n]=t[n]}(Object(t),e)}),e}},function(t,e,n){"use strict";t.exports=function(t){return"function"==typeof t}},function(t,e,n){"use strict";t.exports=n(18)()?String.prototype.contains:n(19)},function(t,e,n){"use strict";var o="razdwatrzy";t.exports=function(){return"function"==typeof o.contains&&(!0===o.contains("dwa")&&!1===o.contains("foo"))}},function(t,e,n){"use strict";var o=String.prototype.indexOf;t.exports=function(t){return o.call(this,t,arguments[1])>-1}},function(t,e,n){"use strict";t.exports=function(t){if("function"!=typeof t)throw new TypeError(t+" is not a function");return t}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=function(){function t(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,n,o){return n&&t(e.prototype,n),o&&t(e,o),e}}(),i=a(n(0)),r=a(n(22));function a(t){return t&&t.__esModule?t:{default:t}}var s=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.danmu=e,this.main=new r.default(e),e.config.defaultOff||this.main.start()}return o(t,[{key:"createSwitch",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.switchBtn=i.default.createDom("dk-switch",'<span class="txt">弹</span>',{},"danmu-switch "+(t?"danmu-switch-active":"")),this.switchBtn}}]),t}();e.default=s,t.exports=e.default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=function(){function t(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,n,o){return n&&t(e.prototype,n),o&&t(e,o),e}}(),i=s(n(23)),r=s(n(24)),a=s(n(0));function s(t){return t&&t.__esModule?t:{default:t}}var u=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.danmu=e,this.container=e.container,this.channel=new i.default(e),this.data=[].concat(e.config.comments),this.queue=[],this.timer=null,this.retryTimer=null,this.interval=2e3,this.status="idle",e.on("bullet_remove",this.updateQueue.bind(this))}return o(t,[{key:"updateQueue",value:function(t){var e=this;e.queue.some(function(n,o){return n.id===t.bullet.id&&(e.queue.splice(o,1),!0)})}},{key:"init",value:function(t,e){e||(e=this),e.data.sort(function(t,e){return t.start-e.start}),e.retryTimer||(e.retryTimer=setInterval(function(){e.readData(),e.dataHandle()},e.interval-1e3))}},{key:"start",value:function(){this.status="playing",this.queue=[],this.container.innerHTML="",this.channel.resetWithCb(this.init,this)}},{key:"stop",value:function(){this.status="closed",clearInterval(this.retryTimer),this.retryTimer=null,this.channel.reset(),this.queue=[],this.container.innerHTML=""}},{key:"play",value:function(){this.status="playing";var t=this.channel.channels,e=this.danmu.container.getBoundingClientRect();t&&t.length>0&&["scroll","top","bottom"].forEach(function(n){for(var o=0;o<t.length;o++)t[o].queue[n].forEach(function(t){t.resized||(t.startMove(e),t.resized=!0)});for(var i=0;i<t.length;i++)t[i].queue[n].forEach(function(t){t.resized=!1})})}},{key:"pause",value:function(){this.status="paused";var t=this.channel.channels,e=this.danmu.container.getBoundingClientRect();t&&t.length>0&&["scroll","top","bottom"].forEach(function(n){for(var o=0;o<t.length;o++)t[o].queue[n].forEach(function(t){t.pauseMove(e)})})}},{key:"dataHandle",value:function(){var t=this;"paused"!==this.status&&"closed"!==this.status&&t.queue.length&&t.queue.forEach(function(e){"waiting"!==e.status&&"paused"!==e.status||e.startMove(t.channel.containerPos)})}},{key:"readData",value:function(){var t=this,e=this.danmu,n=0;e.player&&e.player.currentTime&&(n=a.default.formatTime(e.player.currentTime));var o=void 0,i=t.interval,s=t.channel,u=void 0;(u=e.player?t.data.filter(function(e){return!e.start&&t.danmu.hideArr.indexOf(e.mode)<0&&(!e.color||t.danmu.hideArr.indexOf("color")<0)&&(e.start=n),t.danmu.hideArr.indexOf(e.mode)<0&&(!e.color||t.danmu.hideArr.indexOf("color")<0)&&e.start-i<=n&&n<=e.start+i}):t.data.filter(function(e){return t.danmu.hideArr.indexOf(e.mode)<0&&(!e.color||t.danmu.hideArr.indexOf("color")<0)})).length>0&&u.forEach(function(n){(o=new r.default(e,n)).attach(),s.addBullet(o).result?(t.queue.push(o),o.topInit()):o.detach()})}}]),t}();e.default=u,t.exports=e.default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=function(){function t(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,n,o){return n&&t(e.prototype,n),o&&t(e,o),e}}();var i=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.danmu=e,this.reset();var n=this;this.danmu.on("bullet_remove",function(t){n.removeBullet(t.bullet)}),this.containerPos=this.danmu.container.getBoundingClientRect(),this.containerWidth=this.containerPos.width,this.containerHeight=this.containerPos.height,this.containerLeft=this.containerPos.left,this.containerRight=this.containerPos.right,this.danmu.bulletResizeTimer=setInterval(function(){n.containerPos=n.danmu.container.getBoundingClientRect(),(Math.abs(n.containerPos.width-n.containerWidth)>=2||Math.abs(n.containerPos.height-n.containerHeight)>=2||Math.abs(n.containerPos.left-n.containerLeft)>=2||Math.abs(n.containerPos.right-n.containerRight)>=2)&&(n.containerWidth=n.containerPos.width,n.containerHeight=n.containerPos.height,n.containerLeft=n.containerPos.left,n.containerRight=n.containerPos.right,n.resize(!0))},50)}return o(t,[{key:"resize",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=this.danmu.container,n=this;setTimeout(function(){n.danmu.bulletBtn.main.data&&n.danmu.bulletBtn.main.data.forEach(function(t){t.bookChannelId&&delete t.bookChannelId});var o=e.getBoundingClientRect();n.width=o.width,n.height=o.height,n.danmu.config.area&&n.danmu.config.area.start>=0&&n.danmu.config.area.end>=n.danmu.config.area.start&&(n.height=n.height*(n.danmu.config.area.end-n.danmu.config.area.start)),n.container=e;for(var i=/mobile/gi.test(navigator.userAgent)?10:12,r=Math.floor(n.height/i),a=[],s=0;s<r;s++)a[s]={id:s,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}};if(n.channels&&n.channels.length<=a.length){for(var u=function(e){a[e]={id:e,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}},["scroll","top"].forEach(function(o){n.channels[e].queue[o].forEach(function(i){i.el&&(a[e].queue[o].push(i),i.resized||(i.pauseMove(n.containerPos,t),i.startMove(n.containerPos),i.resized=!0))})}),n.channels[e].queue.bottom.forEach(function(o){if(o.el){if(a[e+a.length-n.channels.length].queue.bottom.push(o),o.channel_id[0]+o.channel_id[1]-1===e){var r=[].concat(o.channel_id);o.channel_id=[r[0]-n.channels.length+a.length,r[1]],o.top=o.channel_id[0]*i,n.danmu.config.area&&n.danmu.config.area.start&&(o.top+=n.containerHeight*n.danmu.config.area.start),o.topInit()}o.resized||(o.pauseMove(n.containerPos,t),o.startMove(n.containerPos),o.resized=!0)}})},c=0;c<n.channels.length;c++)u(c);for(var l=function(t){["scroll","top","bottom"].forEach(function(e){a[t].queue[e].forEach(function(t){t.resized=!1})})},f=0;f<a.length;f++)l(f);n.channels=a,n.channelHeight=i}else if(n.channels&&n.channels.length>a.length){for(var h=function(e){a[e]={id:e,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}},["scroll","top","bottom"].forEach(function(o){if("top"===o&&e>Math.floor(a.length/2));else if("bottom"===o&&e<=Math.floor(a.length/2));else{var r="bottom"===o?e-a.length+n.channels.length:e;n.channels[r].queue[o].forEach(function(s,u){if(s.el){if(a[e].queue[o].push(s),"bottom"===o&&s.channel_id[0]+s.channel_id[1]-1===r){var c=[].concat(s.channel_id);s.channel_id=[c[0]-n.channels.length+a.length,c[1]],s.top=s.channel_id[0]*i,n.danmu.config.area&&n.danmu.config.area.start&&(s.top+=n.containerHeight*n.danmu.config.area.start),s.topInit()}s.resized||(s.pauseMove(n.containerPos,t),s.startMove(n.containerPos),s.resized=!0)}n.channels[r].queue[o].splice(u,1)})}})},d=0;d<a.length;d++)h(d);for(var p=function(t){["scroll","top","bottom"].forEach(function(e){n.channels[t].queue[e].forEach(function(t){t.pauseMove(n.containerPos),t.remove()})})},m=a.length;m<n.channels.length;m++)p(m);for(var v=function(t){["scroll","top","bottom"].forEach(function(e){a[t].queue[e].forEach(function(t){t.resized=!1})})},g=0;g<a.length;g++)v(g);n.channels=a,n.channelHeight=i}},10)}},{key:"addBullet",value:function(t){var e=this.danmu,n=this.channels,o=this.channelHeight,i=Math.ceil(t.height/o);if(i>n.length)return{result:!1,message:"exceed channels.length, occupy="+i+",channelsSize="+n.length};for(var r=!0,a=void 0,s=-1,u=0,c=n.length;u<c;u++)if(n[u].queue[t.mode].some(function(e){return e.id===t.id}))return{result:!1,message:"exsited, channelOrder="+u+",danmu_id="+t.id};if("scroll"===t.mode)for(var l=0,f=n.length-i;l<=f;l++){r=!0;for(var h=l;h<l+i;h++){if((a=n[h]).operating.scroll){r=!1;break}if((a.bookId.scroll||t.prior)&&a.bookId.scroll!==t.id){r=!1;break}a.operating.scroll=!0;var d=a.queue.scroll[0];if(d){var p=d.el.getBoundingClientRect();if(p.right>this.containerPos.right){r=!1,a.operating.scroll=!1;break}var m=p.left-this.containerPos.left+p.width,v=(this.containerPos.width+p.width)/d.duration,g=m/v,b=this.containerPos.width,y=(this.containerPos.width+t.width)/t.duration,w=b/y;if(e.config.bOffset||(e.config.bOffset=0),v<y&&g+e.config.bOffset>w){r=!1,a.operating.scroll=!1;break}}a.operating.scroll=!1}if(r){s=l;break}}else if("top"===t.mode)for(var k=0,x=n.length-i;k<=x;k++){r=!0;for(var _=k;_<k+i;_++){if(_>Math.floor(n.length/2)){r=!1;break}if((a=n[_]).operating[t.mode]){r=!1;break}if((a.bookId[t.mode]||t.prior)&&a.bookId[t.mode]!==t.id){r=!1;break}if(a.operating[t.mode]=!0,a.queue[t.mode].length>0){r=!1,a.operating[t.mode]=!1;break}a.operating[t.mode]=!1}if(r){s=k;break}}else if("bottom"===t.mode)for(var O=n.length-i;O>=0;O--){r=!0;for(var M=O;M<O+i;M++){if(M<=Math.floor(n.length/2)){r=!1;break}if((a=n[M]).operating[t.mode]){r=!1;break}if((a.bookId[t.mode]||t.prior)&&a.bookId[t.mode]!==t.id){r=!1;break}if(a.operating[t.mode]=!0,a.queue[t.mode].length>0){r=!1,a.operating[t.mode]=!1;break}a.operating[t.mode]=!1}if(r){s=O;break}}if(-1!==s){for(var C=s,E=s+i;C<E;C++)(a=n[C]).operating[t.mode]=!0,a.queue[t.mode].unshift(t),t.prior&&delete a.bookId[t.mode],a.operating[t.mode]=!1;if(t.prior)delete t.bookChannelId,e.bulletBtn.main.data.some(function(e){return e.id===t.id&&(delete e.bookChannelId,!0)});return t.channel_id=[s,i],t.top=s*o,this.danmu.config.area&&this.danmu.config.area.start&&(t.top+=this.containerHeight*this.danmu.config.area.start),{result:t,message:"success"}}if(t.prior)if(t.bookChannelId){e.bulletBtn.main.data.some(function(e){return e.id===t.id&&(e.start+=2e3,!0)})}else{s=-1;for(var j=0,T=n.length-i;j<=T;j++){r=!0;for(var P=j;P<j+i;P++)if(n[P].bookId[t.mode]){r=!1;break}if(r){s=j;break}}if(-1!==s){for(var B=s;B<s+i;B++)n[B].bookId[t.mode]=t.id;e.bulletBtn.main.data.some(function(e){return e.id===t.id&&(e.start+=2e3,e.bookChannelId=[s,i],!0)})}}return{result:!1,message:"no surplus will right"}}},{key:"removeBullet",value:function(t){for(var e=this.channels,n=t.channel_id,o=void 0,i=n[0],r=n[0]+n[1];i<r;i++)if(o=e[i]){o.operating[t.mode]=!0;var a=-1;o.queue[t.mode].some(function(e,n){return e.id===t.id&&(a=n,!0)}),a>-1&&o.queue[t.mode].splice(a,1),o.operating[t.mode]=!1}}},{key:"reset",value:function(){var t=this.danmu.container,e=this;e.channels&&e.channels.length>0&&["scroll","top","bottom"].forEach(function(t){for(var n=0;n<e.channels.length;n++)e.channels[n].queue[t].forEach(function(t){t.pauseMove(e.containerPos),t.remove()})}),setTimeout(function(){var n=t.getBoundingClientRect();e.width=n.width,e.height=n.height,e.danmu.config.area&&e.danmu.config.area.start>=0&&e.danmu.config.area.end>=e.danmu.config.area.start&&(e.height=e.height*(e.danmu.config.area.end-e.danmu.config.area.start)),e.container=t;for(var o=/mobile/gi.test(navigator.userAgent)?10:12,i=Math.floor(e.height/o),r=[],a=0;a<i;a++)r[a]={id:a,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}};e.channels=r,e.channelHeight=o},200)}},{key:"resetWithCb",value:function(t,e){var n=this.danmu.container,o=this;o.channels&&o.channels.length>0&&["scroll","top","bottom"].forEach(function(t){for(var e=0;e<o.channels.length;e++)o.channels[e].queue[t].forEach(function(t){t.pauseMove(o.containerPos),t.remove()})});var i=n.getBoundingClientRect();o.width=i.width,o.height=i.height,o.danmu.config.area&&o.danmu.config.area.start>=0&&o.danmu.config.area.end>=o.danmu.config.area.start&&(o.height=o.height*(o.danmu.config.area.end-o.danmu.config.area.start)),o.container=n;for(var r=/mobile/gi.test(navigator.userAgent)?10:12,a=Math.floor(o.height/r),s=[],u=0;u<a;u++)s[u]={id:u,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}};o.channels=s,o.channelHeight=r,t&&t(!0,e)}}]),t}();e.default=i,t.exports=e.default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o,i=function(){function t(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,n,o){return n&&t(e.prototype,n),o&&t(e,o),e}}(),r=n(0),a=(o=r)&&o.__esModule?o:{default:o};var s=function(){function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.danmu=e,this.duration=n.duration,this.id=n.id,this.container=e.container,this.start=n.start,this.prior=n.prior,this.color=n.color,this.bookChannelId=n.bookChannelId;var o=void 0;if(n.el&&1===n.el.nodeType)o=a.default.copyDom(n.el);else if((o=document.createElement("div")).textContent=n.txt,n.style){var i=n.style;Object.keys(i).forEach(function(t){o.style[t]=i[t]})}"top"===n.mode||"bottom"===n.mode?this.mode=n.mode:this.mode="scroll",this.el=o,this.status="waiting";var r=this.container.getBoundingClientRect();this.el.style.left=r.width+"px"}return i(t,[{key:"attach",value:function(){this.container.appendChild(this.el),this.elPos=this.el.getBoundingClientRect(),this.width=this.elPos.width,this.height=this.elPos.height}},{key:"detach",value:function(){this.container&&this.el&&this.container.removeChild(this.el),this.el=null}},{key:"topInit",value:function(){this.el.style.top=this.top+"px"}},{key:"pauseMove",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if("paused"!==this.status&&(this.status="paused",clearTimeout(this.removeTimer),this.el))if("scroll"===this.mode){if(e){var n=((new Date).getTime()-this.moveTime)/1e3*this.moveV,o=0;o=this.moveMoreS-n>=0?(this.moveMoreS-n)/this.moveContainerWidth*t.width:this.moveMoreS-n,this.el.style.left=o+"px"}else this.el.style.left=this.el.getBoundingClientRect().left-t.left+"px";this.el.style.transform="translateX(0px) translateY(0px) translateZ(0px)",this.el.style.transition="transform 0s linear 0s"}else this.pastDuration&&this.startTime?this.pastDuration=this.pastDuration+(new Date).getTime()-this.startTime:this.pastDuration=1}},{key:"startMove",value:function(t){var e=this;if(this.el&&"start"!==this.status)if(this.status="start","scroll"===this.mode){this.moveV=(t.width+this.width)/this.duration*1e3;var n=(e.el.getBoundingClientRect().right-t.left)/this.moveV;this.el.style.transition="transform "+n+"s linear 0s",setTimeout(function(){e.el&&(e.el.style.transform="translateX(-"+(e.el.getBoundingClientRect().right-t.left)+"px) translateY(0px) translateZ(0px)",e.moveTime=(new Date).getTime(),e.moveMoreS=e.el.getBoundingClientRect().left-t.left,e.moveContainerWidth=t.width,e.removeTimer=setTimeout(i,1e3*n))},20)}else{this.el.style.left="50%",this.el.style.margin="0 0 0 -"+this.width/2+"px",this.pastDuration||(this.pastDuration=1);var o=this.duration>=this.pastDuration?this.duration-this.pastDuration:0;this.removeTimer=setTimeout(i,o),this.startTime=(new Date).getTime()}function i(){if(e.el)if("scroll"===e.mode){var t=e.danmu.container.getBoundingClientRect(),n=e.el.getBoundingClientRect();n&&n.right<=t.left+100?(e.status="end",e.remove()):(e.pauseMove(t),e.startMove(t))}else e.status="end",e.remove()}}},{key:"remove",value:function(){(this.removeTimer&&clearTimeout(this.removeTimer),this.el&&this.el.parentNode)&&(this.el.parentNode.removeChild(this.el),this.el=null,this.danmu.emit("bullet_remove",{bullet:this}))}}]),t}();e.default=s,t.exports=e.default},function(t,e,n){var o=n(26);"string"==typeof o&&(o=[[t.i,o,""]]);var i={hmr:!0,transform:void 0,insertInto:void 0};n(28)(o,i);o.locals&&(t.exports=o.locals)},function(t,e,n){(t.exports=n(27)(!1)).push([t.i,".danmu{overflow:hidden;-webkit-user-select:none;-moz-user-select:none;user-select:none;-ms-user-select:none}.danmu>*{position:absolute;white-space:nowrap}.danmu-switch{width:32px;height:20px;border-radius:100px;background-color:#ccc;-webkit-box-sizing:border-box;box-sizing:border-box;outline:none;cursor:pointer;position:relative;text-align:center;margin:10px auto}.danmu-switch.danmu-switch-active{padding-left:12px;background-color:#f85959}.danmu-switch span.txt{width:20px;height:20px;line-height:20px;text-align:center;display:block;border-radius:100px;background-color:#ffffff;-webkit-box-shadow:-2px 0 0 0 rgba(0, 0, 0, .04);box-shadow:-2px 0 0 0 rgba(0, 0, 0, .04);font-family:PingFangSC;font-size:10px;font-weight:500;color:#f44336}\n",""])},function(t,e){t.exports=function(t){var e=[];return e.toString=function(){return this.map(function(e){var n=function(t,e){var n=t[1]||"",o=t[3];if(!o)return n;if(e&&"function"==typeof btoa){var i=(a=o,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(a))))+" */"),r=o.sources.map(function(t){return"/*# sourceURL="+o.sourceRoot+t+" */"});return[n].concat(r).concat([i]).join("\n")}var a;return[n].join("\n")}(e,t);return e[2]?"@media "+e[2]+"{"+n+"}":n}).join("")},e.i=function(t,n){"string"==typeof t&&(t=[[null,t,""]]);for(var o={},i=0;i<this.length;i++){var r=this[i][0];"number"==typeof r&&(o[r]=!0)}for(i=0;i<t.length;i++){var a=t[i];"number"==typeof a[0]&&o[a[0]]||(n&&!a[2]?a[2]=n:n&&(a[2]="("+a[2]+") and ("+n+")"),e.push(a))}},e}},function(t,e,n){var o,i,r={},a=(o=function(){return window&&document&&document.all&&!window.atob},function(){return void 0===i&&(i=o.apply(this,arguments)),i}),s=function(t){var e={};return function(t){if("function"==typeof t)return t();if(void 0===e[t]){var n=function(t){return document.querySelector(t)}.call(this,t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(t){n=null}e[t]=n}return e[t]}}(),u=null,c=0,l=[],f=n(29);function h(t,e){for(var n=0;n<t.length;n++){var o=t[n],i=r[o.id];if(i){i.refs++;for(var a=0;a<i.parts.length;a++)i.parts[a](o.parts[a]);for(;a<o.parts.length;a++)i.parts.push(b(o.parts[a],e))}else{var s=[];for(a=0;a<o.parts.length;a++)s.push(b(o.parts[a],e));r[o.id]={id:o.id,refs:1,parts:s}}}}function d(t,e){for(var n=[],o={},i=0;i<t.length;i++){var r=t[i],a=e.base?r[0]+e.base:r[0],s={css:r[1],media:r[2],sourceMap:r[3]};o[a]?o[a].parts.push(s):n.push(o[a]={id:a,parts:[s]})}return n}function p(t,e){var n=s(t.insertInto);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");var o=l[l.length-1];if("top"===t.insertAt)o?o.nextSibling?n.insertBefore(e,o.nextSibling):n.appendChild(e):n.insertBefore(e,n.firstChild),l.push(e);else if("bottom"===t.insertAt)n.appendChild(e);else{if("object"!=typeof t.insertAt||!t.insertAt.before)throw new Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n");var i=s(t.insertInto+" "+t.insertAt.before);n.insertBefore(e,i)}}function m(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t);var e=l.indexOf(t);e>=0&&l.splice(e,1)}function v(t){var e=document.createElement("style");return void 0===t.attrs.type&&(t.attrs.type="text/css"),g(e,t.attrs),p(t,e),e}function g(t,e){Object.keys(e).forEach(function(n){t.setAttribute(n,e[n])})}function b(t,e){var n,o,i,r;if(e.transform&&t.css){if(!(r=e.transform(t.css)))return function(){};t.css=r}if(e.singleton){var a=c++;n=u||(u=v(e)),o=k.bind(null,n,a,!1),i=k.bind(null,n,a,!0)}else t.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=function(t){var e=document.createElement("link");return void 0===t.attrs.type&&(t.attrs.type="text/css"),t.attrs.rel="stylesheet",g(e,t.attrs),p(t,e),e}(e),o=function(t,e,n){var o=n.css,i=n.sourceMap,r=void 0===e.convertToAbsoluteUrls&&i;(e.convertToAbsoluteUrls||r)&&(o=f(o));i&&(o+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(i))))+" */");var a=new Blob([o],{type:"text/css"}),s=t.href;t.href=URL.createObjectURL(a),s&&URL.revokeObjectURL(s)}.bind(null,n,e),i=function(){m(n),n.href&&URL.revokeObjectURL(n.href)}):(n=v(e),o=function(t,e){var n=e.css,o=e.media;o&&t.setAttribute("media",o);if(t.styleSheet)t.styleSheet.cssText=n;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(n))}}.bind(null,n),i=function(){m(n)});return o(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;o(t=e)}else i()}}t.exports=function(t,e){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(e=e||{}).attrs="object"==typeof e.attrs?e.attrs:{},e.singleton||"boolean"==typeof e.singleton||(e.singleton=a()),e.insertInto||(e.insertInto="head"),e.insertAt||(e.insertAt="bottom");var n=d(t,e);return h(n,e),function(t){for(var o=[],i=0;i<n.length;i++){var a=n[i];(s=r[a.id]).refs--,o.push(s)}t&&h(d(t,e),e);for(i=0;i<o.length;i++){var s;if(0===(s=o[i]).refs){for(var u=0;u<s.parts.length;u++)s.parts[u]();delete r[s.id]}}}};var y,w=(y=[],function(t,e){return y[t]=e,y.filter(Boolean).join("\n")});function k(t,e,n,o){var i=n?"":o.css;if(t.styleSheet)t.styleSheet.cssText=w(e,i);else{var r=document.createTextNode(i),a=t.childNodes;a[e]&&t.removeChild(a[e]),a.length?t.insertBefore(r,a[e]):t.appendChild(r)}}},function(t,e){t.exports=function(t){var e="undefined"!=typeof window&&window.location;if(!e)throw new Error("fixUrls requires window.location");if(!t||"string"!=typeof t)return t;var n=e.protocol+"//"+e.host,o=n+e.pathname.replace(/\/[^\/]*$/,"/");return t.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,function(t,e){var i,r=e.trim().replace(/^"(.*)"$/,function(t,e){return e}).replace(/^'(.*)'$/,function(t,e){return e});return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(r)?t:(i=0===r.indexOf("//")?r:0===r.indexOf("/")?n+r:o+r.replace(/^\.\//,""),"url("+JSON.stringify(i)+")")})}}]); | ||
window.DanmuJs=function(t){var e={};function n(o){if(e[o])return e[o].exports;var i=e[o]={i:o,l:!1,exports:{}};return t[o].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(o,i,function(e){return t[e]}.bind(null,i));return o},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=2)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o={createDom:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"div",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",i=document.createElement(t);return i.className=o,i.innerHTML=e,Object.keys(n).forEach(function(e){var o=e,r=n[e];"video"===t||"audio"===t?r&&i.setAttribute(o,r):i.setAttribute(o,r)}),i},hasClass:function(t,e){return t.classList?Array.prototype.some.call(t.classList,function(t){return t===e}):!!t.className.match(new RegExp("(\\s|^)"+e+"(\\s|$)"))},addClass:function(t,e){t.classList?e.replace(/(^\s+|\s+$)/g,"").split(/\s+/g).forEach(function(e){e&&t.classList.add(e)}):o.hasClass(t,e)||(t.className+=" "+e)},removeClass:function(t,e){t.classList?e.split(/\s+/g).forEach(function(e){t.classList.remove(e)}):o.hasClass(t,e)&&e.split(/\s+/g).forEach(function(e){var n=new RegExp("(\\s|^)"+e+"(\\s|$)");t.className=t.className.replace(n," ")})},toggleClass:function(t,e){e.split(/\s+/g).forEach(function(e){o.hasClass(t,e)?o.removeClass(t,e):o.addClass(t,e)})},findDom:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,e=arguments[1],n=void 0;try{n=t.querySelector(e)}catch(o){e.startsWith("#")&&(n=t.getElementById(e.slice(1)))}return n},deepCopy:function(t,e){if("Object"===o.typeOf(e)&&"Object"===o.typeOf(t))return Object.keys(e).forEach(function(n){"Object"!==o.typeOf(e[n])||e[n]instanceof Node?"Array"===o.typeOf(e[n])?t[n]="Array"===o.typeOf(t[n])?t[n].concat(e[n]):e[n]:t[n]=e[n]:t[n]?o.deepCopy(t[n],e[n]):t[n]=e[n]}),t},typeOf:function(t){return Object.prototype.toString.call(t).match(/([^\s.*]+)(?=]$)/g)[0]},copyDom:function(t){if(t&&1===t.nodeType){var e=document.createElement(t.tagName);return Array.prototype.forEach.call(t.attributes,function(t){e.setAttribute(t.name,t.value)}),t.innerHTML&&(e.innerHTML=t.innerHTML),e}return""},formatTime:function(t){var e=Math.floor(t);return 1e3*e+(t-e)}};e.default=o,t.exports=e.default},function(t,e,n){"use strict";var o=n(13)();t.exports=function(t){return t!==o&&null!==t}},function(t,e,n){t.exports=n(3)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o,i=n(4),r=(o=i)&&o.__esModule?o:{default:o};n(25),e.default=r.default,t.exports=e.default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=function(){function t(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,n,o){return n&&t(e.prototype,n),o&&t(e,o),e}}(),i=s(n(5)),r=s(n(21)),a=s(n(0));function s(t){return t&&t.__esModule?t:{default:t}}var u=function(){function t(e){var n=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.config=a.default.deepCopy({overlap:!1,area:{start:0,end:1},comments:[]},e),this.hideArr=[],(0,i.default)(this);var o=this;if(this.config.comments.forEach(function(t){t.duration=t.duration<5e3?5e3:t.duration,t.mode||(t.mode="scroll")}),!this.config.container||1!==this.config.container.nodeType)return this.emit("error","container id can't be empty"),!1;if(this.container=this.config.container,this.config.containerStyle){var s=this.config.containerStyle;Object.keys(s).forEach(function(t){o.container.style[t]=s[t]})}this.player=this.config.player,a.default.addClass(this.container,"danmu"),this.bulletBtn=new r.default(this),["touchend","click","dblclick"].forEach(function(t){n.container.addEventListener(t,function(e){if(e.preventDefault(),e.stopPropagation(),o.player){var n=void 0;document.createEvent?(n=document.createEvent("Event")).initEvent(t,!0,!0):n=new Event(t),o.player.dispatchEvent(n)}},!1)}),this.emit("ready")}return o(t,[{key:"start",value:function(){this.bulletBtn.main.start()}},{key:"pause",value:function(){this.bulletBtn.main.pause()}},{key:"play",value:function(){this.bulletBtn.main.play()}},{key:"stop",value:function(){this.bulletBtn.main.stop()}},{key:"sendComment",value:function(t){t&&t.id&&t.duration&&(t.el||t.txt)&&(t.duration=t.duration<5e3?5e3:t.duration,this.bulletBtn.main.data.push(t))}},{key:"setCommentID",value:function(t,e){var n=this.container.getBoundingClientRect();t&&e&&(this.bulletBtn.main.data.some(function(n){return n.id===t&&(n.id=e,!0)}),this.bulletBtn.main.queue.some(function(o){return o.id===t&&(o.id=e,o.pauseMove(n),o.startMove(n),!0)}))}},{key:"setCommentDuration",value:function(t,e){var n=this.container.getBoundingClientRect();t&&e&&(e=e<5e3?5e3:e,this.bulletBtn.main.data.some(function(n){return n.id===t&&(n.duration=e,!0)}),this.bulletBtn.main.queue.some(function(o){return o.id===t&&(o.duration=e,o.pauseMove(n),o.startMove(n),!0)}))}},{key:"setAllDuration",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"scroll",e=arguments[1],n=this.container.getBoundingClientRect();e&&(e=e<5e3?5e3:e,this.bulletBtn.main.data.forEach(function(n){t===n.mode&&(n.duration=e)}),this.bulletBtn.main.queue.forEach(function(o){t===o.mode&&(o.duration=e,o.pauseMove(n),o.startMove(n))}))}},{key:"hide",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"scroll";this.hideArr.indexOf(t)<0&&this.hideArr.push(t),this.bulletBtn.main.queue.filter(function(e){return t===e.mode||"color"===t&&e.color}).forEach(function(t){return t.remove()})}},{key:"show",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"scroll",e=this.hideArr.indexOf(t);e>-1&&this.hideArr.splice(e,1)}}]),t}();e.default=u,t.exports=e.default},function(t,e,n){"use strict";var o,i,r,a,s,u,c,l=n(6),f=n(20),h=Function.prototype.apply,d=Function.prototype.call,p=Object.create,m=Object.defineProperty,v=Object.defineProperties,g=Object.prototype.hasOwnProperty,b={configurable:!0,enumerable:!1,writable:!0};i=function(t,e){var n,i;return f(e),i=this,o.call(this,t,n=function(){r.call(i,t,n),h.call(e,this,arguments)}),n.__eeOnceListener__=e,this},s={on:o=function(t,e){var n;return f(e),g.call(this,"__ee__")?n=this.__ee__:(n=b.value=p(null),m(this,"__ee__",b),b.value=null),n[t]?"object"==typeof n[t]?n[t].push(e):n[t]=[n[t],e]:n[t]=e,this},once:i,off:r=function(t,e){var n,o,i,r;if(f(e),!g.call(this,"__ee__"))return this;if(!(n=this.__ee__)[t])return this;if("object"==typeof(o=n[t]))for(r=0;i=o[r];++r)i!==e&&i.__eeOnceListener__!==e||(2===o.length?n[t]=o[r?0:1]:o.splice(r,1));else o!==e&&o.__eeOnceListener__!==e||delete n[t];return this},emit:a=function(t){var e,n,o,i,r;if(g.call(this,"__ee__")&&(i=this.__ee__[t]))if("object"==typeof i){for(n=arguments.length,r=new Array(n-1),e=1;e<n;++e)r[e-1]=arguments[e];for(i=i.slice(),e=0;o=i[e];++e)h.call(o,this,r)}else switch(arguments.length){case 1:d.call(i,this);break;case 2:d.call(i,this,arguments[1]);break;case 3:d.call(i,this,arguments[1],arguments[2]);break;default:for(n=arguments.length,r=new Array(n-1),e=1;e<n;++e)r[e-1]=arguments[e];h.call(i,this,r)}}},u={on:l(o),once:l(i),off:l(r),emit:l(a)},c=v({},u),t.exports=e=function(t){return null==t?p(c):v(Object(t),u)},e.methods=s},function(t,e,n){"use strict";var o=n(7),i=n(15),r=n(16),a=n(17);(t.exports=function(t,e){var n,r,s,u,c;return arguments.length<2||"string"!=typeof t?(u=e,e=t,t=null):u=arguments[2],null==t?(n=s=!0,r=!1):(n=a.call(t,"c"),r=a.call(t,"e"),s=a.call(t,"w")),c={value:e,configurable:n,enumerable:r,writable:s},u?o(i(u),c):c}).gs=function(t,e,n){var s,u,c,l;return"string"!=typeof t?(c=n,n=e,e=t,t=null):c=arguments[3],null==e?e=void 0:r(e)?null==n?n=void 0:r(n)||(c=n,n=void 0):(c=e,e=n=void 0),null==t?(s=!0,u=!1):(s=a.call(t,"c"),u=a.call(t,"e")),l={get:e,set:n,configurable:s,enumerable:u},c?o(i(c),l):l}},function(t,e,n){"use strict";t.exports=n(8)()?Object.assign:n(9)},function(t,e,n){"use strict";t.exports=function(){var t,e=Object.assign;return"function"==typeof e&&(e(t={foo:"raz"},{bar:"dwa"},{trzy:"trzy"}),t.foo+t.bar+t.trzy==="razdwatrzy")}},function(t,e,n){"use strict";var o=n(10),i=n(14),r=Math.max;t.exports=function(t,e){var n,a,s,u=r(arguments.length,2);for(t=Object(i(t)),s=function(o){try{t[o]=e[o]}catch(t){n||(n=t)}},a=1;a<u;++a)e=arguments[a],o(e).forEach(s);if(void 0!==n)throw n;return t}},function(t,e,n){"use strict";t.exports=n(11)()?Object.keys:n(12)},function(t,e,n){"use strict";t.exports=function(){try{return Object.keys("primitive"),!0}catch(t){return!1}}},function(t,e,n){"use strict";var o=n(1),i=Object.keys;t.exports=function(t){return i(o(t)?Object(t):t)}},function(t,e,n){"use strict";t.exports=function(){}},function(t,e,n){"use strict";var o=n(1);t.exports=function(t){if(!o(t))throw new TypeError("Cannot use null or undefined");return t}},function(t,e,n){"use strict";var o=n(1),i=Array.prototype.forEach,r=Object.create;t.exports=function(t){var e=r(null);return i.call(arguments,function(t){o(t)&&function(t,e){var n;for(n in t)e[n]=t[n]}(Object(t),e)}),e}},function(t,e,n){"use strict";t.exports=function(t){return"function"==typeof t}},function(t,e,n){"use strict";t.exports=n(18)()?String.prototype.contains:n(19)},function(t,e,n){"use strict";var o="razdwatrzy";t.exports=function(){return"function"==typeof o.contains&&(!0===o.contains("dwa")&&!1===o.contains("foo"))}},function(t,e,n){"use strict";var o=String.prototype.indexOf;t.exports=function(t){return o.call(this,t,arguments[1])>-1}},function(t,e,n){"use strict";t.exports=function(t){if("function"!=typeof t)throw new TypeError(t+" is not a function");return t}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=function(){function t(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,n,o){return n&&t(e.prototype,n),o&&t(e,o),e}}(),i=a(n(0)),r=a(n(22));function a(t){return t&&t.__esModule?t:{default:t}}var s=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.danmu=e,this.main=new r.default(e),e.config.defaultOff||this.main.start()}return o(t,[{key:"createSwitch",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.switchBtn=i.default.createDom("dk-switch",'<span class="txt">弹</span>',{},"danmu-switch "+(t?"danmu-switch-active":"")),this.switchBtn}}]),t}();e.default=s,t.exports=e.default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=function(){function t(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,n,o){return n&&t(e.prototype,n),o&&t(e,o),e}}(),i=s(n(23)),r=s(n(24)),a=s(n(0));function s(t){return t&&t.__esModule?t:{default:t}}var u=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.danmu=e,this.container=e.container,this.channel=new i.default(e),this.data=[].concat(e.config.comments),this.queue=[],this.timer=null,this.retryTimer=null,this.interval=2e3,this.status="idle",e.on("bullet_remove",this.updateQueue.bind(this))}return o(t,[{key:"updateQueue",value:function(t){var e=this;e.queue.some(function(n,o){return n.id===t.bullet.id&&(e.queue.splice(o,1),!0)})}},{key:"init",value:function(t,e){e||(e=this),e.data.sort(function(t,e){return t.start-e.start}),e.retryTimer||(e.retryTimer=setInterval(function(){e.readData(),e.dataHandle()},e.interval-1e3))}},{key:"start",value:function(){this.status="playing",this.queue=[],this.container.innerHTML="",this.channel.resetWithCb(this.init,this)}},{key:"stop",value:function(){this.status="closed",clearInterval(this.retryTimer),this.retryTimer=null,this.channel.reset(),this.queue=[],this.container.innerHTML=""}},{key:"play",value:function(){this.status="playing";var t=this.channel.channels,e=this.danmu.container.getBoundingClientRect();t&&t.length>0&&["scroll","top","bottom"].forEach(function(n){for(var o=0;o<t.length;o++)t[o].queue[n].forEach(function(t){t.resized||(t.startMove(e),t.resized=!0)});for(var i=0;i<t.length;i++)t[i].queue[n].forEach(function(t){t.resized=!1})})}},{key:"pause",value:function(){this.status="paused";var t=this.channel.channels,e=this.danmu.container.getBoundingClientRect();t&&t.length>0&&["scroll","top","bottom"].forEach(function(n){for(var o=0;o<t.length;o++)t[o].queue[n].forEach(function(t){t.pauseMove(e)})})}},{key:"dataHandle",value:function(){var t=this;"paused"!==this.status&&"closed"!==this.status&&t.queue.length&&t.queue.forEach(function(e){"waiting"!==e.status&&"paused"!==e.status||e.startMove(t.channel.containerPos)})}},{key:"readData",value:function(){var t=this,e=this.danmu,n=0;e.player&&e.player.currentTime&&(n=a.default.formatTime(e.player.currentTime));var o=void 0,i=t.interval,s=t.channel,u=void 0;(u=e.player?t.data.filter(function(e){return!e.start&&t.danmu.hideArr.indexOf(e.mode)<0&&(!e.color||t.danmu.hideArr.indexOf("color")<0)&&(e.start=n),t.danmu.hideArr.indexOf(e.mode)<0&&(!e.color||t.danmu.hideArr.indexOf("color")<0)&&e.start-i<=n&&n<=e.start+i}):t.data.filter(function(e){return t.danmu.hideArr.indexOf(e.mode)<0&&(!e.color||t.danmu.hideArr.indexOf("color")<0)})).length>0&&u.forEach(function(n){(o=new r.default(e,n)).attach(),s.addBullet(o).result?(t.queue.push(o),o.topInit()):o.detach()})}}]),t}();e.default=u,t.exports=e.default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=function(){function t(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,n,o){return n&&t(e.prototype,n),o&&t(e,o),e}}();var i=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.danmu=e,this.reset();var n=this;this.danmu.on("bullet_remove",function(t){n.removeBullet(t.bullet)}),this.containerPos=this.danmu.container.getBoundingClientRect(),this.containerWidth=this.containerPos.width,this.containerHeight=this.containerPos.height,this.containerLeft=this.containerPos.left,this.containerRight=this.containerPos.right,this.danmu.bulletResizeTimer=setInterval(function(){n.containerPos=n.danmu.container.getBoundingClientRect(),(Math.abs(n.containerPos.width-n.containerWidth)>=2||Math.abs(n.containerPos.height-n.containerHeight)>=2||Math.abs(n.containerPos.left-n.containerLeft)>=2||Math.abs(n.containerPos.right-n.containerRight)>=2)&&(n.containerWidth=n.containerPos.width,n.containerHeight=n.containerPos.height,n.containerLeft=n.containerPos.left,n.containerRight=n.containerPos.right,n.resize(!0))},50)}return o(t,[{key:"resize",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=this.danmu.container,n=this;setTimeout(function(){n.danmu.bulletBtn.main.data&&n.danmu.bulletBtn.main.data.forEach(function(t){t.bookChannelId&&delete t.bookChannelId});var o=e.getBoundingClientRect();n.width=o.width,n.height=o.height,n.danmu.config.area&&n.danmu.config.area.start>=0&&n.danmu.config.area.end>=n.danmu.config.area.start&&(n.height=n.height*(n.danmu.config.area.end-n.danmu.config.area.start)),n.container=e;for(var i=/mobile/gi.test(navigator.userAgent)?10:12,r=Math.floor(n.height/i),a=[],s=0;s<r;s++)a[s]={id:s,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}};if(n.channels&&n.channels.length<=a.length){for(var u=function(e){a[e]={id:e,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}},["scroll","top"].forEach(function(o){n.channels[e].queue[o].forEach(function(i){i.el&&(a[e].queue[o].push(i),i.resized||(i.pauseMove(n.containerPos,t),i.startMove(n.containerPos),i.resized=!0))})}),n.channels[e].queue.bottom.forEach(function(o){if(o.el){if(a[e+a.length-n.channels.length].queue.bottom.push(o),o.channel_id[0]+o.channel_id[1]-1===e){var r=[].concat(o.channel_id);o.channel_id=[r[0]-n.channels.length+a.length,r[1]],o.top=o.channel_id[0]*i,n.danmu.config.area&&n.danmu.config.area.start&&(o.top+=n.containerHeight*n.danmu.config.area.start),o.topInit()}o.resized||(o.pauseMove(n.containerPos,t),o.startMove(n.containerPos),o.resized=!0)}})},c=0;c<n.channels.length;c++)u(c);for(var l=function(t){["scroll","top","bottom"].forEach(function(e){a[t].queue[e].forEach(function(t){t.resized=!1})})},f=0;f<a.length;f++)l(f);n.channels=a,n.channelHeight=i}else if(n.channels&&n.channels.length>a.length){for(var h=function(e){a[e]={id:e,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}},["scroll","top","bottom"].forEach(function(o){if("top"===o&&e>Math.floor(a.length/2));else if("bottom"===o&&e<=Math.floor(a.length/2));else{var r="bottom"===o?e-a.length+n.channels.length:e;n.channels[r].queue[o].forEach(function(s,u){if(s.el){if(a[e].queue[o].push(s),"bottom"===o&&s.channel_id[0]+s.channel_id[1]-1===r){var c=[].concat(s.channel_id);s.channel_id=[c[0]-n.channels.length+a.length,c[1]],s.top=s.channel_id[0]*i,n.danmu.config.area&&n.danmu.config.area.start&&(s.top+=n.containerHeight*n.danmu.config.area.start),s.topInit()}s.resized||(s.pauseMove(n.containerPos,t),s.startMove(n.containerPos),s.resized=!0)}n.channels[r].queue[o].splice(u,1)})}})},d=0;d<a.length;d++)h(d);for(var p=function(t){["scroll","top","bottom"].forEach(function(e){n.channels[t].queue[e].forEach(function(t){t.pauseMove(n.containerPos),t.remove()})})},m=a.length;m<n.channels.length;m++)p(m);for(var v=function(t){["scroll","top","bottom"].forEach(function(e){a[t].queue[e].forEach(function(t){t.resized=!1})})},g=0;g<a.length;g++)v(g);n.channels=a,n.channelHeight=i}},10)}},{key:"addBullet",value:function(t){var e=this.danmu,n=this.channels,o=this.channelHeight,i=Math.ceil(t.height/o);if(i>n.length)return{result:!1,message:"exceed channels.length, occupy="+i+",channelsSize="+n.length};for(var r=!0,a=void 0,s=-1,u=0,c=n.length;u<c;u++)if(n[u].queue[t.mode].some(function(e){return e.id===t.id}))return{result:!1,message:"exsited, channelOrder="+u+",danmu_id="+t.id};if("scroll"===t.mode)for(var l=0,f=n.length-i;l<=f;l++){r=!0;for(var h=l;h<l+i;h++){if((a=n[h]).operating.scroll){r=!1;break}if((a.bookId.scroll||t.prior)&&a.bookId.scroll!==t.id){r=!1;break}a.operating.scroll=!0;var d=a.queue.scroll[0];if(d){var p=d.el.getBoundingClientRect();if(p.right>this.containerPos.right){r=!1,a.operating.scroll=!1;break}var m=p.left-this.containerPos.left+p.width,v=(this.containerPos.width+p.width)/d.duration,g=m/v,b=this.containerPos.width,y=(this.containerPos.width+t.width)/t.duration,w=b/y;if(e.config.bOffset||(e.config.bOffset=0),v<y&&g+e.config.bOffset>w){r=!1,a.operating.scroll=!1;break}}a.operating.scroll=!1}if(r){s=l;break}}else if("top"===t.mode)for(var k=0,x=n.length-i;k<=x;k++){r=!0;for(var _=k;_<k+i;_++){if(_>Math.floor(n.length/2)){r=!1;break}if((a=n[_]).operating[t.mode]){r=!1;break}if((a.bookId[t.mode]||t.prior)&&a.bookId[t.mode]!==t.id){r=!1;break}if(a.operating[t.mode]=!0,a.queue[t.mode].length>0){r=!1,a.operating[t.mode]=!1;break}a.operating[t.mode]=!1}if(r){s=k;break}}else if("bottom"===t.mode)for(var O=n.length-i;O>=0;O--){r=!0;for(var M=O;M<O+i;M++){if(M<=Math.floor(n.length/2)){r=!1;break}if((a=n[M]).operating[t.mode]){r=!1;break}if((a.bookId[t.mode]||t.prior)&&a.bookId[t.mode]!==t.id){r=!1;break}if(a.operating[t.mode]=!0,a.queue[t.mode].length>0){r=!1,a.operating[t.mode]=!1;break}a.operating[t.mode]=!1}if(r){s=O;break}}if(-1!==s){for(var C=s,E=s+i;C<E;C++)(a=n[C]).operating[t.mode]=!0,a.queue[t.mode].unshift(t),t.prior&&delete a.bookId[t.mode],a.operating[t.mode]=!1;if(t.prior)delete t.bookChannelId,e.bulletBtn.main.data.some(function(e){return e.id===t.id&&(delete e.bookChannelId,!0)});return t.channel_id=[s,i],t.top=s*o,this.danmu.config.area&&this.danmu.config.area.start&&(t.top+=this.containerHeight*this.danmu.config.area.start),{result:t,message:"success"}}if(t.prior)if(t.bookChannelId){e.bulletBtn.main.data.some(function(e){return e.id===t.id&&(e.start+=2e3,!0)})}else{s=-1;for(var j=0,T=n.length-i;j<=T;j++){r=!0;for(var P=j;P<j+i;P++)if(n[P].bookId[t.mode]){r=!1;break}if(r){s=j;break}}if(-1!==s){for(var B=s;B<s+i;B++)n[B].bookId[t.mode]=t.id;e.bulletBtn.main.data.some(function(e){return e.id===t.id&&(e.start+=2e3,e.bookChannelId=[s,i],!0)})}}return{result:!1,message:"no surplus will right"}}},{key:"removeBullet",value:function(t){for(var e=this.channels,n=t.channel_id,o=void 0,i=n[0],r=n[0]+n[1];i<r;i++)if(o=e[i]){o.operating[t.mode]=!0;var a=-1;o.queue[t.mode].some(function(e,n){return e.id===t.id&&(a=n,!0)}),a>-1&&o.queue[t.mode].splice(a,1),o.operating[t.mode]=!1}}},{key:"reset",value:function(){var t=this.danmu.container,e=this;e.channels&&e.channels.length>0&&["scroll","top","bottom"].forEach(function(t){for(var n=0;n<e.channels.length;n++)e.channels[n].queue[t].forEach(function(t){t.pauseMove(e.containerPos),t.remove()})}),setTimeout(function(){var n=t.getBoundingClientRect();e.width=n.width,e.height=n.height,e.danmu.config.area&&e.danmu.config.area.start>=0&&e.danmu.config.area.end>=e.danmu.config.area.start&&(e.height=e.height*(e.danmu.config.area.end-e.danmu.config.area.start)),e.container=t;for(var o=/mobile/gi.test(navigator.userAgent)?10:12,i=Math.floor(e.height/o),r=[],a=0;a<i;a++)r[a]={id:a,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}};e.channels=r,e.channelHeight=o},200)}},{key:"resetWithCb",value:function(t,e){var n=this.danmu.container,o=this;o.channels&&o.channels.length>0&&["scroll","top","bottom"].forEach(function(t){for(var e=0;e<o.channels.length;e++)o.channels[e].queue[t].forEach(function(t){t.pauseMove(o.containerPos),t.remove()})});var i=n.getBoundingClientRect();o.width=i.width,o.height=i.height,o.danmu.config.area&&o.danmu.config.area.start>=0&&o.danmu.config.area.end>=o.danmu.config.area.start&&(o.height=o.height*(o.danmu.config.area.end-o.danmu.config.area.start)),o.container=n;for(var r=/mobile/gi.test(navigator.userAgent)?10:12,a=Math.floor(o.height/r),s=[],u=0;u<a;u++)s[u]={id:u,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}};o.channels=s,o.channelHeight=r,t&&t(!0,e)}}]),t}();e.default=i,t.exports=e.default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o,i=function(){function t(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,n,o){return n&&t(e.prototype,n),o&&t(e,o),e}}(),r=n(0),a=(o=r)&&o.__esModule?o:{default:o};var s=function(){function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.danmu=e,this.duration=n.duration,this.id=n.id,this.container=e.container,this.start=n.start,this.prior=n.prior,this.color=n.color,this.bookChannelId=n.bookChannelId;var o=void 0;if(n.el&&1===n.el.nodeType)o=a.default.copyDom(n.el);else if((o=document.createElement("div")).textContent=n.txt,n.style){var i=n.style;Object.keys(i).forEach(function(t){o.style[t]=i[t]})}"top"===n.mode||"bottom"===n.mode?this.mode=n.mode:this.mode="scroll",this.el=o,this.status="waiting";var r=this.container.getBoundingClientRect();this.el.style.left=r.width+"px"}return i(t,[{key:"attach",value:function(){this.container.appendChild(this.el),this.elPos=this.el.getBoundingClientRect(),this.width=this.elPos.width,this.height=this.elPos.height}},{key:"detach",value:function(){this.container&&this.el&&this.container.removeChild(this.el),this.el=null}},{key:"topInit",value:function(){this.el.style.top=this.top+"px"}},{key:"pauseMove",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if("paused"!==this.status&&(this.status="paused",clearTimeout(this.removeTimer),this.el))if("scroll"===this.mode){if(e){var n=((new Date).getTime()-this.moveTime)/1e3*this.moveV,o=0;o=this.moveMoreS-n>=0?(this.moveMoreS-n)/this.moveContainerWidth*t.width:this.moveMoreS-n,this.el.style.left=o+"px"}else this.el.style.left=this.el.getBoundingClientRect().left-t.left+"px";this.el.style.transform="translateX(0px) translateY(0px) translateZ(0px)",this.el.style.transition="transform 0s linear 0s"}else this.pastDuration&&this.startTime?this.pastDuration=this.pastDuration+(new Date).getTime()-this.startTime:this.pastDuration=1}},{key:"startMove",value:function(t){var e=this;if(this.el&&"start"!==this.status)if(this.status="start","scroll"===this.mode){this.moveV=(t.width+this.width)/this.duration*1e3;var n=(e.el.getBoundingClientRect().right-t.left)/this.moveV;this.el.style.transition="transform "+n+"s linear 0s",setTimeout(function(){e.el&&(e.el.style.transform="translateX(-"+(e.el.getBoundingClientRect().right-t.left)+"px) translateY(0px) translateZ(0px)",e.moveTime=(new Date).getTime(),e.moveMoreS=e.el.getBoundingClientRect().left-t.left,e.moveContainerWidth=t.width,e.removeTimer=setTimeout(i,1e3*n))},20)}else{this.el.style.left="50%",this.el.style.margin="0 0 0 -"+this.width/2+"px",this.pastDuration||(this.pastDuration=1);var o=this.duration>=this.pastDuration?this.duration-this.pastDuration:0;this.removeTimer=setTimeout(i,o),this.startTime=(new Date).getTime()}function i(){if(e.el)if("scroll"===e.mode){var t=e.danmu.container.getBoundingClientRect(),n=e.el.getBoundingClientRect();n&&n.right<=t.left+100?(e.status="end",e.remove()):(e.pauseMove(t),e.startMove(t))}else e.status="end",e.remove()}}},{key:"remove",value:function(){(this.removeTimer&&clearTimeout(this.removeTimer),this.el&&this.el.parentNode)&&(this.el.parentNode.removeChild(this.el),this.el=null,this.danmu.emit("bullet_remove",{bullet:this}))}}]),t}();e.default=s,t.exports=e.default},function(t,e,n){var o=n(26);"string"==typeof o&&(o=[[t.i,o,""]]);var i={hmr:!0,transform:void 0,insertInto:void 0};n(28)(o,i);o.locals&&(t.exports=o.locals)},function(t,e,n){(t.exports=n(27)(!1)).push([t.i,".danmu{overflow:hidden;-webkit-user-select:none;-moz-user-select:none;user-select:none;-ms-user-select:none}.danmu>*{position:absolute;white-space:nowrap}.danmu-switch{width:32px;height:20px;border-radius:100px;background-color:#ccc;-webkit-box-sizing:border-box;box-sizing:border-box;outline:none;cursor:pointer;position:relative;text-align:center;margin:10px auto}.danmu-switch.danmu-switch-active{padding-left:12px;background-color:#f85959}.danmu-switch span.txt{width:20px;height:20px;line-height:20px;text-align:center;display:block;border-radius:100px;background-color:#ffffff;-webkit-box-shadow:-2px 0 0 0 rgba(0, 0, 0, .04);box-shadow:-2px 0 0 0 rgba(0, 0, 0, .04);font-family:PingFangSC;font-size:10px;font-weight:500;color:#f44336}\n",""])},function(t,e){t.exports=function(t){var e=[];return e.toString=function(){return this.map(function(e){var n=function(t,e){var n=t[1]||"",o=t[3];if(!o)return n;if(e&&"function"==typeof btoa){var i=(a=o,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(a))))+" */"),r=o.sources.map(function(t){return"/*# sourceURL="+o.sourceRoot+t+" */"});return[n].concat(r).concat([i]).join("\n")}var a;return[n].join("\n")}(e,t);return e[2]?"@media "+e[2]+"{"+n+"}":n}).join("")},e.i=function(t,n){"string"==typeof t&&(t=[[null,t,""]]);for(var o={},i=0;i<this.length;i++){var r=this[i][0];"number"==typeof r&&(o[r]=!0)}for(i=0;i<t.length;i++){var a=t[i];"number"==typeof a[0]&&o[a[0]]||(n&&!a[2]?a[2]=n:n&&(a[2]="("+a[2]+") and ("+n+")"),e.push(a))}},e}},function(t,e,n){var o,i,r={},a=(o=function(){return window&&document&&document.all&&!window.atob},function(){return void 0===i&&(i=o.apply(this,arguments)),i}),s=function(t){var e={};return function(t){if("function"==typeof t)return t();if(void 0===e[t]){var n=function(t){return document.querySelector(t)}.call(this,t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(t){n=null}e[t]=n}return e[t]}}(),u=null,c=0,l=[],f=n(29);function h(t,e){for(var n=0;n<t.length;n++){var o=t[n],i=r[o.id];if(i){i.refs++;for(var a=0;a<i.parts.length;a++)i.parts[a](o.parts[a]);for(;a<o.parts.length;a++)i.parts.push(b(o.parts[a],e))}else{var s=[];for(a=0;a<o.parts.length;a++)s.push(b(o.parts[a],e));r[o.id]={id:o.id,refs:1,parts:s}}}}function d(t,e){for(var n=[],o={},i=0;i<t.length;i++){var r=t[i],a=e.base?r[0]+e.base:r[0],s={css:r[1],media:r[2],sourceMap:r[3]};o[a]?o[a].parts.push(s):n.push(o[a]={id:a,parts:[s]})}return n}function p(t,e){var n=s(t.insertInto);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");var o=l[l.length-1];if("top"===t.insertAt)o?o.nextSibling?n.insertBefore(e,o.nextSibling):n.appendChild(e):n.insertBefore(e,n.firstChild),l.push(e);else if("bottom"===t.insertAt)n.appendChild(e);else{if("object"!=typeof t.insertAt||!t.insertAt.before)throw new Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n");var i=s(t.insertInto+" "+t.insertAt.before);n.insertBefore(e,i)}}function m(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t);var e=l.indexOf(t);e>=0&&l.splice(e,1)}function v(t){var e=document.createElement("style");return void 0===t.attrs.type&&(t.attrs.type="text/css"),g(e,t.attrs),p(t,e),e}function g(t,e){Object.keys(e).forEach(function(n){t.setAttribute(n,e[n])})}function b(t,e){var n,o,i,r;if(e.transform&&t.css){if(!(r=e.transform(t.css)))return function(){};t.css=r}if(e.singleton){var a=c++;n=u||(u=v(e)),o=k.bind(null,n,a,!1),i=k.bind(null,n,a,!0)}else t.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=function(t){var e=document.createElement("link");return void 0===t.attrs.type&&(t.attrs.type="text/css"),t.attrs.rel="stylesheet",g(e,t.attrs),p(t,e),e}(e),o=function(t,e,n){var o=n.css,i=n.sourceMap,r=void 0===e.convertToAbsoluteUrls&&i;(e.convertToAbsoluteUrls||r)&&(o=f(o));i&&(o+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(i))))+" */");var a=new Blob([o],{type:"text/css"}),s=t.href;t.href=URL.createObjectURL(a),s&&URL.revokeObjectURL(s)}.bind(null,n,e),i=function(){m(n),n.href&&URL.revokeObjectURL(n.href)}):(n=v(e),o=function(t,e){var n=e.css,o=e.media;o&&t.setAttribute("media",o);if(t.styleSheet)t.styleSheet.cssText=n;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(n))}}.bind(null,n),i=function(){m(n)});return o(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;o(t=e)}else i()}}t.exports=function(t,e){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(e=e||{}).attrs="object"==typeof e.attrs?e.attrs:{},e.singleton||"boolean"==typeof e.singleton||(e.singleton=a()),e.insertInto||(e.insertInto="head"),e.insertAt||(e.insertAt="bottom");var n=d(t,e);return h(n,e),function(t){for(var o=[],i=0;i<n.length;i++){var a=n[i];(s=r[a.id]).refs--,o.push(s)}t&&h(d(t,e),e);for(i=0;i<o.length;i++){var s;if(0===(s=o[i]).refs){for(var u=0;u<s.parts.length;u++)s.parts[u]();delete r[s.id]}}}};var y,w=(y=[],function(t,e){return y[t]=e,y.filter(Boolean).join("\n")});function k(t,e,n,o){var i=n?"":o.css;if(t.styleSheet)t.styleSheet.cssText=w(e,i);else{var r=document.createTextNode(i),a=t.childNodes;a[e]&&t.removeChild(a[e]),a.length?t.insertBefore(r,a[e]):t.appendChild(r)}}},function(t,e){t.exports=function(t){var e="undefined"!=typeof window&&window.location;if(!e)throw new Error("fixUrls requires window.location");if(!t||"string"!=typeof t)return t;var n=e.protocol+"//"+e.host,o=n+e.pathname.replace(/\/[^\/]*$/,"/");return t.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,function(t,e){var i,r=e.trim().replace(/^"(.*)"$/,function(t,e){return e}).replace(/^'(.*)'$/,function(t,e){return e});return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(r)?t:(i=0===r.indexOf("//")?r:0===r.indexOf("/")?n+r:o+r.replace(/^\.\//,""),"url("+JSON.stringify(i)+")")})}}]); | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports["danmu.js"]=e():t["danmu.js"]=e()}(window,function(){return function(t){var e={};function n(o){if(e[o])return e[o].exports;var i=e[o]={i:o,l:!1,exports:{}};return t[o].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(o,i,function(e){return t[e]}.bind(null,i));return o},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=2)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o={createDom:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"div",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",i=document.createElement(t);return i.className=o,i.innerHTML=e,Object.keys(n).forEach(function(e){var o=e,r=n[e];"video"===t||"audio"===t?r&&i.setAttribute(o,r):i.setAttribute(o,r)}),i},hasClass:function(t,e){return t.classList?Array.prototype.some.call(t.classList,function(t){return t===e}):!!t.className.match(new RegExp("(\\s|^)"+e+"(\\s|$)"))},addClass:function(t,e){t.classList?e.replace(/(^\s+|\s+$)/g,"").split(/\s+/g).forEach(function(e){e&&t.classList.add(e)}):o.hasClass(t,e)||(t.className+=" "+e)},removeClass:function(t,e){t.classList?e.split(/\s+/g).forEach(function(e){t.classList.remove(e)}):o.hasClass(t,e)&&e.split(/\s+/g).forEach(function(e){var n=new RegExp("(\\s|^)"+e+"(\\s|$)");t.className=t.className.replace(n," ")})},toggleClass:function(t,e){e.split(/\s+/g).forEach(function(e){o.hasClass(t,e)?o.removeClass(t,e):o.addClass(t,e)})},findDom:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,e=arguments[1],n=void 0;try{n=t.querySelector(e)}catch(o){e.startsWith("#")&&(n=t.getElementById(e.slice(1)))}return n},deepCopy:function(t,e){if("Object"===o.typeOf(e)&&"Object"===o.typeOf(t))return Object.keys(e).forEach(function(n){"Object"!==o.typeOf(e[n])||e[n]instanceof Node?"Array"===o.typeOf(e[n])?t[n]="Array"===o.typeOf(t[n])?t[n].concat(e[n]):e[n]:t[n]=e[n]:t[n]?o.deepCopy(t[n],e[n]):t[n]=e[n]}),t},typeOf:function(t){return Object.prototype.toString.call(t).match(/([^\s.*]+)(?=]$)/g)[0]},copyDom:function(t){if(t&&1===t.nodeType){var e=document.createElement(t.tagName);return Array.prototype.forEach.call(t.attributes,function(t){e.setAttribute(t.name,t.value)}),t.innerHTML&&(e.innerHTML=t.innerHTML),e}return""},formatTime:function(t){var e=Math.floor(t);return 1e3*e+(t-e)}};e.default=o,t.exports=e.default},function(t,e,n){"use strict";var o=n(13)();t.exports=function(t){return t!==o&&null!==t}},function(t,e,n){t.exports=n(3)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o,i=n(4),r=(o=i)&&o.__esModule?o:{default:o};n(25),e.default=r.default,t.exports=e.default},function(t,n,o){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,n,o){return n&&t(e.prototype,n),o&&t(e,o),e}}(),r=u(o(5)),a=u(o(21)),s=u(o(0));function u(t){return t&&t.__esModule?t:{default:t}}var c=function(){function t(n){var o=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.config=s.default.deepCopy({overlap:!1,area:{start:0,end:1},comments:[]},n),this.hideArr=[],(0,r.default)(this);var i=this;if(this.config.comments.forEach(function(t){t.duration=t.duration<5e3?5e3:t.duration,t.mode||(t.mode="scroll")}),!this.config.container||1!==this.config.container.nodeType)return this.emit("error","container id can't be empty"),!1;if(this.container=this.config.container,this.config.containerStyle){var u=this.config.containerStyle;Object.keys(u).forEach(function(t){i.container.style[t]=u[t]})}this.player=this.config.player,s.default.addClass(this.container,"danmu"),this.bulletBtn=new a.default(this),["touchend","click","dblclick"].forEach(function(t){o.container.addEventListener(t,function(){if(e.preventDefault(),e.stopPropagation(),i.player){var n=void 0;document.createEvent?(n=document.createEvent("Event")).initEvent(t,!0,!0):n=new Event(t),i.player.dispatchEvent(n)}},!1)}),this.emit("ready")}return i(t,[{key:"start",value:function(){this.bulletBtn.main.start()}},{key:"pause",value:function(){this.bulletBtn.main.pause()}},{key:"play",value:function(){this.bulletBtn.main.play()}},{key:"stop",value:function(){this.bulletBtn.main.stop()}},{key:"sendComment",value:function(t){t&&t.id&&t.duration&&(t.el||t.txt)&&(t.duration=t.duration<5e3?5e3:t.duration,this.bulletBtn.main.data.push(t))}},{key:"setCommentID",value:function(t,e){var n=this.container.getBoundingClientRect();t&&e&&(this.bulletBtn.main.data.some(function(n){return n.id===t&&(n.id=e,!0)}),this.bulletBtn.main.queue.some(function(o){return o.id===t&&(o.id=e,o.pauseMove(n),o.startMove(n),!0)}))}},{key:"setCommentDuration",value:function(t,e){var n=this.container.getBoundingClientRect();t&&e&&(e=e<5e3?5e3:e,this.bulletBtn.main.data.some(function(n){return n.id===t&&(n.duration=e,!0)}),this.bulletBtn.main.queue.some(function(o){return o.id===t&&(o.duration=e,o.pauseMove(n),o.startMove(n),!0)}))}},{key:"setAllDuration",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"scroll",e=arguments[1],n=this.container.getBoundingClientRect();e&&(e=e<5e3?5e3:e,this.bulletBtn.main.data.forEach(function(n){t===n.mode&&(n.duration=e)}),this.bulletBtn.main.queue.forEach(function(o){t===o.mode&&(o.duration=e,o.pauseMove(n),o.startMove(n))}))}},{key:"hide",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"scroll";this.hideArr.indexOf(t)<0&&this.hideArr.push(t),this.bulletBtn.main.queue.filter(function(e){return t===e.mode||"color"===t&&e.color}).forEach(function(t){return t.remove()})}},{key:"show",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"scroll",e=this.hideArr.indexOf(t);e>-1&&this.hideArr.splice(e,1)}}]),t}();n.default=c,t.exports=n.default},function(t,e,n){"use strict";var o,i,r,a,s,u,c,l=n(6),f=n(20),h=Function.prototype.apply,d=Function.prototype.call,p=Object.create,m=Object.defineProperty,v=Object.defineProperties,g=Object.prototype.hasOwnProperty,b={configurable:!0,enumerable:!1,writable:!0};i=function(t,e){var n,i;return f(e),i=this,o.call(this,t,n=function(){r.call(i,t,n),h.call(e,this,arguments)}),n.__eeOnceListener__=e,this},s={on:o=function(t,e){var n;return f(e),g.call(this,"__ee__")?n=this.__ee__:(n=b.value=p(null),m(this,"__ee__",b),b.value=null),n[t]?"object"==typeof n[t]?n[t].push(e):n[t]=[n[t],e]:n[t]=e,this},once:i,off:r=function(t,e){var n,o,i,r;if(f(e),!g.call(this,"__ee__"))return this;if(!(n=this.__ee__)[t])return this;if("object"==typeof(o=n[t]))for(r=0;i=o[r];++r)i!==e&&i.__eeOnceListener__!==e||(2===o.length?n[t]=o[r?0:1]:o.splice(r,1));else o!==e&&o.__eeOnceListener__!==e||delete n[t];return this},emit:a=function(t){var e,n,o,i,r;if(g.call(this,"__ee__")&&(i=this.__ee__[t]))if("object"==typeof i){for(n=arguments.length,r=new Array(n-1),e=1;e<n;++e)r[e-1]=arguments[e];for(i=i.slice(),e=0;o=i[e];++e)h.call(o,this,r)}else switch(arguments.length){case 1:d.call(i,this);break;case 2:d.call(i,this,arguments[1]);break;case 3:d.call(i,this,arguments[1],arguments[2]);break;default:for(n=arguments.length,r=new Array(n-1),e=1;e<n;++e)r[e-1]=arguments[e];h.call(i,this,r)}}},u={on:l(o),once:l(i),off:l(r),emit:l(a)},c=v({},u),t.exports=e=function(t){return null==t?p(c):v(Object(t),u)},e.methods=s},function(t,e,n){"use strict";var o=n(7),i=n(15),r=n(16),a=n(17);(t.exports=function(t,e){var n,r,s,u,c;return arguments.length<2||"string"!=typeof t?(u=e,e=t,t=null):u=arguments[2],null==t?(n=s=!0,r=!1):(n=a.call(t,"c"),r=a.call(t,"e"),s=a.call(t,"w")),c={value:e,configurable:n,enumerable:r,writable:s},u?o(i(u),c):c}).gs=function(t,e,n){var s,u,c,l;return"string"!=typeof t?(c=n,n=e,e=t,t=null):c=arguments[3],null==e?e=void 0:r(e)?null==n?n=void 0:r(n)||(c=n,n=void 0):(c=e,e=n=void 0),null==t?(s=!0,u=!1):(s=a.call(t,"c"),u=a.call(t,"e")),l={get:e,set:n,configurable:s,enumerable:u},c?o(i(c),l):l}},function(t,e,n){"use strict";t.exports=n(8)()?Object.assign:n(9)},function(t,e,n){"use strict";t.exports=function(){var t,e=Object.assign;return"function"==typeof e&&(e(t={foo:"raz"},{bar:"dwa"},{trzy:"trzy"}),t.foo+t.bar+t.trzy==="razdwatrzy")}},function(t,e,n){"use strict";var o=n(10),i=n(14),r=Math.max;t.exports=function(t,e){var n,a,s,u=r(arguments.length,2);for(t=Object(i(t)),s=function(o){try{t[o]=e[o]}catch(t){n||(n=t)}},a=1;a<u;++a)e=arguments[a],o(e).forEach(s);if(void 0!==n)throw n;return t}},function(t,e,n){"use strict";t.exports=n(11)()?Object.keys:n(12)},function(t,e,n){"use strict";t.exports=function(){try{return Object.keys("primitive"),!0}catch(t){return!1}}},function(t,e,n){"use strict";var o=n(1),i=Object.keys;t.exports=function(t){return i(o(t)?Object(t):t)}},function(t,e,n){"use strict";t.exports=function(){}},function(t,e,n){"use strict";var o=n(1);t.exports=function(t){if(!o(t))throw new TypeError("Cannot use null or undefined");return t}},function(t,e,n){"use strict";var o=n(1),i=Array.prototype.forEach,r=Object.create;t.exports=function(t){var e=r(null);return i.call(arguments,function(t){o(t)&&function(t,e){var n;for(n in t)e[n]=t[n]}(Object(t),e)}),e}},function(t,e,n){"use strict";t.exports=function(t){return"function"==typeof t}},function(t,e,n){"use strict";t.exports=n(18)()?String.prototype.contains:n(19)},function(t,e,n){"use strict";var o="razdwatrzy";t.exports=function(){return"function"==typeof o.contains&&(!0===o.contains("dwa")&&!1===o.contains("foo"))}},function(t,e,n){"use strict";var o=String.prototype.indexOf;t.exports=function(t){return o.call(this,t,arguments[1])>-1}},function(t,e,n){"use strict";t.exports=function(t){if("function"!=typeof t)throw new TypeError(t+" is not a function");return t}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=function(){function t(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,n,o){return n&&t(e.prototype,n),o&&t(e,o),e}}(),i=a(n(0)),r=a(n(22));function a(t){return t&&t.__esModule?t:{default:t}}var s=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.danmu=e,this.main=new r.default(e),e.config.defaultOff||this.main.start()}return o(t,[{key:"createSwitch",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.switchBtn=i.default.createDom("dk-switch",'<span class="txt">弹</span>',{},"danmu-switch "+(t?"danmu-switch-active":"")),this.switchBtn}}]),t}();e.default=s,t.exports=e.default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=function(){function t(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,n,o){return n&&t(e.prototype,n),o&&t(e,o),e}}(),i=s(n(23)),r=s(n(24)),a=s(n(0));function s(t){return t&&t.__esModule?t:{default:t}}var u=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.danmu=e,this.container=e.container,this.channel=new i.default(e),this.data=[].concat(e.config.comments),this.queue=[],this.timer=null,this.retryTimer=null,this.interval=2e3,this.status="idle",e.on("bullet_remove",this.updateQueue.bind(this))}return o(t,[{key:"updateQueue",value:function(t){var e=this;e.queue.some(function(n,o){return n.id===t.bullet.id&&(e.queue.splice(o,1),!0)})}},{key:"init",value:function(t,e){e||(e=this),e.data.sort(function(t,e){return t.start-e.start}),e.retryTimer||(e.retryTimer=setInterval(function(){e.readData(),e.dataHandle()},e.interval-1e3))}},{key:"start",value:function(){this.status="playing",this.queue=[],this.container.innerHTML="",this.channel.resetWithCb(this.init,this)}},{key:"stop",value:function(){this.status="closed",clearInterval(this.retryTimer),this.retryTimer=null,this.channel.reset(),this.queue=[],this.container.innerHTML=""}},{key:"play",value:function(){this.status="playing";var t=this.channel.channels,e=this.danmu.container.getBoundingClientRect();t&&t.length>0&&["scroll","top","bottom"].forEach(function(n){for(var o=0;o<t.length;o++)t[o].queue[n].forEach(function(t){t.resized||(t.startMove(e),t.resized=!0)});for(var i=0;i<t.length;i++)t[i].queue[n].forEach(function(t){t.resized=!1})})}},{key:"pause",value:function(){this.status="paused";var t=this.channel.channels,e=this.danmu.container.getBoundingClientRect();t&&t.length>0&&["scroll","top","bottom"].forEach(function(n){for(var o=0;o<t.length;o++)t[o].queue[n].forEach(function(t){t.pauseMove(e)})})}},{key:"dataHandle",value:function(){var t=this;"paused"!==this.status&&"closed"!==this.status&&t.queue.length&&t.queue.forEach(function(e){"waiting"!==e.status&&"paused"!==e.status||e.startMove(t.channel.containerPos)})}},{key:"readData",value:function(){var t=this,e=this.danmu,n=0;e.player&&e.player.currentTime&&(n=a.default.formatTime(e.player.currentTime));var o=void 0,i=t.interval,s=t.channel,u=void 0;(u=e.player?t.data.filter(function(e){return!e.start&&t.danmu.hideArr.indexOf(e.mode)<0&&(!e.color||t.danmu.hideArr.indexOf("color")<0)&&(e.start=n),t.danmu.hideArr.indexOf(e.mode)<0&&(!e.color||t.danmu.hideArr.indexOf("color")<0)&&e.start-i<=n&&n<=e.start+i}):t.data.filter(function(e){return t.danmu.hideArr.indexOf(e.mode)<0&&(!e.color||t.danmu.hideArr.indexOf("color")<0)})).length>0&&u.forEach(function(n){(o=new r.default(e,n)).attach(),s.addBullet(o).result?(t.queue.push(o),o.topInit()):o.detach()})}}]),t}();e.default=u,t.exports=e.default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=function(){function t(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,n,o){return n&&t(e.prototype,n),o&&t(e,o),e}}();var i=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.danmu=e,this.reset();var n=this;this.danmu.on("bullet_remove",function(t){n.removeBullet(t.bullet)}),this.containerPos=this.danmu.container.getBoundingClientRect(),this.containerWidth=this.containerPos.width,this.containerHeight=this.containerPos.height,this.containerLeft=this.containerPos.left,this.containerRight=this.containerPos.right,this.danmu.bulletResizeTimer=setInterval(function(){n.containerPos=n.danmu.container.getBoundingClientRect(),(Math.abs(n.containerPos.width-n.containerWidth)>=2||Math.abs(n.containerPos.height-n.containerHeight)>=2||Math.abs(n.containerPos.left-n.containerLeft)>=2||Math.abs(n.containerPos.right-n.containerRight)>=2)&&(n.containerWidth=n.containerPos.width,n.containerHeight=n.containerPos.height,n.containerLeft=n.containerPos.left,n.containerRight=n.containerPos.right,n.resize(!0))},50)}return o(t,[{key:"resize",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=this.danmu.container,n=this;setTimeout(function(){n.danmu.bulletBtn.main.data&&n.danmu.bulletBtn.main.data.forEach(function(t){t.bookChannelId&&delete t.bookChannelId});var o=e.getBoundingClientRect();n.width=o.width,n.height=o.height,n.danmu.config.area&&n.danmu.config.area.start>=0&&n.danmu.config.area.end>=n.danmu.config.area.start&&(n.height=n.height*(n.danmu.config.area.end-n.danmu.config.area.start)),n.container=e;for(var i=/mobile/gi.test(navigator.userAgent)?10:12,r=Math.floor(n.height/i),a=[],s=0;s<r;s++)a[s]={id:s,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}};if(n.channels&&n.channels.length<=a.length){for(var u=function(e){a[e]={id:e,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}},["scroll","top"].forEach(function(o){n.channels[e].queue[o].forEach(function(i){i.el&&(a[e].queue[o].push(i),i.resized||(i.pauseMove(n.containerPos,t),i.startMove(n.containerPos),i.resized=!0))})}),n.channels[e].queue.bottom.forEach(function(o){if(o.el){if(a[e+a.length-n.channels.length].queue.bottom.push(o),o.channel_id[0]+o.channel_id[1]-1===e){var r=[].concat(o.channel_id);o.channel_id=[r[0]-n.channels.length+a.length,r[1]],o.top=o.channel_id[0]*i,n.danmu.config.area&&n.danmu.config.area.start&&(o.top+=n.containerHeight*n.danmu.config.area.start),o.topInit()}o.resized||(o.pauseMove(n.containerPos,t),o.startMove(n.containerPos),o.resized=!0)}})},c=0;c<n.channels.length;c++)u(c);for(var l=function(t){["scroll","top","bottom"].forEach(function(e){a[t].queue[e].forEach(function(t){t.resized=!1})})},f=0;f<a.length;f++)l(f);n.channels=a,n.channelHeight=i}else if(n.channels&&n.channels.length>a.length){for(var h=function(e){a[e]={id:e,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}},["scroll","top","bottom"].forEach(function(o){if("top"===o&&e>Math.floor(a.length/2));else if("bottom"===o&&e<=Math.floor(a.length/2));else{var r="bottom"===o?e-a.length+n.channels.length:e;n.channels[r].queue[o].forEach(function(s,u){if(s.el){if(a[e].queue[o].push(s),"bottom"===o&&s.channel_id[0]+s.channel_id[1]-1===r){var c=[].concat(s.channel_id);s.channel_id=[c[0]-n.channels.length+a.length,c[1]],s.top=s.channel_id[0]*i,n.danmu.config.area&&n.danmu.config.area.start&&(s.top+=n.containerHeight*n.danmu.config.area.start),s.topInit()}s.resized||(s.pauseMove(n.containerPos,t),s.startMove(n.containerPos),s.resized=!0)}n.channels[r].queue[o].splice(u,1)})}})},d=0;d<a.length;d++)h(d);for(var p=function(t){["scroll","top","bottom"].forEach(function(e){n.channels[t].queue[e].forEach(function(t){t.pauseMove(n.containerPos),t.remove()})})},m=a.length;m<n.channels.length;m++)p(m);for(var v=function(t){["scroll","top","bottom"].forEach(function(e){a[t].queue[e].forEach(function(t){t.resized=!1})})},g=0;g<a.length;g++)v(g);n.channels=a,n.channelHeight=i}},10)}},{key:"addBullet",value:function(t){var e=this.danmu,n=this.channels,o=this.channelHeight,i=Math.ceil(t.height/o);if(i>n.length)return{result:!1,message:"exceed channels.length, occupy="+i+",channelsSize="+n.length};for(var r=!0,a=void 0,s=-1,u=0,c=n.length;u<c;u++)if(n[u].queue[t.mode].some(function(e){return e.id===t.id}))return{result:!1,message:"exsited, channelOrder="+u+",danmu_id="+t.id};if("scroll"===t.mode)for(var l=0,f=n.length-i;l<=f;l++){r=!0;for(var h=l;h<l+i;h++){if((a=n[h]).operating.scroll){r=!1;break}if((a.bookId.scroll||t.prior)&&a.bookId.scroll!==t.id){r=!1;break}a.operating.scroll=!0;var d=a.queue.scroll[0];if(d){var p=d.el.getBoundingClientRect();if(p.right>this.containerPos.right){r=!1,a.operating.scroll=!1;break}var m=p.left-this.containerPos.left+p.width,v=(this.containerPos.width+p.width)/d.duration,g=m/v,b=this.containerPos.width,y=(this.containerPos.width+t.width)/t.duration,w=b/y;if(e.config.bOffset||(e.config.bOffset=0),v<y&&g+e.config.bOffset>w){r=!1,a.operating.scroll=!1;break}}a.operating.scroll=!1}if(r){s=l;break}}else if("top"===t.mode)for(var x=0,k=n.length-i;x<=k;x++){r=!0;for(var _=x;_<x+i;_++){if(_>Math.floor(n.length/2)){r=!1;break}if((a=n[_]).operating[t.mode]){r=!1;break}if((a.bookId[t.mode]||t.prior)&&a.bookId[t.mode]!==t.id){r=!1;break}if(a.operating[t.mode]=!0,a.queue[t.mode].length>0){r=!1,a.operating[t.mode]=!1;break}a.operating[t.mode]=!1}if(r){s=x;break}}else if("bottom"===t.mode)for(var O=n.length-i;O>=0;O--){r=!0;for(var M=O;M<O+i;M++){if(M<=Math.floor(n.length/2)){r=!1;break}if((a=n[M]).operating[t.mode]){r=!1;break}if((a.bookId[t.mode]||t.prior)&&a.bookId[t.mode]!==t.id){r=!1;break}if(a.operating[t.mode]=!0,a.queue[t.mode].length>0){r=!1,a.operating[t.mode]=!1;break}a.operating[t.mode]=!1}if(r){s=O;break}}if(-1!==s){for(var C=s,E=s+i;C<E;C++)(a=n[C]).operating[t.mode]=!0,a.queue[t.mode].unshift(t),t.prior&&delete a.bookId[t.mode],a.operating[t.mode]=!1;if(t.prior)delete t.bookChannelId,e.bulletBtn.main.data.some(function(e){return e.id===t.id&&(delete e.bookChannelId,!0)});return t.channel_id=[s,i],t.top=s*o,this.danmu.config.area&&this.danmu.config.area.start&&(t.top+=this.containerHeight*this.danmu.config.area.start),{result:t,message:"success"}}if(t.prior)if(t.bookChannelId){e.bulletBtn.main.data.some(function(e){return e.id===t.id&&(e.start+=2e3,!0)})}else{s=-1;for(var j=0,T=n.length-i;j<=T;j++){r=!0;for(var P=j;P<j+i;P++)if(n[P].bookId[t.mode]){r=!1;break}if(r){s=j;break}}if(-1!==s){for(var B=s;B<s+i;B++)n[B].bookId[t.mode]=t.id;e.bulletBtn.main.data.some(function(e){return e.id===t.id&&(e.start+=2e3,e.bookChannelId=[s,i],!0)})}}return{result:!1,message:"no surplus will right"}}},{key:"removeBullet",value:function(t){for(var e=this.channels,n=t.channel_id,o=void 0,i=n[0],r=n[0]+n[1];i<r;i++)if(o=e[i]){o.operating[t.mode]=!0;var a=-1;o.queue[t.mode].some(function(e,n){return e.id===t.id&&(a=n,!0)}),a>-1&&o.queue[t.mode].splice(a,1),o.operating[t.mode]=!1}}},{key:"reset",value:function(){var t=this.danmu.container,e=this;e.channels&&e.channels.length>0&&["scroll","top","bottom"].forEach(function(t){for(var n=0;n<e.channels.length;n++)e.channels[n].queue[t].forEach(function(t){t.pauseMove(e.containerPos),t.remove()})}),setTimeout(function(){var n=t.getBoundingClientRect();e.width=n.width,e.height=n.height,e.danmu.config.area&&e.danmu.config.area.start>=0&&e.danmu.config.area.end>=e.danmu.config.area.start&&(e.height=e.height*(e.danmu.config.area.end-e.danmu.config.area.start)),e.container=t;for(var o=/mobile/gi.test(navigator.userAgent)?10:12,i=Math.floor(e.height/o),r=[],a=0;a<i;a++)r[a]={id:a,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}};e.channels=r,e.channelHeight=o},200)}},{key:"resetWithCb",value:function(t,e){var n=this.danmu.container,o=this;o.channels&&o.channels.length>0&&["scroll","top","bottom"].forEach(function(t){for(var e=0;e<o.channels.length;e++)o.channels[e].queue[t].forEach(function(t){t.pauseMove(o.containerPos),t.remove()})});var i=n.getBoundingClientRect();o.width=i.width,o.height=i.height,o.danmu.config.area&&o.danmu.config.area.start>=0&&o.danmu.config.area.end>=o.danmu.config.area.start&&(o.height=o.height*(o.danmu.config.area.end-o.danmu.config.area.start)),o.container=n;for(var r=/mobile/gi.test(navigator.userAgent)?10:12,a=Math.floor(o.height/r),s=[],u=0;u<a;u++)s[u]={id:u,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}};o.channels=s,o.channelHeight=r,t&&t(!0,e)}}]),t}();e.default=i,t.exports=e.default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o,i=function(){function t(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,n,o){return n&&t(e.prototype,n),o&&t(e,o),e}}(),r=n(0),a=(o=r)&&o.__esModule?o:{default:o};var s=function(){function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.danmu=e,this.duration=n.duration,this.id=n.id,this.container=e.container,this.start=n.start,this.prior=n.prior,this.color=n.color,this.bookChannelId=n.bookChannelId;var o=void 0;if(n.el&&1===n.el.nodeType)o=a.default.copyDom(n.el);else if((o=document.createElement("div")).textContent=n.txt,n.style){var i=n.style;Object.keys(i).forEach(function(t){o.style[t]=i[t]})}"top"===n.mode||"bottom"===n.mode?this.mode=n.mode:this.mode="scroll",this.el=o,this.status="waiting";var r=this.container.getBoundingClientRect();this.el.style.left=r.width+"px"}return i(t,[{key:"attach",value:function(){this.container.appendChild(this.el),this.elPos=this.el.getBoundingClientRect(),this.width=this.elPos.width,this.height=this.elPos.height}},{key:"detach",value:function(){this.container&&this.el&&this.container.removeChild(this.el),this.el=null}},{key:"topInit",value:function(){this.el.style.top=this.top+"px"}},{key:"pauseMove",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if("paused"!==this.status&&(this.status="paused",clearTimeout(this.removeTimer),this.el))if("scroll"===this.mode){if(e){var n=((new Date).getTime()-this.moveTime)/1e3*this.moveV,o=0;o=this.moveMoreS-n>=0?(this.moveMoreS-n)/this.moveContainerWidth*t.width:this.moveMoreS-n,this.el.style.left=o+"px"}else this.el.style.left=this.el.getBoundingClientRect().left-t.left+"px";this.el.style.transform="translateX(0px) translateY(0px) translateZ(0px)",this.el.style.transition="transform 0s linear 0s"}else this.pastDuration&&this.startTime?this.pastDuration=this.pastDuration+(new Date).getTime()-this.startTime:this.pastDuration=1}},{key:"startMove",value:function(t){var e=this;if(this.el&&"start"!==this.status)if(this.status="start","scroll"===this.mode){this.moveV=(t.width+this.width)/this.duration*1e3;var n=(e.el.getBoundingClientRect().right-t.left)/this.moveV;this.el.style.transition="transform "+n+"s linear 0s",setTimeout(function(){e.el&&(e.el.style.transform="translateX(-"+(e.el.getBoundingClientRect().right-t.left)+"px) translateY(0px) translateZ(0px)",e.moveTime=(new Date).getTime(),e.moveMoreS=e.el.getBoundingClientRect().left-t.left,e.moveContainerWidth=t.width,e.removeTimer=setTimeout(i,1e3*n))},20)}else{this.el.style.left="50%",this.el.style.margin="0 0 0 -"+this.width/2+"px",this.pastDuration||(this.pastDuration=1);var o=this.duration>=this.pastDuration?this.duration-this.pastDuration:0;this.removeTimer=setTimeout(i,o),this.startTime=(new Date).getTime()}function i(){if(e.el)if("scroll"===e.mode){var t=e.danmu.container.getBoundingClientRect(),n=e.el.getBoundingClientRect();n&&n.right<=t.left+100?(e.status="end",e.remove()):(e.pauseMove(t),e.startMove(t))}else e.status="end",e.remove()}}},{key:"remove",value:function(){(this.removeTimer&&clearTimeout(this.removeTimer),this.el&&this.el.parentNode)&&(this.el.parentNode.removeChild(this.el),this.el=null,this.danmu.emit("bullet_remove",{bullet:this}))}}]),t}();e.default=s,t.exports=e.default},function(t,e,n){var o=n(26);"string"==typeof o&&(o=[[t.i,o,""]]);var i={hmr:!0,transform:void 0,insertInto:void 0};n(28)(o,i);o.locals&&(t.exports=o.locals)},function(t,e,n){(t.exports=n(27)(!1)).push([t.i,".danmu{overflow:hidden;-webkit-user-select:none;-moz-user-select:none;user-select:none;-ms-user-select:none}.danmu>*{position:absolute;white-space:nowrap}.danmu-switch{width:32px;height:20px;border-radius:100px;background-color:#ccc;-webkit-box-sizing:border-box;box-sizing:border-box;outline:none;cursor:pointer;position:relative;text-align:center;margin:10px auto}.danmu-switch.danmu-switch-active{padding-left:12px;background-color:#f85959}.danmu-switch span.txt{width:20px;height:20px;line-height:20px;text-align:center;display:block;border-radius:100px;background-color:#ffffff;-webkit-box-shadow:-2px 0 0 0 rgba(0, 0, 0, .04);box-shadow:-2px 0 0 0 rgba(0, 0, 0, .04);font-family:PingFangSC;font-size:10px;font-weight:500;color:#f44336}\n",""])},function(t,e){t.exports=function(t){var e=[];return e.toString=function(){return this.map(function(e){var n=function(t,e){var n=t[1]||"",o=t[3];if(!o)return n;if(e&&"function"==typeof btoa){var i=(a=o,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(a))))+" */"),r=o.sources.map(function(t){return"/*# sourceURL="+o.sourceRoot+t+" */"});return[n].concat(r).concat([i]).join("\n")}var a;return[n].join("\n")}(e,t);return e[2]?"@media "+e[2]+"{"+n+"}":n}).join("")},e.i=function(t,n){"string"==typeof t&&(t=[[null,t,""]]);for(var o={},i=0;i<this.length;i++){var r=this[i][0];"number"==typeof r&&(o[r]=!0)}for(i=0;i<t.length;i++){var a=t[i];"number"==typeof a[0]&&o[a[0]]||(n&&!a[2]?a[2]=n:n&&(a[2]="("+a[2]+") and ("+n+")"),e.push(a))}},e}},function(t,e,n){var o,i,r={},a=(o=function(){return window&&document&&document.all&&!window.atob},function(){return void 0===i&&(i=o.apply(this,arguments)),i}),s=function(t){var e={};return function(t){if("function"==typeof t)return t();if(void 0===e[t]){var n=function(t){return document.querySelector(t)}.call(this,t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(t){n=null}e[t]=n}return e[t]}}(),u=null,c=0,l=[],f=n(29);function h(t,e){for(var n=0;n<t.length;n++){var o=t[n],i=r[o.id];if(i){i.refs++;for(var a=0;a<i.parts.length;a++)i.parts[a](o.parts[a]);for(;a<o.parts.length;a++)i.parts.push(b(o.parts[a],e))}else{var s=[];for(a=0;a<o.parts.length;a++)s.push(b(o.parts[a],e));r[o.id]={id:o.id,refs:1,parts:s}}}}function d(t,e){for(var n=[],o={},i=0;i<t.length;i++){var r=t[i],a=e.base?r[0]+e.base:r[0],s={css:r[1],media:r[2],sourceMap:r[3]};o[a]?o[a].parts.push(s):n.push(o[a]={id:a,parts:[s]})}return n}function p(t,e){var n=s(t.insertInto);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");var o=l[l.length-1];if("top"===t.insertAt)o?o.nextSibling?n.insertBefore(e,o.nextSibling):n.appendChild(e):n.insertBefore(e,n.firstChild),l.push(e);else if("bottom"===t.insertAt)n.appendChild(e);else{if("object"!=typeof t.insertAt||!t.insertAt.before)throw new Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n");var i=s(t.insertInto+" "+t.insertAt.before);n.insertBefore(e,i)}}function m(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t);var e=l.indexOf(t);e>=0&&l.splice(e,1)}function v(t){var e=document.createElement("style");return void 0===t.attrs.type&&(t.attrs.type="text/css"),g(e,t.attrs),p(t,e),e}function g(t,e){Object.keys(e).forEach(function(n){t.setAttribute(n,e[n])})}function b(t,e){var n,o,i,r;if(e.transform&&t.css){if(!(r=e.transform(t.css)))return function(){};t.css=r}if(e.singleton){var a=c++;n=u||(u=v(e)),o=x.bind(null,n,a,!1),i=x.bind(null,n,a,!0)}else t.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=function(t){var e=document.createElement("link");return void 0===t.attrs.type&&(t.attrs.type="text/css"),t.attrs.rel="stylesheet",g(e,t.attrs),p(t,e),e}(e),o=function(t,e,n){var o=n.css,i=n.sourceMap,r=void 0===e.convertToAbsoluteUrls&&i;(e.convertToAbsoluteUrls||r)&&(o=f(o));i&&(o+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(i))))+" */");var a=new Blob([o],{type:"text/css"}),s=t.href;t.href=URL.createObjectURL(a),s&&URL.revokeObjectURL(s)}.bind(null,n,e),i=function(){m(n),n.href&&URL.revokeObjectURL(n.href)}):(n=v(e),o=function(t,e){var n=e.css,o=e.media;o&&t.setAttribute("media",o);if(t.styleSheet)t.styleSheet.cssText=n;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(n))}}.bind(null,n),i=function(){m(n)});return o(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;o(t=e)}else i()}}t.exports=function(t,e){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(e=e||{}).attrs="object"==typeof e.attrs?e.attrs:{},e.singleton||"boolean"==typeof e.singleton||(e.singleton=a()),e.insertInto||(e.insertInto="head"),e.insertAt||(e.insertAt="bottom");var n=d(t,e);return h(n,e),function(t){for(var o=[],i=0;i<n.length;i++){var a=n[i];(s=r[a.id]).refs--,o.push(s)}t&&h(d(t,e),e);for(i=0;i<o.length;i++){var s;if(0===(s=o[i]).refs){for(var u=0;u<s.parts.length;u++)s.parts[u]();delete r[s.id]}}}};var y,w=(y=[],function(t,e){return y[t]=e,y.filter(Boolean).join("\n")});function x(t,e,n,o){var i=n?"":o.css;if(t.styleSheet)t.styleSheet.cssText=w(e,i);else{var r=document.createTextNode(i),a=t.childNodes;a[e]&&t.removeChild(a[e]),a.length?t.insertBefore(r,a[e]):t.appendChild(r)}}},function(t,e){t.exports=function(t){var e="undefined"!=typeof window&&window.location;if(!e)throw new Error("fixUrls requires window.location");if(!t||"string"!=typeof t)return t;var n=e.protocol+"//"+e.host,o=n+e.pathname.replace(/\/[^\/]*$/,"/");return t.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,function(t,e){var i,r=e.trim().replace(/^"(.*)"$/,function(t,e){return e}).replace(/^'(.*)'$/,function(t,e){return e});return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(r)?t:(i=0===r.indexOf("//")?r:0===r.indexOf("/")?n+r:o+r.replace(/^\.\//,""),"url("+JSON.stringify(i)+")")})}}])}); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports["danmu.js"]=e():t["danmu.js"]=e()}(window,function(){return function(t){var e={};function n(o){if(e[o])return e[o].exports;var i=e[o]={i:o,l:!1,exports:{}};return t[o].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(o,i,function(e){return t[e]}.bind(null,i));return o},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=2)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o={createDom:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"div",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",i=document.createElement(t);return i.className=o,i.innerHTML=e,Object.keys(n).forEach(function(e){var o=e,r=n[e];"video"===t||"audio"===t?r&&i.setAttribute(o,r):i.setAttribute(o,r)}),i},hasClass:function(t,e){return t.classList?Array.prototype.some.call(t.classList,function(t){return t===e}):!!t.className.match(new RegExp("(\\s|^)"+e+"(\\s|$)"))},addClass:function(t,e){t.classList?e.replace(/(^\s+|\s+$)/g,"").split(/\s+/g).forEach(function(e){e&&t.classList.add(e)}):o.hasClass(t,e)||(t.className+=" "+e)},removeClass:function(t,e){t.classList?e.split(/\s+/g).forEach(function(e){t.classList.remove(e)}):o.hasClass(t,e)&&e.split(/\s+/g).forEach(function(e){var n=new RegExp("(\\s|^)"+e+"(\\s|$)");t.className=t.className.replace(n," ")})},toggleClass:function(t,e){e.split(/\s+/g).forEach(function(e){o.hasClass(t,e)?o.removeClass(t,e):o.addClass(t,e)})},findDom:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,e=arguments[1],n=void 0;try{n=t.querySelector(e)}catch(o){e.startsWith("#")&&(n=t.getElementById(e.slice(1)))}return n},deepCopy:function(t,e){if("Object"===o.typeOf(e)&&"Object"===o.typeOf(t))return Object.keys(e).forEach(function(n){"Object"!==o.typeOf(e[n])||e[n]instanceof Node?"Array"===o.typeOf(e[n])?t[n]="Array"===o.typeOf(t[n])?t[n].concat(e[n]):e[n]:t[n]=e[n]:t[n]?o.deepCopy(t[n],e[n]):t[n]=e[n]}),t},typeOf:function(t){return Object.prototype.toString.call(t).match(/([^\s.*]+)(?=]$)/g)[0]},copyDom:function(t){if(t&&1===t.nodeType){var e=document.createElement(t.tagName);return Array.prototype.forEach.call(t.attributes,function(t){e.setAttribute(t.name,t.value)}),t.innerHTML&&(e.innerHTML=t.innerHTML),e}return""},formatTime:function(t){var e=Math.floor(t);return 1e3*e+(t-e)}};e.default=o,t.exports=e.default},function(t,e,n){"use strict";var o=n(13)();t.exports=function(t){return t!==o&&null!==t}},function(t,e,n){t.exports=n(3)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o,i=n(4),r=(o=i)&&o.__esModule?o:{default:o};n(25),e.default=r.default,t.exports=e.default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=function(){function t(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,n,o){return n&&t(e.prototype,n),o&&t(e,o),e}}(),i=s(n(5)),r=s(n(21)),a=s(n(0));function s(t){return t&&t.__esModule?t:{default:t}}var u=function(){function t(e){var n=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.config=a.default.deepCopy({overlap:!1,area:{start:0,end:1},comments:[]},e),this.hideArr=[],(0,i.default)(this);var o=this;if(this.config.comments.forEach(function(t){t.duration=t.duration<5e3?5e3:t.duration,t.mode||(t.mode="scroll")}),!this.config.container||1!==this.config.container.nodeType)return this.emit("error","container id can't be empty"),!1;if(this.container=this.config.container,this.config.containerStyle){var s=this.config.containerStyle;Object.keys(s).forEach(function(t){o.container.style[t]=s[t]})}this.player=this.config.player,a.default.addClass(this.container,"danmu"),this.bulletBtn=new r.default(this),["touchend","click","dblclick"].forEach(function(t){n.container.addEventListener(t,function(e){if(e.preventDefault(),e.stopPropagation(),o.player){var n=void 0;document.createEvent?(n=document.createEvent("Event")).initEvent(t,!0,!0):n=new Event(t),o.player.dispatchEvent(n)}},!1)}),this.emit("ready")}return o(t,[{key:"start",value:function(){this.bulletBtn.main.start()}},{key:"pause",value:function(){this.bulletBtn.main.pause()}},{key:"play",value:function(){this.bulletBtn.main.play()}},{key:"stop",value:function(){this.bulletBtn.main.stop()}},{key:"sendComment",value:function(t){t&&t.id&&t.duration&&(t.el||t.txt)&&(t.duration=t.duration<5e3?5e3:t.duration,this.bulletBtn.main.data.push(t))}},{key:"setCommentID",value:function(t,e){var n=this.container.getBoundingClientRect();t&&e&&(this.bulletBtn.main.data.some(function(n){return n.id===t&&(n.id=e,!0)}),this.bulletBtn.main.queue.some(function(o){return o.id===t&&(o.id=e,o.pauseMove(n),o.startMove(n),!0)}))}},{key:"setCommentDuration",value:function(t,e){var n=this.container.getBoundingClientRect();t&&e&&(e=e<5e3?5e3:e,this.bulletBtn.main.data.some(function(n){return n.id===t&&(n.duration=e,!0)}),this.bulletBtn.main.queue.some(function(o){return o.id===t&&(o.duration=e,o.pauseMove(n),o.startMove(n),!0)}))}},{key:"setAllDuration",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"scroll",e=arguments[1],n=this.container.getBoundingClientRect();e&&(e=e<5e3?5e3:e,this.bulletBtn.main.data.forEach(function(n){t===n.mode&&(n.duration=e)}),this.bulletBtn.main.queue.forEach(function(o){t===o.mode&&(o.duration=e,o.pauseMove(n),o.startMove(n))}))}},{key:"hide",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"scroll";this.hideArr.indexOf(t)<0&&this.hideArr.push(t),this.bulletBtn.main.queue.filter(function(e){return t===e.mode||"color"===t&&e.color}).forEach(function(t){return t.remove()})}},{key:"show",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"scroll",e=this.hideArr.indexOf(t);e>-1&&this.hideArr.splice(e,1)}}]),t}();e.default=u,t.exports=e.default},function(t,e,n){"use strict";var o,i,r,a,s,u,c,l=n(6),f=n(20),h=Function.prototype.apply,d=Function.prototype.call,p=Object.create,m=Object.defineProperty,v=Object.defineProperties,g=Object.prototype.hasOwnProperty,b={configurable:!0,enumerable:!1,writable:!0};i=function(t,e){var n,i;return f(e),i=this,o.call(this,t,n=function(){r.call(i,t,n),h.call(e,this,arguments)}),n.__eeOnceListener__=e,this},s={on:o=function(t,e){var n;return f(e),g.call(this,"__ee__")?n=this.__ee__:(n=b.value=p(null),m(this,"__ee__",b),b.value=null),n[t]?"object"==typeof n[t]?n[t].push(e):n[t]=[n[t],e]:n[t]=e,this},once:i,off:r=function(t,e){var n,o,i,r;if(f(e),!g.call(this,"__ee__"))return this;if(!(n=this.__ee__)[t])return this;if("object"==typeof(o=n[t]))for(r=0;i=o[r];++r)i!==e&&i.__eeOnceListener__!==e||(2===o.length?n[t]=o[r?0:1]:o.splice(r,1));else o!==e&&o.__eeOnceListener__!==e||delete n[t];return this},emit:a=function(t){var e,n,o,i,r;if(g.call(this,"__ee__")&&(i=this.__ee__[t]))if("object"==typeof i){for(n=arguments.length,r=new Array(n-1),e=1;e<n;++e)r[e-1]=arguments[e];for(i=i.slice(),e=0;o=i[e];++e)h.call(o,this,r)}else switch(arguments.length){case 1:d.call(i,this);break;case 2:d.call(i,this,arguments[1]);break;case 3:d.call(i,this,arguments[1],arguments[2]);break;default:for(n=arguments.length,r=new Array(n-1),e=1;e<n;++e)r[e-1]=arguments[e];h.call(i,this,r)}}},u={on:l(o),once:l(i),off:l(r),emit:l(a)},c=v({},u),t.exports=e=function(t){return null==t?p(c):v(Object(t),u)},e.methods=s},function(t,e,n){"use strict";var o=n(7),i=n(15),r=n(16),a=n(17);(t.exports=function(t,e){var n,r,s,u,c;return arguments.length<2||"string"!=typeof t?(u=e,e=t,t=null):u=arguments[2],null==t?(n=s=!0,r=!1):(n=a.call(t,"c"),r=a.call(t,"e"),s=a.call(t,"w")),c={value:e,configurable:n,enumerable:r,writable:s},u?o(i(u),c):c}).gs=function(t,e,n){var s,u,c,l;return"string"!=typeof t?(c=n,n=e,e=t,t=null):c=arguments[3],null==e?e=void 0:r(e)?null==n?n=void 0:r(n)||(c=n,n=void 0):(c=e,e=n=void 0),null==t?(s=!0,u=!1):(s=a.call(t,"c"),u=a.call(t,"e")),l={get:e,set:n,configurable:s,enumerable:u},c?o(i(c),l):l}},function(t,e,n){"use strict";t.exports=n(8)()?Object.assign:n(9)},function(t,e,n){"use strict";t.exports=function(){var t,e=Object.assign;return"function"==typeof e&&(e(t={foo:"raz"},{bar:"dwa"},{trzy:"trzy"}),t.foo+t.bar+t.trzy==="razdwatrzy")}},function(t,e,n){"use strict";var o=n(10),i=n(14),r=Math.max;t.exports=function(t,e){var n,a,s,u=r(arguments.length,2);for(t=Object(i(t)),s=function(o){try{t[o]=e[o]}catch(t){n||(n=t)}},a=1;a<u;++a)e=arguments[a],o(e).forEach(s);if(void 0!==n)throw n;return t}},function(t,e,n){"use strict";t.exports=n(11)()?Object.keys:n(12)},function(t,e,n){"use strict";t.exports=function(){try{return Object.keys("primitive"),!0}catch(t){return!1}}},function(t,e,n){"use strict";var o=n(1),i=Object.keys;t.exports=function(t){return i(o(t)?Object(t):t)}},function(t,e,n){"use strict";t.exports=function(){}},function(t,e,n){"use strict";var o=n(1);t.exports=function(t){if(!o(t))throw new TypeError("Cannot use null or undefined");return t}},function(t,e,n){"use strict";var o=n(1),i=Array.prototype.forEach,r=Object.create;t.exports=function(t){var e=r(null);return i.call(arguments,function(t){o(t)&&function(t,e){var n;for(n in t)e[n]=t[n]}(Object(t),e)}),e}},function(t,e,n){"use strict";t.exports=function(t){return"function"==typeof t}},function(t,e,n){"use strict";t.exports=n(18)()?String.prototype.contains:n(19)},function(t,e,n){"use strict";var o="razdwatrzy";t.exports=function(){return"function"==typeof o.contains&&(!0===o.contains("dwa")&&!1===o.contains("foo"))}},function(t,e,n){"use strict";var o=String.prototype.indexOf;t.exports=function(t){return o.call(this,t,arguments[1])>-1}},function(t,e,n){"use strict";t.exports=function(t){if("function"!=typeof t)throw new TypeError(t+" is not a function");return t}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=function(){function t(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,n,o){return n&&t(e.prototype,n),o&&t(e,o),e}}(),i=a(n(0)),r=a(n(22));function a(t){return t&&t.__esModule?t:{default:t}}var s=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.danmu=e,this.main=new r.default(e),e.config.defaultOff||this.main.start()}return o(t,[{key:"createSwitch",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.switchBtn=i.default.createDom("dk-switch",'<span class="txt">弹</span>',{},"danmu-switch "+(t?"danmu-switch-active":"")),this.switchBtn}}]),t}();e.default=s,t.exports=e.default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=function(){function t(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,n,o){return n&&t(e.prototype,n),o&&t(e,o),e}}(),i=s(n(23)),r=s(n(24)),a=s(n(0));function s(t){return t&&t.__esModule?t:{default:t}}var u=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.danmu=e,this.container=e.container,this.channel=new i.default(e),this.data=[].concat(e.config.comments),this.queue=[],this.timer=null,this.retryTimer=null,this.interval=2e3,this.status="idle",e.on("bullet_remove",this.updateQueue.bind(this))}return o(t,[{key:"updateQueue",value:function(t){var e=this;e.queue.some(function(n,o){return n.id===t.bullet.id&&(e.queue.splice(o,1),!0)})}},{key:"init",value:function(t,e){e||(e=this),e.data.sort(function(t,e){return t.start-e.start}),e.retryTimer||(e.retryTimer=setInterval(function(){e.readData(),e.dataHandle()},e.interval-1e3))}},{key:"start",value:function(){this.status="playing",this.queue=[],this.container.innerHTML="",this.channel.resetWithCb(this.init,this)}},{key:"stop",value:function(){this.status="closed",clearInterval(this.retryTimer),this.retryTimer=null,this.channel.reset(),this.queue=[],this.container.innerHTML=""}},{key:"play",value:function(){this.status="playing";var t=this.channel.channels,e=this.danmu.container.getBoundingClientRect();t&&t.length>0&&["scroll","top","bottom"].forEach(function(n){for(var o=0;o<t.length;o++)t[o].queue[n].forEach(function(t){t.resized||(t.startMove(e),t.resized=!0)});for(var i=0;i<t.length;i++)t[i].queue[n].forEach(function(t){t.resized=!1})})}},{key:"pause",value:function(){this.status="paused";var t=this.channel.channels,e=this.danmu.container.getBoundingClientRect();t&&t.length>0&&["scroll","top","bottom"].forEach(function(n){for(var o=0;o<t.length;o++)t[o].queue[n].forEach(function(t){t.pauseMove(e)})})}},{key:"dataHandle",value:function(){var t=this;"paused"!==this.status&&"closed"!==this.status&&t.queue.length&&t.queue.forEach(function(e){"waiting"!==e.status&&"paused"!==e.status||e.startMove(t.channel.containerPos)})}},{key:"readData",value:function(){var t=this,e=this.danmu,n=0;e.player&&e.player.currentTime&&(n=a.default.formatTime(e.player.currentTime));var o=void 0,i=t.interval,s=t.channel,u=void 0;(u=e.player?t.data.filter(function(e){return!e.start&&t.danmu.hideArr.indexOf(e.mode)<0&&(!e.color||t.danmu.hideArr.indexOf("color")<0)&&(e.start=n),t.danmu.hideArr.indexOf(e.mode)<0&&(!e.color||t.danmu.hideArr.indexOf("color")<0)&&e.start-i<=n&&n<=e.start+i}):t.data.filter(function(e){return t.danmu.hideArr.indexOf(e.mode)<0&&(!e.color||t.danmu.hideArr.indexOf("color")<0)})).length>0&&u.forEach(function(n){(o=new r.default(e,n)).attach(),s.addBullet(o).result?(t.queue.push(o),o.topInit()):o.detach()})}}]),t}();e.default=u,t.exports=e.default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=function(){function t(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,n,o){return n&&t(e.prototype,n),o&&t(e,o),e}}();var i=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.danmu=e,this.reset();var n=this;this.danmu.on("bullet_remove",function(t){n.removeBullet(t.bullet)}),this.containerPos=this.danmu.container.getBoundingClientRect(),this.containerWidth=this.containerPos.width,this.containerHeight=this.containerPos.height,this.containerLeft=this.containerPos.left,this.containerRight=this.containerPos.right,this.danmu.bulletResizeTimer=setInterval(function(){n.containerPos=n.danmu.container.getBoundingClientRect(),(Math.abs(n.containerPos.width-n.containerWidth)>=2||Math.abs(n.containerPos.height-n.containerHeight)>=2||Math.abs(n.containerPos.left-n.containerLeft)>=2||Math.abs(n.containerPos.right-n.containerRight)>=2)&&(n.containerWidth=n.containerPos.width,n.containerHeight=n.containerPos.height,n.containerLeft=n.containerPos.left,n.containerRight=n.containerPos.right,n.resize(!0))},50)}return o(t,[{key:"resize",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=this.danmu.container,n=this;setTimeout(function(){n.danmu.bulletBtn.main.data&&n.danmu.bulletBtn.main.data.forEach(function(t){t.bookChannelId&&delete t.bookChannelId});var o=e.getBoundingClientRect();n.width=o.width,n.height=o.height,n.danmu.config.area&&n.danmu.config.area.start>=0&&n.danmu.config.area.end>=n.danmu.config.area.start&&(n.height=n.height*(n.danmu.config.area.end-n.danmu.config.area.start)),n.container=e;for(var i=/mobile/gi.test(navigator.userAgent)?10:12,r=Math.floor(n.height/i),a=[],s=0;s<r;s++)a[s]={id:s,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}};if(n.channels&&n.channels.length<=a.length){for(var u=function(e){a[e]={id:e,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}},["scroll","top"].forEach(function(o){n.channels[e].queue[o].forEach(function(i){i.el&&(a[e].queue[o].push(i),i.resized||(i.pauseMove(n.containerPos,t),i.startMove(n.containerPos),i.resized=!0))})}),n.channels[e].queue.bottom.forEach(function(o){if(o.el){if(a[e+a.length-n.channels.length].queue.bottom.push(o),o.channel_id[0]+o.channel_id[1]-1===e){var r=[].concat(o.channel_id);o.channel_id=[r[0]-n.channels.length+a.length,r[1]],o.top=o.channel_id[0]*i,n.danmu.config.area&&n.danmu.config.area.start&&(o.top+=n.containerHeight*n.danmu.config.area.start),o.topInit()}o.resized||(o.pauseMove(n.containerPos,t),o.startMove(n.containerPos),o.resized=!0)}})},c=0;c<n.channels.length;c++)u(c);for(var l=function(t){["scroll","top","bottom"].forEach(function(e){a[t].queue[e].forEach(function(t){t.resized=!1})})},f=0;f<a.length;f++)l(f);n.channels=a,n.channelHeight=i}else if(n.channels&&n.channels.length>a.length){for(var h=function(e){a[e]={id:e,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}},["scroll","top","bottom"].forEach(function(o){if("top"===o&&e>Math.floor(a.length/2));else if("bottom"===o&&e<=Math.floor(a.length/2));else{var r="bottom"===o?e-a.length+n.channels.length:e;n.channels[r].queue[o].forEach(function(s,u){if(s.el){if(a[e].queue[o].push(s),"bottom"===o&&s.channel_id[0]+s.channel_id[1]-1===r){var c=[].concat(s.channel_id);s.channel_id=[c[0]-n.channels.length+a.length,c[1]],s.top=s.channel_id[0]*i,n.danmu.config.area&&n.danmu.config.area.start&&(s.top+=n.containerHeight*n.danmu.config.area.start),s.topInit()}s.resized||(s.pauseMove(n.containerPos,t),s.startMove(n.containerPos),s.resized=!0)}n.channels[r].queue[o].splice(u,1)})}})},d=0;d<a.length;d++)h(d);for(var p=function(t){["scroll","top","bottom"].forEach(function(e){n.channels[t].queue[e].forEach(function(t){t.pauseMove(n.containerPos),t.remove()})})},m=a.length;m<n.channels.length;m++)p(m);for(var v=function(t){["scroll","top","bottom"].forEach(function(e){a[t].queue[e].forEach(function(t){t.resized=!1})})},g=0;g<a.length;g++)v(g);n.channels=a,n.channelHeight=i}},10)}},{key:"addBullet",value:function(t){var e=this.danmu,n=this.channels,o=this.channelHeight,i=Math.ceil(t.height/o);if(i>n.length)return{result:!1,message:"exceed channels.length, occupy="+i+",channelsSize="+n.length};for(var r=!0,a=void 0,s=-1,u=0,c=n.length;u<c;u++)if(n[u].queue[t.mode].some(function(e){return e.id===t.id}))return{result:!1,message:"exsited, channelOrder="+u+",danmu_id="+t.id};if("scroll"===t.mode)for(var l=0,f=n.length-i;l<=f;l++){r=!0;for(var h=l;h<l+i;h++){if((a=n[h]).operating.scroll){r=!1;break}if((a.bookId.scroll||t.prior)&&a.bookId.scroll!==t.id){r=!1;break}a.operating.scroll=!0;var d=a.queue.scroll[0];if(d){var p=d.el.getBoundingClientRect();if(p.right>this.containerPos.right){r=!1,a.operating.scroll=!1;break}var m=p.left-this.containerPos.left+p.width,v=(this.containerPos.width+p.width)/d.duration,g=m/v,b=this.containerPos.width,y=(this.containerPos.width+t.width)/t.duration,w=b/y;if(e.config.bOffset||(e.config.bOffset=0),v<y&&g+e.config.bOffset>w){r=!1,a.operating.scroll=!1;break}}a.operating.scroll=!1}if(r){s=l;break}}else if("top"===t.mode)for(var x=0,k=n.length-i;x<=k;x++){r=!0;for(var _=x;_<x+i;_++){if(_>Math.floor(n.length/2)){r=!1;break}if((a=n[_]).operating[t.mode]){r=!1;break}if((a.bookId[t.mode]||t.prior)&&a.bookId[t.mode]!==t.id){r=!1;break}if(a.operating[t.mode]=!0,a.queue[t.mode].length>0){r=!1,a.operating[t.mode]=!1;break}a.operating[t.mode]=!1}if(r){s=x;break}}else if("bottom"===t.mode)for(var O=n.length-i;O>=0;O--){r=!0;for(var M=O;M<O+i;M++){if(M<=Math.floor(n.length/2)){r=!1;break}if((a=n[M]).operating[t.mode]){r=!1;break}if((a.bookId[t.mode]||t.prior)&&a.bookId[t.mode]!==t.id){r=!1;break}if(a.operating[t.mode]=!0,a.queue[t.mode].length>0){r=!1,a.operating[t.mode]=!1;break}a.operating[t.mode]=!1}if(r){s=O;break}}if(-1!==s){for(var C=s,E=s+i;C<E;C++)(a=n[C]).operating[t.mode]=!0,a.queue[t.mode].unshift(t),t.prior&&delete a.bookId[t.mode],a.operating[t.mode]=!1;if(t.prior)delete t.bookChannelId,e.bulletBtn.main.data.some(function(e){return e.id===t.id&&(delete e.bookChannelId,!0)});return t.channel_id=[s,i],t.top=s*o,this.danmu.config.area&&this.danmu.config.area.start&&(t.top+=this.containerHeight*this.danmu.config.area.start),{result:t,message:"success"}}if(t.prior)if(t.bookChannelId){e.bulletBtn.main.data.some(function(e){return e.id===t.id&&(e.start+=2e3,!0)})}else{s=-1;for(var j=0,T=n.length-i;j<=T;j++){r=!0;for(var P=j;P<j+i;P++)if(n[P].bookId[t.mode]){r=!1;break}if(r){s=j;break}}if(-1!==s){for(var B=s;B<s+i;B++)n[B].bookId[t.mode]=t.id;e.bulletBtn.main.data.some(function(e){return e.id===t.id&&(e.start+=2e3,e.bookChannelId=[s,i],!0)})}}return{result:!1,message:"no surplus will right"}}},{key:"removeBullet",value:function(t){for(var e=this.channels,n=t.channel_id,o=void 0,i=n[0],r=n[0]+n[1];i<r;i++)if(o=e[i]){o.operating[t.mode]=!0;var a=-1;o.queue[t.mode].some(function(e,n){return e.id===t.id&&(a=n,!0)}),a>-1&&o.queue[t.mode].splice(a,1),o.operating[t.mode]=!1}}},{key:"reset",value:function(){var t=this.danmu.container,e=this;e.channels&&e.channels.length>0&&["scroll","top","bottom"].forEach(function(t){for(var n=0;n<e.channels.length;n++)e.channels[n].queue[t].forEach(function(t){t.pauseMove(e.containerPos),t.remove()})}),setTimeout(function(){var n=t.getBoundingClientRect();e.width=n.width,e.height=n.height,e.danmu.config.area&&e.danmu.config.area.start>=0&&e.danmu.config.area.end>=e.danmu.config.area.start&&(e.height=e.height*(e.danmu.config.area.end-e.danmu.config.area.start)),e.container=t;for(var o=/mobile/gi.test(navigator.userAgent)?10:12,i=Math.floor(e.height/o),r=[],a=0;a<i;a++)r[a]={id:a,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}};e.channels=r,e.channelHeight=o},200)}},{key:"resetWithCb",value:function(t,e){var n=this.danmu.container,o=this;o.channels&&o.channels.length>0&&["scroll","top","bottom"].forEach(function(t){for(var e=0;e<o.channels.length;e++)o.channels[e].queue[t].forEach(function(t){t.pauseMove(o.containerPos),t.remove()})});var i=n.getBoundingClientRect();o.width=i.width,o.height=i.height,o.danmu.config.area&&o.danmu.config.area.start>=0&&o.danmu.config.area.end>=o.danmu.config.area.start&&(o.height=o.height*(o.danmu.config.area.end-o.danmu.config.area.start)),o.container=n;for(var r=/mobile/gi.test(navigator.userAgent)?10:12,a=Math.floor(o.height/r),s=[],u=0;u<a;u++)s[u]={id:u,queue:{scroll:[],top:[],bottom:[]},operating:{scroll:!1,top:!1,bottom:!1},bookId:{}};o.channels=s,o.channelHeight=r,t&&t(!0,e)}}]),t}();e.default=i,t.exports=e.default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o,i=function(){function t(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,n,o){return n&&t(e.prototype,n),o&&t(e,o),e}}(),r=n(0),a=(o=r)&&o.__esModule?o:{default:o};var s=function(){function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.danmu=e,this.duration=n.duration,this.id=n.id,this.container=e.container,this.start=n.start,this.prior=n.prior,this.color=n.color,this.bookChannelId=n.bookChannelId;var o=void 0;if(n.el&&1===n.el.nodeType)o=a.default.copyDom(n.el);else if((o=document.createElement("div")).textContent=n.txt,n.style){var i=n.style;Object.keys(i).forEach(function(t){o.style[t]=i[t]})}"top"===n.mode||"bottom"===n.mode?this.mode=n.mode:this.mode="scroll",this.el=o,this.status="waiting";var r=this.container.getBoundingClientRect();this.el.style.left=r.width+"px"}return i(t,[{key:"attach",value:function(){this.container.appendChild(this.el),this.elPos=this.el.getBoundingClientRect(),this.width=this.elPos.width,this.height=this.elPos.height}},{key:"detach",value:function(){this.container&&this.el&&this.container.removeChild(this.el),this.el=null}},{key:"topInit",value:function(){this.el.style.top=this.top+"px"}},{key:"pauseMove",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if("paused"!==this.status&&(this.status="paused",clearTimeout(this.removeTimer),this.el))if("scroll"===this.mode){if(e){var n=((new Date).getTime()-this.moveTime)/1e3*this.moveV,o=0;o=this.moveMoreS-n>=0?(this.moveMoreS-n)/this.moveContainerWidth*t.width:this.moveMoreS-n,this.el.style.left=o+"px"}else this.el.style.left=this.el.getBoundingClientRect().left-t.left+"px";this.el.style.transform="translateX(0px) translateY(0px) translateZ(0px)",this.el.style.transition="transform 0s linear 0s"}else this.pastDuration&&this.startTime?this.pastDuration=this.pastDuration+(new Date).getTime()-this.startTime:this.pastDuration=1}},{key:"startMove",value:function(t){var e=this;if(this.el&&"start"!==this.status)if(this.status="start","scroll"===this.mode){this.moveV=(t.width+this.width)/this.duration*1e3;var n=(e.el.getBoundingClientRect().right-t.left)/this.moveV;this.el.style.transition="transform "+n+"s linear 0s",setTimeout(function(){e.el&&(e.el.style.transform="translateX(-"+(e.el.getBoundingClientRect().right-t.left)+"px) translateY(0px) translateZ(0px)",e.moveTime=(new Date).getTime(),e.moveMoreS=e.el.getBoundingClientRect().left-t.left,e.moveContainerWidth=t.width,e.removeTimer=setTimeout(i,1e3*n))},20)}else{this.el.style.left="50%",this.el.style.margin="0 0 0 -"+this.width/2+"px",this.pastDuration||(this.pastDuration=1);var o=this.duration>=this.pastDuration?this.duration-this.pastDuration:0;this.removeTimer=setTimeout(i,o),this.startTime=(new Date).getTime()}function i(){if(e.el)if("scroll"===e.mode){var t=e.danmu.container.getBoundingClientRect(),n=e.el.getBoundingClientRect();n&&n.right<=t.left+100?(e.status="end",e.remove()):(e.pauseMove(t),e.startMove(t))}else e.status="end",e.remove()}}},{key:"remove",value:function(){(this.removeTimer&&clearTimeout(this.removeTimer),this.el&&this.el.parentNode)&&(this.el.parentNode.removeChild(this.el),this.el=null,this.danmu.emit("bullet_remove",{bullet:this}))}}]),t}();e.default=s,t.exports=e.default},function(t,e,n){var o=n(26);"string"==typeof o&&(o=[[t.i,o,""]]);var i={hmr:!0,transform:void 0,insertInto:void 0};n(28)(o,i);o.locals&&(t.exports=o.locals)},function(t,e,n){(t.exports=n(27)(!1)).push([t.i,".danmu{overflow:hidden;-webkit-user-select:none;-moz-user-select:none;user-select:none;-ms-user-select:none}.danmu>*{position:absolute;white-space:nowrap}.danmu-switch{width:32px;height:20px;border-radius:100px;background-color:#ccc;-webkit-box-sizing:border-box;box-sizing:border-box;outline:none;cursor:pointer;position:relative;text-align:center;margin:10px auto}.danmu-switch.danmu-switch-active{padding-left:12px;background-color:#f85959}.danmu-switch span.txt{width:20px;height:20px;line-height:20px;text-align:center;display:block;border-radius:100px;background-color:#ffffff;-webkit-box-shadow:-2px 0 0 0 rgba(0, 0, 0, .04);box-shadow:-2px 0 0 0 rgba(0, 0, 0, .04);font-family:PingFangSC;font-size:10px;font-weight:500;color:#f44336}\n",""])},function(t,e){t.exports=function(t){var e=[];return e.toString=function(){return this.map(function(e){var n=function(t,e){var n=t[1]||"",o=t[3];if(!o)return n;if(e&&"function"==typeof btoa){var i=(a=o,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(a))))+" */"),r=o.sources.map(function(t){return"/*# sourceURL="+o.sourceRoot+t+" */"});return[n].concat(r).concat([i]).join("\n")}var a;return[n].join("\n")}(e,t);return e[2]?"@media "+e[2]+"{"+n+"}":n}).join("")},e.i=function(t,n){"string"==typeof t&&(t=[[null,t,""]]);for(var o={},i=0;i<this.length;i++){var r=this[i][0];"number"==typeof r&&(o[r]=!0)}for(i=0;i<t.length;i++){var a=t[i];"number"==typeof a[0]&&o[a[0]]||(n&&!a[2]?a[2]=n:n&&(a[2]="("+a[2]+") and ("+n+")"),e.push(a))}},e}},function(t,e,n){var o,i,r={},a=(o=function(){return window&&document&&document.all&&!window.atob},function(){return void 0===i&&(i=o.apply(this,arguments)),i}),s=function(t){var e={};return function(t){if("function"==typeof t)return t();if(void 0===e[t]){var n=function(t){return document.querySelector(t)}.call(this,t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(t){n=null}e[t]=n}return e[t]}}(),u=null,c=0,l=[],f=n(29);function h(t,e){for(var n=0;n<t.length;n++){var o=t[n],i=r[o.id];if(i){i.refs++;for(var a=0;a<i.parts.length;a++)i.parts[a](o.parts[a]);for(;a<o.parts.length;a++)i.parts.push(b(o.parts[a],e))}else{var s=[];for(a=0;a<o.parts.length;a++)s.push(b(o.parts[a],e));r[o.id]={id:o.id,refs:1,parts:s}}}}function d(t,e){for(var n=[],o={},i=0;i<t.length;i++){var r=t[i],a=e.base?r[0]+e.base:r[0],s={css:r[1],media:r[2],sourceMap:r[3]};o[a]?o[a].parts.push(s):n.push(o[a]={id:a,parts:[s]})}return n}function p(t,e){var n=s(t.insertInto);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");var o=l[l.length-1];if("top"===t.insertAt)o?o.nextSibling?n.insertBefore(e,o.nextSibling):n.appendChild(e):n.insertBefore(e,n.firstChild),l.push(e);else if("bottom"===t.insertAt)n.appendChild(e);else{if("object"!=typeof t.insertAt||!t.insertAt.before)throw new Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n");var i=s(t.insertInto+" "+t.insertAt.before);n.insertBefore(e,i)}}function m(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t);var e=l.indexOf(t);e>=0&&l.splice(e,1)}function v(t){var e=document.createElement("style");return void 0===t.attrs.type&&(t.attrs.type="text/css"),g(e,t.attrs),p(t,e),e}function g(t,e){Object.keys(e).forEach(function(n){t.setAttribute(n,e[n])})}function b(t,e){var n,o,i,r;if(e.transform&&t.css){if(!(r=e.transform(t.css)))return function(){};t.css=r}if(e.singleton){var a=c++;n=u||(u=v(e)),o=x.bind(null,n,a,!1),i=x.bind(null,n,a,!0)}else t.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=function(t){var e=document.createElement("link");return void 0===t.attrs.type&&(t.attrs.type="text/css"),t.attrs.rel="stylesheet",g(e,t.attrs),p(t,e),e}(e),o=function(t,e,n){var o=n.css,i=n.sourceMap,r=void 0===e.convertToAbsoluteUrls&&i;(e.convertToAbsoluteUrls||r)&&(o=f(o));i&&(o+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(i))))+" */");var a=new Blob([o],{type:"text/css"}),s=t.href;t.href=URL.createObjectURL(a),s&&URL.revokeObjectURL(s)}.bind(null,n,e),i=function(){m(n),n.href&&URL.revokeObjectURL(n.href)}):(n=v(e),o=function(t,e){var n=e.css,o=e.media;o&&t.setAttribute("media",o);if(t.styleSheet)t.styleSheet.cssText=n;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(n))}}.bind(null,n),i=function(){m(n)});return o(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;o(t=e)}else i()}}t.exports=function(t,e){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(e=e||{}).attrs="object"==typeof e.attrs?e.attrs:{},e.singleton||"boolean"==typeof e.singleton||(e.singleton=a()),e.insertInto||(e.insertInto="head"),e.insertAt||(e.insertAt="bottom");var n=d(t,e);return h(n,e),function(t){for(var o=[],i=0;i<n.length;i++){var a=n[i];(s=r[a.id]).refs--,o.push(s)}t&&h(d(t,e),e);for(i=0;i<o.length;i++){var s;if(0===(s=o[i]).refs){for(var u=0;u<s.parts.length;u++)s.parts[u]();delete r[s.id]}}}};var y,w=(y=[],function(t,e){return y[t]=e,y.filter(Boolean).join("\n")});function x(t,e,n,o){var i=n?"":o.css;if(t.styleSheet)t.styleSheet.cssText=w(e,i);else{var r=document.createTextNode(i),a=t.childNodes;a[e]&&t.removeChild(a[e]),a.length?t.insertBefore(r,a[e]):t.appendChild(r)}}},function(t,e){t.exports=function(t){var e="undefined"!=typeof window&&window.location;if(!e)throw new Error("fixUrls requires window.location");if(!t||"string"!=typeof t)return t;var n=e.protocol+"//"+e.host,o=n+e.pathname.replace(/\/[^\/]*$/,"/");return t.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,function(t,e){var i,r=e.trim().replace(/^"(.*)"$/,function(t,e){return e}).replace(/^'(.*)'$/,function(t,e){return e});return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(r)?t:(i=0===r.indexOf("//")?r:0===r.indexOf("/")?n+r:o+r.replace(/^\.\//,""),"url("+JSON.stringify(i)+")")})}}])}); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "danmu.js", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"description": "HTML5 danmu (danmaku) plugin for any DOM element", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
@@ -40,3 +40,3 @@ import EventEmitter from 'event-emitter' | ||
['touchend', 'click', 'dblclick'].forEach(item => { | ||
this.container.addEventListener(item, function () { | ||
this.container.addEventListener(item, function (e) { | ||
e.preventDefault() | ||
@@ -43,0 +43,0 @@ e.stopPropagation() |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
331945