fix number bug

This commit is contained in:
wareya committed 2019-06-16 19:11:33 -04:00
1 parent 0cc6b2df11
commit c0210e10a7
2 files changed
+16

No files matched your search

+1
View File
@@ -7,6 +7,7 @@
["", "ず", 10000],
["", "や", 10000],
["金", "かね", 20],
["額", "ひたい", 20],
["主", "あるじ", 20],
["前", "まえ", 20],
+15
View File
@@ -1286,8 +1286,23 @@ browser.storage.onChanged.addListener((updates, storageArea) =>
let last_lookup = undefined;
let last_manual_interaction = Date.now();
function may_contain_japanese(text)
{
for(let c of text.split(""))
if(c.codePointAt(0) > 0x3000)
return true;
return false;
}
function is_number(c)
{
return "1234567890".includes(c);
}
async function send_lookup(lookup)
{
if(is_number(lookup[0].split("")[0]) && !may_contain_japanese(lookup[5]))
return;
if(!settings.kanji_mode)
{
let response = await browser.runtime.sendMessage(