-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.html
More file actions
544 lines (472 loc) · 13.9 KB
/
index.html
File metadata and controls
544 lines (472 loc) · 13.9 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
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>jsonos Browser</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/mashlib/dist/mash.css" />
<!-- Using solid-shim instead of mashlib -->
<script src="dist/solid-shim.min.js"></script>
<style>
:root {
--primary: #7C3AED;
--primary-dark: #6D28D9;
--secondary: #2563EB;
--bg-light: #f8fafc;
--bg-dark: #0f172a;
--text-light: #1e293b;
--text-dark: #e2e8f0;
--card-light: #ffffff;
--card-dark: #1e293b;
}
* {
box-sizing: border-box;
}
body {
margin: 0;
font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
background: var(--bg-light);
color: var(--text-light);
min-height: 100vh;
}
@media (prefers-color-scheme: dark) {
body {
background: var(--bg-dark);
color: var(--text-dark);
}
.header { background: linear-gradient(135deg, #5B21B6, #1D4ED8); }
.card { background: var(--card-dark); border-color: #334155; }
#uriField { background: #1e293b; color: #e2e8f0; border-color: #475569; }
#uriField:focus { border-color: var(--primary); }
.quick-link { background: #334155; color: #e2e8f0; }
.quick-link:hover { background: #475569; }
.status-bar { background: var(--card-dark); border-color: #334155; }
}
.header {
background: linear-gradient(135deg, var(--primary), var(--secondary));
color: white;
padding: 1.5rem 2rem;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}
.header-content {
max-width: 1400px;
margin: 0 auto;
}
.header h1 {
margin: 0 0 0.5rem 0;
font-size: 1.75rem;
font-weight: 600;
display: flex;
align-items: center;
gap: 0.5rem;
}
.header h1::before {
content: "";
display: inline-block;
width: 32px;
height: 32px;
background: url('../img/logo.png') no-repeat center;
background-size: contain;
}
.header-subtitle {
opacity: 0.9;
font-size: 0.95rem;
}
.search-container {
margin-top: 1.25rem;
display: flex;
gap: 0.75rem;
flex-wrap: wrap;
}
#uriField {
flex: 1;
min-width: 280px;
padding: 0.875rem 1.25rem;
font-size: 1rem;
border: 2px solid rgba(255, 255, 255, 0.3);
border-radius: 12px;
background: rgba(255, 255, 255, 0.95);
color: var(--text-light);
outline: none;
transition: all 0.2s ease;
}
#uriField:focus {
border-color: white;
box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.2);
}
#uriField::placeholder {
color: #94a3b8;
}
#goButton {
padding: 0.875rem 2rem;
font-size: 1rem;
font-weight: 600;
background: white;
color: var(--primary);
border: none;
border-radius: 12px;
cursor: pointer;
transition: all 0.2s ease;
}
#goButton:hover {
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
#goButton:active {
transform: translateY(0);
}
.quick-links {
margin-top: 1rem;
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
align-items: center;
}
.quick-links-label {
font-size: 0.85rem;
opacity: 0.8;
margin-right: 0.25rem;
}
.quick-link {
display: inline-block;
padding: 0.4rem 0.9rem;
font-size: 0.85rem;
background: rgba(255, 255, 255, 0.2);
color: white;
text-decoration: none;
border-radius: 20px;
transition: all 0.2s ease;
cursor: pointer;
border: 1px solid rgba(255, 255, 255, 0.3);
}
.quick-link:hover {
background: rgba(255, 255, 255, 0.35);
transform: translateY(-1px);
}
.status-bar {
background: var(--card-light);
border-bottom: 1px solid #e2e8f0;
padding: 0.75rem 2rem;
display: flex;
align-items: center;
justify-content: space-between;
flex-wrap: wrap;
gap: 0.5rem;
}
.status-bar-content {
max-width: 1400px;
margin: 0 auto;
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
flex-wrap: wrap;
gap: 0.5rem;
}
.user-info {
display: flex;
align-items: center;
gap: 0.5rem;
font-size: 0.9rem;
}
.user-info .label {
color: #64748b;
}
#webId {
font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
font-size: 0.85rem;
color: var(--primary);
}
#loginButtonArea {
display: flex;
align-items: center;
}
#loginButtonArea input[type="button"],
#loginButtonArea button {
padding: 0.6rem 1.5rem !important;
font-size: 0.875rem !important;
font-weight: 600 !important;
background: white !important;
color: var(--primary) !important;
border: 2px solid var(--primary) !important;
border-radius: 50px !important;
cursor: pointer !important;
transition: all 0.2s ease;
opacity: 1 !important;
margin: 0 0.35rem !important;
text-transform: none !important;
letter-spacing: 0 !important;
box-shadow: 0 2px 8px rgba(124, 58, 237, 0.15);
}
#loginButtonArea input[type="button"]:hover,
#loginButtonArea button:hover {
background: var(--primary) !important;
color: white !important;
transform: translateY(-1px);
box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}
#loginButtonArea a {
padding: 0.6rem 1.5rem !important;
font-size: 0.875rem !important;
font-weight: 600 !important;
background: linear-gradient(135deg, var(--primary), var(--secondary)) !important;
color: white !important;
border: none !important;
border-radius: 50px !important;
cursor: pointer !important;
text-decoration: none !important;
display: inline-block;
margin: 0 0.35rem !important;
box-shadow: 0 2px 8px rgba(124, 58, 237, 0.25);
transition: all 0.2s ease;
}
#loginButtonArea a:hover {
transform: translateY(-1px);
box-shadow: 0 4px 16px rgba(124, 58, 237, 0.4);
}
.browser-container {
max-width: 1400px;
margin: 0 auto;
padding: 1.5rem 2rem;
}
.card {
background: var(--card-light);
border-radius: 16px;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
border: 1px solid #e2e8f0;
overflow: hidden;
}
#DummyUUID {
min-height: 60vh;
padding: 1rem;
}
.loading {
display: none;
text-align: center;
padding: 3rem;
color: #64748b;
}
.loading.active {
display: block;
}
.spinner {
width: 40px;
height: 40px;
border: 3px solid #e2e8f0;
border-top-color: var(--primary);
border-radius: 50%;
animation: spin 0.8s linear infinite;
margin: 0 auto 1rem;
}
@keyframes spin {
to { transform: rotate(360deg); }
}
.welcome-message {
text-align: center;
padding: 4rem 2rem;
color: #64748b;
}
.welcome-message h2 {
color: var(--text-light);
margin-bottom: 0.5rem;
}
@media (prefers-color-scheme: dark) {
.welcome-message h2 { color: var(--text-dark); }
}
.footer {
text-align: center;
padding: 2rem;
color: #64748b;
font-size: 0.85rem;
}
.footer a {
color: var(--primary);
text-decoration: none;
}
.footer a:hover {
text-decoration: underline;
}
@media (max-width: 640px) {
.header { padding: 1rem; }
.browser-container { padding: 1rem; }
.status-bar { padding: 0.75rem 1rem; }
#uriField { min-width: 100%; }
}
</style>
</head>
<body>
<header class="header">
<div class="header-content">
<h1>jsonos Browser</h1>
<p class="header-subtitle">The JSON Operating System for the Web</p>
<div class="search-container">
<input
type="text"
id="uriField"
placeholder="Enter a Solid pod URL or WebID..."
autocomplete="off"
spellcheck="false"
/>
<button id="goButton">Browse</button>
</div>
<div class="quick-links">
<span class="quick-links-label">Try:</span>
<a class="quick-link" data-uri="https://timbl.solidcommunity.net/profile/card#me">Tim Berners-Lee</a>
<a class="quick-link" data-uri="https://solidos.solidcommunity.net/public/Roadmap/">Roadmap</a>
<a class="quick-link" data-uri="https://solidos.solidcommunity.net/public/SolidOS%20team%20meetings/">Team Meetings</a>
<a class="quick-link" data-uri="https://solidos.solidcommunity.net/public/">SolidOS Files</a>
</div>
</div>
</header>
<div class="status-bar">
<div class="status-bar-content">
<div class="user-info">
<span class="label">Logged in as:</span>
<span id="webId">Not logged in</span>
</div>
<div id="loginButtonArea"></div>
</div>
</div>
<main class="browser-container">
<div class="card">
<div id="welcome" class="welcome-message">
<h2>Welcome to jsonos</h2>
<p>Enter a URL above or click one of the quick links to get started.</p>
<p>Log in with your WebID to access private data and edit resources.</p>
</div>
<div id="loading" class="loading">
<div class="spinner"></div>
<p>Loading resource...</p>
</div>
<div class="TabulatorOutline" id="DummyUUID" role="main" style="display: none;">
<table id="outline"></table>
<div id="GlobalDashboard"></div>
</div>
</div>
</main>
<footer class="footer">
<p>
Powered by <a href="https://jsonos.com" target="_blank">jsonos</a> |
<a href="https://github.com/json-os" target="_blank">GitHub</a> |
<a href="https://solidproject.org/" target="_blank">Solid Project</a>
</p>
</footer>
<script>
document.addEventListener('DOMContentLoaded', function() {
const authn = SolidLogic.authn
const authSession = SolidLogic.authSession
const store = SolidLogic.store
const dom = document
const uriField = dom.getElementById('uriField')
const goButton = dom.getElementById('goButton')
const loginButtonArea = dom.getElementById('loginButtonArea')
const webIdArea = dom.getElementById('webId')
const welcomeEl = dom.getElementById('welcome')
const loadingEl = dom.getElementById('loading')
const browserEl = dom.getElementById('DummyUUID')
const outliner = panes.getOutliner(dom)
// Navigate to a URI
function go(uri) {
if (!uri) uri = uriField.value.trim()
if (!uri) return
uriField.value = uri
console.log('Navigating to:', uri)
// Show loading state
welcomeEl.style.display = 'none'
loadingEl.classList.add('active')
browserEl.style.display = 'none'
// Update URL bar
const params = new URLSearchParams(location.search)
params.set('uri', uri)
window.history.replaceState({}, '', `${location.origin}${location.pathname}?${params}`)
document.title = `jsonos - ${uri}`
// Load the resource
const subject = $rdf.sym(uri)
setTimeout(() => {
loadingEl.classList.remove('active')
browserEl.style.display = 'block'
outliner.GotoSubject(subject, true, undefined, true, undefined)
}, 100)
updateLoginArea()
}
// Update login status display
async function updateLoginArea() {
loginButtonArea.innerHTML = ''
loginButtonArea.appendChild(UI.login.loginStatusBox(document, null, {}))
// Override signup button/link to point to correct URL
setTimeout(() => {
// Fix any anchor links
const signupLinks = loginButtonArea.querySelectorAll('a')
signupLinks.forEach(link => {
const text = link.textContent.toLowerCase()
if (text.includes('sign') || text.includes('register') || text.includes('pod')) {
link.href = 'https://solidproject.org/get_a_pod'
link.target = '_blank'
}
})
// Fix signup button (which opens broken popup)
const buttons = loginButtonArea.querySelectorAll('input[type="button"], button')
buttons.forEach(btn => {
const text = (btn.value || btn.textContent || '').toLowerCase()
if (text.includes('sign up')) {
// Clone to remove old event listeners
const newBtn = btn.cloneNode(true)
btn.parentNode.replaceChild(newBtn, btn)
newBtn.addEventListener('click', (e) => {
e.preventDefault()
e.stopPropagation()
window.open('https://solidproject.org/get_a_pod', '_blank')
})
}
})
}, 100)
const me = authn.currentUser()
if (me) {
const shortId = me.value.length > 50
? me.value.substring(0, 47) + '...'
: me.value
webIdArea.textContent = shortId
webIdArea.title = me.value
} else {
webIdArea.textContent = 'Not logged in'
webIdArea.title = ''
}
}
// Event listeners
uriField.addEventListener('keyup', (e) => {
if (e.keyCode === 13) go()
})
goButton.addEventListener('click', () => go())
// Quick links
document.querySelectorAll('.quick-link').forEach(link => {
link.addEventListener('click', (e) => {
e.preventDefault()
const uri = link.dataset.uri
go(uri)
})
})
// Handle auth events
if (authSession) {
authSession.events.on('login', () => {
updateLoginArea()
if (uriField.value) go()
})
authSession.events.on('logout', () => {
updateLoginArea()
if (uriField.value) go()
})
authSession.events.on('sessionRestore', () => {
updateLoginArea()
if (uriField.value) go()
})
}
// Check for URI in query string
const initial = new URLSearchParams(location.search).get('uri')
if (initial) {
go(initial)
}
updateLoginArea()
})
</script>
</body>
</html>