Add player id in ranking and ally members
This commit is contained in:
@@ -27,7 +27,9 @@ function createCustomElement(tag, attrs, text, style) {
|
||||
let elt = document.createElement(tag);
|
||||
if (attrs) {
|
||||
for (let [key, value] of Object.entries(attrs)) {
|
||||
elt.setAttribute(key, value.toString());
|
||||
if (value !== null) {
|
||||
elt.setAttribute(key, value.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (text) {
|
||||
@@ -163,6 +165,25 @@ function main() {
|
||||
let sub = urlParams.get("sub");
|
||||
let sendCommandForm = document.getElementById("sendCommandForm");
|
||||
|
||||
/* Add player id on ranking */
|
||||
if (section === "ranking" || (section === "ally" && module === "members")) {
|
||||
let mainContentPane = document.getElementsByClassName("contentpane")[1];
|
||||
let borderListTable = mainContentPane.getElementsByClassName("borderlist")[0];
|
||||
let playerRows = borderListTable.getElementsByTagName("tr");
|
||||
|
||||
let headerCells = playerRows[0].getElementsByTagName("th");
|
||||
let idHeaderCell = createCustomElement("th", {"class": headerCells[0].getAttribute("class")}, "Id");
|
||||
playerRows[0].insertBefore(idHeaderCell, headerCells[1]);
|
||||
|
||||
for (let i = 1; i < playerRows.length; i ++) {
|
||||
let playerCells = playerRows[i].getElementsByTagName("td");
|
||||
let playerProfileLink = playerCells[1].getElementsByTagName("a")[0].getAttribute("href");
|
||||
let idValue = playerProfileLink.replace(/^.*id=(\d+)$/, "$1");
|
||||
let idCell = createCustomElement("td", {"class": playerCells[0].getAttribute("class")}, idValue);
|
||||
playerRows[i].insertBefore(idCell, playerCells[1]);
|
||||
}
|
||||
}
|
||||
|
||||
/* Display unit-points on user profile */
|
||||
if (section === "info_player" && (module === "profile" || module === null)) {
|
||||
let mainContentPane = document.getElementsByClassName("contentpane")[1];
|
||||
|
||||
Reference in New Issue
Block a user