From 2abc3c585cdc63723a0423d3871a792439ef2d79 Mon Sep 17 00:00:00 2001 From: rnhmjoj Date: Mon, 8 Mar 2021 22:05:26 +0100 Subject: userscripts/readability-js: fixup of 55fdae8 The mozilla/readability library doesn't output a body by default. So, let's add one in the header and plug the result in. --- misc/userscripts/readability-js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/misc/userscripts/readability-js b/misc/userscripts/readability-js index 532df51c6..d286e570e 100755 --- a/misc/userscripts/readability-js +++ b/misc/userscripts/readability-js @@ -106,7 +106,12 @@ const HEADER = ` SAwLTIgMC44OTUtMiAyczAuODk1IDIgMiAyaDIwYzEuMTEgMCAyLTAuODk1IDItMnMtMC44OTUtMi0yLTJ6bTAgOGgtMjBjLTEuMTEgMC0yIDAuODk1LTIg MnMwLjg5NSAyIDIgMmgyMGMxLjExIDAgMi0wLjg5NSAyLTJzLTAuODk1LTItMi0yem0tMTIgOGgtOGMtMS4xMSAwLTIgMC44OTUtMiAyczAuODk1IDIgMiA yaDhjMS4xMSAwIDItMC44OTUgMi0ycy0wLjg5NS0yLTItMnoiIGZpbGw9IiNmZmYiLz4KPC9nPgo8L3N2Zz4K"/> -`; + + + %s + + +`; const scriptsDir = path.join(process.env.QUTE_DATA_DIR, 'userscripts'); const tmpFile = path.join(scriptsDir, '/readability.html'); @@ -129,10 +134,7 @@ else { getDOM(target, domOpts).then(dom => { let reader = new Readability(dom.window.document); let article = reader.parse(); - let content = util.format(HEADER, article.title) + article.content; - - // add a class to make styling the page easier - content = content.replace('', '') + let content = util.format(HEADER, article.title, article.content); fs.writeFile(tmpFile, content, (err) => { if (err) { -- cgit v1.2.3-54-g00ecf