Looks AMAZING

This commit is contained in:
dginovker 2021-01-07 16:21:34 -05:00
parent 80852925d0
commit 0ccc943caf
3 changed files with 65 additions and 19 deletions

View File

@ -127,7 +127,8 @@ English
<li><a href="./../../404.html" class="fly"><span>Password Recovery</span></a></li>
<li><a href="./../../404.html" class="fly"><span>Locked Account Recovery</span></a></li>
<li><a href="./../../404.html" class="fly"><span>Appeal Bans & Mutes</span></a></li>
<li><a href="./../../services/m=bugtracker_v4/index.html" class="fly"><span>Submit a Bug Report</span></a></li>
<li><a href="./../../services/m=bugtracker_v4/index.html" class="fly"><span>Submit a Bug Report</span></a>
</li>
<li><a href="./../../404.html" class="fly"><span>Parents' Guide</span></a></li>
</ul>
</li>
@ -438,7 +439,8 @@ English
<tr>
<td>
<span style="white-space: nowrap;">
<img src="../../site/img/osrsimg/ironman.png" style="height: 11px; padding-right: 30px;">
<img src="../../site/img/osrsimg/ironman.png"
style="height: 11px; padding-right: 30px;">
<label class="control control-checkbox">
<input type="checkbox" name="check_iron" id="check_iron" value="1" class="checkbox"
style="pointer-events: none;" />
@ -448,10 +450,11 @@ English
</td>
<td>
<span style="white-space: nowrap;">
<img src="../../site/img/osrsimg/ultimateironman.png" style="height: 11px; padding-right: 25px;">
<img src="../../site/img/osrsimg/ultimateironman.png"
style="height: 11px; padding-right: 25px;">
<label class="control control-checkbox">
<input type="checkbox" name="check_ultiron" id="check_ultiron" value="1" class="checkbox"
style="pointer-events: none;" />
<input type="checkbox" name="check_ultiron" id="check_ultiron" value="1"
class="checkbox" style="pointer-events: none;" />
<div class="control_indicator"></div>
</label>
</span>
@ -460,8 +463,8 @@ English
<span style="white-space: nowrap;">
<img src="../../site/img/osrsimg/hcim.png" style="height: 11px; padding-right: 25px;">
<label class="control control-checkbox">
<input type="checkbox" name="check_hciron" id="check_hciron" value="1" class="checkbox"
style="pointer-events: none;" />
<input type="checkbox" name="check_hciron" id="check_hciron" value="1"
class="checkbox" style="pointer-events: none;" />
<div class="control_indicator"></div>
</label>
</span>
@ -507,6 +510,12 @@ English
</div>
</div>
<br style="clear:both" />
<div style="width: 100%; text-align: center; padding-top: 6px;">
<span id="total_xp"
style="display: inline-block; color: rgba(211, 200, 163, 0.9); font-weight: bold; opacity: 0; transition: opacity 2s; -webkit-transition: opacity 2s;">
Loading..
</span>
</div>
</div>
</div>
</div>

View File

