aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/main.js33
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);
+}