/* ======================================================================== The /r/place Atlas An Atlas of Reddit's /r/place, with information to each artwork of the canvas provided by the community. Copyright (C) 2017 Roland Rytz Licensed under the GNU Affero General Public License Version 3 This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For more information, see: https://draemm.li/various/place-atlas/license.txt ======================================================================== */ window.addEventListener("error", function(e){ console.log(e); var errorMessage = "

An error has occurred:

"; errorMessage += "

"+e.message+"

"; errorMessage += "

on line "+e.lineno+"

"; errorMessage += "

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

"; document.getElementById("loadingContent").innerHTML = errorMessage; }); var atlas = [ { "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 ] ] } ]; //console.log("There are "+atlas.length+" entries in the Atlas."); /* atlas.sort(function(a, b){ if (a.id < b.id) { return -1; } if (a.id > b.id) { return 1; } // a must be equal to b return 0; }); for(var i = 0; i < atlas.length; i++){ if(atlas[i-1]){ if(atlas[i-1].id == atlas[i].id){ console.log(atlas[i-1].id + ": "+ atlas[i-1].name); console.log(atlas[i ].id + ": "+ atlas[i ].name); } } } console.log("biggest id: "+atlas[atlas.length-1].id + ", " + atlas[atlas.length-1].name); */ /* for(var i = 0; i < atlas.length; i++){ if(typeof atlas[i].website == "undefined"){ console.log(atlas[i].name); } else if(atlas[i].website.trim() != ""){ if(atlas[i].website.trim().substring(0, 4) != "http"){ console.log(atlas[i].name + ": " + atlas[i].website); } } } */ // sort by center.y, so that lines will overlap less atlas.sort(function(a, b){ if (a.center[1] < b.center[1]) { return -1; } if (a.center[1] > b.center[1]) { return 1; } // a must be equal to b return 0; }); /* // Populate with test data for(var i = 0; i < 10000; i++){ var x = ~~(Math.random() * 1000)+0.5; var y = ~~(Math.random() * 1000)+0.5; var w = ~~(Math.random()*100); var h = ~~(Math.random()*100); atlas.push({ "id": 5, "name": "test"+(i+3), "website": "", "subreddit": "", "center": [0, 0], "path":[ [x, y], [x+w, y], [x+w, y+h], [x, y+h] ] }); } */