Feature multi-attack in same second

This commit is contained in:
2025-11-13 20:13:16 +01:00
parent 4fe2922e5a
commit 8eb8e30331
4 changed files with 65 additions and 20 deletions

View File

@@ -1,5 +1,9 @@
# Changelog # Changelog
## 1.5.1 (2025-11-13)
- fonctionnalité de multi-attaques dans la même seconde
## 1.4.14 (2025-11-13) ## 1.4.14 (2025-11-13)
- correction affichage menu avec rapports - correction affichage menu avec rapports

View File

@@ -1,7 +1,7 @@
{ {
"manifest_version": 3, "manifest_version": 3,
"name": "KAplus", "name": "KAplus",
"version": "1.4.14", "version": "1.5.1",
"author": "Samuel Campos - netoik.io", "author": "Samuel Campos - netoik.io",
"description": "Extension développée pour améliorer l'expérience de jeu KingsAge (fonctionne avec ou sans premium)", "description": "Extension développée pour améliorer l'expérience de jeu KingsAge (fonctionne avec ou sans premium)",

View File

@@ -5,8 +5,8 @@
"firefox" "firefox"
], ],
"release_notes": { "release_notes": {
"fr": "- correction affichage menu avec rapports", "fr": "- fonctionnalité de multi-attaques dans la même seconde",
"en-US": "- fix display navbar with reports" "en-US": "- feature multi-attack in same second"
} }
} }
} }

View File

@@ -129,4 +129,45 @@ if (document.body.id === "overview") {
villagePointsRow.after(unitPointsRow); villagePointsRow.after(unitPointsRow);
} }
/* Allow multiple attacks */
if (document.body.id === "build_barracks_command") {
let table = document.createElement("table");
table.classList.add("borderlist");
let tbody = document.createElement("tbody");
let tr = document.createElement("tr");
let th = document.createElement("th");
th.textContent = "Nombre d'attaques:";
tr.appendChild(th)
let td = document.createElement("td");
let input = document.createElement("input");
input.setAttribute("type", "number");
input.setAttribute("name", "attack_count");
input.setAttribute("value", "1");
td.appendChild(input);
tr.appendChild(td);
tbody.appendChild(tr);
table.appendChild(tbody);
let form = document.getElementsByTagName("form")[0];
let firstInput = form.getElementsByTagName("input")[0];
form.insertBefore(table, firstInput);
form.addEventListener("submit", function(event) {
event.preventDefault();
let formData = new FormData(this);
let attackCount = parseInt(formData.get("attack_count").toString());
formData.delete("attack_count");
let sent = 0;
for (let i = 0; i < attackCount; i ++) {
let xhr = new XMLHttpRequest();
xhr.onload = function() {
sent ++;
if (sent === attackCount) {
window.location.replace(xhr.responseURL);
}
}
xhr.open(this.method, this.action, true);
xhr.send(formData);
}
});
}