14 Commits

Author SHA1 Message Date
4fe2922e5a Fix display navbar with reports
All checks were successful
Continuous Deployment / lint (push) Successful in 26s
Continuous Deployment / deploy-chrome (push) Successful in 31s
Continuous Deployment / deploy-firefox (push) Successful in 2m43s
2025-11-13 10:31:12 +01:00
4f1d5442be Continuous deployment on Chrome
Some checks failed
Continuous Deployment / lint (push) Successful in 28s
Continuous Deployment / deploy-chrome (push) Successful in 31s
Continuous Deployment / deploy-firefox (push) Failing after 26s
2025-11-13 01:17:56 +01:00
45d5200e61 Fix bug menu
All checks were successful
Continuous Deployment / lint (push) Successful in 29s
Continuous Deployment / deploy (push) Successful in 5m8s
2025-11-11 23:39:57 +01:00
10de4507af Add data collection permissions
All checks were successful
Continuous Deployment / lint (push) Successful in 30s
Continuous Deployment / deploy (push) Successful in 56s
2025-11-11 17:34:00 +01:00
a37d54cd2e Fix metadata.json format
All checks were successful
Continuous Deployment / lint (push) Successful in 30s
Continuous Deployment / deploy (push) Successful in 3m20s
2025-11-11 16:36:50 +01:00
abc7742b75 Remove data_collection_permissions because not supported for android
All checks were successful
Continuous Deployment / lint (push) Successful in 30s
Continuous Deployment / deploy (push) Successful in 5m20s
2025-11-11 14:58:51 +01:00
05369a6661 Update version before tagging
All checks were successful
Continuous Deployment / lint (push) Successful in 1m27s
Continuous Deployment / deploy (push) Successful in 4m33s
2025-11-11 14:29:00 +01:00
948de12bc5 Add web ext key and secret in workflow 2025-11-11 14:26:41 +01:00
f7cb4da37c Setup continuous deployment
Some checks failed
Continuous Deployment / lint (push) Successful in 1m26s
Continuous Deployment / deploy (push) Failing after 15s
2025-11-11 13:48:48 +01:00
89c5c127c5 create makefile 2025-10-22 11:29:03 +02:00
2b1eb25a28 Add Makefile 2025-09-15 11:00:47 +02:00
2ca48bda23 Change notif point from image to css background 2025-09-15 10:57:03 +02:00
57d83653d5 Fix messages with notifs in menu 2025-09-15 10:56:29 +02:00
bc73c51fac Fix messages display 2025-09-14 12:42:43 +02:00
9 changed files with 223 additions and 171 deletions

41
.gitea/workflows/cd.yaml Normal file
View File

@@ -0,0 +1,41 @@
name: Continuous Deployment
on:
push:
tags:
- v*
jobs:
lint:
runs-on: linux
steps:
- name: Checkout repo
uses: actions/checkout@v5
- name: Run linter
run: make lint
deploy-chrome:
needs: lint
runs-on: linux
steps:
- name: Checkout repo
uses: actions/checkout@v5
- name: Deploy project to Chrome Webstore
env:
CLIENT_ID: ${{ vars.CHROME_CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.CHROME_CLIENT_SECRET }}
EXTENSION_ID: ${{ vars.CHROME_EXTENSION_ID }}
REFRESH_TOKEN: ${{ secrets.CHROME_REFRESH_TOKEN }}
run: make deploy_chrome
deploy-firefox:
needs: lint
runs-on: linux
steps:
- name: Checkout repo
uses: actions/checkout@v5
- name: Deploy project to Firefox Addons
env:
WEB_EXT_API_KEY: ${{ vars.FIREFOX_API_KEY }}
WEB_EXT_API_SECRET: ${{ secrets.FIREFOX_API_SECRET }}
run: make deploy_firefox

1
.gitignore vendored
View File

@@ -1 +1,2 @@
web-ext-artifacts/
.idea/

View File

