summaryrefslogtreecommitdiff
path: root/viewfeed.js
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2007-08-09 08:36:04 +0100
committerAndrew Dolgov <[email protected]>2007-08-09 08:36:04 +0100
commitac541432000c24fee20cf0e0ce0881aa6437455a (patch)
treee2c45aface714fc5929348dd2fdde79614e1aed5 /viewfeed.js
parente4914b62755d3dddc42cd3d6a283978338800f57 (diff)
infinite scrolling
Diffstat (limited to 'viewfeed.js')
-rw-r--r--viewfeed.js49
1 files changed, 44 insertions, 5 deletions
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);
+ }
+}