Spaces:
Running
Running
Update index.html
Browse files- index.html +114 -44
index.html
CHANGED
|
@@ -4,9 +4,7 @@
|
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
<title>Phone OS - Hero Edition</title>
|
| 7 |
-
<!-- Link to your style.css -->
|
| 8 |
<link rel="stylesheet" href="style.css">
|
| 9 |
-
<!-- FontAwesome for Icons -->
|
| 10 |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
| 11 |
</head>
|
| 12 |
<body>
|
|
@@ -53,10 +51,11 @@
|
|
| 53 |
</div>
|
| 54 |
</div>
|
| 55 |
|
| 56 |
-
<!-- === IMAGE VIEWER MODAL
|
| 57 |
<div id="image-viewer" class="image-modal">
|
| 58 |
<div class="close-modal" onclick="closeImageViewer()"><i class="fas fa-times"></i></div>
|
| 59 |
<img id="full-image" src="" alt="Full View">
|
|
|
|
| 60 |
</div>
|
| 61 |
|
| 62 |
<!-- === APPS === -->
|
|
@@ -79,17 +78,21 @@
|
|
| 79 |
</div>
|
| 80 |
</div>
|
| 81 |
|
| 82 |
-
<!-- GALLERY -->
|
| 83 |
<div id="app-gallery" class="app-window">
|
| 84 |
<div class="app-header">
|
| 85 |
<i class="fas fa-chevron-left back-btn" onclick="closeAllApps()"></i>
|
| 86 |
<span class="app-title">Gallery</span>
|
|
|
|
|
|
|
| 87 |
</div>
|
| 88 |
<div class="app-content">
|
| 89 |
<div class="gallery-grid" id="gallery-container">
|
| 90 |
<!-- Images injected via JS -->
|
| 91 |
</div>
|
| 92 |
</div>
|
|
|
|
|
|
|
| 93 |
</div>
|
| 94 |
|
| 95 |
<!-- FILES -->
|
|
@@ -125,6 +128,7 @@
|
|
| 125 |
<div class="setting-row"><span>Wi-Fi</span><div class="toggle active"></div></div>
|
| 126 |
<div class="setting-row"><span>One For All</span><div class="toggle active"></div></div>
|
| 127 |
<div class="setting-row"><span>Notifications</span><div class="toggle"></div></div>
|
|
|
|
| 128 |
</div>
|
| 129 |
</div>
|
| 130 |
|
|
@@ -144,7 +148,7 @@
|
|
| 144 |
</div>
|
| 145 |
|
| 146 |
<script>
|
| 147 |
-
|
| 148 |
function updateClock() {
|
| 149 |
const now = new Date();
|
| 150 |
const hours = String(now.getHours()).padStart(2, '0');
|
|
@@ -154,16 +158,12 @@
|
|
| 154 |
setInterval(updateClock, 1000);
|
| 155 |
updateClock();
|
| 156 |
|
| 157 |
-
// 2. Navigation Logic
|
| 158 |
function openApp(appName) {
|
| 159 |
closeAllApps();
|
| 160 |
const app = document.getElementById(`app-${appName}`);
|
| 161 |
-
if (app)
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
if (appName === 'terminal') {
|
| 165 |
-
runCppSimulation();
|
| 166 |
-
}
|
| 167 |
}
|
| 168 |
|
| 169 |
function closeAllApps() {
|
|
@@ -172,11 +172,107 @@
|
|
| 172 |
closeImageViewer();
|
| 173 |
}
|
| 174 |
|
| 175 |
-
|
| 176 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 177 |
const modal = document.getElementById('image-viewer');
|
| 178 |
const img = document.getElementById('full-image');
|
|
|
|
| 179 |
img.src = src;
|
|
|
|
| 180 |
modal.classList.add('active');
|
| 181 |
}
|
| 182 |
|
|
@@ -184,38 +280,10 @@
|
|
| 184 |
document.getElementById('image-viewer').classList.remove('active');
|
| 185 |
}
|
| 186 |
|
| 187 |
-
|
| 188 |
-
const galleryContainer = document.getElementById('gallery-container');
|
| 189 |
-
|
| 190 |
-
const animeImages = [
|
| 191 |
-
// 1. Deku (UPDATED)
|
| 192 |
-
'https://zippyshare.c505c4ada4c6e4e79e0c43ae377c115c.r2.cloudflarestorage.com/users/7RMKGJwkwm1oP/upngQl8xGxoX23E_1764351993.jpeg?response-content-disposition=attachment%3B%20filename%3D%22IMG_6588.jpeg%22&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=aeed1e70264ea81f25dbe24821aae76e%2F20251128%2Fapac%2Fs3%2Faws4_request&X-Amz-Date=20251128T190811Z&X-Amz-SignedHeaders=host&X-Amz-Expires=3600&X-Amz-Signature=1a43e069fa66c1712ee04bd515d741dab0a652254cbe652fcd8b267a62e2c234',
|
| 193 |
-
// 2. Bakugo (UPDATED)
|
| 194 |
-
'https://zippyshare.c505c4ada4c6e4e79e0c43ae377c115c.r2.cloudflarestorage.com/users/7RMKGJwkwm1oP/NF3kWJlONBmeNmT_1764357029.jpeg?response-content-disposition=attachment%3B%20filename%3D%22IMG_6587.jpeg%22&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=aeed1e70264ea81f25dbe24821aae76e%2F20251128%2Fapac%2Fs3%2Faws4_request&X-Amz-Date=20251128T191052Z&X-Amz-SignedHeaders=host&X-Amz-Expires=3600&X-Amz-Signature=6950d847664cbd1ac0681e56aaed71e5ebb2ba84b56dc7d23f798c950bf3b009',
|
| 195 |
-
// 3. Lemillion
|
| 196 |
-
'https://zippyshare.c505c4ada4c6e4e79e0c43ae377c115c.r2.cloudflarestorage.com/anonymous/24hVBYnR0sej5YO_1764352426.jpeg?response-content-disposition=attachment%3B%20filename%3D%22IMG_6589.jpeg%22&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=aeed1e70264ea81f25dbe24821aae76e%2F20251128%2Fapac%2Fs3%2Faws4_request&X-Amz-Date=20251128T175357Z&X-Amz-SignedHeaders=host&X-Amz-Expires=3600&X-Amz-Signature=ea6c28b4ce1b8aaa133028520a58ba227181619a67eb31fef8b2f4b0fb393d94',
|
| 197 |
-
// 4. Endeavor
|
| 198 |
-
'https://zippyshare.c505c4ada4c6e4e79e0c43ae377c115c.r2.cloudflarestorage.com/anonymous/YU0KZoE6AJAh7Cr_1764352615.jpeg?response-content-disposition=attachment%3B%20filename%3D%22IMG_6591.jpeg%22&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=aeed1e70264ea81f25dbe24821aae76e%2F20251128%2Fapac%2Fs3%2Faws4_request&X-Amz-Date=20251128T175708Z&X-Amz-SignedHeaders=host&X-Amz-Expires=3600&X-Amz-Signature=25de618665bcf322783abd21c80e0e5ce4d110ff2bd8fe3a283175ddafa229eb',
|
| 199 |
-
// 5. Aizawa
|
| 200 |
-
'https://zippyshare.c505c4ada4c6e4e79e0c43ae377c115c.r2.cloudflarestorage.com/users/7RMKGJwkwm1oP/y9t8U09Eay1TR5q_1764352783.jpeg?response-content-disposition=attachment%3B%20filename%3D%22IMG_6593.jpeg%22&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=aeed1e70264ea81f25dbe24821aae76e%2F20251128%2Fapac%2Fs3%2Faws4_request&X-Amz-Date=20251128T175954Z&X-Amz-SignedHeaders=host&X-Amz-Expires=3600&X-Amz-Signature=f762d0f7c4e9101f60def05f199e57faf827419e5e2e3271dc9cd3c426e54c13',
|
| 201 |
-
// 6. Star and Stripes
|
| 202 |
-
'https://zippyshare.c505c4ada4c6e4e79e0c43ae377c115c.r2.cloudflarestorage.com/users/7RMKGJwkwm1oP/iq41Z54egsDcuRy_1764352905.jpeg?response-content-disposition=attachment%3B%20filename%3D%22IMG_6229.jpeg%22&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=aeed1e70264ea81f25dbe24821aae76e%2F20251128%2Fapac%2Fs3%2Faws4_request&X-Amz-Date=20251128T180200Z&X-Amz-SignedHeaders=host&X-Amz-Expires=3600&X-Amz-Signature=c161b9af91c01714475774139de440e466fd4954e871d2e92fef7b2733fe7f36'
|
| 203 |
-
];
|
| 204 |
-
|
| 205 |
-
animeImages.forEach(url => {
|
| 206 |
-
const div = document.createElement('div');
|
| 207 |
-
div.className = 'gallery-item';
|
| 208 |
-
// We use quotes inside url() because these links contain complex characters
|
| 209 |
-
div.style.backgroundImage = `url('${url}')`;
|
| 210 |
-
div.onclick = () => openImageViewer(url);
|
| 211 |
-
galleryContainer.appendChild(div);
|
| 212 |
-
});
|
| 213 |
-
|
| 214 |
-
// 5. C++ Simulation
|
| 215 |
function runCppSimulation() {
|
| 216 |
const terminal = document.getElementById('terminal-content');
|
| 217 |
terminal.innerHTML = "";
|
| 218 |
-
|
| 219 |
const cppCode = `
|
| 220 |
#include <iostream>
|
| 221 |
using namespace std;
|
|
@@ -235,7 +303,6 @@ int main() {
|
|
| 235 |
return 0;
|
| 236 |
}
|
| 237 |
`;
|
| 238 |
-
|
| 239 |
let i = 0;
|
| 240 |
const typeWriter = () => {
|
| 241 |
if (i < cppCode.length) {
|
|
@@ -246,6 +313,9 @@ int main() {
|
|
| 246 |
};
|
| 247 |
typeWriter();
|
| 248 |
}
|
|
|
|
|
|
|
|
|
|
| 249 |
</script>
|
| 250 |
</body>
|
| 251 |
</html>
|
|
|
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
<title>Phone OS - Hero Edition</title>
|
|
|
|
| 7 |
<link rel="stylesheet" href="style.css">
|
|
|
|
| 8 |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
| 9 |
</head>
|
| 10 |
<body>
|
|
|
|
| 51 |
</div>
|
| 52 |
</div>
|
| 53 |
|
| 54 |
+
<!-- === IMAGE VIEWER MODAL === -->
|
| 55 |
<div id="image-viewer" class="image-modal">
|
| 56 |
<div class="close-modal" onclick="closeImageViewer()"><i class="fas fa-times"></i></div>
|
| 57 |
<img id="full-image" src="" alt="Full View">
|
| 58 |
+
<div id="image-caption" style="position:absolute; bottom:30px; color:white; background:rgba(0,0,0,0.5); padding:5px 10px; border-radius:10px;"></div>
|
| 59 |
</div>
|
| 60 |
|
| 61 |
<!-- === APPS === -->
|
|
|
|
| 78 |
</div>
|
| 79 |
</div>
|
| 80 |
|
| 81 |
+
<!-- GALLERY APP (UPDATED WITH UPLOAD) -->
|
| 82 |
<div id="app-gallery" class="app-window">
|
| 83 |
<div class="app-header">
|
| 84 |
<i class="fas fa-chevron-left back-btn" onclick="closeAllApps()"></i>
|
| 85 |
<span class="app-title">Gallery</span>
|
| 86 |
+
<!-- UPLOAD BUTTON -->
|
| 87 |
+
<i class="fas fa-plus" onclick="triggerUpload()" style="color:#007AFF; cursor:pointer; font-size:20px;"></i>
|
| 88 |
</div>
|
| 89 |
<div class="app-content">
|
| 90 |
<div class="gallery-grid" id="gallery-container">
|
| 91 |
<!-- Images injected via JS -->
|
| 92 |
</div>
|
| 93 |
</div>
|
| 94 |
+
<!-- Hidden File Input -->
|
| 95 |
+
<input type="file" id="file-upload" accept="image/*" style="display:none" onchange="handleFileUpload(event)">
|
| 96 |
</div>
|
| 97 |
|
| 98 |
<!-- FILES -->
|
|
|
|
| 128 |
<div class="setting-row"><span>Wi-Fi</span><div class="toggle active"></div></div>
|
| 129 |
<div class="setting-row"><span>One For All</span><div class="toggle active"></div></div>
|
| 130 |
<div class="setting-row"><span>Notifications</span><div class="toggle"></div></div>
|
| 131 |
+
<div class="setting-row" onclick="clearLocalData()" style="color:#ff3b30; cursor:pointer; justify-content:center;">Reset Gallery Data</div>
|
| 132 |
</div>
|
| 133 |
</div>
|
| 134 |
|
|
|
|
| 148 |
</div>
|
| 149 |
|
| 150 |
<script>
|
| 151 |
+
/* --- 1. SYSTEM LOGIC --- */
|
| 152 |
function updateClock() {
|
| 153 |
const now = new Date();
|
| 154 |
const hours = String(now.getHours()).padStart(2, '0');
|
|
|
|
| 158 |
setInterval(updateClock, 1000);
|
| 159 |
updateClock();
|
| 160 |
|
|
|
|
| 161 |
function openApp(appName) {
|
| 162 |
closeAllApps();
|
| 163 |
const app = document.getElementById(`app-${appName}`);
|
| 164 |
+
if (app) app.classList.add('open');
|
| 165 |
+
if (appName === 'terminal') runCppSimulation();
|
| 166 |
+
if (appName === 'gallery') renderGallery(); // Refresh gallery on open
|
|
|
|
|
|
|
|
|
|
| 167 |
}
|
| 168 |
|
| 169 |
function closeAllApps() {
|
|
|
|
| 172 |
closeImageViewer();
|
| 173 |
}
|
| 174 |
|
| 175 |
+
/* --- 2. GALLERY & UPLOAD LOGIC --- */
|
| 176 |
+
|
| 177 |
+
// Initial Data (The Provided Links)
|
| 178 |
+
const defaultCharacters = [
|
| 179 |
+
{ name: "Deku", url: "https://zippyshare.c505c4ada4c6e4e79e0c43ae377c115c.r2.cloudflarestorage.com/users/7RMKGJwkwm1oP/upngQl8xGxoX23E_1764351993.jpeg?response-content-disposition=attachment%3B%20filename%3D%22IMG_6588.jpeg%22&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=aeed1e70264ea81f25dbe24821aae76e%2F20251128%2Fapac%2Fs3%2Faws4_request&X-Amz-Date=20251128T190811Z&X-Amz-SignedHeaders=host&X-Amz-Expires=3600&X-Amz-Signature=1a43e069fa66c1712ee04bd515d741dab0a652254cbe652fcd8b267a62e2c234" },
|
| 180 |
+
{ name: "Bakugo", url: "https://zippyshare.c505c4ada4c6e4e79e0c43ae377c115c.r2.cloudflarestorage.com/users/7RMKGJwkwm1oP/NF3kWJlONBmeNmT_1764357029.jpeg?response-content-disposition=attachment%3B%20filename%3D%22IMG_6587.jpeg%22&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=aeed1e70264ea81f25dbe24821aae76e%2F20251128%2Fapac%2Fs3%2Faws4_request&X-Amz-Date=20251128T191052Z&X-Amz-SignedHeaders=host&X-Amz-Expires=3600&X-Amz-Signature=6950d847664cbd1ac0681e56aaed71e5ebb2ba84b56dc7d23f798c950bf3b009" },
|
| 181 |
+
{ name: "Lemillion", url: "https://zippyshare.c505c4ada4c6e4e79e0c43ae377c115c.r2.cloudflarestorage.com/anonymous/24hVBYnR0sej5YO_1764352426.jpeg?response-content-disposition=attachment%3B%20filename%3D%22IMG_6589.jpeg%22&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=aeed1e70264ea81f25dbe24821aae76e%2F20251128%2Fapac%2Fs3%2Faws4_request&X-Amz-Date=20251128T175357Z&X-Amz-SignedHeaders=host&X-Amz-Expires=3600&X-Amz-Signature=ea6c28b4ce1b8aaa133028520a58ba227181619a67eb31fef8b2f4b0fb393d94" },
|
| 182 |
+
{ name: "Endeavor", url: "https://zippyshare.c505c4ada4c6e4e79e0c43ae377c115c.r2.cloudflarestorage.com/anonymous/YU0KZoE6AJAh7Cr_1764352615.jpeg?response-content-disposition=attachment%3B%20filename%3D%22IMG_6591.jpeg%22&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=aeed1e70264ea81f25dbe24821aae76e%2F20251128%2Fapac%2Fs3%2Faws4_request&X-Amz-Date=20251128T175708Z&X-Amz-SignedHeaders=host&X-Amz-Expires=3600&X-Amz-Signature=25de618665bcf322783abd21c80e0e5ce4d110ff2bd8fe3a283175ddafa229eb" },
|
| 183 |
+
{ name: "Aizawa", url: "https://zippyshare.c505c4ada4c6e4e79e0c43ae377c115c.r2.cloudflarestorage.com/users/7RMKGJwkwm1oP/y9t8U09Eay1TR5q_1764352783.jpeg?response-content-disposition=attachment%3B%20filename%3D%22IMG_6593.jpeg%22&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=aeed1e70264ea81f25dbe24821aae76e%2F20251128%2Fapac%2Fs3%2Faws4_request&X-Amz-Date=20251128T175954Z&X-Amz-SignedHeaders=host&X-Amz-Expires=3600&X-Amz-Signature=f762d0f7c4e9101f60def05f199e57faf827419e5e2e3271dc9cd3c426e54c13" },
|
| 184 |
+
{ name: "Star and Stripes", url: "https://zippyshare.c505c4ada4c6e4e79e0c43ae377c115c.r2.cloudflarestorage.com/users/7RMKGJwkwm1oP/iq41Z54egsDcuRy_1764352905.jpeg?response-content-disposition=attachment%3B%20filename%3D%22IMG_6229.jpeg%22&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=aeed1e70264ea81f25dbe24821aae76e%2F20251128%2Fapac%2Fs3%2Faws4_request&X-Amz-Date=20251128T180200Z&X-Amz-SignedHeaders=host&X-Amz-Expires=3600&X-Amz-Signature=c161b9af91c01714475774139de440e466fd4954e871d2e92fef7b2733fe7f36" }
|
| 185 |
+
];
|
| 186 |
+
|
| 187 |
+
// 1. RENDER FUNCTION
|
| 188 |
+
function renderGallery() {
|
| 189 |
+
const container = document.getElementById('gallery-container');
|
| 190 |
+
container.innerHTML = ''; // Clear
|
| 191 |
+
|
| 192 |
+
// Merge default data with LocalStorage data
|
| 193 |
+
const savedData = JSON.parse(localStorage.getItem('heroGallery')) || {};
|
| 194 |
+
|
| 195 |
+
// Create a working list based on defaults
|
| 196 |
+
let displayList = [...defaultCharacters];
|
| 197 |
+
|
| 198 |
+
// Check if user has uploaded a custom override for any character
|
| 199 |
+
displayList = displayList.map(char => {
|
| 200 |
+
if (savedData[char.name]) {
|
| 201 |
+
return { name: char.name, url: savedData[char.name] }; // Use uploaded image
|
| 202 |
+
}
|
| 203 |
+
return char;
|
| 204 |
+
});
|
| 205 |
+
|
| 206 |
+
// Add any NEW characters the user uploaded (that weren't in defaults)
|
| 207 |
+
Object.keys(savedData).forEach(key => {
|
| 208 |
+
// If this key is NOT in the default list, add it
|
| 209 |
+
if (!displayList.find(c => c.name === key)) {
|
| 210 |
+
displayList.push({ name: key, url: savedData[key] });
|
| 211 |
+
}
|
| 212 |
+
});
|
| 213 |
+
|
| 214 |
+
// Draw to screen
|
| 215 |
+
displayList.forEach(item => {
|
| 216 |
+
const div = document.createElement('div');
|
| 217 |
+
div.className = 'gallery-item';
|
| 218 |
+
div.style.backgroundImage = `url('${item.url}')`;
|
| 219 |
+
div.onclick = () => openImageViewer(item.url, item.name);
|
| 220 |
+
|
| 221 |
+
// Optional: Add name label
|
| 222 |
+
/*
|
| 223 |
+
const label = document.createElement('div');
|
| 224 |
+
label.innerText = item.name;
|
| 225 |
+
label.style.cssText = "position:absolute; bottom:0; left:0; right:0; background:rgba(0,0,0,0.7); color:white; font-size:9px; padding:2px; text-align:center;";
|
| 226 |
+
div.appendChild(label);
|
| 227 |
+
*/
|
| 228 |
+
|
| 229 |
+
container.appendChild(div);
|
| 230 |
+
});
|
| 231 |
+
}
|
| 232 |
+
|
| 233 |
+
// 2. UPLOAD HANDLER
|
| 234 |
+
function triggerUpload() {
|
| 235 |
+
document.getElementById('file-upload').click();
|
| 236 |
+
}
|
| 237 |
+
|
| 238 |
+
function handleFileUpload(event) {
|
| 239 |
+
const file = event.target.files[0];
|
| 240 |
+
if (!file) return;
|
| 241 |
+
|
| 242 |
+
// Ask for Name Mapping
|
| 243 |
+
const charName = prompt("Who is this character? (e.g., 'Aizawa', 'Deku')");
|
| 244 |
+
if (!charName) return;
|
| 245 |
+
|
| 246 |
+
const reader = new FileReader();
|
| 247 |
+
reader.onload = function(e) {
|
| 248 |
+
const base64Image = e.target.result;
|
| 249 |
+
|
| 250 |
+
// Save to Local Storage (Key = Name, Value = Base64 Data)
|
| 251 |
+
const savedData = JSON.parse(localStorage.getItem('heroGallery')) || {};
|
| 252 |
+
savedData[charName] = base64Image;
|
| 253 |
+
localStorage.setItem('heroGallery', JSON.stringify(savedData));
|
| 254 |
+
|
| 255 |
+
// Re-render
|
| 256 |
+
renderGallery();
|
| 257 |
+
alert(`Updated image for: ${charName}`);
|
| 258 |
+
};
|
| 259 |
+
reader.readAsDataURL(file);
|
| 260 |
+
}
|
| 261 |
+
|
| 262 |
+
function clearLocalData() {
|
| 263 |
+
if(confirm("Reset all uploaded gallery photos?")) {
|
| 264 |
+
localStorage.removeItem('heroGallery');
|
| 265 |
+
renderGallery();
|
| 266 |
+
}
|
| 267 |
+
}
|
| 268 |
+
|
| 269 |
+
// 3. VIEWER
|
| 270 |
+
function openImageViewer(src, caption) {
|
| 271 |
const modal = document.getElementById('image-viewer');
|
| 272 |
const img = document.getElementById('full-image');
|
| 273 |
+
const cap = document.getElementById('image-caption');
|
| 274 |
img.src = src;
|
| 275 |
+
cap.innerText = caption || "";
|
| 276 |
modal.classList.add('active');
|
| 277 |
}
|
| 278 |
|
|
|
|
| 280 |
document.getElementById('image-viewer').classList.remove('active');
|
| 281 |
}
|
| 282 |
|
| 283 |
+
/* --- 3. C++ SIMULATION --- */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 284 |
function runCppSimulation() {
|
| 285 |
const terminal = document.getElementById('terminal-content');
|
| 286 |
terminal.innerHTML = "";
|
|
|
|
| 287 |
const cppCode = `
|
| 288 |
#include <iostream>
|
| 289 |
using namespace std;
|
|
|
|
| 303 |
return 0;
|
| 304 |
}
|
| 305 |
`;
|
|
|
|
| 306 |
let i = 0;
|
| 307 |
const typeWriter = () => {
|
| 308 |
if (i < cppCode.length) {
|
|
|
|
| 313 |
};
|
| 314 |
typeWriter();
|
| 315 |
}
|
| 316 |
+
|
| 317 |
+
// Initialize Gallery on Load
|
| 318 |
+
renderGallery();
|
| 319 |
</script>
|
| 320 |
</body>
|
| 321 |
</html>
|