aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpukkamustard <pukkamustard@posteo.net>2020-06-09 17:50:12 +0200
committerpukkamustard <pukkamustard@posteo.net>2020-06-09 17:50:12 +0200
commit564b34788e9bbc1968e4e3e8a8d213292da507df (patch)
tree8c44bcaae6261eca40cdd3707e0313c785637612
parent1a7e3a464536dbf4ef91b995b93ac9977fa96cb7 (diff)
web-demo: JSON-LD sample data
-rw-r--r--examples/web-demo/index.html6
-rw-r--r--examples/web-demo/index.js21
-rw-r--r--examples/web-demo/src/index.js21
-rw-r--r--examples/web-demo/style.css2
4 files changed, 50 insertions, 0 deletions
diff --git a/examples/web-demo/index.html b/examples/web-demo/index.html
index 85b4119..c58e164 100644
--- a/examples/web-demo/index.html
+++ b/examples/web-demo/index.html
@@ -23,6 +23,10 @@
Load sample vocabulary
</button>
+ <button id="input-load-sample-actor">
+ Load sample ActivityPub Actor (JSON-LD)
+ </button>
+
</div>
<div id="controls">
@@ -40,8 +44,10 @@
<div id="encoded">
<h2>Encoded</h2>
+ <h3>ERIS URN</h3>
<input id="encoded-eris-urn" type="url" readonly>
</input>
+ <h3>encoded data</h3>
<pre id="encoded-data"></pre>
</div>
diff --git a/examples/web-demo/index.js b/examples/web-demo/index.js
index a8b5c7a..7d68994 100644
--- a/examples/web-demo/index.js
+++ b/examples/web-demo/index.js
@@ -58395,6 +58395,20 @@ const signify = `
rdfs:domain <#Signature> .
`
+const alyssa = `
+{"@context": "https://www.w3.org/ns/activitystreams",
+ "type": "Person",
+ "id": "https://social.example/alyssa/",
+ "name": "Alyssa P. Hacker",
+ "preferredUsername": "alyssa",
+ "summary": "Lisp enthusiast hailing from MIT",
+ "inbox": "https://social.example/alyssa/inbox/",
+ "outbox": "https://social.example/alyssa/outbox/",
+ "followers": "https://social.example/alyssa/followers/",
+ "following": "https://social.example/alyssa/following/",
+ "liked": "https://social.example/alyssa/liked/"}
+`
+
function rdfParse (input, contentType) {
return new Promise((resolve, reject) => {
const textStream = Streamify(input)
@@ -58422,7 +58436,9 @@ async function main () {
// get elements from dom
const inputTextarea = document.getElementById('input-textarea')
+ const inputLoadSampleText = document.getElementById('input-load-sample-text')
const inputLoadSampleVocabulary = document.getElementById('input-load-sample-vocabulary')
+ const inputLoadSampleActor = document.getElementById('input-load-sample-actor')
const controlsEncode = document.getElementById('controls-encode')
const controlsInputType = document.getElementById('controls-input-type')
const encodedErisUrn = document.getElementById('encoded-eris-urn')
@@ -58470,6 +58486,11 @@ async function main () {
inputTextarea.value = signify
controlsInputType.value = 'text/turtle'
}
+
+ inputLoadSampleActor.onclick = function (e) {
+ inputTextarea.value = alyssa
+ controlsInputType.value = 'application/ld+json'
+ }
}
window.onload = () => {
diff --git a/examples/web-demo/src/index.js b/examples/web-demo/src/index.js
index 5e7e24c..2725adf 100644
--- a/examples/web-demo/src/index.js
+++ b/examples/web-demo/src/index.js
@@ -44,6 +44,20 @@ const signify = `
rdfs:domain <#Signature> .
`
+const alyssa = `
+{"@context": "https://www.w3.org/ns/activitystreams",
+ "type": "Person",
+ "id": "https://social.example/alyssa/",
+ "name": "Alyssa P. Hacker",
+ "preferredUsername": "alyssa",
+ "summary": "Lisp enthusiast hailing from MIT",
+ "inbox": "https://social.example/alyssa/inbox/",
+ "outbox": "https://social.example/alyssa/outbox/",
+ "followers": "https://social.example/alyssa/followers/",
+ "following": "https://social.example/alyssa/following/",
+ "liked": "https://social.example/alyssa/liked/"}
+`
+
function rdfParse (input, contentType) {
return new Promise((resolve, reject) => {
const textStream = Streamify(input)
@@ -71,7 +85,9 @@ async function main () {
// get elements from dom
const inputTextarea = document.getElementById('input-textarea')
+ const inputLoadSampleText = document.getElementById('input-load-sample-text')
const inputLoadSampleVocabulary = document.getElementById('input-load-sample-vocabulary')
+ const inputLoadSampleActor = document.getElementById('input-load-sample-actor')
const controlsEncode = document.getElementById('controls-encode')
const controlsInputType = document.getElementById('controls-input-type')
const encodedErisUrn = document.getElementById('encoded-eris-urn')
@@ -119,6 +135,11 @@ async function main () {
inputTextarea.value = signify
controlsInputType.value = 'text/turtle'
}
+
+ inputLoadSampleActor.onclick = function (e) {
+ inputTextarea.value = alyssa
+ controlsInputType.value = 'application/ld+json'
+ }
}
window.onload = () => {
diff --git a/examples/web-demo/style.css b/examples/web-demo/style.css
index f9ea248..1f784a4 100644
--- a/examples/web-demo/style.css
+++ b/examples/web-demo/style.css
@@ -39,5 +39,7 @@ textarea {
#encoded-data {
white-space: pre-wrap;
+ max-height: 400px;
+ overflow: auto;
}