From cc569d2e7784d1bb23c2b7ee92a4f67542574d67 Mon Sep 17 00:00:00 2001 From: Amardeep Date: Sun, 31 May 2026 00:57:50 +0530 Subject: [PATCH] video and screen sharing --- web/plugin.head.html | 171 ++++++++----------------------------------- 1 file changed, 31 insertions(+), 140 deletions(-) diff --git a/web/plugin.head.html b/web/plugin.head.html index 5eb2c77..31d5ca2 100644 --- a/web/plugin.head.html +++ b/web/plugin.head.html @@ -1320,95 +1320,13 @@ || normalized.indexOf('screen-share') !== -1 || normalized.indexOf('screen share') !== -1 || normalized.indexOf('screen sharing') !== -1 + || normalized.indexOf('screen-sharing') !== -1 || normalized.indexOf('screenshare') !== -1 || normalized.indexOf('share screen') !== -1 - || normalized.indexOf('share your screen') !== -1; - } - - function isPoliticTalkVisibleElement(element) { - if (!element || !element.getBoundingClientRect) { - return false; - } - - var rect = element.getBoundingClientRect(); - var styles = window.getComputedStyle(element); - - return rect.width > 0 - && rect.height > 0 - && styles.display !== 'none' - && styles.visibility !== 'hidden'; - } - - function getPoliticTalkAudioOnlyControlRoots() { - var candidates = Array.prototype.slice.call(document.querySelectorAll([ - '#sideToolbarContainer', - '.sideToolbarContainer', - '.participants-pane', - '.participants_pane', - '[class*="participantsPane"]', - '[role="dialog"]', - '[role="menu"]', - '[aria-modal="true"]', - '[class*="popover"]', - '[class*="Popover"]', - '[class*="context"]', - '[class*="Context"]', - '[class*="drawer"]', - '[class*="Drawer"]', - '[class*="menu"]', - '[class*="Menu"]' - ].join(','))); - - return candidates.filter(function(candidate) { - var text = normalizePoliticTalkText(candidate.textContent); - var rect = candidate.getBoundingClientRect(); - - return isPoliticTalkVisibleElement(candidate) - && rect.width > 120 - && rect.height > 40 - && ( - text.indexOf('meeting participants') !== -1 - || text.indexOf('search participants') !== -1 - || text.indexOf('anwesende') !== -1 - || text.indexOf('mute all') !== -1 - || text.indexOf('alle stummschalten') !== -1 - || isPoliticTalkVideoOrScreenText(text) - ); - }); - } - - function findPoliticTalkActionContainer(element) { - var current = element; - var candidate = null; - - while (current && current !== document.body) { - var role = normalizePoliticTalkText(current.getAttribute('role')); - var text = normalizePoliticTalkText(current.textContent); - var rect = current.getBoundingClientRect(); - - if (current.tagName === 'BUTTON' - || role === 'button' - || role === 'menuitem' - || role === 'menuitemcheckbox') { - return current; - } - - if (isPoliticTalkVideoOrScreenText(text) - && rect.width > 40 - && rect.width < 760 - && rect.height > 24 - && rect.height < 150) { - candidate = current; - } - - if (candidate && (rect.width > 900 || rect.height > 220)) { - break; - } - - current = current.parentElement; - } - - return candidate || element; + || normalized.indexOf('share your screen') !== -1 + || normalized.indexOf('desktop') !== -1 + || normalized.indexOf('kamera') !== -1 + || normalized.indexOf('bildschirm') !== -1; } function hidePoliticTalkVideoScreenControls() { @@ -1416,62 +1334,35 @@ return; } - var roots = getPoliticTalkAudioOnlyControlRoots(); + var controls = document.querySelectorAll([ + 'button', + '[role="button"]', + '[role="menuitem"]', + '[role="menuitemcheckbox"]', + '.mutevideolink', + '.mutedesktoplink', + '[data-testid^="mute-video-"]', + '[data-testid^="mute-desktop-"]', + '[data-testid^="unmute-video-"]', + '[data-testid^="unmute-desktop-"]' + ].join(',')); - if (!roots.length) { - return; - } + controls.forEach(function(control) { + var controlText = [ + control.getAttribute('aria-label'), + control.getAttribute('title'), + control.getAttribute('class'), + control.getAttribute('data-testid'), + control.textContent + ].join(' '); - roots.forEach(function(root) { - var controls = root.querySelectorAll([ - 'button', - '[role="button"]', - '[role="menuitem"]', - '[role="menuitemcheckbox"]', - '[aria-label]', - '[title]', - 'li', - 'div', - 'span' - ].join(',')); + if (!isPoliticTalkVideoOrScreenText(controlText)) { + return; + } - controls.forEach(function(control) { - var controlText = [ - control.getAttribute('aria-label'), - control.getAttribute('title'), - control.textContent - ].join(' '); - - if (!isPoliticTalkVideoOrScreenText(controlText)) { - return; - } - - var rect = control.getBoundingClientRect(); - var isSemanticAction = control.tagName === 'BUTTON' - || control.tagName === 'LI' - || control.hasAttribute('role') - || control.hasAttribute('aria-label') - || control.hasAttribute('title'); - - if (!isSemanticAction && ( - rect.width < 40 - || rect.width > 760 - || rect.height < 18 - || rect.height > 150 - )) { - return; - } - - var container = findPoliticTalkActionContainer(control); - - if (!container || container === root || container === document.body) { - return; - } - - container.classList.add('politictalk-hidden-video-screen-control'); - container.setAttribute('aria-hidden', 'true'); - container.setAttribute('tabindex', '-1'); - }); + control.classList.add('politictalk-hidden-video-screen-control'); + control.setAttribute('aria-hidden', 'true'); + control.setAttribute('tabindex', '-1'); }); }