mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-09 03:17:46 -08:00
- Created a new documentation file for the danmuku plugin, detailing its usage and providing code examples. - Added a comprehensive guide for language settings (i18n), including instructions for importing languages, setting default languages, and modifying language options. - Included code snippets for initializing the Artplayer with different languages and examples for adding new languages.
8 lines
5.3 KiB
JavaScript
8 lines
5.3 KiB
JavaScript
|
|
/*!
|
|
* artplayer-plugin-ambilight.js v1.0.0
|
|
* Github: https://github.com/zhw2590582/ArtPlayer
|
|
* (c) 2017-2025 Harvey Zack
|
|
* Released under the MIT License.
|
|
*/
|
|
!function(e,r,t,n,o,i,a,u){var c="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},f="function"==typeof c[n]&&c[n],l=f.i||{},d=f.cache||{},s="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(r,t){if(!d[r]){if(!e[r]){if(o[r])return o[r];var i="function"==typeof c[n]&&c[n];if(!t&&i)return i(r,!0);if(f)return f(r,!0);if(s&&"string"==typeof r)return s(r);var a=Error("Cannot find module '"+r+"'");throw a.code="MODULE_NOT_FOUND",a}l.resolve=function(t){var n=e[r][1][t];return null!=n?n:t},l.cache={};var u=d[r]=new p.Module(r);e[r][0].call(u.exports,l,u,u.exports,c)}return d[r].exports;function l(e){var r=l.resolve(e);return!1===r?{}:p(r)}}p.isParcelRequire=!0,p.Module=function(e){this.id=e,this.bundle=p,this.require=s,this.exports={}},p.modules=e,p.cache=d,p.parent=f,p.distDir=void 0,p.publicUrl=void 0,p.devServer=void 0,p.i=l,p.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]},Object.defineProperty(p,"root",{get:function(){return c[n]}}),c[n]=p;for(var y=0;y<r.length;y++)p(r[y]);if(t){var v=p(t);"object"==typeof exports&&"undefined"!=typeof module?module.exports=v:"function"==typeof define&&define.amd&&define(function(){return v})}}({bzF6W:[function(e,r,t,n){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(t),o.export(t,"default",function(){return a});var i=e("@swc/helpers/cjs/_sliced_to_array.cjs");function a(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(r){var t,n,o,a,u,c,f,l,d,s,p,y,v,m=r.template.$video,b=r.constructor.utils,g=b.createElement,h=b.addClass,_=b.setStyles,w=e.blur,j=e.opacity,x=e.frequency,A=e.duration,O=g("div"),I=((t=O).innerHTML=Array(9).fill("<div></div>").join(""),Array.from(t.children));n=O,o=m,h(n,"artplayer-plugin-ambilight"),o.parentNode.insertBefore(n,o),_(n,{position:"absolute",top:0,left:0,zIndex:9,inset:0,display:"grid",gridTemplateColumns:"1fr 1fr 1fr",gridTemplateRows:"1fr 1fr 1fr"}),a=I,u=void 0===w?"50px":w,c=void 0===j?.5:j,f=void 0===A?.3:A,a.forEach(function(e){_(e,{opacity:c,filter:"blur(".concat(u,")"),transition:"background-color ".concat(f,"s ease")})});var M=(l=m,d=I,s=void 0===x?10:x,y=(p=g("canvas")).getContext("2d"),p.width=3,p.height=3,v=0,function e(){var t=performance.now();if(t-v<1e3/s||!r.playing){E=requestAnimationFrame(e);return}v=t;var n=l.videoWidth/3,o=l.videoHeight/3,a=[[0,0],[n,0],[2*n,0],[0,o],[n,o],[2*n,o],[0,2*o],[n,2*o],[2*n,2*o]].map(function(e){var r,t,a,u,c=(0,i._)(e,2),f=c[0],d=c[1];return y.drawImage(l,f,d,n,o,0,0,1,1),t=(r=(0,i._)(y.getImageData(0,0,1,1).data,3))[0],a=r[1],u=r[2],"rgb(".concat(t,", ").concat(a,", ").concat(u,")")});d.forEach(function(e,r){e.style.backgroundColor=a[r]}),E=requestAnimationFrame(e)}),E=null;function F(){E||M()}function S(){E&&(cancelAnimationFrame(E),E=null)}return r.on("ready",F),r.on("destroy",S),{name:"artplayerPluginAmbilight",start:F,stop:S}}}"undefined"!=typeof window&&(window.artplayerPluginAmbilight=a)},{"@swc/helpers/cjs/_sliced_to_array.cjs":"69dwW","@parcel/transformer-js/src/esmodule-helpers.js":"ihnSZ"}],"69dwW":[function(e,r,t,n){"use strict";var o=e("1c05c980d01d7095"),i=e("d604d0840046159b"),a=e("9ac1542249932d1a"),u=e("d04f777c592843b");t._=function(e,r){return o._(e)||i._(e,r)||u._(e,r)||a._()}},{"1c05c980d01d7095":"dgv90",d604d0840046159b:"8f1n5","9ac1542249932d1a":"edvMI",d04f777c592843b:"ikxEb"}],dgv90:[function(e,r,t,n){"use strict";t._=function(e){if(Array.isArray(e))return e}},{}],"8f1n5":[function(e,r,t,n){"use strict";t._=function(e,r){var t,n,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,u=!1;try{for(o=o.call(e);!(a=(t=o.next()).done)&&(i.push(t.value),!r||i.length!==r);a=!0);}catch(e){u=!0,n=e}finally{try{a||null==o.return||o.return()}finally{if(u)throw n}}return i}}},{}],edvMI:[function(e,r,t,n){"use strict";t._=function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},{}],ikxEb:[function(e,r,t,n){"use strict";var o=e("3202629de7a6dd0f");t._=function(e,r){if(e){if("string"==typeof e)return o._(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return o._(e,r)}}},{"3202629de7a6dd0f":"8HLaN"}],"8HLaN":[function(e,r,t,n){"use strict";t._=function(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=Array(r);t<r;t++)n[t]=e[t];return n}},{}],ihnSZ:[function(e,r,t,n){t.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},t.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},t.exportAll=function(e,r){return Object.keys(e).forEach(function(t){"default"===t||"__esModule"===t||Object.prototype.hasOwnProperty.call(r,t)||Object.defineProperty(r,t,{enumerable:!0,get:function(){return e[t]}})}),r},t.export=function(e,r,t){Object.defineProperty(e,r,{enumerable:!0,get:t})}},{}]},["bzF6W"],"bzF6W","parcelRequireb9c8",{}); |