diff --git a/index.html b/index.html
index 1de8749..da80586 100644
--- a/index.html
+++ b/index.html
@@ -405,27 +405,47 @@
}
tick(); setInterval(tick, 1000);
- // ── Notes ──────────────────────────────────────────────────────────────
- const NOTES_KEY = 'dashboard_notes';
+ // ── Notes — server-backed so they sync across all devices ─────────────
+ const API = '/notes.php';
+ let _notes = [];
- function loadNotes() {
- return JSON.parse(localStorage.getItem(NOTES_KEY) || '[]');
+ function escHtml(s) {
+ return String(s).replace(/&/g,'&').replace(//g,'>').replace(/\n/g,'
');
}
- function saveNotes(notes) {
- localStorage.setItem(NOTES_KEY, JSON.stringify(notes));
+
+ async function notesApi(action, body = {}) {
+ try {
+ const r = await fetch(API, {
+ method: 'POST',
+ headers: { 'Content-Type': 'application/json' },
+ body: JSON.stringify({ action, ...body }),
+ credentials: 'same-origin',
+ });
+ return await r.json();
+ } catch (e) { return { ok: false }; }
+ }
+
+ async function fetchNotes() {
+ const el = document.getElementById('notes-list');
+ if (el && !_notes.length) el.innerHTML = '