Bilibili-Evolved/registry/dist/components/video/player/legacy-auto-play.js
2022-03-13 16:01:40 +00:00

1 line
1.6 KiB
JavaScript

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["video/player/legacy-auto-play"]=t():e["video/player/legacy-auto-play"]=t()}(self,(function(){return function(){"use strict";var e={d:function(t,o){for(var n in o)e.o(o,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:o[n]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}},t={};e.d(t,{component:function(){return c}});var o=coreApis.observer,n=coreApis.spinQuery,i=coreApis.utils,a=coreApis.utils.urls;const c={name:"legacyAutoPlay",displayName:"传统连播模式",description:"模拟传统的多 P 连播策略: 仅连播视频的分 P 和番剧的多集, 最后 1P 放完禁止连播其他推荐视频.",tags:[componentsTags.video],urlInclude:a.videoUrls,entry:async()=>{const e={enable:[".base-video-sections .next-button",".multi-page .next-button",".player-auxiliary-autoplay-switch input"],disable:[".recommend-list .next-button"]},t=[()=>Boolean(dq(".multi-page .list-box li.on:last-child"))];await(0,i.playerReady)();const a=async()=>{const o=await(0,n.select)([...e.disable,...e.enable].join(","));if(!o)return;var i;(e.enable.some((e=>o.matches(e)))&&t.every((e=>!e())))!==(i=o,Boolean(i.querySelector(".switch-button.on")||i.matches(":checked")))&&o.click()};(0,o.videoChange)((async()=>{a();(await(0,n.select)(".bilibili-player-video video"))?.addEventListener("play",a,{once:!0})}))},commitHash:"77d4e04d00179793585309ff6fbbc34369452271",coreVersion:"2.1.6"};return t=t.component}()}));