Added onclick functionality for menu items

This commit is contained in:
2025-07-05 18:32:26 +02:00
parent 2f63009c31
commit 20b6c731b8
4 changed files with 104 additions and 34 deletions

View File

@@ -42,8 +42,11 @@ function exitFullscreen() {
* Toggle between enter and exit fullscreen.
*/
function toggleFullscreen() {
if (document.fullscreenElement) exitFullscreen();
else enterFullscreen();
const params = new URLSearchParams(window.location.search);
const isFull = params.get('fullscreen') === '1';
if (isFull) exitFullscreen();
else enterFullscreen();
}
/**

View File

@@ -139,5 +139,20 @@ window.addEventListener('popstate', function(event) {
}
});
/**
* Opens the current iframe URL in a new browser tab.
*/
function openIframeInNewTab() {
const params = new URLSearchParams(window.location.search);
const iframeUrl = params.get('iframe');
if (iframeUrl) {
window.open(iframeUrl, '_blank');
} else {
alert('No iframe is currently open.');
}
}
// expose globally so your templates onclick can find it
window.openIframeInNewTab = openIframeInNewTab;
// Adjust iframe height on window resize
window.addEventListener('resize', syncIframeHeight);