mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2024-11-13 02:14:23 +01:00
Merge pull request #1315 from mchangrh/invidiousProgressBar
shortcut creating preview bar on invidious
This commit is contained in:
commit
a0c82dc734
1 changed files with 24 additions and 12 deletions
|
@ -391,20 +391,32 @@ function handleMobileControlsMutations(): void {
|
||||||
function createPreviewBar(): void {
|
function createPreviewBar(): void {
|
||||||
if (previewBar !== null) return;
|
if (previewBar !== null) return;
|
||||||
|
|
||||||
const progressElementSelectors = [
|
const progressElementOptions = [{
|
||||||
// For mobile YouTube
|
// For mobile YouTube
|
||||||
".progress-bar-background",
|
selector: ".progress-bar-background",
|
||||||
// for new mobile YouTube (#1287)
|
isVisibleCheck: true
|
||||||
".ytm-progress-bar",
|
}, {
|
||||||
// For YouTube
|
// For new mobile YouTube (#1287)
|
||||||
".ytp-progress-bar-container",
|
selector: ".ytm-progress-bar",
|
||||||
".no-model.cue-range-markers",
|
isVisibleCheck: true
|
||||||
// For Invidious/VideoJS
|
}, {
|
||||||
".vjs-progress-holder"
|
// For Desktop YouTube
|
||||||
|
selector: ".ytp-progress-bar-container",
|
||||||
|
isVisibleCheck: true
|
||||||
|
}, {
|
||||||
|
// For Desktop YouTube
|
||||||
|
selector: ".no-model.cue-range-marker",
|
||||||
|
isVisibleCheck: true
|
||||||
|
}, {
|
||||||
|
// For Invidious/VideoJS
|
||||||
|
selector: ".vjs-progress-holder",
|
||||||
|
isVisibleCheck: false
|
||||||
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
for (const selector of progressElementSelectors) {
|
for (const option of progressElementOptions) {
|
||||||
const el = findValidElement(document.querySelectorAll(selector));
|
const allElements = document.querySelectorAll(option.selector) as NodeListOf<HTMLElement>;
|
||||||
|
const el = option.isVisibleCheck ? findValidElement(allElements) : allElements[0];
|
||||||
|
|
||||||
if (el) {
|
if (el) {
|
||||||
previewBar = new PreviewBar(el, onMobileYouTube, onInvidious);
|
previewBar = new PreviewBar(el, onMobileYouTube, onInvidious);
|
||||||
|
|
Loading…
Reference in a new issue