diff options
author | Ehsan Akhgari <ehsan@mozilla.com> | 2010-09-17 18:42:55 -0400 |
---|---|---|
committer | Ehsan Akhgari <ehsan@mozilla.com> | 2010-09-17 18:42:55 -0400 |
commit | 191882d40ff8e328473dbbf918d205f0e0898f6e (patch) | |
tree | d44e36ef87759d74e3d9a37c9dc8d3c573c0328d /lib | |
parent | 510a7dd6796e874710f4177655da51880eacbdcd (diff) | |
download | bugzilla-triage-191882d40ff8e328473dbbf918d205f0e0898f6e.tar.gz |
Add a link to collapse all of tbplbot's comments
Diffstat (limited to 'lib')
-rw-r--r-- | lib/main.js | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/lib/main.js b/lib/main.js index 2855427..79b4933 100644 --- a/lib/main.js +++ b/lib/main.js @@ -370,6 +370,8 @@ function tweakBugzilla(d) { AttachmentFlagHandler.setupLinks(d); },true); d.body.appendChild(iframe); + + tbplbotSpamCollapser(d); } var TransformValues = { @@ -1100,3 +1102,34 @@ function addAssignToSelfButton(d) { } } } + +function tbplbotSpamCollapser(d) { + var collapseExpandBox = d.querySelector(".bz_collapse_expand_comments"); + if (!collapseExpandBox) { + return; + } + var a = d.createElement("a"); + a.href = "#"; + a.addEventListener("click", function(e) { + e.preventDefault(); + var win = d.defaultView.wrappedJSObject; + var comments = d.querySelectorAll(".bz_comment"); + for (var i = 0; i < comments.length; ++i) { + var comment = comments[i]; + try { + if (comment.querySelector(".bz_comment_user a.email").href.substr(7) == + "tbplbot@gmail.com") { + win.collapse_comment(comment.querySelector(".bz_collapse_comment"), + comment.querySelector(".bz_comment_text")); + } + } catch (e) { + continue; + } + } + return false; + }, false); + a.appendChild(d.createTextNode("Collapse All tbplbot Comments")); + var li = d.createElement("li"); + li.appendChild(a); + collapseExpandBox.appendChild(li); +} |