userscripts/readability: add unique body class
Until per-domains stylesheets are implemented, there is no way to
apply style to the readability page only. With this patch, you can
just use the global setting `content.user_stylesheets` by writing
a more specific CSS selector. For example:
body.qute-readability {
font-family: Libertinus;
font-size: 1.2em;
text-align: justify;
}
will change the font and text alignment of the readability page,
without altering the style of other websites.
This commit is contained in:
parent
76b03db20e
commit
55fdae8eed
|
|
@ -57,6 +57,9 @@ with codecs.open(os.environ['QUTE_HTML'], 'r', 'utf-8') as source:
|
|||
title = doc.title()
|
||||
content = doc.summary().replace('<html>', HEADER % title)
|
||||
|
||||
# add a class to make styling the page easier
|
||||
content = content.replace('<body>', '<body class="qute-readability">')
|
||||
|
||||
with codecs.open(tmpfile, 'w', 'utf-8') as target:
|
||||
target.write(content.lstrip())
|
||||
|
||||
|
|
|
|||
|
|
@ -131,6 +131,9 @@ getDOM(target, domOpts).then(dom => {
|
|||
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">')
|
||||
|
||||
fs.writeFile(tmpFile, content, (err) => {
|
||||
if (err) {
|
||||
qute.messageError([`"${err}"`])
|
||||
|
|
|
|||
Loading…
Reference in New Issue