|
1 | | -<html> |
2 | | - |
3 | | -<head> |
4 | | - <meta name="viewport" content="width=device-width, initial-scale=1"> |
5 | | - <title>Flash Player</title> |
6 | | - <link id="favicon" rel="shortcut icon" type="image/png" href="/"> |
7 | | -</head> |
8 | | - |
9 | | -<body> |
10 | | - <div id="ruffle" width="100%" height="100%"></div> |
11 | | - <script src="ruffle.js"></script> |
12 | | - <script> |
13 | | - var defaultGame = (new URLSearchParams(window.location.search)).get('game'); |
14 | | - if (document.getElementsByTagName('base').length > 0 && !window.location.href.includes(document.getElementsByTagName('base')[0].href)) { |
15 | | - const gameUrl = new URL(document.getElementsByTagName('base')[0].href); |
16 | | - const gameUrlParams = (new URLSearchParams(gameUrl.search)).get('game'); |
17 | | - defaultGame = gameUrlParams || defaultGame; |
18 | | - } |
19 | | - if (!defaultGame) { |
20 | | - /*var fileInput = document.createElement('input'); |
21 | | - fileInput.type = 'file'; |
22 | | - fileInput.id = 'fileInput'; |
23 | | - var uploadButton = document.createElement('button'); |
24 | | - uploadButton.textContent = 'Upload File'; |
25 | | - uploadButton.addEventListener('click', handleFileUpload); |
26 | | - // Append elements to the body |
27 | | - document.body.appendChild(fileInput); |
28 | | - document.body.appendChild(uploadButton); |
29 | | -
|
30 | | - function handleFileUpload() { |
31 | | - var uploadedFile = fileInput.files[0]; |
32 | | - if (uploadedFile) { |
33 | | - // appears to take a url rather than local file |
34 | | - load(uploadedFile); |
35 | | - } else { |
36 | | - alert('Please select a file to upload.'); |
37 | | - } |
38 | | - } |
39 | | - */ |
40 | | - } else { |
41 | | - document.title = (defaultGame.replace(/-/g, ' ')).toLowerCase().split(' ').map(function (word) { |
42 | | - return word[0].toUpperCase() + word.substr(1); |
43 | | - }).join(' '); |
44 | | - document.querySelector('#favicon').href = `images/${defaultGame}.png`; |
45 | | - load(`files/${defaultGame}.swf`); |
46 | | - } |
47 | | - |
48 | | - function load(game) { |
49 | | - window.RufflePlayer = window.RufflePlayer || {}; |
50 | | - window.addEventListener("load", (event) => { |
51 | | - const ruffle = window.RufflePlayer.newest(); |
52 | | - const player = ruffle.createPlayer(); |
53 | | - const container = document.getElementById("ruffle"); |
54 | | - player.id = "player"; |
55 | | - player.style.width = "100%"; |
56 | | - player.style.height = "100%"; |
57 | | - container.appendChild(player) |
58 | | - player.load(game); |
59 | | - }); |
60 | | - } |
61 | | - </script> |
62 | | -</body> |
63 | | - |
64 | | -</html> |
| 1 | +<html> |
| 2 | + |
| 3 | +<head> |
| 4 | + <meta name="viewport" content="width=device-width, initial-scale=1"> |
| 5 | + <title>Flash Player</title> |
| 6 | + <link id="favicon" rel="shortcut icon" type="image/png" href="/"> |
| 7 | +</head> |
| 8 | + |
| 9 | +<body> |
| 10 | + <div id="ruffle" width="100%" height="100%"></div> |
| 11 | + <script src="ruffle.js"></script> |
| 12 | + <script> |
| 13 | + var defaultGame = (new URLSearchParams(window.location.search)).get('game'); |
| 14 | + if (defaultGame.charAt(defaultGame.length - 1) == '/') |
| 15 | + defaultGame = defaultGame.substring(0, defaultGame.length - 1); |
| 16 | + if (document.getElementsByTagName('base').length > 0 && !window.location.href.includes(document.getElementsByTagName('base')[0].href)) { |
| 17 | + const gameUrl = new URL(document.getElementsByTagName('base')[0].href); |
| 18 | + const gameUrlParams = (new URLSearchParams(gameUrl.search)).get('game'); |
| 19 | + defaultGame = gameUrlParams || defaultGame; |
| 20 | + } |
| 21 | + if (!defaultGame) { |
| 22 | + /*var fileInput = document.createElement('input'); |
| 23 | + fileInput.type = 'file'; |
| 24 | + fileInput.id = 'fileInput'; |
| 25 | + var uploadButton = document.createElement('button'); |
| 26 | + uploadButton.textContent = 'Upload File'; |
| 27 | + uploadButton.addEventListener('click', handleFileUpload); |
| 28 | + // Append elements to the body |
| 29 | + document.body.appendChild(fileInput); |
| 30 | + document.body.appendChild(uploadButton); |
| 31 | +
|
| 32 | + function handleFileUpload() { |
| 33 | + var uploadedFile = fileInput.files[0]; |
| 34 | + if (uploadedFile) { |
| 35 | + // appears to take a url rather than local file |
| 36 | + load(uploadedFile); |
| 37 | + } else { |
| 38 | + alert('Please select a file to upload.'); |
| 39 | + } |
| 40 | + } |
| 41 | + */ |
| 42 | + } else { |
| 43 | + document.title = (defaultGame.replace(/-/g, ' ')).toLowerCase().split(' ').map(function (word) { |
| 44 | + return word[0].toUpperCase() + word.substr(1); |
| 45 | + }).join(' '); |
| 46 | + document.querySelector('#favicon').href = `images/${defaultGame}.png`; |
| 47 | + load(`files/${defaultGame}.swf`); |
| 48 | + } |
| 49 | + |
| 50 | + function load(game) { |
| 51 | + window.RufflePlayer = window.RufflePlayer || {}; |
| 52 | + window.addEventListener("load", (event) => { |
| 53 | + const ruffle = window.RufflePlayer.newest(); |
| 54 | + const player = ruffle.createPlayer(); |
| 55 | + const container = document.getElementById("ruffle"); |
| 56 | + player.id = "player"; |
| 57 | + player.style.width = "100%"; |
| 58 | + player.style.height = "100%"; |
| 59 | + container.appendChild(player) |
| 60 | + player.load(game); |
| 61 | + }); |
| 62 | + } |
| 63 | + </script> |
| 64 | +</body> |
| 65 | + |
| 66 | +</html> |
0 commit comments