diff --git a/src/js/portfolio.js b/src/js/portfolio.js index b49f3db..1b0c630 100644 --- a/src/js/portfolio.js +++ b/src/js/portfolio.js @@ -32,6 +32,9 @@ function getNodeLabel(node){ } function getNodeYear(n){ if(typeof n['https://schema.org/dateCreated'] !== 'undefined') { + if(n['https://schema.org/dateCreated'].length == 9){ + return n['https://schema.org/dateCreated']; + } return n['https://schema.org/dateCreated'].substr(0,4); } if(typeof n['https://schema.org/datePublished'] !== 'undefined') { @@ -39,7 +42,8 @@ function getNodeYear(n){ } if(typeof n['https://schema.org/startDate'] !== 'undefined') { // console.log(n['https://schema.org/startDate']); - return n['https://schema.org/startDate'].substr(0,4); + const year = n['https://schema.org/startDate'].substr(0,4); + return year; } if(typeof n['https://schema.org/endDate'] !== 'undefined') { return n['https://schema.org/endDate'].substr(0,4); @@ -593,9 +597,11 @@ var setDetails = function(nodeDatum, nodeIdx) { } else if(attr == 'https://schema.org/contentUrl') { listEl.innerHTML += `
${getDisplayAttr(attr)}
${nodeAttr[i]}
`; if(nodeDatum['@type'] == 'https://schema.org/VideoObject') { - let videoType = nodeAttr['https://schema.org/encodingFormat'] ? `type='${nodeAttr['https://schema.org/encodingFormat']}'`: ""; - let poster = nodeAttr['https://schema.org/thumbnailUrl'] ? `poster='${nodeAttr['https://schema.org/thumbnailUrl']}'`: ""; - listEl.innerHTML += `
`; + // console.log(nodeDatum, nodeAttr); + let videoType = nodeDatum['https://schema.org/encodingFormat'] ? `type='${nodeDatum['https://schema.org/encodingFormat']}'`: ""; + let poster = nodeDatum['https://schema.org/thumbnailUrl'] ? `poster='${nodeDatum['https://schema.org/thumbnailUrl']}'`: ""; + // TODO: enable outplay and make it work (for some reason it does not...) + listEl.innerHTML += `
`; } else{ listEl.innerHTML += `
`; } @@ -672,7 +678,13 @@ var setDetails = function(nodeDatum, nodeIdx) { if(typeof rel['https://schema.org/contentUrl'] != 'undefined') { let ddEl = document.createElement('dd') ddEl.classList.add('dd-contentobject'); - ddEl.innerHTML = `` + if(rel['@type'] == 'https://schema.org/VideoObject') { + let videoType = rel['https://schema.org/encodingFormat'] ? `type='${rel['https://schema.org/encodingFormat']}'`: ""; + let poster = rel['https://schema.org/thumbnailUrl'] ? `poster='${rel['https://schema.org/thumbnailUrl']}'`: ""; + ddEl.innerHTML += ``; + } else{ + ddEl.innerHTML = `` + } relsEl.appendChild(ddEl); } } @@ -1066,6 +1078,16 @@ node.each(function(d) { .attr("preserveAspectRatio","xMidYMid slice") ; }); +node.each(function(d) { + if(d['@type'] !== 'https://schema.org/VideoObject') { + return; + } + const size = getSizeForNode(d); + d3.select(this).append('svg:polygon') + .attr('points', "-10,-10, -10,10, 10,0") + .attr("class","play") + ; + }); simulation .nodes(graph.nodes) diff --git a/src/scss/portfolio.scss b/src/scss/portfolio.scss index 3679ab0..77d1e5b 100644 --- a/src/scss/portfolio.scss +++ b/src/scss/portfolio.scss @@ -127,7 +127,10 @@ g.node{ text-anchor:middle; } } - &.ImageObject{ + .play{ + fill:white; + } + &.ImageObject, &.VideoObject, &.BroadcastEvent{ text.nodeTitle { display: none; }