From bb5c0968ad8f2dd46a4a398b505a829c584f02e6 Mon Sep 17 00:00:00 2001 From: Matěj Cepl Date: Mon, 6 Jun 2011 14:16:43 +0200 Subject: Make coloring reporter’s comments working again. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data/lib/collectingMetadata.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'data/lib/collectingMetadata.js') diff --git a/data/lib/collectingMetadata.js b/data/lib/collectingMetadata.js index 06b43ac..f1fa488 100644 --- a/data/lib/collectingMetadata.js +++ b/data/lib/collectingMetadata.js @@ -14,10 +14,10 @@ function Comment(comment) { function CommentList(doc) { - var comments = document.getElementById("comments"). + var commentElems = document.getElementById("comments"). getElementsByClassName("bz_comment"); - comments = []; - Array.forEach(comments, function(item) { + var comments = {}; + Array.forEach(commentElems, function(item) { var com = new Comment(item); if (com.element) { comments[ISODateString(com.date)] = com; @@ -32,12 +32,13 @@ function CommentList(doc) { */ CommentList.prototype.colorComments = function colorComments() { var reporter = getReporter(); - var reporterComments = this.comments.filter(function (com) { - return com.author === reporter; - }); - reporterComments.forEach(function (com) { - com.element.style.backgroundColor = ReporterColor.toString(); - }); + var com = null; + for (var idx in this.comments) { + com = this.comments[idx]; + if (com.author === reporter) { + com.element.style.backgroundColor = ReporterColor.toString(); + } + } } CommentList.prototype.getAllCommentsText = function getAllCommentsText() { @@ -45,7 +46,6 @@ CommentList.prototype.getAllCommentsText = function getAllCommentsText() { outStr += com.getElementsByTagName("pre")[0].textContent + "\n"; }).trim(); } - // ----------------------------------------------------------- /** -- cgit