2 lines
20 KiB
JavaScript
2 lines
20 KiB
JavaScript
"use strict";var data,graph,_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function getLabelAttribute(e){if(void 0!==e["https://schema.org/name"])return"https://schema.org/name";switch(e["@type"]){case"https://schema.org/WebSite":if(void 0!==e["https://schema.org/url"])return"https://schema.org/url";break;case"https://schema.org/ImageObject":if(void 0!==e["https://schema.org/caption"])return"https://schema.org/caption";if(void 0!==e["https://schema.org/contentUrl"])return"https://schema.org/contentUrl";break;case"https://schema.org/PostalAddress":if(void 0!==e["https://schema.org/addressLocality"])return"https://schema.org/addressLocality"}return"@id"}function getNodeLabel(e){var t=e[getLabelAttribute(e)];return void 0===t&&(t=e["@id"]),void 0===t&&(t=""),t}function getNodeYear(e){return void 0!==e["https://schema.org/dateCreated"]?e["https://schema.org/dateCreated"].substr(0,4):void 0!==e["https://schema.org/datePublished"]?e["https://schema.org/datePublished"].substr(0,4):void 0!==e["https://schema.org/startDate"]?(console.log(e["https://schema.org/startDate"]),e["https://schema.org/startDate"].substr(0,4)):void 0!==e["https://schema.org/endDate"]?e["https://schema.org/endDate"].substr(0,4):void 0!==e["https://schema.org/foundingDate"]?e["https://schema.org/foundingDate"].substr(0,4):void 0!==e["https://schema.org/temporalCoverage"]&&e["https://schema.org/temporalCoverage"].match(/\d{4}-\d{4}/)?e["https://schema.org/temporalCoverage"].substr(5,4):null}function getDisplayAttr(e){return e.replace(/.*[#|\/]/,"")}function jsonLdToGraph(e){var t={},r=[];for(var n in e)t[e[n]["@id"]]=e[n];for(var a in e){var o=e[a],i=o["@id"];for(var s in o){var d=Array.isArray(o[s])?o[s]:[o[s]];for(var c in d)"@id"!==s&&"string"==typeof d[c]&&t[d[c]]?r[r.length]={source:i,target:d[c],name:s}:void 0!==d[c]["@id"]&&(1==Object.keys(d[c]).length&&void 0===t[d[c]["@id"]]||(r[r.length]={source:i,target:d[c]["@id"],name:s}))}}return{nodes:Object.values(t),links:r}}var nodeMap={},linkMap={},breadcrumbs={},requestPromise=fetch("/assets/js/rubenvandeven.jsonld").then(function(e){return e.json()}).then(function(e){for(var t in(graph=jsonLdToGraph(e["@graph"])).nodes)nodeMap[graph.nodes[t]["@id"]]=graph.nodes[t];startGraph(graph)});function inCircle(e,t,r){var n=Math.abs(e),a=Math.abs(t);return!(r<n||r<a)&&(n+a<=r||Math.pow(e,2)+Math.pow(t,2)<=Math.pow(r,2))}function createLinkMap(e){var t={},r=!0,n=!1,a=void 0;try{for(var o,i=e.links[Symbol.iterator]();!(r=(o=i.next()).done);r=!0){var s=o.value;void 0===t[s.source]&&(t[s.source]=[]),t[s.source][t[s.source].length]={id:s.target,name:s.name},void 0===t[s.target]&&(t[s.target]=[]),t[s.target][t[s.target].length]={id:s.source,name:s.name}}}catch(e){n=!0,a=e}finally{try{!r&&i.return&&i.return()}finally{if(n)throw a}}return t}var nodeSize=40,selectedNodeSize=140,firstNodeId="https://rubenvandeven.com/";function getSizeForNode(e){return e.hasOwnProperty("https://schema.org/thumbnailUrl")?nodeSize:e["@id"]==firstNodeId?1.2*nodeSize:nodeSize*(.7+Math.min(20,linkMap[e["@id"]].length)/40)}function createBreadcrumbs(c,e){var l={},t=function(e){var t=l[e].slice();t.push(e);var r=[],n=!0,a=!1,o=void 0;try{for(var i,s=c[e][Symbol.iterator]();!(n=(i=s.next()).done);n=!0){var d=i.value;void 0===l[d.id]&&(l[d.id]=t,r.push(d.id))}}catch(e){a=!0,o=e}finally{try{!n&&s.return&&s.return()}finally{if(a)throw o}}return r};l[e]=[];for(var r=[e];0<r.length;){var n=[],a=!0,o=!1,i=void 0;try{for(var s,d=r[Symbol.iterator]();!(a=(s=d.next()).done);a=!0){var u=t(s.value);n=n.concat(u)}}catch(e){o=!0,i=e}finally{try{!a&&d.return&&d.return()}finally{if(o)throw i}}r=n}return l}var nodePositions={};function startGraph(z){var d=0,t={};for(var e in linkMap=createLinkMap(z),breadcrumbs=createBreadcrumbs(linkMap,firstNodeId),z.nodes){var r=z.nodes[e]["@type"];void 0===t[r]&&(t[r]=[]),t[r].push(e)}document.getElementById("graphControls");var a=document.getElementById("typeLinks"),n=document.getElementById("showMoreTypeLinks"),o=document.getElementById("moreTypeLinks"),s=(document.getElementById("relLinks"),Object.keys(t).map(function(e){return[e,t[e].length]}));s.sort(function(e,t){return t[1]-e[1]});var c=0,i=function(e){var i=s[e][0],t=document.createElement("li"),r=document.createElement("a"),n=document.createElement("span");n.innerHTML=s[e][1],n.classList.add("typeCount"),r.innerHTML=getDisplayAttr(i),r.title=i,r.addEventListener("click",function(){U(i)}),r.addEventListener("mouseover",function(){var e=document.getElementsByClassName(i),t=!0,r=!1,n=void 0;try{for(var a,o=e[Symbol.iterator]();!(t=(a=o.next()).done);t=!0){a.value.classList.add("typeHighlight")}}catch(e){r=!0,n=e}finally{try{!t&&o.return&&o.return()}finally{if(r)throw n}}}),r.addEventListener("mouseout",function(){var e=document.getElementsByClassName(i),t=!0,r=!1,n=void 0;try{for(var a,o=e[Symbol.iterator]();!(t=(a=o.next()).done);t=!0){a.value.classList.remove("typeHighlight")}}catch(e){r=!0,n=e}finally{try{!t&&o.return&&o.return()}finally{if(r)throw n}}}),t.append(r),t.append(n),(c<5?a:o).appendChild(t),c++};for(var l in s)i(l);n.addEventListener("click",function(){document.body.classList.add("showMoreLinks");document.body.addEventListener("mouseup",function e(t){t.preventDefault(),t.stopPropagation(),document.body.removeEventListener("mouseup",e,!0),document.body.classList.remove("showMoreLinks")},!0)},!1);var u,h,m=d3.select("svg"),p=(m.attr("width"),m.attr("height"),m.append("g").attr("id","container")),f=d3.forceSimulation().force("link",d3.forceLink().id(function(e){return e["@id"]}).strength(.005)).force("charge",d3.forceManyBody()).force("collision",d3.forceCollide(function(e){return 1.1*getSizeForNode(e)})),g=p.append("g").attr("class","links").selectAll(".relationship").data(z.links).enter().append("g").attr("class",function(e){return"relationship "+e.name}),v=g.append("line").attr("marker-end","url(#arrowHead)"),y=g.append("text").text(function(e){return getDisplayAttr(e.name)}),B=p.append("g").attr("class","nodes").selectAll(".node").data(z.nodes).enter().append("g").attr("class",function(e){var t="node "+e["@type"];if(e["@type"]){var r=e["@type"].lastIndexOf("/");-1<r&&(t+=" "+e["@type"].substr(r+1))}return t}),b=function(){return m.attr("viewBox").split(" ").map(parseFloat)},L=function(e){w(),"object"==(void 0===e?"undefined":_typeof(e))&&null!==e&&1==e.length&&(e=e[0]),nodePositions={},null!==e&&("object"==(void 0===e?"undefined":_typeof(e))?x(e):nodePositions[e]=[u,h],B.each(function(e,t,r){void 0!==nodePositions[t]?(r[t].classList.add("centeredNode"),r[t].classList.add("visibleNode")):(r[t].classList.remove("centeredNode"),r[t].classList.remove("visibleNode"))}),f.alpha(1),f.restart())},x=function(e,t){var r=b(),n=A();w(),void 0===t&&(t=1==e.length?r[2]/6:r[2]/(4+Math.max(0,2.5-e.length))),d=t;for(var a=r[0]+r[2]/2-n.dx,o=r[1]+r[3]/2-n.dy,i=2*Math.PI/e.length,s=0;s<e.length;s++)nodePositions[e[s]]=[a+Math.sin(i*s)*t,o+Math.cos(i*s)*t];f.alpha(1),f.restart()},U=function(e,t){void 0===t&&(t=!0),Array.isArray(e)||(e=[e]);var r=[];for(var n in z.nodes)-1<e.indexOf(z.nodes[n]["@type"])&&(r[r.length]=n);M(),t?(console.log(e[0],getDisplayAttr(e[0]),e.map(getDisplayAttr)),history.pushState({types:e},"","/@type/"+e.map(getDisplayAttr).join("+"))):history.replaceState({types:e},"","/@type/"+e.map(getDisplayAttr).join("+")),L(r.length?r:null)},Y=(d3.transition().duration(750).ease(d3.easeLinear),document.getElementById("nodeDetails")),R=function(r,e){var t=document.createElement("dd");t.classList.add("relLink");var n=document.createElement("a");n.innerHTML=getNodeLabel(r),null!==getNodeYear(r)&&(n.innerHTML+="<span class='nodeYear'>"+getNodeYear(r)+"</span>"),n.classList.add("nodeTitle"),n.classList.add("nodeTitleNr"+e),n.addEventListener("click",function(e){var t=z.nodes.indexOf(r);q(t)});var a=document.createElement("a");return a.classList.add("nodeType"),a.innerHTML=getDisplayAttr(r["@type"]),a.title=r["@type"],a.addEventListener("click",function(e){U(r["@type"])}),t.appendChild(n),t.appendChild(a),t},q=function(n,e){void 0===e&&(e=!0);var a=null,i=null;if(B.each(function(e,t,r){t==n&&(a=r[n],i=e)}),a){var t=null;t=i["@id"].startsWith("https://rubenvandeven.com/")?i["@id"].substr(26):"?id="+i["@id"],e?history.pushState({node:n},getNodeLabel(i),"/"+t):history.replaceState({node:n},getNodeLabel(i),"/"+t),L(n);var s=breadcrumbs[i["@id"]].slice();s[s.length]=i["@id"];var d=[];g.each(function(n,e,t,r){n.source==i||n.target==i?(t[e].classList.add("activeLink","visibleLink"),t[e].getElementsByTagName("line")[0].setAttribute("marker-end","url(#arrowHeadSelected)"),B.filter(function(e,t){var r=e["@id"]==n.source["@id"]||e["@id"]==n.target["@id"];return r&&-1===d.indexOf(t)&&(d[d.length]=t),r}).classed("visibleNode",!0)):(t[e].classList.remove("activeLink"),t[e].getElementsByTagName("line")[0].setAttribute("marker-end","url(#arrowHead)"));var a=s.indexOf(n.source["@id"]),o=s.indexOf(n.target["@id"]);-1<a&&-1<o&&1==Math.abs(a-o)?(t[e].classList.add("breadcrumbLink"),t[e].getElementsByTagName("line")[0].setAttribute("marker-end","url(#arrowHeadCrumbTrail)")):t[e].classList.remove("breadcrumbLink")});var r=d.indexOf(n);-1!==r&&d.splice(r,1),x(d),function(t,n){for(document.body.classList.add("detailsOpen"),scrollToY(0,4e3);Y.hasChildNodes();)Y.removeChild(Y.lastChild);var e=[],r=[],a=[],o=document.createElement("div");o.id="nodeDetailsScaler",o.addEventListener("mousedown",function(e){var t=function(e){Y.style.width=window.innerWidth-e.clientX+5+"px"};document.body.addEventListener("mousemove",t),document.body.addEventListener("mouseup",function(){document.body.removeEventListener("mousemove",t)})}),nodeDetails.appendChild(o);var i=document.createElement("ul");i.classList.add("breadcrumbs");var s=function(r){var e=document.createElement("li"),t=document.createElement("span");t.classList.add("crumb"),t.addEventListener("click",function(e){var t=z.nodes.indexOf(nodeMap[r]);q(t)}),t.innerHTML=""+getNodeLabel(nodeMap[r]);var n=getNodeYear(nodeMap[r]);null!==n&&(t.innerHTML+="<span class='nodeYear'>"+n+"</span>"),e.appendChild(t),i.appendChild(e),a.push(getNodeLabel(nodeMap[r]))},d=!0,c=!1,l=void 0;try{for(var u,h=breadcrumbs[t["@id"]][Symbol.iterator]();!(d=(u=h.next()).done);d=!0)s(u.value)}catch(e){c=!0,l=e}finally{try{!d&&h.return&&h.return()}finally{if(c)throw l}}Y.appendChild(i),a.push(getNodeLabel(t));var m=getLabelAttribute(t),p=document.createElement("h2");p.innerHTML=getNodeLabel(t);var f=document.createElement("span");f.classList.add("nodeType"),f.innerHTML=getDisplayAttr(t["@type"]),f.title=t["@type"],f.addEventListener("click",function(e){U(t["@type"])}),p.appendChild(f),Y.appendChild(p);var g=document.createElement("dl"),v=["@id","x","y","index","@type","vy","vx","fx","fy","leftX","rightX"];for(var y in"https://schema.org/contentUrl"!==m&&(v[v.length]=m),t)if(-1==v.indexOf(y)){var b=Array.isArray(t[y])?t[y]:[t[y]];for(var L in b)if(("string"!=typeof b[L]||!nodeMap[b[L]])&&void 0===b[L]["@id"])if("https://schema.org/url"==y||"http://www.w3.org/2000/01/rdf-schema#seeAlso"==y)g.innerHTML+="<dt class='dt-"+getDisplayAttr(y)+"' title='"+y+"'>"+getDisplayAttr(y)+"</dt><dd class='dd-"+getDisplayAttr(y)+"'><a href='"+b[L]+"'>"+b[L]+"</a></dd>";else if("https://schema.org/embedUrl"==y)g.innerHTML+="<dt class='dt-"+getDisplayAttr(y)+"' title='"+y+"'>"+getDisplayAttr(y)+"</dt><dd class='dd-"+getDisplayAttr(y)+"'><a href='"+b[L]+"'>"+b[L]+"</a></dd>",g.innerHTML+="<dd class='dd-embed'><embed src='"+b[L]+"'></embed></dd>";else if("https://schema.org/contentUrl"==y)if(g.innerHTML+="<dt class='dt-"+getDisplayAttr(y)+"' title='"+y+"'>"+getDisplayAttr(y)+"</dt><dd class='dd-"+getDisplayAttr(y)+"'><a href='"+b[L]+"'>"+b[L]+"</a></dd>","https://schema.org/VideoObject"==t["@type"]){var x=b["https://schema.org/encodingFormat"]?"type='"+b["https://schema.org/encodingFormat"]+"'":"",M=b["https://schema.org/thumbnailUrl"]?"poster='"+b["https://schema.org/thumbnailUrl"]+"'":"";g.innerHTML+="<dd class='dd-contentobject'><video controls "+M+" autoplay><source src='"+b[L]+"' "+x+"></video></dd>"}else g.innerHTML+="<dd class='dd-contentobject'><object data='"+b[L]+"'></object></dd>";else{var w=b[L].replace(/\n/g,"<br>");g.innerHTML+="<dt class='dt-"+getDisplayAttr(y)+"' title='"+y+"'>"+getDisplayAttr(y)+"</dt><dd class='dd-"+getDisplayAttr(y)+"'>"+w+"</dd>"}}Y.appendChild(g);for(var A=document.createElement("dl"),N=0;N<z.links.length;N++){var T=z.links[N];T.source["@id"]==t["@id"]&&(void 0===r[T.name]&&(r[T.name]=[]),r[T.name][r[T.name].length]=T.target),T.target["@id"]==t["@id"]&&(void 0===e[T.name]&&(e[T.name]=[]),e[T.name][e[T.name].length]=T.source)}for(var k in r){var E=document.createElement("dt");for(var S in E.innerHTML=getDisplayAttr(k),A.appendChild(E),r[k]){var C=r[k][S];if(A.appendChild(R(C)),void 0!==C["https://schema.org/contentUrl"]){var D=document.createElement("dd");if(D.classList.add("dd-contentobject"),"https://schema.org/VideoObject"==C["@type"]){var O=C["https://schema.org/encodingFormat"]?"type='"+C["https://schema.org/encodingFormat"]+"'":"",F=C["https://schema.org/thumbnailUrl"]?"poster='"+C["https://schema.org/thumbnailUrl"]+"'":"";D.innerHTML+='<video controls preload="none" '+F+"><source src='"+C["https://schema.org/contentUrl"]+"' "+O+"></video>"}else D.innerHTML="<object data='"+C["https://schema.org/contentUrl"]+"'></object>";A.appendChild(D)}}}for(var H in e){var j=document.createElement("dt");for(var X in j.innerHTML=getDisplayAttr(H),A.appendChild(j),e[H]){var I=e[H][X];if(A.appendChild(R(I,X)),void 0!==I["https://schema.org/contentUrl"]){var P=document.createElement("dd");P.classList.add("dd-contentobject"),P.innerHTML="<object data='"+I["https://schema.org/contentUrl"]+"'></object>",A.appendChild(P)}}}Y.appendChild(A),B.each(function(e,t,r){t==n?r[t].classList.add("selectedNode"):r[t].classList.remove("selectedNode")}),document.title=a.join(" :: ")}(i,n)}},M=function(){L(null),g.each(function(e,t,r,n){r[t].classList.remove("activeLink"),r[t].classList.remove("breadcrumbLink"),r[t].getElementsByTagName("line")[0].setAttribute("marker-end","url(#arrowHead)")}),document.body.classList.remove("detailsOpen"),scrollToY(0,4e3)};window.addEventListener("popstate",function(e){if(e.state.hasOwnProperty("node"))q(e.state.node,!1);else{var t=z.nodes.find(function(e){return e["@id"]===firstNodeId});q(z.nodes.indexOf(t),!1)}});var w=function(){var e=b(),t=A();u=e[0]+e[2]/2-t.dx,h=e[1]+e[3]/2-t.dy},A=function(){var e=document.getElementById("container"),t=0,r=0,n=1;if(0<e.transform.baseVal.length){var a=!0,o=!1,i=void 0;try{for(var s,d=e.transform.baseVal[Symbol.iterator]();!(a=(s=d.next()).done);a=!0){var c=s.value;c.type==SVGTransform.SVG_TRANSFORM_TRANSLATE?(t+=c.matrix.e,r+=c.matrix.f):c.type==SVGTransform.SVG_TRANSFORM_SCALE&&(n*=c.matrix.a)}}catch(e){o=!0,i=e}finally{try{!a&&d.return&&d.return()}finally{if(o)throw i}}}return{dx:t,dy:r,scale:n}};w();var N=!1;f.force("centerActive",function(s){B.each(function(e,t,r){var n=e,a=.1*s;if(n.fx=null,n.fy=null,void 0!==nodePositions[t])0==N?(n.x=nodePositions[t][0],n.y=nodePositions[t][1],n.vx=0,n.vy=0):(n.vx-=(n.x-nodePositions[t][0])*a*5,n.vy-=(n.y-nodePositions[t][1])*a*5);else{if(d<1)return;var o=n.x-u,i=n.y-h;if(!inCircle(o,i,d))return;0==N?(n.fx=n.x+o*(2+Math.random()),n.fy=n.y+i*(2+Math.random())):(n.vx+=o*a*4,n.vy+=i*a*4)}})});B.append("path").attr("id",function(e,t){return"nodePath"+t}).attr("d",function(e){var t=.9*getSizeForNode(e);getSizeForNode(e);return"M0 0 m -"+t+", 0 a "+t+","+t+" 0 1,0 "+2*t+",0 a "+t+","+t+" 0 1,0 -"+2*t+",0"});B.call(d3.drag().on("start",function(e,t,r){d3.event.active||f.alphaTarget(.3).restart();var n=r[t];e.fx=e.x,e.fy=e.y,n.classList.add("drag")}).on("drag",function(e,t){e.fx=d3.event.x,e.fy=d3.event.y}).on("end",function(e,t,r){d3.event.active||f.alphaTarget(0);var n=r[t];e.fx=null,e.fy=null,n.classList.remove("drag")})).on("click",function(e,t,r){var n=r[t];q(t,n,e)}).on("mouseover",function(a,e){g.each(function(e,t,r,n){e.source!=a&&e.target!=a||r[t].classList.add("hoverLink")})}).on("mouseout",function(){for(var e=document.getElementsByClassName("hoverLink");0<e.length;)e[0].classList.remove("hoverLink")}),m.call(d3.zoom().scaleExtent([.3,3]).on("start",function(){m.node().classList.add("dragging")}).on("end",function(){m.node().classList.remove("dragging")}).on("zoom",function(e,t,r){p.attr("transform",d3.event.transform)})),B.append("circle").attr("r",function(e){return getSizeForNode(e)}).attr("class","nodeBg"),B.append("circle").attr("r",function(e){return 1.08*getSizeForNode(e)}).attr("class","highlightCircle"),B.append("text").attr("class","nodeType").text(function(e){return e["@type"]}),B.append("text").attr("class","nodeYear").attr("y","22").text(function(e){return getNodeYear(e)});if(B.append("text").attr("class","nodeTitle").attr("y","5").each(function(e,t){var r=void 0,n=d3.select(this),a=getNodeLabel(e),o=!1;if(20<a.length&&(o=function(e){var t=Math.floor(e.length/2),r=!1,n=!1,a=!0,o=!1,i=void 0;try{for(var s,d=[" ","-",""][Symbol.iterator]();!(a=(s=d.next()).done);a=!0){var c=s.value;if(!(e.indexOf(c)<0)){var l=e.substr(0,t).lastIndexOf(c);-1===l&&(l=e.indexOf(c)),l+=1,(!1===r||Math.abs(l-t)<Math.abs(r-t))&&(r=l,n=c)}}}catch(e){o=!0,i=e}finally{try{!a&&d.return&&d.return()}finally{if(o)throw i}}if(!1===r)return!1;var u=e.substr(0,r).trim();return""==n&&(u+="-"),[u,e.substr(r).trim()]}(a)),!1!==o){n.append("tspan").text(o[0]).attr("y","-10").attr("x","0");var i=n.append("tspan").text(o[1]).attr("y","10").attr("x","0"),s=i.node().getComputedTextLength(),d=i.node().getComputedTextLength();r=Math.max(s,d)}else n.text(a),r=n.node().getComputedTextLength();r>2*getSizeForNode(e)&&n.attr("transform","scale("+2*getSizeForNode(e)/r/1.05+")")}),B.each(function(e){e["https://schema.org/thumbnailUrl"]&&d3.select(this).append("svg:image").attr("xlink:href",e["https://schema.org/thumbnailUrl"]).attr("width",function(e){return 2*getSizeForNode(e)}).attr("height",function(e){return 2*getSizeForNode(e)}).attr("transform",function(e){return"translate(-"+getSizeForNode(e)+" -"+getSizeForNode(e)+")"}).attr("clip-path","url(#clipNodeImage)").attr("preserveAspectRatio","xMidYMid slice")}),f.nodes(z.nodes).on("tick",function(){z.nodes.forEach(function(e,t){e.leftX=e.rightX=e.x}),v.each(function(e){var t,r,n,a,o,i;e.source.rightX<e.target.leftX?(t=e.source.rightX,r=e.target.leftX):e.target.rightX<e.source.leftX?(r=e.target.rightX,t=e.source.leftX):e.target.isCircle?r=t=e.target.x:e.source.isCircle?r=t=e.source.x:((n=(e.source.x+e.target.x)/2)>e.target.rightX?n=e.target.rightX:n>e.source.rightX?n=e.source.rightX:n<e.target.leftX?n=e.target.leftX:n<e.source.leftX&&(n=e.source.leftX),r=t=n),a=r-t,o=e.target.y-e.source.y,i=Math.atan2(a,o);var s=getSizeForNode(e.source)+3.2,d=getSizeForNode(e.target)+3.2;e.sourceX=t+Math.sin(i)*s,e.targetX=r-Math.sin(i)*d,e.sourceY=e.source.y+Math.cos(i)*s,e.targetY=e.target.y-Math.cos(i)*d}).attr("x1",function(e){return e.sourceX}).attr("y1",function(e){return e.sourceY}).attr("x2",function(e){return e.targetX}).attr("y2",function(e){return e.targetY}),y.attr("transform",function(e){var t=(e.target.x-e.source.x)/2,r=(e.target.y-e.source.y)/2,n=e.source.x+t,a=e.source.y+r,o=180*Math.atan(r/t)/Math.PI;return isNaN(o)?"":"translate("+n+" "+a+") rotate("+o+") translate(0, -10)"}),B.attr("transform",function(e){return"translate("+e.x+","+e.y+")"})}),f.force("link").links(z.links).distance(function(e){return e.name,300}),location.pathname.startsWith("/@type/"))for(var T in t)getDisplayAttr(T)==location.pathname.substr(7)&&U(T,!1);else{var k=location.search.startsWith("?id=")?location.search.substr(4):"https://rubenvandeven.com"+location.pathname,E=z.nodes.find(function(e){return e["@id"]===k});q(z.nodes.indexOf(E),!1)}var S=document.getElementById("initPlaceholder");m.node().removeChild(S),setTimeout(function(){N=!0,document.body.classList.add("graphInitialised")},500)}var reqAnimFrame=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame||window.oRequestAnimationFrame||function(e){window.setTimeout(e,1e3/60)};function scrollToY(n,e,a,o){var i=window.scrollY,s=(n=n||0,e=e||2e3,a=a||"easeOutSine",0),d=(o=o||!1,Math.max(.1,Math.min(Math.abs(i-n)/e,.8))),c=(Math.PI,{easeOutSine:function(e){return Math.sin(e*(Math.PI/2))},easeInOutSine:function(e){return-.5*(Math.cos(Math.PI*e)-1)},easeInOutQuint:function(e){return(e/=.5)<1?.5*Math.pow(e,5):.5*(Math.pow(e-2,5)+2)}});!function e(){var t=(s+=1/60)/d,r=c[a](t);t<1?(reqAnimFrame(e),window.scrollTo(0,i+(n-i)*r)):(window.scrollTo(0,n),o&&o())}()}
|
||
//# sourceMappingURL=portfolio.min.js.map
|