length setting, some deconj fixes
This commit is contained in:
1 parent
86bb4d4c0d
commit
d8246c59f8
4 files changed
+22
-14
No files matched your search
@@ -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"});
|
||||
|
||||
+1
-4
@@ -10,12 +10,9 @@
|
||||
<div class=panel>
|
||||
<form name=optform>
|
||||
<div class="panel-section panel-section-formElements browser-style">
|
||||
<!--<div class=panel-section>-->
|
||||
<input id="enabled" type="checkbox" name=enabled class=panel-formElements-item/><label for=enabled class=panel-formElements-item>Enabled</label>
|
||||
<!--</div>-->
|
||||
<!--<div class=panel-section>-->
|
||||
<input id="compact" type="checkbox" name=compact class=panel-formElements-item/><label for=compact class=panel-formElements-item>Compact</label>
|
||||
<!--</div>-->
|
||||
<input id="length" type="number" min="6" max="100" value="25" name=length class=panel-formElements-item/><label for=length class=panel-formElements-item>Search length (characters) (default 25, sane values are from 25 and 50)</label>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
+9
-2
@@ -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),
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
+7
-4
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user