mirror of
https://github.com/2009scape/2009scape.github.io.git
synced 2024-08-18 07:09:42 +02:00
Started modularizing + push old CSS
This commit is contained in:
parent
5b56ef81d6
commit
5866a14ca1
37
services/m=hiscore/helpers.js
Normal file
37
services/m=hiscore/helpers.js
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
var REQUIRE = REQUIRE || {};
|
||||||
|
REQUIRE.sName = [
|
||||||
|
"Attack",
|
||||||
|
"Defence",
|
||||||
|
"Strength",
|
||||||
|
"Constitution",
|
||||||
|
"Ranged",
|
||||||
|
"Prayer",
|
||||||
|
"Magic",
|
||||||
|
"Cooking",
|
||||||
|
"Woodcutting",
|
||||||
|
"Fletching",
|
||||||
|
"Fishing",
|
||||||
|
"Firemaking",
|
||||||
|
"Crafting",
|
||||||
|
"Smithing",
|
||||||
|
"Mining",
|
||||||
|
"Herblore",
|
||||||
|
"Agility",
|
||||||
|
"Thieving",
|
||||||
|
"Slayer",
|
||||||
|
"Farming",
|
||||||
|
"Runecrafting",
|
||||||
|
"Hunter",
|
||||||
|
"Construction",
|
||||||
|
"Summoning"
|
||||||
|
]
|
||||||
|
|
||||||
|
REQUIRE.linkLeftTabSkillNames = () => {
|
||||||
|
REQUIRE.sName.forEach((skill, index) => {
|
||||||
|
row = document.getElementsByClassName(` ${skill} ico`)[0].addEventListener("click", function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
console.log(skill, index);
|
||||||
|
loadSkillTable(index);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
@ -622,7 +622,7 @@ English
|
|||||||
<input id="search_rank" class="textinput text" maxlength="12" type="text" name="rank" value="">
|
<input id="search_rank" class="textinput text" maxlength="12" type="text" name="rank" value="">
|
||||||
<input type="hidden" name="table" value="0">
|
<input type="hidden" name="table" value="0">
|
||||||
<input type="hidden" name="category_type" value="0">
|
<input type="hidden" name="category_type" value="0">
|
||||||
<input type="submit" name="submit" class="buttonmedium" value="Search">
|
<input id="search_rank_submit" type="submit" name="submit" class="buttonmedium" value="Search">
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div class="subsectionHeader search_title">Compare Users</div>
|
<div class="subsectionHeader search_title">Compare Users</div>
|
||||||
@ -698,6 +698,7 @@ English
|
|||||||
<!-- Mirrored from services/m=hiscore/hiscores.ws by HTTrack Website Copier/3.x [XR&CO'2010], Sun, 18 Jul 2010 08:59:40 GMT -->
|
<!-- Mirrored from services/m=hiscore/hiscores.ws by HTTrack Website Copier/3.x [XR&CO'2010], Sun, 18 Jul 2010 08:59:40 GMT -->
|
||||||
<!-- Added by HTTrack -->
|
<!-- Added by HTTrack -->
|
||||||
<meta http-equiv="content-type" content="text/html;charset=ISO-8859-1"><!-- /Added by HTTrack -->
|
<meta http-equiv="content-type" content="text/html;charset=ISO-8859-1"><!-- /Added by HTTrack -->
|
||||||
|
<script type="text/javascript" src="./helpers.js"></script>
|
||||||
<script type="text/javascript" src="./hiscores.js"></script>
|
<script type="text/javascript" src="./hiscores.js"></script>
|
||||||
|
|
||||||
</html>
|
</html>
|
@ -1,35 +1,12 @@
|
|||||||
|
var REQUIRE = REQUIRE || {};
|
||||||
|
|
||||||
let page = 0;
|
let page = 0;
|
||||||
let currentSkillId = "";
|
let currentSkillId = "";
|
||||||
|
|
||||||
const apiURL = "http://localhost:3000";
|
const apiURL = "http://localhost:3000";
|
||||||
const sName = [
|
|
||||||
"Attack",
|
|
||||||
"Defence",
|
|
||||||
"Strength",
|
|
||||||
"Constitution",
|
|
||||||
"Ranged",
|
|
||||||
"Prayer",
|
|
||||||
"Magic",
|
|
||||||
"Cooking",
|
|
||||||
"Woodcutting",
|
|
||||||
"Fletching",
|
|
||||||
"Fishing",
|
|
||||||
"Firemaking",
|
|
||||||
"Crafting",
|
|
||||||
"Smithing",
|
|
||||||
"Mining",
|
|
||||||
"Herblore",
|
|
||||||
"Agility",
|
|
||||||
"Thieving",
|
|
||||||
"Slayer",
|
|
||||||
"Farming",
|
|
||||||
"Runecrafting",
|
|
||||||
"Hunter",
|
|
||||||
"Construction",
|
|
||||||
"Summoning"
|
|
||||||
]
|
|
||||||
|
|
||||||
let tableData = [];
|
let tableData = [];
|
||||||
|
let defaultTableData = [];
|
||||||
|
|
||||||
function loadDefaultHSTable() {
|
function loadDefaultHSTable() {
|
||||||
fetch(`${apiURL}/highscores/getPlayersByTotal`)
|
fetch(`${apiURL}/highscores/getPlayersByTotal`)
|
||||||
@ -37,6 +14,7 @@ function loadDefaultHSTable() {
|
|||||||
.then(result => {
|
.then(result => {
|
||||||
console.log(result[0]);
|
console.log(result[0]);
|
||||||
tableData = result;
|
tableData = result;
|
||||||
|
defaultTableData = result;
|
||||||
populateDefaultHSTable();
|
populateDefaultHSTable();
|
||||||
})
|
})
|
||||||
.catch(error => console.log('error', error));
|
.catch(error => console.log('error', error));
|
||||||
@ -77,6 +55,7 @@ function loadUserTable(username) {
|
|||||||
console.log(result[0]);
|
console.log(result[0]);
|
||||||
tableData = result;
|
tableData = result;
|
||||||
populatePlayerHSTable();
|
populatePlayerHSTable();
|
||||||
|
document.getElementById("scores_head_skill").innerText = username + "'s ";
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
document.getElementById('search_name').style.color = 'red';
|
document.getElementById('search_name').style.color = 'red';
|
||||||
@ -94,7 +73,7 @@ function populatePlayerHSTable() {
|
|||||||
|
|
||||||
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">${sName[i - 1]}</a>`;
|
row.childNodes[3].innerHTML = `<a href="./hiscores.html">${REQUIRE.sName[i - 1]}</a>`;
|
||||||
row.childNodes[3].addEventListener("click", e => {
|
row.childNodes[3].addEventListener("click", e => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
loadSkillTable(i - 1);
|
loadSkillTable(i - 1);
|
||||||
@ -123,8 +102,8 @@ function loadSkillTable(skillId) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function populateSkillHSTable() {
|
function populateSkillHSTable() {
|
||||||
document.getElementById("scores_head_skill").innerText = sName[currentSkillId];
|
document.getElementById("scores_head_skill").innerText = REQUIRE.sName[currentSkillId];
|
||||||
document.getElementById("scores_head_icon").src = `../../site/img/hiscores/skill_icon_${sName[currentSkillId].toLowerCase()}1eccb.gif`;
|
document.getElementById("scores_head_icon").src = `../../site/img/hiscores/skill_icon_${REQUIRE.sName[currentSkillId].toLowerCase()}1eccb.gif`;
|
||||||
|
|
||||||
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];
|
||||||
@ -177,14 +156,20 @@ document.getElementById("search_button").addEventListener("click", function (e)
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Handle Skill Names
|
document.getElementById("search_rank_submit").addEventListener("click", function (e) {
|
||||||
sName.forEach((skill, index) => {
|
e.preventDefault();
|
||||||
row = document.getElementsByClassName(` ${skill} ico`)[0].addEventListener("click", function (e) {
|
if (document.getElementById('search_rank').value) {
|
||||||
e.preventDefault();
|
loadUserTable(defaultTableData[document.getElementById('search_rank').value - 1].username)
|
||||||
console.log(skill, index);
|
document.getElementById("scores_head_skill").innerText = defaultTableData[document.getElementById('search_rank').value - 1].username + "'s ";
|
||||||
loadSkillTable(index);
|
}
|
||||||
});
|
else {
|
||||||
|
loadDefaultHSTable();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
// Handle Skill Names
|
||||||
|
REQUIRE.linkLeftTabSkillNames();
|
||||||
|
|
||||||
|
|
||||||
loadDefaultHSTable();
|
loadDefaultHSTable();
|
||||||
|
@ -223,6 +223,12 @@
|
|||||||
.row22 {
|
.row22 {
|
||||||
background-color: #423419;
|
background-color: #423419;
|
||||||
}
|
}
|
||||||
|
.row23 {
|
||||||
|
background-color: #534221;
|
||||||
|
}
|
||||||
|
.row24 {
|
||||||
|
background-color: #423419;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -396,10 +402,10 @@
|
|||||||
height: 27px;
|
height: 27px;
|
||||||
}
|
}
|
||||||
#button-up {
|
#button-up {
|
||||||
top: 165px;
|
top: 180px;
|
||||||
}
|
}
|
||||||
#button-down {
|
#button-down {
|
||||||
top: 170px;
|
top: 185px;
|
||||||
}
|
}
|
||||||
#button-up span.lev1_arrow {
|
#button-up span.lev1_arrow {
|
||||||
background-image: url('../img/hiscores/arrow_upeccb.gif?3');
|
background-image: url('../img/hiscores/arrow_upeccb.gif?3');
|
||||||
@ -486,7 +492,7 @@
|
|||||||
#playerList_back {
|
#playerList_back {
|
||||||
float: left;
|
float: left;
|
||||||
width: 371px;
|
width: 371px;
|
||||||
height: 466px;
|
height: 505px;
|
||||||
margin-right: 5px;
|
margin-right: 5px;
|
||||||
}
|
}
|
||||||
#table_friend {
|
#table_friend {
|
||||||
@ -536,7 +542,7 @@
|
|||||||
.arrow_back {
|
.arrow_back {
|
||||||
width: 25px;
|
width: 25px;
|
||||||
background-color: #3B2B0F;
|
background-color: #3B2B0F;
|
||||||
height: 419px;
|
height: 457px;
|
||||||
float: right;
|
float: right;
|
||||||
}
|
}
|
||||||
#arrow_up {
|
#arrow_up {
|
||||||
@ -583,7 +589,7 @@
|
|||||||
#search_back {
|
#search_back {
|
||||||
float: left;
|
float: left;
|
||||||
width: 156px;
|
width: 156px;
|
||||||
height: 466px;
|
height: 505px;
|
||||||
}
|
}
|
||||||
.search_small, .search_large {
|
.search_small, .search_large {
|
||||||
margin-bottom: 2px;
|
margin-bottom: 2px;
|
||||||
|
Loading…
Reference in New Issue
Block a user