sif1_patch/index.html
2024-12-31 11:20:24 +08:00

84 lines
3.9 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<script src="jszip.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.0.0/crypto-js.min.js"></script>
<script src="loader.js"></script>
</head>
<body>
<h3>SIF1服务器修补程序</h3>
<br>
<fieldset>
服务器 URL<input id="serverurl" type="text" value="https://sif.zhushenwudi.top" autocomplete="off"><br><br>
<input type="radio" id="apk" name="format" value="apk" onchange="clickstuff(event)" checked><label for="apk">Android</label>
<input type="radio" id="ipa" name="format" value="ipa" onchange="clickstuff(event)"><label for="ipa">iOS</label>
<div id="patches">
<div id="patches-android"></div>
<div id="patches-ios"></div>
</div>
</fieldset>
<br><br><br>
<button onclick="load(event)">开始修补</button>
<script>
function clickstuff(e) {
if (document.getElementById("apk").checked) {
document.getElementById("patches-android").style.display = "";
document.getElementById("patches-ios").style.display = "none";
} else {
document.getElementById("patches-android").style.display = "none";
document.getElementById("patches-ios").style.display = "";
}
}
let patches;
function load(e) {
let android = document.getElementById("apk").checked;
e.target.remove();
console.log("Patch start");
for (let i=0; i<patches.length; i++) {
let patch = patches[i];
if (android) {
patches[i].checked = patch.android ? document.getElementById(patch.id + "-android").checked : false;
} else {
patches[i].checked = patch.ios ? document.getElementById(patch.id + "-ios").checked : false;
}
}
init_honoka(android, document.getElementById("serverurl").value, patches);
}
(async () => {
patches = JSON.parse(await (await fetch("patches.json")).text());
patches.forEach(patch => {
let input = document.createElement("input");
input.type = "checkbox";
input.checked = patch.checked;
let label = document.createElement("label");
label.innerText = patch.description;
if (patch.android) {
let id = patch.id + "-android";
input.id = id;
input.value = id;
label.for = id;
document.getElementById("patches-android").appendChild(document.createElement("br"));
document.getElementById("patches-android").appendChild(input);
document.getElementById("patches-android").appendChild(label);
}
if (patch.ios) {
let id = patch.id + "-ios";
input.id = id;
input.value = id;
label.for = id;
document.getElementById("patches-ios").appendChild(document.createElement("br"));
document.getElementById("patches-ios").appendChild(input);
document.getElementById("patches-ios").appendChild(label);
}
})
})();
addEventListener("DOMContentLoaded", clickstuff);
</script>
<p id="status"></p>
</body>
</html>