From 86076ad7f0ea9a1d31a7c34f1bcb4699ecf13811 Mon Sep 17 00:00:00 2001 From: tastytea Date: Sun, 14 Jun 2020 18:32:09 +0200 Subject: [PATCH] npr_text_only: Support transcripts. --- news/npr_text_only.user.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/news/npr_text_only.user.js b/news/npr_text_only.user.js index b906247..cb43d40 100644 --- a/news/npr_text_only.user.js +++ b/news/npr_text_only.user.js @@ -2,9 +2,9 @@ // @name NPR text only // @description Redirects to the privacy respecting, text-only version of articles on npr.org and limits the text-width to 80 characters. // @description:de Leitet auf die datenschutzfreundliche, nur-text version von artikeln auf npr.org weiter und beschränkt die text-breite auf 80 zeichen. -// @version 2019.07.06.2 +// @version 2020.06.14.1 // @author tastytea -// @copyright 2019, tastytea (https://tastytea.de/) +// @copyright 2019-2020, tastytea (https://tastytea.de/) // @license GPL-3.0-only // @namespace tastytea.de // @homepageURL https://schlomp.space/tastytea/userscripts @@ -30,8 +30,14 @@ function main() function redirect() { - const re = new RegExp('/[0-9]{4}/[0-9]{2}/[0-9]{2}/([0-9]+)/'); - const result = re.exec(window.location.href); + const re_date = new RegExp('/[0-9]{4}/[0-9]{2}/[0-9]{2}/([0-9]+)/'); + const re_transcript = new RegExp('/transcripts/([0-9]+)$'); + let result = re_date.exec(window.location.href); + + if (result === null) + { + result = re_transcript.exec(window.location.href); + } if (result !== null && result.length > 1) {