35

28

Bug-monkey scripts probably don't qualify as full plug-ins on their own right and probably don't belong in the plug-in gallery, but it would be nice to have a centralized repository of BugMonkey scripts/css where people can share them

Since they are essentially just text blocks, I though I'd open a Question on here where people could post their scripts and/or vote on the best ones.

Michael: If you had other ideas for another place to do this, please let me know and I'll delete this post.

flag
2 
Seems fine to me! – Michael Pryor Sep 16 2009 at 17:29
show 1 more comment

116 Answers

0

Here is a really simple script to alternate the colors for case events on the case detail view.

//alternate colors in case detail events
$(".bugevent:odd").css("background-color","#E0E9F1")

Prompted by this newsgroup question.

link|flag
0

Here's a script to hide all Backlog change entries:

$("div.bugevent").each(function() {
  if ($("div.changes", this).text().toLowerCase().indexOf(" backlog") >= 0) {
    $(this).css("display", "none");
  }
});
link|flag
0

If you want all your case titles on the single bug view page to contain the case number pre-pended ala FogBugz 6 (perhaps for easy copy and paste):

$(document).ready(function() {
    // Don't do anything unless we're looking at a single bug
    if (!window.goBug || 
        !$("#bugviewContainer").length || 
        $("#miniBugList").length) 
        return;

    $(".title").html("Case " + goBug.ixBug + ": " + goBug.sTitle);
});
link|flag
0

I posted a script that adds the "Favorites" star to the popup that appears when you hover over a case ID.

link|flag
0

Some Kanban plugin mods to make it play nice in FB8:

// Kanban Plugin hackery from Offroadcode.com
$( document ).ready( function() {
  // What is the plugin number for the Kanban plugin (hint hover over the kanban link and it will be in the url)
  var kanbanPlugInNumber = 21;

  // Change page title so it sticks out in tabbed browsers
  if ( typeof initKanban != "undefined" ) {
    // Enter code that will only run on the Kanban board here
    $("title").text( "Kanban" );
  }

  // Update, this hack is no longer needed with the latest version of 
  // the Kanban plug. I'll leave it here if you need it though :)
  // Make the "Kanban" link in the top right menu work with FB8
  /*
  var kanbanurl = "/default.asp?pg=pgPlugin&ixPlugin=" + kanbanPlugInNumber ; 
  var bb = $('#belowBanner');
  bb.prepend('<span><a class="navlink" href="' + kanbanurl + '">Kanban</a></span>');
  */
});
link|flag
0

I posted a css line to preserve whitespace in VSS Differences:

table.fileDiff td { white-space: pre; }
link|flag
0

Bugmonkey for showing the links for inline image attachments at the bottom of the message:

name:        Show inline attachment links
description: Shows the links for inline attachments at the bottom of a Bug Event.
author:      Ben McCormack
version:     1.0.0.0
minApi:      1.0

js: 
//http://plugins.jquery.com/project/URLEncode - some code to encode/decode URLs
$.extend({URLEncode:function(c){var o='';var x=0;c=c.toString();var r=/(^[a-zA-Z0-9_.]*)/;
  while(x<c.length){var m=r.exec(c.substr(x));
    if(m!=null && m.length>1 && m[1]!=''){o+=m[1];x+=m[1].length;
    }else{if(c[x]==' ')o+='+';else{var d=c.charCodeAt(x);var h=d.toString(16);
    o+='%'+(h.length<2?'0':'')+h.toUpperCase();}x++;}}return o;},
URLDecode:function(s){var o=s;var binVal,t;var r=/(%[^%]{2})/;
  while((m=r.exec(o))!=null && m.length>1 && m[1]!=''){b=parseInt(m[1].substr(1),16);
  t=String.fromCharCode(b);o=o.replace(m[1],t);}return o;}
});

var putImageAttachmentsAsLinks = function() {
  var rgElementsWithImageLinks = $('[href*="ixAttachment="][title*="Click for full-sized image"] :not(:hidden)').parent();
  $(rgElementsWithImageLinks).each(function() {
    var sHref = $(this).attr('href');
    var re = /&sFileName=.*/
    var rgsFileNameMatches = sHref.match(re);
    if (rgsFileNameMatches.length > 0) {
      var sFileName = $.URLDecode(rgsFileNameMatches[0].replace("&sFileName=",""));
      var sHtmlToInsert = '' +
        '<p class="bugEvent">\n' +
        '  <a href="' + sHref + '" target="altfilewindow">\n' +
        '  <img src="images/attachment.gif" alt="Attachment" width="16" height="16" align="left" border="0" style="padding-right:10px" />\n'+
        '    ' + sFileName + '</a>\n' +
        '</p>';
      $(this).parents('.emailBody').append(sHtmlToInsert);
    }
  });
};

