Greasy Fork is available in English.

Hide/Show ruby text/Furigana (hotkey & on-screen button)

Add an on-screen button and hotkey to toggle furigana on an off

Tác giả
Garbaz
Cài đặt hàng ngày
0
Số lần cài đặt
17
Đánh giá
0 0 0
Phiên bản
1.6
Đã tạo
17-10-2020
Đã cập nhật
20-11-2020
Giấy phép
N/A
Áp dụng cho

This script adds an on-screen button and hotkey to hide/show ruby text (e.g. furigana above kanji) in websites. The script only activates if there actually is ruby text in the current web page.

The button appears in the top left by default, showing the current state. Clicking on it will toggle.

In addition, the key to the left of the number row under the ESC key (I think on the US layout it has ~ on it) can also be pressed to toggle.

The hotkey and button (whether and where to show it) can be configured at the top of the script.

Technical detail:

Not every web page uses the "proper" html <ruby> tags to render ruby text, instead using some manual CSS shenanigans. To also support jisho.org specifically, I added the "furigana" CSS class to my code, but of course if other websites use a different class name, the script won't work. If you have some website where the script doesn't work, right-click on a furigana element and click inspect. It probably has a "class=" somewhere in the HTML. You can add that class name in the code (in const css_visible and const css_hidden) by simply duplicating the special case for "furigana" and renaming it (don't forget the dot!).