diff --git a/README.md b/README.md index a478e61..9913645 100644 --- a/README.md +++ b/README.md @@ -3,11 +3,18 @@ Extension chrome pour Equideow qui permet d'obtenir plus facilement les différentes informations du jeux comme le blup, le PG, les compétences mais aussi d'afficher un coefficient de victoire pour mieux gérer ses blups notamment +Il s'agit la des nouvelles et anciennes version de l'extension trouvable en stores. +Ainsi que de la version vX.Y.Z qui est ma version personnel (incluant des features de l'abonnement VIP). +La version vX.Y.Z n'arrivera jamais dans les store et est buggué et non fiable. --- ## Better Howrse Small chrome extension for Howrse that allow you to get more informations about your horses and competition difficulties. +Here are available all recents and pasts updates of the browser extension that you can find on the stores. +There is also the vX.Y.Z which is my personnal version of the extension (that adds some VIP sub features). +The vX.Y.Z will never made it to the stores and is buggy and unreliable + --- [![Last Version](https://img.shields.io/badge/last%20version-v1.4.0-informational)](#) [![DeepScan grade](https://deepscan.io/api/teams/17688/projects/21040/branches/592899/badge/grade.svg)](https://deepscan.io/dashboard#view=project&tid=17688&pid=21040&bid=592899) diff --git a/foodSelect.js b/foodSelect.js new file mode 100644 index 0000000..394f9bd --- /dev/null +++ b/foodSelect.js @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2022. Gwen Tripet-Costet + * This file is part of Better Equideow (Better Howrse). + * Better Equideow (Better Howrse) is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * Better Equideow (Better Howrse) is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + * You should have received a copy of the GNU General Public License along with this program. If not, see . + */ + +class FoodSelect { + constructor() { + this.feedingBtn = document.getElementById("boutonNourrir"); + this.haySlider = document.getElementById("haySlider"); // entire bloc containing ol, script, li, span + this.haySelectors = this.haySlider.getElementsByTagName("span"); // all span selectors from 0 to 20 + this.oatsSlider = document.getElementById("oatsSlider"); + this.oatsSelectors = this.oatsSlider.getElementsByTagName("span"); + } + + selectFeedAmount() { + // will get the value eg: XX/20 for hay and X/16 for oats. + const fourrageNode = document.getElementsByClassName( + "section-fourrage section-fourrage-target" + ); + const avoineNode = document.getElementsByClassName( + "section-avoine section-avoine-target" + ); + + const fourrageValue = fourrageNode[0].innerHTML; + const avoineValue = avoineNode[0].innerHTML; + + const fourrageIndex = parseInt(fourrageValue); + const avoineIndex = parseInt(avoineValue); + + this.haySelectors[fourrageIndex].click(); + this.oatsSelectors[avoineIndex].click(); + } +} + +const foodSelect = new FoodSelect(); + +foodSelect.feedingBtn.addEventListener("click", () => { + foodSelect.selectFeedAmount(); +}); diff --git a/manifest.json b/manifest.json index 381149f..31b09d5 100644 --- a/manifest.json +++ b/manifest.json @@ -2,7 +2,7 @@ "name": "__MSG_appName__", "description": "__MSG_appDesc__", "default_locale": "fr", - "version": "1.4.0", + "version": "x.y.z", "manifest_version": 3, "action": { "default_title": "Click to see your horse sells", @@ -19,7 +19,7 @@ { "matches": ["*://*.equideow.com/*", "*://*.howrse.com/*"], "run_at": "document_end", - "js": ["moreInfos.js", "competitionsDiffDisplay.js"] + "js": ["moreInfos.js", "competitionsDiffDisplay.js", "foodSelect.js"] } ] }