forked from SolidOS/solid-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
681 lines (636 loc) · 30.2 KB
/
Copy pathindex.html
File metadata and controls
681 lines (636 loc) · 30.2 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
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset='UTF-8'>
<title>solid-ui UI.widgets.buttons examples page</title>
<script type="text/javascript" src="../../lib/webpack-bundle.js"></script>
<script>
const $ = document.querySelector.bind(document)
function showSource(widgetName) {
$(`#viewSource-${widgetName}`).innerHTML = $(`#script-${widgetName}`).innerText
.replace(/&/g, "&")
.replace(/</g, "<")
.replace(/>/g, ">")
.replace(/"/g, """)
.replace(/'/g, "'")
}
</script>
</head>
<body>
<h2 id="addStyleSheet"><a href="#addStyleSheet">addStyleSheet</a></h2>
<script id="script-addStyleSheet">
window.addEventListener('DOMContentLoaded', (event) => {
UI.widgets.addStyleSheet(document, 'https://linkeddata.github.io/tabulator-firefox/content/tabbedtab.css')
})
</script>
<pre id="viewSource-addStyleSheet"></pre><script>showSource('addStyleSheet')</script>
<h2 id="allClassURIs"><a href="#allClassURIs">allClassURIs</a></h2>
<script id="script-allClassURIs">
window.addEventListener('DOMContentLoaded', (event) => {
UI.store.add(
UI.rdf.namedNode('http://example.com/#some-thing'),
UI.rdf.namedNode('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'),
UI.rdf.namedNode('http://example.com/#some-class')
)
UI.store.add(
UI.rdf.namedNode('http://example.com/#some-other-thing'),
UI.rdf.namedNode('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'),
UI.rdf.namedNode('http://example.com/#some-other-class')
)
const list = Object.keys(UI.widgets.allClassURIs())
const ul = $('#ul-allClassURIs')
list.map((uri) => {
const li = document.createElement('li')
li.appendChild(document.createTextNode(uri))
ul.appendChild(li)
})
})
</script>
<pre id="viewSource-allClassURIs"></pre><script>showSource('allClassURIs')</script>
<ul id="ul-allClassURIs"></ul>
<h2 id="askName"><a href="#askName">askName</a></h2>
<script id="script-askName">
window.addEventListener('DOMContentLoaded', async () => {
try {
const name = await UI.widgets.askName(document, UI.store, $('#div-askName'))
window.alert(`You picked "${name}"`)
} catch (error) {
window.alert(`Error asking name`)
}
});
</script>
<pre id="viewSource-askName"></pre><script>showSource('askName')</script>
<div id="div-askName"></div>
<h2 id="attachmentList"><a href="#attachmentList">attachmentList</a></h2>
<script id="script-attachmentList">
window.addEventListener('DOMContentLoaded', (event) => {
UI.store.add(
UI.rdf.namedNode('https://example-user.inrupt.net/public/some-message.ttl#this'),
UI.ns.wf('attachment'),
UI.rdf.namedNode('http://example.com/#some-attachment')
)
UI.widgets.attachmentList(document, UI.rdf.namedNode('https://example-user.inrupt.net/public/some-message.ttl#this'), $('#div-attachmentList'))
})
</script>
<pre id="viewSource-attachmentList"></pre><script>showSource('attachmentList')</script>
<div id="div-attachmentList"></div>
<h2 id="button-with-icon"><a href="#button-with-icon">button with icon</a></h2>
<script id="script-button-with-icon">
window.addEventListener('DOMContentLoaded', (event) => {
const solidLogo = 'https://solidproject.org/assets/img/solid-emblem.svg'
$('#div-button-with-icon').appendChild(
UI.widgets.button(document, solidLogo, 'test', () => {
window.alert('clicked!')
})
)
})
</script>
<pre id="viewSource-button-with-icon"></pre><script>showSource('button-with-icon')</script>
<div id="div-button-with-icon"></div>
<h2 id="button-with-text-primary-no-border"><a href="#button-with-text-primary-no-border">button with text (primary color, no border)</a></h2>
<script id="script-button-with-text-primary-no-border">
window.addEventListener('DOMContentLoaded', (event) => {
$('#div-button-with-text-primary-no-border').appendChild(
UI.widgets.button(document, undefined, 'test', () => {
window.alert('clicked!')
})
)
})
</script>
<pre id="viewSource-button-with-text-primary-no-border"></pre><script>showSource('button-with-text-primary-no-border')</script>
<div id="div-button-with-text-primary-no-border"></div>
<h2 id="button-with-text-primary-needs-border"><a href="#button-with-text-primary-needs-border">button with text (primary color, needs border)</a>
</h2>
<script id="script-button-with-text-primary-needs-border">
window.addEventListener('DOMContentLoaded', (event) => {
$('#div-button-with-text-primary-needs-border').appendChild(
UI.widgets.button(document, undefined, 'test', () => {
window.alert('clicked!')
}, { needsBorder: true })
)
})
</script>
<pre id="viewSource-button-with-text-primary-needs-border"></pre><script>showSource('button-with-text-primary-needs-border')</script>
<div id="div-button-with-text-primary-needs-border"></div>
<h2 id="button-with-text-secondary-no-border"><a href="#button-with-text-secondary-no-border">button with text (secondary color, no border)</a>
</h2>
<script id="script-button-with-text-secondary-no-border">
window.addEventListener('DOMContentLoaded', (event) => {
$('#div-button-with-text-secondary-no-border').appendChild(
UI.widgets.button(document, undefined, 'test', () => {
window.alert('clicked!')
}, { buttonColor: 'Secondary' })
)
})
</script>
<pre id="viewSource-button-with-text-secondary-no-border"></pre><script>showSource('button-with-text-secondary-no-border')</script>
<div id="div-button-with-text-secondary-no-border"></div>
<h2 id="button-with-text-secondary-needs-border"><a href="#button-with-text-secondary-needs-border">button with text (secondary color, needs border)</a></h2>
<script id="script-button-with-text-secondary-needs-border">
window.addEventListener('DOMContentLoaded', (event) => {
$('#div-button-with-text-secondary-needs-border').appendChild(
UI.widgets.button(document, undefined, 'test', () => {
window.alert('clicked!')
}, { buttonColor: 'Secondary', needsBorder: true })
)
})
</script>
<pre id="viewSource-button-with-text-secondary-needs-border"></pre><script>showSource('button-with-text-secondary-needs-border')</script>
<div id="div-button-with-text-secondary-needs-border"></div>
<h2 id="cancelButton"><a href="#cancelButton">cancelButton</a></h2>
<script id="script-cancelButton">
window.addEventListener('DOMContentLoaded', (event) => {
$('#div-cancelButton').appendChild(
UI.widgets.cancelButton(document, () => {
window.alert('clicked!')
})
)
})
</script>
<pre id="viewSource-cancelButton"></pre><script>showSource('cancelButton')</script>
<div id="div-cancelButton"></div>
<h2 id="clearElement"><a href="#clearElement">clearElement</a></h2>
<script id="script-clearElement">
window.addEventListener('DOMContentLoaded', (event) => {
let counter = 0
setInterval(() => {
if (counter++ % 2 === 0) {
const text = document.createTextNode('Now you see me')
$('#div-clearElement').appendChild(text)
} else {
UI.widgets.clearElement($('#div-clearElement'))
}
}, 1000)
})
</script>
<pre id="viewSource-clearElement"></pre><script>showSource('clearElement')</script>
<div id="div-clearElement" style="height: 2em;"></div>
<h2 id="complain"><a href="#complain">complain</a></h2>
<script id="script-complain">
window.addEventListener('DOMContentLoaded', (event) => {
UI.widgets.complain({ div: $('#div-complain'), dom: document }, 'not good!')
})
</script>
<pre id="viewSource-complain"></pre><script>showSource('complain')</script>
<div id="div-complain" style="height: 2em;"></div>
<h2 id="continueButton"><a href="#continueButton">continueButton</a></h2>
<script id="script-continueButton">
window.addEventListener('DOMContentLoaded', (event) => {
$('#div-continueButton').appendChild(
UI.widgets.continueButton(document, () => window.alert('clicked!'))
)
})
</script>
<pre id="viewSource-continueButton"></pre><script>showSource('continueButton')</script>
<div id="div-continueButton"></div>
<h2 id="defaultAnnotationStore"><a href="#defaultAnnotationStore">defaultAnnotationStore</a></h2>
<script id="script-defaultAnnotationStore">
window.addEventListener('DOMContentLoaded', (event) => {
const url = 'http://example.com/a/b.html'
const result = UI.widgets.defaultAnnotationStore(UI.rdf.namedNode(url))
$('#div-defaultAnnotationStore').appendChild(document.createTextNode(result.uri))
})
</script>
<pre id="viewSource-defaultAnnotationStore"></pre><script>showSource('defaultAnnotationStore')</script>
<div id="div-defaultAnnotationStore"></div>
<h2 id="deleteButtonWithCheck"><a href="#deleteButtonWithCheck">deleteButtonWithCheck</a></h2>
<script id="script-deleteButtonWithCheck">
window.addEventListener('DOMContentLoaded', (event) => {
const result = UI.widgets.deleteButtonWithCheck(
document,
$('#div-deleteButtonWithCheck'),
'something',
() => window.alert('irreversible!'))
$('#div-deleteButtonWithCheck').appendChild(result)
})
</script>
<pre id="viewSource-deleteButtonWithCheck"></pre><script>showSource('deleteButtonWithCheck')</script>
<div id="div-deleteButtonWithCheck"></div>
<h2 id="extractLogURI"><a href="#extractLogURI">extractLogURI</a></h2>
<script id="script-extractLogURI">
window.addEventListener('DOMContentLoaded', (event) => {
const url = 'https://example.com/logFile=http%3A%2F%2Fexample.org%2Flogs.ttl&rulesFile=ttp%3A%2F%2Fexample.org%2Frules.ttl'
const extracted = decodeURIComponent(UI.widgets.extractLogURI(url))
$('#div-extractLogURI').appendChild(document.createTextNode(extracted))
})
</script>
<pre id="viewSource-extractLogURI"></pre><script>showSource('extractLogURI')</script>
<div id="div-extractLogURI"></div>
<h2 id="formatDateTime"><a href="#formatDateTime">formatDateTime</a></h2>
<script id="script-formatDateTime">
window.addEventListener('DOMContentLoaded', (event) => {
const result = UI.widgets.formatDateTime(
new Date(),
'{FullYear}-{Month}-{Date}T{Hours}:{Minutes}:{Seconds}.{Milliseconds}'
)
$('#div-formatDateTime').appendChild(document.createTextNode(result))
})
</script>
<pre id="viewSource-formatDateTime"></pre><script>showSource('formatDateTime')</script>
<div id="div-formatDateTime"></div>
<h2 id="faviconOrDefault"><a href="#faviconOrDefault"><a href="#faviconOrDefault">faviconOrDefault</a></a></h2>
<script id="script-faviconOrDefault">
window.addEventListener('DOMContentLoaded', (event) => {
const result = UI.widgets.faviconOrDefault(document, UI.rdf.namedNode('https://solidproject.org/'))
$('#div-faviconOrDefault').appendChild(result)
})
</script>
<pre id="viewSource-faviconOrDefault"></pre><script>showSource('faviconOrDefault')</script>
<div id="div-faviconOrDefault"></div>
<h2 id="fileUploadButtonDiv"><a href="#fileUploadButtonDiv"><a href="#fileUploadButtonDiv">fileUploadButtonDiv</a></a></h2>
<script id="script-fileUploadButtonDiv">
window.addEventListener('DOMContentLoaded', (event) => {
const result = UI.widgets.fileUploadButtonDiv(document, (files) => {
window.alert('uploaded! ' + files.length)
})
$('#div-fileUploadButtonDiv').appendChild(result)
})
</script>
<pre id="viewSource-fileUploadButtonDiv"></pre><script>showSource('fileUploadButtonDiv')</script>
<div id="div-fileUploadButtonDiv"></div>
<h2 id="findImage"><a href="#findImage">findImage</a></h2>
<script id="script-findImage">
function displayFindImageResult(node) {
const result = UI.widgets.findImage(node)
const image = document.createElement('img')
image.setAttribute('src', result)
image.setAttribute('style', 'width: 100px; height: 100px;')
$('#div-findImage').appendChild(image)
}
window.addEventListener('DOMContentLoaded', (event) => {
displayFindImageResult(UI.ns.foaf('Agent'))
displayFindImageResult(UI.ns.rdf('Resource'))
const michiel = UI.rdf.namedNode('https://michielbdejong.inrupt.net/profile/card#me')
const michielPhoto = UI.rdf.namedNode('https://michielbdejong.com/img/me.jpg')
UI.store.add(michiel, UI.ns.vcard('hasPhoto'), michielPhoto)
displayFindImageResult(michiel)
})
</script>
<pre id="viewSource-findImage"></pre><script>showSource('findImage')</script>
<div id="div-findImage"></div>
<h2 id="findImageFromURI"><a href="#findImageFromURI">findImageFromURI</a></h2>
<script id="script-findImageFromURI">
function displayFindImageFromURIResult(url) {
const node = UI.rdf.namedNode(url)
const result = UI.widgets.findImageFromURI(node)
const image = document.createElement('img')
image.setAttribute('src', result)
image.setAttribute('style', 'width: 100px; height: 100px;')
$('#div-findImageFromURI').appendChild(image)
}
window.addEventListener('DOMContentLoaded', (event) => {
displayFindImageFromURIResult('https://example.com/')
displayFindImageFromURIResult('https://solidproject.org/some/file.html')
displayFindImageFromURIResult('mid:asdf')
displayFindImageFromURIResult('mailto:user@example.com')
})
</script>
<pre id="viewSource-findImageFromURI"></pre><script>showSource('findImageFromURI')</script>
<div id="div-findImageFromURI"></div>
<h2 id="iconForClass"><a href="#iconForClass">iconForClass</a></h2>
<script id="script-iconForClass">
window.addEventListener('DOMContentLoaded', (event) => {
const lines = []
Object.keys(UI.widgets.iconForClass).map((key) => {
lines.push(`<li><img src="${UI.icons.iconBase}${UI.widgets.iconForClass[key]}" style="width:20px;height:20px;"> ${key}</li>`)
})
$('#div-iconForClass').innerHTML = `<ul>${lines.join('')}</ul>`
})
</script>
<pre id="viewSource-iconForClass"></pre><script>showSource('iconForClass')</script>
<div id="div-iconForClass"></div>
<h2 id="imagesOf"><a href="#imagesOf">imagesOf</a></h2>
<script id="script-imagesOf">
window.addEventListener('DOMContentLoaded', (event) => {
const store = UI.rdf.graph()
const tajMahal = UI.rdf.namedNode('http://dbpedia.org/page/Taj_Mahal')
const tajMahalPhoto = 'https://upload.wikimedia.org/wikipedia/commons/thumb/1/1d/Taj_Mahal_%28Edited%29.jpeg/1200px-Taj_Mahal_%28Edited%29.jpeg'
store.add(tajMahal, UI.ns.sioc('avatar'), tajMahalPhoto)
const result = UI.widgets.imagesOf(tajMahal, store)
result.map((imageUrl) => {
const image = document.createElement('img')
image.setAttribute('src', imageUrl)
image.setAttribute('style', 'width: 100px; height: 100px;')
$('#div-imagesOf').appendChild(image)
})
})
</script>
<pre id="viewSource-imagesOf"></pre><script>showSource('imagesOf')</script>
<div id="div-imagesOf"></div>
<h2 id="twoLineTransaction"><a href="#twoLineTransaction">twoLineTransaction</a></h2>
<script id="script-twoLineTransaction">
window.addEventListener('DOMContentLoaded', (event) => {
const twoLineTransaction = UI.widgets.index.twoLine['http://www.w3.org/2000/10/swap/pim/qif#Transaction']
const thing = UI.rdf.namedNode('http://example.com/#transaction')
UI.store.add(thing, UI.ns.qu('payee'), UI.rdf.namedNode('https://payee.com/#me'))
UI.store.add(thing, UI.ns.qu('date'), UI.rdf.literal('2020-01-01'))
UI.store.add(thing, UI.ns.qu('amount'), UI.rdf.literal('20 USD'))
const result = twoLineTransaction(document, thing)
$('#div-twoLineTransaction').appendChild(result)
})
</script>
<pre id="viewSource-twoLineTransaction"></pre><script>showSource('twoLineTransaction')</script>
<div id="div-twoLineTransaction"></div>
<h2 id="twoLineTrip"><a href="#twoLineTrip">twoLineTrip</a></h2>
<script id="script-twoLineTrip">
window.addEventListener('DOMContentLoaded', (event) => {
const twoLineTrip = UI.widgets.index.twoLine['http://www.w3.org/ns/pim/trip#Trip']
const thing = UI.rdf.namedNode('http://example.com/#trip')
UI.store.add(thing, UI.ns.dc('title'), 'Some trip')
UI.store.add(thing, UI.ns.cal('dtstart'), UI.rdf.literal('2020-01-01'))
UI.store.add(thing, UI.ns.cal('dtend'), UI.rdf.literal('2020-02-02'))
const result = twoLineTrip(document, thing)
$('#div-twoLineTrip').appendChild(result)
})
</script>
<pre id="viewSource-twoLineTrip"></pre><script>showSource('twoLineTrip')</script>
<div id="div-twoLineTrip"></div>
<h2 id="twoLineWidgetForClass"><a href="#twoLineWidgetForClass">twoLineWidgetForClass</a></h2>
<script id="script-twoLineWidgetForClass">
window.addEventListener('DOMContentLoaded', (event) => {
const rdfClass = UI.ns.foaf('Person')
const thing = UI.rdf.namedNode('https://michielbdejong.inrupt.net/profile/card#me')
const widgetFunction = UI.widgets.index.twoLine.widgetForClass(rdfClass)
const widget = widgetFunction(document, thing)
$('#div-twoLineWidgetForClass').appendChild(widget)
})
</script>
<pre id="viewSource-twoLineWidgetForClass"></pre><script>showSource('twoLineWidgetForClass')</script>
<div id="div-twoLineWidgetForClass"></div>
<h2 id="isAudio"><a href="#isAudio">isAudio</a></h2>
<script id="script-isAudio">
window.addEventListener('DOMContentLoaded', (event) => {
UI.store.add(UI.rdf.namedNode('http://example.com/audio.mpeg'), UI.ns.rdf('type'), UI.rdf.namedNode('http://www.w3.org/ns/iana/media-types/audio/'))
const result = UI.widgets.isAudio(UI.rdf.namedNode('http://example.com/audio.mpeg'))
$('#div-isAudio').appendChild(document.createTextNode(result))
})
</script>
<pre id="viewSource-isAudio"></pre><script>showSource('isAudio')</script>
<div id="div-isAudio"></div>
<h2 id="isImage"><a href="#isImage">isImage</a></h2>
<script id="script-isImage">
window.addEventListener('DOMContentLoaded', (event) => {
UI.store.add(UI.rdf.namedNode('http://example.com/image.jpeg'), UI.ns.rdf('type'), UI.rdf.namedNode('http://www.w3.org/ns/iana/media-types/image/'))
const result = UI.widgets.isImage(UI.rdf.namedNode('http://example.com/image.jpeg'))
$('#div-isImage').appendChild(document.createTextNode(result))
})
</script>
<pre id="viewSource-isImage"></pre><script>showSource('isImage')</script>
<div id="div-isImage"></div>
<h2 id="isVideo"><a href="#isVideo">isVideo</a></h2>
<script id="script-isVideo">
window.addEventListener('DOMContentLoaded', (event) => {
UI.store.add(UI.rdf.namedNode('http://example.com/video.mov'), UI.ns.rdf('type'), UI.rdf.namedNode('http://www.w3.org/ns/iana/media-types/video/'))
const result = UI.widgets.isImage(UI.rdf.namedNode('http://example.com/video.mov'))
$('#div-isVideo').appendChild(document.createTextNode(result))
})
</script>
<pre id="viewSource-isVideo"></pre><script>showSource('isVideo')</script>
<div id="div-isVideo"></div>
<h2 id="linkButton"><a href="#linkButton">linkButton</a></h2>
<script id="script-linkButton">
window.addEventListener('DOMContentLoaded', (event) => {
document.outlineManager = {
GotoSubject: (object) => {
window.alert('You told the outlineManager to go to subject ' + object.uri)
}
}
const result = UI.widgets.linkButton(document, UI.rdf.namedNode('http://example.com/'))
$('#div-linkButton').appendChild(result)
})
</script>
<pre id="viewSource-linkButton"></pre><script>showSource('linkButton')</script>
<div id="div-linkButton"></div>
<h2 id="linkIcon"><a href="#linkIcon">linkIcon</a></h2>
<script id="script-linkIcon">
window.addEventListener('DOMContentLoaded', (event) => {
$('#div-linkIcon').appendChild(UI.widgets.linkIcon(
document,
UI.rdf.namedNode('https://example.com/'))
)
$('#div-linkIcon').appendChild(UI.widgets.linkIcon(
document,
UI.rdf.namedNode('https://example.org/'),
'https://solidproject.org/favicon.ico')
)
})
</script>
<pre id="viewSource-linkIcon"></pre><script>showSource('linkIcon')</script>
<div id="div-linkIcon"></div>
<h2 id="openHrefInOutlineMode"><a href="#openHrefInOutlineMode">openHrefInOutlineMode</a></h2>
<script id="script-openHrefInOutlineMode">
window.addEventListener('DOMContentLoaded', (event) => {
document.outlineManager = {
GotoSubject: (object) => {
window.alert('You told the outlineManager to go to subject ' + object.uri)
}
}
const anchor = document.createElement('a')
anchor.setAttribute('href', 'http://example.com')
anchor.onclick = (e) => {
UI.widgets.openHrefInOutlineMode(e)
return false
}
anchor.appendChild(document.createTextNode('click me'))
$('#div-openHrefInOutlineMode').appendChild(anchor)
})
</script>
<pre id="viewSource-openHrefInOutlineMode"></pre><script>showSource('openHrefInOutlineMode')</script>
<div id="div-openHrefInOutlineMode"></div>
<h2 id="personTR"><a href="#personTR">personTR</a></h2>
<script id="script-personTR">
window.addEventListener('DOMContentLoaded', (event) => {
const michiel = UI.rdf.namedNode('https://michielbdejong.inrupt.net/profile/card#me')
const result = UI.widgets.personTR(document, null, michiel)
$('#div-personTR').appendChild(result)
})
</script>
<pre id="viewSource-personTR"></pre><script>showSource('personTR')</script>
<div id="div-personTR"></div>
<h2 id="propertyTriage"><a href="#propertyTriage">propertyTriage</a></h2>
<script id="script-propertyTriage">
window.addEventListener('DOMContentLoaded', (event) => {
// FIXME: make this example return actual possible properties
const kb = UI.rdf.graph()
const result = UI.widgets.propertyTriage(kb)
$('#div-propertyTriage').appendChild(document.createTextNode(JSON.stringify(result)))
})
</script>
<pre id="viewSource-propertyTriage"></pre><script>showSource('propertyTriage')</script>
<div id="div-propertyTriage"></div>
<h2 id="refreshTree"><a href="#refreshTree">refreshTree</a></h2>
<script id="script-refreshTree">
window.addEventListener('DOMContentLoaded', (event) => {
setInterval(() => {
UI.widgets.refreshTree(document.body)
}, 1000)
const refreshable = document.createElement('p')
refreshable.refresh = () => {
refreshable.innerText = new Date().getTime()
}
$('#div-refreshTree').appendChild(refreshable)
})
</script>
<pre id="viewSource-refreshTree"></pre><script>showSource('refreshTree')</script>
<div id="div-refreshTree"></div>
<h2 id="removeButton"><a href="#removeButton">removeButton</a></h2>
<script id="script-removeButton">
window.addEventListener('DOMContentLoaded', (event) => {
const p = document.createElement('p')
p.appendChild(document.createTextNode('click x to remove me'))
const button = UI.widgets.removeButton(document, p)
$('#div-removeButton').appendChild(p)
$('#div-removeButton').appendChild(button)
})
</script>
<pre id="viewSource-removeButton"></pre><script>showSource('removeButton')</script>
<div id="div-removeButton"></div>
<h2 id="shortDate"><a href="#shortDate">shortDate</a></h2>
<script id="script-shortDate">
window.addEventListener('DOMContentLoaded', (event) => {
const results = [
UI.widgets.shortDate('2020-01-01T15:43', true),
UI.widgets.shortDate('2020-01-01T15:43', false),
UI.widgets.shortDate(new Date().toISOString(), true),
UI.widgets.shortDate(new Date().toISOString(), false)
]
$('#div-shortDate').innerHTML = `<ul><li>${results.join('</li><li>')}</li></ul>`
})
</script>
<pre id="viewSource-shortDate"></pre><script>showSource('shortDate')</script>
<div id="div-shortDate"></div>
<h2 id="shortTime"><a href="#shortTime">shortTime</a></h2>
<script id="script-shortTime">
window.addEventListener('DOMContentLoaded', (event) => {
const result = UI.widgets.shortTime()
$('#div-shortTime').appendChild(document.createTextNode(result))
})
</script>
<pre id="viewSource-shortTime"></pre><script>showSource('shortTime')</script>
<div id="div-shortTime"></div>
<h2 id="selectorPanel"><a href="#selectorPanel">selectorPanel</a></h2>
<script id="script-selectorPanel">
window.addEventListener('DOMContentLoaded', (event) => {
const dom = document
const kb = UI.rdf.graph()
const type = UI.rdf.namedNode('http://example.com/#type')
const predicate = UI.rdf.namedNode('http://example.com/#pred')
const inverse = false
const possible = [
UI.rdf.namedNode('http://example.com/#blue'),
UI.rdf.namedNode('http://example.com/#green'),
UI.rdf.namedNode('http://example.com/#yellow')
]
const options = {}
function callbackFunction(thing, event, selected) {
if (selected) {
window.alert(`${thing.uri} selected!`)
} else {
window.alert(`${thing.uri} de-selected!`)
}
}
function linkCallback(thing, event, inverse, setStyleFunction) {
window.alert('link clicked? ' + thing.uri)
}
const result = UI.widgets.selectorPanel(
dom,
kb,
type,
predicate,
inverse,
possible,
options,
callbackFunction,
linkCallback
)
$('#div-selectorPanel').appendChild(result)
})
</script>
<pre id="viewSource-selectorPanel"></pre><script>showSource('selectorPanel')</script>
<div id="div-selectorPanel"></div>
<h2 id="selectorPanelRefresh"><a href="#selectorPanelRefresh">selectorPanelRefresh</a></h2>
<script id="script-selectorPanelRefresh">
window.addEventListener('DOMContentLoaded', (event) => {
const list = document.createElement('div')
const dom = document
const kb = UI.rdf.graph()
const type = UI.rdf.namedNode('http://example.com/#type')
const predicate = UI.rdf.namedNode('http://example.com/#pred')
const inverse = false
const possible = [
UI.rdf.namedNode('http://example.com/#blue'),
UI.rdf.namedNode('http://example.com/#green'),
UI.rdf.namedNode('http://example.com/#yellow')
]
const options = {}
function callbackFunction(thing, event, selected) {
if (selected) {
window.alert(`${thing.uri} selected!`)
} else {
window.alert(`${thing.uri} de-selected!`)
}
}
function linkCallback(thing, event, inverse, setStyleFunction) {
window.alert('link clicked? ' + thing.uri)
}
const result = UI.widgets.selectorPanelRefresh(
list,
dom,
kb,
type,
predicate,
inverse,
possible,
options,
callbackFunction,
linkCallback
)
$('#div-selectorPanelRefresh').appendChild(result)
})
</script>
<pre id="viewSource-selectorPanelRefresh"></pre><script>showSource('selectorPanelRefresh')</script>
<div id="div-selectorPanelRefresh"></div>
<h2 id="setImage"><a href="#setImage">setImage</a></h2>
<script id="script-setImage">
window.addEventListener('DOMContentLoaded', (event) => {
const myTrip = UI.rdf.namedNode('http://example.com/#trip')
UI.store.add(myTrip, UI.ns.rdf('type'), UI.ns.trip('Trip'))
const img = document.createElement('img')
img.setAttribute('style', 'height:50px;width:50px;')
UI.widgets.setImage(img, myTrip)
$('#div-setImage').appendChild(img)
})
</script>
<pre id="viewSource-setImage"></pre><script>showSource('setImage')</script>
<div id="div-setImage"></div>
<h2 id="setName"><a href="#setName">setName</a></h2>
<script id="script-setName">
window.addEventListener('DOMContentLoaded', (event) => {
const myTrip = UI.rdf.namedNode('http://example.com/#trip')
UI.store.add(myTrip, UI.ns.foaf('name'), 'My Trip')
UI.widgets.setName($('#div-setName'), myTrip)
})
</script>
<pre id="viewSource-setName"></pre><script>showSource('setName')</script>
<div id="div-setName"></div>
<h2 id="tempSite"><a href="#tempSite">tempSite</a></h2>
<script id="script-tempSite">
window.addEventListener('DOMContentLoaded', (event) => {
const myTrip = UI.rdf.namedNode('http://example.com/#trip')
const result = UI.widgets.tempSite(myTrip)
$('#div-tempSite').appendChild(document.createTextNode(result))
})
</script>
<pre id="viewSource-tempSite"></pre><script>showSource('tempSite')</script>
<div id="div-tempSite"></div>
<h2 id="timestamp"><a href="#timestamp">timestamp</a></h2>
<script id="script-timestamp">
window.addEventListener('DOMContentLoaded', (event) => {
const result = UI.widgets.timestamp()
$('#div-timestamp').appendChild(document.createTextNode(result))
})
</script>
<pre id="viewSource-timestamp"></pre><script>showSource('timestamp')</script>
<div id="div-timestamp"></div>
</body>
</html>