Added the same regex as in the faq page in scribe #19
This commit is contained in:
parent
352c9127a6
commit
343ab3bbc0
|
@ -2,18 +2,19 @@ import commonHelper from './common.js'
|
||||||
|
|
||||||
|
|
||||||
const targets = [
|
const targets = [
|
||||||
/^medium\.com/,
|
/(?:.*\.)*(?<!(link\.|cdn\-images\-\d+\.))medium\.com(\/.*)?$/,
|
||||||
/.*\.medium\.com/,
|
// /^medium\.com/,
|
||||||
// Other domains of medium blogs, source(s): https://findingtom.com/best-medium-blogs-to-follow/#1-forge
|
// /.*\.medium\.com/,
|
||||||
/towardsdatascience\.com/,
|
// // Other domains of medium blogs, source(s): https://findingtom.com/best-medium-blogs-to-follow/#1-forge
|
||||||
/uxdesign\.cc/,
|
// /towardsdatascience\.com/,
|
||||||
/uxplanet\.org/,
|
// /uxdesign\.cc/,
|
||||||
/betterprogramming\.pub/,
|
// /uxplanet\.org/,
|
||||||
/aninjusticemag\.com/,
|
// /betterprogramming\.pub/,
|
||||||
/betterhumans\.pub/,
|
// /aninjusticemag\.com/,
|
||||||
/psiloveyou\.xyz/,
|
// /betterhumans\.pub/,
|
||||||
/entrepreneurshandbook\.co/,
|
// /psiloveyou\.xyz/,
|
||||||
/blog\.coinbase\.com/
|
// /entrepreneurshandbook\.co/,
|
||||||
|
// /blog\.coinbase\.com/
|
||||||
];
|
];
|
||||||
|
|
||||||
let redirects = {
|
let redirects = {
|
||||||
|
@ -64,11 +65,13 @@ function setDisableMedium(val) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function redirect(url, initiator) {
|
function redirect(url, initiator, type) {
|
||||||
if (disableMedium) return null;
|
if (disableMedium) return null;
|
||||||
|
|
||||||
if (url.pathname == "/") return null;
|
if (url.pathname == "/") return null;
|
||||||
|
|
||||||
|
if (type != "main_frame" && "sub_frame" && "xmlhttprequest" && "other")
|
||||||
|
return null;
|
||||||
|
|
||||||
let instancesList = [...scribeRedirectsChecks, ...scribeCustomRedirects];
|
let instancesList = [...scribeRedirectsChecks, ...scribeCustomRedirects];
|
||||||
if (instancesList.length === 0) return null;
|
if (instancesList.length === 0) return null;
|
||||||
|
@ -85,7 +88,7 @@ function redirect(url, initiator) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function isMedium(url) {
|
function isMedium(url) {
|
||||||
return targets.some((rx) => rx.test(url.host));
|
return targets.some((rx) => rx.test(url.href));
|
||||||
}
|
}
|
||||||
|
|
||||||
async function init() {
|
async function init() {
|
||||||
|
|
|
@ -49,7 +49,7 @@ browser.webRequest.onBeforeRequest.addListener(
|
||||||
|
|
||||||
else if (redditHelper.isReddit(url)) newUrl = redditHelper.redirect(url, initiator, details.type);
|
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);
|
else if (translateHelper.isTranslate(url)) newUrl = translateHelper.redirect(url, initiator);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue