diff options
author | Simon Green <sgreen@redhat.com> | 2014-04-02 10:52:30 +0200 |
---|---|---|
committer | Byron Jones <glob@mozilla.com> | 2014-04-02 10:52:30 +0200 |
commit | 33513415fbea127615960fd55a725cd39cb31a17 (patch) | |
tree | b88d9fe1b7b9bc80a2edf9ad5dd8a4dff9378ff8 /extensions/InlineHistory/web | |
parent | cc18ce2279b2506319bd0a729ce0333d7f8ae0ba (diff) | |
download | bugzilla-33513415fbea127615960fd55a725cd39cb31a17.tar.gz bugzilla-33513415fbea127615960fd55a725cd39cb31a17.tar.xz |
Bug 891757: "Additional hours worked" displayed inline with comments is now superfluous
Diffstat (limited to 'extensions/InlineHistory/web')
-rw-r--r-- | extensions/InlineHistory/web/inline-history.js | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/extensions/InlineHistory/web/inline-history.js b/extensions/InlineHistory/web/inline-history.js index 95a664a42..c59c2932c 100644 --- a/extensions/InlineHistory/web/inline-history.js +++ b/extensions/InlineHistory/web/inline-history.js @@ -13,11 +13,13 @@ var inline_history = { init: function() { Dom = YAHOO.util.Dom; - // remove 'has been marked as a duplicate of this bug' comments var reDuplicate = /^\*\*\* \S+ \d+ has been marked as a duplicate of this/; var reBugId = /show_bug\.cgi\?id=(\d+)/; + var reHours = /Additional hours worked: \d+\.\d+/; + var comments = Dom.getElementsByClassName("bz_comment", 'div', 'comments'); for (var i = 1, il = comments.length; i < il; i++) { + // remove 'has been marked as a duplicate of this bug' comments var textDiv = Dom.getElementsByClassName('bz_comment_text', 'pre', comments[i]); if (textDiv) { var match = reDuplicate.exec(textDiv[0].textContent || textDiv[0].innerText); @@ -50,12 +52,22 @@ var inline_history = { } } } + + // remove 'Additional hours worked: ' comments + var commentNodes = comments[i].childNodes; + for (var j = 0, jl = commentNodes.length; j < jl; j++) { + if (reHours.exec(commentNodes[j].textContent)) { + comments[i].removeChild(commentNodes[j]); + // Remove the <br> before it + comments[i].removeChild(commentNodes[j-1]); + break; + } + } } // ensure new items are placed immediately after the last comment - var commentDivs = Dom.getElementsByClassName('bz_comment', 'div', 'comments'); - if (!commentDivs.length) return; - var lastCommentDiv = commentDivs[commentDivs.length - 1]; + if (!comments.length) return; + var lastCommentDiv = comments[comments.length - 1]; // insert activity into the correct location var commentTimes = Dom.getElementsByClassName('bz_comment_time', 'span', 'comments'); |