update map

This commit is contained in:
Minecon724 2024-10-10 19:42:49 +02:00
parent dfa7618cc9
commit 5351a37dda
Signed by: Minecon724
GPG key ID: 3CCC4D267742C8E8
2 changed files with 23 additions and 14 deletions

View file

@ -13,38 +13,42 @@ var de1t = [50.085448739143715, 8.461733038044116];
// title, hostname, popup, location // title, hostname, popup, location
var nodes = { var nodes = {
pl1: { pl1: {
country: 'pl',
location: [52.1904441909767, 20.922122237417636], location: [52.1904441909767, 20.922122237417636],
city: "Warsaw, Poland", city: "Warsaw, Poland",
hostname: "pl1.420129.xyz", hostname: "pl1.420129.xyz",
datacenter: "equinix wa3", datacenter: "equinix wa3",
description: "", description: ``,
publicKey: "v854+5m4Diqh8oGo6/sGVS7LELsreIjMujkWqwc6bWo=", publicKey: "v854+5m4Diqh8oGo6/sGVS7LELsreIjMujkWqwc6bWo=",
linkLocal: "fe80::129:3" linkLocal: "fe80::129:3"
}, },
de1: { de1: {
country: 'de',
location: [49.44951340282083, 11.014075123186862], location: [49.44951340282083, 11.014075123186862],
city: "Nuremberg, Germany", city: "Nuremberg, Germany",
hostname: "de1.420129.xyz", hostname: "de1.420129.xyz",
datacenter: "hetzner nbg", datacenter: "hetzner nbg",
description: "Tunneled to Frankfurt. If you have a node here at hetzner nuremberg, it will go nbg -> fra -> nbg.", description: `Tunneled to Frankfurt. If you have a node here at hetzner nuremberg, it will go nbg -> fra -> nbg.`,
publicKey: "N9rGceoiFcc/obnHrqMAmVlrb/E2Br55+doekTKwNF8=", publicKey: "N9rGceoiFcc/obnHrqMAmVlrb/E2Br55+doekTKwNF8=",
linkLocal: "fe80::129:2" linkLocal: "fe80::129:2"
}, },
nl1: { nl1: {
country: 'nl',
location: [52.36679746122722, 4.891598348592709], location: [52.36679746122722, 4.891598348592709],
city: "Amsterdam, Netherlands", city: "Amsterdam, Netherlands",
hostname: "nl1.420129.xyz", hostname: "nl1.420129.xyz",
datacenter: "scaleway AMS-1", datacenter: "scaleway AMS-1",
description: "I don't know where exactly", description: `I don't know where exactly`,
publicKey: "iZfLBtF6BiQvdKXx4Yl02u+OL6ls35gSpWCRmB9q4lU=", publicKey: "iZfLBtF6BiQvdKXx4Yl02u+OL6ls35gSpWCRmB9q4lU=",
linkLocal: "fe80::129:1" linkLocal: "fe80::129:1"
}, },
it1: { it1: {
country: 'it',
location: [41.66806722233489, 12.503981281868477], location: [41.66806722233489, 12.503981281868477],
city: "Rome, Italy", city: "Rome, Italy",
hostname: "it1.420129.xyz", hostname: "it1.420129.xyz",
datacenter: "c1vhosting?", datacenter: "c1vhosting?",
description: "Location also approximate, there's no evidence of the existence of the data center", description: `Location also approximate, there's no evidence of the existence of the data center`,
publicKey: "", publicKey: "",
linkLocal: "fe80::129:4" linkLocal: "fe80::129:4"
} }
@ -68,9 +72,11 @@ sidebarContent.onclick = (ev) => {
console.log('a') console.log('a')
//sidebarContent.removeChild(opened); //sidebarContent.removeChild(opened);
popup.offsetHeight;
popup.style.height = rect.height - 20 + 'px'; popup.style.height = rect.height - 20 + 'px';
popup.style.transform = 'none'; popup.style.transform = 'none';
nodesElement.style.opacity = 1; nodesElement.style.opacity = 1;
sidebarContent.style.backgroundColor = null;
opened = null; opened = null;
map.closePopup(); map.closePopup();
@ -88,7 +94,7 @@ function onNodeClick(ev, node, elem) {
nodesElement.style.opacity = 0; nodesElement.style.opacity = 0;
ele = elem.cloneNode(true); ele = elem.cloneNode(true);
ele.innerHTML += `<br><br>Datacenter: <span class="code">${node.datacenter}</span><br>${node.description.split('\n').slice(1).join('\n')}`; ele.innerHTML += `<br><br>Datacenter: <span class="code">${node.datacenter}</span><br>${node.description.split('\n').slice(1).join('<br>')}`;
ele.onclick = (ev) => {ev.stopPropagation()}; ele.onclick = (ev) => {ev.stopPropagation()};
ele.classList.add('selectedNode'); ele.classList.add('selectedNode');
@ -104,8 +110,9 @@ function onNodeClick(ev, node, elem) {
const destY = 72 - rect.top; // window.innerHeight / 4 const destY = 72 - rect.top; // window.innerHeight / 4
ele.style.transform = `translateY(${destY}px)`; ele.style.transform = `translateY(${destY}px)`;
ele.style.height = window.innerHeight / 3 + 'px'; ele.style.height = window.innerHeight / 3 + 'px';
sidebarContent.style.backgroundColor = "#111";
opened = [ele, elem]; opened = [ele, elem, node];
ev.stopPropagation(); ev.stopPropagation();
} }
@ -118,7 +125,8 @@ for (let node of Object.values(nodes)) {
ele.onclick = (ev) => { ele.onclick = (ev) => {
marker.openPopup(); marker.openPopup();
map.panTo(node.location, { map.panTo(node.location, {
padding: [1000, 1000] padding: [1000, 1000], // TODO I could use this to fix the small screen issue
duration: 0.3
}); });
onNodeClick(ev, node, ele); onNodeClick(ev, node, ele);
}; };

View file

@ -19,7 +19,7 @@ html, body {
transition: transform .3s ease, height .3s ease; transition: transform .3s ease, height .3s ease;
text-align: left; text-align: left;
background: #222; background-color: #222;
padding: 10px 20px; padding: 10px 20px;
margin: 10px; margin: 10px;
width: calc(100% - 60px); width: calc(100% - 60px);
@ -45,6 +45,7 @@ html, body {
text-align: center; text-align: center;
height: 100%; height: 100%;
width: 300px; width: 300px;
transition: background-color .3s ease;
overflow-x: scroll; overflow-x: scroll;
@ -83,7 +84,7 @@ html, body {
} }
.leaflet-left { .leaflet-left {
margin-left: 320px; margin-left: 310px;
} }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { .leaflet-popup-content-wrapper, .leaflet-popup-tip {
@ -123,18 +124,18 @@ html, body {
@media screen and (max-width: 600px) { @media screen and (max-width: 600px) {
#sidebar { #sidebar {
width: 100%; width: 100%;
height: 320px; height: calc(50vh + 20px);
mask-image: linear-gradient(180deg, black 300px, transparent 320px); mask-image: linear-gradient(180deg, black 50vh, transparent calc(50vh + 20px));
#sidebarContent { #sidebarContent {
width: 100%; width: 100%;
height: 300px; height: 50vh;
} }
} }
.leaflet-left { .leaflet-left {
margin-left: none; margin-left: 5px;
margin-top: 320px; margin-top: calc(50vh + 10px); /* looks finer without the 10px but then can't click through, so I instead added some left margin */
} }
} }