mirror of
https://github.com/2009scape/2009scape.github.io.git
synced 2024-08-18 15:19:56 +02:00
Some ironman stuuff
This commit is contained in:
parent
071378af1e
commit
2fa7073cf8
@ -96,8 +96,12 @@ hiscores.formatName = (name, aposS = false) => {
|
|||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
hiscores.setHeadSkillIcon = (skillName) => {
|
hiscores.setHeadSkillIcon = (icon) => {
|
||||||
document.getElementById("scores_head_icon").src = `../../site/img/hiscores/skill_icon_${skillName.toLowerCase()}1eccb.gif`;
|
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) => {
|
hiscores.setHeadSkillText = (text) => {
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
var hiscores = hiscores || {};
|
var hiscores = hiscores || {};
|
||||||
|
const ironmanIcon = `<img src="../../site/img/osrsimg/ironman.png" style="height: 11px"> `
|
||||||
|
|
||||||
hiscores.loadDefaultHSTable = () => {
|
hiscores.loadDefaultHSTable = () => {
|
||||||
fetch(`${hiscores.apiURL}/highscores/playersByTotal`)
|
fetch(`${hiscores.apiURL}/highscores/playersByTotal`)
|
||||||
@ -22,7 +23,7 @@ hiscores.populateDefaultHSTable = () => {
|
|||||||
|
|
||||||
row.childNodes[3].replaceWith(document.createElement("td"));
|
row.childNodes[3].replaceWith(document.createElement("td"));
|
||||||
row.childNodes[3].className = "alL";
|
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) {
|
row.childNodes[3].addEventListener("click", function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
hiscores.loadUserTable(playerData.username);
|
hiscores.loadUserTable(playerData.username);
|
||||||
@ -44,6 +45,7 @@ hiscores.loadUserTable = (username) => {
|
|||||||
.then(result => {
|
.then(result => {
|
||||||
document.getElementById('search_name').style.color = 'black';
|
document.getElementById('search_name').style.color = 'black';
|
||||||
hiscores.tableData = result.skills;
|
hiscores.tableData = result.skills;
|
||||||
|
hiscores.tableInfo = result.info;
|
||||||
hiscores.populatePlayerHSTable();
|
hiscores.populatePlayerHSTable();
|
||||||
hiscores.setHeadSkillText(hiscores.formatName(username, true));
|
hiscores.setHeadSkillText(hiscores.formatName(username, true));
|
||||||
})
|
})
|
||||||
@ -54,7 +56,7 @@ hiscores.loadUserTable = (username) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
hiscores.populatePlayerHSTable = () => {
|
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++) {
|
for (let i = 1; i <= 24; i++) {
|
||||||
row = document.getElementsByClassName(`row row${i}`)[0];
|
row = document.getElementsByClassName(`row row${i}`)[0];
|
||||||
|
|
||||||
@ -105,7 +107,7 @@ hiscores.populateSkillHSTable = () => {
|
|||||||
|
|
||||||
row.childNodes[3].replaceWith(document.createElement("td"));
|
row.childNodes[3].replaceWith(document.createElement("td"));
|
||||||
row.childNodes[3].className = "alL";
|
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) {
|
row.childNodes[3].addEventListener("click", function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
hiscores.loadUserTable(playerData.username);
|
hiscores.loadUserTable(playerData.username);
|
||||||
|
BIN
site/img/osrsimg/ironman.png
Normal file
BIN
site/img/osrsimg/ironman.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
Loading…
Reference in New Issue
Block a user