diff --git a/config/politictalk.parallelglobe.io-config.js b/config/politictalk.parallelglobe.io-config.js index 7d658a2..b1c8e05 100644 --- a/config/politictalk.parallelglobe.io-config.js +++ b/config/politictalk.parallelglobe.io-config.js @@ -1387,7 +1387,7 @@ var config = { // disablePrivateChat: 'all' | 'allow-moderator-chat' | 'disable-visitor-chat', // }, remoteVideoMenu: { - disabled: true, + disabled: false, disableDemote: true, disableKick: true, disableGrantModerator: true, @@ -1496,7 +1496,7 @@ var config = { participantsPane: { enabled: true, hideModeratorSettingsTab: true, - hideMoreActionsButton: true, + hideMoreActionsButton: false, hideMuteAllButton: false }, diff --git a/web/plugin.head.html b/web/plugin.head.html index a4692f1..5eb2c77 100644 --- a/web/plugin.head.html +++ b/web/plugin.head.html @@ -1325,58 +1325,90 @@ || normalized.indexOf('share your screen') !== -1; } - function getPoliticTalkParticipantsPane() { + 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"]' + '[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.find(function(candidate) { + return candidates.filter(function(candidate) { var text = normalizePoliticTalkText(candidate.textContent); var rect = candidate.getBoundingClientRect(); - return rect.width > 120 - && rect.height > 240 + 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) ); - }) || null; + }); } 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' + if (current.tagName === 'BUTTON' || role === 'button' || role === 'menuitem' - || ( - isPoliticTalkVideoOrScreenText(text) - && rect.width > 40 - && rect.width < 720 - && rect.height > 24 - && rect.height < 160 - ) - ) { + || 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 element; + return candidate || element; } function hidePoliticTalkVideoScreenControls() { @@ -1384,46 +1416,62 @@ return; } - var pane = getPoliticTalkParticipantsPane(); + var roots = getPoliticTalkAudioOnlyControlRoots(); - if (!pane) { + if (!roots.length) { return; } - var controls = pane.querySelectorAll('button, [role="button"], [role="menuitem"], li, div, span'); + roots.forEach(function(root) { + var controls = root.querySelectorAll([ + 'button', + '[role="button"]', + '[role="menuitem"]', + '[role="menuitemcheckbox"]', + '[aria-label]', + '[title]', + 'li', + 'div', + 'span' + ].join(',')); - controls.forEach(function(control) { - var controlText = [ - control.getAttribute('aria-label'), - control.getAttribute('title'), - control.textContent - ].join(' '); + controls.forEach(function(control) { + var controlText = [ + control.getAttribute('aria-label'), + control.getAttribute('title'), + control.textContent + ].join(' '); - if (!isPoliticTalkVideoOrScreenText(controlText)) { - return; - } + 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'); + 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 > 720 - || rect.height < 20 - || rect.height > 160 - )) { - return; - } + if (!isSemanticAction && ( + rect.width < 40 + || rect.width > 760 + || rect.height < 18 + || rect.height > 150 + )) { + return; + } - var container = findPoliticTalkActionContainer(control); + var container = findPoliticTalkActionContainer(control); - container.classList.add('politictalk-hidden-video-screen-control'); - container.setAttribute('aria-hidden', 'true'); - container.setAttribute('tabindex', '-1'); + 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'); + }); }); }