diff options
author | rien333 <rien334@gmail.com> | 2021-03-11 19:24:27 +0100 |
---|---|---|
committer | rien333 <rien334@gmail.com> | 2021-03-11 19:24:27 +0100 |
commit | 41dbe04fe3a3c25e656b265c55ca6f280067c1a4 (patch) | |
tree | 8139d518e5fcfea4f8129d27253dd5ba8f52b35c /misc | |
parent | 40054ac944a988e02ca8f3de414581f1e77688d8 (diff) | |
download | qutebrowser-41dbe04fe3a3c25e656b265c55ca6f280067c1a4.tar.gz qutebrowser-41dbe04fe3a3c25e656b265c55ca6f280067c1a4.zip |
[readability-js] Add article metadata on top of the page
Diffstat (limited to 'misc')
-rwxr-xr-x | misc/userscripts/readability-js | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/misc/userscripts/readability-js b/misc/userscripts/readability-js index d9474aeb1..ab907ee9a 100755 --- a/misc/userscripts/readability-js +++ b/misc/userscripts/readability-js @@ -52,6 +52,15 @@ const HEADER = ` h1, h2, h3 { line-height: 1.2; } + h1.reader-title { + font-size: 1.85em; + line-height: 1.25em; + width: 100%; + margin: 0 0; + } + a.reader-title { + color: #FFFFFF !important; + } img { max-width:100%; height:auto; @@ -108,6 +117,9 @@ const HEADER = ` yaDhjMS4xMSAwIDItMC44OTUgMi0ycy0wLjg5NS0yLTItMnoiIGZpbGw9IiNmZmYiLz4KPC9nPgo8L3N2Zz4K"/> </head> <body class="qute-readability"> + <h1 class="reader-title">%s</h1> + <div>From <a class="reader-title" href=%s>%s</a></div> + <hr> %s </body> </html> @@ -134,7 +146,8 @@ 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); + let subtitle = (article.siteName == null) ? new URL(process.env.QUTE_URL).hostname : article.siteName; + let content = util.format(HEADER, article.title, article.title, process.env.QUTE_URL, subtitle, article.content); fs.writeFile(tmpFile, content, (err) => { if (err) { |