Merge pull request #118 from AleziaKurdis/PlacesApp-add-MS

Places App: "Add MS node" capability
This commit is contained in:
Julian Groß 2022-07-16 22:44:12 +02:00 committed by GitHub
commit d1eba882ec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 111 additions and 38 deletions

View file

@ -487,6 +487,41 @@ div.placeEntry {
text-align: center;
}
div.addMsEntry {
width: 85%;
height: 38px;
background: #292929;
border: 0px;
border-radius: 6px;
box-shadow: 3px 3px 5px rgba(0,0,0,0.8);
margin: 6px 0px 9px 6px;
text-align: left;
}
#addMS {
margin: 8px;
width: 85%;
}
#addMsBtn {
background: #bababa;
background-image: linear-gradient(to bottom, #bababa, #424242);
border-radius: 4px;
color: #ffffff;
font-size: 18px;
padding: 1px 5px 1px 5px;
border: 0px;
text-decoration: none;
font-weight: 700;
}
#addMsBtn:hover {
background: #e0e0e0;
background-image: linear-gradient(to bottom, #e0e0e0, #737373);
text-decoration: none;
font-weight: 700;
}
div.placeEntryHighlighter {
width: 85%;
height: 80px;
@ -913,3 +948,10 @@ button.federationFilterOn:hover {
button.externalFilterOn:hover {
border: solid #00e2ff 1px;
}
#reloading {
width: 80%;
color: #ffffff;
font-size: 18px;
text-align: center;
}

View file

@ -246,6 +246,9 @@
}
formattedMetaverseList = formattedMetaverseList + "<div class = 'addMsEntry'><input type = 'text' id='addMS'> <button id='addMsBtn' onclick='addMS();'>&plus;</button></div>";
formattedMetaverseList = formattedMetaverseList + "<div id='reloading'></div>";
document.getElementById("searchFiltersBar").style.display = "none";
document.getElementById("list_content").innerHTML = formattedMetaverseList;
@ -509,6 +512,7 @@
"value": pinned
};
EventBridge.emitWebEvent(JSON.stringify(message));
document.getElementById("reloading").innerHTML = "RELOADING...";
sleepFor(210);
reload();
}
@ -521,6 +525,7 @@
"value": fetch
};
EventBridge.emitWebEvent(JSON.stringify(message));
document.getElementById("reloading").innerHTML = "RELOADING...";
sleepFor(210);
reload();
}
@ -750,6 +755,21 @@
while(new Date().getTime() < now + milliseconds){ /* do nothing */ }
}
function addMS() {
var msUrlToAdd = document.getElementById("addMS").value;
if (msUrlToAdd.substr(0, 4).toLocaleLowerCase() === "http") {
var message = {
"channel": channel,
"action": "ADD_MS",
"metaverseUrl": msUrlToAdd
};
EventBridge.emitWebEvent(JSON.stringify(message));
document.getElementById("reloading").innerHTML = "RELOADING...";
sleepFor(210);
reload();
}
}
displayMaturityFilter();
document.getElementById("clearBtn").style.display = "none";
document.getElementById("searchFiltersBar").style.display = "none";

View file

@ -107,7 +107,18 @@
timestamp = d.getTime();
metaverseServers[messageObj.metaverseIndex].fetch = messageObj.value;
saveMetaverseToFetchSetting();
} else if (messageObj.action === "ADD_MS" && (n - timestamp) > INTERCALL_DELAY) {
d = new Date();
timestamp = d.getTime();
var newMs = {
"url": messageObj.metaverseUrl,
"region": "external",
"fetch": false,
"pinned": true,
"order": "Z"
}
metaverseServers.push(newMs);
savePinnedMetaverseSetting();
}
}
}