From 0d369c4c1e9e37dd3e72a9cf3cad5ef71d443b58 Mon Sep 17 00:00:00 2001 From: samuel Date: Sat, 29 Nov 2025 12:28:39 +0100 Subject: [PATCH] Add calculator form to new tab --- CHANGELOG.md | 4 ++++ images/blank.svg | 1 + manifest.json | 2 +- metadata.json | 4 ++-- src/kaplus.js | 21 +++++++++++++++++++-- 5 files changed, 27 insertions(+), 5 deletions(-) create mode 100644 images/blank.svg diff --git a/CHANGELOG.md b/CHANGELOG.md index a9e4998..87b1d86 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 1.11.3 (2026-11-21) + +- ajout du calculateur de trajet vers un nouvel onglet + ## 1.11.2 (2026-11-28) - correction du bug sur les multiples attaques avec comte diff --git a/images/blank.svg b/images/blank.svg new file mode 100644 index 0000000..8951f67 --- /dev/null +++ b/images/blank.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/manifest.json b/manifest.json index 8d3ec58..e9a5f88 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 3, "name": "KAplus", - "version": "1.11.2", + "version": "1.11.3", "developer": { "name": "Samuel Campos", diff --git a/metadata.json b/metadata.json index 88c99f8..523a12c 100644 --- a/metadata.json +++ b/metadata.json @@ -5,8 +5,8 @@ "firefox" ], "release_notes": { - "fr": "- correction du bug sur les multiples attaques avec comte\n- correction du bug sur le bouton pour sélectionner toutes les troupes\n- correction du bug sur l'envoi de ressources vers un village cible\n- ajout des ids dans la liste des joueurs d'une alliance\n- ajout de l'id sur le profil d'un joueur", - "en-US": "- fix bug on multiple attacks with snob\n- fix bug on button for selecting all units\n- fix bug on sending resources to a target village\n- add player id in other ally member list\n- add id on player profile" + "fr": "- ajout du calculateur de trajet vers un nouvel onglet", + "en-US": "- add travel calculator in new tab" } } } \ No newline at end of file diff --git a/src/kaplus.js b/src/kaplus.js index 302d015..bd4d8a8 100644 --- a/src/kaplus.js +++ b/src/kaplus.js @@ -463,7 +463,7 @@ function showSecondsAndCalculator() { let table = contentPane.getElementsByClassName("borderlist")[0]; let rows = table.getElementsByTagName("tr"); - let headCell = createCustomElement("th"); + let headCell = createCustomElement("th", null, "Calcul"); rows[0].appendChild(headCell); for (let i = 1; i < rows.length; i ++) { @@ -480,7 +480,16 @@ function showSecondsAndCalculator() { let targetPoint = searchPoint(cells[1].textContent); let calculatorCell = createCustomElement("td"); let calculatorForm = createCustomElement( - "form", {"method": "post", "action": "/?s=tools&m=runtime_calculator&inta=calculate"} + "form", + { + "method": "post", + "action": "/?s=tools&m=runtime_calculator&inta=calculate", + "title": "Calculateur de trajet", + }, + null, + { + "display": "inline-block", + }, ); calculatorForm.appendChild(createCustomInput("hidden", "start_x", startPoint.x)); calculatorForm.appendChild(createCustomInput("hidden", "start_y", startPoint.y)); @@ -495,6 +504,14 @@ function showSecondsAndCalculator() { ); calculatorForm.appendChild(calculatorImg); calculatorCell.appendChild(calculatorForm); + + let calculatorFormBlank = calculatorForm.cloneNode(true); + calculatorFormBlank.setAttribute("target", "_blank"); + calculatorFormBlank.setAttribute("title", "Calculateur de trajet dans nouvel onglet"); + let calculatorBlankImg = calculatorFormBlank.getElementsByTagName("input")[4] + calculatorBlankImg.setAttribute("src", chrome.runtime.getURL("images/blank.svg")); + calculatorCell.appendChild(calculatorFormBlank); + rows[i].appendChild(calculatorCell); } }