diff --git a/dist/linkify-plus-plus.user.js b/dist/linkify-plus-plus.user.js index e7c909f..a0a4243 100644 --- a/dist/linkify-plus-plus.user.js +++ b/dist/linkify-plus-plus.user.js @@ -3642,16 +3642,17 @@ const triggers = [ { enabled: pref => pref.get("triggerByHover"), trigger: options => { - document.addEventListener("mouseover", function(e){ + // catch the first mousemove event since mouseover doesn't fire at page refresh + document.addEventListener("mousemove", handle, {passive: true, once: true}); + document.addEventListener("mouseover", handle, { passive: true }); + + function handle(e) { const el = e.target; - console.log(el, processedNodes.has(el)); if (validRoot(el, options.validator)) { processedNodes.add(el); linkify({...options, root: el, recursive: false}); } - }, { - passive: true - }); + } } }, { @@ -3703,7 +3704,6 @@ function createValidator({includeElement, excludeElement}) { if (processedNodes.has(node)) { return false; } - // processedNodes.add(node); if (node.isContentEditable) { return false; @@ -3835,8 +3835,8 @@ function getMessageFactory() { "optionsMailLabel": "Match email address.", "optionsNewTabLabel": "Open links in new tabs.", "optionsStandaloneLabel": "The link must be surrounded by whitespaces.", - "optionsTriggerLabel": "Trigger linkify on", - "optionsTriggerByPageLoadLabel": "Page load", + "optionsTriggerLabel": "Trigger linkifier when", + "optionsTriggerByPageLoadLabel": "Page loaded", "optionsTriggerByNewNodeLabel": "New elements added", "optionsTriggerByHoverLabel": "Mouse over", "optionsTriggerByClickLabel": "Mouse click", diff --git a/src/lib/main.js b/src/lib/main.js index 7384f8f..c3ca9e7 100644 --- a/src/lib/main.js +++ b/src/lib/main.js @@ -61,16 +61,17 @@ const triggers = [ { enabled: pref => pref.get("triggerByHover"), trigger: options => { - document.addEventListener("mouseover", function(e){ + // catch the first mousemove event since mouseover doesn't fire at page refresh + document.addEventListener("mousemove", handle, {passive: true, once: true}); + document.addEventListener("mouseover", handle, { passive: true }); + + function handle(e) { const el = e.target; - console.log(el, processedNodes.has(el)) if (validRoot(el, options.validator)) { processedNodes.add(el); linkify({...options, root: el, recursive: false}); } - }, { - passive: true - }); + } } }, { diff --git a/src/static/_locales/en/messages.json b/src/static/_locales/en/messages.json index c0f9752..a201045 100644 --- a/src/static/_locales/en/messages.json +++ b/src/static/_locales/en/messages.json @@ -36,10 +36,10 @@ "message": "The link must be surrounded by whitespaces." }, "optionsTriggerLabel": { - "message": "Trigger linkify on" + "message": "Trigger linkifier when" }, "optionsTriggerByPageLoadLabel": { - "message": "Page load" + "message": "Page loaded" }, "optionsTriggerByNewNodeLabel": { "message": "New elements added"