build all

Refactor utility functions for improved readability and consistency

- Updated compatibility.js to use consistent line endings and formatting.
- Refactored component.js for better readability and structure, including consistent use of arrow functions and binding.
- Simplified dom.js functions with consistent formatting and improved readability.
- Enhanced emitter.js with consistent formatting and arrow function usage.
- Streamlined error.js for improved readability and consistency.
- Refactored file.js to use consistent formatting and improved readability.
- Improved format.js functions for better readability and consistency.
- Updated index.js to maintain consistent export formatting.
- Refactored property.js for improved readability and consistency.
- Enhanced subtitle.js with consistent formatting and improved readability.
- Refactored time.js for better readability and consistent formatting.

fix: update lint script to target only source files for consistency

Revert "fix: restore export statements for various plugins and update type definitions for better clarity"

This reverts commit b5e969d81ec765cd8a34b06e6ef4f232ef25087f.

fix: restore export statements for various plugins and update type definitions for better clarity

Refactor type definitions to use interfaces instead of type aliases for better extensibility and clarity across i18n, icons, option, player, quality, setting, subtitle, template, and utils modules.
This commit is contained in:
Harvey Zack committed 2025-08-03 13:17:33 +08:00
1 parent 532dd67cfd
commit 35ad9883af
447 files changed
+18248 -17946

No files matched your search

