Files
politictalk/web/plugin.head.html

115 lines
3.3 KiB
HTML

<style>
.politictalk-room-logo {
align-items: center;
display: flex;
height: 64px;
justify-content: center;
left: max(20px, env(safe-area-inset-left));
opacity: 0.96;
position: fixed;
top: max(20px, env(safe-area-inset-top));
width: 64px;
z-index: 2147483000;
}
.politictalk-room-logo img {
display: block;
height: 100%;
object-fit: contain;
width: 100%;
}
@media (max-width: 640px) {
.politictalk-room-logo {
height: 52px;
left: max(12px, env(safe-area-inset-left));
top: max(12px, env(safe-area-inset-top));
width: 52px;
}
}
</style>
<script>
(function() {
function decodeBase64Url(value) {
var base64 = value.replace(/-/g, '+').replace(/_/g, '/');
while (base64.length % 4) {
base64 += '=';
}
var binary = window.atob(base64);
var bytes = new Uint8Array(binary.length);
for (var index = 0; index < binary.length; index += 1) {
bytes[index] = binary.charCodeAt(index);
}
return new TextDecoder().decode(bytes);
}
function getPoliticTalkMeetingTitle() {
try {
var token = new URLSearchParams(window.location.search).get('jwt');
if (!token) {
return '';
}
var payload = JSON.parse(decodeBase64Url(token.split('.')[1] || ''));
var context = payload.context || {};
var room = context.room || {};
var title = (context.politictalk && context.politictalk.title)
|| room.subject
|| room.name
|| '';
title = String(title);
return title.trim() ? title : '';
} catch (error) {
return '';
}
}
function applyPoliticTalkMeetingTitle() {
var meetingTitle = getPoliticTalkMeetingTitle();
if (!meetingTitle) {
return;
}
window.config = window.config || {};
window.config.subject = meetingTitle;
window.config.localSubject = meetingTitle;
}
function mountPoliticTalkLogo() {
if (!document.body || document.getElementById('politictalk-room-logo')) {
return;
}
var link = document.createElement('a');
link.className = 'politictalk-room-logo';
link.href = 'https://parallelglobe.io/politictalk';
link.id = 'politictalk-room-logo';
link.rel = 'noopener noreferrer';
link.target = '_blank';
var image = document.createElement('img');
image.alt = 'ParallelGlobe';
image.src = '/images/politictalk/pg_globe.png';
link.appendChild(image);
document.body.appendChild(link);
}
applyPoliticTalkMeetingTitle();
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', mountPoliticTalkLogo);
} else {
mountPoliticTalkLogo();
}
}());
</script>