mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-08 10:56:15 -08:00
Refactor code structure for improved readability and maintainability
This commit is contained in:
1 parent
3ae89ab349
commit
ddb78cf850
8 files changed
+56
-9
No files matched your search
@@ -5,4 +5,4 @@
|
||||
* (c) 2017-2026 Harvey Zhao
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(t,e,i,a,n){var o="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},s="function"==typeof o[a]&&o[a],r=s.i||{},l=s.cache||{},d="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(e,i){if(!l[e]){if(!t[e]){if(n[e])return n[e];var r="function"==typeof o[a]&&o[a];if(!i&&r)return r(e,!0);if(s)return s(e,!0);if(d&&"string"==typeof e)return d(e);var u=Error("Cannot find module '"+e+"'");throw u.code="MODULE_NOT_FOUND",u}m.resolve=function(i){var a=t[e][1][i];return null!=a?a:i},m.cache={};var h=l[e]=new p.Module(e);t[e][0].call(h.exports,m,h,h.exports,o)}return l[e].exports;function m(t){var e=m.resolve(t);if(!1===e)return{};if(Array.isArray(e)){var i={__esModule:!0};return e.forEach(function(t){var e=t[0],a=t[1],n=t[2]||t[0],o=p(a);"*"===e?Object.keys(o).forEach(function(t){"default"===t||"__esModule"===t||Object.prototype.hasOwnProperty.call(i,t)||Object.defineProperty(i,t,{enumerable:!0,get:function(){return o[t]}})}):"*"===n?Object.defineProperty(i,e,{enumerable:!0,value:o}):Object.defineProperty(i,e,{enumerable:!0,get:function(){return"default"===n?o.__esModule?o.default:o:o[n]}})}),i}return p(e)}}p.isParcelRequire=!0,p.Module=function(t){this.id=t,this.bundle=p,this.require=d,this.exports={}},p.modules=t,p.cache=l,p.parent=s,p.distDir=void 0,p.publicUrl=void 0,p.devServer=void 0,p.i=r,p.register=function(e,i){t[e]=[function(t,e){e.exports=i},{}]},Object.defineProperty(p,"root",{get:function(){return o[a]}}),o[a]=p;for(var u=0;u<e.length;u++)p(e[u]);if(i){var h=p(i);"object"==typeof exports&&"u">typeof module?module.exports=h:"function"==typeof define&&define.amd&&define(function(){return h})}}({"666Ok":[function(t,e,i,a){var n=t("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(i),n.export(i,"default",()=>u);var o=t("./danmuku"),s=n.interopDefault(o),r=t("./heatmap"),l=n.interopDefault(r),d=t("./setting"),p=n.interopDefault(d);function u(t){return e=>{let i=new(0,s.default)(e,t),a=new(0,p.default)(e,i);return i.option.heatmap&&(0,l.default)(e,i,i.option.heatmap),{name:"artplayerPluginDanmuku",emit:i.emit.bind(i),load:i.load.bind(i),config:i.config.bind(i),hide:i.hide.bind(i),show:i.show.bind(i),reset:i.reset.bind(i),mount:a.mount.bind(a),get option(){return i.option},get isHide(){return i.isHide},get isStop(){return i.isStop}}}}u.icons=p.default.icons,"u">typeof window&&(window.artplayerPluginDanmuku=u)},{"./danmuku":"g81Wu","./heatmap":"hjtgU","./setting":"ho690","@parcel/transformer-js/src/esmodule-helpers.js":"6ykb1"}],g81Wu:[function(t,e,i,a){var n=t("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(i);var o=t("bundle-text:./worker"),s=n.interopDefault(o),r=t("./bilibili");class l{constructor(t,e){const{constructor:i,template:a}=t;this.utils=i.utils,this.validator=i.validator,this.$danmuku=a.$danmuku,this.$player=a.$player,this.art=t,this.queue=[],this.$refs=[],this.isStop=!1,this.isHide=!1,this.timer=null,this.index=0,this.option=l.option,this.states={wait:[],ready:[],emit:[],stop:[]},this.config(e,!0);const n=new Blob([s.default.replace("export{e as default};","")],{type:"application/javascript"});this.worker=new Worker(URL.createObjectURL(n)),this.start=this.start.bind(this),this.stop=this.stop.bind(this),this.reset=this.reset.bind(this),this.resize=this.resize.bind(this),this.destroy=this.destroy.bind(this),t.on("video:play",this.start),t.on("video:playing",this.start),t.on("video:pause",this.stop),t.on("video:waiting",this.stop),t.on("destroy",this.destroy),t.on("resize",this.resize),this.load()}static get option(){return{danmuku:[],speed:5,margin:[10,"25%"],opacity:1,color:"#FFFFFF",mode:0,modes:[0,1,2],fontSize:25,antiOverlap:!0,synchronousPlayback:!1,mount:void 0,heatmap:!1,width:512,points:[],filter:()=>!0,beforeEmit:()=>!0,beforeVisible:()=>!0,visible:!0,emitter:!0,maxLength:200,lockTime:5,theme:"dark",OPACITY:{},FONT_SIZE:{},MARGIN:{},SPEED:{},COLOR:[]}}static get scheme(){return{danmuku:"array|function|string",speed:"number",margin:"array",opacity:"number",color:"string",mode:"number",modes:"array",fontSize:"number|string",antiOverlap:"boolean",synchronousPlayback:"boolean",mount:"?htmldivelement|string",heatmap:"object|boolean",width:"number",points:"array",filter:"function",beforeEmit:"function",beforeVisible:"function",visible:"boolean",emitter:"boolean",maxLength:"number",lockTime:"number",theme:"string",OPACITY:"object",FONT_SIZE:"object",MARGIN:"object",SPEED:"object",COLOR:"array"}}static get cssText(){return` user-select: none; position: absolute; white-space: pre; pointer-events: none; perspective: 500px; display: inline-block; will-change: transform; font-weight: normal; line-height: 1.125; visibility: hidden; font-family: SimHei, "Microsoft JhengHei", Arial, Helvetica, sans-serif; text-shadow: rgb(0, 0, 0) 1px 0px 1px, rgb(0, 0, 0) 0px 1px 1px, rgb(0, 0, 0) 0px -1px 1px, rgb(0, 0, 0) -1px 0px 1px; `}get isRotate(){return this.art.pluginsLine truncated
|
||||
!function(t,e,i,a,n,o,s,r){var l="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},d="function"==typeof l[a]&&l[a],p=d.i||{},u=d.cache||{},h="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function m(e,i){if(!u[e]){if(!t[e]){if(n[e])return n[e];var o="function"==typeof l[a]&&l[a];if(!i&&o)return o(e,!0);if(d)return d(e,!0);if(h&&"string"==typeof e)return h(e);var s=Error("Cannot find module '"+e+"'");throw s.code="MODULE_NOT_FOUND",s}p.resolve=function(i){var a=t[e][1][i];return null!=a?a:i},p.cache={};var r=u[e]=new m.Module(e);t[e][0].call(r.exports,p,r,r.exports,l)}return u[e].exports;function p(t){var e=p.resolve(t);if(!1===e)return{};if(Array.isArray(e)){var i={__esModule:!0};return e.forEach(function(t){var e=t[0],a=t[1],n=t[2]||t[0],o=m(a);"*"===e?Object.keys(o).forEach(function(t){"default"===t||"__esModule"===t||Object.prototype.hasOwnProperty.call(i,t)||Object.defineProperty(i,t,{enumerable:!0,get:function(){return o[t]}})}):"*"===n?Object.defineProperty(i,e,{enumerable:!0,value:o}):Object.defineProperty(i,e,{enumerable:!0,get:function(){return"default"===n?o.__esModule?o.default:o:o[n]}})}),i}return m(e)}}m.isParcelRequire=!0,m.Module=function(t){this.id=t,this.bundle=m,this.require=h,this.exports={}},m.modules=t,m.cache=u,m.parent=d,m.distDir=void 0,m.publicUrl=void 0,m.devServer=void 0,m.i=p,m.register=function(e,i){t[e]=[function(t,e){e.exports=i},{}]},Object.defineProperty(m,"root",{get:function(){return l[a]}}),l[a]=m;for(var c=0;c<e.length;c++)m(e[c]);if(i){var f=m(i);"object"==typeof exports&&"u">typeof module?module.exports=f:"function"==typeof define&&define.amd&&define(function(){return f})}}({"666Ok":[function(t,e,i,a){var n=t("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(i),n.export(i,"default",()=>u);var o=t("./danmuku"),s=n.interopDefault(o),r=t("./heatmap"),l=n.interopDefault(r),d=t("./setting"),p=n.interopDefault(d);function u(t){return e=>{let i=new(0,s.default)(e,t),a=new(0,p.default)(e,i);return i.option.heatmap&&(0,l.default)(e,i,i.option.heatmap),{name:"artplayerPluginDanmuku",emit:i.emit.bind(i),load:i.load.bind(i),config:i.config.bind(i),hide:i.hide.bind(i),show:i.show.bind(i),reset:i.reset.bind(i),mount:a.mount.bind(a),get option(){return i.option},get isHide(){return i.isHide},get isStop(){return i.isStop}}}}u.icons=p.default.icons,"u">typeof window&&(window.artplayerPluginDanmuku=u)},{"./danmuku":"g81Wu","./heatmap":"hjtgU","./setting":"ho690","@parcel/transformer-js/src/esmodule-helpers.js":"6ykb1"}],g81Wu:[function(t,e,i,a){var n=t("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(i);var o=t("bundle-text:./worker"),s=n.interopDefault(o),r=t("./bilibili");class l{constructor(t,e){const{constructor:i,template:a}=t;this.utils=i.utils,this.validator=i.validator,this.$danmuku=a.$danmuku,this.$player=a.$player,this.art=t,this.queue=[],this.$refs=[],this.isStop=!1,this.isHide=!1,this.timer=null,this.index=0,this.option=l.option,this.states={wait:[],ready:[],emit:[],stop:[]},this.config(e,!0);const n=new Blob([s.default.replace("export{e as default};","")],{type:"application/javascript"});this.worker=new Worker(URL.createObjectURL(n)),this.start=this.start.bind(this),this.stop=this.stop.bind(this),this.reset=this.reset.bind(this),this.resize=this.resize.bind(this),this.destroy=this.destroy.bind(this),t.on("video:play",this.start),t.on("video:playing",this.start),t.on("video:pause",this.stop),t.on("video:waiting",this.stop),t.on("destroy",this.destroy),t.on("resize",this.resize),this.load()}static get option(){return{danmuku:[],speed:5,margin:[10,"25%"],opacity:1,color:"#FFFFFF",mode:0,modes:[0,1,2],fontSize:25,antiOverlap:!0,synchronousPlayback:!1,mount:void 0,heatmap:!1,width:512,points:[],filter:()=>!0,beforeEmit:()=>!0,beforeVisible:()=>!0,visible:!0,emitter:!0,maxLength:200,lockTime:5,theme:"dark",OPACITY:{},FONT_SIZE:{},MARGIN:{},SPEED:{},COLOR:[]}}static get scheme(){return{danmuku:"array|function|string",speed:"number",margin:"array",opacity:"number",color:"string",mode:"number",modes:"array",fontSize:"number|string",antiOverlap:"boolean",synchronousPlayback:"boolean",mount:"?htmldivelement|string",heatmap:"object|boolean",width:"number",points:"array",filter:"function",beforeEmit:"function",beforeVisible:"function",visible:"boolean",emitter:"boolean",maxLength:"number",lockTime:"number",theme:"string",OPACITY:"object",FONT_SIZE:"object",MARGIN:"object",SPEED:"object",COLOR:"array"}}static get cssText(){return` user-select: none; position: absolute; white-space: pre; pointer-events: none; perspective: 500px; display: inline-block; will-change: transform; font-weight: normal; line-height: 1.125; visibility: hidden; font-family: SimHei, "Microsoft JhengHei", Arial, Helvetica, sans-serif; text-shadow: rgb(0, 0, 0) 1px 0px 1px, rgb(0, 0, 0) 0px 1px 1px, rgb(0, 0, 0) 0px -1px 1px, rgb(0, 0, 0) -1px 0px 1px; `}get isRotate(){return this.art.pLine truncated
|
||||
@@ -5,4 +5,4 @@
|
||||
* (c) 2017-2026 Harvey Zhao
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,n,a,i){var r="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},o="function"==typeof r[a]&&r[a],s=o.i||{},l=o.cache||{},u="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function d(t,n){if(!l[t]){if(!e[t]){if(i[t])return i[t];var s="function"==typeof r[a]&&r[a];if(!n&&s)return s(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}f.resolve=function(n){var a=e[t][1][n];return null!=a?a:n},f.cache={};var p=l[t]=new d.Module(t);e[t][0].call(p.exports,f,p,p.exports,r)}return l[t].exports;function f(e){var t=f.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var n={__esModule:!0};return t.forEach(function(e){var t=e[0],a=e[1],i=e[2]||e[0],r=d(a);"*"===t?Object.keys(r).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(n,e)||Object.defineProperty(n,e,{enumerable:!0,get:function(){return r[e]}})}):"*"===i?Object.defineProperty(n,t,{enumerable:!0,value:r}):Object.defineProperty(n,t,{enumerable:!0,get:function(){return"default"===i?r.__esModule?r.default:r:r[i]}})}),n}return d(t)}}d.isParcelRequire=!0,d.Module=function(e){this.id=e,this.bundle=d,this.require=u,this.exports={}},d.modules=e,d.cache=l,d.parent=o,d.distDir=void 0,d.publicUrl=void 0,d.devServer=void 0,d.i=s,d.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(d,"root",{get:function(){return r[a]}}),r[a]=d;for(var c=0;c<t.length;c++)d(t[c]);if(n){var p=d(n);"object"==typeof exports&&"u">typeof module?module.exports=p:"function"==typeof define&&define.amd&&define(function(){return p})}}({l3CkF:[function(e,t,n,a){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(n),i.export(n,"default",function(){return c});var r=e("./danmuku"),o=i.interopDefault(r),s=e("./heatmap"),l=i.interopDefault(s),u=e("./setting"),d=i.interopDefault(u);function c(e){return function(t){var n=new(0,o.default)(t,e),a=new(0,d.default)(t,n);return n.option.heatmap&&(0,l.default)(t,n,n.option.heatmap),{name:"artplayerPluginDanmuku",emit:n.emit.bind(n),load:n.load.bind(n),config:n.config.bind(n),hide:n.hide.bind(n),show:n.show.bind(n),reset:n.reset.bind(n),mount:a.mount.bind(a),get option(){return n.option},get isHide(){return n.isHide},get isStop(){return n.isStop}}}}c.icons=d.default.icons,"u">typeof window&&(window.artplayerPluginDanmuku=c)},{"./danmuku":"u1ZRC","./heatmap":"hLPK6","./setting":"jpEpW","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],u1ZRC:[function(e,t,n,a){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(n),i.export(n,"default",function(){return h});var r=e("@swc/helpers/cjs/_async_to_generator.cjs"),o=e("@swc/helpers/cjs/_class_call_check.cjs"),s=e("@swc/helpers/cjs/_create_class.cjs"),l=e("@swc/helpers/cjs/_object_spread.cjs"),u=e("@swc/helpers/cjs/_object_spread_props.cjs"),d=e("@swc/helpers/cjs/_ts_generator.cjs"),c=e("bundle-text:./worker"),p=i.interopDefault(c),f=e("./bilibili"),h=function(){"use strict";function e(t,n){(0,o._)(this,e);var a=t.constructor,i=t.template;this.utils=a.utils,this.validator=a.validator,this.$danmuku=i.$danmuku,this.$player=i.$player,this.art=t,this.queue=[],this.$refs=[],this.isStop=!1,this.isHide=!1,this.timer=null,this.index=0,this.option=e.option,this.states={wait:[],ready:[],emit:[],stop:[]},this.config(n,!0);var r=new Blob([p.default.replace("export{e as default};","")],{type:"application/javascript"});this.worker=new Worker(URL.createObjectURL(r)),this.start=this.start.bind(this),this.stop=this.stop.bind(this),this.reset=this.reset.bind(this),this.resize=this.resize.bind(this),this.destroy=this.destroy.bind(this),t.on("video:play",this.start),t.on("video:playing",this.start),t.on("video:pause",this.stop),t.on("video:waiting",this.stop),t.on("destroy",this.destroy),t.on("resize",this.resize),this.load()}return(0,s._)(e,[{key:"isRotate",get:function(){var e,t;return null==(t=this.art.plugins)||null==(e=t.autoOrientation)?void 0:e.state}},{key:"marginTop",get:function(){var t=this.utils.clamp,n=this.option.margin[0],a=this.$player.clientHeight;return"number"==typeof n?t(n,0,a):"string"==typeof n&&n.endsWith("%")?t(a*(Number.parseFloat(n)/100),0,a):e.option.margin[0]}},{key:"marginBottom",get:function(){var t=this.utils.clamp,n=this.option.margin[1],a=this.$player.clientHeight;return"number"==typeof n?t(n,0,a):"string"==typeof n&&n.endsWith("%")?t(a*(Number.parseFloat(n)/100),0,a):e.option.margin[1]}},{key:"fontSize",get:function(){var t=this.utils.clamp,n=this.$player.clientHeight,a=this.option.fontSize;return"number"==typeof a?Math.round(t(a,12,n)):"string"==typeof a&&a.endsWith("%")?Math.round(t(n*(Number.parseFloat(a)/100),12,n)):e.option.fontSize}},{key:"$ref",get:function(){var t=this.$refs.pop()||document.createElement("div");return t.style.cssText=e.cssText,t.dataset.mode="",t.dataset.id="",t.classNamLine truncated
|
||||
!function(e,t,n,a,i,r,o,s){var l="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},u="function"==typeof l[a]&&l[a],d=u.i||{},c=u.cache||{},p="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function f(t,n){if(!c[t]){if(!e[t]){if(i[t])return i[t];var r="function"==typeof l[a]&&l[a];if(!n&&r)return r(t,!0);if(u)return u(t,!0);if(p&&"string"==typeof t)return p(t);var o=Error("Cannot find module '"+t+"'");throw o.code="MODULE_NOT_FOUND",o}d.resolve=function(n){var a=e[t][1][n];return null!=a?a:n},d.cache={};var s=c[t]=new f.Module(t);e[t][0].call(s.exports,d,s,s.exports,l)}return c[t].exports;function d(e){var t=d.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var n={__esModule:!0};return t.forEach(function(e){var t=e[0],a=e[1],i=e[2]||e[0],r=f(a);"*"===t?Object.keys(r).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(n,e)||Object.defineProperty(n,e,{enumerable:!0,get:function(){return r[e]}})}):"*"===i?Object.defineProperty(n,t,{enumerable:!0,value:r}):Object.defineProperty(n,t,{enumerable:!0,get:function(){return"default"===i?r.__esModule?r.default:r:r[i]}})}),n}return f(t)}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.require=p,this.exports={}},f.modules=e,f.cache=c,f.parent=u,f.distDir=void 0,f.publicUrl=void 0,f.devServer=void 0,f.i=d,f.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(f,"root",{get:function(){return l[a]}}),l[a]=f;for(var h=0;h<t.length;h++)f(t[h]);if(n){var m=f(n);"object"==typeof exports&&"u">typeof module?module.exports=m:"function"==typeof define&&define.amd&&define(function(){return m})}}({l3CkF:[function(e,t,n,a){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(n),i.export(n,"default",function(){return c});var r=e("./danmuku"),o=i.interopDefault(r),s=e("./heatmap"),l=i.interopDefault(s),u=e("./setting"),d=i.interopDefault(u);function c(e){return function(t){var n=new(0,o.default)(t,e),a=new(0,d.default)(t,n);return n.option.heatmap&&(0,l.default)(t,n,n.option.heatmap),{name:"artplayerPluginDanmuku",emit:n.emit.bind(n),load:n.load.bind(n),config:n.config.bind(n),hide:n.hide.bind(n),show:n.show.bind(n),reset:n.reset.bind(n),mount:a.mount.bind(a),get option(){return n.option},get isHide(){return n.isHide},get isStop(){return n.isStop}}}}c.icons=d.default.icons,"u">typeof window&&(window.artplayerPluginDanmuku=c)},{"./danmuku":"u1ZRC","./heatmap":"hLPK6","./setting":"jpEpW","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],u1ZRC:[function(e,t,n,a){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(n),i.export(n,"default",function(){return h});var r=e("@swc/helpers/cjs/_async_to_generator.cjs"),o=e("@swc/helpers/cjs/_class_call_check.cjs"),s=e("@swc/helpers/cjs/_create_class.cjs"),l=e("@swc/helpers/cjs/_object_spread.cjs"),u=e("@swc/helpers/cjs/_object_spread_props.cjs"),d=e("@swc/helpers/cjs/_ts_generator.cjs"),c=e("bundle-text:./worker"),p=i.interopDefault(c),f=e("./bilibili"),h=function(){"use strict";function e(t,n){(0,o._)(this,e);var a=t.constructor,i=t.template;this.utils=a.utils,this.validator=a.validator,this.$danmuku=i.$danmuku,this.$player=i.$player,this.art=t,this.queue=[],this.$refs=[],this.isStop=!1,this.isHide=!1,this.timer=null,this.index=0,this.option=e.option,this.states={wait:[],ready:[],emit:[],stop:[]},this.config(n,!0);var r=new Blob([p.default.replace("export{e as default};","")],{type:"application/javascript"});this.worker=new Worker(URL.createObjectURL(r)),this.start=this.start.bind(this),this.stop=this.stop.bind(this),this.reset=this.reset.bind(this),this.resize=this.resize.bind(this),this.destroy=this.destroy.bind(this),t.on("video:play",this.start),t.on("video:playing",this.start),t.on("video:pause",this.stop),t.on("video:waiting",this.stop),t.on("destroy",this.destroy),t.on("resize",this.resize),this.load()}return(0,s._)(e,[{key:"isRotate",get:function(){var e,t;return null==(t=this.art.plugins)||null==(e=t.autoOrientation)?void 0:e.state}},{key:"marginTop",get:function(){var t=this.utils.clamp,n=this.option.margin[0],a=this.$player.clientHeight;return"number"==typeof n?t(n,0,a):"string"==typeof n&&n.endsWith("%")?t(a*(Number.parseFloat(n)/100),0,a):e.option.margin[0]}},{key:"marginBottom",get:function(){var t=this.utils.clamp,n=this.option.margin[1],a=this.$player.clientHeight;return"number"==typeof n?t(n,0,a):"string"==typeof n&&n.endsWith("%")?t(a*(Number.parseFloat(n)/100),0,a):e.option.margin[1]}},{key:"fontSize",get:function(){var t=this.utils.clamp,n=this.$player.clientHeight,a=this.option.fontSize;return"number"==typeof a?Math.round(t(a,12,n)):"string"==typeof a&&a.endsWith("%")?Math.round(t(n*(Number.parseFloat(a)/100),12,n)):e.option.fontSize}},{key:"$ref",get:function(){var t=this.$refs.pop()||document.createElement("div");return t.style.cssText=e.cssText,t.dataset.mode="",t.dataset.id="",t.clLine truncated
|
||||
@@ -5,4 +5,4 @@
|
||||
* (c) 2017-2026 Harvey Zhao
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,i,a,o){var n="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},s="function"==typeof n[a]&&n[a],r=s.i||{},l=s.cache||{},d="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(t,i){if(!l[t]){if(!e[t]){if(o[t])return o[t];var r="function"==typeof n[a]&&n[a];if(!i&&r)return r(t,!0);if(s)return s(t,!0);if(d&&"string"==typeof t)return d(t);var u=Error("Cannot find module '"+t+"'");throw u.code="MODULE_NOT_FOUND",u}m.resolve=function(i){var a=e[t][1][i];return null!=a?a:i},m.cache={};var h=l[t]=new p.Module(t);e[t][0].call(h.exports,m,h,h.exports,n)}return l[t].exports;function m(e){var t=m.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var i={__esModule:!0};return t.forEach(function(e){var t=e[0],a=e[1],o=e[2]||e[0],n=p(a);"*"===t?Object.keys(n).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(i,e)||Object.defineProperty(i,e,{enumerable:!0,get:function(){return n[e]}})}):"*"===o?Object.defineProperty(i,t,{enumerable:!0,value:n}):Object.defineProperty(i,t,{enumerable:!0,get:function(){return"default"===o?n.__esModule?n.default:n:n[o]}})}),i}return p(t)}}p.isParcelRequire=!0,p.Module=function(e){this.id=e,this.bundle=p,this.require=d,this.exports={}},p.modules=e,p.cache=l,p.parent=s,p.distDir=void 0,p.publicUrl=void 0,p.devServer=void 0,p.i=r,p.register=function(t,i){e[t]=[function(e,t){t.exports=i},{}]},Object.defineProperty(p,"root",{get:function(){return n[a]}}),n[a]=p;for(var u=0;u<t.length;u++)p(t[u]);if(i){var h=p(i);"object"==typeof exports&&"u">typeof module?module.exports=h:"function"==typeof define&&define.amd&&define(function(){return h})}}({"7ICE7":[function(e,t,i,a){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(i),o.export(i,"default",()=>u);var n=e("./danmuku"),s=o.interopDefault(n),r=e("./heatmap"),l=o.interopDefault(r),d=e("./setting"),p=o.interopDefault(d);function u(e){return t=>{let i=new(0,s.default)(t,e),a=new(0,p.default)(t,i);return i.option.heatmap&&(0,l.default)(t,i,i.option.heatmap),{name:"artplayerPluginDanmuku",emit:i.emit.bind(i),load:i.load.bind(i),config:i.config.bind(i),hide:i.hide.bind(i),show:i.show.bind(i),reset:i.reset.bind(i),mount:a.mount.bind(a),get option(){return i.option},get isHide(){return i.isHide},get isStop(){return i.isStop}}}}u.icons=p.default.icons,"u">typeof window&&(window.artplayerPluginDanmuku=u)},{"./danmuku":"9bpce","./heatmap":"9KNY2","./setting":"94xSe","@parcel/transformer-js/src/esmodule-helpers.js":"loqXi"}],"9bpce":[function(e,t,i,a){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(i);var n=e("bundle-text:./worker"),s=o.interopDefault(n),r=e("./bilibili");class l{constructor(e,t){let{constructor:i,template:a}=e;this.utils=i.utils,this.validator=i.validator,this.$danmuku=a.$danmuku,this.$player=a.$player,this.art=e,this.queue=[],this.$refs=[],this.isStop=!1,this.isHide=!1,this.timer=null,this.index=0,this.option=l.option,this.states={wait:[],ready:[],emit:[],stop:[]},this.config(t,!0);let o=new Blob([s.default.replace("export{e as default};","")],{type:"application/javascript"});this.worker=new Worker(URL.createObjectURL(o)),this.start=this.start.bind(this),this.stop=this.stop.bind(this),this.reset=this.reset.bind(this),this.resize=this.resize.bind(this),this.destroy=this.destroy.bind(this),e.on("video:play",this.start),e.on("video:playing",this.start),e.on("video:pause",this.stop),e.on("video:waiting",this.stop),e.on("destroy",this.destroy),e.on("resize",this.resize),this.load()}static get option(){return{danmuku:[],speed:5,margin:[10,"25%"],opacity:1,color:"#FFFFFF",mode:0,modes:[0,1,2],fontSize:25,antiOverlap:!0,synchronousPlayback:!1,mount:void 0,heatmap:!1,width:512,points:[],filter:()=>!0,beforeEmit:()=>!0,beforeVisible:()=>!0,visible:!0,emitter:!0,maxLength:200,lockTime:5,theme:"dark",OPACITY:{},FONT_SIZE:{},MARGIN:{},SPEED:{},COLOR:[]}}static get scheme(){return{danmuku:"array|function|string",speed:"number",margin:"array",opacity:"number",color:"string",mode:"number",modes:"array",fontSize:"number|string",antiOverlap:"boolean",synchronousPlayback:"boolean",mount:"?htmldivelement|string",heatmap:"object|boolean",width:"number",points:"array",filter:"function",beforeEmit:"function",beforeVisible:"function",visible:"boolean",emitter:"boolean",maxLength:"number",lockTime:"number",theme:"string",OPACITY:"object",FONT_SIZE:"object",MARGIN:"object",SPEED:"object",COLOR:"array"}}static get cssText(){return` user-select: none; position: absolute; white-space: pre; pointer-events: none; perspective: 500px; display: inline-block; will-change: transform; font-weight: normal; line-height: 1.125; visibility: hidden; font-family: SimHei, "Microsoft JhengHei", Arial, Helvetica, sans-serif; text-shadow: rgb(0, 0, 0) 1px 0px 1px, rgb(0, 0, 0) 0px 1px 1px, rgb(0, 0, 0) 0px -1px 1px, rgb(0, 0, 0) -1px 0px 1px; `}get isRotate(){return this.art.plugins?.Line truncated
|
||||
!function(e,t,i,a,o,n,s,r){var l="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},d="function"==typeof l[a]&&l[a],p=d.i||{},u=d.cache||{},h="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function m(t,i){if(!u[t]){if(!e[t]){if(o[t])return o[t];var n="function"==typeof l[a]&&l[a];if(!i&&n)return n(t,!0);if(d)return d(t,!0);if(h&&"string"==typeof t)return h(t);var s=Error("Cannot find module '"+t+"'");throw s.code="MODULE_NOT_FOUND",s}p.resolve=function(i){var a=e[t][1][i];return null!=a?a:i},p.cache={};var r=u[t]=new m.Module(t);e[t][0].call(r.exports,p,r,r.exports,l)}return u[t].exports;function p(e){var t=p.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var i={__esModule:!0};return t.forEach(function(e){var t=e[0],a=e[1],o=e[2]||e[0],n=m(a);"*"===t?Object.keys(n).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(i,e)||Object.defineProperty(i,e,{enumerable:!0,get:function(){return n[e]}})}):"*"===o?Object.defineProperty(i,t,{enumerable:!0,value:n}):Object.defineProperty(i,t,{enumerable:!0,get:function(){return"default"===o?n.__esModule?n.default:n:n[o]}})}),i}return m(t)}}m.isParcelRequire=!0,m.Module=function(e){this.id=e,this.bundle=m,this.require=h,this.exports={}},m.modules=e,m.cache=u,m.parent=d,m.distDir=void 0,m.publicUrl=void 0,m.devServer=void 0,m.i=p,m.register=function(t,i){e[t]=[function(e,t){t.exports=i},{}]},Object.defineProperty(m,"root",{get:function(){return l[a]}}),l[a]=m;for(var c=0;c<t.length;c++)m(t[c]);if(i){var f=m(i);"object"==typeof exports&&"u">typeof module?module.exports=f:"function"==typeof define&&define.amd&&define(function(){return f})}}({"7ICE7":[function(e,t,i,a){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(i),o.export(i,"default",()=>u);var n=e("./danmuku"),s=o.interopDefault(n),r=e("./heatmap"),l=o.interopDefault(r),d=e("./setting"),p=o.interopDefault(d);function u(e){return t=>{let i=new(0,s.default)(t,e),a=new(0,p.default)(t,i);return i.option.heatmap&&(0,l.default)(t,i,i.option.heatmap),{name:"artplayerPluginDanmuku",emit:i.emit.bind(i),load:i.load.bind(i),config:i.config.bind(i),hide:i.hide.bind(i),show:i.show.bind(i),reset:i.reset.bind(i),mount:a.mount.bind(a),get option(){return i.option},get isHide(){return i.isHide},get isStop(){return i.isStop}}}}u.icons=p.default.icons,"u">typeof window&&(window.artplayerPluginDanmuku=u)},{"./danmuku":"9bpce","./heatmap":"9KNY2","./setting":"94xSe","@parcel/transformer-js/src/esmodule-helpers.js":"loqXi"}],"9bpce":[function(e,t,i,a){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(i);var n=e("bundle-text:./worker"),s=o.interopDefault(n),r=e("./bilibili");class l{constructor(e,t){let{constructor:i,template:a}=e;this.utils=i.utils,this.validator=i.validator,this.$danmuku=a.$danmuku,this.$player=a.$player,this.art=e,this.queue=[],this.$refs=[],this.isStop=!1,this.isHide=!1,this.timer=null,this.index=0,this.option=l.option,this.states={wait:[],ready:[],emit:[],stop:[]},this.config(t,!0);let o=new Blob([s.default.replace("export{e as default};","")],{type:"application/javascript"});this.worker=new Worker(URL.createObjectURL(o)),this.start=this.start.bind(this),this.stop=this.stop.bind(this),this.reset=this.reset.bind(this),this.resize=this.resize.bind(this),this.destroy=this.destroy.bind(this),e.on("video:play",this.start),e.on("video:playing",this.start),e.on("video:pause",this.stop),e.on("video:waiting",this.stop),e.on("destroy",this.destroy),e.on("resize",this.resize),this.load()}static get option(){return{danmuku:[],speed:5,margin:[10,"25%"],opacity:1,color:"#FFFFFF",mode:0,modes:[0,1,2],fontSize:25,antiOverlap:!0,synchronousPlayback:!1,mount:void 0,heatmap:!1,width:512,points:[],filter:()=>!0,beforeEmit:()=>!0,beforeVisible:()=>!0,visible:!0,emitter:!0,maxLength:200,lockTime:5,theme:"dark",OPACITY:{},FONT_SIZE:{},MARGIN:{},SPEED:{},COLOR:[]}}static get scheme(){return{danmuku:"array|function|string",speed:"number",margin:"array",opacity:"number",color:"string",mode:"number",modes:"array",fontSize:"number|string",antiOverlap:"boolean",synchronousPlayback:"boolean",mount:"?htmldivelement|string",heatmap:"object|boolean",width:"number",points:"array",filter:"function",beforeEmit:"function",beforeVisible:"function",visible:"boolean",emitter:"boolean",maxLength:"number",lockTime:"number",theme:"string",OPACITY:"object",FONT_SIZE:"object",MARGIN:"object",SPEED:"object",COLOR:"array"}}static get cssText(){return` user-select: none; position: absolute; white-space: pre; pointer-events: none; perspective: 500px; display: inline-block; will-change: transform; font-weight: normal; line-height: 1.125; visibility: hidden; font-family: SimHei, "Microsoft JhengHei", Arial, Helvetica, sans-serif; text-shadow: rgb(0, 0, 0) 1px 0px 1px, rgb(0, 0, 0) 0px 1px 1px, rgb(0, 0, 0) 0px -1px 1px, rgb(0, 0, 0) -1px 0px 1px; `}get isRotate(){return this.art.pluLine truncated
|
||||
Reference in new issue
Block a user