update unread/total/etc counters for selected feed on viewfeed iframe load
This commit is contained in:
parent
f0601b870c
commit
6113ef7d22
24
backend.php
24
backend.php
|
@ -274,8 +274,8 @@
|
||||||
|
|
||||||
$line = pg_fetch_assoc($result);
|
$line = pg_fetch_assoc($result);
|
||||||
|
|
||||||
if ($subop == "ForceUpdate") {
|
if ($subop == "ForceUpdate" ||
|
||||||
// (!$subop && $line["update_timeout"] > MIN_UPDATE_TIME)) {
|
(!$subop && $line["update_timeout"] > MIN_UPDATE_TIME)) {
|
||||||
|
|
||||||
update_rss_feed($link, $line["feed_url"], $feed);
|
update_rss_feed($link, $line["feed_url"], $feed);
|
||||||
|
|
||||||
|
@ -482,9 +482,23 @@
|
||||||
$total = pg_fetch_result($result, 0, "total");
|
$total = pg_fetch_result($result, 0, "total");
|
||||||
$unread = pg_fetch_result($result, 0, "unread");
|
$unread = pg_fetch_result($result, 0, "unread");
|
||||||
|
|
||||||
print "<div class=\"invisible\" id=\"FACTIVE\">$feed</div>";
|
// update unread/total counters and status for active feed in the feedlist
|
||||||
print "<div class=\"invisible\" id=\"FTOTAL\">$total</div>";
|
// kludge, because iframe doesn't seem to support onload()
|
||||||
print "<div class=\"invisible\" id=\"FUNREAD\">$unread</div>";
|
|
||||||
|
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) {
|
if ($addheader) {
|
||||||
print "</body></html>";
|
print "</body></html>";
|
||||||
|
|
Loading…
Reference in New Issue