mashlib 1.10.2-73f2af57 → 1.10.2-91b9595f

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,135 @@
1
+ <!DOCTYPE html>
2
+ <html id="docHTML">
3
+ <head>
4
+ <meta content="text/html; charset=UTF-8" http-equiv="content-type">
5
+ <link type="text/css" rel="stylesheet" href="mash.css" />
6
+ <script type="text/javascript" src="mashlib.js"></script>
7
+ <script>
8
+ document.addEventListener('DOMContentLoaded', function() {
9
+ const authn = UI.authn
10
+ const authSession = UI.authn.authSession
11
+ const store = UI.store
12
+ const $rdf = UI.rdf
13
+ const dom = document
14
+ $rdf.Fetcher.crossSiteProxyTemplate = self.origin + '/xss?uri={uri}'
15
+ const uri = window.location.href
16
+ window.document.title = 'SolidOS Web App: ' + uri
17
+ const outliner = panes.getOutliner(dom) //function from solid-panes
18
+
19
+ function go (event) {
20
+ let uri = $rdf.uri.join(uriField.value, window.location.href)
21
+ console.log("User field " + uriField.value)
22
+ console.log("User requests " + uri)
23
+
24
+ const params = new URLSearchParams(location.search)
25
+ params.set('uri', uri);
26
+ window.history.replaceState({}, '', `${location.origin}${location.pathname}?${params}`);
27
+
28
+ var subject = $rdf.sym(uri);
29
+ outliner.GotoSubject(subject, true, undefined, true, undefined);
30
+ mungeLoginArea();
31
+ }
32
+
33
+ const uriField = dom.getElementById('uriField')
34
+ const goButton = dom.getElementById('goButton')
35
+ const loginButtonArea = document.getElementById("loginButtonArea");
36
+ const webIdArea = dom.getElementById('webId')
37
+ const banner = dom.getElementById('inputArea')
38
+
39
+ uriField.addEventListener('keyup', function (e) {
40
+ if (e.keyCode === 13) {
41
+ go(e)
42
+ }
43
+ }, false)
44
+
45
+ goButton.addEventListener('click', go, false);
46
+ let initial = new URLSearchParams(self.location.search).get("uri")
47
+ if (initial) {
48
+ uriField.value = initial
49
+ go()
50
+ } else {
51
+ console.log('ready for user input')
52
+ }
53
+ async function mungeLoginArea(){
54
+ loginButtonArea.innerHTML="";
55
+ if(uriField.value) {
56
+ loginButtonArea.appendChild(UI.login.loginStatusBox(document, null, {}))
57
+ }
58
+ const me = authn.currentUser()
59
+ if (me) {
60
+ const logoutButton = loginButtonArea.querySelector('input');
61
+ logoutButton.value = "Logout";
62
+ let displayId = `&lt;${me.value}>`;
63
+ webIdArea.innerHTML = displayId;
64
+ banner.style.backgroundColor="#bbccbb";
65
+ } else {
66
+ banner.style.backgroundColor="#ccbbbb";
67
+ }
68
+ loginButtonArea.style.display="inline-block";
69
+ }
70
+
71
+ if (authSession) {
72
+ authSession.onLogin(() => {
73
+ mungeLoginArea();
74
+ go()
75
+ })
76
+ authSession.onLogout(() => {
77
+ mungeLoginArea();
78
+ webIdArea.innerHTML = "public user";
79
+ go()
80
+ })
81
+ authSession.onSessionRestore((url) => {
82
+ mungeLoginArea();
83
+ go()
84
+ })
85
+ }
86
+ mungeLoginArea();
87
+ });
88
+ </script>
89
+ </head>
90
+ <body>
91
+
92
+ <div style="width:100%;" id="inputArea">
93
+ <div style="margin-bottom:0.6em">
94
+ The SolidOS Databrowser
95
+ </div>
96
+ <div style="margin-left:1em">
97
+ Viewing <input id="uriField" type="text" style="font-size:100%; min-width:25em; padding:0.5em;" placeholder="enter a pod address e.g. https://you.solidcommunity.net/"/> <input type="button" id="goButton" value="Go" />
98
+ </div>
99
+ <div style="margin-top:0.5em;margin-left:1em">
100
+ As user <span id="webId">&lt;public user></span> <span id="loginButtonArea"></span>
101
+ </div>
102
+ </div>
103
+
104
+ <table style="width:100%;">
105
+ <tr>
106
+ <div class="TabulatorOutline" id="DummyUUID" role="main">
107
+ <table id="outline"></table>
108
+ <div id="GlobalDashboard"></div>
109
+ </div>
110
+ </tr>
111
+ </table>
112
+
113
+ <style>
114
+ #inputArea {
115
+ width:100%;
116
+ padding:0.5em;
117
+ background-color:#d0d0d0;
118
+ }
119
+ #loginButtonArea input {
120
+ display:inline-block;
121
+ margin:0.25em !important;
122
+ padding:0.25em !important;
123
+ }
124
+ #webId {
125
+ display:inline-block;
126
+ padding-top:0.6em;
127
+ padding-bottom:0.6em;
128
+ }
129
+ #uriField {
130
+ width:70%;
131
+ margin-top:0.6em !important;
132
+ }
133
+ </style>
134
+
135
+ </body></html>