Skip to content

Instantly share code, notes, and snippets.

@hastebrot
Last active April 21, 2018 11:52
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 hastebrot/72b40b4854d9dc90b114473bf1bccef6 to your computer and use it in GitHub Desktop.
Save hastebrot/72b40b4854d9dc90b114473bf1bccef6 to your computer and use it in GitHub Desktop.
Browser Bookmarklets for Atlassian Jira

Browser Bookmarklets for Atlassian Jira

Jira is a proprietary issue tracking product, developed by Atlassian. It provides bug tracking, issue tracking, and project management functions.

"Jira (software)." Wikipedia, The Free Encyclopedia.

Usage:

"Installation" of a bookmarklet is performed by creating a new bookmark, and pasting the code into the URL destination field. Alternatively, if the bookmarklet is presented as a link, under some browsers it can be dragged and dropped onto the bookmark bar. The bookmarklet can then be run by loading the bookmark normally.

Cycle through panel widths in work mode (kanban board):

jira-cycle-panels:

javascript:(function(){
  const ratios = [0.5, 0.6, 0.7, 0.8, 0.33];
  const loadIndex = () => $("body").data("jira-ratios-index");
  const saveIndex = index => $("body").data("jira-ratios-index", index);
  const index = loadIndex() || 0;
  const nextIndex = (index + 1) % ratios.length;
  saveIndex(nextIndex);
  const percentage = ratios[index] * 100;
  $("#ghx-work #ghx-pool-column").css("width", percentage + "%");
  $("#ghx-work #ghx-detail-view").css("width", (100 - percentage) + "%");
  GH.Layout.fireDelayedWindowResize();
})();

Show/hide columns in work mode (kanban board):

jira-toggle-columns:

javascript:(function(){
  const columnIndizes = [2];
  const columnIdsAll = $("#ghx-column-headers .ghx-column")
    .toArray().map(it => $(it).data("id"));
  const columnIds = columnIndizes.map(index => columnIdsAll[index]);
  const show = element => $(element).css("display", "table-cell");
  const hide = element => $(element).css("display", "none");
  const isHidden = element => $(element).css("display") === "none";
  const toggle = element => isHidden(element) ? show(element) : hide(element);
  const toggleColumn = columnId => {
    toggle($("[data-id=" + columnId + "]"));
    toggle($("[data-column-id=" + columnId + "]"));
  };
  columnIds.forEach(columnId => toggleColumn(columnId));
  GH.Layout.fireDelayedWindowResize();
})();

Original source: https://gist.github.com/dkniffin/b6f5dd4e1bde716e7b32

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment