mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-08 19:06:15 -08:00
- Created a new documentation file for the danmuku plugin with code examples. - Added a comprehensive guide for language settings, including default languages, importing languages, adding new languages, and modifying existing languages. - Updated the i18n documentation to reflect changes in language handling and provide code snippets for implementation.
8 lines
4.3 KiB
JavaScript
8 lines
4.3 KiB
JavaScript
|
|
/*!
|
|
* artplayer-plugin-vtt-thumbnail.js v1.0.3
|
|
* Github: https://github.com/zhw2590582/ArtPlayer
|
|
* (c) 2017-2025 Harvey Zack
|
|
* Released under the MIT License.
|
|
*/
|
|
!function(e,t,n,r,o,i,l,u){var f="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},a="function"==typeof f[r]&&f[r],d=a.i||{},s=a.cache||{},c="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(t,n){if(!s[t]){if(!e[t]){if(o[t])return o[t];var i="function"==typeof f[r]&&f[r];if(!n&&i)return i(t,!0);if(a)return a(t,!0);if(c&&"string"==typeof t)return c(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 u=s[t]=new p.Module(t);e[t][0].call(u.exports,d,u,u.exports,f)}return s[t].exports;function d(e){var t=d.resolve(e);return!1===t?{}:p(t)}}p.isParcelRequire=!0,p.Module=function(e){this.id=e,this.bundle=p,this.require=c,this.exports={}},p.modules=e,p.cache=s,p.parent=a,p.distDir=void 0,p.publicUrl=void 0,p.devServer=void 0,p.i=d,p.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(p,"root",{get:function(){return f[r]}}),f[r]=p;for(var h=0;h<t.length;h++)p(t[h]);if(n){var m=p(n);"object"==typeof exports&&"undefined"!=typeof module?module.exports=m:"function"==typeof define&&define.amd&&define(function(){return m})}}({egVzc:[function(e,t,n,r){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(n),o.export(n,"default",()=>u);var i=e("./getVttArray"),l=o.interopDefault(i);function u(e){return async t=>{let{constructor:{utils:{setStyle:n,isMobile:r,addClass:o}},template:{$progress:i}}=t,u=null,f=await (0,l.default)(e.vtt);return t.controls.add({name:"vtt-thumbnail",position:"top",index:20,style:e.style||{},mounted(e){o(e,"art-control-thumbnails"),t.on("setBar",async(o,l,a)=>{let d="played"===o&&a&&r;if("hover"===o||d){let o=i.clientWidth*l,a=l*t.duration;n(e,"display","flex");let s=f.find(e=>a>=e.start&&a<=e.end);if(!s)return n(e,"display","none");if(o>0&&o<i.clientWidth)n(e,"backgroundImage",`url(${s.url})`),n(e,"height",`${s.h}px`),n(e,"width",`${s.w}px`),n(e,"backgroundPosition",`-${s.x}px -${s.y}px`),o<=s.w/2?n(e,"left",0):o>i.clientWidth-s.w/2?n(e,"left",`${i.clientWidth-s.w}px`):n(e,"left",`${o-s.w/2}px`);else r||n(e,"display","none");d&&(clearTimeout(u),u=setTimeout(()=>{n(e,"display","none")},500))}})}}),{name:"artplayerPluginVttThumbnail"}}}"undefined"!=typeof window&&(window.artplayerPluginVttThumbnail=u)},{"./getVttArray":"i9qdo","@parcel/transformer-js/src/esmodule-helpers.js":"loqXi"}],i9qdo:[function(e,t,n,r){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");function i(e){var t,n,r;let o=e.split("."),i=o[0].split(":")||[],l=Number((t=o[1]||"0",n=3,r="0",t.length>n?String(t):((n-=t.length)>r.length&&(r+=r.repeat(n/r.length)),String(t)+r.slice(0,n))))/1e3,u=3600*Number(i[i.length-3]||0);return u+60*Number(i[i.length-2]||0)+Number(i[i.length-1]||0)+l}async function l(e=""){let t=(await (await fetch(e)).text()).split(/[\n\r]/g).filter(e=>e.trim()),n=[];for(let r=1;r<t.length;r+=2){let o=t[r],l=t[r+1];if(!l.trim())continue;let u=/((?:\d{2}:)?(?:\d{2}:)?\d{2}(?:.\d{3})?) ?-->?((?:\d{2}:)?(?:\d{2}:)?\d{2}(?:.\d{3})?)/,f=o.match(u),a=/(.*)#(\w{4})=(.*)/,d=l.match(a),s=Math.floor(i(f[1])),c=Math.floor(i(f[2])),p=d[1];if(!/^\/|(?:https?|ftp|file):\/\//i.test(p)){let t=e.split("/");t.pop(),t.push(p),p=t.join("/")}let h={start:s,end:c,url:p},m=d[2].split(""),g=d[3].split(",");for(let e=0;e<m.length;e++)h[m[e]]=g[e];n.push(h)}return n}o.defineInteropFlag(n),o.export(n,"default",()=>l)},{"@parcel/transformer-js/src/esmodule-helpers.js":"loqXi"}],loqXi:[function(e,t,n,r){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})}},{}]},["egVzc"],"egVzc","parcelRequire4dc0",{});let{default:e}=parcelRequire4dc0("egVzc");export{e as default}; |