mirror of
https://github.com/EmulatorJS/EmulatorJS.git
synced 2024-09-21 03:16:29 +00:00
43 lines
1.1 KiB
HTML
43 lines
1.1 KiB
HTML
<html>
|
|
<body>
|
|
<div id='app'>
|
|
<ul>
|
|
<br><br>
|
|
<input type='file' onchange='decryptButton()' id='file'><br><br><br>
|
|
</ul>
|
|
</div>
|
|
|
|
<script>
|
|
|
|
function decryptButton() {
|
|
var finished = function() {
|
|
window.stopped = true
|
|
var a = document.createElement('a')
|
|
a.href = URL.createObjectURL(new Blob([window.body]))
|
|
a.download = 'emulator.js'
|
|
a.click()
|
|
}
|
|
window.finished = finished
|
|
var file = document.getElementById('file').files[0]
|
|
document.getElementById('file').remove()
|
|
var reader = new FileReader()
|
|
reader.onload = async function(e) {
|
|
window.body = e.target.result
|
|
var a = body.split("['")
|
|
for (var i=1; i<a.length; i++) {
|
|
var error = false
|
|
a[i] = a[i].split("']")[0]
|
|
if (a[i].split('\\x').length != 1 || a[i].split('\\u').length != 1 || a[i].split("'").length != 1 || a[i].split('"').length != 1) {
|
|
var error = true
|
|
}
|
|
if (! error) {
|
|
window.body = body.replaceAll("['"+a[i]+"']", '.' + a[i].replaceAll("'", "\\'").replaceAll('"', '\\"').replaceAll('\\', '\\\\'))
|
|
}
|
|
}
|
|
finished()
|
|
}
|
|
reader.readAsText(file)
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|