@ -1,5 +1,7 @@
var hiscores = hiscores || {};
let activityInfo = [];
hiscores.populateActivityTable = () => {
row = (num) => document.getElementsByClassName(`row row${num}`)[0]; // Small wrapper that gets a row by just the row #
@ -18,15 +20,7 @@ hiscores.populateActivityTable = () => {
row(i).childNodes[5].innerHTML = "";
}
[["Total XP", "getServerTotalXp", "total_xp"],
["Total Slayer Tasks Completed", "getServerTotalSlayerTasks", "total_tasks"],
["Total Logs Chopped", "getServerTotalAttribute/logs_chopped", "sum"],
["Total Fish Caught", "getServerTotalAttribute/fish_caught", "sum"],
["Total Rocks Mined", "getServerTotalAttribute/rocks_mined", "sum"],
["Total Al Kharid Gate Tax", "getServerTotalAttribute/alkharid_gate", "sum"],
["Total Enemies Killed", "getServerTotalAttribute/enemies_killed", "sum"],
["Total Deaths", "getServerTotalAttribute/deaths", "sum"],
].forEach(([title, endpoint, resultAttr], index) => {
activityInfo.forEach(([title, endpoint, resultAttr], index) => {
row(index + 1).childNodes[3].innerHTML = title;
row(index + 1).childNodes[5].innerHTML = `<span style="color: rgba(186, 128, 63, 0.4);">Loading..</span>`;
fetch(`${hiscores.apiURL}/hiscores/${endpoint}/${restrictions}`)
@ -38,6 +32,16 @@ hiscores.populateActivityTable = () => {
});
}
hiscores.enterTotalXp = () => {
fetch(`${hiscores.apiURL}/hiscores/getServerTotalXp/${restrictions}`)
.then(response => response.json())
.then(result => {
document.getElementById("total_xp").innerText = "Server Total XP: " + Math.round(result.total_xp).toLocaleString();
document.getElementById("total_xp").style.opacity = "1";
})
.catch(error => console.log('error', error));
}
/**
* In URL ?player=guthix, passing param "player" will return "guthix"
* In same example, passing param "page" will return null
@ -82,9 +86,27 @@ if (getParam("maxXP")) {
document.getElementById('maxXP').value = getParam("maxXP");
document.getElementById('maxXPoutput').innerHTML = getParam("maxXP");
}
switch (getParam("filter")) {
case "combat":
activityInfo.push(["Total Slayer Tasks Completed", "getServerTotalSlayerTasks", "total_tasks"]);
activityInfo.push(["Total Enemies Killed", "getServerTotalAttribute/enemies_killed", "sum"]);
activityInfo.push(["Total Deaths", "getServerTotalAttribute/deaths", "sum"]);
break;
case "miscellaneous":
activityInfo.push(["Total Al Kharid Gate Tax", "getServerTotalAttribute/alkharid_gate", "sum"]);
break;
default: // Skilling
activityInfo.push(["Total Logs Chopped", "getServerTotalAttribute/logs_chopped", "sum"]);
activityInfo.push(["Total Fish Caught", "getServerTotalAttribute/fish_caught", "sum"]);
activityInfo.push(["Total Rocks Mined", "getServerTotalAttribute/rocks_mined", "sum"]);
break;
}
restrictions = JSON.stringify(restrictions);
hiscores.linkLeftTabActivityNames("activity");
hiscores.initializePageArrows("activity");
hiscores.initalizeRightsideButtons("activity");
hiscores.populateActivityTable("activity");
hiscores.populateActivityTable("activity");
hiscores.enterTotalXp();

View File

@ -1,6 +1,6 @@
var hiscores = hiscores || {};
hiscores.apiURL = "https://2800a66204e1.ngrok.io";
hiscores.apiURL = "http://localhost:3000";
hiscores.sName = [
"Attack",
@ -49,6 +49,21 @@ hiscores.linkLeftTabSkillNames = (loc = "hiscores") => {
});
}
hiscores.linkLeftTabActivityNames = (loc = "activities") => {
document.getElementsByClassName(` Slayer ico`)[0].addEventListener("click", function (e) {
e.preventDefault();
window.location.replace(`./${loc}.html?filter=combat${hiscores.getFiltersAsURLparams()}`);
});
document.getElementsByClassName(` Summoning ico`)[0].addEventListener("click", function (e) {
e.preventDefault();
window.location.replace(`./${loc}.html?filter=miscellaneous${hiscores.getFiltersAsURLparams()}`);
});
document.getElementsByClassName(` Overall ico`)[0].addEventListener("click", function (e) {
e.preventDefault();
window.location.replace(`./${loc}.html${hiscores.getFiltersAsURLparams()}`);
});
}
hiscores.initializePageArrows = (loc = "hiscores") => {
document.getElementById("button-up").addEventListener("click", function (e) {
e.preventDefault();
@ -99,7 +114,7 @@ hiscores.initalizeRightsideButtons = (loc = "hiscores") => {
e.preventDefault();
let pageRemovedFiltersLocation = window.location.search.split(/\?iron=[A-z]+|\?ultiron=[A-z]+|\?hciron=[A-z]+|\?maxXP=[\d\.]+/).join('');
window.location.replace(`./${loc}.html${pageRemovedFiltersLocation}`);
})
})
}
}