video and screen sharing

This commit is contained in:
2026-05-31 00:57:50 +05:30
parent 52a145492b
commit cc569d2e77

View File

@@ -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');
});
}