Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Add gender info in the moreInfo section #80

Closed
AndreaMendez09 opened this issue Apr 17, 2024 · 4 comments
Closed

Feat: Add gender info in the moreInfo section #80

AndreaMendez09 opened this issue Apr 17, 2024 · 4 comments

Comments

@AndreaMendez09
Copy link
Contributor

Hi!
Im working on this feature but im not a JS developer, im a Backend in Java so feel free to correct me if u need it.

At the moment I have this done:
imagen

The problem im facing is with the integration with the other languages:
imagen
They dont have an ID for the gender part, so I have to do it like this:
this.regexpSexHtml = /<td class="first"><strong>Sexo:<\/strong>\s*(\w+)<\/td>/

How can I make this work for the rest of the languages?

Another thing, when you go to the buy horses part, when added this feature you see this:
imagen
I think im doing somethin wrong or in a wrong file.

And the last thing I want to ask is, I believe this can be done better:

          const sexHTML = data.match(this.regexpSexHtml);
          const img = document.createElement("img")
          if (sexHTML[1] === `${translation.get(this.lang, 'sex', 'female')}`) {
            img.src = chrome.runtime.getURL("images/female.png")
          } else if (sexHTML[1] === `${translation.get(this.lang, 'sex', 'male')}`) {
            img.src = chrome.runtime.getURL("images/male.png")
          } else {
            img.src = chrome.runtime.getURL("images/gelding.png")
          }

I was trying to do something like this:

const imageUrl = chrome.runtime.getURL(images/${sexValue}.png);

The concept its to delete de ifs statements, and simplify the code, but with the translation feature i dont know how to do it.

Thanks for your help! I will update in the comments if I find a solution for any of this problems.

The branch im working in --> https://github.com/AndreaMendez09/Better-Equideow/tree/more-info-horse-gender

@Gwenillia
Copy link
Owner

Sure, can you please open a PR when it’s fixed, or if you want me to fix it just tag me :)

For the first thing: I think you can use the xPath of the element or something like that 🤔

For the bug on buy horse part, you can display the icon only when this.elevageLocation is true

this.elevageLocation =

This line should be the same on all howrse websites since the url seems to always be in french.

@AndreaMendez09
Copy link
Contributor Author

Thanks! I manage with your help to make it work, I will do a PR, the only thing thats incomplete its the translation file for PL and NO.

@Gwenillia
Copy link
Owner

Yep, I will check it later this week and see if I still have my NO and PL accounts. I’ll take the occasion to add all missing strings at the same time :)

Thanks for your contribution 🥇

@Gwenillia Gwenillia linked a pull request Apr 18, 2024 that will close this issue
@Gwenillia
Copy link
Owner

#82

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants