diff --git a/src/assets/javascripts/helpers/medium.js b/src/assets/javascripts/helpers/medium.js index 216fcf2..65afba5 100644 --- a/src/assets/javascripts/helpers/medium.js +++ b/src/assets/javascripts/helpers/medium.js @@ -2,18 +2,19 @@ import commonHelper from './common.js' const targets = [ - /^medium\.com/, - /.*\.medium\.com/, - // Other domains of medium blogs, source(s): https://findingtom.com/best-medium-blogs-to-follow/#1-forge - /towardsdatascience\.com/, - /uxdesign\.cc/, - /uxplanet\.org/, - /betterprogramming\.pub/, - /aninjusticemag\.com/, - /betterhumans\.pub/, - /psiloveyou\.xyz/, - /entrepreneurshandbook\.co/, - /blog\.coinbase\.com/ + /(?:.*\.)*(? rx.test(url.host)); + return targets.some((rx) => rx.test(url.href)); } async function init() { diff --git a/src/pages/background/background.js b/src/pages/background/background.js index e4c0188..7ed4c8e 100644 --- a/src/pages/background/background.js +++ b/src/pages/background/background.js @@ -49,7 +49,7 @@ browser.webRequest.onBeforeRequest.addListener( else if (redditHelper.isReddit(url)) newUrl = redditHelper.redirect(url, initiator, details.type); - else if (mediumHelper.isMedium(url)) newUrl = mediumHelper.redirect(url, initiator); + else if (mediumHelper.isMedium(url)) newUrl = mediumHelper.redirect(url, initiator, details.type); else if (translateHelper.isTranslate(url)) newUrl = translateHelper.redirect(url, initiator);