ayunWebEPK/decompile.html

120 lines
3.4 KiB
HTML
Raw Permalink Normal View History

<!DOCTYPE html>
<html>
<head>
<script async src="https://arc.io/widget.min.js#HEPCFa3K"></script>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>ayunWebEPK</title>
<script type="text/javascript" src="jszip.min.js"></script>
<script type="text/javascript" src="pako_inflate.min.js"></script>
<script type="text/javascript" src="ayunEPKDecompiler.js"></script>
<link rel="preconnect" href="https://fonts.googleapis.com"/>
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin/>
<link href="https://fonts.googleapis.com/css2?family=Nunito&display=swap" rel="stylesheet"/>
<style>
a:not([href]) {
display: none;
}
*, ::file-selector-button {
font-family: 'Nunito', sans-serif;
}
body {
background-color: #111111;
color: #dddddd;
}
input[disabled] {
opacity: 0.8;
}
::file-selector-button, progress {
background-color: #343434;
color: #eeeeee;
border: 1px solid #eeeeee;
border-radius: 4px;
}
a, input[type=file] {
color: #dddddd;
}
progress {
height: 1em;
}
progress, ::-webkit-file-upload-button {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
}
progress[value="0"][max="1"] {
display: none;
}
::-moz-progress-bar {
background-color: #eeeeee;
}
::-webkit-progress-value {
background-color: #eeeeee;
}
::-webkit-progress-bar {
background-color: #343434;
border-radius: 4px;
}
</style>
</head>
<body>
2022-10-02 17:12:49 -07:00
<sub><a href=".">Want to compile one instead?</a></sub>
2022-10-08 13:04:11 -07:00
<br/>
<sub><a href="builder.html">Want to create one instead?</a></sub>
<h1>ayunWebEPK</h1>
<p>Decompile EPK files in your browser!</p>
Select .EPK file: <input type="file" onchange="selectFile(this);" accept=".epk"/>
<br/>
<progress value="0" max="1"></progress>
<a download="my-cool.zip">Download as a ZIP!</a>
<script>
2022-10-08 13:04:11 -07:00
const downloadLink = document.querySelectorAll('a')[2];
const progressBar = document.querySelector('progress');
function selectFile(fileElem) {
downloadLink.removeAttribute('href');
fileElem.disabled = true;
if (fileElem.files.length > 0) {
const epkFile = fileElem.files[0];
const reader = new FileReader();
reader.onload = function(e) {
2022-10-08 13:04:11 -07:00
progressBar.value = 0;
progressBar.max = 1;
window.decompileEPK()(e.target.result, function() {
progressBar.max++;
progressBar.value++;
}).then(function(fileList) {
if (fileList == null) {
2022-10-08 13:04:11 -07:00
alert('Invalid EPK!');
fileElem.value = '';
progressBar.value = 0;
progressBar.max = 1;
fileElem.removeAttribute('disabled');
return;
}
const zip = new JSZip();
progressBar.max = fileList.length;
2022-10-08 13:04:11 -07:00
progressBar.value = 0;
for (const file of fileList) {
progressBar.value++;
if (file.type != 'FILE') continue;
2022-10-02 18:41:04 -07:00
zip.file(file.name, file.data);
}
zip.generateAsync({type: 'blob'}).then(function(content) {
downloadLink.href = window.URL.createObjectURL(content);
fileElem.value = '';
progressBar.value = 0;
progressBar.max = 1;
2022-10-08 13:04:11 -07:00
fileElem.removeAttribute('disabled');
});
});
};
reader.readAsArrayBuffer(epkFile);
} else {
fileElem.removeAttribute('disabled');
}
}
</script>
</body>
</html>