mirror of
https://github.com/the1812/Bilibili-Evolved.git
synced 2025-11-04 21:22:45 +08:00
1 line
1.9 KiB
JavaScript
1 line
1.9 KiB
JavaScript
!function(e,a){"object"==typeof exports&&"object"==typeof module?module.exports=a():"function"==typeof define&&define.amd?define([],a):"object"==typeof exports?exports["video/danmaku/expand"]=a():e["video/danmaku/expand"]=a()}(globalThis,(()=>(()=>{"use strict";var e={d:(a,o)=>{for(var t in o)e.o(o,t)&&!e.o(a,t)&&Object.defineProperty(a,t,{enumerable:!0,get:o[t]})},o:(e,a)=>Object.prototype.hasOwnProperty.call(e,a)},a={};e.d(a,{component:()=>l});const o=coreApis.componentApis.define,t=coreApis.observer,n=coreApis.spinQuery,i=coreApis.utils,s=coreApis.utils.log,r=coreApis.utils.urls,l=(0,o.defineComponentMetadata)({name:"expandDanmakuList",displayName:"展开弹幕列表",entry:async e=>{let{settings:{options:a}}=e;const o=(0,s.useScopedConsole)("展开弹幕列表");(0,t.videoChange)((async()=>{if(r.mediaListUrls.some((e=>(0,i.matchUrlPattern)(e)))&&a.ignoreMediaList)return;const e=await(async()=>{const e=((await(0,n.select)(".bilibili-player-video-info-danmaku-number, .bpx-player-video-info-dm"))?.textContent??"").match(/\d+/);if(!e)return null;const a=parseInt(e[0]);return Number.isNaN(a)?null:a})();if(o.log(`当前弹幕量: ${e}`),null!==e&&e>a.maxDanmakuCount)return void o.log(`超过了最大弹幕数量 ${a.maxDanmakuCount}, 跳过展开`);const t=await(0,n.select)(".bui-collapse-wrap");if(t&&t.classList.contains("bui-collapse-wrap-folded")){(await(0,n.select)(".bui-collapse-header"))?.click()}}))},tags:[componentsTags.video],description:{"zh-CN":"每次加载视频时自动展开弹幕列表, 如果弹幕装载量超过 `最大弹幕数量`, 则不展开以免对页面造成卡顿."},options:{ignoreMediaList:{defaultValue:!0,displayName:"合集类页面不自动展开"},maxDanmakuCount:{defaultValue:500,displayName:"最大弹幕数量"}},urlInclude:[...r.videoAndBangumiUrls,...r.mediaListUrls],commitHash:"702d02d6ccd0aaf052d01da5339c0a0fcd2e3aaa",coreVersion:"2.6.0"});return a=a.component})())); |