Update index.html

This commit is contained in:
Allan Niles 2022-02-23 10:04:46 -07:00 committed by GitHub
parent 958e684943
commit b63ca45924
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,11 +2,14 @@
<head> <head>
<title>Emulatorjs | Select Game Rom</title> <title>Emulatorjs | Select Game Rom</title>
<link rel="icon" type="image/png" href="docs/Emulatorjs Logo.png"> <link rel="icon" type="image/png" href="docs/Emulatorjs Logo.png">
<base href="https://allancoding.github.io/emulatorjs-allancoding/">
</head> </head>
<body> <body>
<style> <style>
body{ body{
background: #c4bdff; background: #c4bdff;
margin: 0;
padding: 0;
} }
.form{ .form{
position: absolute; position: absolute;
@ -37,6 +40,9 @@ body{
} }
.eimg{ .eimg{
width: 250px; width: 250px;
}
#uploadf, #uploadf1{
display: block;
} }
</style> </style>
<script> <script>
@ -48,10 +54,8 @@ width: 250px;
var extension = e.target.files[0].name.split('.').pop() var extension = e.target.files[0].name.split('.').pop()
var gameName = e.target.files[0].name.replaceAll("'", "\\'") var gameName = e.target.files[0].name.replaceAll("'", "\\'")
var gameName = gameName.substr(0, gameName.length - extension.length - 1) var gameName = gameName.substr(0, gameName.length - extension.length - 1)
e.target.remove() e.target.remove();
while(document.body.firstChild) { document.getElementById('uploadf').style.display = "none"; document.getElementById('uploadf1').style.display = "none";
document.body.removeChild(document.body.firstChild);
};
if (['fds', 'nes', 'unif', 'unf'].includes(extension)) { if (['fds', 'nes', 'unif', 'unf'].includes(extension)) {
var core = 'nes'; var core = 'nes';
} else if (['z64'].includes(extension)) { } else if (['z64'].includes(extension)) {
@ -131,13 +135,13 @@ width: 250px;
}(); }();
}; };
var a = document.createElement('div'); var a = document.createElement('div');
a.style = "width:640px;height:480px;max-width:100%"; a.style = "width:60%;height:100%;max-width:100%";
var b = document.createElement('div'); var b = document.createElement('div');
b.id = 'game'; b.id = 'game';
a.appendChild(b); a.appendChild(b);
document.body.appendChild(a); document.getElementById("cont").appendChild(a);
var script = document.createElement('script'); var script = document.createElement('script');
script.innerHTML = "EJS_player = '#game'; EJS_gameName = '" + gameName + "'; EJS_biosUrl = ''; EJS_gameUrl = '" + gameUrl + "'; EJS_core = '" + core + "'; EJS_pathtodata = 'data/'; "; script.innerHTML = "EJS_player = '#game'; EJS_gameName = '" + gameName + "'; EJS_biosUrl = ''; EJS_gameUrl = '" + gameUrl + "'; EJS_core = '" + core + "'; EJS_pathtodata = 'data/';";
document.body.appendChild(script); document.body.appendChild(script);
var script = document.createElement('script'); var script = document.createElement('script');
script.src = 'data/loader.js'; script.src = 'data/loader.js';
@ -145,10 +149,10 @@ width: 250px;
} }
}) })
</script> </script>
<center> <center id="cont">
<img class="eimg" src="docs/Emulatorjs Logo.png"> <img id="uploadf1" class="eimg" src="docs/Emulatorjs Logo.png">
</center> </center>
<div class="form"> <div id="uploadf" class="form">
<input type="file" id="file"> <input type="file" id="file">
<b><p>Select Game Rom: Drag your files here or click in this area.</p></b> <b><p>Select Game Rom: Drag your files here or click in this area.</p></b>
</div> </div>