@@ -1,5 +1,62 @@
# Changelog
## 1.4.14 (2025-11-13)
- correction affichage menu avec rapports
## 1.4.13 (2025-11-13)
- déploiement automatique sur chrome
## 1.4.12 (2025-11-11)
- correction bug menu
## 1.4.11 (2025-11-11)
- ajout des data collection permissions
## 1.4.10 (2025-11-11)
- correction du fichier metadata.json
## 1.4.9 (2025-11-11)
- test déploiement manuel
## 1.4.8 (2025-11-11)
- suppression de data_collection_permissions car non supporté pour Android
## 1.4.7 (2025-11-11)
- correction du déploiement automatisé
- ajout de data_collection_permissions dans manifest.json
## 1.4.6 (2025-11-11)
- déploiement automatisé sur firefox
- correction du bug d'affichage du menu Messages et Rapports
## 1.4.5 (2025-10-14)
- tests de déploiement automatisé
## 1.4.4 (2025-10-11)
- tests de déploiement automatisé
## 1.4.3 (2025-09-15)
- correction de l'affichage du menu en cas de nouveau rapport
- utilisation de css pure plutôt que d'une image pour les notifs de messages
## 1.4.2 (2025-09-14)
- annulation de la suppression des tours drapeaux (car impossible de réduire l'écran correctement)
- correction de l'affichage quand il y a des nouveaux messages et des rapports d'attaques
- suppression totale de la bannière de publicité
## 1.4.1 (2025-09-02)
- correction de la largeur du menu principal

14
Makefile Normal file
View File

@@ -0,0 +1,14 @@
build:
web-ext build --overwrite-dest
lint:
web-ext lint
deploy_chrome:
chrome-webstore-upload
deploy_firefox:
web-ext sign --channel listed --amo-metadata metadata.json
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

View File

@@ -1 +0,0 @@
<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>

Before

Width:  |  Height:  |  Size: 362 B

View File

@@ -1,36 +1,42 @@
{
"manifest_version": 3,
"name": "KAplus",
"version": "1.4.1",
"version": "1.4.14",
"author": "Samuel Campos - netoik.io",
"description": "Extension développée pour améliorer l'expérience de jeu KingsAge (fonctionne avec ou sans premium)",
"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}"
}
},
"browser_specific_settings": {
"gecko": {
"id": "{e750d6a9-86ff-4129-aed6-542de03deb79}",
"data_collection_permissions": {
"required": [
"websiteContent",
"websiteActivity"
]
}
}
},
"content_scripts": [
{
"matches": ["https://*.kingsage.gameforge.com/*"],
"js": ["src/kaplus.js"],
"css": ["src/kaplus.css"]
"css": ["src/kaplus.css"]
}
],
"web_accessible_resources": [
{
"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"
}
"icons": {
"32": "icons/kaplus32.png",
"64": "icons/kaplus64.png",
"100": "icons/kaplus.png",
"128": "icons/kaplus128.png"
}
}

12
metadata.json Normal file
View File

@@ -0,0 +1,12 @@
{
"version": {
"compatibility": [
"android",
"firefox"
],
"release_notes": {
"fr": "- correction affichage menu avec rapports",
"en-US": "- fix display navbar with reports"
}
}
}

View File

