Commit b7e4fdd1 authored by taco@waag.org's avatar taco@waag.org
Browse files

label, content and verification result

parent 0cc1f53c
......@@ -19,36 +19,44 @@ if (window.hasRun) {
switch(fragmentType){
case 'data-pop-v0-title':
renderTitle(message,result);
renderTitle(fragmentType,message,result);
break;
case 'data-pop-v0-abstract':
renderAbstract(message,result);
renderAbstract(fragmentType,message,result);
break;
case 'data-pop-v0-body':
renderBody(message,result);
renderBody(fragmentType,message,result);
break;
case 'data-pop-v0-author':
renderAuthor(message,result);
renderAuthor(fragmentType,message,result);
break;
case 'data-pop-v0-img':
renderImage(message,result);
renderImage(fragmentType,message,result);
break;
}
}
}
function appendLabel(fragment,type){
let label = document.createElement('div');
label.classList.add('pop-label');
label.textContent = type;
fragment.appendChild(label);
}
function appendProof(fragment,result){
let proof_string = JSON.stringify(result);
let proof = document.createElement('span');
let proof = document.createElement('div');
proof.classList.add('pop-proof');
proof.textContent = proof_string;
fragment.appendChild(proof);
}
function renderTitle(content, result){
function renderTitle(type, content, result){
let fragment = document.createElement('div');
fragment.classList.add('pop-title');
appendLabel(fragment, type);
let header = document.createElement('h1');
header.textContent = content;
......@@ -57,9 +65,10 @@ if (window.hasRun) {
document.body.appendChild(fragment);
}
function renderAbstract(content, result){
function renderAbstract(type, content, result){
let fragment = document.createElement('div');
fragment.classList.add('pop-abstract');
appendLabel(fragment, type);
let p = document.createElement('pre');
p.textContent = content;
......@@ -69,9 +78,10 @@ if (window.hasRun) {
document.body.appendChild(fragment);
}
function renderBody(content, result){
function renderBody(type, content, result){
let fragment = document.createElement('div');
fragment.classList.add('pop-body');
appendLabel(fragment, type);
let p = document.createElement('pre');
p.textContent = content;
......@@ -81,9 +91,10 @@ if (window.hasRun) {
document.body.appendChild(fragment);
}
function renderAuthor(content, result){
function renderAuthor(type, content, result){
let fragment = document.createElement('div');
fragment.classList.add('pop-author');
appendLabel(fragment, type);
let p = document.createElement('pre');
p.textContent = content;
......@@ -93,9 +104,10 @@ if (window.hasRun) {
document.body.appendChild(fragment);
}
function renderImage(content, result){
function renderImage(type, content, result){
let fragment = document.createElement('div');
fragment.classList.add('pop-image');
appendLabel(fragment, type);
let p = document.createElement('img');
p.src = content;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment