summaryrefslogtreecommitdiff
path: root/backend.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2005-09-05 13:07:57 +0100
committerAndrew Dolgov <[email protected]>2005-09-05 13:07:57 +0100
commit6113ef7d22096e2a71a57c34483957ac7fe26205 (patch)
treed34829d08a326780127ef8dc7d83081db6e58fce /backend.php
parentf0601b870ceb69b5e29493eac6ad0111e60a8ac4 (diff)
update unread/total/etc counters for selected feed on viewfeed iframe load
Diffstat (limited to 'backend.php')
-rw-r--r--backend.php24
1 files changed, 19 insertions, 5 deletions
diff --git a/backend.php b/backend.php
index 325c367eb..a2236c3a6 100644
--- a/backend.php
+++ b/backend.php
@@ -274,8 +274,8 @@
$line = pg_fetch_assoc($result);
- if ($subop == "ForceUpdate") {
-// (!$subop && $line["update_timeout"] > MIN_UPDATE_TIME)) {
+ if ($subop == "ForceUpdate" ||
+ (!$subop && $line["update_timeout"] > MIN_UPDATE_TIME)) {
update_rss_feed($link, $line["feed_url"], $feed);
@@ -482,9 +482,23 @@
$total = pg_fetch_result($result, 0, "total");
$unread = pg_fetch_result($result, 0, "unread");
- print "<div class=\"invisible\" id=\"FACTIVE\">$feed</div>";
- print "<div class=\"invisible\" id=\"FTOTAL\">$total</div>";
- print "<div class=\"invisible\" id=\"FUNREAD\">$unread</div>";
+ // update unread/total counters and status for active feed in the feedlist
+ // kludge, because iframe doesn't seem to support onload()
+
+ print "<script type=\"text/javascript\">
+ var feedr = parent.document.getElementById(\"FEEDR-\" + $feed);
+ var feedt = parent.document.getElementById(\"FEEDT-\" + $feed);
+ var feedu = parent.document.getElementById(\"FEEDU-\" + $feed);
+
+ feedt.innerHTML = \"$total\";
+ feedu.innerHTML = \"$unread\";
+
+ if ($unread > 0 && !feedr.className.match(\"Unread\")) {
+ feedr.className = feedr.className + \"Unread\";
+ } else if ($unread <= 0) {
+ feedr.className = feedr.className.replace(\"Unread\", \"\");
+ }
+ </script>";
if ($addheader) {
print "</body></html>";