From d61311d48b540ed68b20ed576e65d55077f9245f Mon Sep 17 00:00:00 2001 From: magnolia1234 <7676006-magnolia1234@users.noreply.gitlab.com> Date: Mon, 16 Dec 2019 20:24:04 +0100 Subject: [PATCH] ET Prime restrictions (only articles) Fixes empty homepage. Restrictions now defined with regular expressions. --- background.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/background.js b/background.js index e8ef8dd..b14c4cd 100644 --- a/background.js +++ b/background.js @@ -100,8 +100,9 @@ var defaultSites = { }; const restrictions = { - 'barrons.com': 'barrons.com/articles', - 'wsj.com': 'wsj.com/articles' + 'barrons.com': /.+barrons\.com\/articles\/.+/, + 'prime.economictimes.indiatimes.com': /.+prime\.economictimes\.indiatimes\.com\/news\/[0-9]{8}\/.+/, + 'wsj.com': /.+wsj\.com\/articles\/.+/ } // Don't remove cookies before page load @@ -450,7 +451,7 @@ function isSiteEnabled(details) { var isEnabled = enabledSites.some(function(enabledSite) { var useSite = (details.url.indexOf("." + enabledSite) !== -1 || details.url.indexOf("/" + enabledSite) !== -1); if (enabledSite in restrictions) { - return useSite && details.url.indexOf(restrictions[enabledSite]) !== -1; + return useSite && details.url.match(restrictions[enabledSite]); } return useSite; });