Skip to content

Instantly share code, notes, and snippets.

@masaakif
Created April 10, 2015 00:30
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 masaakif/60780c90449f4ca7acec to your computer and use it in GitHub Desktop.
Save masaakif/60780c90449f4ca7acec to your computer and use it in GitHub Desktop.
JIRAのフィールド初期値設定
// ==UserScript==
// @id jira-a1e859d8-9b47-4c42-9c76-8ac4fc0a8157@scriptish
// @name JIRA_SetInitialValue
// @version 1.0
// @namespace
// @author Masaaki Fujiwara
// @description
// @include http://jira/secure/CreateIssue.jspa
// @run-at document-end
// ==/UserScript==
setValues();
function setValues(){
var assignee = document.evaluate("//select[@id='assignee']", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
var bizprio = document.evaluate("//select[@id='customfield_10040']", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
var cusprio = document.evaluate("//select[@id='customfield_10050']", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
var desc = document.evaluate("//textarea[@id='description']", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
setSelValue(assignee, "tomoyukis");
setSelValue(bizprio, "Biz High");
setSelValue(cusprio, "H5");
desc.value = "*Reported By/Time:*\n\n\n*When the problem happened:*\n\n\n*Environment:*\n\n\n*Issue:*\n\n\n*Workaround:*\n\n\n*Reproduce Step:*\n\n\n*What RTB would like to developers to do:*\n\n\n";
};
function setSelValue(sel, value) {
setval:{
for(i = 0; i < sel.options.length; i++) {
if (sel.options[i].value == value) {
sel.selectedIndex = i;
break setval;
}
}
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment