aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/utils/pageUtils.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils/pageUtils.ts')
-rw-r--r--src/utils/pageUtils.ts20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/utils/pageUtils.ts b/src/utils/pageUtils.ts
new file mode 100644
index 00000000..e88f7cc9
--- /dev/null
+++ b/src/utils/pageUtils.ts
@@ -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;
+} \ No newline at end of file