try {
putImageAttachmentsAsLinks();
}
catch (e) {
 console.log(e.toString());
}
link|flag
1 
Currently, FogBugz will parse anything in the format of [see attached: aLogFile.log]' as an image and wrap it in an `img tag. This can be a pain for in-line non-image attachments. This script will cause all image attachments to show up more-or-less like regular attachments. – Ben McCormack Jul 14 2011 at 19:19
show 1 more comment
0

For use with the Relative Time plugin:

name:        Make overdue relative date red
description: Checks the relative due date and if it is red, makes it red
author:      Ben McCormack
version:     1.0.0.0
minApi:      1.0

js: 
$('span.relative-time-due:not([data-time_span_seconds*="-"]):not([data-time_span_seconds*="null"])').css('color','red');

Screenshot

link|flag
0

Inspired by this 'answer', I created a tiny customization to automatically enable the key shortcuts on page load:

name:        Auto Hotkeys
description: Enable the hotkeys on load
author:      Michel de Ruiter
version:     1.0.0.0

js: 
KeyManager.nHotKeysLevel = 1;
KeyManager.activateHotKeys();

I'm sure it can be improved to also activate on edit, cancel, etc. And it should probably not activate on Edit. Feel free to edit, anyone!

link|flag
0

Fog Creek video

http://www.youtube.com/watch?v=-jm942TrsK4

Shows a central repository.

I guess it never made it to production.

link|flag
show 1 more comment
0

I created a simple Quips script to mimic the old Quips plugin for Bugzilla. It's nothing special, but it does the job.

link|flag
0

I hacked a customization to change the default selected From: value (when sending e-mails) to the personal name variant.

link|flag
0

I posted a script to easily toggle the visibility of all quoted texts in e-mails.

When searching a long case for something you just know is there but you cannot find it, it might be hidden in a 'quote'. One click now expands them all!

link|flag
0

This tiny customization makes code blocks in case events (and e-mails, for logged-in users) stand out, and smaller.

name:          Code block style
description:   Make code blocks in case events a bit more visible
author:        Michel de Ruiter
version:       1.0.0.0

css:
.bugevent div.codesnippet.scroll,
.bugevent code.inline-codesnippet {
  background-color: #FFD;
  font-size: 82%;
}
link|flag
0

I created a customization to highlight the specific case event (hash anchor) the user jumped to.

link|flag
0

A script to prevent deleting attachments.

link|flag
0

I wrote a horribly hacky script to add a password reset link to the edit user page so admins can force users to change their password* http://fogbugz.stackexchange.com/questions/9823/ability-to-reset-a-users-password-as-an-administrator

* of course, FogBugz will happily let them set the same password again ;)

link|flag
0

This customization allows the navigation bar to be narrow instead of always using 1000px.

It takes care to use no more vertical space than necessary, even when the navigation bar wraps on small screens.

name:          Narrow menu
description:   Allow the menu to be very narrow
author:        Michel de Ruiter
version:       1.1.0.0

js:
$('body').addClass('narrowmenu');

css:
.narrowmenu #tbFull {
  min-width: 1em;
}
.narrowmenu #tbFull #banner {
  height: auto;
  min-height: 40px;
}
.narrowmenu #containerLogo {
  height: 40px;
  top: 0;
}
.narrowmenu #mainnav {
  display: table-cell;
  height: 40px;
  vertical-align: middle;
  padding: 0;
}
.narrowmenu #mainnav a.navlink {
  padding: 0 3px;
  margin: 0;
}
.narrowmenu #mainnav a.navlink:hover {
  padding-top: 3px;
  padding-bottom: 2px;
}

Might not work with iPads.

link|flag
0

This script will set default values for Project and Area on all new cases, rather than using the most recently used value for those fields. Just change the defaultProject and defaultArea variables to names that match your system, and be sure to match them case sensitively.

name:        Override sticky defaults for new cases
description: Always use a given Project and Area for new cases
author:      Daniel LeCheminant
version:     1.0.0.0

