mirror of
https://github.com/placeAtlas/atlas.git
synced 2024-07-05 19:49:02 +02:00
Merge branch 'master' into cleanup
This commit is contained in:
commit
a1ecd39963
4
netlify.toml
Normal file
4
netlify.toml
Normal file
|
@ -0,0 +1,4 @@
|
|||
[[headers]]
|
||||
for = "/*"
|
||||
[headers.values]
|
||||
Access-Control-Allow-Origin = "*"
|
|
@ -137,6 +137,35 @@ async function init(){
|
|||
if(initOverlap){
|
||||
initOverlap();
|
||||
}
|
||||
} else if(mode.startsWith("diff")){
|
||||
wrapper.className = wrapper.className.replace(/ drawMode/g, "");
|
||||
try {
|
||||
let liveResp = await fetch("https://place-atlas.stefanocoding.me/atlas.json");
|
||||
let liveJson = await liveResp.json();
|
||||
let liveAtlasReduced = liveJson.reduce(function(a, c) {
|
||||
a[c.id] = c;
|
||||
return a;
|
||||
},{});
|
||||
if(mode.endsWith("only")){
|
||||
atlas = atlas.filter(function(entry) {
|
||||
return JSON.stringify(entry) !== JSON.stringify(liveAtlasReduced[entry.id]);
|
||||
});
|
||||
}
|
||||
atlas = atlas.map(function(entry) {
|
||||
if(liveAtlasReduced[entry.id] === undefined){
|
||||
entry.diff = "add";
|
||||
}else if(JSON.stringify(entry) !== JSON.stringify(liveAtlasReduced[entry.id])){
|
||||
entry.diff = "edit";
|
||||
}
|
||||
return entry;
|
||||
});
|
||||
//TEMP FOR TIME TRAVEL
|
||||
atlasBackup = atlas;
|
||||
} catch (error) {
|
||||
console.log("Diff mode failed to load, reverting to normal view - " + error);
|
||||
} finally {
|
||||
initView();
|
||||
}
|
||||
}
|
||||
|
||||
function changeOverlapMode(){
|
||||
|
@ -164,7 +193,7 @@ async function init(){
|
|||
|
||||
const toggleMode = document.getElementById("toggleMode");
|
||||
toggleMode.onclick = changeOverlapMode;
|
||||
toggleMode.innerHTML = modeMap[mode];
|
||||
toggleMode.innerHTML = modeMap[mode] || "Overlap";
|
||||
|
||||
document.getElementById("loading").style.display = "none";
|
||||
|
||||
|
|
|
@ -1,78 +1,78 @@
|
|||
const timeConfig = [
|
||||
{
|
||||
timestamp: 1648822500,
|
||||
url: "/_img/place/1648822500.png",
|
||||
url: "./_img/place/1648822500.png",
|
||||
image: null
|
||||
},
|
||||
{
|
||||
timestamp: 1648847036,
|
||||
url: "/_img/place/1648847036.png",
|
||||
url: "./_img/place/1648847036.png",
|
||||
image: null
|
||||
},
|
||||
{
|
||||
timestamp: 1648870452,
|
||||
url: "/_img/place/1648870452.png",
|
||||
url: "./_img/place/1648870452.png",
|
||||
image: null
|
||||
},
|
||||
{
|
||||
timestamp: 1648893666,
|
||||
url: "/_img/place/1648893666.png",
|
||||
url: "./_img/place/1648893666.png",
|
||||
image: null
|
||||
},
|
||||
{
|
||||
timestamp: 1648917500,
|
||||
url: "/_img/place/1648917500.png",
|
||||
url: "./_img/place/1648917500.png",
|
||||
image: null
|
||||
},
|
||||
{
|
||||
timestamp: 1648942113,
|
||||
url: "/_img/place/1648942113.png",
|
||||
url: "./_img/place/1648942113.png",
|
||||
image: null
|
||||
},
|
||||
{
|
||||
timestamp: 1648956234,
|
||||
url: "/_img/place/1648956234.png",
|
||||
url: "./_img/place/1648956234.png",
|
||||
image: null
|
||||
},
|
||||
{
|
||||
timestamp: 1648968061,
|
||||
url: "/_img/place/1648968061.png",
|
||||
url: "./_img/place/1648968061.png",
|
||||
image: null
|
||||
},
|
||||
{
|
||||
timestamp: 1648979987,
|
||||
url: "/_img/place/1648979987.png",
|
||||
url: "./_img/place/1648979987.png",
|
||||
image: null
|
||||
},
|
||||
|
||||
{
|
||||
timestamp: 1648992274,
|
||||
url: "/_img/place/1648992274.png",
|
||||
url: "./_img/place/1648992274.png",
|
||||
image: null
|
||||
},
|
||||
{
|
||||
timestamp: 1649012915,
|
||||
url: "/_img/place/1649012915.png",
|
||||
url: "./_img/place/1649012915.png",
|
||||
image: null
|
||||
},
|
||||
{
|
||||
timestamp: 1649037182,
|
||||
url: "/_img/place/1649037182.png",
|
||||
url: "./_img/place/1649037182.png",
|
||||
image: null
|
||||
},
|
||||
{
|
||||
timestamp: 1649060793,
|
||||
url: "/_img/place/1649060793.png",
|
||||
url: "./_img/place/1649060793.png",
|
||||
image: null
|
||||
},
|
||||
{
|
||||
timestamp: 1649084741,
|
||||
url: "/_img/place/1649084741.png",
|
||||
url: "./_img/place/1649084741.png",
|
||||
image: null
|
||||
},
|
||||
{
|
||||
timestamp: 1649113199,
|
||||
url: "/_img/place/final.png",
|
||||
url: "./_img/place/final.png",
|
||||
image: null,
|
||||
showAtlas: true,
|
||||
},
|
||||
|
|
|
@ -114,8 +114,23 @@ function renderBackground(atlas){
|
|||
|
||||
backgroundContext.closePath();
|
||||
|
||||
backgroundContext.strokeStyle = "rgba(255, 255, 255, 0.8)";
|
||||
var bgStrokeStyle;
|
||||
switch (atlas[i].diff) {
|
||||
case "add":
|
||||
bgStrokeStyle = "rgba(0, 255, 0, 1)";
|
||||
backgroundContext.lineWidth = 2;
|
||||
break;
|
||||
case "edit":
|
||||
bgStrokeStyle = "rgba(255, 255, 0, 1)";
|
||||
backgroundContext.lineWidth = 2;
|
||||
break;
|
||||
default:
|
||||
bgStrokeStyle = "rgba(255, 255, 255, 0.8)";
|
||||
break;
|
||||
}
|
||||
backgroundContext.strokeStyle = bgStrokeStyle;
|
||||
backgroundContext.stroke();
|
||||
backgroundContext.lineWidth = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -691,7 +706,19 @@ function initView(){
|
|||
|
||||
context.globalCompositeOperation = "source-over";
|
||||
|
||||
context.strokeStyle = "rgba(0, 0, 0, 1)";
|
||||
var hoverStrokeStyle;
|
||||
switch (hovered[i].diff) {
|
||||
case "add":
|
||||
hoverStrokeStyle = "rgba(0, 155, 0, 1)";
|
||||
break;
|
||||
case "edit":
|
||||
hoverStrokeStyle = "rgba(155, 155, 0, 1)";
|
||||
break;
|
||||
default:
|
||||
hoverStrokeStyle = "rgba(0, 0, 0, 1)";
|
||||
break;
|
||||
}
|
||||
context.strokeStyle = hoverStrokeStyle;
|
||||
//context.lineWidth = zoom;
|
||||
context.stroke();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue