JIRA Cloud Quick Add Sub-Tasks

Quickly add subtasks to a JIRA Task

当前为 2018-02-22 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name JIRA Cloud Quick Add Sub-Tasks
  3. // @namespace *.atlassian.net
  4. // @version 0.3
  5. // @description Quickly add subtasks to a JIRA Task
  6. // @match https://*.atlassian.net/browse/*
  7. // @grant none
  8. //
  9. // @author Tim <timsayshey@gmail.com>
  10. //
  11. // @license GPLv3 - http://www.gnu.org/licenses/gpl-3.0.txt
  12. // @copyright Copyright (C) 2018, by Tim <timsayshey@gmail.com>
  13. // @Locale en_US
  14. // ==/UserScript==
  15.  
  16. /**
  17. * This program is free software: you can redistribute it and/or modify
  18. * it under the terms of the GNU General Public License as published by
  19. * the Free Software Foundation, either version 3 of the License, or
  20. * (at your option) any later version.
  21. *
  22. * This program is distributed in the hope that it will be useful,
  23. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  24. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  25. * GNU General Public License for more details.
  26. *
  27. * You should have received a copy of the GNU General Public License
  28. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  29. */
  30.  
  31. function main() {
  32. $("body").append(
  33. "<link rel='stylesheet prefetch' href='https://versatilitywerks.github.io/jAlert/dist/jAlert.css'>"+
  34. "<script src='https://versatilitywerks.github.io/jAlert/dist/jAlert.min.js'></script>"
  35. );
  36.  
  37. $("body").append('<a href="javascript:void(0)" id="addSubtasks" style="position:absolute;right:0;top:0;z-index:9999; background:white; display:block; padding:5px; margin:15px; border-radius:3px; border:1px solid #bbb">Bulk Subtasks (Open subtask modal first)</a>');
  38.  
  39. $(document).on("click","#addSubtasks",function(e) {
  40. $.jAlert({
  41. 'id': 'myAlert',
  42. 'content':
  43. '<h4>Add Sub Tasks</h4> Enter a list of new subtasks. On each line, separate the title from the description with a dollar sign ($) as seen in the placeholder below.<br><b style="color:red">New sub task modal must be open otherwise this won\'t work!</b>'+
  44. '<textarea id="subtaskList" style="height:300px;width:100%" class="required" name="msg" placeholder="My new task $ My new task description\nAnother new-task $ Another new task description\nYet another new task $ Yet another new task description"></textarea>'+
  45. '<a href="#" id="saveSubtasks" class="aui-button">Submit</a>',
  46. 'autofocus':'textarea',
  47. 'size':'md'
  48. });
  49. });
  50.  
  51. $(document).on("click","#saveSubtasks",function(e) {
  52. var lines = $('#subtaskList').val().split('\n');
  53. console.log(lines);
  54. $.each(lines, function(){
  55. var details = this.split("$");
  56. console.log(details);
  57. $.post("/secure/QuickCreateIssue.jspa?decorator=none", {
  58. pid: $(".aui-avatar-project").attr("id"),
  59. issuetype: 5,
  60. parentIssueId: $("input[name=parentIssueId]").val(),
  61. atl_token: $("input[name=atl_token]").val(),
  62. formToken: $("input[name=formToken]").val(),
  63. priority: 3,
  64. summary: details[0],
  65. description: details[1],
  66. assignee: "-1",
  67. "dnd-dropzone": "",
  68. duedate: "",
  69. fieldsToRetain: "project"
  70. },
  71. function(data, status){
  72. alert("Data: " + data + "\nStatus: " + status);
  73. });
  74. });
  75.  
  76. });
  77. }
  78.  
  79. // Execute the main function
  80. main();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址