Added memberlist and url parameters

This commit is contained in:
lkarch 2025-05-22 13:14:23 -04:00
parent ff9da2efb0
commit 6c10dac168
3 changed files with 55 additions and 34 deletions

View File

@ -1,7 +1,12 @@
const url = new URL(window.location.toLocaleString());
const sectionList = document.getElementsByClassName("section");
const nnRuler = "cool_tellow";
const nnCoRuler = "ColoradoCrusade";
const electionDate = "2025-6-30";
const memberList = ["Omtegu", "pupik923", "cool_tellow", "JoeTheDauntless", "black_frieza", "Jinx64_", "eldiego", "Gero06", "Spencer1019", "mrcreeperg4", "TiredToonz", "idan1503", "Wormzy333", "ColoradoCrusade", "spenten", "Geogaddiiii", "Austcd30", "MyNameIsRasheed", "MrSteam84", "TwoGoodFiveme", "ara2009", "Ransterr", "ItzFriez6312", "ArzoAblaze", "jssjsjjssj", "toiletteeth", "B8arn", "FredDerp", "Georgequank", "hunterg2i", "KarmaIsDepressed", "Mini", "ChilliChillt", "ServerLite", "proper_cat", "Master__Kief", "ItzBiblcle", "MrAss_asd", "Burningskull562", "se2p", "mindlord", "ItIsYeFish", "pivozavr2004", "latcyy", "LuckKir", "oggghrkwneh", "MiHoub", "David", "lkarch", "MegaByteX", "ScaryCowCow4", "Glanthrial", "Deskfan45", "nielubiecie321", "BoomFox_Official", "DrDews", "DrNubXP", "hagluciak19", "SavageUser", "Fireballiceball", "JakeRedstone", "kaiookk1", "My_ChairSlipped", "j63k", "jurckurc", "workingontrying", "KevinDurantgoat", "Creeperpaste", "Islando_Commando", "Migzotic", "Teasoup", "F8fnir", "JorgenMister", "isnikoda", "TrustedHawk1855", "Revivey", "BleonIlazi", "AgentTammy", "Losangelesquest", "jeorm", "CrafterSteve98", "ilikemacandcheez", "NotRawZach", "herrydicc", "Hendway", "Pugino", "TeeDoesStuff", "TomAndBon", "SJET_Inc", "Urogalo", "arrochista", "JakePaulcraft", "WetBed43", "grammarissue", "pappoy76", "BurgerMan_27", "ilhanerdem2015", "BashurverseMC", "Batteryacids", "freddyw", "Acid0verl0ad", "CerealBoiz", "Q_QIndustries", "minerkat2011", "Capital3", "Assult_penguin", "NexSol", "DrWild", "nnnnn", "Jerry_juju", "hanxing", "Juasonxd", "Mikey_herobrine", "FluffyFoxFae", "Karmatical0", "ItsMxt", "Yen45", "Olat", "FredMCGamer", "capitanatomico", "DanielRobert15", "Hefeng_Song", "Leozero_", "MyGmail", "SkyNotBlue", "eldiegoat", "huntermkk", "ItsVollx", "sonictank1", "Miyazaki", "Beanzo0", "VolxyzMC", "tvoreal", "sushi_king86", "KAMILE33", "pascal_machet", "barton1357TF2", "Yungyoungin1", "kleeorg", "SnailRibs", "yourstruly71", "Csorroflegma", "ahhhhhhhh1587", "Lofeee", "mmakart", "adebuilder", "Jetteriter", "mud4dum", "Jesper2011", "GREENAPPLE", "guinea_pig_doody", "CreeperX200", "AudemusJura", "cutekttn", "bartur4", "Feruxia", "Kurzov", "MONKEYMAN346776", "breadcool", "Zaku1626", "keyboardan", "tetunnel", "ItTommy22Toad", "FulgencioBatista", "inoxisane", "q0iat", "Levinder", "aidenjamesmcl"];
function getCookie(cookieName) {
var name = cookieName + "=";
var decodedCookie = decodeURIComponent(document.cookie);
@ -27,10 +32,9 @@ function calculateCountdown(endingDate) {
}
function switchSection(sectionName, button) {
var i, section, navButton;
section = document.getElementsByClassName("section");
for (i = 0; i < section.length; i++) {
section[i].style.display = "none";
var i, navButton;
for (i = 0; i < sectionList.length; i++) {
sectionList[i].style.display = "none";
}
navButton = document.getElementsByClassName("navButton");
@ -48,7 +52,7 @@ function switchSection(sectionName, button) {
button.style.color = "black";
}
function onPageLoad() {
function loadRulersAndElectionCountdown() {
console.log(nnRuler);
document.getElementById("ruler").innerText = nnRuler;
document.getElementById("rulerImage").src = "https://minotar.net/armor/body/" + nnRuler + "/100.png";
@ -65,11 +69,29 @@ function onPageLoad() {
} else {
document.getElementById("electionCountdown").innerText = "The next election is in " + Math.ceil(calculateCountdown(electionDate)) + " days!";
}
}
console.log(document.cookie);
if (getCookie("section") === "") {
document.getElementById("electionButton").click();
function loadMemberList() {
for (let member = 0; member < memberList.length; member++) {
const memberListItem = document.createElement("p");
memberListItem.innerHTML = memberList[member];
document.getElementById("memberList").appendChild(memberListItem);
}
}
function onPageLoad() {
loadRulersAndElectionCountdown()
loadMemberList()
if (url.searchParams.has("section")) {
console.log("URL parameter found, forcing section to " + url.searchParams.get("section") + ".");
document.getElementById(url.searchParams.get("section") + "Button").click();
} else if (getCookie("section") === "") {
console.log("A wild user appears! Defaulting to first section, \"" + sectionList[0].id + "\".")
document.getElementById(sectionList[0].id + "Button").click();
} else {
console.log("Section cookie found, restoring section to \"" + getCookie("section") + "\".");
document.getElementById(getCookie("section") + "Button").click();
}
}

View File

@ -1,9 +1,3 @@
@media(max-width:1400px) {
.navButton {
}
}
@font-face {
font-family: 'minecraft';
src: url('/assets/fonts/MinecraftRegular.otf') format('opentype');
@ -40,9 +34,6 @@ body {
overflow-x: hidden;
}
.card {
margin: auto;
border-left: 6px solid #eee;
@ -51,7 +42,6 @@ body {
margin-bottom: 20px;
box-shadow: 2px 2px 8px rgba(0,0,0,0.1);
width: 370px;
height: 322px;
}
.card p {
@ -65,6 +55,7 @@ body {
#cardContainer {
padding-top: 20px;
width: 100%;
}
#splash {
@ -93,6 +84,7 @@ body {
#navbar {
position: fixed;
width: 100%;
background-color: black;
}
.navButton {
@ -101,8 +93,7 @@ body {
border: none;
border-top: 3px solid black;
cursor: pointer;
font-size: 2.4vw;
width: 20%;
font-size: 2vw;
background-color: black;
color: white;
}

View File

@ -12,23 +12,24 @@
</head>
<body onload="onPageLoad()">
<div id="navbar">
<button class="navButton" id="placeholder1Button" onclick="switchSection('placeholder1', this)">Placeholder1</button>
<button class="navButton" id="infoButton" onclick="switchSection('info', this)">Info</button>
<button class="navButton" id="electionButton" onclick="switchSection('election', this)">Election</button>
<button class="navButton" id="placeholder2Button" onclick="switchSection('placeholder2', this)">Placeholder2</button>
<button class="navButton" id="placeholder3Button" onclick="switchSection('placeholder3', this)">Placeholder3</button>
<button class="navButton" id="placeholder4Button" onclick="switchSection('placeholder4', this)">Placeholder4</button>
<button class="navButton" id="constitutionButton" onclick="switchSection('constitution', this)">Constitution</button>
<button class="navButton" id="membersButton" onclick="switchSection('members', this)">Members</button>
<button class="navButton" id="newsButton" onclick="switchSection('news', this)">News Notice</button>
<button class="navButton" id="historyButton" onclick="switchSection('history', this)">History</button>
</div>
<div class="section" id="placeholder1">
<p>placeholder</p>
<div class="section" id="info">
<p>Info</p>
</div>
<div class="section" id="election">
<div id="cardContainer">
<div class="card">
<div class="card" style="height: 322px;">
<p>Ruler<hr></p>
<p id="ruler">Steve</p>
<img id="rulerImage" src="https://minotar.net/body/MHF_Steve/100.png" alt="Player Render">
</div>
<div class="card">
<div class="card" style="height: 322px;">
<p>Co-Ruler<hr></p>
<p id="coRuler">Steve</p>
<img id="coRulerImage" src="https://minotar.net/body/MHF_Steve/100.png" alt="Player Render">
@ -40,14 +41,21 @@
<br>
<p id="electionCountdown">Election Countdown</p>
</div>
<div class="section" id="placeholder2">
<p>placeholder</p>
<div class="section" id="constitution">
<p>Constitution</p>
</div>
<div class="section" id="placeholder3">
<p>placeholder</p>
<div class="section" id="members">
<div id="cardContainer">
<div class="card" id="memberList">
<p>Member List<hr></p>
</div>
</div>
</div>
<div class="section" id="placeholder4">
<p>placeholder</p>
<div class="section" id="news">
<p>News Notice</p>
</div>
<div class="section" id="history">
<p>History</p>
</div>
<script src="assets/javascript/index.js"></script>
</body>