fixed flash loading for mgg0

This commit is contained in:
MetaGG2
2026-04-10 23:07:13 -04:00
parent 7915c0e565
commit 5364f96257
+66 -64
View File
@@ -1,64 +1,66 @@
<html> <html>
<head> <head>
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<title>Flash Player</title> <title>Flash Player</title>
<link id="favicon" rel="shortcut icon" type="image/png" href="/"> <link id="favicon" rel="shortcut icon" type="image/png" href="/">
</head> </head>
<body> <body>
<div id="ruffle" width="100%" height="100%"></div> <div id="ruffle" width="100%" height="100%"></div>
<script src="ruffle.js"></script> <script src="ruffle.js"></script>
<script> <script>
var defaultGame = (new URLSearchParams(window.location.search)).get('game'); var defaultGame = (new URLSearchParams(window.location.search)).get('game');
if (document.getElementsByTagName('base').length > 0 && !window.location.href.includes(document.getElementsByTagName('base')[0].href)) { if (defaultGame.charAt(defaultGame.length - 1) == '/')
const gameUrl = new URL(document.getElementsByTagName('base')[0].href); defaultGame = defaultGame.substring(0, defaultGame.length - 1);
const gameUrlParams = (new URLSearchParams(gameUrl.search)).get('game'); if (document.getElementsByTagName('base').length > 0 && !window.location.href.includes(document.getElementsByTagName('base')[0].href)) {
defaultGame = gameUrlParams || defaultGame; const gameUrl = new URL(document.getElementsByTagName('base')[0].href);
} const gameUrlParams = (new URLSearchParams(gameUrl.search)).get('game');
if (!defaultGame) { defaultGame = gameUrlParams || defaultGame;
/*var fileInput = document.createElement('input'); }
fileInput.type = 'file'; if (!defaultGame) {
fileInput.id = 'fileInput'; /*var fileInput = document.createElement('input');
var uploadButton = document.createElement('button'); fileInput.type = 'file';
uploadButton.textContent = 'Upload File'; fileInput.id = 'fileInput';
uploadButton.addEventListener('click', handleFileUpload); var uploadButton = document.createElement('button');
// Append elements to the body uploadButton.textContent = 'Upload File';
document.body.appendChild(fileInput); uploadButton.addEventListener('click', handleFileUpload);
document.body.appendChild(uploadButton); // Append elements to the body
document.body.appendChild(fileInput);
function handleFileUpload() { document.body.appendChild(uploadButton);
var uploadedFile = fileInput.files[0];
if (uploadedFile) { function handleFileUpload() {
// appears to take a url rather than local file var uploadedFile = fileInput.files[0];
load(uploadedFile); if (uploadedFile) {
} else { // appears to take a url rather than local file
alert('Please select a file to upload.'); load(uploadedFile);
} } else {
} alert('Please select a file to upload.');
*/ }
} else { }
document.title = (defaultGame.replace(/-/g, ' ')).toLowerCase().split(' ').map(function (word) { */
return word[0].toUpperCase() + word.substr(1); } else {
}).join(' '); document.title = (defaultGame.replace(/-/g, ' ')).toLowerCase().split(' ').map(function (word) {
document.querySelector('#favicon').href = `images/${defaultGame}.png`; return word[0].toUpperCase() + word.substr(1);
load(`files/${defaultGame}.swf`); }).join(' ');
} document.querySelector('#favicon').href = `images/${defaultGame}.png`;
load(`files/${defaultGame}.swf`);
function load(game) { }
window.RufflePlayer = window.RufflePlayer || {};
window.addEventListener("load", (event) => { function load(game) {
const ruffle = window.RufflePlayer.newest(); window.RufflePlayer = window.RufflePlayer || {};
const player = ruffle.createPlayer(); window.addEventListener("load", (event) => {
const container = document.getElementById("ruffle"); const ruffle = window.RufflePlayer.newest();
player.id = "player"; const player = ruffle.createPlayer();
player.style.width = "100%"; const container = document.getElementById("ruffle");
player.style.height = "100%"; player.id = "player";
container.appendChild(player) player.style.width = "100%";
player.load(game); player.style.height = "100%";
}); container.appendChild(player)
} player.load(game);
</script> });
</body> }
</script>
</html> </body>
</html>