kareila: (Default)
kareila ([personal profile] kareila) wrote in [site community profile] changelog2009-07-17 03:10 am

[dw-free] Track icon on recent entries/readpage throws a JS error

[commit: http://hg.dwscoalition.org/dw-free/rev/a9fbb12e6ff8]

http://bugs.dwscoalition.org/show_bug.cgi?id=1249

Don't reference undefined variables.

Patch by [personal profile] afuna.

Files modified:
  • htdocs/js/esn.js
--------------------------------------------------------------------------------
diff -r e36c136e204d -r a9fbb12e6ff8 htdocs/js/esn.js
--- a/htdocs/js/esn.js	Thu Jul 16 21:46:29 2009 -0500
+++ b/htdocs/js/esn.js	Thu Jul 16 22:10:15 2009 -0500
@@ -142,7 +142,17 @@ ESN.trackBtnClickHandler = function (evt
         commentsTrackBtn = TrackCheckbox("someone replies in this comment thread", 1);
     } else {
         // entry tracking button
-        newEntryTrackBtn = TrackCheckbox(LJ_cmtinfo["journal"] + " posts a new entry", trackingNewEntries);
+        var journal; 
+        
+        if ( typeof LJ_cmtinfo !== 'undefined' ) {
+            journal = LJ_cmtinfo["journal"];
+        } else if ( typeof Site !== 'undefined' ) {
+            journal = Site.currentJournal;
+        }
+
+        if ( journal ) {
+            newEntryTrackBtn = TrackCheckbox( journal + " posts a new entry", trackingNewEntries );
+        }
         commentsTrackBtn = TrackCheckbox("someone comments on this post", trackingNewComments);
     }
 
--------------------------------------------------------------------------------
afuna: Cat under a blanket. Text: "Cats are just little people with Fur and Fangs" (Default)

[personal profile] afuna 2009-07-17 03:19 am (UTC)(link)
Mwahaha, yay! this bothers me on my journal all the time.

(Are we using the same whitespace rules in JS that we are in Perl, btw? It makes sense to me, but I've been following whatever is in the file)