Skip to content

Commit

Permalink
view: use aboutReaderContent.css from Firefox's reading mode
Browse files Browse the repository at this point in the history
see issue #77
  • Loading branch information
felipeborges committed Jul 29, 2015
1 parent b1de49f commit b6533ea
Show file tree
Hide file tree
Showing 3 changed files with 118 additions and 0 deletions.
113 changes: 113 additions & 0 deletions data/aboutReaderContent.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */

#moz-reader-content {
display: none;
font-size: 1em;
line-height: 1.6em;
}

h1,
h2,
h3 {
font-weight: bold;
}

h1 {
font-size: 1.6em;
line-height: 1.25em;
}

h2 {
font-size: 1.2em;
line-height: 1.51em;
}

h3 {
font-size: 1em;
line-height: 1.66em;
}

a {
text-decoration: underline;
font-weight: normal;
}

a,
a:visited,
a:hover,
a:active {
color: #0095dd;
}

* {
max-width: 100%;
height: auto;
}

p,
code,
pre,
blockquote,
ul,
ol,
li,
figure,
.wp-caption {
margin: 0 0 30px 0;
}

p > img:only-child,
p > a:only-child > img:only-child,
.wp-caption img,
figure img {
display: block;
}

img[moz-reader-center] {
margin-left: auto;
margin-right: auto;
}

.caption,
.wp-caption-text,
figcaption {
font-size: 0.9em;
line-height: 1.48em;
font-style: italic;
}

code,
pre {
white-space: pre-wrap;
}

blockquote {
padding: 0;
-moz-padding-start: 16px;
}

ul,
ol {
padding: 0;
}

ul {
-moz-padding-start: 30px;
list-style: disc;
}

ol {
-moz-padding-start: 30px;
list-style: decimal;
}

/* Hide elements with common "hidden" class names */
.visually-hidden,
.visuallyhidden,
.hidden,
.invisible,
.sr-only {
display: none;
}
1 change: 1 addition & 0 deletions data/gnome-news.gresource.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
<file compressed="true" preprocess="xml-stripblanks">Menu.ui</file>
<file compressed="true" preprocess="xml-stripblanks">HeaderBar.ui</file>
<file compressed="true">application.css</file>
<file compressed="true">aboutReaderContent.css</file>
</gresource>
</gresources>
4 changes: 4 additions & 0 deletions gnomenews/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,14 @@ class FeedView(Gtk.Stack):
def __init__(self, tracker, post):
Gtk.Stack.__init__(self,
transition_type=Gtk.StackTransitionType.CROSSFADE)
stylesheet = Gio.File.new_for_uri('resource:///org/gnome/News/aboutReaderContent.css')
webview = WebKit2.WebView()
if post.content:
html = """
<style>
"""
html += stylesheet.load_contents(None)[1].decode()
html += """
* {
max-width: 100%%;
height: auto;
Expand Down

0 comments on commit b6533ea

Please sign in to comment.