Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/jangernert/FeedReader.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBilal Elmoussaoui <bil.elmoussaoui@gmail.com>2017-10-23 19:25:12 +0300
committerBilal Elmoussaoui <bil.elmoussaoui@gmail.com>2017-10-23 19:25:12 +0300
commit6bb6fac40f4de8764578a987359cf67d22d17094 (patch)
treea49992214029d82b7c5ad5b5aba1e003d226068c
parent41002698026dafd5319633082006e310d12c64cd (diff)
fix themes loading, add pre/code tags theming, fix img width & heightthemes
-rw-r--r--data/ArticleView/default/style.css4
-rw-r--r--data/ArticleView/midnight/style.css93
-rw-r--r--src/Utils.vala61
3 files changed, 83 insertions, 75 deletions
diff --git a/data/ArticleView/default/style.css b/data/ArticleView/default/style.css
index 36792b8b..7eb84a5e 100644
--- a/data/ArticleView/default/style.css
+++ b/data/ArticleView/default/style.css
@@ -25,7 +25,9 @@ body{
font-family: Arial, Helvetica, sans-serif;
}
img {
- width: 100%;
+ max-width: 100%;
+ height: auto;
+ width: auto;
}
p {
diff --git a/data/ArticleView/midnight/style.css b/data/ArticleView/midnight/style.css
index e8f35dc6..a0f0d0af 100644
--- a/data/ArticleView/midnight/style.css
+++ b/data/ArticleView/midnight/style.css
@@ -1,68 +1,87 @@
-html, body {
- margin: 0;
- padding: 0;
- width: auto;
+html,
+body {
+ margin: 0;
+ padding: 0;
+ width: auto;
}
-a, body {
-color: #ECECEC;
+a,
+body {
+ color: #ECECEC;
+}
+
+img {
+ max-width: 100%;
+ height: auto;
+ width: auto;
+}
+
+pre,
+code {
+ background-color: #D7DDE8;
+ padding: 3px;
+ color: #2E3440;
+ font-family: monospace;
+ display: inline-block;
+ margin: 3px;
+}
+
+pre {
+ width: 100%;
}
.unselectable {
- -webkit-user-select: none;
- -webkit-touch-callout: none;
- -webkit-user-drag: none;
- user-select: none;
+ -webkit-user-select: none;
+ -webkit-touch-callout: none;
+ -webkit-user-drag: none;
+ user-select: none;
}
a {
- text-decoration: none;
+ text-decoration: none;
}
a:hover {
- opacity:0.7;
+ opacity: 0.7;
}
-body{
- font-family: Arial, Helvetica, sans-serif;
- background-color: #2E3440;
-}
-
-img {
- width: 100%;
+body {
+ font-family: Arial, Helvetica, sans-serif;
+ background-color: #2E3440;
}
p {
- text-align: justify;
+ text-align: justify;
}
#feedreader-container {
- margin: 10px;
- padding: 20px;
+ margin: 10px;
+ padding: 20px;
}
+
#feedreader-container article header {
- font-family: LyonText,Georgia,serif;
- margin-bottom: 50px;
+ font-family: LyonText, Georgia, serif;
+ margin-bottom: 50px;
}
#feedreader-container article header #title {
- font-size: 3em;
- font-weight: 400;
- line-height: 1.3em;
- margin-bottom: 5px;
- margin-top: 0;
+ font-size: 3em;
+ font-weight: 400;
+ line-height: 1.3em;
+ margin-bottom: 5px;
+ margin-top: 0;
}
#feedreader-container article header #author {
- font-size: 1.1em;
- font-weight: 400;
- line-height: 0.8em;
- margin-bottom: 5px;
- margin-top: 0;
- color: #AFAFAF;
+ font-size: 1.1em;
+ font-weight: 400;
+ line-height: 0.8em;
+ margin-bottom: 5px;
+ margin-top: 0;
+ color: #AFAFAF;
}
-
#feedreader-container article #content {
- margin: 5px;
+ margin: 5px;
}
+
diff --git a/src/Utils.vala b/src/Utils.vala
index bbb633eb..4ca1b994 100644
--- a/src/Utils.vala
+++ b/src/Utils.vala
@@ -595,18 +595,10 @@ public class FeedReader.Utils : GLib.Object {
public static string buildArticle(string html, string title, string url, string? author, string date, string feedID)
{
- var article = new GLib.StringBuilder();
string theme = Settings.general().get_string("article-theme");
- string author_date = "";
- if(author != null)
- author_date += _("posted by: %s, ").printf(author);
-
- author_date += date;
-
string template = "";
string css = "";
-
try
{
if (!ArticleTheme.exists(theme)) {
@@ -628,19 +620,6 @@ public class FeedReader.Utils : GLib.Object {
Logger.error("Utils.buildArticle: %s".printf(e.message));
}
- string select_id = "$UNSELECTABLE";
- int select_pos = article.str.index_of(select_id);
-
- if(Settings.tweaks().get_boolean("article-select-text"))
- {
- article.erase(select_pos-1, select_id.length+1);
- }
- else
- {
- article.erase(select_pos, select_id.length);
- article.insert(select_pos, "unselectable");
- }
-
// Calculate the Large and Small font sizes
string font = Settings.general().get_string("font");
var desc = Pango.FontDescription.from_string(font);
@@ -650,23 +629,31 @@ public class FeedReader.Utils : GLib.Object {
string large_size = (fontsize * 2).to_string();
string normal_size = fontsize.to_string();
- string article_content = article.str;
-
- article_content.replace("$HTML", html);
- article_content.replace("$AUTHOR", author_date);
- article_content.replace("$TITLE", title);
- article_content.replace("$URL", url);
- article_content.replace("$FEED", DataBase.readOnly().read_feed(feedID).getTitle());
- article_content.replace("$FONTFAMILY", fontfamilly);
- article_content.replace("$SMALLSIZE", normal_size);
- article_content.replace("$LARGESIZE", large_size);
- article_content.replace("$FONTSIZE", small_size);
- article_content.replace("$CSS", css);
-
- // Replace article content with the correct one
- article.assign(article_content);
+ if (author != null) {
+ template = template.replace("$AUTHOR", author);
+ } else {
+ template = template.replace("$AUTHOR", _("Unknown"));
+ }
+ template = template.replace("$HTML", html);
+ template = template.replace("$DATE", date);
+ template = template.replace("$TITLE", title);
+ template = template.replace("$URL", url);
+ template = template.replace("$FEED", DataBase.readOnly().read_feed(feedID).getTitle());
+ template = template.replace("$FONTFAMILY", fontfamilly);
+ template = template.replace("$SMALLSIZE", normal_size);
+ template = template.replace("$LARGESIZE", large_size);
+ template = template.replace("$FONTSIZE", small_size);
+ template = template.replace("$CSS", css);
- return article.str;
+ if(Settings.tweaks().get_boolean("article-select-text"))
+ {
+ template = template.replace("$UNSELECTABLE", "");
+ }
+ else
+ {
+ template = template.replace("$UNSELECTABLE", "unselectable");
+ }
+ return template;
}
public static bool canManipulateContent(bool? online = null)