The following BugMonkey script shows one way to have more control over which/how case events are displayed:
// Provide a menu on case view that allows you to do one of the following:
// View all events
// Show all events as one-line summaries
// Show seen events as one-line summaries
// Hide seen events
$(document).ready(function() {
// Don't do anything unless we're looking at a single bug
if (!window.goBug ||
!$("#bugviewContainer").length ||
$("#miniBugList").length)
return;
// The text displayed in the display menu
var modes = {
showAll: {
text: "Show All",
label: "Showing all events",
show: ".bugevent"
},
summarizeAll: {
text: "Summarize All",
label: "Summarizing all events",
show: ".small-summary"
},
summarizeSeen: {
text: "Summarize Seen",
label: "Summarizing #seen events",
show: ".bugevent:not(.seen),.small-summary.seen"
},
hideSeen: {
text: "Hide Seen",
label: "Hiding #seen events",
show: ".bugevent:not(.seen)"
}
};
// The name of the cookie used to save settings
var sCookie = "sSeenEventMode";
// Read the user's current settings. Default is to show all
var sSeenMode = getCookie(sCookie) || "showAll";
// Determine the last event the user saw
var ixLastView = goBug.ixBugEventLastView;
// A table describing the translation from a standard bug event
// to its summary
var summTrans = [
{ sel: ".action", color: "#000", css: { "font-weight": "bold"} },
{ sel: ".date a", color: "#68615e" },
{ fnHtml: function(ev) {
return (ev.find(".emailBody").html() || ev.find(".body").html() || "").
replace(/<[^>]*>/g, " ");
}, color: "#888"
},
{ sel: ".changes", color: "#aaa" }
];
var jAllEvents = $("#BugEvents .bugevent");
// Process bug events we've already seen
var numSeen =
jAllEvents
// Filter out events we haven't seen
.filter(function() {
return /\d+/.exec($(this).attr("id")) <= ixLastView;
})
.addClass("seen")
.length;
// Process all visible bug events
jAllEvents
.each(function() {
var ev = $(this);
// Create the event summary
var divSummary = $("<div>")
.addClass("small-summary")
.css({
"white-space": "nowrap",
overflow: "hidden",
"text-overflow": "ellipsis",
"font-size": "10px",
"margin-bottom": "4px",
"cursor": "pointer"
})
.insertBefore(this)
.click(function() {
// Clicking anywhere on the summary hides it
// and displays the full bug event
$(this).hide().next(".bugevent").show();
});
if (ev.hasClass("seen")) divSummary.addClass("seen");
// Convert the bug event into a summary
$.each(summTrans, function(ix, tbl) {
var entry = $("<span>")
.css(tbl.css)
.css({
color: tbl.color,
"margin-right": "4px"
})
.appendTo(divSummary);
if (tbl.fnHtml)
entry.html(tbl.fnHtml(ev));
else
entry.text(ev.find(tbl.sel).text())
});
});
var divMenu = $("<div>")
.css({
"margin-bottom": "1em",
border: "1px dotted #888",
padding: "4px",
"background-color": "#f4f4f4"
})
.insertBefore("#BugEvents");
var spanLabel = $("<span>")
.css({
"font-weight": "bold",
"float": "right"
})
.appendTo(divMenu);
// Set the display mode
var setMode = function(ev, sMode) {
// If this is being used as an event handler,
// get the mode from the link that was clicked
sMode = sMode || $(this).attr("mode");
// Don't underline the link that represents the current display mode
divMenu.find("a")
.css("text-decoration", function() {
return $(this).attr("mode") == sMode ? "none" : "underline";
});
// Only show the events/summaries allowed by the user's selection
$("#BugEvents").find(".bugevent,.small-summary")
.hide()
.filter(modes[sMode].show)
.show();
// Update the label
spanLabel.html(modes[sMode].label.replace(/#seen/g, numSeen));
// Remember the user's selection
setCookie(sCookie, sMode);
};
// Add the display modes to the menu
for (var mode in modes) {
$("<a>")
.text(modes[mode].text)
.css("margin", ".5em")
.attr({ href: "javascript:void(0)", mode: mode })
.appendTo(divMenu)
.click(setMode);
}
// Apply the user's saved mode
setMode(null, sSeenMode);
});
If you'd like to use the code as is, you can use the Closure compiled version:
$(document).ready(function(){if(!(!window.goBug||!$("#bugviewContainer").length||$("#miniBugList").length)){var e={showAll:{text:"Show All",label:"Showing all events",show:".bugevent"},summarizeAll:{text:"Summarize All",label:"Summarizing all events",show:".small-summary"},summarizeSeen:{text:"Summarize Seen",label:"Summarizing #seen events",show:".bugevent:not(.seen),.small-summary.seen"},hideSeen:{text:"Hide Seen",label:"Hiding #seen events",show:".bugevent:not(.seen)"}},i=getCookie("sSeenEventMode")||
"showAll",j=goBug.ixBugEventLastView,k=[{sel:".action",color:"#000",css:{"font-weight":"bold"}},{sel:".date a",color:"#68615e"},{fnHtml:function(b){return(b.find(".emailBody").html()||b.find(".body").html()||"").replace(/<[^>]*>/g," ")},color:"#888"},{sel:".changes",color:"#aaa"}],c=$("#BugEvents .bugevent"),l=c.filter(function(){return/\d+/.exec($(this).attr("id"))<=j}).addClass("seen").length;c.each(function(){var b=$(this),a=$("<div>").addClass("small-summary").css({"white-space":"nowrap",overflow:"hidden",
"text-overflow":"ellipsis","font-size":"10px","margin-bottom":"4px",cursor:"pointer"}).insertBefore(this).click(function(){$(this).hide().next(".bugevent").show()});b.hasClass("seen")&&a.addClass("seen");$.each(k,function(n,d){var g=$("<span>").css(d.css).css({color:d.color,"margin-right":"4px"}).appendTo(a);d.fnHtml?g.html(d.fnHtml(b)):g.text(b.find(d.sel).text())})});var f=$("<div>").css({"margin-bottom":"1em",border:"1px dotted #888",padding:"4px","background-color":"#f4f4f4"}).insertBefore("#BugEvents"),
m=$("<span>").css({"font-weight":"bold","float":"right"}).appendTo(f);c=function(b,a){a=a||$(this).attr("mode");f.find("a").css("text-decoration",function(){return $(this).attr("mode")==a?"none":"underline"});$("#BugEvents").find(".bugevent,.small-summary").hide().filter(e[a].show).show();m.html(e[a].label.replace(/#seen/g,l));setCookie("sSeenEventMode",a)};for(var h in e)$("<a>").text(e[h].text).css("margin",".5em").attr({href:"javascript:void(0)",mode:h}).appendTo(f).click(c);c(null,i)}});