-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsettings.html
More file actions
412 lines (374 loc) · 15.1 KB
/
Copy pathsettings.html
File metadata and controls
412 lines (374 loc) · 15.1 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Settings — Map of Knowledge</title>
<link rel="stylesheet" href="css/style.css">
<style>
/* ── page ── */
body {
background: linear-gradient(160deg, #F5EAE3 0%, #EDE6F0 55%, #E4EBF5 100%);
overflow: auto;
min-height: 100vh;
}
.settings-page {
max-width: 520px;
margin: 0 auto;
padding: 72px 20px 60px;
}
/* ── page header ── */
.settings-title {
font-size: 22px; font-weight: 720;
color: #2C2820; letter-spacing: -0.4px;
margin-bottom: 28px;
}
/* ── section ── */
.settings-section {
margin-bottom: 28px;
}
.settings-section-label {
font-size: 10px; font-weight: 700; letter-spacing: 0.9px;
text-transform: uppercase; color: #B0A496;
margin-bottom: 8px;
padding: 0 4px;
}
/* ── row card ── */
.settings-row {
background: rgba(255,255,255,0.65);
border: 1px solid rgba(58,48,40,0.08);
border-radius: 14px;
padding: 16px 18px;
display: flex; align-items: center; justify-content: space-between;
gap: 16px;
box-shadow: 0 2px 10px rgba(58,48,40,0.05);
}
.settings-row + .settings-row { margin-top: 6px; }
.settings-row-text { flex: 1; }
.settings-row-label {
font-size: 13px; font-weight: 600; color: #2C2820;
margin-bottom: 3px;
}
.settings-row-desc {
font-size: 12px; color: #8A7E72; line-height: 1.5;
}
/* ── toggle ── */
.st-toggle {
width: 42px; height: 24px; border-radius: 12px;
background: rgba(58,48,40,0.12);
position: relative; flex-shrink: 0;
cursor: pointer;
transition: background 0.2s;
border: none; padding: 0;
}
.st-toggle.on { background: #8BAD7E; }
.st-toggle-thumb {
position: absolute; top: 3px; left: 3px;
width: 18px; height: 18px; border-radius: 50%;
background: #fff;
box-shadow: 0 1px 4px rgba(0,0,0,0.20);
transition: transform 0.2s;
}
.st-toggle.on .st-toggle-thumb { transform: translateX(18px); }
.settings-save-btn {
display: block; width: 100%;
margin-top: 12px;
padding: 13px 20px;
background: linear-gradient(135deg, #C4826A 0%, #B06850 100%);
color: #fff; border: none; border-radius: 14px;
font-size: 14px; font-weight: 600; font-family: inherit;
cursor: pointer; letter-spacing: 0.1px;
transition: opacity 0.15s, transform 0.1s;
}
.settings-save-btn:hover { opacity: 0.88; transform: translateY(-1px); }
.settings-save-btn:active { transform: translateY(0); }
/* ── map filter rows ── */
.sf-filter-row {
background: rgba(255,255,255,0.65);
border: 1px solid rgba(58,48,40,0.08);
border-radius: 14px;
padding: 12px 18px;
display: flex; align-items: center; gap: 12px;
box-shadow: 0 2px 10px rgba(58,48,40,0.05);
}
.sf-filter-row + .sf-filter-row { margin-top: 6px; }
.sf-color-dot {
width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}
.sf-filter-label { font-size: 13px; font-weight: 600; color: #2C2820; flex: 1; }
.sf-delete-btn {
font-size: 11px; font-weight: 600; color: #B0A496;
cursor: pointer; border-radius: 6px;
background: none; border: none; padding: 4px 8px;
transition: color 0.12s, background 0.12s;
}
.sf-delete-btn:hover { color: #C4826A; background: rgba(196,130,106,0.08); }
.sf-add-btn {
width: 100%; margin-top: 8px;
padding: 11px 18px;
background: rgba(255,255,255,0.45);
border: 1.5px dashed rgba(58,48,40,0.18);
border-radius: 14px; color: #8A7E72;
font-size: 13px; font-weight: 500; font-family: inherit;
cursor: pointer; text-align: center;
transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.sf-add-btn:hover { background: rgba(255,255,255,0.70); border-color: rgba(58,48,40,0.28); color: #3A3028; }
.sf-add-form {
background: rgba(255,255,255,0.65);
border: 1px solid rgba(58,48,40,0.08);
border-radius: 14px; padding: 16px 18px;
box-shadow: 0 2px 10px rgba(58,48,40,0.05);
margin-top: 8px;
display: flex; flex-direction: column; gap: 10px;
}
.sf-add-form.hidden { display: none; }
.sf-input {
width: 100%; padding: 9px 12px;
border: 1.5px solid rgba(58,48,40,0.12);
border-radius: 9px; font-size: 13px;
font-family: inherit; color: #2C2820;
background: rgba(255,255,255,0.80);
outline: none; box-sizing: border-box;
transition: border-color 0.15s;
}
.sf-input:focus { border-color: #C4826A; }
.sf-input::placeholder { color: #B0A496; }
.sf-form-actions {
display: flex; gap: 8px; justify-content: flex-end;
}
.sf-cancel-btn {
padding: 8px 16px; border-radius: 9px;
font-size: 13px; font-weight: 500; font-family: inherit;
cursor: pointer; background: none;
border: 1.5px solid rgba(58,48,40,0.14); color: #8A7E72;
transition: background 0.12s;
}
.sf-cancel-btn:hover { background: rgba(58,48,40,0.04); }
.sf-save-filter-btn {
padding: 8px 16px; border-radius: 9px;
font-size: 13px; font-weight: 600; font-family: inherit;
cursor: pointer; border: none;
background: linear-gradient(135deg, #C4826A 0%, #B06850 100%);
color: #fff; transition: opacity 0.15s;
}
.sf-save-filter-btn:hover { opacity: 0.88; }
.sf-custom-label {
font-size: 10px; font-weight: 700; letter-spacing: 0.9px;
text-transform: uppercase; color: #B0A496;
padding: 0 4px; margin-top: 16px; margin-bottom: 8px;
}
</style>
</head>
<body>
<!-- ════════════════════════════════════════
TOP BAR
════════════════════════════════════════ -->
<header id="top-bar">
<a class="topbar-logo" href="index.html">
<div class="topbar-logo-icon">
<svg width="16" height="16" viewBox="0 0 16 16" fill="none">
<circle cx="8" cy="8" r="5.5" stroke="white" stroke-width="1.3"/>
<circle cx="8" cy="8" r="1.4" fill="white"/>
<line x1="8" y1="2.5" x2="8" y2="4.6" stroke="white" stroke-width="1.3" stroke-linecap="round"/>
<line x1="8" y1="11.4" x2="8" y2="13.5" stroke="white" stroke-width="1.3" stroke-linecap="round"/>
<line x1="2.5" y1="8" x2="4.6" y2="8" stroke="white" stroke-width="1.3" stroke-linecap="round"/>
<line x1="11.4" y1="8" x2="13.5" y2="8" stroke="white" stroke-width="1.3" stroke-linecap="round"/>
</svg>
</div>
<span class="topbar-logo-text">Map of Knowledge</span>
</a>
<div class="topbar-right">
<div class="topbar-burger-wrap">
<button class="topbar-icon-btn topbar-burger" id="nav-menu" title="Menu">
<svg width="16" height="14" viewBox="0 0 16 14" fill="none">
<path d="M1 1h14M1 7h14M1 13h14" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
</svg>
</button>
<div id="nav-dropdown" class="nav-dropdown">
<button class="nav-dropdown-item" onclick="window.location='profile.html'">
<svg width="15" height="15" viewBox="0 0 15 15" fill="none">
<circle cx="7.5" cy="5" r="2.5" stroke="currentColor" stroke-width="1.2"/>
<path d="M2 13c0-2.8 2.5-4.5 5.5-4.5s5.5 1.7 5.5 4.5" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/>
</svg>
Account
</button>
<button class="nav-dropdown-item" onclick="window.location='notifications.html'">
<svg width="15" height="15" viewBox="0 0 15 15" fill="none">
<path d="M7.5 1.5a4 4 0 0 0-4 4v2.5L2.5 9.5h10l-1-1.5V5.5a4 4 0 0 0-4-4z" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round"/>
<path d="M6 11.5a1.5 1.5 0 0 0 3 0" stroke="currentColor" stroke-width="1.2"/>
</svg>
Notifications
</button>
<div class="nav-dropdown-divider"></div>
<button class="nav-dropdown-item active-page">
<img src="images/icon-settings.svg" width="15" height="15" alt="">
Settings
</button>
</div>
</div>
</div>
</header>
<!-- ════════════════════════════════════════
SETTINGS CONTENT
════════════════════════════════════════ -->
<main class="settings-page">
<h1 class="settings-title">Settings</h1>
<!-- MAP BEHAVIOUR -->
<div class="settings-section">
<div class="settings-section-label">Map behaviour</div>
<div class="settings-row">
<div class="settings-row-text">
<div class="settings-row-label">Screen saver</div>
<div class="settings-row-desc">After one minute of inactivity the map slowly pans and zooms through the knowledge graph.</div>
</div>
<button class="st-toggle on" id="screensaver-toggle" aria-label="Toggle screen saver">
<div class="st-toggle-thumb"></div>
</button>
</div>
</div>
<!-- MAP FILTERS -->
<div class="settings-section" id="filters">
<div class="settings-section-label">Map filters</div>
<div id="sf-preset-list"></div>
<div id="sf-custom-section" style="display:none">
<div class="sf-custom-label">Custom</div>
<div id="sf-custom-list"></div>
</div>
<button class="sf-add-btn" id="sf-add-open">+ Add custom filter</button>
<div class="sf-add-form hidden" id="sf-add-form">
<input type="text" class="sf-input" id="sf-filter-name"
placeholder="Filter name (e.g. ABRSM Grade 6)">
<input type="text" class="sf-input" id="sf-filter-labels"
placeholder="Knowledge areas, comma-separated (e.g. Music theory, Acoustics)">
<div class="sf-form-actions">
<button class="sf-cancel-btn" id="sf-cancel">Cancel</button>
<button class="sf-save-filter-btn" id="sf-save">Add filter</button>
</div>
</div>
</div>
<button class="settings-save-btn" onclick="window.location='index.html'">
Save & return to map
</button>
</main>
<script>
/* ── Burger dropdown ── */
document.getElementById('nav-menu').addEventListener('click', function (e) {
e.stopPropagation();
document.getElementById('nav-dropdown').classList.toggle('open');
});
document.addEventListener('click', function () {
document.getElementById('nav-dropdown').classList.remove('open');
});
/* ── Filter settings ── */
var PRESET_FILTERS = [
{ id: 'my-knowledge', label: 'My Knowledge', color: '#9B8FB5' },
{ id: 'estonian-basic-school', label: 'Estonian Basic School 2023', color: '#8BAD7E' },
{ id: 'aws-solutions-architect', label: 'AWS Solutions Architect', color: '#6BA8C4' },
{ id: 'b-driving-licence', label: 'B-Category Driving Licence', color: '#D4A85A' },
{ id: 'abrsm-grade5-music', label: 'ABRSM Grade 5 Music Theory', color: '#C48FA0' },
];
var CUSTOM_COLORS = ['#A0C4B0', '#C4A0B0', '#A0B0C4', '#C4B4A0', '#B0A0C4'];
function sfGetHidden() {
try { return JSON.parse(localStorage.getItem('kq_filter_hidden') || '[]'); }
catch(e) { return []; }
}
function sfSetHidden(arr) { localStorage.setItem('kq_filter_hidden', JSON.stringify(arr)); }
function sfGetCustom() {
try { return JSON.parse(localStorage.getItem('kq_filter_custom') || '[]'); }
catch(e) { return []; }
}
function sfSetCustom(arr) { localStorage.setItem('kq_filter_custom', JSON.stringify(arr)); }
/* Render preset filter rows */
var sfPresetList = document.getElementById('sf-preset-list');
var sfHidden = sfGetHidden();
PRESET_FILTERS.forEach(function(f, i) {
var isOn = sfHidden.indexOf(f.id) === -1;
var row = document.createElement('div');
row.className = 'sf-filter-row';
if (i > 0) row.style.marginTop = '6px';
row.innerHTML =
'<span class="sf-color-dot" style="background:' + f.color + '"></span>' +
'<span class="sf-filter-label">' + f.label + '</span>' +
'<button class="st-toggle' + (isOn ? ' on' : '') + '" data-filter-id="' + f.id + '" aria-label="Toggle ' + f.label + '">' +
'<div class="st-toggle-thumb"></div></button>';
sfPresetList.appendChild(row);
});
sfPresetList.addEventListener('click', function(e) {
var btn = e.target.closest('.st-toggle');
if (!btn) return;
var fid = btn.dataset.filterId;
var isOn = btn.classList.toggle('on');
var h = sfGetHidden();
if (isOn) { var idx = h.indexOf(fid); if (idx !== -1) h.splice(idx, 1); }
else { if (h.indexOf(fid) === -1) h.push(fid); }
sfSetHidden(h);
});
/* Render custom filter rows */
function sfRenderCustom() {
var customs = sfGetCustom();
var section = document.getElementById('sf-custom-section');
var customList = document.getElementById('sf-custom-list');
customList.innerHTML = '';
section.style.display = customs.length ? '' : 'none';
customs.forEach(function(cf, i) {
var row = document.createElement('div');
row.className = 'sf-filter-row';
if (i > 0) row.style.marginTop = '6px';
row.innerHTML =
'<span class="sf-color-dot" style="background:' + cf.color + '"></span>' +
'<span class="sf-filter-label">' + cf.label + '</span>' +
'<button class="sf-delete-btn" data-filter-id="' + cf.id + '" title="Remove filter">✕</button>';
customList.appendChild(row);
});
}
sfRenderCustom();
document.getElementById('sf-custom-list').addEventListener('click', function(e) {
var btn = e.target.closest('.sf-delete-btn');
if (!btn) return;
var fid = btn.dataset.filterId;
sfSetCustom(sfGetCustom().filter(function(cf) { return cf.id !== fid; }));
sfSetHidden(sfGetHidden().filter(function(id) { return id !== fid; }));
sfRenderCustom();
});
/* Add form */
var sfAddOpen = document.getElementById('sf-add-open');
var sfAddForm = document.getElementById('sf-add-form');
sfAddOpen.addEventListener('click', function() {
sfAddForm.classList.remove('hidden');
sfAddOpen.style.display = 'none';
});
document.getElementById('sf-cancel').addEventListener('click', function() {
sfAddForm.classList.add('hidden');
sfAddOpen.style.display = '';
document.getElementById('sf-filter-name').value = '';
document.getElementById('sf-filter-labels').value = '';
});
document.getElementById('sf-save').addEventListener('click', function() {
var name = document.getElementById('sf-filter-name').value.trim();
if (!name) { document.getElementById('sf-filter-name').focus(); return; }
var labels = document.getElementById('sf-filter-labels').value
.split(',').map(function(s) { return s.trim(); }).filter(Boolean);
var customs = sfGetCustom();
var color = CUSTOM_COLORS[customs.length % CUSTOM_COLORS.length];
customs.push({ id: 'custom-' + Date.now(), label: name, color: color, labels: labels });
sfSetCustom(customs);
sfRenderCustom();
sfAddForm.classList.add('hidden');
sfAddOpen.style.display = '';
document.getElementById('sf-filter-name').value = '';
document.getElementById('sf-filter-labels').value = '';
});
/* ── Screensaver toggle ── */
const ssToggle = document.getElementById('screensaver-toggle');
// Load saved state (default: on)
if (localStorage.getItem('screensaver_enabled') === 'false') {
ssToggle.classList.remove('on');
}
ssToggle.addEventListener('click', function () {
const isOn = this.classList.toggle('on');
localStorage.setItem('screensaver_enabled', isOn ? 'true' : 'false');
});
</script>
</body>
</html>