pass object to call updateTitle() to parse_counters() (closes #9)

This commit is contained in:
Andrew Dolgov 2005-12-21 08:12:17 +01:00
parent 8983d99556
commit 3bdb368b87
2 changed files with 8 additions and 5 deletions

View File

@ -355,7 +355,7 @@ if (!xmlhttp_rpc && typeof XMLHttpRequest!='undefined') {
xmlhttp_rpc = new XMLHttpRequest(); xmlhttp_rpc = new XMLHttpRequest();
} }
function parse_counters(reply, f_document) { function parse_counters(reply, f_document, title_obj) {
try { try {
for (var l = 0; l < reply.childNodes.length; l++) { for (var l = 0; l < reply.childNodes.length; l++) {
var id = reply.childNodes[l].getAttribute("id"); var id = reply.childNodes[l].getAttribute("id");
@ -365,8 +365,8 @@ function parse_counters(reply, f_document) {
var has_img = reply.childNodes[l].getAttribute("hi"); var has_img = reply.childNodes[l].getAttribute("hi");
if (id == "global-unread") { if (id == "global-unread") {
parent.global_unread = ctr; title_obj.global_unread = ctr;
parent.updateTitle(); title_obj.updateTitle();
continue; continue;
} }
@ -419,6 +419,9 @@ function parse_counters(reply, f_document) {
} }
} }
// this one is called from feedlist context
// thus title_obj passed to parse_counters is parent (e.g. main ttrss window)
function all_counters_callback() { function all_counters_callback() {
if (xmlhttp_rpc.readyState == 4) { if (xmlhttp_rpc.readyState == 4) {
try { try {
@ -430,7 +433,7 @@ function all_counters_callback() {
var reply = xmlhttp_rpc.responseXML.firstChild; var reply = xmlhttp_rpc.responseXML.firstChild;
var f_document = parent.frames["feeds-frame"].document; var f_document = parent.frames["feeds-frame"].document;
parse_counters(reply, f_document); parse_counters(reply, f_document, parent);
} catch (e) { } catch (e) {
exception_error("all_counters_callback", e); exception_error("all_counters_callback", e);

View File

@ -96,7 +96,7 @@ function refetch_callback() {
var f_document = window.frames["feeds-frame"].document; var f_document = window.frames["feeds-frame"].document;
parse_counters(reply, f_document); parse_counters(reply, f_document, window);
updateTitle(""); updateTitle("");
notify("All feeds updated."); notify("All feeds updated.");