summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2021-03-11 17:14:39 +0100
committerFlorian Bruhin <me@the-compiler.org>2021-03-11 17:14:39 +0100
commitf54b76b0a49337b03978434808e438cb2cb6cb7b (patch)
tree07b31502616d510ff30b758b1c7f9a3090e8589b
parent8d267b6a2483d6f679a9a61bb3ee91c324cd3b69 (diff)
parent2abc3c585cdc63723a0423d3871a792439ef2d79 (diff)
downloadqutebrowser-f54b76b0a49337b03978434808e438cb2cb6cb7b.tar.gz
qutebrowser-f54b76b0a49337b03978434808e438cb2cb6cb7b.zip
Merge remote-tracking branch 'origin/pr/6241'
-rwxr-xr-xmisc/userscripts/readability-js12
1 files changed, 7 insertions, 5 deletions
diff --git a/misc/userscripts/readability-js b/misc/userscripts/readability-js
index 340e3bbb9..d9474aeb1 100755
--- a/misc/userscripts/readability-js
+++ b/misc/userscripts/readability-js
@@ -106,7 +106,12 @@ const HEADER = `
SAwLTIgMC44OTUtMiAyczAuODk1IDIgMiAyaDIwYzEuMTEgMCAyLTAuODk1IDItMnMtMC44OTUtMi0yLTJ6bTAgOGgtMjBjLTEuMTEgMC0yIDAuODk1LTIg
MnMwLjg5NSAyIDIgMmgyMGMxLjExIDAgMi0wLjg5NSAyLTJzLTAuODk1LTItMi0yem0tMTIgOGgtOGMtMS4xMSAwLTIgMC44OTUtMiAyczAuODk1IDIgMiA
yaDhjMS4xMSAwIDItMC44OTUgMi0ycy0wLjg5NS0yLTItMnoiIGZpbGw9IiNmZmYiLz4KPC9nPgo8L3N2Zz4K"/>
-</head>`;
+</head>
+<body class="qute-readability">
+ %s
+</body>
+</html>
+`;
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('<body>', '<body class="qute-readability">')
+ let content = util.format(HEADER, article.title, article.content);
fs.writeFile(tmpFile, content, (err) => {
if (err) {