Update app.js
Browse files
app.js
CHANGED
|
@@ -1313,3 +1313,41 @@ function showAuthSuccess(msg){const el=document.getElementById('auth-error');el.
|
|
| 1313 |
function showToast(msg,color='var(--accent)'){const t=document.createElement('div');t.className='toast';t.style.borderColor=color;t.style.color=color;t.textContent=msg;document.body.appendChild(t);setTimeout(()=>t.remove(),3000);}
|
| 1314 |
|
| 1315 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1313 |
function showToast(msg,color='var(--accent)'){const t=document.createElement('div');t.className='toast';t.style.borderColor=color;t.style.color=color;t.textContent=msg;document.body.appendChild(t);setTimeout(()=>t.remove(),3000);}
|
| 1314 |
|
| 1315 |
|
| 1316 |
+
|
| 1317 |
+
// βββ APP INIT βββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 1318 |
+
window.addEventListener('DOMContentLoaded', async () => {
|
| 1319 |
+
// Auth-Screen anzeigen, App & Banned-Screen verstecken
|
| 1320 |
+
document.getElementById('auth-screen').style.display = 'flex';
|
| 1321 |
+
document.getElementById('app').classList.remove('visible');
|
| 1322 |
+
document.getElementById('banned-screen').style.display = 'none';
|
| 1323 |
+
|
| 1324 |
+
// Loading-Overlay anzeigen
|
| 1325 |
+
const loadEl = document.createElement('div');
|
| 1326 |
+
loadEl.id = 'init-loading';
|
| 1327 |
+
loadEl.style.cssText = 'position:fixed;inset:0;background:var(--bg,#0a0e14);display:flex;align-items:center;justify-content:center;z-index:99999;flex-direction:column;gap:12px;font-family:Orbitron,monospace;';
|
| 1328 |
+
loadEl.innerHTML = '<div style="font-size:1.4rem;color:#00d4ff;letter-spacing:.2em">NoahsChat</div><div style="font-size:.7rem;color:#4a5568;letter-spacing:.15em">VERBINDE...</div>';
|
| 1329 |
+
document.body.appendChild(loadEl);
|
| 1330 |
+
|
| 1331 |
+
// DB laden
|
| 1332 |
+
await apiLoad();
|
| 1333 |
+
|
| 1334 |
+
// Owner-Account anlegen falls noch nicht vorhanden
|
| 1335 |
+
if (!DB.users[OWNER_NAME.toLowerCase()]) {
|
| 1336 |
+
DB.users[OWNER_NAME.toLowerCase()] = {
|
| 1337 |
+
username: OWNER_NAME,
|
| 1338 |
+
password: encode(OWNER_PASS),
|
| 1339 |
+
color: 0,
|
| 1340 |
+
role: 'owner',
|
| 1341 |
+
joined: Date.now(),
|
| 1342 |
+
settings: { lang: 'de', translate: false, notif: true }
|
| 1343 |
+
};
|
| 1344 |
+
apiSave();
|
| 1345 |
+
}
|
| 1346 |
+
|
| 1347 |
+
// Loading entfernen
|
| 1348 |
+
loadEl.remove();
|
| 1349 |
+
|
| 1350 |
+
// Captchas initialisieren
|
| 1351 |
+
refreshCaptcha('login');
|
| 1352 |
+
refreshCaptcha('reg');
|
| 1353 |
+
});
|