npr_text_only: Fixed regular expression.

The regular expression was too specific, I made it more general.
This commit is contained in:
tastytea 2019-07-06 05:32:02 +02:00
parent cf030b1593
commit 0b617420d1
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
1 changed files with 3 additions and 3 deletions

View File

@ -2,7 +2,7 @@
// @name NPR text only // @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 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. // @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.1 // @version 2019.07.06.2
// @author tastytea // @author tastytea
// @copyright 2019, tastytea (https://tastytea.de/) // @copyright 2019, tastytea (https://tastytea.de/)
// @license GPL-3.0-only // @license GPL-3.0-only
@ -30,7 +30,7 @@ function main()
function redirect() function redirect()
{ {
const re = new RegExp('npr\.org/[0-9]{4}/[0-9]{2}/[0-9]{2}/([0-9]+)/'); const re = new RegExp('/[0-9]{4}/[0-9]{2}/[0-9]{2}/([0-9]+)/');
const result = re.exec(window.location.href); const result = re.exec(window.location.href);
if (result !== null && result.length > 1) if (result !== null && result.length > 1)
@ -39,7 +39,7 @@ function redirect()
} }
else else
{ {
console.error("Could not find sId."); console.warn("Could not find sId.");
} }
} }