forked from SolidOS/mashlib
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbookmark-test.html
More file actions
89 lines (79 loc) · 2.63 KB
/
bookmark-test.html
File metadata and controls
89 lines (79 loc) · 2.63 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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Bookmark Pane Test</title>
<link rel="stylesheet" href="/mash.css">
<style>
body {
font-family: system-ui, sans-serif;
margin: 0;
padding: 20px;
}
h1 {
margin-top: 0;
}
#outline {
border: 1px solid #ccc;
min-height: 400px;
padding: 10px;
}
.controls {
margin-bottom: 20px;
padding: 10px;
background: #f5f5f5;
border-radius: 4px;
}
.controls button {
margin-right: 10px;
padding: 8px 16px;
cursor: pointer;
}
</style>
</head>
<body>
<h1>Bookmark Pane Test</h1>
<div class="controls">
<button onclick="loadBookmarks()">Load Test Bookmarks</button>
<button onclick="loadSingleBookmark()">Load Single Bookmark</button>
</div>
<div id="outline"></div>
<script src="/mashlib.js"></script>
<script>
const outliner = panes.getOutliner(document)
async function loadBookmarks() {
// Load the test bookmarks file (container-like view)
const subject = $rdf.sym(window.location.origin + '/test-bookmarks.ttl')
// First fetch the data
try {
await SolidLogic.store.fetcher.load(subject)
console.log('Loaded bookmarks data')
// Clear and render
document.getElementById('outline').innerHTML = ''
outliner.GotoSubject(subject, true, undefined, true, undefined)
} catch (e) {
console.error('Failed to load:', e)
alert('Failed to load bookmarks: ' + e.message)
}
}
async function loadSingleBookmark() {
// Load a single bookmark
const subject = $rdf.sym(window.location.origin + '/test-bookmarks.ttl#bookmark1')
try {
await SolidLogic.store.fetcher.load(subject.doc())
console.log('Loaded bookmark data')
document.getElementById('outline').innerHTML = ''
outliner.GotoSubject(subject, true, undefined, true, undefined)
} catch (e) {
console.error('Failed to load:', e)
alert('Failed to load bookmark: ' + e.message)
}
}
// Auto-load on page load
window.onload = () => {
console.log('Bookmark pane test page loaded')
console.log('Click a button to test the bookmark pane')
}
</script>
</body>
</html>