AUTO Show Assignee field in JIRA Create Linked Issue

Show Assignee field in the JIRA modal window of Create Linked Issue

  1. // ==UserScript==
  2. // @name AUTO Show Assignee field in JIRA Create Linked Issue
  3. // @namespace https://www.hicaliber.com.au
  4. // @version 0.2
  5. // @description Show Assignee field in the JIRA modal window of Create Linked Issue
  6. // @author Nikita Alekseev
  7. // @match http*://*.atlassian.net/*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. //waitForKeyElements coped from https://gist.github.com/mjblay/18d34d861e981b7785e407c3b443b99b
  12.  
  13. function waitForKeyElements (
  14. selectorTxt, /* Required: The selector string that
  15. specifies the desired element(s).
  16. */
  17. actionFunction, /* Required: The code to run when elements are
  18. found. It is passed a jNode to the matched
  19. element.
  20. */
  21. bWaitOnce /* Optional: If false, will continue to scan for
  22. new elements even after the first match is
  23. found.
  24. */
  25. ) {
  26. var targetNodes, btargetsFound;
  27. targetNodes = document.querySelectorAll(selectorTxt);
  28.  
  29. if (targetNodes && targetNodes.length > 0) {
  30. btargetsFound = true;
  31. /*--- Found target node(s). Go through each and act if they
  32. are new.
  33. */
  34. targetNodes.forEach(function(element) {
  35. var alreadyFound = element.dataset.found == 'alreadyFound' ? 'alreadyFound' : false;
  36.  
  37. if (!alreadyFound) {
  38. //--- Call the payload function.
  39. var cancelFound = actionFunction (element);
  40. if (cancelFound)
  41. btargetsFound = false;
  42. else
  43. element.dataset.found = 'alreadyFound';
  44. }
  45. } );
  46. }
  47. else {
  48. btargetsFound = false;
  49. }
  50.  
  51. //--- Get the timer-control variable for this selector.
  52. var controlObj = waitForKeyElements.controlObj || {};
  53. var controlKey = selectorTxt.replace (/[^\w]/g, "_");
  54. var timeControl = controlObj [controlKey];
  55.  
  56. //--- Now set or clear the timer as appropriate.
  57. if (btargetsFound && bWaitOnce && timeControl) {
  58. //--- The only condition where we need to clear the timer.
  59. clearInterval (timeControl);
  60. delete controlObj [controlKey];
  61. }
  62. else {
  63. //--- Set a timer, if needed.
  64. if ( ! timeControl) {
  65. timeControl = setInterval ( function () {
  66. waitForKeyElements ( selectorTxt,
  67. actionFunction,
  68. bWaitOnce
  69. );
  70. },
  71. 300
  72. );
  73. controlObj [controlKey] = timeControl;
  74. }
  75. }
  76. waitForKeyElements.controlObj = controlObj;
  77. }
  78.  
  79. waitForKeyElements("#create-linked-issue-dialog .jira-dialog-content #qf-field-assignee", (jNode) => jNode && jNode.removeAttribute('style'));

QingJ © 2025

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