mirror of
https://github.com/isledecomp/isle.pizza.git
synced 2026-01-19 05:41:17 +00:00
Add Full Screen mode
This commit is contained in:
parent
a9f40d67f8
commit
89ef30348a
32
index.html
32
index.html
@ -722,6 +722,19 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</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>
|
</div>
|
||||||
<div class="config-section">
|
<div class="config-section">
|
||||||
@ -1103,7 +1116,7 @@
|
|||||||
const elements = this.form.elements;
|
const elements = this.form.elements;
|
||||||
|
|
||||||
for (const element of elements) {
|
for (const element of elements) {
|
||||||
if (!element.name) continue;
|
if (!element.name || element.dataset.notIni == "true") continue;
|
||||||
|
|
||||||
let value;
|
let value;
|
||||||
switch (element.type) {
|
switch (element.type) {
|
||||||
@ -1234,6 +1247,23 @@
|
|||||||
} else {
|
} else {
|
||||||
history.replaceState({ page: 'main' }, '', window.location.pathname);
|
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>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user