diff --git a/web/plugin.head.html b/web/plugin.head.html index ad09a87..71fa48f 100644 --- a/web/plugin.head.html +++ b/web/plugin.head.html @@ -11,6 +11,7 @@ } html:not(.politictalk-direct-access-blocked) { + --politictalk-stage-top-inset: 96px; --politictalk-toolbar-bottom-offset: 12px; --politictalk-toolbar-mobile-scale: 0.96; } @@ -38,6 +39,12 @@ background-image: none !important; } + html.politictalk-stage-brand-inset:not(.politictalk-direct-access-blocked) #videospace { + box-sizing: border-box !important; + height: calc(100% - var(--politictalk-stage-top-inset, 96px)) !important; + top: var(--politictalk-stage-top-inset, 96px) !important; + } + .politictalk-room-logo { align-items: center; display: flex; @@ -467,6 +474,10 @@ background-position: center center !important; } + html:not(.politictalk-direct-access-blocked) { + --politictalk-stage-top-inset: 88px; + } + .politictalk-room-logo { gap: 10px; height: 48px; @@ -772,6 +783,55 @@ }, 250); } + function isSideToolbarOpen() { + var sideToolbar = document.getElementById('sideToolbarContainer') + || document.querySelector('.sideToolbarContainer'); + + if (!sideToolbar) { + return false; + } + + var rect = sideToolbar.getBoundingClientRect(); + var style = window.getComputedStyle(sideToolbar); + + return style.display !== 'none' + && style.visibility !== 'hidden' + && Number(style.opacity || 1) > 0 + && rect.width > 120 + && rect.height > 240; + } + + function updatePoliticTalkStageBrandInset() { + if (directAccessBlocked || !document.body) { + document.documentElement.classList.remove('politictalk-stage-brand-inset'); + return; + } + + document.documentElement.classList.toggle('politictalk-stage-brand-inset', !isSideToolbarOpen()); + } + + function mountPoliticTalkStageBrandInset() { + updatePoliticTalkStageBrandInset(); + + window.addEventListener('resize', updatePoliticTalkStageBrandInset, { passive: true }); + window.addEventListener('orientationchange', updatePoliticTalkStageBrandInset, { passive: true }); + + if (window.politicTalkStageInsetObserver || !document.body) { + return; + } + + window.politicTalkStageInsetObserver = new MutationObserver(function() { + window.cancelAnimationFrame(window.politicTalkStageInsetFrame); + window.politicTalkStageInsetFrame = window.requestAnimationFrame(updatePoliticTalkStageBrandInset); + }); + window.politicTalkStageInsetObserver.observe(document.body, { + attributes: true, + attributeFilter: [ 'class', 'style' ], + childList: true, + subtree: true + }); + } + function isIgnoredJitsiPath(path) { return /^\/(?:static|images|libs|css|sounds|fonts|transcripts)\//.test(path); } @@ -1161,6 +1221,7 @@ mountDirectAccessMessage(); mountHostHangupPolicy(); mountMobileToolbarPositioning(); + mountPoliticTalkStageBrandInset(); }); } else { mountPoliticTalkDocumentTitle(); @@ -1168,6 +1229,7 @@ mountDirectAccessMessage(); mountHostHangupPolicy(); mountMobileToolbarPositioning(); + mountPoliticTalkStageBrandInset(); } }());