From 19ef11ce991c3d001050c9724bd2b60cf565dae2 Mon Sep 17 00:00:00 2001 From: ManeraKai Date: Wed, 1 Feb 2023 12:22:15 +0300 Subject: [PATCH] Readded Neuters https://github.com/libredirect/libredirect/issues/604 . Tweaked localization code --- README.md | 1 + package.json | 2 +- src/assets/images/reuters-icon.svg | 267 +++++++++++++++++++++++++ src/assets/javascripts/services.js | 11 +- src/config.json | 21 +- src/pages/options/index.pug | 1 - src/pages/options/widgets/services.pug | 2 +- src/pages/widgets/links.pug | 2 +- src/pages/widgets/switches.pug | 2 +- 9 files changed, 302 insertions(+), 7 deletions(-) create mode 100644 src/assets/images/reuters-icon.svg diff --git a/README.md b/README.md index a4011e9..12166fb 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,7 @@ A web extension that redirects YouTube, Twitter, TikTok... requests to alternati - TikTok [ProxiTok](https://github.com/pablouser1/ProxiTok) - Reddit [Libreddit](https://github.com/spikecodes/libreddit#instances), [Teddit](https://codeberg.org/teddit/teddit#instances) - Imgur [Rimgo](https://codeberg.org/video-prize-ranch/rimgo) +- Reuters [Neuters](https://github.com/HookedBehemoth/neuters) - Medium [Scribe](https://sr.ht/~edwardloveall/Scribe/) - Quora [Quetre](https://github.com/zyachel/quetre) - IMDb [libremdb](https://github.com/zyachel/libremdb) diff --git a/package.json b/package.json index a35c3d4..5afbf16 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "npm": ">=8.1.2" }, "scripts": { - "start": "web-ext run --devtools", + "start": "web-ext run", "start_ar": "web-ext run --firefox=/home/esmail/Downloads/ar/firefox/firefox --pref font.language.group=ar", "build": "web-ext build", "test": "web-ext lint", diff --git a/src/assets/images/reuters-icon.svg b/src/assets/images/reuters-icon.svg new file mode 100644 index 0000000..0cc8a03 --- /dev/null +++ b/src/assets/images/reuters-icon.svg @@ -0,0 +1,267 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js index 322c801..9e73cce 100644 --- a/src/assets/javascripts/services.js +++ b/src/assets/javascripts/services.js @@ -383,7 +383,15 @@ function redirect(url, type, initiator, forceRedirection) { } return `${randomInstance}${url.pathname}${url.search}` default: - return `${randomInstance}${url.pathname}${url.search} ` + return `${randomInstance}${url.pathname}${url.search}` + case "neuters": { + const p = url.pathname + if (p.startsWith('/article/') || p.startsWith('/pf/') || p.startsWith('/arc/') || p.startsWith('/resizer/')) { + return null; + } + return `${randomInstance}${p}`; + } + } } @@ -519,6 +527,7 @@ function initDefaults() { options['facil'] = [' https://facilmap.org '] options['osm'] = ['https://www.openstreetmap.org'] options['breezeWiki'] = ['https://breezewiki.com'] + options['neuters'] = ['https://neuters.de'] browser.storage.local.set({ options }, diff --git a/src/config.json b/src/config.json index a1e88e8..d683079 100644 --- a/src/config.json +++ b/src/config.json @@ -446,7 +446,7 @@ "privateBin": { "name": "PrivateBin", "instanceList": true, - "url": "https://privatebin.info/" + "url": "https://privatebin.info" } }, "targets": [ @@ -459,6 +459,25 @@ "imageType": "svgMono", "embeddable": false, "url": "https://paste.libredirect.invalid" + }, + "reuters": { + "frontends": { + "neuters": { + "name": "Neuters", + "instanceList": true, + "url": "https://github.com/HookedBehemoth/neuters" + } + }, + "targets": [ + "^https?:\\/{2}(www\\.)?reuters.com\\/" + ], + "name": "Paste Text", + "options": { + "enabled": false + }, + "imageType": "svg", + "embeddable": false, + "url": "https://reuters.com" } } } \ No newline at end of file diff --git a/src/pages/options/index.pug b/src/pages/options/index.pug index 12b2d2f..4e19b08 100644 --- a/src/pages/options/index.pug +++ b/src/pages/options/index.pug @@ -6,6 +6,5 @@ html(id="elementToShowWithJavaScript" lang="en") div#pages include /src/pages/options/widgets/general include /src/pages/options/widgets/services - include /src/pages/options/widgets/about script(type="module" src="./index.js") \ No newline at end of file diff --git a/src/pages/options/widgets/services.pug b/src/pages/options/widgets/services.pug index 79d2053..257ffd7 100644 --- a/src/pages/options/widgets/services.pug +++ b/src/pages/options/widgets/services.pug @@ -2,7 +2,7 @@ each val, service in services section(class="option-block" id=service+"_page") div(class="some-block option-block") h1 - a(target="_blank" href=services[service].url data-localise=`__MSG_${service}__`)=services[service].name + a(target="_blank" href=services[service].url)=services[service].name hr diff --git a/src/pages/widgets/links.pug b/src/pages/widgets/links.pug index 2421a24..253177f 100644 --- a/src/pages/widgets/links.pug +++ b/src/pages/widgets/links.pug @@ -12,7 +12,7 @@ section(class="links" id="links") img(class='light' src=`/assets/images/${key}-icon-light.svg`) else img(src=`/assets/images/${key}-icon.${services[key].imageType}`) - span(data-localise="__MSG_"+key+"__")=services[key].name + span=services[key].name div(class="title") a(target="_blank" href="https://libredirect.github.io") diff --git a/src/pages/widgets/switches.pug b/src/pages/widgets/switches.pug index 2dfad67..580a25d 100644 --- a/src/pages/widgets/switches.pug +++ b/src/pages/widgets/switches.pug @@ -6,5 +6,5 @@ each val, service in services img(class='light' src=`/assets/images/${service}-icon-light.svg`) else img(src=`/assets/images/${service}-icon.${services[service].imageType}`) - h4(data-localise="__MSG_"+service+"__")=services[service].name + h4=services[service].name input(class=service + "-enabled" type="checkbox") \ No newline at end of file