summaryrefslogtreecommitdiff
path: root/offline.js
diff options
context:
space:
mode:
Diffstat (limited to 'offline.js')
-rw-r--r--offline.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/offline.js b/offline.js
index 371aeecf0..58c2377c2 100644
--- a/offline.js
+++ b/offline.js
@@ -490,3 +490,28 @@ function update_local_feedlist_counters() {
exception_error("update_local_feedlist_counters", e);
}
}
+
+function get_local_feed_unread(id) {
+ try {
+ var rs;
+
+ if (id == -4) {
+ rs = db.execute("SELECT SUM(unread) FROM articles");
+ } else if (id == -1) {
+ rs = db.execute("SELECT SUM(unread) FROM articles WHERE marked = 1");
+ } else {
+ rs = db.execute("SELECT SUM(unread) FROM articles WHERE feed_id = ?", [id]);
+ }
+
+ if (rs.isValidRow()) {
+ return rs.field(0);
+ } else {
+ return 0;
+ }
+
+ } catch (e) {
+ exception_error("get_local_feed_unread", e);
+ }
+}
+
+