comment stuff out, switch event type
This commit is contained in:
1 parent
edf041465e
commit
ad1bb79218
3 files changed
+23
-22
No files matched your search
+11
-11
@@ -465,9 +465,9 @@ function stdrule_deconjugate_inner(my_form, my_rule)
|
|||||||
{
|
{
|
||||||
if(false)//my_rule.detail=="potential")
|
if(false)//my_rule.detail=="potential")
|
||||||
{
|
{
|
||||||
console.log("Returning from deconjugation: tag doesn't match");
|
//console.log("Returning from deconjugation: tag doesn't match");
|
||||||
console.log(my_form);
|
//console.log(my_form);
|
||||||
console.log(my_rule);
|
//console.log(my_rule);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -771,13 +771,13 @@ function lookup_indirect(text, time, divexisted)
|
|||||||
}
|
}
|
||||||
if(result !== undefined)
|
if(result !== undefined)
|
||||||
{
|
{
|
||||||
console.log("found lookup");
|
//console.log("found lookup");
|
||||||
console.log(text)
|
//console.log(text)
|
||||||
return {text:text, result:result};
|
return {text:text, result:result};
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
console.log("did not find lookup");
|
//console.log("did not find lookup");
|
||||||
//console.log(text);
|
//console.log(text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -847,8 +847,8 @@ function tryopenwindow(info, tab)
|
|||||||
}
|
}
|
||||||
catch(err)
|
catch(err)
|
||||||
{
|
{
|
||||||
console.log(err);
|
//console.log(err);
|
||||||
console.log(JSON.stringify(err, Object.getOwnPropertyNames(err)));
|
//console.log(JSON.stringify(err, Object.getOwnPropertyNames(err)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -891,10 +891,10 @@ function clipboard_hook(tab)
|
|||||||
document.execCommand("paste");
|
document.execCommand("paste");
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("setting message listener");
|
//console.log("setting message listener");
|
||||||
browser.runtime.onMessage.addListener((req, sender, sendResponse) =>
|
browser.runtime.onMessage.addListener((req, sender, sendResponse) =>
|
||||||
{
|
{
|
||||||
console.log("received message to background script");
|
//console.log("received message to background script");
|
||||||
if (req.type == "search")
|
if (req.type == "search")
|
||||||
{
|
{
|
||||||
sendResponse(lookup_indirect(req.text, req.time, req.divexisted));
|
sendResponse(lookup_indirect(req.text, req.time, req.divexisted));
|
||||||
@@ -912,7 +912,7 @@ browser.runtime.onMessage.addListener((req, sender, sendResponse) =>
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
console.log("set message listener");
|
//console.log("set message listener");
|
||||||
|
|
||||||
browser.contextMenus.create({
|
browser.contextMenus.create({
|
||||||
id: "nazeka-toggle",
|
id: "nazeka-toggle",
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"manifest_version": 2,
|
"manifest_version": 2,
|
||||||
"name": "nazeka",
|
"name": "nazeka",
|
||||||
"version": "0.1.1",
|
"version": "0.1.2",
|
||||||
"author": "Wareya",
|
"author": "Wareya",
|
||||||
"homepage_url": "https://github.com/wareya/nazeka",
|
"homepage_url": "https://github.com/wareya/nazeka",
|
||||||
"description": "A rikai replacement.",
|
"description": "A rikai replacement.",
|
||||||
|
|||||||
+11
-10
@@ -603,9 +603,9 @@ async function lookup_loop()
|
|||||||
//console.log("queue not empty");
|
//console.log("queue not empty");
|
||||||
let lookup = lookup_queue.pop();
|
let lookup = lookup_queue.pop();
|
||||||
lookup_queue = [];
|
lookup_queue = [];
|
||||||
console.log("asking background to search the dictionary");
|
//console.log("asking background to search the dictionary");
|
||||||
let response = await browser.runtime.sendMessage({type:"search", text:lookup[0], time:Date.now(), divexisted:exists_div()});
|
let response = await browser.runtime.sendMessage({type:"search", text:lookup[0], time:Date.now(), divexisted:exists_div()});
|
||||||
console.log("got response");
|
//console.log("got response");
|
||||||
if(response)
|
if(response)
|
||||||
{
|
{
|
||||||
let mydiv = build_div(response.text, response.result);
|
let mydiv = build_div(response.text, response.result);
|
||||||
@@ -620,7 +620,7 @@ async function lookup_loop()
|
|||||||
|
|
||||||
if(lookup_loop_cancel)
|
if(lookup_loop_cancel)
|
||||||
{
|
{
|
||||||
console.log("queue setup");
|
//console.log("queue setup");
|
||||||
lookup_loop_cancel = false;
|
lookup_loop_cancel = false;
|
||||||
lookup_timer = undefined;
|
lookup_timer = undefined;
|
||||||
return;
|
return;
|
||||||
@@ -633,9 +633,9 @@ lookup_timer = setTimeout(lookup_loop, settings.lookuprate);
|
|||||||
|
|
||||||
function lookup_enqueue(text, x, y, x2, y2)
|
function lookup_enqueue(text, x, y, x2, y2)
|
||||||
{
|
{
|
||||||
console.log("trying to enqueue lookup");
|
//console.log("trying to enqueue lookup");
|
||||||
lookup_queue = [[text, x, y, x2, y2]];
|
lookup_queue = [[text, x, y, x2, y2]];
|
||||||
console.log("enqueued lookup");
|
//console.log("enqueued lookup");
|
||||||
if(!lookup_timer || lookup_last_time+settings.lookuprate*100 < Date.now())
|
if(!lookup_timer || lookup_last_time+settings.lookuprate*100 < Date.now())
|
||||||
{
|
{
|
||||||
if(lookup_timer)
|
if(lookup_timer)
|
||||||
@@ -646,7 +646,7 @@ function lookup_enqueue(text, x, y, x2, y2)
|
|||||||
|
|
||||||
function lookup_cancel()
|
function lookup_cancel()
|
||||||
{
|
{
|
||||||
console.log("cancelling lookup");
|
//console.log("cancelling lookup");
|
||||||
lookup_queue = [];
|
lookup_queue = [];
|
||||||
delete_div();
|
delete_div();
|
||||||
}
|
}
|
||||||
@@ -665,6 +665,7 @@ function update(event)
|
|||||||
//console.log(Date.now() + " vs " + time_of_last);
|
//console.log(Date.now() + " vs " + time_of_last);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//console.log("---- entry to word lookup at " + Date.now());
|
//console.log("---- entry to word lookup at " + Date.now());
|
||||||
time_of_last = Date.now();
|
time_of_last = Date.now();
|
||||||
//console.log("searching for text");
|
//console.log("searching for text");
|
||||||
@@ -729,8 +730,8 @@ function update(event)
|
|||||||
// if there was text, use it
|
// if there was text, use it
|
||||||
if (textNode && textNode.nodeType == 3)
|
if (textNode && textNode.nodeType == 3)
|
||||||
{
|
{
|
||||||
print_object(textNode);
|
//print_object(textNode);
|
||||||
print_object(textNode.parentNode);
|
//print_object(textNode.parentNode);
|
||||||
let rect = textNode.parentNode.getBoundingClientRect();
|
let rect = textNode.parentNode.getBoundingClientRect();
|
||||||
let fud = 5;
|
let fud = 5;
|
||||||
// FIXME: Doesn't work to reject in all cases
|
// FIXME: Doesn't work to reject in all cases
|
||||||
@@ -789,7 +790,7 @@ function update(event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
text = text.trim();
|
text = text.trim();
|
||||||
print_object(text);
|
//print_object(text);
|
||||||
text = text.substring(0, Math.min(text.length, settings.length));
|
text = text.substring(0, Math.min(text.length, settings.length));
|
||||||
|
|
||||||
//if(text != "")
|
//if(text != "")
|
||||||
@@ -827,6 +828,6 @@ function update_touch(event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
window.addEventListener("mousemove", update);
|
window.addEventListener("mousemove", update);
|
||||||
document.addEventListener("touchmove", update_touch);
|
document.addEventListener("touchstart", update_touch);
|
||||||
|
|
||||||
|
|
||||||
Reference in new issue
Block a user