stephenmk / Jitendex

A free, offline, and openly licensed Japanese-to-English dictionary. Updates weekly!
https://jitendex.org
Creative Commons Attribution Share Alike 4.0 International
248 stars 2 forks source link

Hide "forms" section when displayed as a list #56

Closed Aridow closed 7 months ago

Aridow commented 7 months ago

With some words like ヘア or コンピューター, the different forms of the word doesn't display as a table but as a list. The issue is, since the different forms already appear in the entry name, I think it's redundant to have this section in that case.

stephenmk commented 7 months ago

The order in which forms appear in the "forms" list roughly corresponds to the frequency of their usages. "ヘア" is considerably more common than "ヘアー", so it is at the top of the list. Likewise for コンピュータ and コンピューター. If I removed a form from the list, then this information would be lost.

I am doing something like what you suggest in the MDict version of Jitendex. The form which appears at the top of an entry is not displayed again in the "other forms" list at the bottom. But since the form displayed at the top in Yomitan is always the form that has been searched (rather than the most frequent form), it is not possible to replicate this design in Yomitan.

Entry for コンピュータ in GoldenDict-ng ![computer](https://github.com/stephenmk/Jitendex/assets/8003332/6740ab0e-c791-4dd4-b63b-63dbc5c72350)
Entry for ヘア in GoldenDict-ng ![hair](https://github.com/stephenmk/Jitendex/assets/8003332/eb60a67e-dc65-4e7c-b7d2-4cd4e1056706)
stephenmk commented 7 months ago

Also, I am already hiding the forms list when an entry only contains one form.

kizen

stephenmk commented 7 months ago

If you still don't want to see the lists, you can add this custom style to your Yomitan to hide them. If you don't know how to do that, I wrote about how to add custom styles to Yomitan in this article.

/* Hide lists of forms in Jitendex */
div[data-sc-content="forms"]:has(ul) {
  display: none;
}
Aridow commented 7 months ago

Thanks. I just had to remove "div" for it to work.

stephenmk commented 7 months ago

That's very surprising to me. I tested it in Chromium and Firefox and it worked with the "div" in both browsers. Are you using a different browser?

Aridow commented 7 months ago

I use Firefox. For instance, with the "div", the list is correctly hidden with コンピューター but not with ヘア. In "inspect element" with ヘア it's: <li class="gloss-sc-li" data-sc-content="forms">

stephenmk commented 7 months ago

Thanks, that makes sense. Because the entry for ヘア has two senses (① and ②), I structured it a little differently. Glad to hear you got it working.