Fixes to style :)
This commit is contained in:
parent
371f5e25bc
commit
076d347a65
2 changed files with 50 additions and 35 deletions
|
|
@ -63,10 +63,6 @@ img.icn {
|
||||||
max-width: 1024px !important;
|
max-width: 1024px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
img.blurred {
|
|
||||||
filter: blur(10%);
|
|
||||||
}
|
|
||||||
|
|
||||||
.outline-text {
|
.outline-text {
|
||||||
color: white;
|
color: white;
|
||||||
text-shadow: -1px 0 rgba(0, 0, 0, .5), 0 1px rgba(0, 0, 0, .5), 1px 0 rgba(0, 0, 0, .5), 0 -1px rgba(0, 0, 0, .5);
|
text-shadow: -1px 0 rgba(0, 0, 0, .5), 0 1px rgba(0, 0, 0, .5), 1px 0 rgba(0, 0, 0, .5), 0 -1px rgba(0, 0, 0, .5);
|
||||||
|
|
@ -92,4 +88,17 @@ img.blurred {
|
||||||
|
|
||||||
.card {
|
.card {
|
||||||
background-color: #323232 !important;
|
background-color: #323232 !important;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: transform ease-in-out 300ms;
|
||||||
|
font-family: 'MinecraftiaRegular';
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-img-top {
|
||||||
|
width: 100%;
|
||||||
|
height: 65%;
|
||||||
|
object-fit: cover;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card:hover {
|
||||||
|
transform: translateY(-10px);
|
||||||
}
|
}
|
||||||
72
forgeserv.js
72
forgeserv.js
|
|
@ -14,6 +14,12 @@ const update = async () => {
|
||||||
for (const el of elements) {
|
for (const el of elements) {
|
||||||
serverElements.appendChild(el);
|
serverElements.appendChild(el);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Init all tooltips to be bootstrappy bois
|
||||||
|
[].slice.call(document.querySelectorAll('[data-toggle="tooltip"]'))
|
||||||
|
.map(function (tooltipTriggerEl) {
|
||||||
|
return new bootstrap.Tooltip(tooltipTriggerEl);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const renderServer = async (server) => {
|
const renderServer = async (server) => {
|
||||||
|
|
@ -25,56 +31,55 @@ const renderServer = async (server) => {
|
||||||
const card = document.createElement('div');
|
const card = document.createElement('div');
|
||||||
card.className = 'card';
|
card.className = 'card';
|
||||||
|
|
||||||
|
if (dynmapUrl) {
|
||||||
|
card.addEventListener('click', () => {
|
||||||
|
window.open(dynmapUrl, "_blank");
|
||||||
|
});
|
||||||
|
card.setAttribute("data-toggle", "tooltip");
|
||||||
|
card.setAttribute("data-placement", "top");
|
||||||
|
card.setAttribute("title", "Click to View Dynmap");
|
||||||
|
} else {
|
||||||
|
card.setAttribute("data-toggle", "tooltip");
|
||||||
|
card.setAttribute("data-placement", "top");
|
||||||
|
card.setAttribute("title", "No Dynmap for this Server 😭");
|
||||||
|
}
|
||||||
|
|
||||||
const img = document.createElement('img');
|
const img = document.createElement('img');
|
||||||
img.className ='blurred card-img-top';
|
img.className = 'card-img-top';
|
||||||
img.src = `/Resources/servers/${id}/cover.png`;
|
img.src = `/Resources/servers/${id}/cover.png`;
|
||||||
|
|
||||||
const icn = document.createElement('img');
|
const icn = document.createElement('img');
|
||||||
icn.className = 'icn';
|
icn.className = 'icn';
|
||||||
icn.src = data.favicon ? data.favicon : '/Resources/default-icon.png';
|
icn.src = data.favicon ? data.favicon : '/Resources/default-icon.png';
|
||||||
|
|
||||||
const title = document.createElement('h3');
|
|
||||||
title.className = 'card-title';
|
|
||||||
title.innerText = name;
|
|
||||||
|
|
||||||
card.appendChild(img);
|
card.appendChild(img);
|
||||||
card.appendChild(icn);
|
card.appendChild(icn);
|
||||||
card.appendChild(title);
|
|
||||||
|
|
||||||
const cardText = document.createElement('div');
|
const container = document.createElement('p');
|
||||||
cardText.className = 'card-text';
|
container.className = 'card-body';
|
||||||
|
|
||||||
const sts = document.createElement('h6');
|
|
||||||
sts.innerText = `Server is ${data.online ? 'online' : 'offline'}`;
|
|
||||||
sts.style.color = data.online ? '#7cb342' : '#ff4340';
|
|
||||||
|
|
||||||
const cnt = document.createElement('p');
|
|
||||||
cnt.innerText = `${data.players.now} / ${data.players.max} Players Online`;
|
|
||||||
|
|
||||||
const ver = document.createElement('p');
|
|
||||||
ver.innerText = `Minecraft Version ${data.server.name}`;
|
|
||||||
|
|
||||||
|
|
||||||
cardText.appendChild(sts);
|
const title = document.createElement('h4');
|
||||||
cardText.appendChild(cnt);
|
title.className = 'card-title mb-3';
|
||||||
cardText.appendChild(ver);
|
title.innerText = `${name}: (${data.online ? 'Online' : 'Offline'})`;
|
||||||
card.appendChild(cardText);
|
title.style.color = data.online ? '#7cb342' : '#ff4340';
|
||||||
|
container.appendChild(title);
|
||||||
|
|
||||||
|
const ver = document.createElement('h5');
|
||||||
|
ver.innerText = `Server Running ${data.server.name}`;
|
||||||
|
|
||||||
|
const cnt = document.createElement('h6');
|
||||||
|
cnt.innerText = `${data.players.now}/${data.players.max} Players Online`;
|
||||||
|
|
||||||
if (hasPackVer) {
|
if (hasPackVer) {
|
||||||
const packVer = document.createElement('h4');
|
const packVer = document.createElement('h5');
|
||||||
packVer.innerText = `Modpack Version ${extractVersion(data.motd)}`;
|
packVer.innerText = `Modpack Version ${extractVersion(data.motd)}`;
|
||||||
card.appendChild(packVer);
|
container.appendChild(packVer);
|
||||||
}
|
}
|
||||||
if (dynmapUrl) {
|
|
||||||
const dynAnc = document.createElement('a');
|
|
||||||
dynAnc.href = dynmapUrl;
|
|
||||||
|
|
||||||
const dmap = document.createElement('b');
|
container.appendChild(ver);
|
||||||
dmap.innerText = `${name.substring(0, 1).toUpperCase() + name.slice(1)} Dynmap`;
|
container.appendChild(cnt);
|
||||||
|
card.appendChild(container);
|
||||||
dynAnc.appendChild(dmap);
|
|
||||||
card.appendChild(dynAnc);
|
|
||||||
}
|
|
||||||
|
|
||||||
return card;
|
return card;
|
||||||
};
|
};
|
||||||
|
|
@ -87,6 +92,7 @@ const extractVersion = (motd) => {
|
||||||
window.addEventListener('load', () => {
|
window.addEventListener('load', () => {
|
||||||
update();
|
update();
|
||||||
document.body.classList.remove("loading");
|
document.body.classList.remove("loading");
|
||||||
|
|
||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
update();
|
update();
|
||||||
}, 30000);
|
}, 30000);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue