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