Make the menu count for unread inbox items dynamic as well.

        Patch by afuna. 

diffs (41 lines):

diff -r be4f84e0c13a -r 0b282f02da3d cgi-bin/DW/Logic/MenuNav.pm
--- a/cgi-bin/DW/Logic/MenuNav.pm       Thu Dec 03 04:46:54 2009 +0000
+++ b/cgi-bin/DW/Logic/MenuNav.pm       Thu Dec 03 04:54:44 2009 +0000
@@ -182,7 +182,7 @@ sub get_menu_navigation {
                 {
                     url => "$LJ::SITEROOT/inbox/",
                     text => $inbox_count ? "menunav.read.inbox.unread" : 
"menunav.read.inbox.nounread",
-                    text_opts => { num => $inbox_count },
+                    text_opts => { num => "<span 
id='Inbox_Unread_Count_Menu'>$inbox_count</span>" },
                     display => $loggedin,
                 },
             ],
diff -r be4f84e0c13a -r 0b282f02da3d htdocs/js/livejournal.js
--- a/htdocs/js/livejournal.js  Thu Dec 03 04:46:54 2009 +0000
+++ b/htdocs/js/livejournal.js  Thu Dec 03 04:54:44 2009 +0000
@@ -69,7 +69,8 @@ LiveJournal.initInboxUpdate = function (
 
     // Don't run if no inbox count
     var unread = $("Inbox_Unread_Count");
-    if (! unread) return;
+    var unread_menu = $("Inbox_Unread_Count_Menu");
+    if (! unread && ! unread_menu) return;
 
     // Update every five minutes
     window.setInterval(LiveJournal.updateInbox, 1000 * 60 * 5);
@@ -97,9 +98,13 @@ LiveJournal.gotInboxUpdate = function (r
     if (! resp || resp.error) return;
 
     var unread = $("Inbox_Unread_Count");
-    if (! unread) return;
+    var unread_menu = $("Inbox_Unread_Count_Menu");
+    if (! unread && ! unread_menu) return;
 
-    unread.innerHTML = resp.unread_count ? "  (" + resp.unread_count + ")" : 
"";
+    if ( unread )
+        unread.innerHTML = resp.unread_count ? "  (" + resp.unread_count + ")" 
: "";
+    if ( unread_menu )
+        unread_menu.innerHTML = resp.unread_count ? resp.unread_count : "";
 };
 
 // Search for placeholders and initialize them
_______________________________________________
dw-changelog mailing list
[email protected]
http://lists.dwscoalition.org/mailman/listinfo/dw-changelog

Reply via email to