Skip to content

Commit

Permalink
Merge pull request #45 from MaastrichtU-Library/32
Browse files Browse the repository at this point in the history
FAIR evaluation UI enhancements and bug fixes issues #32  #15  #42
  • Loading branch information
pedrohserrano committed Jul 14, 2023
2 parents 89981dd + 591f93e commit 9788760
Show file tree
Hide file tree
Showing 9 changed files with 90 additions and 3,598 deletions.
26 changes: 10 additions & 16 deletions background.js
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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});
}
});
15 changes: 2 additions & 13 deletions contentScript.js
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -15,7 +15,6 @@ async function highlightSearchTerms()
//HTML code used to highlight DOI's
var highlightStartTag = "<font style= \"color: white; background-color:#ea512a;\">";
var highlightEndTag = "</font>";

//Find dois in HTML code and add to array
const dois = [];
var index = 0;
Expand Down Expand Up @@ -76,17 +75,11 @@ async function highlightSearchTerms()


}






catch (error) {
throw error;
}


}
//Redirect user to the DOI
function dir_url(id){
Expand All @@ -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();
Binary file added icons/load.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 8 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
<link href="styles.css" rel="stylesheet">
<link href="loader.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
<script type="module" src="bundle.js"></script>
<title>the FAIR extension</title>
</head>
<body>
Expand All @@ -16,6 +15,9 @@

<main class="container">
<section class="leftpane">
<div id="spinner" style="display: none;">
<img src="icons/load.gif" alt="Loading..." />
</div>
<div id="evaluation" class="boxed center2">🎓️ No evaluation yet</div>
<div id="score" class="center" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"></div>
</section>
Expand All @@ -32,11 +34,14 @@
<footer>
<div class="w3-container">
<div class="w3-panel w3-pale-blue w3-leftbar w3-rightbar w3-border-blue">
<p>Copyright (c) 2023 Maastricht University Library</p>
<p>More info? Visit the<a href="https://github.com/MaastrichtU-Library/the-FAIR-extension">Github repo 😸</a></p>
<p><a href="https://github.com/MaastrichtU-Library/the-FAIR-extension/blob/main/disclaimer.md">Privacy Disclaimer</a> last update 24/10/22</p>
<p><a href="https://github.com/MaastrichtU-Library/the-FAIR-extension/releases/tag/Beta">the FAIR extension</a> v1.0.0 - beta</p>
<p><a href="https://github.com/MaastrichtU-Library/the-FAIR-extension/releases/tag/Beta">the FAIR extension</a> v1.1.0 - beta</p>
<p>Copyright (c) 2023 Maastricht University Library</p>
</div>
</div>
</footer>
</body>
<script src="contentScript.js"></script>
<script src="popup.js"></script>
</html>
53 changes: 21 additions & 32 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,42 +1,31 @@
{
"name": "the FAIR extension",
"version": "1.0.0",
"version": "1.1.0",
"description": "An open-source web browser extension that allows researchers to do FAIRness evaluations directly to the web source.",

"web_accessible_resources": [{
"resources": ["index.html"],
"matches": ["<all_urls>"]
}],
"content_scripts": [
{
"matches": ["<all_urls>"],
"js": ["contentScript.js"],
"run_at": "document_end"
}
]
,
{
"matches": ["<all_urls>"],
"js": ["contentScript.js"],
"run_at": "document_end"
}
],
"icons": {
"16": "/icons/icon16.png",
"48": "/icons/icon48.png",
"128": "/icons/icon128.png"
"16": "icons/icon16.png",
"48": "icons/icon48.png",
"128": "icons/icon128.png"
},
"host_permissions": ["<all_urls>"],
"action":{
"default_popup": "index.html"
,"deafault_icon": {
"16": "/icons/icon16.png",
"48": "/icons/icon48.png",
"128": "/icons/icon128.png"
}
"action": {
"default_popup": "index.html",
"default_icon": {
"16": "icons/icon16.png",
"48": "icons/icon48.png",
"128": "icons/icon128.png"
}
},
"background": {
"service_worker": "background.js"
},
"permissions" : ["storage"],

"service_worker": "background.js"
},
"permissions": ["storage"],
"manifest_version": 3



}

}
Loading

0 comments on commit 9788760

Please sign in to comment.