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

added versioning id token to data attribute in example data

parent a706ef7c
......@@ -16,7 +16,7 @@ function signatures_v0(fragments){
//replace the message in the signature to what's actually in the DOM
var obj = JSON.parse(signature_string);
if(fragment_type == "data-pop-v0-img")
if(fragment_type == "data-pop-v0-id-img")
{
//calculate hash of the image in the backend based on this url
obj.message = node.getAttribute('src');
......@@ -34,7 +34,7 @@ function signatures_v0(fragments){
//1. find all elements with data-pop-* attributes,
let known_versions = ["0"];
let known_categories = ["title","abstract","author","img","body"];
let known_attributes = known_versions.map(v => known_categories.map(c => "[data-pop-v" + v + "-" + c + "]")).flat();
let known_attributes = known_versions.map(v => known_categories.map(c => "[data-pop-v" + v + "-id-" + c + "]")).flat();
let fragment_selector = known_attributes.join();
let fragments = document.querySelectorAll(fragment_selector);
......
......@@ -19,19 +19,19 @@ if (window.hasRun) {
let envelope = state.envelopes[i];
switch(fragmentType) {
case 'data-pop-v0-title':
case 'data-pop-v0-id-title':
renderTitle(fragmentType,message,result,envelope);
break;
case 'data-pop-v0-abstract':
case 'data-pop-v0-id-abstract':
renderAbstract(fragmentType,message,result,envelope);
break;
case 'data-pop-v0-body':
case 'data-pop-v0-id-body':
renderBody(fragmentType,message,result,envelope);
break;
case 'data-pop-v0-author':
case 'data-pop-v0-id-author':
renderAuthor(fragmentType,message,result,envelope);
break;
case 'data-pop-v0-img':
case 'data-pop-v0-id-img':
renderImage(fragmentType,message,result,envelope);
break;
}
......@@ -50,7 +50,7 @@ if (window.hasRun) {
//creates a blockquote (or img) for the message that contains the original envelope as attribute
function toClipboard(message, envelope, type){
if(type == 'data-pop-v0-img'){
if(type == 'data-pop-v0-id-img'){
let img = document.createElement('img');
img.src = message;
img.setAttribute(type,envelope);
......
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