Skip to content

Instantly share code, notes, and snippets.

@netsi1964
Created February 6, 2013 09:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save netsi1964/4721303 to your computer and use it in GitHub Desktop.
Save netsi1964/4721303 to your computer and use it in GitHub Desktop.
Greasemonkey: FogBugz util
// ==UserScript==
// @name FogBugz utils by Sten Hougaard (netsi1964@gmail.com)
// @namespace http://www.netsi.dk
// @author Sten Hougaard (netsi1964@gmail.com)
// @description Extends the fogbugz interface
// @include https://*.fogbugz.com*
// ==/UserScript==
<!--FogBugz.user.js -->
// a function that loads jQuery and calls a callback function when jQuery has finished loading
function addJQuery(callback) {
var script = document.createElement("script");
script.setAttribute("src", "//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js");
script.addEventListener('load', function() {
var script = document.createElement("script");
script.textContent = "jQuery.noConflict(true);(" + callback.toString() + ")();";
document.body.appendChild(script);
}, false);
document.body.appendChild(script);
}
// the guts of this userscript
function main() {
jQuery('td:contains("Closed"), td:contains("New")').css('background', 'rgba(255,0,0,.7)');
jQuery('td:contains("Active"), td:contains("In progress")').css('background', 'rgba(0,255,0,.7)');
jQuery('td:contains("Fixing")').css('background', 'rgba(255,255,0,.7)');
}
// load jQuery and execute the main function
addJQuery(main);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment