Advertisement
Guest User

Untitled

a guest
Aug 28th, 2014
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function CreateWorkSubTask(key) {
  2.     console.log(key);
  3.     var span = jQuery("#create_work_sub_task_link span");
  4.     if (span.length) {
  5.         console.log("make wait");
  6.         var oldLabel = span.text();
  7.         var sp_width = span.css("width");
  8.         console.log(sp_width);
  9.         span.css("display", "block");
  10.         span.css("width", sp_width);
  11.         span.text("waiting...");
  12.         var dots = window.setInterval( function() {
  13.             if (span.text().length > 9) {
  14.                 span.text(span.text().substring(0,7));
  15.             } else {
  16.                 span.text(span.text() + ".");
  17.             }
  18.         }, 100)
  19.     }
  20.     var p = jQuery.post(
  21.         "/plugins/servlet/createWorkSubTask",
  22.         {"issueKey": key},
  23.         function(data) {
  24.             console.log(data);
  25.             if (data.uri) {
  26.                 window.location.replace(data.uri);
  27.             } else {
  28.                 alert(data.message);
  29.                 window.clearInterval(dots);
  30.                 span.text(oldLabel);
  31.             }
  32.         },
  33.         "json"
  34.     );
  35.     p.fail(function() {
  36.         console.log("fail");
  37.         alert("can't create work sub-task, please contact with jira administrators");
  38.         window.clearInterval(dots);
  39.         span.text(oldLabel);
  40.     });
  41.     return false;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement