|
|
|
|
1
|
-sites_url = "https://raw.githubusercontent.com/RSF-RWB/collateralfreedom/master/sites.json"
|
|
|
2
|
-sites = {}
|
|
|
|
|
1
|
+var sites_url = "https://raw.githubusercontent.com/RSF-RWB/collateralfreedom/master/sites.json"
|
|
|
2
|
+var sites = {}
|
|
|
3
|
+var domain_regexp = /:\/\/(www\.)?([^\/]+)\//
|
3
|
|
4
|
|
4
|
function getSitesAndMirrors() {
|
5
|
function getSitesAndMirrors() {
|
5
|
$.getJSON(sites_url).done(function(data) { chrome.storage.local.set({"sites": data}) })
|
6
|
$.getJSON(sites_url).done(function(data) { chrome.storage.local.set({"sites": data}) })
|
|
|
|
|
26
|
getCurrentTabUrl(function(url) {
|
27
|
getCurrentTabUrl(function(url) {
|
27
|
chrome.storage.local.get("sites", function(sites){
|
28
|
chrome.storage.local.get("sites", function(sites){
|
28
|
sites = sites.sites
|
29
|
sites = sites.sites
|
29
|
- domain = url.match(/:\/\/(www\.)?([^\/]+)\//).slice(-1)[0]
|
|
|
|
|
30
|
+ let domain = url.match(domain_regexp).slice(-1)[0]
|
30
|
if(domain in sites) {
|
31
|
if(domain in sites) {
|
31
|
chrome.browserAction.setIcon({path: 'rsc/icon-red.png'})
|
32
|
chrome.browserAction.setIcon({path: 'rsc/icon-red.png'})
|
32
|
}
|
33
|
}
|