@@ -5,5 +5,5 @@
* (c) 2017-2025 Harvey Zack
* Released under the MIT License.
*/
!function(e,t,n,o,r,i,u,l){var d="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},f="function"==typeof d[o]&&d[o],a=f.i||{},c=f.cache||{},s="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(t,n){if(!c[t]){if(!e[t]){if(r[t])return r[t];var i="function"==typeof d[o]&&d[o];if(!n&&i)return i(t,!0);if(f)return f(t,!0);if(s&&"string"==typeof t)return s(t);var u=Error("Cannot find module '"+t+"'");throw u.code="MODULE_NOT_FOUND",u}a.resolve=function(n){var o=e[t][1][n];return null!=o?o:n},a.cache={};var l=c[t]=new p.Module(t);e[t][0].call(l.exports,a,l,l.exports,d)}return c[t].exports;function a(e){var t=a.resolve(e);return!1===t?{}:p(t)}}p.isParcelRequire=!0,p.Module=function(e){this.id=e,this.bundle=p,this.require=s,this.exports={}},p.modules=e,p.cache=c,p.parent=f,p.distDir=void 0,p.publicUrl=void 0,p.devServer=void 0,p.i=a,p.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(p,"root",{get:function(){return d[o]}}),d[o]=p;for(var m=0;m<t.length;m++)p(t[m]);if(n){var h=p(n);"object"==typeof exports&&"undefined"!=typeof module?module.exports=h:"function"==typeof define&&define.amd&&define(function(){return h})}}({"4omrA":[function(e,t,n,o){var r=e("@parcel/transformer-js/src/esmodule-helpers.js");function i(e){return async t=>(t.on("video:loadedmetadata",()=>{let n=e.url||t.option.url,o=e.width||160,r=e.number||100,i=e.scale||1;!function({url:e,width:t,number:n},o){let r=document.createElement("video");r.crossOrigin="anonymous",r.src=e,r.onloadedmetadata=()=>{let e=r.duration,i=document.createElement("canvas"),u=i.getContext("2d"),l=Math.floor(t*r.videoHeight/r.videoWidth);i.width=10*t,i.height=l*Math.ceil(n/10);let d=0,f=null;!function a(c){i.toBlob(e=>{URL.revokeObjectURL(f),o({url:f=URL.createObjectURL(e),height:l})},"image/jpeg"),c>=n||(r.currentTime=e*c/n,r.onseeked=()=>{u.drawImage(r,c%10*t,Math.floor(c/10)*l,t,l),d++,a(c+1)})}(0)}}({url:n,width:o,number:r},e=>{t.thumbnails={...e,column:10,number:r,width:o,scale:i}})}),{name:"artplayerPluginAutoThumbnail"})}r.defineInteropFlag(n),r.export(n,"default",()=>i),"undefined"!=typeof window&&(window.artplayerPluginAutoThumbnail=i)},{"@parcel/transformer-js/src/esmodule-helpers.js":"w4pLy"}],w4pLy:[function(e,t,n,o){n.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},n.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},n.exportAll=function(e,t){return Object.keys(e).forEach(function(n){"default"===n||"__esModule"===n||Object.prototype.hasOwnProperty.call(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[n]}})}),t},n.export=function(e,t,n){Object.defineProperty(e,t,{enumerable:!0,get:n})}},{}]},["4omrA"],"4omrA","parcelRequireb705",{});let{default:e}=parcelRequireb705("4omrA");export{e as default};
!function(e,t,n,o,r,u,i,l){var d="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},f="function"==typeof d[o]&&d[o],a=f.i||{},c=f.cache||{},s="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(t,n){if(!c[t]){if(!e[t]){if(r[t])return r[t];var u="function"==typeof d[o]&&d[o];if(!n&&u)return u(t,!0);if(f)return f(t,!0);if(s&&"string"==typeof t)return s(t);var i=Error("Cannot find module '"+t+"'");throw i.code="MODULE_NOT_FOUND",i}a.resolve=function(n){var o=e[t][1][n];return null!=o?o:n},a.cache={};var l=c[t]=new p.Module(t);e[t][0].call(l.exports,a,l,l.exports,d)}return c[t].exports;function a(e){var t=a.resolve(e);return!1===t?{}:p(t)}}p.isParcelRequire=!0,p.Module=function(e){this.id=e,this.bundle=p,this.require=s,this.exports={}},p.modules=e,p.cache=c,p.parent=f,p.distDir=void 0,p.publicUrl=void 0,p.devServer=void 0,p.i=a,p.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(p,"root",{get:function(){return d[o]}}),d[o]=p;for(var m=0;m<t.length;m++)p(t[m]);if(n){var h=p(n);"object"==typeof exports&&"undefined"!=typeof module?module.exports=h:"function"==typeof define&&define.amd&&define(function(){return h})}}({guSFC:[function(e,t,n,o){var r=e("@parcel/transformer-js/src/esmodule-helpers.js");function u(e){return async t=>(t.on("video:loadedmetadata",()=>{let n=e.url||t.option.url,o=e.width||160,r=e.number||100,u=e.scale||1;!function({url:e,width:t,number:n},o){let r=document.createElement("video");r.crossOrigin="anonymous",r.src=e,r.onloadedmetadata=()=>{let e=r.duration,u=document.createElement("canvas"),i=u.getContext("2d"),l=Math.floor(t*r.videoHeight/r.videoWidth);u.width=10*t,u.height=l*Math.ceil(n/10);let d=null;!function f(a){u.toBlob(e=>{URL.revokeObjectURL(d),o({url:d=URL.createObjectURL(e),height:l})},"image/jpeg"),a>=n||(r.currentTime=e*a/n,r.onseeked=()=>{i.drawImage(r,a%10*t,Math.floor(a/10)*l,t,l),f(a+1)})}(0)}}({url:n,width:o,number:r},e=>{t.thumbnails={...e,column:10,number:r,width:o,scale:u}})}),{name:"artplayerPluginAutoThumbnail"})}r.defineInteropFlag(n),r.export(n,"default",()=>u),"undefined"!=typeof window&&(window.artplayerPluginAutoThumbnail=u)},{"@parcel/transformer-js/src/esmodule-helpers.js":"5lQoW"}],"5lQoW":[function(e,t,n,o){n.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},n.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},n.exportAll=function(e,t){return Object.keys(e).forEach(function(n){"default"===n||"__esModule"===n||Object.prototype.hasOwnProperty.call(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[n]}})}),t},n.export=function(e,t,n){Object.defineProperty(e,t,{enumerable:!0,get:n})}},{}]},["guSFC"],"guSFC","parcelRequire4dc0",{});let{default:e}=parcelRequire4dc0("guSFC");export{e as default};
//# sourceMappingURL=artplayer-plugin-auto-thumbnail.esm.js.map
@@ -1 +1 @@
{"mappings":"C,A,S,C,C,C,C,C,C,C,C,C,C,C,C,C,C,C,E,I,E,A,a,O,W,W,A,a,O,K,K,A,a,O,O,O,A,a,O,O,O,C,E,E,A,Y,O,C,C,E,E,C,C,E,C,E,E,C,E,C,E,E,E,K,E,C,E,E,A,a,O,Q,A,Y,O,O,O,E,O,O,C,I,C,Q,S,E,C,C,C,E,G,C,C,C,E,C,C,G,C,C,C,E,C,C,G,C,C,E,C,O,C,C,E,C,I,E,A,Y,O,C,C,E,E,C,C,E,C,G,C,G,E,O,E,E,C,G,G,E,O,E,E,C,G,G,G,A,U,O,E,O,E,G,I,E,A,M,uB,E,I,O,E,I,C,mB,C,C,E,O,C,S,C,E,I,E,C,C,E,C,E,C,E,C,O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AAC,EAAM,IAK7C,OAAO,cAAc,CAAC,EAAM,EAAK,CAC/B,WAAY,CAAA,EACZ,IAAK,WACH,OAAO,CAAM,CAAC,EAAI,AACpB,CACF,EACF,GAEO,CACT,EAEA,EAAQ,MAAM,CAAG,SAAU,CAAI,CAAE,CAAQ,CAAE,CAAG,EAC5C,OAAO,cAAc,CAAC,EAAM,EAAU,CACpC,WAAY,CAAA,EACZ,IAAK,CACP,EACF,C,E,C,E,E,C,Q,C,Q,oB,C,G,G,C,Q,C,C,C,kB,gB,K,O","sources":["<anon>","src/index.js","../../node_modules/@parcel/transformer-js/src/esmodule-helpers.js"],"sourcesContent":["// modules are defined as an array\n// [ module function, map of requires ]\n//\n// map of requires is short require name -> numeric require\n//\n// anything defined in a previous bundle is accessed via the\n// orig method which is the require for previous bundles\n\n(function (\n modules,\n entry,\n mainEntry,\n parcelRequireName,\n externals,\n distDir,\n publicUrl,\n devServer\n) {\n /* eslint-disable no-undef */\n var globalObject =\n typeof globalThis !== 'undefined'\n ? globalThis\n : typeof self !== 'undefined'\n ? self\n : typeof window !== 'undefined'\n ? window\n : typeof global !== 'undefined'\n ? global\n : {};\n /* eslint-enable no-undef */\n\n // Save the require from previous bundle to this closure if any\n var previousRequire =\n typeof globalObject[parcelRequireName] === 'function' &&\n globalObject[parcelRequireName];\n\n var importMap = previousRequire.i || {};\n var cache = previousRequire.cache || {};\n // Do not use `require` to prevent Webpack from trying to bundle this call\n var nodeRequire =\n typeof module !== 'undefined' &&\n typeof module.require === 'function' &&\n module.require.bind(module);\n\n function newRequire(name, jumped) {\n if (!cache[name]) {\n if (!modules[name]) {\n if (externals[name]) {\n return externals[name];\n }\n // if we cannot find the module within our internal map or\n // cache jump to the current global require ie. the last bundle\n // that was added to the page.\n var currentRequire =\n typeof globalObject[parcelRequireName] === 'function' &&\n globalObject[parcelRequireName];\n if (!jumped && currentRequire) {\n return currentRequire(name, true);\n }\n\n // If there are other bundles on this page the require from the\n // previous one is saved to 'previousRequire'. Repeat this as\n // many times as there are bundles until the module is found or\n // we exhaust the require chain.\n if (previousRequire) {\n return previousRequire(name, true);\n Line truncated
{"mappings":"C,A,S,C,C,C,C,C,C,C,C,C,C,C,C,C,C,C,E,I,E,A,a,O,W,W,A,a,O,K,K,A,a,O,O,O,A,a,O,O,O,C,E,E,A,Y,O,C,C,E,E,C,C,E,C,E,E,C,E,C,E,E,E,K,E,C,E,E,A,a,O,Q,A,Y,O,O,O,E,O,O,C,I,C,Q,S,E,C,C,C,E,G,C,C,C,E,C,C,G,C,C,C,E,C,C,G,C,C,E,C,O,C,C,E,C,I,E,A,Y,O,C,C,E,E,C,C,E,C,G,C,G,E,O,E,E,C,G,G,E,O,E,E,C,G,G,G,A,U,O,E,O,E,G,I,E,A,M,uB,E,I,O,E,I,C,mB,C,C,E,O,C,S,C,E,I,E,C,C,E,C,E,C,E,C,O,A,M,E,E,C,E,E,K,C,C,E,I,E,C,C,E,C,I,E,M,C,G,C,C,E,C,E,C,I,C,E,O,C,E,E,E,O,C,E,C,O,C,C,E,C,O,C,S,E,C,E,I,E,E,O,C,G,M,A,C,I,E,C,E,E,E,C,C,E,e,C,C,E,E,M,C,S,C,E,I,C,E,C,E,I,C,M,C,E,I,C,O,C,E,I,C,O,C,C,C,E,E,O,C,E,E,K,C,E,E,M,C,E,E,O,C,K,E,E,S,C,K,E,E,S,C,K,E,E,C,C,E,E,Q,C,S,C,C,C,E,C,C,E,C,C,S,C,C,C,E,E,O,C,C,E,C,E,A,E,O,c,C,E,O,C,I,W,O,C,C,E,A,C,G,C,C,E,C,E,I,I,E,E,E,E,M,C,I,E,C,C,E,E,G,E,C,I,E,E,E,A,C,U,O,S,A,a,O,O,O,O,C,E,A,Y,O,Q,O,G,E,O,W,O,C,E,C,E,C,M,C,S,C,C,C,C,C,C,C,E,I,E,E,kDCyCe,SAAS,EAA6B,CAAM,EACzD,OAAO,MAAO,IACZ,EAAI,EAAE,CAAC,uBAAwB,KAC7B,IAAM,EAAM,EAAO,GAAG,E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AwBpB,AAAkB,aAAlB,OAAO,QACT,CAAA,OAAO,4BAA4B,CAAG,CADxC,C,E,C,iD,O,E,C,Q,C,S,C,C,C,C,C,C,C,ECjEA,EAAQ,cAAc,CAAG,SAAU,CAAC,EAClC,OAAO,GAAK,EAAE,UAAU,CAAG,EAAI,CAAC,QAAS,CAAC,CAC5C,EAEA,EAAQ,iBAAiB,CAAG,SAAU,CAAC,EACrC,OAAO,cAAc,CAAC,EAAG,aAAc,CAAC,MAAO,CAAA,CAAI,EACrD,EAEA,EAAQ,SAAS,CAAG,SAAU,CAAM,CAAE,CAAI,EAkBxC,OAjBA,OAAO,IAAI,CAAC,GAAQ,OAAO,CAAC,SAAU,CAAG,EAE7B,YAAR,GACA,AAAQ,eAAR,GACA,OAAO,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,EAAM,IAK7C,OAAO,cAAc,CAAC,EAAM,EAAK,CAC/B,WAAY,CAAA,EACZ,IAAK,WACH,OAAO,CAAM,CAAC,EAAI,AACpB,CACF,EACF,GAEO,CACT,EAEA,EAAQ,MAAM,CAAG,SAAU,CAAI,CAAE,CAAQ,CAAE,CAAG,EAC5C,OAAO,cAAc,CAAC,EAAM,EAAU,CACpC,WAAY,CAAA,EACZ,IAAK,CACP,EACF,C,E,C,E,E,C,Q,C,Q,oB,C,G,G,C,Q,C,C,C,kB,gB,K,O","sources":["<anon>","packages/artplayer-plugin-auto-thumbnail/src/index.js","node_modules/@parcel/transformer-js/src/esmodule-helpers.js"],"sourcesContent":["// modules are defined as an array\n// [ module function, map of requires ]\n//\n// map of requires is short require name -> numeric require\n//\n// anything defined in a previous bundle is accessed via the\n// orig method which is the require for previous bundles\n\n(function (\n modules,\n entry,\n mainEntry,\n parcelRequireName,\n externals,\n distDir,\n publicUrl,\n devServer\n) {\n /* eslint-disable no-undef */\n var globalObject =\n typeof globalThis !== 'undefined'\n ? globalThis\n : typeof self !== 'undefined'\n ? self\n : typeof window !== 'undefined'\n ? window\n : typeof global !== 'undefined'\n ? global\n : {};\n /* eslint-enable no-undef */\n\n // Save the require from previous bundle to this closure if any\n var previousRequire =\n typeof globalObject[parcelRequireName] === 'function' &&\n globalObject[parcelRequireName];\n\n var importMap = previousRequire.i || {};\n var cache = previousRequire.cache || {};\n // Do not use `require` to prevent Webpack from trying to bundle this call\n var nodeRequire =\n typeof module !== 'undefined' &&\n typeof module.require === 'function' &&\n module.require.bind(module);\n\n function newRequire(name, jumped) {\n if (!cache[name]) {\n if (!modules[name]) {\n if (externals[name]) {\n return externals[name];\n }\n // if we cannot find the module within our internal map or\n // cache jump to the current global require ie. the last bundle\n // that was added to the page.\n var currentRequire =\n typeof globalObject[parcelRequireName] === 'function' &&\n globalObject[parcelRequireName];\n if (!jumped && currentRequire) {\n return currentRequire(name, true);\n }\n\n // If there are other bundles on this page the require from the\n // previous one is saved to 'previousRequire'. Repeat this as\n // many times as there are bundles until the module is found or\n // we exhaust the require chain.\n if (previousRequire) {\n return previousRequiLine truncated
@@ -5,4 +5,4 @@
* (c) 2017-2025 Harvey Zack
* Released under the MIT License.
*/
!function(e,t,n,o,r,i,u,l){var d="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},f="function"==typeof d[o]&&d[o],a=f.i||{},c=f.cache||{},s="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(t,n){if(!c[t]){if(!e[t]){if(r[t])return r[t];var i="function"==typeof d[o]&&d[o];if(!n&&i)return i(t,!0);if(f)return f(t,!0);if(s&&"string"==typeof t)return s(t);var u=Error("Cannot find module '"+t+"'");throw u.code="MODULE_NOT_FOUND",u}a.resolve=function(n){var o=e[t][1][n];return null!=o?o:n},a.cache={};var l=c[t]=new p.Module(t);e[t][0].call(l.exports,a,l,l.exports,d)}return c[t].exports;function a(e){var t=a.resolve(e);return!1===t?{}:p(t)}}p.isParcelRequire=!0,p.Module=function(e){this.id=e,this.bundle=p,this.require=s,this.exports={}},p.modules=e,p.cache=c,p.parent=f,p.distDir=void 0,p.publicUrl=void 0,p.devServer=void 0,p.i=a,p.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(p,"root",{get:function(){return d[o]}}),d[o]=p;for(var m=0;m<t.length;m++)p(t[m]);if(n){var h=p(n);"object"==typeof exports&&"undefined"!=typeof module?module.exports=h:"function"==typeof define&&define.amd&&define(function(){return h})}}({jz4E5:[function(e,t,n,o){var r=e("@parcel/transformer-js/src/esmodule-helpers.js");function i(e){return async t=>(t.on("video:loadedmetadata",()=>{let n=e.url||t.option.url,o=e.width||160,r=e.number||100,i=e.scale||1;!function({url:e,width:t,number:n},o){let r=document.createElement("video");r.crossOrigin="anonymous",r.src=e,r.onloadedmetadata=()=>{let e=r.duration,i=document.createElement("canvas"),u=i.getContext("2d"),l=Math.floor(t*r.videoHeight/r.videoWidth);i.width=10*t,i.height=l*Math.ceil(n/10);let d=0,f=null;!function a(c){i.toBlob(e=>{URL.revokeObjectURL(f),o({url:f=URL.createObjectURL(e),height:l})},"image/jpeg"),c>=n||(r.currentTime=e*c/n,r.onseeked=()=>{u.drawImage(r,c%10*t,Math.floor(c/10)*l,t,l),d++,a(c+1)})}(0)}}({url:n,width:o,number:r},e=>{t.thumbnails={...e,column:10,number:r,width:o,scale:i}})}),{name:"artplayerPluginAutoThumbnail"})}r.defineInteropFlag(n),r.export(n,"default",()=>i),"undefined"!=typeof window&&(window.artplayerPluginAutoThumbnail=i)},{"@parcel/transformer-js/src/esmodule-helpers.js":"7o2zS"}],"7o2zS":[function(e,t,n,o){n.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},n.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},n.exportAll=function(e,t){return Object.keys(e).forEach(function(n){"default"===n||"__esModule"===n||Object.prototype.hasOwnProperty.call(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[n]}})}),t},n.export=function(e,t,n){Object.defineProperty(e,t,{enumerable:!0,get:n})}},{}]},["jz4E5"],"jz4E5","parcelRequireb705",{});
!function(e,t,n,o,r,i,u,l){var d="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},f="function"==typeof d[o]&&d[o],a=f.i||{},c=f.cache||{},s="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(t,n){if(!c[t]){if(!e[t]){if(r[t])return r[t];var i="function"==typeof d[o]&&d[o];if(!n&&i)return i(t,!0);if(f)return f(t,!0);if(s&&"string"==typeof t)return s(t);var u=Error("Cannot find module '"+t+"'");throw u.code="MODULE_NOT_FOUND",u}a.resolve=function(n){var o=e[t][1][n];return null!=o?o:n},a.cache={};var l=c[t]=new p.Module(t);e[t][0].call(l.exports,a,l,l.exports,d)}return c[t].exports;function a(e){var t=a.resolve(e);return!1===t?{}:p(t)}}p.isParcelRequire=!0,p.Module=function(e){this.id=e,this.bundle=p,this.require=s,this.exports={}},p.modules=e,p.cache=c,p.parent=f,p.distDir=void 0,p.publicUrl=void 0,p.devServer=void 0,p.i=a,p.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(p,"root",{get:function(){return d[o]}}),d[o]=p;for(var m=0;m<t.length;m++)p(t[m]);if(n){var h=p(n);"object"==typeof exports&&"undefined"!=typeof module?module.exports=h:"function"==typeof define&&define.amd&&define(function(){return h})}}({"6MsoC":[function(e,t,n,o){var r=e("@parcel/transformer-js/src/esmodule-helpers.js");function i(e){return async t=>(t.on("video:loadedmetadata",()=>{let n=e.url||t.option.url,o=e.width||160,r=e.number||100,i=e.scale||1;!function({url:e,width:t,number:n},o){let r=document.createElement("video");r.crossOrigin="anonymous",r.src=e,r.onloadedmetadata=()=>{let e=r.duration,i=document.createElement("canvas"),u=i.getContext("2d"),l=Math.floor(t*r.videoHeight/r.videoWidth);i.width=10*t,i.height=l*Math.ceil(n/10);let d=null;!function f(a){i.toBlob(e=>{URL.revokeObjectURL(d),o({url:d=URL.createObjectURL(e),height:l})},"image/jpeg"),a>=n||(r.currentTime=e*a/n,r.onseeked=()=>{u.drawImage(r,a%10*t,Math.floor(a/10)*l,t,l),f(a+1)})}(0)}}({url:n,width:o,number:r},e=>{t.thumbnails={...e,column:10,number:r,width:o,scale:i}})}),{name:"artplayerPluginAutoThumbnail"})}r.defineInteropFlag(n),r.export(n,"default",()=>i),"undefined"!=typeof window&&(window.artplayerPluginAutoThumbnail=i)},{"@parcel/transformer-js/src/esmodule-helpers.js":"6ykb1"}],"6ykb1":[function(e,t,n,o){n.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},n.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},n.exportAll=function(e,t){return Object.keys(e).forEach(function(n){"default"===n||"__esModule"===n||Object.prototype.hasOwnProperty.call(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[n]}})}),t},n.export=function(e,t,n){Object.defineProperty(e,t,{enumerable:!0,get:n})}},{}]},["6MsoC"],"6MsoC","parcelRequire4dc0",{});
@@ -5,4 +5,4 @@
* (c) 2017-2025 Harvey Zack
* Released under the MIT License.
*/
!function(e,t,r,n,o,i,c,u){var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},s="function"==typeof a[n]&&a[n],f=s.i||{},l=s.cache||{},p="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function d(t,r){if(!l[t]){if(!e[t]){if(o[t])return o[t];var i="function"==typeof a[n]&&a[n];if(!r&&i)return i(t,!0);if(s)return s(t,!0);if(p&&"string"==typeof t)return p(t);var c=Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}f.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},f.cache={};var u=l[t]=new d.Module(t);e[t][0].call(u.exports,f,u,u.exports,a)}return l[t].exports;function f(e){var t=f.resolve(e);return!1===t?{}: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=l,d.parent=s,d.distDir=void 0,d.publicUrl=void 0,d.devServer=void 0,d.i=f,d.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(d,"root",{get:function(){return a[n]}}),a[n]=d;for(var y=0;y<t.length;y++)d(t[y]);if(r){var _=d(r);"object"==typeof exports&&"undefined"!=typeof module?module.exports=_:"function"==typeof define&&define.amd&&define(function(){return _})}}({bzF6W:[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"),u=e("@swc/helpers/cjs/_object_spread_props.cjs"),a=e("@swc/helpers/cjs/_ts_generator.cjs");function s(e){var t;return t=(0,i._)(function(t){return(0,a._)(this,function(r){return t.on("video:loadedmetadata",function(){var r,n,o,i,a,s,f=e.url||t.option.url,l=e.width||160,p=e.number||100,d=e.scale||1;r={url:f,width:l,number:p},n=function(e){t.thumbnails=(0,u._)((0,c._)({},e),{column:10,number:p,width:l,scale:d})},o=r.url,i=r.width,a=r.number,(s=document.createElement("video")).crossOrigin="anonymous",s.src=o,s.onloadedmetadata=function(){var e=s.duration,t=document.createElement("canvas"),r=t.getContext("2d"),o=Math.floor(i*s.videoHeight/s.videoWidth);t.width=10*i,t.height=o*Math.ceil(a/10);var c=0,u=null;!function f(l){t.toBlob(function(e){URL.revokeObjectURL(u),n({url:u=URL.createObjectURL(e),height:o})},"image/jpeg"),l>=a||(s.currentTime=e*l/a,s.onseeked=function(){r.drawImage(s,l%10*i,Math.floor(l/10)*o,i,o),c++,f(l+1)})}(0)}}),[2,{name:"artplayerPluginAutoThumbnail"}]})}),function(e){return t.apply(this,arguments)}}"undefined"!=typeof window&&(window.artplayerPluginAutoThumbnail=s)},{"@swc/helpers/cjs/_async_to_generator.cjs":"4ElRo","@swc/helpers/cjs/_object_spread.cjs":"7vaqr","@swc/helpers/cjs/_object_spread_props.cjs":"iJXke","@swc/helpers/cjs/_ts_generator.cjs":"a4h1C","@parcel/transformer-js/src/esmodule-helpers.js":"ihnSZ"}],"4ElRo":[function(e,t,r,n){"use strict";function o(e,t,r,n,o,i,c){try{var u=e[i](c),a=u.value}catch(e){r(e);return}u.done?t(a):Promise.resolve(a).then(n,o)}r._=function(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var c=e.apply(t,r);function u(e){o(c,n,i,u,a,"next",e)}function a(e){o(c,n,i,u,a,"throw",e)}u(void 0)})}}},{}],"7vaqr":[function(e,t,r,n){"use strict";var o=e("b3d0f206b721b857");r._=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){o._(e,t,r[t])})}return e}},{b3d0f206b721b857:"dgB2K"}],dgB2K:[function(e,t,r,n){"use strict";r._=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}},{}],iJXke:[function(e,t,r,n){"use strict";r._=function(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}},{}],a4h1C:[function(e,t,r,n){"use strict";r._=e("3d8e14b4b7163380").__generator},{"3d8e14b4b7163380":"36MWs"}],"36MWs":[function(e,t,r,n){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(r),o.export(r,"__extends",function(){return u}),o.export(r,"__assign",function(){return a}),o.export(r,"__rest",function(){return s}),o.export(r,"__decorate",function(){return f}),o.export(r,"__param",function(){return l}),o.export(r,"__esDecorate",function(){return p}),o.export(r,"__runInitializers",function(){return d}),o.export(r,"__propKey",function(){return y}),o.export(r,"__setFunctionName",function(){return _}),o.export(r,"__metadata",function(){return b}),o.export(r,"__awaiter",function(){return h}),o.exporLine truncated
!function(e,t,r,n,o,i,c,u){var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},s="function"==typeof a[n]&&a[n],f=s.i||{},l=s.cache||{},p="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function d(t,r){if(!l[t]){if(!e[t]){if(o[t])return o[t];var i="function"==typeof a[n]&&a[n];if(!r&&i)return i(t,!0);if(s)return s(t,!0);if(p&&"string"==typeof t)return p(t);var c=Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}f.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},f.cache={};var u=l[t]=new d.Module(t);e[t][0].call(u.exports,f,u,u.exports,a)}return l[t].exports;function f(e){var t=f.resolve(e);return!1===t?{}: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=l,d.parent=s,d.distDir=void 0,d.publicUrl=void 0,d.devServer=void 0,d.i=f,d.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(d,"root",{get:function(){return a[n]}}),a[n]=d;for(var y=0;y<t.length;y++)d(t[y]);if(r){var _=d(r);"object"==typeof exports&&"undefined"!=typeof module?module.exports=_:"function"==typeof define&&define.amd&&define(function(){return _})}}({"9JZgh":[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"),u=e("@swc/helpers/cjs/_object_spread_props.cjs"),a=e("@swc/helpers/cjs/_ts_generator.cjs");function s(e){return function(t){return(0,i._)(function(){return(0,a._)(this,function(r){return t.on("video:loadedmetadata",function(){var r,n,o,i,a,s,f=e.url||t.option.url,l=e.width||160,p=e.number||100,d=e.scale||1;r={url:f,width:l,number:p},n=function(e){t.thumbnails=(0,u._)((0,c._)({},e),{column:10,number:p,width:l,scale:d})},o=r.url,i=r.width,a=r.number,(s=document.createElement("video")).crossOrigin="anonymous",s.src=o,s.onloadedmetadata=function(){var e=s.duration,t=document.createElement("canvas"),r=t.getContext("2d"),o=Math.floor(i*s.videoHeight/s.videoWidth);t.width=10*i,t.height=o*Math.ceil(a/10);var c=null;!function u(f){t.toBlob(function(e){URL.revokeObjectURL(c),n({url:c=URL.createObjectURL(e),height:o})},"image/jpeg"),f>=a||(s.currentTime=e*f/a,s.onseeked=function(){r.drawImage(s,f%10*i,Math.floor(f/10)*o,i,o),u(f+1)})}(0)}}),[2,{name:"artplayerPluginAutoThumbnail"}]})})()}}"undefined"!=typeof window&&(window.artplayerPluginAutoThumbnail=s)},{"@swc/helpers/cjs/_async_to_generator.cjs":"cZn0e","@swc/helpers/cjs/_object_spread.cjs":"kyoEj","@swc/helpers/cjs/_object_spread_props.cjs":"3G1wX","@swc/helpers/cjs/_ts_generator.cjs":"eltGh","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],cZn0e:[function(e,t,r,n){"use strict";function o(e,t,r,n,o,i,c){try{var u=e[i](c),a=u.value}catch(e){r(e);return}u.done?t(a):Promise.resolve(a).then(n,o)}r._=function(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var c=e.apply(t,r);function u(e){o(c,n,i,u,a,"next",e)}function a(e){o(c,n,i,u,a,"throw",e)}u(void 0)})}}},{}],kyoEj:[function(e,t,r,n){"use strict";var o=e("9f9b8a24218ee51e");r._=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){o._(e,t,r[t])})}return e}},{"9f9b8a24218ee51e":"ltU3W"}],ltU3W:[function(e,t,r,n){"use strict";r._=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}},{}],"3G1wX":[function(e,t,r,n){"use strict";r._=function(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}},{}],eltGh:[function(e,t,r,n){"use strict";r._=e("eb260df52bffddd").__generator},{eb260df52bffddd:"6yrAu"}],"6yrAu":[function(e,t,r,n){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(r),o.export(r,"__extends",function(){return u}),o.export(r,"__assign",function(){return a}),o.export(r,"__rest",function(){return s}),o.export(r,"__decorate",function(){return f}),o.export(r,"__param",function(){return l}),o.export(r,"__esDecorate",function(){return p}),o.export(r,"__runInitializers",function(){return d}),o.export(r,"__propKey",function(){return y}),o.export(r,"__setFunctionName",function(){return _}),o.export(r,"__metadata",function(){return h}),o.export(r,"__awaiter",function(){return b}),o.export(r,"__generator",function(){return v}),o.Line truncated
@@ -1,30 +1,30 @@
{
"license": "MIT",
"version": "1.0.1",
"name": "artplayer-plugin-auto-thumbnail",
"description": "auto-thumbnail plugin for ArtPlayer",
"main": "dist/artplayer-plugin-auto-thumbnail.js",
"legacy": "dist/artplayer-plugin-auto-thumbnail.legacy.js",
"module": "dist/artplayer-plugin-auto-thumbnail.esm.js",
"types": "types/artplayer-plugin-auto-thumbnail.d.ts",
"exports": {
"import": "./dist/artplayer-plugin-auto-thumbnail.esm.js",
"require": "./dist/artplayer-plugin-auto-thumbnail.js",
"default": "./dist/artplayer-plugin-auto-thumbnail.js"
},
"author": "Harvey Zack <laozhaochaguan@gmail.com>",
"browserslist": "last 1 Chrome version",
"homepage": "https://artplayer.org",
"repository": {
"type": "git",
"url": "git+https://github.com/zhw2590582/ArtPlayer.git"
},
"bugs": {
"url": "https://github.com/zhw2590582/ArtPlayer/issues"
},
"keywords": [
"html5",
"video",
"player"
]
"name": "artplayer-plugin-auto-thumbnail",
"version": "1.0.1",
"description": "auto-thumbnail plugin for ArtPlayer",
"author": "Harvey Zack <laozhaochaguan@gmail.com>",
"license": "MIT",
"homepage": "https://artplayer.org",
"repository": {
"type": "git",
"url": "git+https://github.com/zhw2590582/ArtPlayer.git"
},
"bugs": {
"url": "https://github.com/zhw2590582/ArtPlayer/issues"
},
"keywords": [
"html5",
"video",
"player"
],
"exports": {
"import": "./dist/artplayer-plugin-auto-thumbnail.esm.js",
"require": "./dist/artplayer-plugin-auto-thumbnail.js",
"default": "./dist/artplayer-plugin-auto-thumbnail.js"
},
"main": "dist/artplayer-plugin-auto-thumbnail.js",
"legacy": "dist/artplayer-plugin-auto-thumbnail.legacy.js",
"module": "dist/artplayer-plugin-auto-thumbnail.esm.js",
"types": "types/artplayer-plugin-auto-thumbnail.d.ts",
"browserslist": "last 1 Chrome version"
}
@@ -1,67 +1,68 @@
function create({ url, width, number }, callback) {
const video = document.createElement('video');
video.crossOrigin = 'anonymous';
video.src = url;
const video = document.createElement('video')
video.crossOrigin = 'anonymous'
video.src = url
video.onloadedmetadata = () => {
const duration = video.duration;
const canvas = document.createElement('canvas');
const ctx = canvas.getContext('2d');
const height = Math.floor((width * video.videoHeight) / video.videoWidth);
video.onloadedmetadata = () => {
const duration = video.duration
const canvas = document.createElement('canvas')
const ctx = canvas.getContext('2d')
const height = Math.floor((width * video.videoHeight) / video.videoWidth)
canvas.width = width * 10;
canvas.height = height * Math.ceil(number / 10);
canvas.width = width * 10
canvas.height = height * Math.ceil(number / 10)
let blobUrl = null;
let blobUrl = null
function seekAndDraw(index) {
canvas.toBlob((blob) => {
URL.revokeObjectURL(blobUrl);
blobUrl = URL.createObjectURL(blob);
function seekAndDraw(index) {
canvas.toBlob((blob) => {
URL.revokeObjectURL(blobUrl)
blobUrl = URL.createObjectURL(blob)
callback({
url: blobUrl,
height: height,
});
}, 'image/jpeg');
callback({
url: blobUrl,
height,
})
}, 'image/jpeg')
if (index >= number) return;
video.currentTime = (duration * index) / number;
if (index >= number)
return
video.currentTime = (duration * index) / number
video.onseeked = () => {
ctx.drawImage(video, (index % 10) * width, Math.floor(index / 10) * height, width, height);
seekAndDraw(index + 1);
};
}
video.onseeked = () => {
ctx.drawImage(video, (index % 10) * width, Math.floor(index / 10) * height, width, height)
seekAndDraw(index + 1)
}
}
seekAndDraw(0);
};
seekAndDraw(0)
}
}
export default function artplayerPluginAutoThumbnail(option) {
return async (art) => {
art.on('video:loadedmetadata', () => {
const url = option.url || art.option.url;
const width = option.width || 160;
const number = option.number || 100;
const scale = option.scale || 1;
create({ url, width, number }, (config) => {
art.thumbnails = {
...config,
column: 10,
number,
width,
scale,
};
});
});
return async (art) => {
art.on('video:loadedmetadata', () => {
const url = option.url || art.option.url
const width = option.width || 160
const number = option.number || 100
const scale = option.scale || 1
create({ url, width, number }, (config) => {
art.thumbnails = {
...config,
column: 10,
number,
width,
scale,
}
})
})
return {
name: 'artplayerPluginAutoThumbnail',
};
};
return {
name: 'artplayerPluginAutoThumbnail',
}
}
}
if (typeof window !== 'undefined') {
window['artplayerPluginAutoThumbnail'] = artplayerPluginAutoThumbnail;
window.artplayerPluginAutoThumbnail = artplayerPluginAutoThumbnail
}
@@ -1,17 +1,17 @@
import type Artplayer from 'artplayer';
import type Artplayer from 'artplayer'
export = artplayerPluginAutoThumbnail;
export = artplayerPluginAutoThumbnail
export as namespace artplayerPluginAutoThumbnail;
type Option = {
url?: string;
width?: number;
number?: number;
scale?: number;
};
interface Option {
url?: string
width?: number
number?: number
scale?: number
}
type Result = {
name: 'artplayerPluginAutoThumbnail';
};
interface Result {
name: 'artplayerPluginAutoThumbnail'
}
declare const artplayerPluginAutoThumbnail: (option: Option) => (art: Artplayer) => Result;
declare const artplayerPluginAutoThumbnail: (option: Option) => (art: Artplayer) => Result