Add skip to highlight to mobile

This commit is contained in:
Ajay Ramachandran
2021-10-21 01:30:52 -04:00
parent d1e6421e5b
commit c803ae9499
4 changed files with 95 additions and 33 deletions

20
src/utils/pageUtils.ts Normal file
View File

@@ -0,0 +1,20 @@
export function getControls(): HTMLElement | false {
const controlsSelectors = [
// YouTube
".ytp-right-controls",
// Mobile YouTube
".player-controls-top",
// Invidious/videojs video element's controls element
".vjs-control-bar",
];
for (const controlsSelector of controlsSelectors) {
const controls = document.querySelectorAll(controlsSelector);
if (controls && controls.length > 0) {
return <HTMLElement> controls[controls.length - 1];
}
}
return false;
}