First commit
41
CHANGELOG.md
Normal file
@@ -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
|
BIN
icons/kaplus.png
Normal file
After Width: | Height: | Size: 2.3 KiB |
BIN
icons/kaplus128.png
Normal file
After Width: | Height: | Size: 5.6 KiB |
BIN
icons/kaplus32.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
icons/kaplus64.png
Normal file
After Width: | Height: | Size: 2.6 KiB |
1
images/ally.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Free v7.0.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path fill="#ffffff" d="M300.9 149.2L184.3 278.8C179.7 283.9 179.9 291.8 184.8 296.7C215.3 327.2 264.8 327.2 295.3 296.7L327.1 264.9C331.3 260.7 336.6 258.4 342 258C348.8 257.4 355.8 259.7 361 264.9L537.6 440L608 384L608 96L496 160L472.2 144.1C456.4 133.6 437.9 128 418.9 128L348.5 128C347.4 128 346.2 128 345.1 128.1C328.2 129 312.3 136.6 300.9 149.2zM148.6 246.7L255.4 128L215.8 128C190.3 128 165.9 138.1 147.9 156.1L144 160L32 96L32 384L188.4 514.3C211.4 533.5 240.4 544 270.3 544L286 544L279 537C269.6 527.6 269.6 512.4 279 503.1C288.4 493.8 303.6 493.7 312.9 503.1L353.9 544.1L362.9 544.1C382 544.1 400.7 539.8 417.7 531.8L391 505C381.6 495.6 381.6 480.4 391 471.1C400.4 461.8 415.6 461.7 424.9 471.1L456.9 503.1L474.4 485.6C483.3 476.7 485.9 463.8 482 452.5L344.1 315.7L329.2 330.6C279.9 379.9 200.1 379.9 150.8 330.6C127.8 307.6 126.9 270.7 148.6 246.6z"/></svg>
|
After Width: | Height: | Size: 1.1 KiB |
1
images/favorites.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Free v7.0.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path fill="#ffffff" d="M341.5 45.1C337.4 37.1 329.1 32 320.1 32C311.1 32 302.8 37.1 298.7 45.1L225.1 189.3L65.2 214.7C56.3 216.1 48.9 222.4 46.1 231C43.3 239.6 45.6 249 51.9 255.4L166.3 369.9L141.1 529.8C139.7 538.7 143.4 547.7 150.7 553C158 558.3 167.6 559.1 175.7 555L320.1 481.6L464.4 555C472.4 559.1 482.1 558.3 489.4 553C496.7 547.7 500.4 538.8 499 529.8L473.7 369.9L588.1 255.4C594.5 249 596.7 239.6 593.9 231C591.1 222.4 583.8 216.1 574.8 214.7L415 189.3L341.5 45.1z"/></svg>
|
After Width: | Height: | Size: 698 B |
1
images/messages.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Free v7.0.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path fill="#ffffff" d="M112 128C85.5 128 64 149.5 64 176C64 191.1 71.1 205.3 83.2 214.4L291.2 370.4C308.3 383.2 331.7 383.2 348.8 370.4L556.8 214.4C568.9 205.3 576 191.1 576 176C576 149.5 554.5 128 528 128L112 128zM64 260L64 448C64 483.3 92.7 512 128 512L512 512C547.3 512 576 483.3 576 448L576 260L377.6 408.8C343.5 434.4 296.5 434.4 262.4 408.8L64 260z"/></svg>
|
After Width: | Height: | Size: 579 B |
1
images/notif.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Free v7.0.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path fill="#ff0000" d="M64 320C64 178.6 178.6 64 320 64C461.4 64 576 178.6 576 320C576 461.4 461.4 576 320 576C178.6 576 64 461.4 64 320z"/></svg>
|
After Width: | Height: | Size: 362 B |
1
images/premium.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Free v7.0.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path fill="#ffd700" d="M345 151.2C354.2 143.9 360 132.6 360 120C360 97.9 342.1 80 320 80C297.9 80 280 97.9 280 120C280 132.6 285.9 143.9 295 151.2L226.6 258.8C216.6 274.5 195.3 278.4 180.4 267.2L120.9 222.7C125.4 216.3 128 208.4 128 200C128 177.9 110.1 160 88 160C65.9 160 48 177.9 48 200C48 221.8 65.5 239.6 87.2 240L119.8 457.5C124.5 488.8 151.4 512 183.1 512L456.9 512C488.6 512 515.5 488.8 520.2 457.5L552.8 240C574.5 239.6 592 221.8 592 200C592 177.9 574.1 160 552 160C529.9 160 512 177.9 512 200C512 208.4 514.6 216.3 519.1 222.7L459.7 267.3C444.8 278.5 423.5 274.6 413.5 258.9L345 151.2z"/></svg>
|
After Width: | Height: | Size: 819 B |
1
images/profile.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Free v7.0.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path fill="#ffffff" d="M320 312C386.3 312 440 258.3 440 192C440 125.7 386.3 72 320 72C253.7 72 200 125.7 200 192C200 258.3 253.7 312 320 312zM290.3 368C191.8 368 112 447.8 112 546.3C112 562.7 125.3 576 141.7 576L498.3 576C514.7 576 528 562.7 528 546.3C528 447.8 448.2 368 349.7 368L290.3 368z"/></svg>
|
After Width: | Height: | Size: 517 B |
1
images/ranking.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Free v7.0.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path fill="#ffffff" d="M278.7 64.7C296 68.4 307 85.4 303.3 102.7L284.2 192L410.7 192L432.7 89.3C436.4 72 453.4 61 470.7 64.7C488 68.4 499 85.4 495.3 102.7L476.2 192L544 192C561.7 192 576 206.3 576 224C576 241.7 561.7 256 544 256L462.4 256L435 384L502.8 384C520.5 384 534.8 398.3 534.8 416C534.8 433.7 520.5 448 502.8 448L421.2 448L399.2 550.7C395.5 568 378.5 579 361.2 575.3C343.9 571.6 332.9 554.6 336.6 537.3L355.7 448L229.2 448L207.2 550.7C203.5 568 186.5 579 169.2 575.3C151.9 571.6 140.9 554.6 144.6 537.3L163.8 448L96 448C78.3 448 64 433.7 64 416C64 398.3 78.3 384 96 384L177.6 384L205 256L137.2 256C119.5 256 105.2 241.7 105.2 224C105.2 206.3 119.5 192 137.2 192L218.8 192L240.8 89.3C244.4 72 261.4 61 278.7 64.7zM270.4 256L243 384L369.5 384L396.9 256L270.4 256z"/></svg>
|
After Width: | Height: | Size: 994 B |
1
images/tools.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Free v7.0.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path fill="#ffffff" d="M541.4 162.6C549 155 561.7 156.9 565.5 166.9C572.3 184.6 576 203.9 576 224C576 312.4 504.4 384 416 384C398.5 384 381.6 381.2 365.8 376L178.9 562.9C150.8 591 105.2 591 77.1 562.9C49 534.8 49 489.2 77.1 461.1L264 274.2C258.8 258.4 256 241.6 256 224C256 135.6 327.6 64 416 64C436.1 64 455.4 67.7 473.1 74.5C483.1 78.3 484.9 91 477.4 98.6L388.7 187.3C385.7 190.3 384 194.4 384 198.6L384 240C384 248.8 391.2 256 400 256L441.4 256C445.6 256 449.7 254.3 452.7 251.3L541.4 162.6z"/></svg>
|
After Width: | Height: | Size: 719 B |
36
manifest.json
Normal file
@@ -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"
|
||||
}
|
||||
}
|
BIN
screenshots/main_navbar.png
Normal file
After Width: | Height: | Size: 374 KiB |
BIN
screenshots/overview_unit_points.png
Normal file
After Width: | Height: | Size: 279 KiB |
BIN
screenshots/unit_points.png
Normal file
After Width: | Height: | Size: 362 KiB |
77
src/kaplus.css
Normal file
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
113
src/kaplus.js
Normal file
@@ -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<villagesRows.length; i+=1) {
|
||||
villagesPoints += num(villagesRows[i].getElementsByTagName("td")[2].textContent);
|
||||
}
|
||||
villagesBonus = 2250 * Math.max(0, villagesCount - 1);
|
||||
|
||||
armyPoints = totalPoints - villagesPoints - villagesBonus;
|
||||
if (villagesCount > 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<noborderRows.length; i++) {
|
||||
if (noborderRows[i].textContent.startsWith("Points:")) {
|
||||
villagePointsRow = noborderRows[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
unitPointsRow = villagePointsRow.cloneNode(true);
|
||||
villagePointsRow.getElementsByTagName("td")[1].textContent = "Points village: " + settlements[3];
|
||||
unitPointsRow.getElementsByTagName("td")[1].textContent = "Points troupes: " + settlements[4];
|
||||
villagePointsRow.after(unitPointsRow);
|
||||
}
|
||||
|
||||
|