Add no live autoplay

This commit is contained in:
the1812 2019-06-13 23:35:04 +08:00
parent 31bf7d92d5
commit fab2a564a6
14 changed files with 3122 additions and 3025 deletions

View File

@ -83,18 +83,18 @@ declare global
const unsafeWindow: Window; const unsafeWindow: Window;
class SpinQuery class SpinQuery
{ {
static condition<T>(query: () => T, condition: (queryResult: T) => boolean, success: (queryResult: T) => void, failed: () => void): void; static condition<T>(query: () => T, condition: (queryResult: T) => boolean, success: (queryResult: T) => void, failed?: () => void): void;
static condition<T>(query: () => T, condition: (queryResult: T) => boolean): Promise<T>; static condition<T>(query: () => T, condition: (queryResult: T) => boolean): Promise<T>;
static select<T>(query: () => T, action: (queryResult: T) => void, failed: () => void): void; static select<T>(query: () => T, action: (queryResult: T) => void, failed?: () => void): void;
static select<T>(query: () => T): Promise<T>; static select<T>(query: () => T): Promise<T>;
static select(query: string): Promise<HTMLElement | null>; static select(query: string): Promise<HTMLElement | null>;
static any<T>(query: () => T, action: (queryResult: T) => void, failed: () => void): void; static any<T>(query: () => T, action: (queryResult: T) => void, failed?: () => void): void;
static any<T>(query: () => T): Promise<T>; static any<T>(query: () => T): Promise<T>;
static any(query: string): Promise<any>; static any(query: string): Promise<any>;
static count<T>(query: () => T, count: number, success: (queryResult: T) => void, failed: () => void): void; static count<T>(query: () => T, count: number, success: (queryResult: T) => void, failed?: () => void): void;
static count<T>(query: () => T, count: number): Promise<T>; static count<T>(query: () => T, count: number): Promise<T>;
static count(query: string, count: number): Promise<NodeListOf<Element>>; static count(query: string, count: number): Promise<NodeListOf<Element>>;
static unsafeJquery(action: () => void, failed: () => void): void; static unsafeJquery(action: () => void, failed?: () => void): void;
static unsafeJquery(): Promise<void>; static unsafeJquery(): Promise<void>;
} }
class Toast class Toast

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

1
min/no-live-autoplay.min.js vendored Normal file
View File

@ -0,0 +1 @@
(()=>{return(e,i)=>{(async()=>{const e=document.URL.replace(window.location.search,"");if(e!=="https://live.bilibili.com/"&&e!=="https://live.bilibili.com/index.html"){return}SpinQuery.condition(()=>document.querySelector(".component-ctnr video"),e=>!e.paused,()=>{const e=document.querySelector(".bilibili-live-player-video-controller-start-btn>button");e.click()})})()}})();

1
min/no-mini-video-autoplay.min.js vendored Normal file
View File

@ -0,0 +1 @@
(()=>{return(r,e)=>{}})();

View File

@ -98,6 +98,9 @@
<checkbox indent="0" key="oldTweets" dependencies=""></checkbox> <checkbox indent="0" key="oldTweets" dependencies=""></checkbox>
<checkbox indent="0" key="i18n" dependencies=""></checkbox> <checkbox indent="0" key="i18n" dependencies=""></checkbox>
<dropdown indent="1" key="i18nLanguage" dependencies="i18n"></dropdown> <dropdown indent="1" key="i18nLanguage" dependencies="i18n"></dropdown>
<checkbox indent="0" key="noLiveAutoplay" dependencies=""></checkbox>
<checkbox indent="1" key="hideHomeLive" dependencies="noLiveAutoplay"></checkbox>
<checkbox indent="0" key="noMiniVideoAutoplay" dependencies=""></checkbox>
<category icon="touch">触摸</category> <category icon="touch">触摸</category>
<checkbox indent="0" key="touchNavBar" dependencies=""></checkbox> <checkbox indent="0" key="touchNavBar" dependencies=""></checkbox>
<checkbox indent="0" key="comboLike" dependencies=""></checkbox> <checkbox indent="0" key="comboLike" dependencies=""></checkbox>

10
utils/no-live-autoplay.js Normal file
View File

@ -0,0 +1,10 @@
(async () => {
const url = document.URL.replace(window.location.search, '');
if (url !== 'https://live.bilibili.com/' && url !== 'https://live.bilibili.com/index.html') {
return;
}
SpinQuery.condition(() => document.querySelector('.component-ctnr video'), (video) => !video.paused, () => {
const button = document.querySelector('.bilibili-live-player-video-controller-start-btn>button');
button.click();
});
})();

14
utils/no-live-autoplay.ts Normal file
View File

@ -0,0 +1,14 @@
(async () => {
const url = document.URL.replace(window.location.search, '')
if (url !== 'https://live.bilibili.com/' && url !== 'https://live.bilibili.com/index.html') {
return
}
SpinQuery.condition(
() => document.querySelector('.component-ctnr video'),
(video: HTMLVideoElement) => !video.paused,
() => {
const button = document.querySelector('.bilibili-live-player-video-controller-start-btn>button') as HTMLButtonElement
button.click()
}
)
})()

View File

View File