From 4ffa126ec3a9cbe06c7bec710f04da47476ed8ad Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sat, 25 Aug 2007 08:38:18 +0100 Subject: [PATCH] update title of active feed in feedlist on the fly --- backend.php | 2 +- functions.js | 7 ++++++- functions.php | 14 ++++++++++---- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/backend.php b/backend.php index 77323008f..272daeb32 100644 --- a/backend.php +++ b/backend.php @@ -244,7 +244,7 @@ if ($_GET["debug"]) $timing_info = print_checkpoint("20", $timing_info); print ""; - getAllCounters($link, $omode); + getAllCounters($link, $omode, $feed); print ""; if ($_GET["debug"]) $timing_info = print_checkpoint("30", $timing_info); diff --git a/functions.js b/functions.js index 1c42df9ff..5414e2bb8 100644 --- a/functions.js +++ b/functions.js @@ -596,7 +596,8 @@ function parse_counters(reply, scheduled_call) { var error = elems[l].getAttribute("error"); var has_img = elems[l].getAttribute("hi"); var updated = elems[l].getAttribute("updated"); - + var title = elems[l].getAttribute("title"); + if (id == "global-unread") { global_unread = ctr; updateTitle(); @@ -650,6 +651,10 @@ function parse_counters(reply, scheduled_call) { } } + if (feedlink && title) { + feedlink.innerHTML = title; + } + if (feedctr && feedu && feedr) { if (feedu.innerHTML != ctr && id == getActiveFeedId() && scheduled_call) { diff --git a/functions.php b/functions.php index d12120a63..2aac7f3db 100644 --- a/functions.php +++ b/functions.php @@ -1866,7 +1866,7 @@ } } - function getAllCounters($link, $omode = "flc") { + function getAllCounters($link, $omode = "flc", $active_feed = false) { /* getLabelCounters($link); getFeedCounters($link); getTagCounters($link); @@ -1880,7 +1880,7 @@ getGlobalCounters($link); if (strchr($omode, "l")) getLabelCounters($link); - if (strchr($omode, "f")) getFeedCounters($link); + if (strchr($omode, "f")) getFeedCounters($link, SMART_RPC_COUNTERS, $active_feed); if (strchr($omode, "t")) getTagCounters($link); if (strchr($omode, "c")) { if (get_pref($link, 'ENABLE_FEED_CATS')) { @@ -2268,7 +2268,7 @@ print ""; } */ - function getFeedCounters($link, $smart_mode = SMART_RPC_COUNTERS) { + function getFeedCounters($link, $smart_mode = SMART_RPC_COUNTERS, $active_feed = false) { $age_qpart = getMaxAgeSubquery(); @@ -2355,7 +2355,13 @@ $has_img_part = ""; } - print ""; + if ($active_feed && $id == $active_feed) { + $has_title_part = "title=\"" . htmlspecialchars($line["title"]) . "\""; + } else { + $has_title_part = ""; + } + + print ""; } }