diff --git a/background.js b/background.js index b046e00..d4f8cc1 100644 --- a/background.js +++ b/background.js @@ -1,4 +1,4 @@ -// Copyright 2022 Maastricht University Library +// Copyright 2023 Maastricht University Library // Use of this source code is governed by an Apache 2.0-style // license that can be found in the LICENSE file or at @@ -7,18 +7,12 @@ // Allows communication between .js files //listener that recieves messages from contnet script -chrome.runtime.onMessage.addListener( - function(request, sender, sendResponse){ - if(request.redirect == null){ - //Stores the list of DOI's in chrome storage with key: "key" - chrome.storage.local.set({key: request.data}, function() { - }); - } - else{ - //Redirects to a specified URL - chrome.tabs.update(sender.tab.id, {url: request.redirect}); - - } - } -); - +chrome.runtime.onMessage.addListener((request, sender) => { + if (request.redirect) { + // Redirects to a specified URL + chrome.tabs.update(sender.tab.id, {url: request.redirect}); + } else if (request.data) { + // Stores the list of DOI's in chrome storage with key: "key" + chrome.storage.local.set({key: request.data}); + } +}); \ No newline at end of file diff --git a/contentScript.js b/contentScript.js index eb5a7ab..c82f493 100644 --- a/contentScript.js +++ b/contentScript.js @@ -1,4 +1,4 @@ -// Copyright 2022 Maastricht University Library +// Copyright 2023 Maastricht University Library // Use of this source code is governed by an Apache 2.0-style // license that can be found in the LICENSE file or at @@ -15,7 +15,6 @@ async function highlightSearchTerms() //HTML code used to highlight DOI's var highlightStartTag = ""; var highlightEndTag = ""; - //Find dois in HTML code and add to array const dois = []; var index = 0; @@ -76,17 +75,11 @@ async function highlightSearchTerms() } - - - - - catch (error) { throw error; } - } //Redirect user to the DOI function dir_url(id){ @@ -100,8 +93,4 @@ function sendCurrent(id){ document.getElementById(id).innerText ="Open the extension for results"; } // initiates functions when a website is visited -highlightSearchTerms(); - - - - +highlightSearchTerms(); \ No newline at end of file diff --git a/icons/load.gif b/icons/load.gif new file mode 100644 index 0000000..a718bd8 Binary files /dev/null and b/icons/load.gif differ diff --git a/index.html b/index.html index 0fe7c3a..1958a20 100644 --- a/index.html +++ b/index.html @@ -6,7 +6,6 @@ -