@@ -1,20 +1,7 @@
@keyframes blinking {
0%, 100% {
opacity: 1;
#inner_footer {
.inner_subcolumns {
left: 0 !important;
}
50% {
opacity: 0;
}
}
@media (max-width:1000px) {
#display_left, #display_right {
display: none !important;
}
}
#banner_container {
display: none;
}
#content_wrapper > table {
@@ -27,12 +14,6 @@
text-align: center !important;
padding: 0 9px 0 11px !important;
}
.flag {
position: absolute;
top: 5px;
width: 50px;
opacity: 0.7;
}
.shortcut_container {
float: none;
}
@@ -42,16 +23,6 @@
.shortcut_container_right {
text-align: left;
}
.shortcut_container_flag {
position: absolute;
top: 0;
}
.shortcut_container_flag_left {
left: 10px;
}
.shortcut_container_flag_right {
right: 10px;
}
.shortcut_element {
margin: 0 !important;
padding: 0 !important;
@@ -59,9 +30,6 @@
width: 70px !important;
text-align: center;
}
.shortcut_container_flag .shortcut_element {
width: auto !important;
}
.shortcut_element_left, .shortcut_element_right, .shortcut_element_left_premium, .shortcut_element_right_premium {
display: none;
}
@@ -80,28 +48,18 @@
position: relative;
opacity: 0.7;
}
a.no_attack {
visibility: hidden;
}
a.has_attack {
.shortcut_element_image {
animation: blinking 2s infinite;
}
.shortcut_element_desc {
color: #FFFFFF;
}
}
a:hover, a.has_notif {
opacity: 1;
}
a.has_notif::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;
background-color: #FF0000;
border-radius: 50%;
position: absolute;
top: -13px;
right: -3px;
width: 13px;
height: 13px;
right: 3px;
width: 12px;
height: 12px;
content: "";
}
.shortcut_element_image {

View File

@@ -3,106 +3,74 @@ function num(s) {
}
function str(n) {
if (n == 0) {
if (n === 0) {
return "0";
}
s = "";
let s = "";
while (n > 0) {
if (s != "") {
if (s !== "") {
s = "." + s;
}
r = n % 1000;
let r = n % 1000;
s = r.toString().padStart(3, "0") + s;
n = ~~(n/1000);
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;
let keyCell = document.createElement("td");
keyCell.textContent = key;
let valueCell = document.createElement("td");
valueCell.textContent = value;
let row = document.createElement("tr");
row.appendChild(keyCell);
row.appendChild(valueCell);
return row;
}
function shortcutElementReplace(elt, img, text) {
hyperlinkElements = elt.getElementsByTagName("a");
if (hyperlinkElements.length == 2) {
hyperlinkElements[0].remove();
elt.getElementsByTagName("a")[0].classList.add("has_notif");
}
imageElements = elt.getElementsByTagName("img");
if (imageElements.length == 1 && imageElements[0].getAttribute("src").endsWith("new_report.png")) {
imageElements[0].remove();
elt.getElementsByTagName("a")[0].classList.add("has_notif");
}
// If more than one hyperlink element found,
// then keep the last one but with href of the first one.
let aElements = elt.getElementsByTagName("a");
let imgElements = elt.getElementsByTagName("img");
if (aElements.length > 1 || imgElements.length > 0) {
aElements[aElements.length - 1].classList.add("has_notif");
aElements[aElements.length - 1].setAttribute("href", aElements[0].getAttribute("href"));
for (let i = imgElements.length - 1; i >= 0; i --) {
imgElements[i].remove();
}
for (let i = aElements.length - 2; i >= 0; i --) {
aElements[i].remove();
}
}
spanImageElement = document.createElement("span");
let spanImageElement = document.createElement("span");
spanImageElement.classList.add("shortcut_element_image");
imgElement = document.createElement("img");
let imgElement = document.createElement("img");
imgElement.setAttribute("src", chrome.runtime.getURL("images/"+img+".svg"));
spanImageElement.appendChild(imgElement);
hyperlinkElement = elt.getElementsByTagName("a")[0];
hyperlinkElement.textContent = "";
hyperlinkElement.appendChild(spanImageElement);
aElements[0].textContent = "";
aElements[0].appendChild(spanImageElement);
if (text) {
spanDescElement = document.createElement("span");
let spanDescElement = document.createElement("span");
spanDescElement.classList.add("shortcut_element_desc");
spanDescElement.textContent = text;
hyperlinkElement.appendChild(spanDescElement);
aElements[0].appendChild(spanDescElement);
}
}
function shortcutElementAddFlag(elt, side) {
shortcutContainer = document.createElement("div");
shortcutContainer.classList.add("shortcut_container", "shortcut_container_flag", "shortcut_container_flag_"+side);
shortcutElement = document.createElement("div");
shortcutElement.classList.add("shortcut_element");
shortcutElementCenter = document.createElement("span");
shortcutElementCenter.classList.add("shortcut_element_center");
shortcutElementMarker = document.createElement("span");
shortcutElementMarker.classList.add("shortcut_element_marker");
hyperlink = document.createElement("a");
hyperlink.classList.add("no_attack");
spanImage = document.createElement("span");
spanImage.classList.add("shortcut_element_image");
image = document.createElement("img");
image.setAttribute("src", chrome.runtime.getURL("images/flag.svg"));
spanDesc = document.createElement("span");
spanDesc.classList.add("shortcut_element_desc");
layTowerAttacks = document.getElementsByClassName("lay_tower_"+side+"_top_attack");
if (layTowerAttacks.length == 1) {
hyperlink.setAttribute("href", layTowerAttacks[0].getElementsByTagName("a")[0].getAttribute("href"));
spanDesc.textContent = layTowerAttacks[0].textContent;
hyperlink.classList.add("has_attack");
hyperlink.classList.remove("no_attack");
}
spanImage.appendChild(image);
hyperlink.appendChild(spanImage);
hyperlink.appendChild(spanDesc);
shortcutElementMarker.appendChild(hyperlink);
shortcutElementCenter.appendChild(shortcutElementMarker);
shortcutElement.appendChild(shortcutElementCenter);
shortcutContainer.appendChild(shortcutElement);
elt.appendChild(shortcutContainer);
}
/* Improve main menu display */
layCastleTopElements = document.getElementsByClassName("lay_castle_top");
if (layCastleTopElements.length == 1) {
shortcutElements = layCastleTopElements[0].getElementsByClassName("shortcut_element");
let layCastleTopElements = document.getElementsByClassName("lay_castle_top");
if (layCastleTopElements.length === 1) {
document.getElementById("banner_skyscraper").remove();
let 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", "");
@@ -111,55 +79,51 @@ if (layCastleTopElements.length == 1) {
shortcutElementReplace(shortcutElements[5], "tools", "");
shortcutElementReplace(shortcutElements[6], "favorites", "");
shortcutBar = layCastleTopElements[0].getElementsByClassName("shortcut-element")[0];
shortcutElementAddFlag(shortcutBar, "left");
shortcutElementAddFlag(shortcutBar, "right");
shortcutContainers = layCastleTopElements[0].getElementsByClassName("shortcut_container");
let shortcutContainers = layCastleTopElements[0].getElementsByClassName("shortcut_container");
shortcutContainers[0].classList.add("shortcut_container_left");
shortcutContainers[2].classList.add("shortcut_container_right");
}
/* Display unit-points on user profile */
if (document.body.id === "info_player") {
mainContentPane = document.getElementsByClassName("contentpane")[1];
borderLists = mainContentPane.getElementsByClassName("borderlist");
let mainContentPane = document.getElementsByClassName("contentpane")[1];
let 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);
let playerPropertiesTable = borderLists[0];
let playerPropertiesRows = playerPropertiesTable.getElementsByTagName("tr");
let totalPoints = num(playerPropertiesRows[2].getElementsByTagName("td")[1].textContent);
let 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) {
let villagesTable = borderLists[1];
let villagesRows = villagesTable.getElementsByTagName("tr");
let villagesPoints = 0;
for (let 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;
let villagesBonus = 2250 * Math.max(0, villagesCount - 1);
let armyPoints = totalPoints - villagesPoints - villagesBonus;
let armyPercent = "-";
if (villagesCount > 0) {
armyPercent = (Math.round(armyPoints / villagesCount) / 100).toString() + " %";
} else {
armyPercent = "-";
armyPercent = (Math.round(armyPoints / villagesCount) / 100).toString() + " %";
}
playerPropertiesTable.appendChild(createRow("Points troupes:", str(armyPoints)));
playerPropertiesTable.appendChild(createRow("Points troupes:", str(armyPoints)));
playerPropertiesTable.appendChild(createRow("% points troupes:", armyPercent));
}
/* Display unit-points on village overview */
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];
let settlements = document.getElementById("settlement").textContent.split("|");
let noBorderRows = document.getElementsByClassName("noborder");
let villagePointsRow = noBorderRows[0];
for (let i=0; i<noBorderRows.length; i++) {
if (noBorderRows[i].textContent.startsWith("Points:")) {
villagePointsRow = noBorderRows[i];
break;
}
}
unitPointsRow = villagePointsRow.cloneNode(true);
let 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);