From f7368018d95f8c12a1f63880834d1e5ed92b9e90 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Sat, 19 Dec 2009 00:37:38 +0100 Subject: [PATCH] Fix comments and likes on pages that extend Object On those pages 'j in somearray' enumerates the non-numerical indices too, thus retrieving methods and such. Use C-style iteration to fix the issue. --- ff_comments.user.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/ff_comments.user.js b/ff_comments.user.js index 5b32619..2519245 100644 --- a/ff_comments.user.js +++ b/ff_comments.user.js @@ -93,9 +93,10 @@ unsafeWindow.ujs_ff_load_entries = function(str) { div.appendChild(ediv); var likes = entry.likes || []; - if (likes.length > 0) { + var jcount = likes.length; + if (jcount > 0) { var liked = '

Liked by '; - for (var j in likes) { + for (var j=0; j < jcount; ++j) { var like = likes[j]; if (like.from) liked += (j > 0 ? ', ' : '') + from2link(like.from); @@ -107,9 +108,11 @@ unsafeWindow.ujs_ff_load_entries = function(str) { ldiv.innerHTML = liked; ediv.appendChild(ldiv); } + var comments = entry.comments || []; - if (comments.length > 0) { - for (var j in comments) { + jcount = comments.length; + if (jcount > 0) { + for (var j=0 ; j < jcount; ++j) { var comment = comments[j]; var cdiv = doc.createElement('div'); cdiv.style.borderTop = '.1ex dotted blue'; -- 2.32.0.93.g670b81a890