added filter for medium images

main
Lee Hanken 2022-02-01 10:04:03 +00:00
parent 9290e3c853
commit 86efeb7fee
1 changed files with 19 additions and 2 deletions

View File

@ -15,6 +15,15 @@ module.exports = {
/\*\*\[\^\]\(#cite_ref[^\)]+\)\*\*/g,
/(?:\\\[)?\[edit\]\([^\s]+\s+"[^"]+"\)(?:\\\])?/ig
]
},
{
domain: /(?:.*\.)?medium\.com/,
replace: [
{
find: '(https://miro.medium.com/max/60/',
replacement: '(https://miro.medium.com/max/600/'
}
]
}
],
@ -22,8 +31,16 @@ module.exports = {
let domain = urlparser.parse(url).hostname
for (let i=0;i<this.list.length;i++) {
if (domain.match(this.list[i].domain)) {
for (let j=0;j<this.list[i].remove.length; j++) {
data = data.replace(this.list[i].remove[j],"");
if (this.list[i].remove) {
for (let j=0;j<this.list[i].remove.length; j++) {
data = data.replaceAll(this.list[i].remove[j],"");
}
}
if (this.list[i].replace) {
for (let j=0;j<this.list[i].replace.length; j++) {
data = data.replaceAll(this.list[i].replace[j].find,
this.list[i].replace[j].replacement);
}
}
}
}