-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrecover-from-infinitygamer.html
51 lines (45 loc) · 1.95 KB
/
recover-from-infinitygamer.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="assets/styles/css/global.min.css">
<script defer src="https://cloud.umami.is/script.js" data-website-id="52bfea34-46bb-49d1-976f-a5252508ddef"></script>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>RECOVERY FROM INFINITYGAMER</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/tf7software/Font-Awesome-pro-cdn@main/css/all.css">
</head>
<body>
<div id="particles-js"></div>
<script src="/particles.min.js"></script>
<input type="file" id="fileInput">
<p id="confirmation"></p>
<p>Due to the move, some game saves may be lost unfortunately. Sorry for any inconvenience.</p>
<script>
const fileInput = document.getElementById("fileInput");
fileInput.addEventListener("change", () => {
if (fileInput.files.length > 0) {
const file = fileInput.files[0];
const reader = new FileReader();
reader.onload = (event) => {
try {
const data = JSON.parse(event.target.result);
for (const key in data) {
localStorage.setItem(key, data[key]);
}
document.getElementById("confirmation").textContent = "Saved!";
} catch (e) {
console.error("Error parsing JSON:", e);
document.getElementById("confirmation").textContent = "Invalid JSON format!";
}
};
reader.onerror = (event) => {
console.error("File could not be read: " + event.target.error.code);
};
reader.readAsText(file); // Read the file as text
} else {
console.log("File input cleared");
}
});
</script>
</body>
</html>