commit e9cca7ea8b8c091a0f8e0fd2e957becd5c34935f Author: samuel Date: Fri Aug 29 13:19:36 2025 +0200 First commit diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..bb4bc16 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,41 @@ +# Changelog + +## 1.3.2 (2025-08-29) + +- correction du calcul du pourcentage des points troupes +- alignement des icônes du menu de navigation + +## 1.3.1 (2025-08-29) + +- correction d'affichage du menu quand des notifications de message ou de forum sont présentes + +## 1.3.0 (2025-08-28) + +- amélioration du menu de navigation avec des icônes identifiables et épurées + +## 1.2.0 (2025-08-25) + +- ajout des points troupes dans la vue du village +- suppression de l'arrière plan sur petit écran + +## 1.1.0 (2025-08+24) + +- suppression de la bannière de publicité qui est invisible quand on utilise un bloqueur de pub +mais qui empêche tout de même de cliquer sur certains boutons en mode tactile + +## 1.0.3 (2025-08-23) + +- correction de l'affichage du pourcentage de points troupes + +## 1.0.2 (2025-08-23) + +- correction de l'affichage de points troupes dans le tableau de profil +- ajout d'une deuxième ligne dans le tableau de profil pour le pourcentage de points troupes + +## 1.0.1 (2025-08-21) + +- migration de manifest_version de 2 vers 3 + +## 1.0 (2025-08-11) + +- ajout d'une ligne dans le tableau de profil pour spécifier les points troupes diff --git a/icons/kaplus.png b/icons/kaplus.png new file mode 100644 index 0000000..6456e83 Binary files /dev/null and b/icons/kaplus.png differ diff --git a/icons/kaplus128.png b/icons/kaplus128.png new file mode 100644 index 0000000..bcf064b Binary files /dev/null and b/icons/kaplus128.png differ diff --git a/icons/kaplus32.png b/icons/kaplus32.png new file mode 100644 index 0000000..e98bb4b Binary files /dev/null and b/icons/kaplus32.png differ diff --git a/icons/kaplus64.png b/icons/kaplus64.png new file mode 100644 index 0000000..072cbe3 Binary files /dev/null and b/icons/kaplus64.png differ diff --git a/images/ally.svg b/images/ally.svg new file mode 100644 index 0000000..f4db4d9 --- /dev/null +++ b/images/ally.svg @@ -0,0 +1 @@ + diff --git a/images/favorites.svg b/images/favorites.svg new file mode 100644 index 0000000..3b6acb0 --- /dev/null +++ b/images/favorites.svg @@ -0,0 +1 @@ + diff --git a/images/messages.svg b/images/messages.svg new file mode 100644 index 0000000..6f6ea9d --- /dev/null +++ b/images/messages.svg @@ -0,0 +1 @@ + diff --git a/images/notif.svg b/images/notif.svg new file mode 100644 index 0000000..f5bda7c --- /dev/null +++ b/images/notif.svg @@ -0,0 +1 @@ + diff --git a/images/premium.svg b/images/premium.svg new file mode 100644 index 0000000..ad49cec --- /dev/null +++ b/images/premium.svg @@ -0,0 +1 @@ + diff --git a/images/profile.svg b/images/profile.svg new file mode 100644 index 0000000..0e4925a --- /dev/null +++ b/images/profile.svg @@ -0,0 +1 @@ + diff --git a/images/ranking.svg b/images/ranking.svg new file mode 100644 index 0000000..edc078d --- /dev/null +++ b/images/ranking.svg @@ -0,0 +1 @@ + diff --git a/images/tools.svg b/images/tools.svg new file mode 100644 index 0000000..4d4335b --- /dev/null +++ b/images/tools.svg @@ -0,0 +1 @@ + diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000..2beb7af --- /dev/null +++ b/manifest.json @@ -0,0 +1,36 @@ +{ + "manifest_version": 3, + "name": "KAplus", + "version": "1.3.2", + + "author": "Samuel Campos - netoik.io", + "description": "Extension développée pour améliorer l'expérience de jeu KingsAge (fonctionne avec ou sans premium)", + + "browser_specific_settings": { + "gecko": { + "id": "{e750d6a9-86ff-4129-aed6-542de03deb79}" + } + }, + + "content_scripts": [ + { + "matches": ["https://*.kingsage.gameforge.com/*"], + "js": ["src/kaplus.js"], + "css": ["src/kaplus.css"] + } + ], + + "web_accessible_resources": [ + { + "matches": ["https://*.kingsage.gameforge.com/*"], + "resources": ["images/*.svg"] + } + ], + + "icons": { + "32": "icons/kaplus32.png", + "64": "icons/kaplus64.png", + "100": "icons/kaplus.png", + "128": "icons/kaplus128.png" + } +} diff --git a/screenshots/main_navbar.png b/screenshots/main_navbar.png new file mode 100644 index 0000000..25c218c Binary files /dev/null and b/screenshots/main_navbar.png differ diff --git a/screenshots/overview_unit_points.png b/screenshots/overview_unit_points.png new file mode 100644 index 0000000..7844aac Binary files /dev/null and b/screenshots/overview_unit_points.png differ diff --git a/screenshots/unit_points.png b/screenshots/unit_points.png new file mode 100644 index 0000000..2412c21 Binary files /dev/null and b/screenshots/unit_points.png differ diff --git a/src/kaplus.css b/src/kaplus.css new file mode 100644 index 0000000..72fdaab --- /dev/null +++ b/src/kaplus.css @@ -0,0 +1,77 @@ +#banner_container { + display: none; +} + +#content_wrapper > table { + width: auto !important; +} + +.lay_castle_top { + .shortcut-element { + top: 148px !important; + text-align: center !important; + } + .shortcut_container { + float: none; + display: + } + .shortcut_container:first-child { + text-align: right; + } + .shortcut_container:last-child { + text-align: left; + } + .shortcut_element { + margin: 0 !important; + padding: 0 !important; + float: none !important; + width: 70px !important; + text-align: center; + } + .shortcut_element_left, .shortcut_element_right, .shortcut_element_left_premium, .shortcut_element_right_premium { + display: none; + } + .shortcut_element_center, .shortcut_element_center_premium { + background: none; + float: none; + diplay: inline-block; + } + .shortcut_element_marker, .shortcut_element_marker_premium { + background-image: none !important; + float: none !important; + display: inline-block !important; + padding: 0 !important; + + a { + position: relative; + opacity: 0.7; + } + a:hover, a.has_notif { + opacity: 1; + } + a.has_notif .shortcut_element_image::after { + background-image: url("moz-extension://__MSG_@@extension_id__/images/notif.svg"), url("chrome-extension://__MSG_@@extension_id__/images/notif.svg"); + background-size: 13px 13px; + position: absolute; + top: -13px; + right: 3px; + width: 13px; + height: 13px; + content: ""; + } + .shortcut_element_image { + padding: 5px 10px; + } + .shortcut_element_image img { + height: 22px; + } + .shortcut_element_desc { + display: inline-block; + vertical-align: top; + font-size: 15px; + font-weight: bold; + padding: 5px 10px 5px 0; + margin: 0 0 0 -10px; + } + } +} diff --git a/src/kaplus.js b/src/kaplus.js new file mode 100644 index 0000000..cbdf3d8 --- /dev/null +++ b/src/kaplus.js @@ -0,0 +1,113 @@ +function num(s) { + return parseInt(s.replace(".", "")); +} + +function str(n) { + if (n == 0) { + return "0"; + } + s = ""; + while (n > 0) { + if (s != "") { + s = "." + s; + } + r = n % 1000; + s = r.toString().padStart(3, "0") + s; + n = ~~(n/1000); + } + return s.replace(/^0+/, ""); +} + +function createRow(key, value) { + keyCell = document.createElement("td"); + keyCell.textContent = key; + valueCell = document.createElement("td"); + valueCell.textContent = value; + row = document.createElement("tr"); + row.appendChild(keyCell); + row.appendChild(valueCell); + return row; +} + +function shortcutElementReplace(elt, img, text) { + spanImageElement = document.createElement("span"); + spanImageElement.classList.add("shortcut_element_image"); + + imgElement = document.createElement("img"); + imgElement.setAttribute("src", chrome.runtime.getURL("images/"+img+".svg")); + spanImageElement.appendChild(imgElement); + + hyperlinkElements = elt.getElementsByTagName("a"); + if (hyperlinkElements.length == 2) { + hyperlinkElements[0].remove(); + elt.getElementsByTagName("a")[0].classList.add("has_notif"); + } + + hyperlinkElement = elt.getElementsByTagName("a")[0]; + hyperlinkElement.textContent = ""; + hyperlinkElement.appendChild(spanImageElement); + + if (text) { + spanDescElement = document.createElement("span"); + spanDescElement.classList.add("shortcut_element_desc"); + spanDescElement.textContent = text; + hyperlinkElement.appendChild(spanDescElement); + } +} + +layCastleTopElements = document.getElementsByClassName("lay_castle_top"); +if (layCastleTopElements.length == 1) { + shortcutElements = layCastleTopElements[0].getElementsByClassName("shortcut_element"); + shortcutElementReplace(shortcutElements[0], "ranking", shortcutElements[0].textContent.replace(/[^0-9]/g, "")); + shortcutElementReplace(shortcutElements[1], "ally", ""); + shortcutElementReplace(shortcutElements[2], "profile", ""); + shortcutElementReplace(shortcutElements[3], "premium", ""); + shortcutElementReplace(shortcutElements[4], "messages", ""); + shortcutElementReplace(shortcutElements[5], "tools", ""); + shortcutElementReplace(shortcutElements[6], "favorites", ""); +} + +if (document.body.id === "info_player") { + mainContentPane = document.getElementsByClassName("contentpane")[1]; + borderLists = mainContentPane.getElementsByClassName("borderlist"); + + playerPropertiesTable = borderLists[0]; + playerPropertiesRows = playerPropertiesTable.getElementsByTagName("tr"); + totalPoints = num(playerPropertiesRows[2].getElementsByTagName("td")[1].textContent); + villagesCount = num(playerPropertiesRows[4].getElementsByTagName("td")[1].textContent); + + villagesTable = borderLists[1]; + villagesRows = villagesTable.getElementsByTagName("tr"); + villagesPoints = 0; + for (i=1; i 0) { + armyPercent = (Math.round(armyPoints / villagesCount) / 100).toString() + " %"; + } else { + armyPercent = "-"; + } + + playerPropertiesTable.appendChild(createRow("Points troupes:", str(armyPoints))); + playerPropertiesTable.appendChild(createRow("% points troupes:", armyPercent)); +} + +if (document.body.id === "overview") { + settlements = document.getElementById("settlement").textContent.split("|"); + noborderRows = document.getElementsByClassName("noborder"); + for (i=0; i