Skip to content

Instantly share code, notes, and snippets.

@shameen
Last active September 4, 2019 11:38
Show Gist options
  • Save shameen/e53581ea7f80c56fdd8942550184af2c to your computer and use it in GitHub Desktop.
Save shameen/e53581ea7f80c56fdd8942550184af2c to your computer and use it in GitHub Desktop.
[Userscript] Classic JIRA backlog: Move labels inline
// ==UserScript==
// @name JIRA classic backlog: Inline labels
// @namespace http://shameen.info
// @version 0.1.1
// @description (Classic JIRA Backlog) Labels shouldnt take up an entire line, this puts them inline on the right of each issue (as the leftmost item)
// @author shameen
// @match https://*.atlassian.net/secure/RapidBoard.jspa?*rapidView=271*
// @downloadUrl https://gist.github.com/shameen/e53581ea7f80c56fdd8942550184af2c/raw/6220806f91df7e827f983406646caba23cb19b16/jira-classic-backlog-inline-labels.user.js
// @grant none
// ==/UserScript==
(function() {
'use strict';
var $ = jQuery;
if (typeof $ !== "function") {
console.error("[userscript Inline labels] jQuery not found");
return;
}
var log = function(text) {
console.log("[userscript Inline labels] ", text);
};
$(function() {
log("starting script");
var moveLabelsUp = function(elemExtraFields) {
var $this = $(elemExtraFields);
var $targetContainer = $this.siblings(".ghx-end");
if (!$targetContainer.length) {
return;
}
//move labels
var newElem = $($this.html());
$this.remove();
newElem.addClass("ghx-fa");
$targetContainer.prepend(newElem);
};
setInterval(function() {
var elems = $(".ghx-end ~ .ghx-plan-extra-fields");
elems.each(function(index, value) {
moveLabelsUp(value);
});
if (elems.length) {
log("moved labels for "+elems.length+" issues.")
}
}, 2500);
log("script initialized");
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment