diff --git a/web/plugin.head.html b/web/plugin.head.html index 92c6be0..c7f649f 100644 --- a/web/plugin.head.html +++ b/web/plugin.head.html @@ -195,6 +195,15 @@ z-index: 2 !important; } + html:not(.politictalk-direct-access-blocked) #largeVideoContainer.politictalk-hide-dominant-speaker #dominantSpeaker, + html:not(.politictalk-direct-access-blocked) #largeVideoContainer.politictalk-hide-dominant-speaker [data-testid="stage-display-name"], + html:not(.politictalk-direct-access-blocked) #largeVideoContainer.politictalk-hide-dominant-speaker #remotePresenceMessage, + html:not(.politictalk-direct-access-blocked) #largeVideoContainer.politictalk-hide-dominant-speaker #remoteConnectionMessage { + opacity: 0 !important; + pointer-events: none !important; + visibility: hidden !important; + } + html:not(.politictalk-direct-access-blocked) #videospace .avatar:not(img), html:not(.politictalk-direct-access-blocked) #videospace .userAvatar:not(img), html:not(.politictalk-direct-access-blocked) #videospace #dominantSpeakerAvatar:not(img) { @@ -2240,7 +2249,7 @@ }); } - function applyPoliticTalkLargeVideoLayout(videospace) { + function setPoliticTalkDominantSpeakerLayerVisibility(videospace, shouldShow) { if (!videospace) { return; } @@ -2251,6 +2260,37 @@ return; } + largeVideoContainer.classList.toggle('politictalk-hide-dominant-speaker', !shouldShow); + + [ + largeVideoContainer.querySelector('#dominantSpeaker'), + largeVideoContainer.querySelector('[data-testid="stage-display-name"]'), + largeVideoContainer.querySelector('#remotePresenceMessage'), + largeVideoContainer.querySelector('#remoteConnectionMessage') + ].forEach(function(element) { + if (!element) { + return; + } + + setPoliticTalkImportantStyle(element, 'opacity', shouldShow ? '1' : '0'); + setPoliticTalkImportantStyle(element, 'pointer-events', shouldShow ? 'auto' : 'none'); + setPoliticTalkImportantStyle(element, 'visibility', shouldShow ? 'visible' : 'hidden'); + }); + } + + function applyPoliticTalkLargeVideoLayout(videospace, tiles) { + if (!videospace) { + return; + } + + var largeVideoContainer = videospace.querySelector('#largeVideoContainer'); + + if (!largeVideoContainer) { + return; + } + + setPoliticTalkDominantSpeakerLayerVisibility(videospace, !tiles || tiles.length <= 1); + var availableHeight = getPoliticTalkAvailableTileHeight(videospace); if (!Number.isFinite(availableHeight) || availableHeight <= 0) { @@ -2357,7 +2397,7 @@ ); var dominantMetadata = getPoliticTalkDominantSpeakerRoleMetadata(videospace, tiles); - applyPoliticTalkLargeVideoLayout(videospace); + applyPoliticTalkLargeVideoLayout(videospace, tiles); applyPoliticTalkTileLayout(videospace, tiles); applyPoliticTalkDominantSpeakerTheme(videospace, tiles, dominantMetadata);