Add Full Screen mode

This commit is contained in:
Christian Semmler 2025-07-08 15:09:38 -07:00
parent a9f40d67f8
commit 89ef30348a
No known key found for this signature in database
GPG Key ID: 086DAA1360BEEE5C

View File

@ -722,6 +722,19 @@
</select>
</div>
</div>
<div class="form-group">
<label class="form-group-label">Window</label>
<div class="radio-group option-list">
<div class="option-item">
<input type="radio" id="window-windowed" name="window" data-not-ini="true" checked>
<label for="window-windowed">Windowed</label>
</div>
<div class="option-item">
<input type="radio" id="window-fullscreen" name="window" data-not-ini="true">
<label for="window-fullscreen">Full Screen</label>
</div>
</div>
</div>
</div>
</div>
<div class="config-section">
@ -1103,7 +1116,7 @@
const elements = this.form.elements;
for (const element of elements) {
if (!element.name) continue;
if (!element.name || element.dataset.notIni == "true") continue;
let value;
switch (element.type) {
@ -1234,6 +1247,23 @@
} else {
history.replaceState({ page: 'main' }, '', window.location.pathname);
}
const fullscreenElement = document.getElementById('window-fullscreen');
const windowedElement = document.getElementById('window-windowed');
fullscreenElement.addEventListener('change', () => {
if (fullscreenElement.checked) {
document.documentElement.requestFullscreen().catch(err => {
console.error(`Error attempting to enable full-screen mode: ${err.message} (${err.name})`);
});
}
});
windowedElement.addEventListener('change', () => {
if (windowedElement.checked && document.fullscreenElement) {
document.exitFullscreen();
}
});
});
</script>