Skip to content

Instantly share code, notes, and snippets.

@efbenson
Created April 22, 2015 16:06
Show Gist options
  • Save efbenson/dddba3b6b519bed7f2e1 to your computer and use it in GitHub Desktop.
Save efbenson/dddba3b6b519bed7f2e1 to your computer and use it in GitHub Desktop.
Userscript (Tampermonkey) to change new comment on JIRA to internal only by default.
// ==UserScript==
// @name Select only Geo for Jira comments by default
// @namespace http://scripts.efbenson.info/
// @version 0.1
// @description Selects the private opton by default
// @match *geodecisions.atlassian.net/browse/*
// @include *geodecisions.atlassian.net/browse/*
// @copyright 2012+, Erik Benson
// @license MIT
// ==/UserScript==
console.log("started....");
var defaultRoleName = "role:10000";
var customRoleSelected = false;
function changeCommentLevel()
{
if (customRoleSelected) return;
var commentLevelSelect = jQuery('.security-level select#commentLevel option[value=\'' + defaultRoleName + '\']');
if (commentLevelSelect)
{ var labelText = commentLevelSelect.first().text(); jQuery("select#commentLevel").val(defaultRoleName); jQuery("#commentLevel-multi-select a.drop span.icon").removeClass("icon-unlocked").addClass("icon-locked"); var htmlEscapedLabel = AJS.$("<div/>").text(labelText).html(); jQuery(".security-level span.current-level").html(AJS.format(AJS.params.securityLevelViewableRestrictedTo, htmlEscapedLabel)); }
}
jQuery('#comment').live('focus', changeCommentLevel);
jQuery('#commentLevel-suggestions').live('click', function()
{ customRoleSelected = true; });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment