diff --git a/options.js b/options.js index f4178ad..88a49aa 100644 --- a/options.js +++ b/options.js @@ -434,6 +434,36 @@ function defaults() label: "Reader font override (without trailing comma)" }); + // hotkeys + settings.push({ + kind: "dummy", + label: "Kanji mode" + }); + settings.push({ + id: "kanji_show_stroke_count", + kind: "checkbox", + default: true, + label: "Show stroke count" + }); + settings.push({ + id: "kanji_show_readings", + kind: "checkbox", + default: true, + label: "Show jouyou readings" + }); + settings.push({ + id: "kanji_show_composition", + kind: "checkbox", + default: true, + label: "Show composition" + }); + settings.push({ + id: "kanji_show_quality_warning", + kind: "checkbox", + default: true, + label: "Show data quality warning" + }); + // hotkeys settings.push({ kind: "dummy", diff --git a/texthook.js b/texthook.js index b2dad40..c122741 100644 --- a/texthook.js +++ b/texthook.js @@ -47,6 +47,10 @@ popup_requires_key: 0, // 0: none; 1: ctrl; 2: shift x_dodge: 1, y_dodge: 0, sticky_maxheight: 0, +kanji_show_stroke_count: true, +kanji_show_readings: true, +kanji_show_composition: true, +kanji_show_quality_warning: true, hotkey_mine: "m", hotkey_close: "n", hotkey_sticky: "b", @@ -1182,14 +1186,19 @@ function build_div_kanji(text, kanjidata, moreText, index) composition.textContent = "Composition: " + kanjidata["z"]; info.appendChild(grade); - info.appendChild(strokes); - if(added_readings > 0) + if(settings.kanji_show_stroke_count) + info.appendChild(strokes); + if(settings.kanji_show_readings && added_readings > 0) info.appendChild(readings); - info.appendChild(composition); + if(settings.kanji_show_composition) + info.appendChild(composition); - tail.appendChild(document.createTextNode("Data for non-jouyou kanji may contain errors.")); - tail.appendChild(document.createElement("br")); - tail.appendChild(document.createTextNode("Composition might not render correctly if it contains obscure characters.")); + if(settings.kanji_show_quality_warning) + { + tail.appendChild(document.createTextNode("Data for non-jouyou kanji may contain errors.")); + tail.appendChild(document.createElement("br")); + tail.appendChild(document.createTextNode("Composition might not render correctly if it contains obscure characters.")); + } tail.style.marginBottom = "4px"; target.appendChild(head); @@ -1268,6 +1277,11 @@ async function settings_init() getvar("use_selection", false); getvar("only_selection", false); + getvar("kanji_show_stroke_count", true); + getvar("kanji_show_readings", true); + getvar("kanji_show_composition", true); + getvar("kanji_show_quality_warning", true); + if(!settings.enabled && exists_div()) delete_div(); if(!settings.enabled)