diff --git a/web/_js/atlas.js b/web/_js/atlas.js index d3dca318..b67c1280 100644 --- a/web/_js/atlas.js +++ b/web/_js/atlas.js @@ -56,6 +56,7 @@ function pointIsInPolygon (point, polygon) { var atlas = [ {"id":0,"name":"Pinewood Logo/Rubix cube (Destroyed)","description":"Originally the logo for the Roblox group Pinewood Builders, the logo transformed into a game of tic tac toe, and then a Rubix cube. It was destroyed after being invaded by Iran","website":"https://pinewoodbuilders.reddit.com/","subreddit":"r/PinewoodBuilders","center":[39.5,279.5],"path":[[22.5,295.5],[23.5,274.5],[35.5,262.5],[55.5,262.5],[55.5,283.5],[43.5,295.5]]}, + {"id":1,"name":"CCKUFI Robin","description":"The icon of CcKuFi, the subreddit of users who made it to the highest tier in Reddit's 2016 April Fools Event, Robin.","subreddit":"ccKufiPrFaShleWoli0","center":[783.5,669.5],"path":[[771.5,661.5],[771.5,680.5],[789.5,680.5],[789.5,664.5],[806.5,664.5],[806.5,660.5],[771.5,660.5]]}, ]; //console.log("There are "+atlas.length+" entries in the Atlas."); diff --git a/web/_js/minified.js b/web/_js/minified.js index fedb1a5d..8904f5f0 100644 --- a/web/_js/minified.js +++ b/web/_js/minified.js @@ -1 +1 @@ -function pointIsInPolygon(e,t){for(var n=e[0],o=e[1],i=!1,a=0,r=t.length-1;ao!=d>o&&n<(s-l)*(o-c)/(d-c)+l&&(i=!i)}return i}window.addEventListener("error",function(e){console.log(e);var t='

An error has occurred:

';t+='

'+e.message+"

",t+='

on line '+e.lineno+"

",t+='

If this keeps happening, feel free to send me a mail.

',document.getElementById("loadingContent").innerHTML=t});var atlas=[{id:0,name:"Pinewood Logo/Rubix cube (Destroyed)",description:"Originally the logo for the Roblox group Pinewood Builders, the logo transformed into a game of tic tac toe, and then a Rubix cube. It was destroyed after being invaded by Iran",website:"https://pinewoodbuilders.reddit.com/",subreddit:"r/PinewoodBuilders",center:[39.5,279.5],path:[[22.5,295.5],[23.5,274.5],[35.5,262.5],[55.5,262.5],[55.5,283.5],[43.5,295.5]]}];atlas.sort(function(e,t){return e.center[1]t.center[1]?1:0});var linesCanvas=document.getElementById("linesCanvas"),linesContext=linesCanvas.getContext("2d"),hovered=[],previousZoomOrigin=[0,0],previousScaleZoomOrigin=[0,0],backgroundCanvas=document.createElement("canvas");backgroundCanvas.width=2e3,backgroundCanvas.height=1e3;var backgroundContext=backgroundCanvas.getContext("2d");function updateLines(){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(var e=0;e1e3&&(l=!0,t.className=t.className.replace(/ listHidden/g,"")),document.documentElement.clientWidth<1e3&&(l=!1,t.className+=" listHidden"),applyView(),y(),updateLines();var h=window.location.search;function v(e){var t=document.createElement("div");t.className="object";var n='

'+e.name+"

";if(e.description&&(n+="

"+e.description+"

"),e.website&&(n+='"+a+""}}return t.innerHTML+=n,t}function p(e,t){if(!dragging&&(!g||t)){var i=[(e.clientX-(container.clientWidth/2-innerContainer.clientWidth/2+zoomOrigin[0]+container.offsetLeft))/zoom,(e.clientY-(container.clientHeight/2-innerContainer.clientHeight/2+zoomOrigin[1]+container.offsetTop))/zoom];if(i[0]<=1100&&i[0]>=-100&&i[0]<=1100&&i[0]>=-100){for(var a=[],r=0;r0?o.className="":o.className="hidden",y()}}}}function f(o,i){var r;switch(a.contains(d)&&a.removeChild(d),e||(e=atlas.concat(),document.getElementById("atlasSize").innerHTML="The Atlas contains "+e.length+" entries."),o?(e=atlas.filter(function(e){return-1!==e.name.toLowerCase().indexOf(o)||-1!==e.description.toLowerCase().indexOf(o)}),document.getElementById("atlasSize").innerHTML="Found "+e.length+" entries."):document.getElementById("atlasSize").innerHTML="The Atlas contains "+e.length+" entries.",null===i&&(i=m),renderBackground(e),y(),document.getElementById("sort").value=i,i){case"shuffle":r=null,0==s&&function(){for(var t=e.length-1;t>0;t--){var n=Math.floor(Math.random()*(t+1)),o=e[t];e[t]=e[n],e[n]=o}}();break;case"alphaAsc":r=function(e,t){return e.name.toLowerCase().localeCompare(t.name.toLowerCase())};break;case"alphaDesc":r=function(e,t){return t.name.toLowerCase().localeCompare(e.name.toLowerCase())};break;case"newest":r=function(e,t){return e.id>t.id?-1:e.idt.id?1:0};break;case"relevant":r=function(e,t){return-1!==e.name.toLowerCase().indexOf(o)&&-1!==t.name.toLowerCase().indexOf(o)?e.name.toLowerCase().indexOf(o)t.name.toLowerCase().indexOf(o)?1:e.name.toLowerCase().localeCompare(t.name.toLowerCase()):-1!==e.name.toLowerCase().indexOf(o)?-1:-1!==t.name.toLowerCase().indexOf(o)?1:e.description.toLowerCase().indexOf(o)t.description.toLowerCase().indexOf(o)?1:e.name.toLowerCase().localeCompare(t.name.toLowerCase())}}r&&e.sort(r);for(var u=s;u=e.length);u++){var h=v(e[u]);h.entry=e[u],h.addEventListener("mouseenter",function(e){g||dragging||(n.innerHTML="",previousZoomOrigin=[zoomOrigin[0],zoomOrigin[1]],previousScaleZoomOrigin=[scaleZoomOrigin[0],scaleZoomOrigin[1]],applyView(),zoomOrigin=[innerContainer.clientWidth/2-this.entry.center[0]*zoom,innerContainer.clientHeight/2-this.entry.center[1]*zoom],scaleZoomOrigin=[500-this.entry.center[0],1e3-this.entry.center[1]],applyView(),hovered=[this.entry],y(),hovered[0].element=this,updateLines())}),h.addEventListener("click",function(e){w(e),g&&(previousZoomOrigin=[zoomOrigin[0],zoomOrigin[1]],previousScaleZoomOrigin=[scaleZoomOrigin[0],scaleZoomOrigin[1]],applyView()),document.documentElement.clientWidth<500&&(n.innerHTML="",l=!1,t.className+=" listHidden",zoom=4,renderBackground(atlas),applyView(),zoomOrigin=[innerContainer.clientWidth/2-this.entry.center[0]*zoom,innerContainer.clientHeight/2-this.entry.center[1]*zoom],scaleZoomOrigin=[500-this.entry.center[0],1e3-this.entry.center[1]],previousZoomOrigin=[zoomOrigin[0],zoomOrigin[1]],previousScaleZoomOrigin=[scaleZoomOrigin[0],scaleZoomOrigin[1]],g=!0,(hovered=[this.entry])[0].element=this,applyView(),y(),updateLines())}),h.addEventListener("mouseleave",function(e){g||dragging||(zoomOrigin=[previousScaleZoomOrigin[0]*zoom,previousScaleZoomOrigin[1]*zoom],scaleZoomOrigin=[previousScaleZoomOrigin[0],previousScaleZoomOrigin[1]],applyView(),hovered=[],updateLines(),y())}),a.appendChild(h)}s+=c,e.length>s&&(d.innerHTML="Show "+Math.min(c,e.length-s)+" more",a.appendChild(d))}function y(){context.clearRect(0,0,canvas.width,canvas.height),context.globalCompositeOperation="source-over",context.clearRect(0,0,canvas.width,canvas.height),hovered.length>0?container.style.cursor="pointer":container.style.cursor="default";for(var e=0;e1e3&&e<=1e3&&(l=!0,t.className=t.className.replace(/ listHidden/g,"")),document.documentElement.clientWidth<1e3&&e>=1e3&&(l=!1,t.className+=" listHidden"),e=document.documentElement.clientWidth,applyView(),y(),updateLines()})}function initDraw(){var e=document.getElementById("finishButton"),t=document.getElementById("resetButton"),n=document.getElementById("undoButton"),o=document.getElementById("redoButton"),i=document.getElementById("highlightUnchartedLabel"),a=document.getElementById("objectInfo"),r=document.getElementById("hint"),l=document.getElementById("exportButton"),c=document.getElementById("cancelButton"),s=document.getElementById("exportOverlay"),d=document.getElementById("exportCloseButton"),m=!1,u=!1,g=!1,h=document.createElement("canvas");h.width=2e3,h.height=1e3;var v=h.getContext("2d"),p=!0;!function(){v.clearRect(0,0,canvas.width,canvas.height),v.fillStyle="rgba(0, 0, 0, 1)";for(var e=0;e0){var o=f[f.length-1];Math.abs(n[1]-o[1])>Math.abs(n[0]-o[0])?n[0]=o[0]:n[1]=o[1]}return n}function C(){var e={id:0,name:document.getElementById("nameField").value,description:document.getElementById("descriptionField").value,website:document.getElementById("websiteField").value,subreddit:document.getElementById("subredditField").value,center:b(f),path:f},t=JSON.stringify(e,null,"\t"),n=document.getElementById("exportString");t=" "+(t=(t=t.split("\n")).join("\n ")),n.value=t,s.style.display="flex",n.focus(),n.select()}function b(e){var t,n,o,i,a=0;for(t=0,n=e.length-1;t0&&y&&(w.push(f.pop()),o.disabled=!1,0==f.length&&(n.disabled=!0),k(f))}function x(){w.length>0&&y&&(f.push(w.pop()),n.disabled=!1,0==w.length&&(o.disabled=!0),k(f))}function z(){y=!1,k(f),a.style.display="block",r.style.display="none",e.style.display="none",n.style.display="none",o.style.display="none",t.style.display="none",i.style.display="none",document.getElementById("nameField").focus()}function B(){f=[],w=[],e.disabled=!0,n.disabled=!0,o.disabled=!0,y=!0,k(f),a.style.display="none",r.style.display="block",e.style.display="block",n.style.display="block",o.style.display="block",t.style.display="block",i.style.display="block",document.getElementById("nameField").value="",document.getElementById("descriptionField").value="",document.getElementById("websiteField").value="",document.getElementById("subredditField").value=""}function k(e){context.globalCompositeOperation="source-over",context.clearRect(0,0,canvas.width,canvas.height),p?(context.drawImage(h,0,0),context.fillStyle="rgba(0, 0, 0, 0.4)"):context.fillStyle="rgba(0, 0, 0, 0.6)",context.fillRect(0,0,canvas.width,canvas.height),context.beginPath(),e[0]&&context.moveTo(e[0][0],e[0][1]);for(var t=1;t=3&&(e.disabled=!1)}}),window.addEventListener("mousemove",function(e){if(!dragging&&y&&f.length>0){var t=E(e.clientX,e.clientY);k(f.concat([t]))}}),window.addEventListener("keyup",function(e){"Enter"==e.key?z():"z"==e.key&&e.ctrlKey?O():"y"==e.key&&e.ctrlKey?x():"Escape"==e.key?s.style.display="none":"Shift"===e.key&&("ShiftRight"===e.code?m=!1:"ShiftLeft"===e.code&&(u=!1),g=m||u)}),window.addEventListener("keydown",function(e){"Shift"===e.key&&("ShiftRight"===e.code?m=!0:"ShiftLeft"===e.code&&(u=!0),g=m||u)}),e.addEventListener("click",function(e){z()}),n.addEventListener("click",function(e){O()}),o.addEventListener("click",function(e){x()}),t.addEventListener("click",function(e){B()}),c.addEventListener("click",function(e){B()}),document.getElementById("nameField").addEventListener("keyup",function(e){"Enter"==e.key&&C()}),document.getElementById("websiteField").addEventListener("keyup",function(e){"Enter"==e.key&&C()}),document.getElementById("subredditField").addEventListener("keyup",function(e){"Enter"==e.key&&C()}),l.addEventListener("click",function(e){C()}),d.addEventListener("click",function(e){B(),s.style.display="none"}),document.getElementById("highlightUncharted").addEventListener("click",function(e){p=this.checked,k(f)})}var innerContainer=document.getElementById("innerContainer"),container=document.getElementById("container"),canvas=document.getElementById("highlightCanvas"),context=canvas.getContext("2d"),zoom=1;window.devicePixelRatio&&(zoom=1/window.devicePixelRatio);var maxZoom=128,minZoom=.1,zoomOrigin=[0,0],scaleZoomOrigin=[0,0],dragging=!1,lastPosition=[0,0],viewportSize=[0,0];function applyView(){scaleZoomOrigin[0]=Math.max(-1e3,Math.min(1e3,scaleZoomOrigin[0])),scaleZoomOrigin[1]=Math.max(-500,Math.min(500,scaleZoomOrigin[1])),zoomOrigin=[scaleZoomOrigin[0]*zoom,scaleZoomOrigin[1]*zoom],innerContainer.style.height=~~(1e3*zoom)+"px",innerContainer.style.width=~~(2e3*zoom)+"px",innerContainer.style.left=~~(container.clientWidth/2-innerContainer.clientWidth/2+zoomOrigin[0]+container.offsetLeft)+"px",innerContainer.style.top=~~(container.clientHeight/2-innerContainer.clientHeight/2+zoomOrigin[1]+container.offsetTop)+"px"}function init(){zoomOrigin=[0,0],applyView();var e=0,t=0,n=[0,0],o="view",i=window.location.search;function a(e,t){lastPosition=[e,t],dragging=!0}function r(e,t){if(dragging){var n=e-lastPosition[0],o=t-lastPosition[1];lastPosition=[e,t],zoomOrigin[0]+=n,zoomOrigin[1]+=o,scaleZoomOrigin[0]+=n/zoom,scaleZoomOrigin[1]+=o/zoom,previousZoomOrigin=[zoomOrigin[0],zoomOrigin[1]],previousScaleZoomOrigin=[scaleZoomOrigin[0],scaleZoomOrigin[1]],updateLines(),applyView()}}function l(e,o,i){var a=e-lastPosition[0],r=o-lastPosition[1],l=e-container.clientWidth/2-a,c=o-container.clientHeight/2-r;scaleZoomOrigin[0]=n[0]+a/i+l/i-l/t,scaleZoomOrigin[1]=n[1]+r/i+c/i-c/t,zoomOrigin[0]=scaleZoomOrigin[0]*i,zoomOrigin[1]=scaleZoomOrigin[1]*i,applyView(),updateLines()}function c(e,t){dragging&&(dragging=!1)}i&&(o=(o=i.split("mode=")[1])?o.split("&")[0]:"view"),"view"==o?(wrapper.className=wrapper.className.replace(/ drawMode/g,""),initView()):"draw"==o?(wrapper.className+=" draw",initDraw()):"about"==o?window.location="./about.html":"overlap"==o&&(wrapper.className=wrapper.className.replace(/ drawMode/g,""),initOverlap&&initOverlap()),document.getElementById("loading").style.display="none",document.getElementById("zoomInButton").addEventListener("click",function(e){var o=container.clientWidth/2,i=container.clientHeight/2;n=[scaleZoomOrigin[0],scaleZoomOrigin[1]],t=zoom,lastPosition=[o,i],zoom*=2,l(o,i,zoom=Math.max(minZoom,Math.min(maxZoom,zoom)))}),document.getElementById("zoomOutButton").addEventListener("click",function(e){var o=container.clientWidth/2,i=container.clientHeight/2;n=[scaleZoomOrigin[0],scaleZoomOrigin[1]],t=zoom,lastPosition=[o,i],zoom/=2,l(o,i,zoom=Math.max(minZoom,Math.min(maxZoom,zoom)))}),document.getElementById("zoomResetButton").addEventListener("click",function(e){zoom=1,zoomOrigin=[0,0],scaleZoomOrigin=[0,0],updateLines(),applyView()}),container.addEventListener("dblclick",function(e){var o=e.clientX-container.offsetLeft,i=e.clientY-container.offsetTop;n=[scaleZoomOrigin[0],scaleZoomOrigin[1]],t=zoom,lastPosition=[o,i],e.ctrlKey?zoom/=2:zoom*=2,l(o,i,zoom=Math.max(minZoom,Math.min(maxZoom,zoom))),e.preventDefault()}),container.addEventListener("wheel",function(e){var o=e.clientX-container.offsetLeft,i=e.clientY-container.offsetTop;n=[scaleZoomOrigin[0],scaleZoomOrigin[1]],t=zoom,lastPosition=[o,i],e.deltaY>0?zoom/=2:e.deltaY<0&&(zoom*=2),l(o,i,zoom=Math.max(minZoom,Math.min(maxZoom,zoom))),e.preventDefault()}),container.addEventListener("mousedown",function(e){a(e.clientX,e.clientY),e.preventDefault()}),container.addEventListener("touchstart",function(o){2==o.touches.length&&o.preventDefault(),function(o){1==o.touches.length?a(o.touches[0].clientX,o.touches[0].clientY):2==o.touches.length&&(e=Math.sqrt(Math.pow(o.touches[0].clientX-o.touches[1].clientX,2)+Math.pow(o.touches[0].clientY-o.touches[1].clientY,2)),t=zoom,n=[scaleZoomOrigin[0],scaleZoomOrigin[1]],a((o.touches[0].clientX+o.touches[1].clientX)/2,(o.touches[0].clientY+o.touches[1].clientY)/2))}(o)}),window.addEventListener("mousemove",function(e){updateLines(),r(e.clientX,e.clientY),dragging&&e.preventDefault()}),window.addEventListener("touchmove",function(n){(2==n.touches.length||n.scale>1)&&n.preventDefault(),function(n){if(updateLines(),1==n.touches.length)r(n.touches[0].clientX,n.touches[0].clientY);else if(2==n.touches.length){var o=Math.sqrt(Math.pow(n.touches[0].clientX-n.touches[1].clientX,2)+Math.pow(n.touches[0].clientY-n.touches[1].clientY,2));zoom=t*o/e;var i=(n.touches[0].clientX+n.touches[1].clientX)/2-container.offsetLeft,a=(n.touches[0].clientY+n.touches[1].clientY)/2-container.offsetTop;l(i,a,zoom)}}(n)},{passive:!1}),window.addEventListener("mouseup",function(e){dragging&&e.preventDefault(),c(e.clientX,e.clientY)}),window.addEventListener("touchend",function(e){0==e.touches.length?c():1==e.touches.length&&(t=zoom,lastPosition=[e.touches[0].clientX,e.touches[0].clientY])}),window.addEventListener("resize",function(){applyView()})}document.getElementById("donateButton").addEventListener("click",function(e){document.getElementById("bitcoinQR").src="./_img/bitcoinQR.png?from=index",document.getElementById("donateOverlay").style.display="flex"}),document.getElementById("closeBitcoinButton").addEventListener("click",function(e){document.getElementById("donateOverlay").style.display="none"}),init(); \ No newline at end of file +function pointIsInPolygon(e,t){for(var n=e[0],o=e[1],i=!1,a=0,r=t.length-1;ao!=d>o&&n<(s-l)*(o-c)/(d-c)+l&&(i=!i)}return i}window.addEventListener("error",function(e){console.log(e);var t='

An error has occurred:

';t+='

'+e.message+"

",t+='

on line '+e.lineno+"

",t+='

If this keeps happening, feel free to send me a mail.

',document.getElementById("loadingContent").innerHTML=t});var atlas=[{id:0,name:"Pinewood Logo/Rubix cube (Destroyed)",description:"Originally the logo for the Roblox group Pinewood Builders, the logo transformed into a game of tic tac toe, and then a Rubix cube. It was destroyed after being invaded by Iran",website:"https://pinewoodbuilders.reddit.com/",subreddit:"r/PinewoodBuilders",center:[39.5,279.5],path:[[22.5,295.5],[23.5,274.5],[35.5,262.5],[55.5,262.5],[55.5,283.5],[43.5,295.5]]},{id:1,name:"CCKUFI Robin",description:"The icon of CcKuFi, the subreddit of users who made it to the highest tier in Reddit's 2016 April Fools Event, Robin.",subreddit:"ccKufiPrFaShleWoli0",center:[783.5,669.5],path:[[771.5,661.5],[771.5,680.5],[789.5,680.5],[789.5,664.5],[806.5,664.5],[806.5,660.5],[771.5,660.5]]}];atlas.sort(function(e,t){return e.center[1]t.center[1]?1:0});var linesCanvas=document.getElementById("linesCanvas"),linesContext=linesCanvas.getContext("2d"),hovered=[],previousZoomOrigin=[0,0],previousScaleZoomOrigin=[0,0],backgroundCanvas=document.createElement("canvas");backgroundCanvas.width=2e3,backgroundCanvas.height=1e3;var backgroundContext=backgroundCanvas.getContext("2d");function updateLines(){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(var e=0;e1e3&&(l=!0,t.className=t.className.replace(/ listHidden/g,"")),document.documentElement.clientWidth<1e3&&(l=!1,t.className+=" listHidden"),applyView(),y(),updateLines();var h=window.location.search;function v(e){var t=document.createElement("div");t.className="object";var n='

'+e.name+"

";if(e.description&&(n+="

"+e.description+"

"),e.website&&(n+='"+a+""}}return t.innerHTML+=n,t}function p(e,t){if(!dragging&&(!g||t)){var i=[(e.clientX-(container.clientWidth/2-innerContainer.clientWidth/2+zoomOrigin[0]+container.offsetLeft))/zoom,(e.clientY-(container.clientHeight/2-innerContainer.clientHeight/2+zoomOrigin[1]+container.offsetTop))/zoom];if(i[0]<=1100&&i[0]>=-100&&i[0]<=1100&&i[0]>=-100){for(var a=[],r=0;r0?o.className="":o.className="hidden",y()}}}}function f(o,i){var r;switch(a.contains(d)&&a.removeChild(d),e||(e=atlas.concat(),document.getElementById("atlasSize").innerHTML="The Atlas contains "+e.length+" entries."),o?(e=atlas.filter(function(e){return-1!==e.name.toLowerCase().indexOf(o)||-1!==e.description.toLowerCase().indexOf(o)}),document.getElementById("atlasSize").innerHTML="Found "+e.length+" entries."):document.getElementById("atlasSize").innerHTML="The Atlas contains "+e.length+" entries.",null===i&&(i=m),renderBackground(e),y(),document.getElementById("sort").value=i,i){case"shuffle":r=null,0==s&&function(){for(var t=e.length-1;t>0;t--){var n=Math.floor(Math.random()*(t+1)),o=e[t];e[t]=e[n],e[n]=o}}();break;case"alphaAsc":r=function(e,t){return e.name.toLowerCase().localeCompare(t.name.toLowerCase())};break;case"alphaDesc":r=function(e,t){return t.name.toLowerCase().localeCompare(e.name.toLowerCase())};break;case"newest":r=function(e,t){return e.id>t.id?-1:e.idt.id?1:0};break;case"relevant":r=function(e,t){return-1!==e.name.toLowerCase().indexOf(o)&&-1!==t.name.toLowerCase().indexOf(o)?e.name.toLowerCase().indexOf(o)t.name.toLowerCase().indexOf(o)?1:e.name.toLowerCase().localeCompare(t.name.toLowerCase()):-1!==e.name.toLowerCase().indexOf(o)?-1:-1!==t.name.toLowerCase().indexOf(o)?1:e.description.toLowerCase().indexOf(o)t.description.toLowerCase().indexOf(o)?1:e.name.toLowerCase().localeCompare(t.name.toLowerCase())}}r&&e.sort(r);for(var u=s;u=e.length);u++){var h=v(e[u]);h.entry=e[u],h.addEventListener("mouseenter",function(e){g||dragging||(n.innerHTML="",previousZoomOrigin=[zoomOrigin[0],zoomOrigin[1]],previousScaleZoomOrigin=[scaleZoomOrigin[0],scaleZoomOrigin[1]],applyView(),zoomOrigin=[innerContainer.clientWidth/2-this.entry.center[0]*zoom,innerContainer.clientHeight/2-this.entry.center[1]*zoom],scaleZoomOrigin=[500-this.entry.center[0],1e3-this.entry.center[1]],applyView(),hovered=[this.entry],y(),hovered[0].element=this,updateLines())}),h.addEventListener("click",function(e){w(e),g&&(previousZoomOrigin=[zoomOrigin[0],zoomOrigin[1]],previousScaleZoomOrigin=[scaleZoomOrigin[0],scaleZoomOrigin[1]],applyView()),document.documentElement.clientWidth<500&&(n.innerHTML="",l=!1,t.className+=" listHidden",zoom=4,renderBackground(atlas),applyView(),zoomOrigin=[innerContainer.clientWidth/2-this.entry.center[0]*zoom,innerContainer.clientHeight/2-this.entry.center[1]*zoom],scaleZoomOrigin=[500-this.entry.center[0],1e3-this.entry.center[1]],previousZoomOrigin=[zoomOrigin[0],zoomOrigin[1]],previousScaleZoomOrigin=[scaleZoomOrigin[0],scaleZoomOrigin[1]],g=!0,(hovered=[this.entry])[0].element=this,applyView(),y(),updateLines())}),h.addEventListener("mouseleave",function(e){g||dragging||(zoomOrigin=[previousScaleZoomOrigin[0]*zoom,previousScaleZoomOrigin[1]*zoom],scaleZoomOrigin=[previousScaleZoomOrigin[0],previousScaleZoomOrigin[1]],applyView(),hovered=[],updateLines(),y())}),a.appendChild(h)}s+=c,e.length>s&&(d.innerHTML="Show "+Math.min(c,e.length-s)+" more",a.appendChild(d))}function y(){context.clearRect(0,0,canvas.width,canvas.height),context.globalCompositeOperation="source-over",context.clearRect(0,0,canvas.width,canvas.height),hovered.length>0?container.style.cursor="pointer":container.style.cursor="default";for(var e=0;e1e3&&e<=1e3&&(l=!0,t.className=t.className.replace(/ listHidden/g,"")),document.documentElement.clientWidth<1e3&&e>=1e3&&(l=!1,t.className+=" listHidden"),e=document.documentElement.clientWidth,applyView(),y(),updateLines()})}function initDraw(){var e=document.getElementById("finishButton"),t=document.getElementById("resetButton"),n=document.getElementById("undoButton"),o=document.getElementById("redoButton"),i=document.getElementById("highlightUnchartedLabel"),a=document.getElementById("objectInfo"),r=document.getElementById("hint"),l=document.getElementById("exportButton"),c=document.getElementById("cancelButton"),s=document.getElementById("exportOverlay"),d=document.getElementById("exportCloseButton"),m=!1,u=!1,g=!1,h=document.createElement("canvas");h.width=2e3,h.height=1e3;var v=h.getContext("2d"),p=!0;!function(){v.clearRect(0,0,canvas.width,canvas.height),v.fillStyle="rgba(0, 0, 0, 1)";for(var e=0;e0){var o=f[f.length-1];Math.abs(n[1]-o[1])>Math.abs(n[0]-o[0])?n[0]=o[0]:n[1]=o[1]}return n}function C(){var e={id:0,name:document.getElementById("nameField").value,description:document.getElementById("descriptionField").value,website:document.getElementById("websiteField").value,subreddit:document.getElementById("subredditField").value,center:b(f),path:f},t=JSON.stringify(e,null,"\t"),n=document.getElementById("exportString");t=" "+(t=(t=t.split("\n")).join("\n ")),n.value=t,s.style.display="flex",n.focus(),n.select()}function b(e){var t,n,o,i,a=0;for(t=0,n=e.length-1;t0&&y&&(w.push(f.pop()),o.disabled=!1,0==f.length&&(n.disabled=!0),k(f))}function x(){w.length>0&&y&&(f.push(w.pop()),n.disabled=!1,0==w.length&&(o.disabled=!0),k(f))}function z(){y=!1,k(f),a.style.display="block",r.style.display="none",e.style.display="none",n.style.display="none",o.style.display="none",t.style.display="none",i.style.display="none",document.getElementById("nameField").focus()}function B(){f=[],w=[],e.disabled=!0,n.disabled=!0,o.disabled=!0,y=!0,k(f),a.style.display="none",r.style.display="block",e.style.display="block",n.style.display="block",o.style.display="block",t.style.display="block",i.style.display="block",document.getElementById("nameField").value="",document.getElementById("descriptionField").value="",document.getElementById("websiteField").value="",document.getElementById("subredditField").value=""}function k(e){context.globalCompositeOperation="source-over",context.clearRect(0,0,canvas.width,canvas.height),p?(context.drawImage(h,0,0),context.fillStyle="rgba(0, 0, 0, 0.4)"):context.fillStyle="rgba(0, 0, 0, 0.6)",context.fillRect(0,0,canvas.width,canvas.height),context.beginPath(),e[0]&&context.moveTo(e[0][0],e[0][1]);for(var t=1;t=3&&(e.disabled=!1)}}),window.addEventListener("mousemove",function(e){if(!dragging&&y&&f.length>0){var t=L(e.clientX,e.clientY);k(f.concat([t]))}}),window.addEventListener("keyup",function(e){"Enter"==e.key?z():"z"==e.key&&e.ctrlKey?O():"y"==e.key&&e.ctrlKey?x():"Escape"==e.key?s.style.display="none":"Shift"===e.key&&("ShiftRight"===e.code?m=!1:"ShiftLeft"===e.code&&(u=!1),g=m||u)}),window.addEventListener("keydown",function(e){"Shift"===e.key&&("ShiftRight"===e.code?m=!0:"ShiftLeft"===e.code&&(u=!0),g=m||u)}),e.addEventListener("click",function(e){z()}),n.addEventListener("click",function(e){O()}),o.addEventListener("click",function(e){x()}),t.addEventListener("click",function(e){B()}),c.addEventListener("click",function(e){B()}),document.getElementById("nameField").addEventListener("keyup",function(e){"Enter"==e.key&&C()}),document.getElementById("websiteField").addEventListener("keyup",function(e){"Enter"==e.key&&C()}),document.getElementById("subredditField").addEventListener("keyup",function(e){"Enter"==e.key&&C()}),l.addEventListener("click",function(e){C()}),d.addEventListener("click",function(e){B(),s.style.display="none"}),document.getElementById("highlightUncharted").addEventListener("click",function(e){p=this.checked,k(f)})}var innerContainer=document.getElementById("innerContainer"),container=document.getElementById("container"),canvas=document.getElementById("highlightCanvas"),context=canvas.getContext("2d"),zoom=1;window.devicePixelRatio&&(zoom=1/window.devicePixelRatio);var maxZoom=128,minZoom=.1,zoomOrigin=[0,0],scaleZoomOrigin=[0,0],dragging=!1,lastPosition=[0,0],viewportSize=[0,0];function applyView(){scaleZoomOrigin[0]=Math.max(-1e3,Math.min(1e3,scaleZoomOrigin[0])),scaleZoomOrigin[1]=Math.max(-500,Math.min(500,scaleZoomOrigin[1])),zoomOrigin=[scaleZoomOrigin[0]*zoom,scaleZoomOrigin[1]*zoom],innerContainer.style.height=~~(1e3*zoom)+"px",innerContainer.style.width=~~(2e3*zoom)+"px",innerContainer.style.left=~~(container.clientWidth/2-innerContainer.clientWidth/2+zoomOrigin[0]+container.offsetLeft)+"px",innerContainer.style.top=~~(container.clientHeight/2-innerContainer.clientHeight/2+zoomOrigin[1]+container.offsetTop)+"px"}function init(){zoomOrigin=[0,0],applyView();var e=0,t=0,n=[0,0],o="view",i=window.location.search;function a(e,t){lastPosition=[e,t],dragging=!0}function r(e,t){if(dragging){var n=e-lastPosition[0],o=t-lastPosition[1];lastPosition=[e,t],zoomOrigin[0]+=n,zoomOrigin[1]+=o,scaleZoomOrigin[0]+=n/zoom,scaleZoomOrigin[1]+=o/zoom,previousZoomOrigin=[zoomOrigin[0],zoomOrigin[1]],previousScaleZoomOrigin=[scaleZoomOrigin[0],scaleZoomOrigin[1]],updateLines(),applyView()}}function l(e,o,i){var a=e-lastPosition[0],r=o-lastPosition[1],l=e-container.clientWidth/2-a,c=o-container.clientHeight/2-r;scaleZoomOrigin[0]=n[0]+a/i+l/i-l/t,scaleZoomOrigin[1]=n[1]+r/i+c/i-c/t,zoomOrigin[0]=scaleZoomOrigin[0]*i,zoomOrigin[1]=scaleZoomOrigin[1]*i,applyView(),updateLines()}function c(e,t){dragging&&(dragging=!1)}i&&(o=(o=i.split("mode=")[1])?o.split("&")[0]:"view"),"view"==o?(wrapper.className=wrapper.className.replace(/ drawMode/g,""),initView()):"draw"==o?(wrapper.className+=" draw",initDraw()):"about"==o?window.location="./about.html":"overlap"==o&&(wrapper.className=wrapper.className.replace(/ drawMode/g,""),initOverlap&&initOverlap()),document.getElementById("loading").style.display="none",document.getElementById("zoomInButton").addEventListener("click",function(e){var o=container.clientWidth/2,i=container.clientHeight/2;n=[scaleZoomOrigin[0],scaleZoomOrigin[1]],t=zoom,lastPosition=[o,i],zoom*=2,l(o,i,zoom=Math.max(minZoom,Math.min(maxZoom,zoom)))}),document.getElementById("zoomOutButton").addEventListener("click",function(e){var o=container.clientWidth/2,i=container.clientHeight/2;n=[scaleZoomOrigin[0],scaleZoomOrigin[1]],t=zoom,lastPosition=[o,i],zoom/=2,l(o,i,zoom=Math.max(minZoom,Math.min(maxZoom,zoom)))}),document.getElementById("zoomResetButton").addEventListener("click",function(e){zoom=1,zoomOrigin=[0,0],scaleZoomOrigin=[0,0],updateLines(),applyView()}),container.addEventListener("dblclick",function(e){var o=e.clientX-container.offsetLeft,i=e.clientY-container.offsetTop;n=[scaleZoomOrigin[0],scaleZoomOrigin[1]],t=zoom,lastPosition=[o,i],e.ctrlKey?zoom/=2:zoom*=2,l(o,i,zoom=Math.max(minZoom,Math.min(maxZoom,zoom))),e.preventDefault()}),container.addEventListener("wheel",function(e){var o=e.clientX-container.offsetLeft,i=e.clientY-container.offsetTop;n=[scaleZoomOrigin[0],scaleZoomOrigin[1]],t=zoom,lastPosition=[o,i],e.deltaY>0?zoom/=2:e.deltaY<0&&(zoom*=2),l(o,i,zoom=Math.max(minZoom,Math.min(maxZoom,zoom))),e.preventDefault()}),container.addEventListener("mousedown",function(e){a(e.clientX,e.clientY),e.preventDefault()}),container.addEventListener("touchstart",function(o){2==o.touches.length&&o.preventDefault(),function(o){1==o.touches.length?a(o.touches[0].clientX,o.touches[0].clientY):2==o.touches.length&&(e=Math.sqrt(Math.pow(o.touches[0].clientX-o.touches[1].clientX,2)+Math.pow(o.touches[0].clientY-o.touches[1].clientY,2)),t=zoom,n=[scaleZoomOrigin[0],scaleZoomOrigin[1]],a((o.touches[0].clientX+o.touches[1].clientX)/2,(o.touches[0].clientY+o.touches[1].clientY)/2))}(o)}),window.addEventListener("mousemove",function(e){updateLines(),r(e.clientX,e.clientY),dragging&&e.preventDefault()}),window.addEventListener("touchmove",function(n){(2==n.touches.length||n.scale>1)&&n.preventDefault(),function(n){if(updateLines(),1==n.touches.length)r(n.touches[0].clientX,n.touches[0].clientY);else if(2==n.touches.length){var o=Math.sqrt(Math.pow(n.touches[0].clientX-n.touches[1].clientX,2)+Math.pow(n.touches[0].clientY-n.touches[1].clientY,2));zoom=t*o/e;var i=(n.touches[0].clientX+n.touches[1].clientX)/2-container.offsetLeft,a=(n.touches[0].clientY+n.touches[1].clientY)/2-container.offsetTop;l(i,a,zoom)}}(n)},{passive:!1}),window.addEventListener("mouseup",function(e){dragging&&e.preventDefault(),c(e.clientX,e.clientY)}),window.addEventListener("touchend",function(e){0==e.touches.length?c():1==e.touches.length&&(t=zoom,lastPosition=[e.touches[0].clientX,e.touches[0].clientY])}),window.addEventListener("resize",function(){applyView()})}document.getElementById("donateButton").addEventListener("click",function(e){document.getElementById("bitcoinQR").src="./_img/bitcoinQR.png?from=index",document.getElementById("donateOverlay").style.display="flex"}),document.getElementById("closeBitcoinButton").addEventListener("click",function(e){document.getElementById("donateOverlay").style.display="none"}),init(); \ No newline at end of file