1 Commits

Author SHA1 Message Date
fe33b9a334 Add button to select all units
All checks were successful
Continuous Deployment / lint (push) Successful in 27s
Continuous Deployment / deploy-chrome (push) Successful in 33s
Continuous Deployment / deploy-firefox (push) Successful in 3m42s
2025-11-18 10:50:35 +01:00
4 changed files with 92 additions and 4 deletions

View File

@@ -1,5 +1,9 @@
# Changelog # Changelog
## 1.9.1 (2025-11-18)
- ajout d'un bouton pour sélectionner toutes les troupes
## 1.8.1 (2025-11-17) ## 1.8.1 (2025-11-17)
- remplacement de 'attaques' par 'occurrences' - remplacement de 'attaques' par 'occurrences'

View File

@@ -1,7 +1,7 @@
{ {
"manifest_version": 3, "manifest_version": 3,
"name": "KAplus", "name": "KAplus",
"version": "1.8.1", "version": "1.9.1",
"developer": { "developer": {
"name": "Samuel Campos", "name": "Samuel Campos",

View File

@@ -5,8 +5,8 @@
"firefox" "firefox"
], ],
"release_notes": { "release_notes": {
"fr": "- remplacement de 'attaques' par 'occurrences'\n- correction du calcul d'arrivée des unités\n- ajout des dizièmes de seconde pour envoyer des unités", "fr": "- ajout d'un bouton pour sélectionner toutes les troupes",
"en-US": "- replace 'attaques' with 'occurrences'\n- fix unit arrival date computing\n- add tenths of seconds to send units" "en-US": " - add button to select all units"
} }
} }
} }

View File

@@ -133,6 +133,7 @@ function main() {
let section = urlParams.get("s"); let section = urlParams.get("s");
let module = urlParams.get("m"); let module = urlParams.get("m");
let sub = urlParams.get("sub"); let sub = urlParams.get("sub");
let sendCommandForm = document.getElementById("sendCommandForm");
/* Display unit-points on user profile */ /* Display unit-points on user profile */
if (section === "info_player" && (module === "profile" || module === null)) { if (section === "info_player" && (module === "profile" || module === null)) {
@@ -179,8 +180,91 @@ function main() {
villagePointsRow.after(unitPointsRow); 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 */ /* 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 */ /* Improve countup time cell */
let oldCell = document.getElementById("countup-time"); let oldCell = document.getElementById("countup-time");
let hms = oldCell.parentElement.previousElementSibling.getElementsByTagName("td")[1].textContent.split(":"); let hms = oldCell.parentElement.previousElementSibling.getElementsByTagName("td")[1].textContent.split(":");