-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbackground.js
More file actions
28 lines (24 loc) · 1.06 KB
/
background.js
File metadata and controls
28 lines (24 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
function flyUNC() {
chrome.tabs.query({'active': true, 'lastFocusedWindow': true}, function (tabs) {
var tabUrl = tabs[0].url;
var ieee = "ieeexplore.ieee.org";
var springer = "link.springer.com";
var acm = "dl.acm.org";
var scienced = "www.sciencedirect.com";
var wiley = "onlinelibrary.wiley.com";
var myNewUrl;
if (tabUrl.includes(ieee))
myNewUrl = tabUrl.replace(ieee, "ieeexplore.ieee.org.libproxy.lib.unc.edu");
else if (tabUrl.includes(springer))
myNewUrl = tabUrl.replace(springer, "link-springer-com.libproxy.lib.unc.edu");
else if (tabUrl.includes(acm))
myNewUrl = tabUrl.replace(acm, "dl-acm-org.libproxy.lib.unc.edu");
else if (tabUrl.includes(scienced))
myNewUrl = tabUrl.replace(scienced, "sciencedirect.com.libproxy.lib.unc.edu");
else if (tabUrl.includes(wiley))
myNewUrl = tabUrl.replace(wiley, "onlinelibrary.wiley.com.libproxy.lib.unc.edu");
//Update the url here.
chrome.tabs.update(tabs[0].id, {url: myNewUrl});
});
}
chrome.browserAction.onClicked.addListener(flyUNC);