Some ironman stuuff

This commit is contained in:
dginovker 2020-12-09 16:12:19 -05:00
parent 071378af1e
commit 2fa7073cf8
3 changed files with 11 additions and 5 deletions

View File

@ -96,8 +96,12 @@ hiscores.formatName = (name, aposS = false) => {
return name;
}
hiscores.setHeadSkillIcon = (skillName) => {
document.getElementById("scores_head_icon").src = `../../site/img/hiscores/skill_icon_${skillName.toLowerCase()}1eccb.gif`;
hiscores.setHeadSkillIcon = (icon) => {
if (icon.includes(".")) {
document.getElementById("scores_head_icon").src = icon;
} else {
document.getElementById("scores_head_icon").src = `../../site/img/hiscores/skill_icon_${icon.toLowerCase()}1eccb.gif`;
}
}
hiscores.setHeadSkillText = (text) => {

View File

@ -1,4 +1,5 @@
var hiscores = hiscores || {};
const ironmanIcon = `<img src="../../site/img/osrsimg/ironman.png" style="height: 11px"> `
hiscores.loadDefaultHSTable = () => {
fetch(`${hiscores.apiURL}/highscores/playersByTotal`)
@ -22,7 +23,7 @@ hiscores.populateDefaultHSTable = () => {
row.childNodes[3].replaceWith(document.createElement("td"));
row.childNodes[3].className = "alL";
row.childNodes[3].innerHTML = `<a href="./hiscores.html">${playerData ? hiscores.formatName(playerData.username) : ""}</a>`;
row.childNodes[3].innerHTML = `${playerData && playerData.iron_mode === "1" ? ironmanIcon : ""}<a href="./hiscores.html">${playerData ? hiscores.formatName(playerData.username) : ""}</a>`;
row.childNodes[3].addEventListener("click", function (e) {
e.preventDefault();
hiscores.loadUserTable(playerData.username);
@ -44,6 +45,7 @@ hiscores.loadUserTable = (username) => {
.then(result => {
document.getElementById('search_name').style.color = 'black';
hiscores.tableData = result.skills;
hiscores.tableInfo = result.info;
hiscores.populatePlayerHSTable();
hiscores.setHeadSkillText(hiscores.formatName(username, true));
})
@ -54,7 +56,7 @@ hiscores.loadUserTable = (username) => {
}
hiscores.populatePlayerHSTable = () => {
hiscores.setHeadSkillIcon("Constitution");
hiscores.setHeadSkillIcon(hiscores.tableInfo.iron_mode === "0" ? "Constitution" : "../../site/img/osrsimg/ironman.png");
for (let i = 1; i <= 24; i++) {
row = document.getElementsByClassName(`row row${i}`)[0];
@ -105,7 +107,7 @@ hiscores.populateSkillHSTable = () => {
row.childNodes[3].replaceWith(document.createElement("td"));
row.childNodes[3].className = "alL";
row.childNodes[3].innerHTML = `<a href="./hiscores.html">${playerData ? hiscores.formatName(playerData.username) : ""}</a>`;
row.childNodes[3].innerHTML = `${playerData && playerData.iron_mode === "1" ? ironmanIcon : ""}<a href="./hiscores.html">${playerData ? hiscores.formatName(playerData.username) : ""}</a>`;
row.childNodes[3].addEventListener("click", function (e) {
e.preventDefault();
hiscores.loadUserTable(playerData.username);

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB