mirror of
https://github.com/2009scape/2009scape.github.io.git
synced 2024-11-04 10:02:36 +01:00
Funorb - Add and hook up optional warning parameter to games
This commit is contained in:
parent
27f85fd1d9
commit
47916d124f
@ -3,7 +3,8 @@
|
|||||||
"name": "Age of War",
|
"name": "Age of War",
|
||||||
"image": "./img/ageofwar.avif",
|
"image": "./img/ageofwar.avif",
|
||||||
"swf": "./swfs/ageofwar.swf",
|
"swf": "./swfs/ageofwar.swf",
|
||||||
"forum": "https://forum.2009scape.org/viewtopic.php?t=383-age-of-war"
|
"forum": "https://forum.2009scape.org/viewtopic.php?t=383-age-of-war",
|
||||||
|
"warn": "Warning: This game is very LOUD"
|
||||||
},
|
},
|
||||||
"bloonstd1": {
|
"bloonstd1": {
|
||||||
"name": "Bloons TD 1",
|
"name": "Bloons TD 1",
|
||||||
|
@ -90,7 +90,7 @@ en">
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
|
||||||
<span style="color: red;" id="warning"></span>
|
<div style="color: red; margin-top: 1rem;" id="warning"></div>
|
||||||
<div id="notFound" style="display: none">
|
<div id="notFound" style="display: none">
|
||||||
<br />
|
<br />
|
||||||
Return to <a href="./gamelist.html">the game list</a> and try again.
|
Return to <a href="./gamelist.html">the game list</a> and try again.
|
||||||
@ -98,7 +98,7 @@ en">
|
|||||||
|
|
||||||
<div id="theGameScreen" style="height: max-content;">
|
<div id="theGameScreen" style="height: max-content;">
|
||||||
<script src="https://unpkg.com/@ruffle-rs/ruffle"></script>
|
<script src="https://unpkg.com/@ruffle-rs/ruffle"></script>
|
||||||
<div style="text-align: center; padding-top: 1.5rem; padding-bottom: 1.5rem;">
|
<div style="text-align: center; padding-top: 0.5rem; padding-bottom: 1.5rem;">
|
||||||
<div id="swfgamecontainer">
|
<div id="swfgamecontainer">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -164,9 +164,9 @@ en">
|
|||||||
<script>
|
<script>
|
||||||
fetch("data.json")
|
fetch("data.json")
|
||||||
.then(async response => {
|
.then(async response => {
|
||||||
console.log(response)
|
// console.log(response)
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
console.log(data);
|
// console.log(data);
|
||||||
// Get the current game parameter from URL
|
// Get the current game parameter from URL
|
||||||
const urlParams = new URLSearchParams(window.location.search);
|
const urlParams = new URLSearchParams(window.location.search);
|
||||||
const game = urlParams.get('game');
|
const game = urlParams.get('game');
|
||||||
@ -179,18 +179,21 @@ en">
|
|||||||
document.getElementById('notFound').style.display = '';
|
document.getElementById('notFound').style.display = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
window.RufflePlayer = window.RufflePlayer || {};
|
|
||||||
window.addEventListener("load", (event) => {
|
|
||||||
const ruffle = window.RufflePlayer.newest();
|
|
||||||
const player = ruffle.createPlayer();
|
|
||||||
const container = document.getElementById("swfgamecontainer");
|
|
||||||
container.appendChild(player);
|
|
||||||
player.load(gameData.swf);
|
|
||||||
player.style.width = "680px";
|
|
||||||
player.style.height = "480px";
|
|
||||||
});
|
|
||||||
document.getElementById('talkInForums').setAttribute('href', gameData?.forum || "https://forum.2009scape.org/viewforum.php?f=26-website-games");
|
document.getElementById('talkInForums').setAttribute('href', gameData?.forum || "https://forum.2009scape.org/viewforum.php?f=26-website-games");
|
||||||
document.getElementById('talkInForums2').setAttribute('href', gameData?.forum || "https://forum.2009scape.org/viewforum.php?f=26-website-games");
|
document.getElementById('talkInForums2').setAttribute('href', gameData?.forum || "https://forum.2009scape.org/viewforum.php?f=26-website-games");
|
||||||
|
|
||||||
|
if (gameData.warn) document.getElementById('warning').innerHTML = gameData.warn;
|
||||||
|
|
||||||
|
window.RufflePlayer = window.RufflePlayer || {};
|
||||||
|
console.log("Loading Ruffle...");
|
||||||
|
const ruffle = window.RufflePlayer.newest();
|
||||||
|
const player = ruffle.createPlayer();
|
||||||
|
const container = document.getElementById("swfgamecontainer");
|
||||||
|
container.appendChild(player);
|
||||||
|
player.load(gameData.swf);
|
||||||
|
player.style.width = "680px";
|
||||||
|
player.style.height = "480px";
|
||||||
|
console.log(player);
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user