mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2024-11-13 02:14:23 +01:00
Merge pull request #1710 from mini-bomba/controls-skip-inline-players
Don't attach controls to inline preview players
This commit is contained in:
commit
e1521e9837
1 changed files with 9 additions and 5 deletions
|
@ -14,9 +14,9 @@ export function getControls(): HTMLElement {
|
|||
];
|
||||
|
||||
for (const controlsSelector of controlsSelectors) {
|
||||
const controls = document.querySelectorAll(controlsSelector);
|
||||
const controls = Array.from(document.querySelectorAll(controlsSelector)).filter(el => !isInPreviewPlayer(el));
|
||||
|
||||
if (controls && controls.length > 0) {
|
||||
if (controls.length > 0) {
|
||||
return <HTMLElement> controls[controls.length - 1];
|
||||
}
|
||||
}
|
||||
|
@ -24,6 +24,10 @@ export function getControls(): HTMLElement {
|
|||
return null;
|
||||
}
|
||||
|
||||
export function isInPreviewPlayer(element: Element): boolean {
|
||||
return !!element.closest("#inline-preview-player");
|
||||
}
|
||||
|
||||
export function isVisible(element: HTMLElement): boolean {
|
||||
return element && element.offsetWidth > 0 && element.offsetHeight > 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue