summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--feedlist.js28
-rw-r--r--functions.php37
-rw-r--r--viewfeed.js49
3 files changed, 91 insertions, 23 deletions
diff --git a/feedlist.js b/feedlist.js
index ac852e9e9..66b040f9f 100644
--- a/feedlist.js
+++ b/feedlist.js
@@ -1,5 +1,7 @@
//var xmlhttp = Ajax.getTransport();
+var feed_cur_page = 0;
+
function viewCategory(cat) {
active_feed_is_cat = true;
viewfeed(cat, '', true);
@@ -35,13 +37,35 @@ function viewFeedGoPage(i) {
}
}
+
+function viewNextFeedPage() {
+ try {
+ if (!getActiveFeedId()) return;
+
+ feed_cur_page++;
+
+ viewfeed(getActiveFeedId(), undefined, undefined, undefined,
+ undefined, feed_cur_page);
+
+ } catch (e) {
+ exception_error(e, "viewFeedGoPage");
+ }
+}
+
function viewfeed(feed, subop, is_cat, subop_param, skip_history, offset) {
try {
- //if (!offset) page_offset = 0;
+// if (!offset) page_offset = 0;
- if (offset != undefined) {
+ if (offset > 0) {
page_offset = offset;
+ } else {
+ page_offset = 0;
+ feed_cur_page = 0;
+ }
+
+ if (getActiveFeedId() != feed) {
+ feed_cur_page = 0;
}
enableHotkeys();
diff --git a/functions.php b/functions.php
index 3bf2a0b7d..7ca93956d 100644
--- a/functions.php
+++ b/functions.php
@@ -3693,7 +3693,9 @@
$topmost_article_ids = array();
- if (!$offset) $offset = 0;
+ if (!$offset) {
+ $offset = 0;
+ }
if ($subop == "undefined") $subop = "";
@@ -3777,24 +3779,26 @@
/// STOP //////////////////////////////////////////////////////////////////////////////////
- print "<div id=\"headlinesContainer\" $rtl_tag>";
+ if (!$offset) {
+ print "<div id=\"headlinesContainer\" $rtl_tag>";
- if (!$result) {
- print "<div align='center'>".__("Could not display feed (query failed). Please check label match syntax or local configuration.")."</div>";
- return;
- }
+ if (!$result) {
+ print "<div align='center'>".__("Could not display feed (query failed). Please check label match syntax or local configuration.")."</div>";
+ return;
+ }
- print_headline_subtoolbar($link, $feed_site_url, $feed_title, false,
- $rtl_content, $feed, $cat_view, $search, $match_on, $search_mode,
- $offset, $limit);
+ print_headline_subtoolbar($link, $feed_site_url, $feed_title, false,
+ $rtl_content, $feed, $cat_view, $search, $match_on, $search_mode,
+ $offset, $limit);
- print "<div id=\"headlinesInnerContainer\">";
+ print "<div id=\"headlinesInnerContainer\" onscroll=\"headlines_scroll_handler()\">";
+ }
if (db_num_rows($result) > 0) {
# print "\{$offset}";
- if (!get_pref($link, 'COMBINED_DISPLAY_MODE')) {
+ if (!get_pref($link, 'COMBINED_DISPLAY_MODE') && !$offset) {
print "<table class=\"headlinesList\" id=\"headlinesList\"
cellspacing=\"0\">";
}
@@ -3975,7 +3979,7 @@
++$lnum;
}
- if (!get_pref($link, 'COMBINED_DISPLAY_MODE')) {
+ if (!get_pref($link, 'COMBINED_DISPLAY_MODE') && !$offset) {
print "</table>";
}
@@ -3984,12 +3988,13 @@
} else {
- print "<div class='whiteBox'>".__('No articles found.')."</div>";
+ if (!$offset) print "<div class='whiteBox'>".__('No articles found.')."</div>";
}
- print "</div>";
-
- print "</div>";
+ if (!$offset) {
+ print "</div>";
+ print "</div>";
+ }
return $topmost_article_ids;
}
diff --git a/viewfeed.js b/viewfeed.js
index 1a3d775ff..e464f2198 100644
--- a/viewfeed.js
+++ b/viewfeed.js
@@ -38,7 +38,10 @@ function headlines_callback() {
debug("headlines_callback");
var f = document.getElementById("headlines-frame");
try {
- f.scrollTop = 0;
+ if (feed_cur_page == 0) {
+ debug("resetting headlines scrollTop");
+ f.scrollTop = 0;
+ }
} catch (e) { };
if (xmlhttp.responseXML) {
@@ -47,11 +50,29 @@ function headlines_callback() {
var articles = xmlhttp.responseXML.getElementsByTagName("article");
var runtime_info = xmlhttp.responseXML.getElementsByTagName("runtime-info");
- if (headlines) {
- f.innerHTML = headlines.firstChild.nodeValue;
+ if (feed_cur_page == 0) {
+ if (headlines) {
+ f.innerHTML = headlines.firstChild.nodeValue;
+ } else {
+ debug("headlines_callback: returned no data");
+ f.innerHTML = "<div class='whiteBox'>" + __('Could not update headlines (missing XML data)') + "</div>";
+
+ }
} else {
- debug("headlines_callback: returned no data");
- f.innerHTML = "<div class='whiteBox'>" + __('Could not update headlines (missing XML data)') + "</div>";
+ if (headlines) {
+ debug("adding some more headlines...");
+
+ var c = document.getElementById("headlinesList");
+
+ if (!c) {
+ c = document.getElementById("headlinesInnerContainer");
+ }
+
+ c.innerHTML = c.innerHTML + headlines.firstChild.nodeValue;
+ } else {
+ debug("headlines_callback: returned no data");
+ notify_error("Error while trying to load more headlines");
+ }
}
@@ -103,6 +124,8 @@ function headlines_callback() {
try {
document.getElementById("headlinesInnerContainer").scrollTop = _tag_cdm_scroll;
_tag_cdm_scroll = false;
+ debug("resetting headlinesInner scrollTop");
+
} catch (e) { }
}
@@ -937,3 +960,19 @@ function cdmMouseIn(elem) {
function cdmMouseOut(elem) {
active_post_id = false;
}
+
+function headlines_scroll_handler() {
+ try {
+
+ var e = document.getElementById("headlinesInnerContainer");
+
+ if (e.scrollTop + e.offsetHeight == e.scrollHeight) {
+ debug("more cowbell!");
+
+ viewNextFeedPage();
+ }
+
+ } catch (e) {
+ exception_error("headlines_scroll_handler", e);
+ }
+}