From eb3d8eb2e78063ceee0651a1f20e73ef80fc3fbd Mon Sep 17 00:00:00 2001 From: Alek Underwood <13879529+o0o0@users.noreply.github.com> Date: Mon, 14 Jan 2019 10:38:33 -0500 Subject: [PATCH] Added font size options --- options.js | 24 ++++++++++++++++++++++++ texthook.js | 13 ++++++++----- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/options.js b/options.js index a6863da..058e702 100644 --- a/options.js +++ b/options.js @@ -217,6 +217,30 @@ function defaults() default: "", label: "Font override (without trailing comma)" }); + settings.push({ + id: "definition_fontsize", + kind: "number", + min: 4, + max: 48, + default: 13, + label: "Definition font size" + }); + settings.push({ + id: "dict_item_fontsize", + kind: "number", + min: 4, + max: 48, + default: 18, + label: "Dictionary item font size" + }); + settings.push({ + id: "reading_fontsize", + kind: "number", + min: 4, + max: 48, + default: 15, + label: "Reading font size" + }); settings.push({ id: "hlfont", kind: "text", diff --git a/texthook.js b/texthook.js index 2aab3c3..7c9e4bd 100644 --- a/texthook.js +++ b/texthook.js @@ -47,6 +47,9 @@ hlcolor: "#99DDFF", hlcolor2: "#99FF99", font: "", hlfont: "", +definition_fontsize: 13, +dict_item_fontsize: 18, +reading_fontsize: 15, corner: 0, xoffset: 5, yoffset: 22, @@ -184,7 +187,7 @@ function display_div(middle, x, y) if(font != "") font += ","; middle.style = `background-color: ${settings.bgcolor}; border-radius: 2.5px; border: 1px solid ${settings.bgcolor};`; - middle.firstChild.style = `border: 1px solid ${settings.fgcolor}; border-radius: 2px; padding: 2px; background-color: ${settings.bgcolor}; color: ${settings.fgcolor}; font-family: ${font} Arial, sans-serif; font-size: 13px; text-align: left;`; + middle.firstChild.style = `border: 1px solid ${settings.fgcolor}; border-radius: 2px; padding: 2px; background-color: ${settings.bgcolor}; color: ${settings.fgcolor}; font-family: ${font} Arial, sans-serif; text-align: left; font-size: ${settings.definition_fontsize}px;`; let find_root = window; let newx = x; @@ -524,11 +527,11 @@ function build_div_inner(text, result, moreText, index, first_of_many = false) if(settings.font.trim().replace(";","").replace("}","") != "") font += settings.font.trim().replace(";","").replace("}","") + ","; style.textContent = -`.nazeka_main_keb{font-size:18px;white-space:nowrap;font-family: ${font}IPAGothic,TakaoGothic,Noto Sans CJK JP Regular,Meiryo,sans-serif;color:${settings.hlcolor}} -.nazeka_main_reb{font-size:18px;white-space:nowrap;font-family: ${font}IPAGothic,TakaoGothic,Noto Sans CJK JP Regular,Meiryo,sans-serif;color:${settings.hlcolor}} +`.nazeka_main_keb{font-size:${settings.dict_item_fontsize}px;white-space:nowrap;font-family: ${font}IPAGothic,TakaoGothic,Noto Sans CJK JP Regular,Meiryo,sans-serif;color:${settings.hlcolor}} +.nazeka_main_reb{font-size:${settings.dict_item_fontsize}px;white-space:nowrap;font-family: ${font}IPAGothic,TakaoGothic,Noto Sans CJK JP Regular,Meiryo,sans-serif;color:${settings.hlcolor}} .nazeka_word * {vertical-align: middle} -.nazeka_sub_keb{font-size:15px;white-space:nowrap;font-family: ${font}IPAGothic,TakaoGothic,Noto Sans CJK JP Regular,Meiryo,sans-serif} -.nazeka_sub_reb{font-size:15px;white-space:nowrap;color:${settings.hlcolor2}} +.nazeka_sub_keb{font-size:${settings.reading_fontsize}px;white-space:nowrap;font-family: ${font}IPAGothic,TakaoGothic,Noto Sans CJK JP Regular,Meiryo,sans-serif} +.nazeka_sub_reb{font-size:${settings.reading_fontsize}px;white-space:nowrap;color:${settings.hlcolor2}} .nazeka_original{float: right; margin-right: 2px; margin-left:4px; opacity:0.7;} .epwing_head{margin: 6px 8px 4px;} .epwing_definition{margin: 0 8px;}