js: 
if (goBug) {
    var defaultProject = "Inbox";
    var defaultArea = "Undecided";

    var setValue = function(target, value, callback) {
        var list = $("#ix" + target);
        var rgOpt = list.find("option");
        var opt = rgOpt.filter(function () {
            return $(this).text() == value;
        }).attr("selected", true);

        DropListControl.refresh(list[0]);

        if (callback) callback(rgOpt.index(opt));
    }

    if (goBug.ixProject == -1) {
        setValue("Project", defaultProject, projectChanged);
        setValue("Area", defaultArea);
    }
}
link|flag
0

Ever tried to search for a wiki page by number? I used BugMonkey to make it work as expected.

link|flag
0

Here is a script to remove the option to email from the FogBugz On Demand built-in "cases@something.fogbugz.com" address:

name:          Remove "cases@" From: option
description:   When emailing from a case, don't show the default cases@something.fogbugz.com option
author:        Adam Wishneusky
version:       1.0.0.0

js:

function RemoveCasesAddress() {
  if ($("#sFrom").length) {
    $("#sFrom").find('[value*="cases@"]').remove();
    DropListControl.refresh($("#sFrom")[0]);
  }
}
RemoveCasesAddress();
$(window).on('BugViewChange', RemoveCasesAddress);
link|flag
0

This customization prevents editing closed cases:

name:          Disable editing closed cases
description:   Removes the edit link on closed cases
author:        Adam Wishneusky
version:       1.0.0.0

js:

css:

  #editClosed0 {
    display: none !important;
  }
  #editClosed1 {
    display: none !important;
  }
link|flag
0

This script removes the Schedule Item category. You can modify it to remove any category you like, or adapt it to remove items from other drop-downs in the case edit page.

name:          Remove Schedule Item Option
description:   In case edit, removes the Schedule Item category
author:        Adam Wishneusky
version:       1.0.0.0

js:

  // set this to the ixCategory for Schedule Item
  var ixCategorySchedItem = 4;
  $(function() {
    // if we're not on the case page, don't do anything
    if (!$('#bugviewContainer').length) return;
    var myFunction = function(sCommand) {
      if (!$('select#ixCategory').length) return;
      if (goBug.ixCategory != ixCategorySchedItem) {
        $('select#ixCategory option[value="' + ixCategorySchedItem + '"]').remove();
        DropListControl.refresh($("select#ixCategory")[0])
      }
    };
    // run it on page-load:
    myFunction('load');
    // run it when the view changes and pass in the new view:
    $(window).on('BugViewChange', function(e, data) {
      myFunction(data.sCommand); 
    });
  });
link|flag
0

This customization is useful if you have a lot of cases with url's in their titles. It removes the link from the title of a case in list view to the case and links the URL instead. In case view, it also linkifies URLs in case titles.

name:        Link URLs in case titles
description: URLs in titles of cases are linked. In the case list, this means the title no longer links to the case. Click the case number to view the case.
author:      Adam Wishneusky
version:     1.0.0.0
minApi:      1.0

js: 
  function replaceURLWithHTMLLinks(text) {
    var exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig;
    return text.replace(exp,"<a href='$1'>$1</a>"); 
  }
  if ($('#bugListContainer').length != 0)
  {
    $('span.title a.title').each(
      function(index){
        $(this).replaceWith(replaceURLWithHTMLLinks($(this).text()));
      }
    );
  }
  if ($('#bugviewContainer').length != 0)
  {
    $('div.title').html(replaceURLWithHTMLLinks($('div.title').text()));
  }
link|flag
0

Add "Projects" dropdown menu to top navigation bar

This script will add a "Projects" dropdown menu to the top navigation bar. The links in this menu serve as quick shortcuts for seeing all the cases in a given project.

link|flag
0

Customize Community User Landing Page

This customization adds a wiki page's content as a third column to the Community User landing page.

link|flag
0

Only search 'active' cases by default

This customization makes the search box only search active cases by default. Specifically, if your search string doesn't include a "status:[foo]" axis, it will automatically append a "status:active" constraint for you when you submit your search.

link|flag
0

"My Filters" should come first

This customization reorders the "Filters" menu to display your personal saved filters before "Shared Filters"

link|flag
0

Problem

Wiki links and images won't load because the URLs are hard coded to a server that can't be accessed.

Solution

See this answer.

link|flag
0

This script adds a case's public ticket url as a link in the sidebar.

link|flag

Your Answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.