diff --git a/background-script.js b/background-script.js
index 955b865..cbef676 100644
--- a/background-script.js
+++ b/background-script.js
@@ -299,6 +299,7 @@ rules.push({type: "onlyfinalrule", dec_end:"", con_end:"ぬ", dec_tag:"stem-mize
rules.push({type: "contextrule", contextrule: "adjspecial", dec_end:"", con_end:"ない", dec_tag:"stem-ku", con_tag:"adj-i", detail:"negative"});
// special negative inflections where the intermediate stage (e.g. 赤くある) is not a synthetic phrase like the end result (e.g. 赤くありません) is
+// FIXME: don't allow conjugating ~ない to this?
rules.push({type: "stdrule", dec_end:"", con_end:"ありません", dec_tag:"stem-ku", con_tag:"uninflectable", detail:"formal negative"});
rules.push({type: "stdrule", dec_end:"", con_end:"ありませんでした", dec_tag:"stem-ku", con_tag:"uninflectable", detail:"formal negative past"});
@@ -316,11 +317,11 @@ rules.push({type: "onlyfinalrule", dec_end:"", con_end:"ましょう", dec_tag:"
////////////////////
rules.push({type: "onlyfinalrule", dec_end:"", con_end:"たら", dec_tag:"stem-ren-less", con_tag:"uninflectable", detail:"conditional"});
-rules.push({type: "onlyfinalrule", dec_end:"", con_end:"だた", dec_tag:"stem-ren-less-v", con_tag:"uninflectable", detail:"conditional"});
-rules.push({type: "onlyfinalrule", dec_end:"", con_end:"ったり", dec_tag:"stem-ka", con_tag:"uninflectable", detail:"conditional"});
+rules.push({type: "onlyfinalrule", dec_end:"", con_end:"だら", dec_tag:"stem-ren-less-v", con_tag:"uninflectable", detail:"conditional"});
+rules.push({type: "onlyfinalrule", dec_end:"", con_end:"ったら", dec_tag:"stem-ka", con_tag:"uninflectable", detail:"conditional"});
rules.push({type: "onlyfinalrule", dec_end:"", con_end:"たらば", dec_tag:"stem-ren-less", con_tag:"uninflectable", detail:"formal conditional"});
-rules.push({type: "onlyfinalrule", dec_end:"", con_end:"だたば", dec_tag:"stem-ren-less-v", con_tag:"uninflectable", detail:"formal conditional"});
-rules.push({type: "onlyfinalrule", dec_end:"", con_end:"ったりば", dec_tag:"stem-ka", con_tag:"uninflectable", detail:"formal conditional"});
+rules.push({type: "onlyfinalrule", dec_end:"", con_end:"だらば", dec_tag:"stem-ren-less-v", con_tag:"uninflectable", detail:"formal conditional"});
+rules.push({type: "onlyfinalrule", dec_end:"", con_end:"ったらば", dec_tag:"stem-ka", con_tag:"uninflectable", detail:"formal conditional"});
rules.push({type: "stdrule", dec_end:"", con_end:"ば", dec_tag:"stem-e", con_tag:"uninflectable", detail:"provisional conditional"});
rules.push({type: "stdrule", dec_end:"", con_end:"れば", dec_tag:"stem-ke", con_tag:"uninflectable", detail:"provisional conditional"});
diff --git a/options.html b/options.html
index 6ad21c0..d916e04 100644
--- a/options.html
+++ b/options.html
@@ -10,12 +10,9 @@
diff --git a/options.js b/options.js
index 8ffdb58..dce246b 100644
--- a/options.js
+++ b/options.js
@@ -2,16 +2,17 @@ function restoreListeners()
{
document.querySelector("#enabled").addEventListener("change", setOptions);
document.querySelector("#compact").addEventListener("change", setOptions);
+ document.querySelector("#length").addEventListener("change", setOptions);
}
function removeListeners()
{
document.querySelector("#enabled").removeEventListener("change", setOptions);
document.querySelector("#compact").removeEventListener("change", setOptions);
+ document.querySelector("#length").removeEventListener("change", setOptions);
}
async function restoreOptions()
{
- restoreListeners();
try
{
let enabled = (await browser.storage.local.get("enabled")).enabled;
@@ -20,12 +21,17 @@ async function restoreOptions()
let compact = (await browser.storage.local.get("compact")).compact;
if(compact == undefined)
compact = true;
+ let length = (await browser.storage.local.get("length")).length;
+ if(length == undefined)
+ length = 25;
removeListeners();
document.querySelector("#enabled").checked = enabled?true:false;
document.querySelector("#compact").checked = compact?true:false;
- restoreListeners();
+ document.querySelector("#length").value = length?length:25;
}
catch (error){}
+ removeListeners();
+ restoreListeners();
}
function setOptions()
@@ -34,6 +40,7 @@ function setOptions()
{
enabled: document.querySelector("#enabled").checked,
compact: document.querySelector("#compact").checked,
+ length: parseInt(document.querySelector("#length").value),
});
}
diff --git a/texthook.js b/texthook.js
index d5b7cbd..2a8c3b2 100644
--- a/texthook.js
+++ b/texthook.js
@@ -25,6 +25,7 @@ function print_object(message)
let settings = {
enabled: false,
compact: true,
+length: 25,
};
let last_time_display = Date.now();
@@ -432,6 +433,9 @@ async function settings_reload()
settings.compact = (await browser.storage.local.get("compact")).compact;
if(settings.compact == undefined)
settings.compact = true;
+ settings.length = (await browser.storage.local.get("length")).length;
+ if(settings.length == undefined)
+ settings.length = true;
//console.log("set settings");
//console.log(settings.enabled);
//console.log(settings.compact);
@@ -506,7 +510,6 @@ function lookup_cancel()
delete_div();
}
-let max_search_len = 25;
let time_of_last = Date.now();
let throttle = 8;
@@ -588,7 +591,7 @@ window.addEventListener("mousemove", (event)=>
// grab text from later and surrounding DOM nodes
let current_node = textNode;
- while(text.length < max_search_len)
+ while(text.length < settings.length)
{
if(current_node == undefined) break;
try
@@ -625,14 +628,14 @@ window.addEventListener("mousemove", (event)=>
}
i++;
}
- if(text.length < max_search_len)
+ if(text.length < settings.length)
current_node = current_node.parentNode;
}
text = text.trim();
//print_object(text);
- text = text.substring(0, Math.min(text.length, max_search_len));
+ text = text.substring(0, Math.min(text.length, settings.length));
//if(text != "")
//lookup_indirect(text, event.clientX, event.clientY, time_of_last);