diff --git a/background.js b/background.js index 7ac9bcd9..60bf0052 100644 --- a/background.js +++ b/background.js @@ -197,6 +197,7 @@ var blockedRegexes = { 'nationalreview.com': /.+\.blueconic\.net\/.+/, 'newrepublic.com': /.+\.onecount\.net\/js\/.+/, 'newsweek.com': /.+\.googletagmanager\.com\/gtm\.js/, +'newyorker.com': /.+\.newyorker\.com\/verso\/static\/presenter-articles.+\.js/, 'nytimes.com': /(.+meter-svc\.nytimes\.com\/meter\.js.+|.+mwcm\.nyt\.com\/.+\.js)/, 'nzherald.co.nz': /nzherald\.co\.nz\/.+\/headjs\/.+\.js/, 'repubblica.it': /scripts\.repubblica\.it\/pw\/pw\.js.+/, @@ -745,24 +746,3 @@ function stripQueryStringAndHashFromPath(url) { return url.split("?")[0].split("#")[0]; } -// daily users counter -function bpc_count_daily_users() { - let date = new Date(); - let dateStr = new Date(date.getTime() - (date.getTimezoneOffset() * 60000)).toISOString().split("T")[0]; - ext_api.storage.sync.get({ - daily_users: {}, - }, function (items) { - var daily_users = items.daily_users; - if (daily_users.date !== dateStr) { - daily_users.date = dateStr; - chrome.storage.sync.set({ - daily_users: daily_users - }, function () { - true; - }); - let manifest_new = 'https://bitbucket.org/magnolia1234/bpc-firefox-daily-users/downloads/bpc-daily-users-' + dateStr + '.json'; - fetch(manifest_new); - } - }); -} -bpc_count_daily_users(); diff --git a/bpc_count_daily_users.js b/bpc_count_daily_users.js new file mode 100644 index 00000000..4d81dbd5 --- /dev/null +++ b/bpc_count_daily_users.js @@ -0,0 +1,23 @@ +var ext_api = (typeof browser === 'object') ? browser : chrome; + +// daily users counter +function bpc_count_daily_users() { + let date = new Date(); + let dateStr = new Date(date.getTime() - (date.getTimezoneOffset() * 60000)).toISOString().split("T")[0]; + ext_api.storage.sync.get({ + daily_users: {}, + }, function (items) { + var daily_users = items.daily_users; + if (daily_users.date !== dateStr) { + daily_users.date = dateStr; + chrome.storage.sync.set({ + daily_users: daily_users + }, function () { + true; + }); + let count_json = 'https://bitbucket.org/magnolia1234/bpc-firefox-daily-users/downloads/bpc-daily-users-' + dateStr + '.json'; + fetch(count_json); + } + }); +} +bpc_count_daily_users(); diff --git a/lp/manifest.json b/lp/manifest.json index 04d50136..6fe7604a 100644 --- a/lp/manifest.json +++ b/lp/manifest.json @@ -1,6 +1,6 @@ { "background": { - "scripts": ["sites.js", "background.js"] + "scripts": ["sites.js", "background.js", "bpc_count_daily_users.js"] }, "content_security_policy": "script-src 'self'; object-src 'self'", "applications": { @@ -304,5 +304,5 @@ "webRequest", "webRequestBlocking" ], - "version": "1.8.3.3" + "version": "1.8.3.4" } \ No newline at end of file diff --git a/manifest.json b/manifest.json index e030666c..9de8a360 100644 --- a/manifest.json +++ b/manifest.json @@ -1,6 +1,6 @@ { "background": { - "scripts": ["sites.js", "background.js"] + "scripts": ["sites.js", "background.js", "bpc_count_daily_users.js"] }, "content_security_policy": "script-src 'self'; object-src 'self'", "applications": { @@ -40,5 +40,5 @@ "webRequest", "webRequestBlocking" ], - "version": "1.8.3.3" + "version": "1.8.3.4" } \ No newline at end of file