From 2fa7073cf87125b2ae7634cb9299fdd134f467cd Mon Sep 17 00:00:00 2001 From: dginovker Date: Wed, 9 Dec 2020 16:12:19 -0500 Subject: [PATCH] Some ironman stuuff --- services/m=hiscore/helpers.js | 8 ++++++-- services/m=hiscore/hiscores.js | 8 +++++--- site/img/osrsimg/ironman.png | Bin 0 -> 1035 bytes 3 files changed, 11 insertions(+), 5 deletions(-) create mode 100644 site/img/osrsimg/ironman.png diff --git a/services/m=hiscore/helpers.js b/services/m=hiscore/helpers.js index 63b63531f..5428fadde 100644 --- a/services/m=hiscore/helpers.js +++ b/services/m=hiscore/helpers.js @@ -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) => { diff --git a/services/m=hiscore/hiscores.js b/services/m=hiscore/hiscores.js index 5b5f55a39..6c3cd38d1 100644 --- a/services/m=hiscore/hiscores.js +++ b/services/m=hiscore/hiscores.js @@ -1,4 +1,5 @@ var hiscores = hiscores || {}; +const ironmanIcon = ` ` 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 = `${playerData ? hiscores.formatName(playerData.username) : ""}`; + row.childNodes[3].innerHTML = `${playerData && playerData.iron_mode === "1" ? ironmanIcon : ""}${playerData ? hiscores.formatName(playerData.username) : ""}`; 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 = `${playerData ? hiscores.formatName(playerData.username) : ""}`; + row.childNodes[3].innerHTML = `${playerData && playerData.iron_mode === "1" ? ironmanIcon : ""}${playerData ? hiscores.formatName(playerData.username) : ""}`; row.childNodes[3].addEventListener("click", function (e) { e.preventDefault(); hiscores.loadUserTable(playerData.username); diff --git a/site/img/osrsimg/ironman.png b/site/img/osrsimg/ironman.png new file mode 100644 index 0000000000000000000000000000000000000000..e138d48ad7c119e861e6648ec44283b8c275c6ff GIT binary patch literal 1035 zcmV+m1oZofP)2|0bEf)Y80Ip4!O^M1^{1NLA>%bINykj)j0aKP_bj;?q* z-f+@|n<2(xnyJr)LP1)N?+0wE-uqOq*8Bb)J?jZm16!x?w5A&c;aTC}W*4^oc_7}_g7>15LsFW@1=ftuqr{H*ot6amMmz-w4L@zfq?-97R;o`cX z#rNTI2l}7%m=UW=4w?3365h|DHwt}s(7jsAs=m(IBSg03iEiQG5JqIbYwZ^T2WSh} z@spnb000SaNLh0L04^f{04^f|c%?sf0006)NklYuW6n)cSV8DP(z*sfW zRB&N3aYfRV;WxB#(S_?S6eVhmNnQC1OduFnuxZ+)ri*q#SP=+6z%IHV4TKG8ObR%_ zC<9?;Jom|)Qa^5T=iT@2xo6J3?@8=G)@(L!kH_Pz>$)Cd1%}PnR4TP64t*jJYpGPa zDa-QpMx&vdruh~GlE^8F!W_rh$Nt|0#bPmrzvd)K+L+JhSh!IUL&Qh`Vp8E5SJ3Hn z)Ox+H8HRCyzdy8X`#TlD95@AWDEW!vDPjZe87IKs(!=5KGbG-EzluhqhgfA4xhPV* z-EKV)2z>DS{bjWE!>dNX34l}Z$B3$`Ps8DGx!3DG!T$AZHY2Qr{3`stWm#%AoBgy* zz;(9U?MSs+y&DRJ&ieiSGZeo>!5W-n(Go*zG=mG|zGO0)=YoVQNF)*?9Guc&KA(RC z;M#Ob?Oxh~;<LmdoW{fL;HCz@AJd8^BH%#Z)(^4;d%GOH^vL z+O=RXm;nLZ`|m8iG!G2Wz!M+i{2L{3b|C=)DS5}*3e0uBHG002ovPDHLk FV1iPy=l1{r literal 0 HcmV?d00001