functionpointIsInPolygon(point,polygon){for(varx=point[0],y=point[1],inside=!1,i=0,j=polygon.length-1;i<polygon.length;j=i++){varxi=polygon[i][0],yi=polygon[i][1],xj=polygon[j][0],yj=polygon[j][1],intersect;yi>y!=yj>y&&x<(xj-xi)*(y-yi)/(yj-yi)+xi&&(inside=!inside)}returninside}window.addEventListener("error",(function(e){console.log(e);varerrorMessage='<p class="error">An error has occurred:</p>';errorMessage+='<p class="errorBody">'+e.message+"</p>",errorMessage+='<p class="errorBody">on line '+e.lineno+"</p>",errorMessage+='<p class="error">If this keeps happening, feel free to send me a <a href="mailto:roland.rytz@gmail.com">mail</a>.</p>',document.getElementById("loadingContent").innerHTML=errorMessage}));varatlas=[{id:0,name:"r/place still has to be indexed",description:"To make sure this project doesn't get flooded with a million requests or changes, I wait until april 4th so I can submit all the ",website:"https://place-atlas.stefanocoding.me/",subreddit:"r/placeAtlas2",center:[502.5,513.5],path:[[2.5,343.5],[994.5,339.5],[996.5,690.5],[2.5,678.5]]}];atlas.sort((function(a,b){returna.center[1]<b.center[1]?-1:a.center[1]>b.center[1]?1:0}));varlinesCanvas=document.getElementById("linesCanvas"),linesContext=linesCanvas.getContext("2d"),hovered=[],previousZoomOrigin=[0,0],previousScaleZoomOrigin=[0,0],backgroundCanvas=document.createElement("canvas");backgroundCanvas.width=1e3,backgroundCanvas.height=1e3;varbackgroundContext=backgroundCanvas.getContext("2d");functionupdateLines(){linesCanvas.width=linesCanvas.clientWidth,linesCanvas.height=linesCanvas.clientHeight,linesContext.lineCap="round",linesContext.lineWidth=Math.max(Math.min(1.5*zoom,24),6),linesContext.strokeStyle="#000000";for(vari=0;i<hovered.length;i++){varelement;0!=(element=hovered[i].element).getBoundingClientRect().left&&(linesContext.beginPath(),linesContext.moveTo(element.getBoundingClientRect().left+document.documentElement.scrollLeft+element.clientWidth/2,element.getBoundingClientRect().top+document.documentElement.scrollTop+20),linesContext.lineTo(~~(hovered[i].center[0]*zoom)+innerContainer.offsetLeft,~~(hovered[i].center[1]*zoom)+innerContainer.offsetTop),linesContext.stroke())}linesContext.lineWidth=Math.max(Math.min(zoom,16),4),linesContext.strokeStyle="#FFFFFF";for(vari=0;i<hovered.length;i++){varelement;0!=(element=hovered[i].element).getBoundingClientRect().left&&(linesContext.beginPath(),linesContext.moveTo(element.getBoundingClientRect().left+document.documentElement.scrollLeft+element.clientWidth/2,element.getBoundingClientRect().top+document.documentElement.scrollTop+20),linesContext.lineTo(~~(hovered[i].center[0]*zoom)+innerContainer.offsetLeft,~~(hovered[i].center[1]*zoom)+innerContainer.offsetTop),linesContext.stroke())}}functionrenderBackground(atlas){backgroundContext.clearRect(0,0,canvas.width,canvas.height),backgroundContext.fillStyle="rgba(0, 0, 0, 0.6)",backgroundContext.fillRect(0,0,backgroundCanvas.width,backgroundCanvas.height);for(vari=0;i<atlas.length;i++){varpath=atlas[i].path;backgroundContext.beginPath(),path[0]&&backgroundContext.moveTo(path[0][0],path[0][1]);for(varp=1;p<path.length;p++)backgroundContext.lineTo(path[p][0],path[p][1]);backgroundContext.closePath(),backgroundContext.strokeStyle="rgba(255, 255, 255, 0.8)",backgroundContext.stroke()}}functioninitView(){varwrapper=document.getElementById("wrapper"),objectsContainer=document.getElementById("objectsList"),closeObjectsListButton=document.getElementById("closeObjectsListButton"),filterInput=document.getElementById("searchList"),entriesList=document.getElementById("entriesList"),hideListButton=document.getElementById("hideListButton"),entriesListShown=!0,sortedAtlas,entriesLimit=50,entriesOffset=0,moreEntriesButton=document.createElement("button");moreEntriesButton.innerHTML="Show 50 more",moreEntriesButton.id="moreEntriesButton",moreEntriesButton.onclick=function(){buildObjectsList(null,null)};vardefaultSort="shuffle";document.getElementById("sort").value=defaultSort;varlastPos=[0,0],fixed=!1;renderBackground(atlas),render(),buildObjects