FooSoft / yomichan

Japanese pop-up dictionary extension for Chrome and Firefox.
https://foosoft.net/projects/yomichan
Other
1.06k stars 213 forks source link

[Feature Request] Custom number of visible lines/spoiler button for collapsed dictionaries #2168

Closed aiko-tanaka closed 2 years ago

aiko-tanaka commented 2 years ago

Collapsible dictionaries (Appearance > Configure Collapsible dictionaries) allows users to have dictionaries collapsed/fully expanded by default.

Seems like the default number of lines visible for collapsed dicts is something around 3 lines. It'd be nice though if that number could be customizable per dict.

For example, i have 旺文社 as my main dictionary and i usually only look at its first 6 lines or so before moving on so I'd like to have its first 6 lines visible by default even when collapsed. Then I might have the other dictionaries like 大辞林 have only 2-3 lines by default. Would also be useful for ppl like me trying to get used to monolingual defs as we can fully hide bilingual dictionaries like JMDict (i.e. all contents hidden I assume if @ 0 lines visible) and the contents will only show when clicking the expand button, kinda acting like a spoiler button.

Thanks!

toasted-nutbread commented 2 years ago

You can do this with custom CSS:

.definition-item[data-dictionary='JMdict'] {
  --collapsible-definition-line-count: 2;
}

You can change JMdict to whatever your dictionary name is, and 2 to the line count.

aiko-tanaka commented 2 years ago

This is so awesome!! thanks!

\ \

I guess what's left is something like a spoiler button for dicts like JMDict(English) and Kireicake? I have the line count set to 1 here. (setting line count to 0 removes the dictionary completely)

新和英 with line count set to 1:

I'm already pretty much 99% satisfied with this, but the 'spoiler' button might be worth looking into if you have the time I guess.

toasted-nutbread commented 2 years ago

2170 adds new options to force the expansion button to always be visible. Together with some more custom CSS, these options can be used to implement a basic spoiler functionality:

/* Spoiler-like functionality, use with Force collapsed mode */
.definition-item[data-dictionary='JMdict'] .definition-item-inner.collapsible.collapsed {
    color: #000000;
    background-color: #000000;
}