您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Add an on-screen button and hotkey to toggle furigana on an off
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!).