video and screen sharing
This commit is contained in:
@@ -1320,95 +1320,13 @@
|
|||||||
|| normalized.indexOf('screen-share') !== -1
|
|| normalized.indexOf('screen-share') !== -1
|
||||||
|| normalized.indexOf('screen share') !== -1
|
|| normalized.indexOf('screen share') !== -1
|
||||||
|| normalized.indexOf('screen sharing') !== -1
|
|| normalized.indexOf('screen sharing') !== -1
|
||||||
|
|| normalized.indexOf('screen-sharing') !== -1
|
||||||
|| normalized.indexOf('screenshare') !== -1
|
|| normalized.indexOf('screenshare') !== -1
|
||||||
|| normalized.indexOf('share screen') !== -1
|
|| normalized.indexOf('share screen') !== -1
|
||||||
|| normalized.indexOf('share your screen') !== -1;
|
|| normalized.indexOf('share your screen') !== -1
|
||||||
}
|
|| normalized.indexOf('desktop') !== -1
|
||||||
|
|| normalized.indexOf('kamera') !== -1
|
||||||
function isPoliticTalkVisibleElement(element) {
|
|| normalized.indexOf('bildschirm') !== -1;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function hidePoliticTalkVideoScreenControls() {
|
function hidePoliticTalkVideoScreenControls() {
|
||||||
@@ -1416,29 +1334,25 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var roots = getPoliticTalkAudioOnlyControlRoots();
|
var controls = document.querySelectorAll([
|
||||||
|
|
||||||
if (!roots.length) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
roots.forEach(function(root) {
|
|
||||||
var controls = root.querySelectorAll([
|
|
||||||
'button',
|
'button',
|
||||||
'[role="button"]',
|
'[role="button"]',
|
||||||
'[role="menuitem"]',
|
'[role="menuitem"]',
|
||||||
'[role="menuitemcheckbox"]',
|
'[role="menuitemcheckbox"]',
|
||||||
'[aria-label]',
|
'.mutevideolink',
|
||||||
'[title]',
|
'.mutedesktoplink',
|
||||||
'li',
|
'[data-testid^="mute-video-"]',
|
||||||
'div',
|
'[data-testid^="mute-desktop-"]',
|
||||||
'span'
|
'[data-testid^="unmute-video-"]',
|
||||||
|
'[data-testid^="unmute-desktop-"]'
|
||||||
].join(','));
|
].join(','));
|
||||||
|
|
||||||
controls.forEach(function(control) {
|
controls.forEach(function(control) {
|
||||||
var controlText = [
|
var controlText = [
|
||||||
control.getAttribute('aria-label'),
|
control.getAttribute('aria-label'),
|
||||||
control.getAttribute('title'),
|
control.getAttribute('title'),
|
||||||
|
control.getAttribute('class'),
|
||||||
|
control.getAttribute('data-testid'),
|
||||||
control.textContent
|
control.textContent
|
||||||
].join(' ');
|
].join(' ');
|
||||||
|
|
||||||
@@ -1446,32 +1360,9 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var rect = control.getBoundingClientRect();
|
control.classList.add('politictalk-hidden-video-screen-control');
|
||||||
var isSemanticAction = control.tagName === 'BUTTON'
|
control.setAttribute('aria-hidden', 'true');
|
||||||
|| control.tagName === 'LI'
|
control.setAttribute('tabindex', '-1');
|
||||||
|| 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');
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user