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 interactive code execution. - Added comprehensive i18n setup instructions, including default language settings, language imports, and examples for adding and modifying languages. - Introduced a test file to verify the integration of the danmuku plugin.
1 line
20 KiB
Plaintext
1 line
20 KiB
Plaintext
{"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,Q,C,S,C,C,C,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CACF,C,E,iB,C,GAlHwB,EAAA,MAAA,CAAA,EAAA,UAAA,IAAA,GAoHpB,AAAkB,aAAlB,OAAO,QACT,CAAA,OAAO,wBAAwB,CAAG,CADpC,C,E,C,iD,O,E,C,Q,C,S,C,C,C,C,C,C,C,ECpHA,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-ambilight/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 }\n\n // Try the node require function if it exists.\n if (nodeRequire && typeof name === 'string') {\n return nodeRequire(name);\n }\n\n var err = new Error(\"Cannot find module '\" + name + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n }\n\n localRequire.resolve = resolve;\n localRequire.cache = {};\n\n var module = (cache[name] = new newRequire.Module(name));\n\n modules[name][0].call(\n module.exports,\n localRequire,\n module,\n module.exports,\n globalObject\n );\n }\n\n return cache[name].exports;\n\n function localRequire(x) {\n var res = localRequire.resolve(x);\n return res === false ? {} : newRequire(res);\n }\n\n function resolve(x) {\n var id = modules[name][1][x];\n return id != null ? id : x;\n }\n }\n\n function Module(moduleName) {\n this.id = moduleName;\n this.bundle = newRequire;\n this.require = nodeRequire;\n this.exports = {};\n }\n\n newRequire.isParcelRequire = true;\n newRequire.Module = Module;\n newRequire.modules = modules;\n newRequire.cache = cache;\n newRequire.parent = previousRequire;\n newRequire.distDir = distDir;\n newRequire.publicUrl = publicUrl;\n newRequire.devServer = devServer;\n newRequire.i = importMap;\n newRequire.register = function (id, exports) {\n modules[id] = [\n function (require, module) {\n module.exports = exports;\n },\n {},\n ];\n };\n\n // Only insert newRequire.load when it is actually used.\n // The code in this file is linted against ES5, so dynamic import is not allowed.\n // INSERT_LOAD_HERE\n\n Object.defineProperty(newRequire, 'root', {\n get: function () {\n return globalObject[parcelRequireName];\n },\n });\n\n globalObject[parcelRequireName] = newRequire;\n\n for (var i = 0; i < entry.length; i++) {\n newRequire(entry[i]);\n }\n\n if (mainEntry) {\n // Expose entry point to Node, AMD or browser globals\n // Based on https://github.com/ForbesLindesay/umd/blob/master/template.js\n var mainExports = newRequire(mainEntry);\n\n // CommonJS\n if (typeof exports === 'object' && typeof module !== 'undefined') {\n module.exports = mainExports;\n\n // RequireJS\n } else if (typeof define === 'function' && define.amd) {\n define(function () {\n return mainExports;\n });\n }\n }\n})({\"9P7rs\":[function(require,module,exports,__globalThis) {\nvar parcelHelpers = require(\"@parcel/transformer-js/src/esmodule-helpers.js\");\nparcelHelpers.defineInteropFlag(exports);\nparcelHelpers.export(exports, \"default\", ()=>artplayerPluginAmbilight);\nfunction artplayerPluginAmbilight(option = {}) {\n return (art)=>{\n const { $video } = art.template;\n const { createElement, addClass, setStyles } = art.constructor.utils;\n const { blur = '50px', opacity = 0.5, frequency = 10, duration = 0.3 } = option;\n const $ambilight = createElement('div');\n const gridItems = createGridItems($ambilight);\n setupAmbilight($ambilight, $video);\n setupGridItems(gridItems, blur, opacity, duration);\n const updateColors = createColorUpdater($video, gridItems, frequency);\n let animationFrameId = null;\n function start() {\n if (!animationFrameId) updateColors();\n }\n function stop() {\n if (animationFrameId) {\n cancelAnimationFrame(animationFrameId);\n animationFrameId = null;\n }\n }\n art.on('ready', start);\n art.on('destroy', stop);\n return {\n name: 'artplayerPluginAmbilight',\n start,\n stop\n };\n function createGridItems($ambilight) {\n $ambilight.innerHTML = Array.from({\n length: 9\n }).fill('<div></div>').join('');\n return Array.from($ambilight.children);\n }\n function setupAmbilight($ambilight, $video) {\n addClass($ambilight, 'artplayer-plugin-ambilight');\n $video.parentNode.insertBefore($ambilight, $video);\n setStyles($ambilight, {\n position: 'absolute',\n top: 0,\n left: 0,\n zIndex: 9,\n inset: 0,\n display: 'grid',\n gridTemplateColumns: '1fr 1fr 1fr',\n gridTemplateRows: '1fr 1fr 1fr'\n });\n }\n function setupGridItems(gridItems, blur, opacity, duration) {\n gridItems.forEach(($item)=>{\n setStyles($item, {\n opacity,\n filter: `blur(${blur})`,\n transition: `background-color ${duration}s ease`\n });\n });\n }\n function createColorUpdater($video, gridItems, frequency) {\n const canvas = createElement('canvas');\n const ctx = canvas.getContext('2d');\n canvas.width = 3;\n canvas.height = 3;\n function getAverageColor(x, y, w, h) {\n ctx.drawImage($video, x, y, w, h, 0, 0, 1, 1);\n const [r, g, b] = ctx.getImageData(0, 0, 1, 1).data;\n return `rgb(${r}, ${g}, ${b})`;\n }\n let lastUpdateTime = 0;\n return function updateColors() {\n const now = performance.now();\n if (now - lastUpdateTime < 1000 / frequency || !art.playing) {\n animationFrameId = requestAnimationFrame(updateColors);\n return;\n }\n lastUpdateTime = now;\n const w = $video.videoWidth / 3;\n const h = $video.videoHeight / 3;\n const colors = [\n [\n 0,\n 0\n ],\n [\n w,\n 0\n ],\n [\n 2 * w,\n 0\n ],\n [\n 0,\n h\n ],\n [\n w,\n h\n ],\n [\n 2 * w,\n h\n ],\n [\n 0,\n 2 * h\n ],\n [\n w,\n 2 * h\n ],\n [\n 2 * w,\n 2 * h\n ]\n ].map(([x, y])=>getAverageColor(x, y, w, h));\n gridItems.forEach(($item, index)=>{\n $item.style.backgroundColor = colors[index];\n });\n animationFrameId = requestAnimationFrame(updateColors);\n };\n }\n };\n}\nif (typeof window !== 'undefined') window.artplayerPluginAmbilight = artplayerPluginAmbilight;\n\n},{\"@parcel/transformer-js/src/esmodule-helpers.js\":\"5lQoW\"}],\"5lQoW\":[function(require,module,exports,__globalThis) {\nexports.interopDefault = function(a) {\n return a && a.__esModule ? a : {\n default: a\n };\n};\nexports.defineInteropFlag = function(a) {\n Object.defineProperty(a, '__esModule', {\n value: true\n });\n};\nexports.exportAll = function(source, dest) {\n Object.keys(source).forEach(function(key) {\n if (key === 'default' || key === '__esModule' || Object.prototype.hasOwnProperty.call(dest, key)) return;\n Object.defineProperty(dest, key, {\n enumerable: true,\n get: function() {\n return source[key];\n }\n });\n });\n return dest;\n};\nexports.export = function(dest, destName, get) {\n Object.defineProperty(dest, destName, {\n enumerable: true,\n get: get\n });\n};\n\n},{}]},[\"9P7rs\"], \"9P7rs\", \"parcelRequire4dc0\", {})\nlet {default: _default, } = parcelRequire4dc0(\"9P7rs\");\nexport {_default as default, };\n\n//# sourceMappingURL=index.js.map\n","export default function artplayerPluginAmbilight(option = {}) {\n return (art) => {\n const { $video } = art.template\n const { createElement, addClass, setStyles } = art.constructor.utils\n const { blur = '50px', opacity = 0.5, frequency = 10, duration = 0.3 } = option\n\n const $ambilight = createElement('div')\n const gridItems = createGridItems($ambilight)\n\n setupAmbilight($ambilight, $video)\n setupGridItems(gridItems, blur, opacity, duration)\n\n const updateColors = createColorUpdater($video, gridItems, frequency)\n\n let animationFrameId = null\n\n function start() {\n if (!animationFrameId) {\n updateColors()\n }\n }\n\n function stop() {\n if (animationFrameId) {\n cancelAnimationFrame(animationFrameId)\n animationFrameId = null\n }\n }\n\n art.on('ready', start)\n art.on('destroy', stop)\n\n return {\n name: 'artplayerPluginAmbilight',\n start,\n stop,\n }\n\n function createGridItems($ambilight) {\n $ambilight.innerHTML = Array.from({ length: 9 }).fill('<div></div>').join('')\n return Array.from($ambilight.children)\n }\n\n function setupAmbilight($ambilight, $video) {\n addClass($ambilight, 'artplayer-plugin-ambilight')\n $video.parentNode.insertBefore($ambilight, $video)\n setStyles($ambilight, {\n position: 'absolute',\n top: 0,\n left: 0,\n zIndex: 9,\n inset: 0,\n display: 'grid',\n gridTemplateColumns: '1fr 1fr 1fr',\n gridTemplateRows: '1fr 1fr 1fr',\n })\n }\n\n function setupGridItems(gridItems, blur, opacity, duration) {\n gridItems.forEach(($item) => {\n setStyles($item, {\n opacity,\n filter: `blur(${blur})`,\n transition: `background-color ${duration}s ease`,\n })\n })\n }\n\n function createColorUpdater($video, gridItems, frequency) {\n const canvas = createElement('canvas')\n const ctx = canvas.getContext('2d')\n canvas.width = 3\n canvas.height = 3\n\n function getAverageColor(x, y, w, h) {\n ctx.drawImage($video, x, y, w, h, 0, 0, 1, 1)\n const [r, g, b] = ctx.getImageData(0, 0, 1, 1).data\n return `rgb(${r}, ${g}, ${b})`\n }\n\n let lastUpdateTime = 0\n\n return function updateColors() {\n const now = performance.now()\n if (now - lastUpdateTime < 1000 / frequency || !art.playing) {\n animationFrameId = requestAnimationFrame(updateColors)\n return\n }\n\n lastUpdateTime = now\n\n const w = $video.videoWidth / 3\n const h = $video.videoHeight / 3\n\n const colors = [\n [0, 0],\n [w, 0],\n [2 * w, 0],\n [0, h],\n [w, h],\n [2 * w, h],\n [0, 2 * h],\n [w, 2 * h],\n [2 * w, 2 * h],\n ].map(([x, y]) => getAverageColor(x, y, w, h))\n\n gridItems.forEach(($item, index) => {\n $item.style.backgroundColor = colors[index]\n })\n\n animationFrameId = requestAnimationFrame(updateColors)\n }\n }\n }\n}\n\nif (typeof window !== 'undefined') {\n window.artplayerPluginAmbilight = artplayerPluginAmbilight\n}\n","exports.interopDefault = function (a) {\n return a && a.__esModule ? a : {default: a};\n};\n\nexports.defineInteropFlag = function (a) {\n Object.defineProperty(a, '__esModule', {value: true});\n};\n\nexports.exportAll = function (source, dest) {\n Object.keys(source).forEach(function (key) {\n if (\n key === 'default' ||\n key === '__esModule' ||\n Object.prototype.hasOwnProperty.call(dest, key)\n ) {\n return;\n }\n\n Object.defineProperty(dest, key, {\n enumerable: true,\n get: function () {\n return source[key];\n },\n });\n });\n\n return dest;\n};\n\nexports.export = function (dest, destName, get) {\n Object.defineProperty(dest, destName, {\n enumerable: true,\n get: get,\n });\n};\n"],"names":["modules","entry","mainEntry","parcelRequireName","externals","distDir","publicUrl","devServer","globalObject","globalThis","self","window","global","previousRequire","importMap","i","cache","nodeRequire","module","require","bind","newRequire","name","jumped","currentRequire","err","Error","code","localRequire","resolve","x","id","Module","call","exports","res","isParcelRequire","moduleName","bundle","parent","register","Object","defineProperty","get","length","mainExports","define","amd","__globalThis","parcelHelpers","artplayerPluginAmbilight","option","art","$ambilight","$video","gridItems","blur","opacity","duration","template","createElement","addClass","setStyles","utils","frequency","innerHTML","Array","from","fill","join","children","parentNode","insertBefore","position","top","left","zIndex","inset","display","gridTemplateColumns","gridTemplateRows","forEach","$item","filter","transition","updateColors","createColorUpdater","canvas","ctx","getContext","width","height","lastUpdateTime","now","performance","playing","animationFrameId","requestAnimationFrame","w","videoWidth","h","videoHeight","colors","map","y","getAverageColor","drawImage","r","g","b","getImageData","data","index","style","backgroundColor","start","stop","cancelAnimationFrame","on","defineInteropFlag","export","interopDefault","a","__esModule","default","value","exportAll","source","dest","keys","key","prototype","hasOwnProperty","enumerable","destName","_default","parcelRequire4dc0"],"version":3,"file":"index.js.map"} |