|
9 | 9 | </script> |
10 | 10 | </head> |
11 | 11 | <body> |
12 | | - <h2 id="addStyleSheet"><a href="#addStyleSheet">addStyleSheet</a></h2> |
| 12 | + <!-- <h2 id="addStyleSheet"><a href="proxy.php?url=https%3A%2F%2Fgithub.com%2FJavaScriptSolidServer%2Fsolid-ui%2Fcommit%2Fb35df8c30e85427e84d18c14fe8b0857bc2c776e%23addStyleSheet">addStyleSheet</a></h2> |
13 | 13 | <script id="script-addStyleSheet"> |
14 | 14 | window.addEventListener('DOMContentLoaded', (event) => { |
15 | 15 | UI.widgets.addStyleSheet(document, 'https://linkeddata.github.io/tabulator-firefox/content/tabbedtab.css') |
@@ -203,23 +203,43 @@ <h2 id="fileUploadButtonDiv"><a href="#fileUploadButtonDiv"><a href="#fileUpload |
203 | 203 | }) |
204 | 204 | </script> |
205 | 205 | <pre id="viewSource-fileUploadButtonDiv"></pre><script>$('#viewSource-fileUploadButtonDiv').innerHTML = $('#script-fileUploadButtonDiv').innerText</script> |
206 | | - <div id="div-fileUploadButtonDiv"></div> |
| 206 | + <div id="div-fileUploadButtonDiv"></div> --> |
207 | 207 |
|
208 | 208 | <h2 id="findImage"><a href="#findImage">findImage</a></h2> |
209 | 209 | <script id="script-findImage"> |
| 210 | + // FIXME: not sure why agentNode.sameTerm(UI.ns.foaf('Agent')) is false |
| 211 | + function displayFindImageResult(url) { |
| 212 | + const node = UI.rdf.namedNode(url) |
| 213 | + const result = UI.widgets.findImage(node) |
| 214 | + const image = document.createElement('img') |
| 215 | + image.setAttribute('src', result) |
| 216 | + image.setAttribute('style', 'width: 100px; height: 100px;') |
| 217 | + $('#div-findImage').appendChild(image) |
| 218 | + } |
210 | 219 | window.addEventListener('DOMContentLoaded', (event) => { |
211 | | - // const result = UI.widgets.findImage() |
212 | | - // $('#div-findImage').appendChild(document.createTextNode(result)) |
| 220 | + const agentNode = UI.rdf.namedNode('https://example.com/#agent') |
| 221 | + UI.store.add(agentNode, UI.ns.rdf('type'), UI.ns.foaf('Agent')) |
| 222 | + displayFindImageResult(agentNode) |
213 | 223 | }) |
214 | 224 | </script> |
215 | 225 | <pre id="viewSource-findImage"></pre><script>$('#viewSource-findImage').innerHTML = $('#script-findImage').innerText</script> |
216 | 226 | <div id="div-findImage"></div> |
217 | 227 |
|
218 | 228 | <h2 id="findImageFromURI"><a href="#findImageFromURI">findImageFromURI</a></h2> |
219 | 229 | <script id="script-findImageFromURI"> |
220 | | - window.addEventListener('DOMContentLoaded', (event) => { |
221 | | - // const result = UI.widgets.findImageFromURI() |
222 | | - // $('#div-findImageFromURI').appendChild(document.createTextNode(result)) |
| 230 | + function displayFindImageFromURIResult(url) { |
| 231 | + const node = UI.rdf.namedNode(url) |
| 232 | + const result = UI.widgets.findImageFromURI(node) |
| 233 | + const image = document.createElement('img') |
| 234 | + image.setAttribute('src', result) |
| 235 | + image.setAttribute('style', 'width: 100px; height: 100px;') |
| 236 | + $('#div-findImageFromURI').appendChild(image) |
| 237 | + } |
| 238 | + window.addEventListener('DOMContentLoaded', (event) => { |
| 239 | + displayFindImageFromURIResult('https://example.com/') |
| 240 | + displayFindImageFromURIResult('https://solidproject.org/some/file.html') |
| 241 | + displayFindImageFromURIResult('mid:asdf') |
| 242 | + displayFindImageFromURIResult('mailto:user@example.com') |
223 | 243 | }) |
224 | 244 | </script> |
225 | 245 | <pre id="viewSource-findImageFromURI"></pre><script>$('#viewSource-findImageFromURI').innerHTML = $('#script-findImageFromURI').innerText</script> |
|
0 commit comments