diff --git a/background.js b/background.js index 28740b2..1e44113 100644 --- a/background.js +++ b/background.js @@ -3,8 +3,8 @@ 'use strict'; // Cookies from this list are blocked by default (obsolete) -// defaultSites are loaded from sites(_custom).json at installation extension -var defaultSites = {}; +// defaultSites are loaded from sites.js at installation extension +// var defaultSites = {}; const restrictions = { 'barrons.com': /.+barrons\.com\/articles\/.+/, @@ -13,7 +13,7 @@ const restrictions = { } // Don't remove cookies before page load -// allow_cookies are completed with domains in sites(_custom).json (default allow/remove_cookies) +// allow_cookies are completed with domains in sites.js (default allow/remove_cookies) var allow_cookies = [ 'adelaidenow.com.au', 'barrons.com', @@ -63,7 +63,7 @@ var allow_cookies = [ ] // Removes cookies after page load -// remove_cookies are completed with domains of sites(_custom).json (default allow/remove_cookies) +// remove_cookies are completed with domains of sites.js (default allow/remove_cookies) var remove_cookies = [ ] @@ -209,28 +209,7 @@ browser.storage.onChanged.addListener(function(changes, namespace) { // Set and show default options on install browser.runtime.onInstalled.addListener(function (details) { if (details.reason == "install") { - const url_sites = browser.runtime.getURL('sites.json'); - fetch(url_sites) - .then(response => { - if (response.ok) { - response.json().then(json => { - var defaultSites_merge = {...defaultSites, ...json}; - defaultSites = defaultSites_merge; - // add custom sites - const url_sites_custom = 'https://raw.githubusercontent.com/magnolia1234/bypass-paywalls-firefox-clean/master/sites_custom.json'; - fetch(url_sites_custom) - .then(response => { - if (response.ok) { - response.json().then(json => { - var defaultSites_merge = {...defaultSites, ...json}; - defaultSites = defaultSites_merge; - setDefaultOptions(); - }) - } else { setDefaultOptions(); } - } ); - }) - } else { setDefaultOptions(); } - } ); + setDefaultOptions(); } else if (details.reason == "update") { // User updated extension } diff --git a/manifest.json b/manifest.json index 67f715d..7df2d43 100644 --- a/manifest.json +++ b/manifest.json @@ -1,6 +1,6 @@ { "background": { - "scripts": ["background.js"] + "scripts": ["sites.js", "background.js"] }, "content_scripts": [ { diff --git a/options.html b/options.html index 9ffb007..e781e38 100644 --- a/options.html +++ b/options.html @@ -1,6 +1,7 @@ + Bypass Paywalls Clean Options