Skip to content

Commit

Permalink
Merge pull request #50 from Gwenillia/vx.y.z
Browse files Browse the repository at this point in the history
v2.0.0-rc.1
  • Loading branch information
Gwenillia authored Jan 14, 2023
2 parents d71da56 + 46aecab commit ce354bc
Show file tree
Hide file tree
Showing 12 changed files with 529 additions and 465 deletions.
8 changes: 2 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,17 @@ 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.
Il s'agit la des nouvelles et anciennes version de l'extension trouvable en stores.

---
## 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)](#)
[![Last Version](https://img.shields.io/badge/last%20version-v2.0.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)

[![Chrome Web Store](https://img.shields.io/chrome-web-store/v/gkopbgamdhaolbjalfcbmbjkjcmgffjp)](https://chrome.google.com/webstore/detail/better-equideow/gkopbgamdhaolbjalfcbmbjkjcmgffjp)
Expand Down
10 changes: 10 additions & 0 deletions _locales/no/messages.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"appName": {
"message": "Better Howrse",
"description": "Navnet på utvidelsen."
},
"appDesc": {
"message": "Denne utvidelsen viser mer informasjon i spillet om hester og konkurranser for å få deg til å føle deg mer komfortabel når du spiller.",
"description": "Beskrivelse av utvidelsen.Beskrivelse av utvidelsen."
}
}
176 changes: 0 additions & 176 deletions competitionsDiffDisplay.js

This file was deleted.

71 changes: 71 additions & 0 deletions foodSelect.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*/

class FoodSelect {
constructor() {
this.feedingBtn = this.setHTMLElement("#boutonNourrir")
this.haySlider = this.setHTMLElement("#haySlider") || null // entire bloc containing ol, script, li, span
this.haySelectors = this.haySlider?.getElementsByTagName("span") // all span selectors from 0 to 20
this.oatsSlider = this.setHTMLElement("#oatsSlider") || null
this.oatsSelectors = this.oatsSlider?.getElementsByTagName("span")
}

setHTMLElement(element) {
return document.querySelector(element)
};

getFoodIndex(foodNode) {
const foodValue = foodNode.innerHTML
const foodIndex = parseInt(foodValue)
return foodIndex
}


async run() {
// 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"
)

if (fourrageNode.length > 0) {
const fourrageIndex = this.getFoodIndex(fourrageNode[0])
this.haySelectors[fourrageIndex].click()
}

if (avoineNode.length > 0) {
const avoineIndex = this.getFoodIndex(avoineNode[0])
this.oatsSelectors[avoineIndex].click()
}
}
}

if (window.location.href.indexOf("elevage/chevaux/cheval?") > -1) {
const foodSelect = new FoodSelect()
if (foodSelect.feedingBtn !== null)
foodSelect.feedingBtn.addEventListener("click", () => {
foodSelect.run()
})

/**
* @description generate a new FoodSelect() because after #loading style change,
* it seems like the different this.elements from foodSelect are erased ..
* @todo fix it...
*/
const startObserver = () => {
observer.start().then(() => {
let newFoodSelect = new FoodSelect()
newFoodSelect.run()
startObserver()
})
}

startObserver()
}
Loading

0 comments on commit ce354bc

Please sign in to comment.