summaryrefslogtreecommitdiff
path: root/offline.js
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2009-02-04 14:33:43 +0300
committerAndrew Dolgov <[email protected]>2009-02-04 14:33:43 +0300
commite491d06df4f9a18020682aa81c0051cc4a8f18a3 (patch)
treef9b9eaba8bca39587e2991529f2e3af1952f694b /offline.js
parent12aa4007ad590ed0215b595dcd82402ef9bbe0cf (diff)
offline: implement infinite scrolling
Diffstat (limited to 'offline.js')
-rw-r--r--offline.js20
1 files changed, 14 insertions, 6 deletions
diff --git a/offline.js b/offline.js
index 089a96f84..268369e21 100644
--- a/offline.js
+++ b/offline.js
@@ -99,8 +99,6 @@ function viewfeed_offline(feed_id, subop, is_cat, subop_param, skip_history, off
} catch (e) { };
- var container = document.getElementById("headlines-frame");
-
var tmp = "";
rs = db.execute("SELECT title FROM feeds WHERE id = ?", [feed_id]);
@@ -156,6 +154,7 @@ function viewfeed_offline(feed_id, subop, is_cat, subop_param, skip_history, off
var limit_qpart = "";
var strategy_qpart = "";
var mode_qpart = "";
+ var offset_qpart = "";
if (limit != 0) {
limit_qpart = "LIMIT " + limit;
@@ -183,17 +182,24 @@ function viewfeed_offline(feed_id, subop, is_cat, subop_param, skip_history, off
strategy_qpart = "marked = 1";
} else if (feed_id == -4) {
strategy_qpart = "1";
- }
+ }
+
+ if (offset > 0) {
+ offset_qpart = "OFFSET " + (offset*30);
+ } else {
+ offset_qpart = "";
+ }
var query = "SELECT * FROM articles WHERE " +
strategy_qpart +
" AND " + mode_qpart +
" ORDER BY updated DESC "+
- limit_qpart;
+ limit_qpart + " " +
+ offset_qpart;
var rs = db.execute(query);
- var line_num = 0;
+ var line_num = offset*30;
while (rs.isValidRow()) {
@@ -264,11 +270,13 @@ function viewfeed_offline(feed_id, subop, is_cat, subop_param, skip_history, off
}
if (offset == 0) {
+ var container = document.getElementById("headlines-frame");
container.innerHTML = tmp;
} else {
var ids = getSelectedArticleIds2();
- //container.innerHTML = container.innerHTML + tmp;
+ var container = document.getElementById("headlinesList");
+ container.innerHTML = container.innerHTML + tmp;
for (var i = 0; i < ids.length; i++) {
markHeadline(ids[i]);