|
|
|
|
@@ -133,6 +133,7 @@ function main() {
|
|
|
|
|
let section = urlParams.get("s");
|
|
|
|
|
let module = urlParams.get("m");
|
|
|
|
|
let sub = urlParams.get("sub");
|
|
|
|
|
let sendCommandForm = document.getElementById("sendCommandForm");
|
|
|
|
|
|
|
|
|
|
/* Display unit-points on user profile */
|
|
|
|
|
if (section === "info_player" && (module === "profile" || module === null)) {
|
|
|
|
|
@@ -179,8 +180,91 @@ function main() {
|
|
|
|
|
villagePointsRow.after(unitPointsRow);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Units order page */
|
|
|
|
|
if (section === "build_barracks" && (module === null || module === "command") && sendCommandForm !== null) {
|
|
|
|
|
let barracksCommands = sendCommandForm.getElementsByClassName("barracksCommand");
|
|
|
|
|
let borderListTables = sendCommandForm.getElementsByClassName("borderlist");
|
|
|
|
|
|
|
|
|
|
let quantityLabel = document.createElement("label");
|
|
|
|
|
let quantityInput = document.createElement("input");
|
|
|
|
|
quantityInput.setAttribute("type", "checkbox");
|
|
|
|
|
quantityInput.addEventListener("change", function () {
|
|
|
|
|
let clickSpans = [];
|
|
|
|
|
if (barracksCommands.length === 1) {
|
|
|
|
|
clickSpans = barracksCommands[0].getElementsByClassName("click");
|
|
|
|
|
} else if (borderListTables.length === 1) {
|
|
|
|
|
clickSpans = borderListTables[0].getElementsByClassName("click");
|
|
|
|
|
}
|
|
|
|
|
for (let i = 0; i < 12; i++) {
|
|
|
|
|
if (clickSpans[i].classList.contains("all")) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
clickSpans[i].click();
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
quantityLabel.appendChild(quantityInput);
|
|
|
|
|
let quantitySpan = document.createElement("span");
|
|
|
|
|
quantitySpan.classList.add("click", "all");
|
|
|
|
|
quantitySpan.textContent = "(Tout sélectionner)";
|
|
|
|
|
quantityLabel.appendChild(quantitySpan);
|
|
|
|
|
|
|
|
|
|
if (barracksCommands.length === 1) {
|
|
|
|
|
let boxCell = document.createElement("div");
|
|
|
|
|
boxCell.classList.add("box");
|
|
|
|
|
|
|
|
|
|
let backgroundCell = document.createElement("div");
|
|
|
|
|
backgroundCell.classList.add("background");
|
|
|
|
|
let backgroundImg = document.createElement("img");
|
|
|
|
|
backgroundImg.setAttribute("src", "//s58-fr.kingsage.gameforge.com/img/modern/card_sendunit.png");
|
|
|
|
|
backgroundCell.appendChild(backgroundImg);
|
|
|
|
|
boxCell.appendChild(backgroundCell);
|
|
|
|
|
|
|
|
|
|
let imageCell = document.createElement("div");
|
|
|
|
|
imageCell.classList.add("image");
|
|
|
|
|
let imageImg = document.createElement("img");
|
|
|
|
|
imageImg.setAttribute("src", "//s58-fr.kingsage.gameforge.com/img/shortcut/barracks.png");
|
|
|
|
|
imageImg.style.width = "28px";
|
|
|
|
|
imageCell.appendChild(imageImg);
|
|
|
|
|
boxCell.appendChild(imageCell);
|
|
|
|
|
|
|
|
|
|
let nameCell = document.createElement("div");
|
|
|
|
|
nameCell.classList.add("name");
|
|
|
|
|
let nameA = document.createElement("a");
|
|
|
|
|
nameA.setAttribute("href", "help.php?m=units");
|
|
|
|
|
nameA.setAttribute("target", "_help");
|
|
|
|
|
let nameB = document.createElement("b");
|
|
|
|
|
nameB.textContent = "Tout";
|
|
|
|
|
nameA.appendChild(nameB);
|
|
|
|
|
nameCell.appendChild(nameA);
|
|
|
|
|
boxCell.appendChild(nameCell);
|
|
|
|
|
|
|
|
|
|
let quantityCell = document.createElement("div");
|
|
|
|
|
quantityCell.classList.add("quantity");
|
|
|
|
|
quantityCell.appendChild(quantityLabel);
|
|
|
|
|
boxCell.appendChild(quantityCell);
|
|
|
|
|
|
|
|
|
|
let brTag = barracksCommands[0].getElementsByTagName("br")[1];
|
|
|
|
|
barracksCommands[0].insertBefore(boxCell, brTag);
|
|
|
|
|
|
|
|
|
|
} else if (borderListTables.length === 1) {
|
|
|
|
|
let borderListRows = borderListTables[0].getElementsByTagName("tr");
|
|
|
|
|
let selectAllCell = borderListRows[1].getElementsByTagName("td")[3];
|
|
|
|
|
|
|
|
|
|
let imageA = document.createElement("a");
|
|
|
|
|
imageA.setAttribute("href", "help.php?m=units");
|
|
|
|
|
imageA.setAttribute("target", "_help");
|
|
|
|
|
let imageImg = document.createElement("img");
|
|
|
|
|
imageImg.setAttribute("src", "//s58-fr.kingsage.gameforge.com/img/shortcut/barracks.png")
|
|
|
|
|
imageImg.setAttribute("title", "Tout");
|
|
|
|
|
imageA.appendChild(imageImg);
|
|
|
|
|
selectAllCell.appendChild(imageA);
|
|
|
|
|
|
|
|
|
|
selectAllCell.appendChild(quantityLabel);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Units sending page */
|
|
|
|
|
if (section === "build_barracks" && module === "command" && sub === "send") {
|
|
|
|
|
if (section === "build_barracks" && module === "command" && sub === "send" && sendCommandForm === null) {
|
|
|
|
|
/* Improve countup time cell */
|
|
|
|
|
let oldCell = document.getElementById("countup-time");
|
|
|
|
|
let hms = oldCell.parentElement.previousElementSibling.getElementsByTagName("td")[1].textContent.split(":");
|
|
|
|
|
|