Refactor code structure for improved readability and maintainability

This commit is contained in:
Harvey Zhao committed 2026-01-01 19:50:00 +08:00
1 parent 4a0fbda3c4
commit 0bb4e1acdb
214 files changed
+462 -415

No files matched your search

@@ -2,7 +2,7 @@
/*!
* artplayer-plugin-document-pip.js v1.0.2
* Github: https://github.com/zhw2590582/ArtPlayer
* (c) 2017-2025 Harvey Zack
* (c) 2017-2026 Harvey Zack
* Released under the MIT License.
*/
!function(e,t,r,n,o,i,c,a){var u="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},l="function"==typeof u[n]&&u[n],s=l.i||{},f=l.cache||{},p="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function d(t,r){if(!f[t]){if(!e[t]){if(o[t])return o[t];var i="function"==typeof u[n]&&u[n];if(!r&&i)return i(t,!0);if(l)return l(t,!0);if(p&&"string"==typeof t)return p(t);var c=Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}s.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},s.cache={};var a=f[t]=new d.Module(t);e[t][0].call(a.exports,s,a,a.exports,u)}return f[t].exports;function s(e){var t=s.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var r={__esModule:!0};return t.forEach(function(e){var t=e[0],n=e[1],o=e[2]||e[0],i=d(n);"*"===t?Object.keys(i).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(r,e)||Object.defineProperty(r,e,{enumerable:!0,get:function(){return i[e]}})}):"*"===o?Object.defineProperty(r,t,{enumerable:!0,value:i}):Object.defineProperty(r,t,{enumerable:!0,get:function(){return"default"===o?i.__esModule?i.default:i:i[o]}})}),r}return d(t)}}d.isParcelRequire=!0,d.Module=function(e){this.id=e,this.bundle=d,this.require=p,this.exports={}},d.modules=e,d.cache=f,d.parent=l,d.distDir=void 0,d.publicUrl=void 0,d.devServer=void 0,d.i=s,d.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(d,"root",{get:function(){return u[n]}}),u[n]=d;for(var y=0;y<t.length;y++)d(t[y]);if(r){var h=d(r);"object"==typeof exports&&"undefined"!=typeof module?module.exports=h:"function"==typeof define&&define.amd&&define(function(){return h})}}({"5Wzsp":[function(e,t,r,n){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(r),o.export(r,"default",function(){return s});var i=e("@swc/helpers/cjs/_async_to_generator.cjs"),c=e("@swc/helpers/cjs/_object_spread.cjs"),a=e("@swc/helpers/cjs/_ts_generator.cjs"),u=e("bundle-text:./style.less"),l=o.interopDefault(u);function s(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=(0,c._)({width:480,height:270,fallbackToVideoPiP:!0,placeholder:"Playing in Document Picture-in-Picture"},e);return function(e){var r,n="documentPictureInPicture"in window&&"function"==typeof(null==(r=window.documentPictureInPicture)?void 0:r.requestWindow),o=e.proxy,c=e.icons,u=e.i18n,l=e.template.$player,s=e.constructor.utils,f=s.append,p=s.tooltip,d=s.addClass,y=s.removeClass,h=s.sleep,_={win:null,originalParent:null,originalNext:null,currentDoc:null,placeholder:null};function m(){return(0,i._)(function(){var r,o,i,c,u,s,f,p;return(0,a._)(this,function(a){switch(a.label){case 0:if(!n&&t.fallbackToVideoPiP)return e.pip=!0,console.warn("[artplayer-plugin-document-pip] Document Picture-in-Picture is not supported, falling back to Video Picture-in-Picture"),[2];if(_.win)return[2];a.label=1;case 1:return a.trys.push([1,4,,5]),[4,window.documentPictureInPicture.requestWindow({width:t.width,height:t.height})];case 2:_.win=i=a.sent(),_.currentDoc=i.document,_.placeholder=document.createElement("div"),_.placeholder.className="artplayer-document-pip-placeholder",_.placeholder.style.cssText="display:flex;justify-content:center;align-items:center;width:100%;height:100%;",_.placeholder.textContent=t.placeholder,_.originalParent=l.parentNode,_.originalNext=l.nextSibling,_.originalParent.insertBefore(_.placeholder,_.originalNext),(c=i.document.createElement("div")).id="__art_dpip_root",i.document.body.appendChild(c);var y=i.document,m=y.createElement("style");if(m.textContent="\n html, body { margin:0; padding:0; width:100%; height:100%; background:#000; overflow:hidden; }\n #__art_dpip_root { position:absolute; inset:0; display:flex; }\n #__art_dpip_root > * { width:100% !important; height:100% !important; }\n ",y.head.appendChild(m),!y.querySelector('meta[name="viewport"]')){var b=y.createElement("meta");b.name="viewport",b.content="width=device-width,initial-scale=1",y.head.appendChild(b)}try{document.querySelectorAll('link[rel="stylesheet"]').forEach(function(e){var t=y.createElement("link");t.rel="stylesheet",t.href=e.href,e.media&&(t.media=e.media),e.crossOrigin&&(t.crossOrigin=e.crossOrigin),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),y.head.appendChild(t)})}catch(e){}try{document.querySelectorAll("style").forEach(function(e){var t=y.createElement("style");t.textContent=e.textContent,y.head.appendChild(t)})}catch(e){}return u=i.document.adoptNode(l),c.appendChild(u),_.currentDoc=i.document,s=function(){var t;return null==(t=e.resize)?void 0:t.call(e)},f=function(){return v()},i.addEventListener("resize",s),i.addEventListener("pagehide",f),i.addEventListener("unload",f),_.cleanup=function(){i.removeEventListener("resize",s),i.removeEventListener("pagehide",f),i.removeEventListener("unload",f)},d(l,"artplayer-document-pip"),null==(r=(o=e.Line truncated
!function(e,t,n,r,o,i,l,c){var u="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},a="function"==typeof u[r]&&u[r],d=a.i||{},s=a.cache||{},p="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function f(t,n){if(!s[t]){if(!e[t]){if(o[t])return o[t];var i="function"==typeof u[r]&&u[r];if(!n&&i)return i(t,!0);if(a)return a(t,!0);if(p&&"string"==typeof t)return p(t);var l=Error("Cannot find module '"+t+"'");throw l.code="MODULE_NOT_FOUND",l}d.resolve=function(n){var r=e[t][1][n];return null!=r?r:n},d.cache={};var c=s[t]=new f.Module(t);e[t][0].call(c.exports,d,c,c.exports,u)}return s[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],r=e[1],o=e[2]||e[0],i=f(r);"*"===t?Object.keys(i).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(n,e)||Object.defineProperty(n,e,{enumerable:!0,get:function(){return i[e]}})}):"*"===o?Object.defineProperty(n,t,{enumerable:!0,value:i}):Object.defineProperty(n,t,{enumerable:!0,get:function(){return"default"===o?i.__esModule?i.default:i:i[o]}})}),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=s,f.parent=a,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 u[r]}}),u[r]=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})}}({"5Wzsp":[function(e,t,n,r){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(n),o.export(n,"default",function(){return d});var i=e("@swc/helpers/cjs/_async_to_generator.cjs"),l=e("@swc/helpers/cjs/_object_spread.cjs"),c=e("@swc/helpers/cjs/_ts_generator.cjs"),u=e("bundle-text:./style.less"),a=o.interopDefault(u);function d(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=(0,l._)({width:480,height:270,fallbackToVideoPiP:!0,placeholder:"Playing in Document Picture-in-Picture"},e);return function(e){var n,r="documentPictureInPicture"in window&&"function"==typeof(null==(n=window.documentPictureInPicture)?void 0:n.requestWindow),o=e.proxy,l=e.icons,u=e.i18n,a=e.template.$player,d=e.constructor.utils,s=d.append,p=d.tooltip,f=d.addClass,h=d.removeClass,m=d.sleep,y={win:null,originalParent:null,originalNext:null,currentDoc:null,placeholder:null};function v(){return(0,i._)(function(){var n,o,i,l,u,d,s,p;return(0,c._)(this,function(c){switch(c.label){case 0:if(!r&&t.fallbackToVideoPiP)return e.pip=!0,console.warn("[artplayer-plugin-document-pip] Document Picture-in-Picture is not supported, falling back to Video Picture-in-Picture"),[2];if(y.win)return[2];c.label=1;case 1:return c.trys.push([1,4,,5]),[4,window.documentPictureInPicture.requestWindow({width:t.width,height:t.height})];case 2:y.win=i=c.sent(),y.currentDoc=i.document,y.placeholder=document.createElement("div"),y.placeholder.className="artplayer-document-pip-placeholder",y.placeholder.style.cssText="display:flex;justify-content:center;align-items:center;width:100%;height:100%;",y.placeholder.textContent=t.placeholder,y.originalParent=a.parentNode,y.originalNext=a.nextSibling,y.originalParent.insertBefore(y.placeholder,y.originalNext),(l=i.document.createElement("div")).id="__art_dpip_root",i.document.body.appendChild(l);var h=i.document,v=h.createElement("style");if(v.textContent="\n html, body { margin:0; padding:0; width:100%; height:100%; background:#000; overflow:hidden; }\n #__art_dpip_root { position:absolute; inset:0; display:flex; }\n #__art_dpip_root > * { width:100% !important; height:100% !important; }\n ",h.head.appendChild(v),!h.querySelector('meta[name="viewport"]')){var g=h.createElement("meta");g.name="viewport",g.content="width=device-width,initial-scale=1",h.head.appendChild(g)}try{document.querySelectorAll('link[rel="stylesheet"]').forEach(function(e){var t=h.createElement("link");t.rel="stylesheet",t.href=e.href,e.media&&(t.media=e.media),e.crossOrigin&&(t.crossOrigin=e.crossOrigin),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),h.head.appendChild(t)})}catch(e){}try{document.querySelectorAll("style").forEach(function(e){var t=h.createElement("style");t.textContent=e.textContent,h.head.appendChild(t)})}catch(e){}return u=i.document.adoptNode(a),l.appendChild(u),y.currentDoc=i.document,d=function(){var t;return null==(t=e.resize)?void 0:t.call(e)},s=function(){return b()},i.addEventListener("resize",d),i.addEventListener("pagehide",s),i.addEventListener("unload",s),y.cleanup=function(){i.removeEventListener("resize",d),i.removeEventListener("pagehide",s),i.removeEventListener("unload",s)},f(a,"artplayer-document-pip"),null==(n=(o=e.events).bindGlobalEvents)||n.call(o),e.emit("document-Line truncated