Skip to content

Instantly share code, notes, and snippets.

@lackac
Created April 3, 2009 12:14
Show Gist options
  • Save lackac/89728 to your computer and use it in GitHub Desktop.
Save lackac/89728 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Jira improvements
// @namespace http://lackac.hu
// @include http://crm.virgo.hu/*
// ==/UserScript==
var GM_JQ = document.createElement('script');
GM_JQ.src = 'http://jquery.com/src/jquery-latest.js';
GM_JQ.type = 'text/javascript';
document.getElementsByTagName('head')[0].appendChild(GM_JQ);
(function() {
if (typeof unsafeWindow.jQuery == 'undefined') {
window.setTimeout(arguments.callee, 100);
} else {
$j = unsafeWindow.$ = unsafeWindow.jQuery;
letsJQuery();
}
})();
function letsJQuery() {
$j('td[width="50%"] input[name="issuesummary"]').css('width', '36em');
$j('tr.rowHeader:contains(Time Sheet Summary)').each(function() {
var table = $j(this).parent();
table.find('tr:not(.rowHeader, :last)').each(function() {
var row = $j(this);
var newRow = row.clone();
var days = row.find('td.nonWorkedDay, td.workedDay').remove();
var issueTitle = row.find('td:eq(2)')
.remove().insertAfter(row.find('td:eq(2)'))
.attr({'colspan': days.length, 'align': 'center'}).addClass('issue-title').hide().find('a').text();
row.find('td:lt(3)').attr('rowspan', 2);
row.attr('title', issueTitle);
newRow.find('td:lt(4)').remove();
newRow.attr('title', issueTitle);
row.after(newRow);
});
table.find('tr:first td:first, tr:last td:first').attr('colspan', 3);
var titlesLink = $j('<span/>').html('(');
titlesLink.append(
$j('<a href="#">Titles</a>').click(function(e) {
e.preventDefault();
$j(this).parents('table:first').find('td.issue-title').toggle();
})
)
titlesLink.append(')');
titlesLink.css('font-size', '0.8em');
table.find('tr:first td:first').append(titlesLink);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment