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

Add readings based on selected text only #30

Open
qntoine opened this issue Feb 22, 2023 · 4 comments
Open

Add readings based on selected text only #30

qntoine opened this issue Feb 22, 2023 · 4 comments
Labels
enhancement New feature or request

Comments

@qntoine
Copy link

qntoine commented Feb 22, 2023

Please consider adding the option to selectively generate readings based on current text selection, as opposed to the full field.

That option was available in another plugin (SimpleFurigana). The author went MIA but the plugin code is still available on Github under GPL 3.0 (see https://github.com/jcsirot/anki-simple-furigana).

Thank you!

@ahlec
Copy link
Collaborator

ahlec commented Feb 23, 2023

This repository is actually a fork of that one, and some of the vestiges of the "only apply to selected text" is found within the architecture for this plugin.

Unfortunately, Anki changes have been pretty dramatic across the past 3 years since that plugin was seeing active development, and there've been numerous and frequent breaking changes. That will mean that we won't be able to directly lift the code from that repository/reenable it within this one, and it'll take additional research and development, especially as this plugin supports a wide range of Anki versions (meaning we need to ensure backwards compatibility and figure out how to do selection in each version).

It can definitely be done, but this might rank lower on the overall priority list (or at least, on my personal one) as I can't imagine applying furigana to only a subset of an input box is an altogether frequent need. Not to mention it'll produce a more difficult UX for users to discover they can do this.

To explore base assumptions though: what would you use case be for needing to apply furigana to only part of the text in the input box? Could that same need be solved with a different feature?

@ahlec ahlec added the enhancement New feature or request label Feb 23, 2023
@qntoine
Copy link
Author

qntoine commented Feb 23, 2023

Thank you for the detailed explanation on the background of this feature.

To go back to the use case, my point is simply that displaying all furigana does not mimic an actual reading experience in Japanese (even in a learning context, e.g. a textbook or flashcards), where only readings for the most difficult words are shown. Displaying all furigana is distracting and can hinder your ability to progress as your brain may intuitively will go for the easiest route and hinge on furigana first.
It is like watching a movie with subtitles on by default: nice to have and even needed in some cases, but unnecessary and distracting in others.

One alternative feature I can think of to elegantly solve this issue would be to add an option to hide furigana by default and display them only when hovering over (for mouse interfaces) or clicking (for touch interfaces) on a certain word.
It seems doable with Ruby (there are many examples available online, including something as simple as ruby rt { visibility: hidden; } ruby:hover rt { visibility: visible; } added to the Styling section), only the solution would need to work on all platforms preferably (Anki for desktop, Anki Mobile, Ankidroid, and Ankiweb).

@obynio
Copy link
Owner

obynio commented Feb 24, 2023

Hello, I should add some background since I'm mostly responsible for removing this feature. Unfortunately Anki removed a lot of the javascript binding "hacks" that we were using to be able to fetch the selected text. I tried my best to keep it by testing several techniques and ultimately decided to remove the feature during the refactoring since none of these techniques worked. I would love to bring it back if we manage to find a way to fetch the user selected text.

This repo is indeed a fork of SimpleFurigana, which is itself a form of ClozeFuriganaTool but has been heavily refactored to make it follow the Anki new releases and make it work on newer versions.

The original author of SimpleFurigana recently reached out to me to tell me that he is too busy to maintain it and prefer to deprecate it and redirect users to this repo.

@obynio
Copy link
Owner

obynio commented Feb 24, 2023

I think your feature request for hide furigana by default is easy to implement. Could you create a separate issue for that feature request so that we don't loose sight of it ? Can't give an ETA though, but I welcome contributions.

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

No branches or pull requests

3 participants