mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-20 20:21:20 -08:00
Refactor code structure for improved readability and maintainability
Remove debugging border from the websr plugin's styling Enhance canvas sizing logic in artplayer-plugin-websr - Updated canvas positioning to center it within the player. - Introduced a new function to calculate canvas size based on the video aspect ratio. - Adjusted canvas dimensions during initialization and on resize events to maintain aspect ratio. - Ensured canvas styles are updated to reflect the calculated dimensions. feat: add comparison mode to artplayer-plugin-websr - Updated README.md to reflect new comparison feature and simplified content. - Modified package.json to remove unnecessary keywords. - Enhanced index.js to implement comparison functionality, allowing users to compare original and upscaled video. - Added new methods for enabling, disabling, and toggling comparison mode, as well as setting and getting the comparison position. - Updated TypeScript definitions to include new comparison options and methods.
This commit is contained in:
1 parent
07a5b0c0f0
commit
7dffd99cfd
308 files changed
+3175
-852
No files matched your search
@@ -5,4 +5,4 @@
|
||||
* (c) 2017-2026 Harvey Zack
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!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
|
||||
!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
|
||||
Reference in new issue
Block a user