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