From 1895fec3cf2b380c1d44de7be27f7d1eb49e7f5f Mon Sep 17 00:00:00 2001 From: shinigami-eyes <43276258+shinigami-eyes@users.noreply.github.com> Date: Mon, 17 Dec 2018 21:56:30 +0100 Subject: [PATCH] Mark link that was clicked --- extension/content.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/extension/content.js b/extension/content.js index 5e7041a..de87982 100644 --- a/extension/content.js +++ b/extension/content.js @@ -432,6 +432,8 @@ function getIdentifierInternal(urlstr) { init(); +var lastGeneratedLinkId = 0; + browser.runtime.onMessage.addListener((message, sender, sendResponse) => { if (message.updateAllLabels) { @@ -468,9 +470,15 @@ browser.runtime.onMessage.addListener((message, sender, sendResponse) => { var exact = snippets.filter(x => x && x.contains(lastRightClickedElement))[0] || null; + + message.linkId = ++lastGeneratedLinkId; + + if (lastRightClickedElement) + lastRightClickedElement.setAttribute('shinigami-eyes-link-id', lastGeneratedLinkId); + message.snippet = exact ? exact.outerHTML : null; var debugClass = 'shinigami-eyes-debug-snippet-highlight'; - + if (exact && message.debug) { exact.classList.add(debugClass); if (message.debug <= 1)