ET Prime restrictions (only articles)

Fixes empty homepage.
Restrictions now defined with regular expressions.
This commit is contained in:
magnolia1234 2019-12-16 20:24:04 +01:00 committed by GitHub
parent dfb4dd0c8a
commit d61311d48b

View file

@ -100,8 +100,9 @@ var defaultSites = {
}; };
const restrictions = { const restrictions = {
'barrons.com': 'barrons.com/articles', 'barrons.com': /.+barrons\.com\/articles\/.+/,
'wsj.com': 'wsj.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 // Don't remove cookies before page load
@ -450,7 +451,7 @@ function isSiteEnabled(details) {
var isEnabled = enabledSites.some(function(enabledSite) { var isEnabled = enabledSites.some(function(enabledSite) {
var useSite = (details.url.indexOf("." + enabledSite) !== -1 || details.url.indexOf("/" + enabledSite) !== -1); var useSite = (details.url.indexOf("." + enabledSite) !== -1 || details.url.indexOf("/" + enabledSite) !== -1);
if (enabledSite in restrictions) { if (enabledSite in restrictions) {
return useSite && details.url.indexOf(restrictions[enabledSite]) !== -1; return useSite && details.url.match(restrictions[enabledSite]);
} }
return useSite; return useSite;
}); });