Compare commits
2 Commits
BotCommand
...
hkremer/re
| Author | SHA1 | Date | |
|---|---|---|---|
| 5b8b01e31a | |||
| 03bcca77f4 |
222
static/app.js
222
static/app.js
@ -1,4 +1,4 @@
|
|||||||
|
//Hopper says hi
|
||||||
// Get the modal
|
// Get the modal
|
||||||
const modal = document.getElementById("myModal");
|
const modal = document.getElementById("myModal");
|
||||||
|
|
||||||
@ -9,141 +9,145 @@ const btn = document.getElementById("myBtn");
|
|||||||
const span = document.getElementsByClassName("close")[0];
|
const span = document.getElementsByClassName("close")[0];
|
||||||
var mode = new URLSearchParams(window.location.search).get("mode");
|
var mode = new URLSearchParams(window.location.search).get("mode");
|
||||||
|
|
||||||
const archiveLink = document.querySelector("#archive-link")
|
const archiveLink = document.querySelector("#archive-link");
|
||||||
const pendingLink = document.querySelector("#pending-link")
|
const pendingLink = document.querySelector("#pending-link");
|
||||||
const statusLink = document.querySelector("#status-link")
|
const statusLink = document.querySelector("#status-link");
|
||||||
function handleForm(event) { event.preventDefault(); }
|
function handleForm(event) {
|
||||||
|
event.preventDefault();
|
||||||
|
}
|
||||||
|
|
||||||
function main() {
|
function main() {
|
||||||
archiveLink.classList.remove("active");
|
archiveLink.classList.remove("active");
|
||||||
pendingLink.classList.remove("active");
|
pendingLink.classList.remove("active");
|
||||||
statusLink.classList.remove("active");
|
statusLink.classList.remove("active");
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case "status":
|
case "status":
|
||||||
statusLink.classList.add("active");
|
statusLink.classList.add("active");
|
||||||
return statusPage();
|
return statusPage();
|
||||||
case "pending":
|
case "pending":
|
||||||
pendingLink.classList.add("active");
|
pendingLink.classList.add("active");
|
||||||
break;
|
break;
|
||||||
case "verifications":
|
case "verifications":
|
||||||
archiveLink.classList.add("active");
|
archiveLink.classList.add("active");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
console.log("No mode");
|
console.log("No mode");
|
||||||
mode = "verifications"
|
mode = "verifications";
|
||||||
archiveLink.classList.add("active");
|
archiveLink.classList.add("active");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
document.getElementById("main-app").innerHTML = '';
|
document.getElementById("main-app").innerHTML = "";
|
||||||
fetch(`https://thanos.nightmare.haus/api/${mode}`)
|
fetch(`https://thanos.nightmare.haus/api/${mode}`)
|
||||||
.then(response => response.json())
|
.then((response) => response.json())
|
||||||
.then(data => processData(data));
|
.then((data) => processData(data));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function statusPage() {
|
function statusPage() {
|
||||||
document.getElementById("main-app").innerHTML = '';
|
document.getElementById("main-app").innerHTML = "";
|
||||||
fetch(`https://thanos.nightmare.haus/api/config`)
|
fetch(`https://thanos.nightmare.haus/api/config`)
|
||||||
.then(response => response.json())
|
.then((response) => response.json())
|
||||||
.then(data => {
|
.then((data) => {
|
||||||
var node = document.createElement("config-status");
|
var node = document.createElement("config-status");
|
||||||
|
|
||||||
var upTime = document.createElement("div");
|
var upTime = document.createElement("div");
|
||||||
upTime.setAttribute("slot", "uptime");
|
upTime.setAttribute("slot", "uptime");
|
||||||
upTime.innerText = data.Uptime;
|
upTime.innerText = data.Uptime;
|
||||||
node.appendChild(upTime);
|
node.appendChild(upTime);
|
||||||
|
|
||||||
var bumpTime = document.createElement("div");
|
var bumpTime = document.createElement("div");
|
||||||
bumpTime.setAttribute("slot", "lastbump")
|
bumpTime.setAttribute("slot", "lastbump");
|
||||||
bumpTime.innerText = new Date(data.BumpTime).toLocaleString();
|
bumpTime.innerText = new Date(data.BumpTime).toLocaleString();
|
||||||
node.appendChild(bumpTime);
|
node.appendChild(bumpTime);
|
||||||
|
|
||||||
node.setData(data);
|
node.setData(data);
|
||||||
|
|
||||||
document.getElementById("main-app").appendChild(node);
|
document.getElementById("main-app").appendChild(node);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function searchPage() {
|
function searchPage() {
|
||||||
var search = document.getElementById("search-bar");
|
var search = document.getElementById("search-bar");
|
||||||
fetch('https://thanos.nightmare.haus/api/verifications')
|
fetch("https://thanos.nightmare.haus/api/verifications")
|
||||||
.then(response => response.json())
|
.then((response) => response.json())
|
||||||
.then(data => {
|
.then((data) => {
|
||||||
var searchData = [];
|
var searchData = [];
|
||||||
for (user of data) {
|
for (user of data) {
|
||||||
var match = false;
|
var match = false;
|
||||||
|
|
||||||
if (user.Username.toLowerCase().includes(search.value.toLowerCase())) {
|
if (user.Username.toLowerCase().includes(search.value.toLowerCase())) {
|
||||||
match = true;
|
match = true;
|
||||||
}
|
}
|
||||||
if (new Date(user.Closed).toLocaleString().includes(search.value)) {
|
if (new Date(user.Closed).toLocaleString().includes(search.value)) {
|
||||||
match = true;
|
match = true;
|
||||||
}
|
}
|
||||||
if (user.UserID.includes(search.value)) {
|
if (user.UserID.includes(search.value)) {
|
||||||
match = true;
|
match = true;
|
||||||
}
|
}
|
||||||
if (match) {
|
if (match) {
|
||||||
searchData.push(user);
|
searchData.push(user);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
processData(searchData);
|
processData(searchData);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function processData(data) {
|
function processData(data) {
|
||||||
document.getElementById("main-app").innerHTML = '';
|
document.getElementById("main-app").innerHTML = "";
|
||||||
if (data.length == 0) {
|
if (data.length == 0) {
|
||||||
alert("No data.");
|
alert("No data.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
data = Object.values(data);
|
data = Object.values(data);
|
||||||
for (user of data) {
|
for (user of data) {
|
||||||
var node = document.createElement("user-card");
|
var node = document.createElement("user-card");
|
||||||
var nameSlot = document.createElement("div");
|
var nameSlot = document.createElement("div");
|
||||||
nameSlot.setAttribute("slot", "username");
|
nameSlot.setAttribute("slot", "username");
|
||||||
nameSlot.innerText = user.Username;
|
nameSlot.innerText = user.Username;
|
||||||
node.appendChild(nameSlot);
|
node.appendChild(nameSlot);
|
||||||
|
|
||||||
var joinDate = document.createElement("div");
|
var joinDate = document.createElement("div");
|
||||||
joinDate.setAttribute("slot", "join-date");
|
joinDate.setAttribute("slot", "join-date");
|
||||||
joinDate.innerText = mode == "pending" ? new Date(user.Submitted).toLocaleString() : new Date(user.Closed).toLocaleString();
|
joinDate.innerText =
|
||||||
node.appendChild(joinDate);
|
mode == "pending"
|
||||||
|
? new Date(user.Submitted).toLocaleString()
|
||||||
|
: new Date(user.Closed).toLocaleString();
|
||||||
|
node.appendChild(joinDate);
|
||||||
|
|
||||||
var discordSlot = document.createElement("div");
|
var discordSlot = document.createElement("div");
|
||||||
discordSlot.setAttribute("slot", "discord-id");
|
discordSlot.setAttribute("slot", "discord-id");
|
||||||
discordSlot.innerText = user.UserID;
|
discordSlot.innerText = user.UserID;
|
||||||
node.appendChild(discordSlot);
|
node.appendChild(discordSlot);
|
||||||
|
|
||||||
var picSlot = document.createElement("div");
|
var picSlot = document.createElement("div");
|
||||||
picSlot.setAttribute("slot", "pic-link");
|
picSlot.setAttribute("slot", "pic-link");
|
||||||
var aNode = document.createElement("a");
|
var aNode = document.createElement("a");
|
||||||
|
|
||||||
aNode.setAttribute("href", mode == "pending" ? user.Photo : `https://thanos.nightmare.haus/${user.Photo}`);
|
aNode.setAttribute(
|
||||||
aNode.innerText = "Verification Photo";
|
"href",
|
||||||
|
mode == "pending"
|
||||||
|
? user.Photo
|
||||||
|
: `https://thanos.nightmare.haus/${user.Photo}`
|
||||||
|
);
|
||||||
|
aNode.innerText = "Verification Photo";
|
||||||
|
|
||||||
picSlot.appendChild(aNode);
|
picSlot.appendChild(aNode);
|
||||||
node.appendChild(picSlot);
|
node.appendChild(picSlot);
|
||||||
document.getElementById("main-app").appendChild(node);
|
document.getElementById("main-app").appendChild(node);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// When the user clicks on <span> (x), close the modal
|
// When the user clicks on <span> (x), close the modal
|
||||||
span.onclick = function () {
|
span.onclick = function () {
|
||||||
modal.style.display = "none";
|
modal.style.display = "none";
|
||||||
}
|
};
|
||||||
|
|
||||||
// When the user clicks anywhere outside of the modal, close it
|
// When the user clicks anywhere outside of the modal, close it
|
||||||
window.onclick = function (event) {
|
window.onclick = function (event) {
|
||||||
if (event.target == modal) {
|
if (event.target == modal) {
|
||||||
modal.style.display = "none";
|
modal.style.display = "none";
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
var form = document.getElementById("search-form");
|
var form = document.getElementById("search-form");
|
||||||
form.addEventListener('submit', handleForm);
|
form.addEventListener("submit", handleForm);
|
||||||
|
|
||||||
main();
|
main();
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
//Hopper says hi again
|
||||||
const basicCard = document.createElement('basic-card');
|
const basicCard = document.createElement('basic-card');
|
||||||
const configStatus = document.createElement('status');
|
const configStatus = document.createElement('status');
|
||||||
const style = `
|
const style = `
|
||||||
|
|||||||
Reference in New Issue
Block a user