").addClass("tooltip-arrow").addClass(A.vertical).addClass(B<1?"align-left":"align-right").appendTo(this)}},content:function(){var B=this;var z=$(this).attr("data-href");if(!z){return'
'+$(this).attr("title")+"
"}$.get(z,function A(E){var D=$(".ui-tooltip:visible");$(".ui-tooltip-content:visible").html(E);D.css({top:"",left:""});D.children(".tooltip-arrow").remove();var C=$(B).tooltip("option","position");C.of=$(B);D.position(C)});return'
'}}).on("mouseenter",function(){var z=this;$(this).tooltip("open");$(".ui-tooltip").on("mouseleave",function(){$(z).tooltip("close")})}).on("mouseleave focusout",function(z){z.stopImmediatePropagation();var A=this;setTimeout(function(){if(!$(".ui-tooltip:hover").length){$(A).tooltip("close")}},100)})};function l(){}l.prototype.showPreview=function(C){C.preventDefault();var z=$(".write-area");var B=$(".preview-area");var y=$("textarea");$("#markdown-write").parent().removeClass("form-tab-selected");$("#markdown-preview").parent().addClass("form-tab-selected");var A=$.ajax({url:$("body").data("markdown-preview-url"),contentType:"application/json",type:"POST",processData:false,dataType:"html",data:JSON.stringify({text:y.val()})});A.done(function(D){B.find(".markdown").html(D);B.css("height",y.css("height"));B.css("width",y.css("width"));z.hide();B.show()})};l.prototype.showWriter=function(y){y.preventDefault();$("#markdown-write").parent().addClass("form-tab-selected");$("#markdown-preview").parent().removeClass("form-tab-selected");$(".write-area").show();$(".preview-area").hide()};l.prototype.listen=function(){$(document).on("click","#markdown-preview",this.showPreview.bind(this));$(document).on("click","#markdown-write",this.showWriter.bind(this))};function f(y){this.app=y;this.keyboardShortcuts()}f.prototype.focus=function(){$(document).on("focus","#form-search",function(){if($("#form-search")[0].setSelectionRange){$("#form-search")[0].setSelectionRange($("#form-search").val().length,$("#form-search").val().length)}})};f.prototype.listen=function(){var y=this;$(document).on("click",".filter-helper",function(B){B.preventDefault();var A=$(this).data("filter");var z=$(this).data("append-filter");if(z){A=$("#form-search").val()+" "+z}$("#form-search").val(A);if($("#board").length){y.app.board.reloadFilters(A)}else{$("form.search").submit()}})};f.prototype.keyboardShortcuts=function(){var y=this;Mousetrap.bind("v o",function(A){var z=$(".view-overview");if(z.length){window.location=z.attr("href")}});Mousetrap.bind("v b",function(A){var z=$(".view-board");if(z.length){window.location=z.attr("href")}});Mousetrap.bind("v c",function(A){var z=$(".view-calendar");if(z.length){window.location=z.attr("href")}});Mousetrap.bind("v l",function(A){var z=$(".view-listing");if(z.length){window.location=z.attr("href")}});Mousetrap.bind("v g",function(A){var z=$(".view-gantt");if(z.length){window.location=z.attr("href")}});Mousetrap.bind("f",function(A){A.preventDefault();var z=document.getElementById("form-search");if(z){z.focus()}});Mousetrap.bind("r",function(A){A.preventDefault();var z=$(".filter-reset").data("filter");$("#form-search").val(z);if($("#board").length){y.app.board.reloadFilters(z)}else{$("form.search").submit()}})};function m(){this.board=new k(this);this.markdown=new l();this.search=new f(this);this.swimlane=new g();this.dropdown=new r();this.tooltip=new q(this);this.popover=new t(this);this.task=new a();this.project=new n();this.subtask=new e(this);this.file=new v(this);this.keyboardShortcuts();this.chosen();this.poll();$(".alert-fade-out").delay(4000).fadeOut(800,function(){$(this).remove()});var y=false;$("select.task-reload-project-destination").change(function(){if(!y){$(".loading-icon").show();y=true;window.location=$(this).data("redirect").replace(/PROJECT_ID/g,$(this).val())}})}m.prototype.listen=function(){this.project.listen();this.popover.listen();this.markdown.listen();this.tooltip.listen();this.dropdown.listen();this.search.listen();this.task.listen();this.swimlane.listen();this.subtask.listen();this.file.listen();this.search.focus();this.autoComplete();this.datePicker();this.focus()};m.prototype.refresh=function(){$(document).off();this.listen()};m.prototype.focus=function(){$("[autofocus]").each(function(y,z){$(this).focus()});$(document).on("focus",".auto-select",function(){$(this).select()});$(document).on("mouseup",".auto-select",function(y){y.preventDefault()})};m.prototype.poll=function(){window.setInterval(this.checkSession,60000)};m.prototype.keyboardShortcuts=function(){var y=this;Mousetrap.bindGlobal("mod+enter",function(){$("form").submit()});Mousetrap.bind("b",function(z){z.preventDefault();$("#board-selector").trigger("chosen:open")});Mousetrap.bindGlobal("esc",function(){y.popover.close();y.dropdown.close()})};m.prototype.checkSession=function(){if(!$(".form-login").length){$.ajax({cache:false,url:$("body").data("status-url"),statusCode:{401:function(){window.location=$("body").data("login-url")}}})}};m.prototype.datePicker=function(){$.datepicker.setDefaults($.datepicker.regional[$("body").data("js-lang")]);$(".form-date").datepicker({showOtherMonths:true,selectOtherMonths:true,dateFormat:"yy-mm-dd",constrainInput:false});$(".form-datetime").datetimepicker({controlType:"select",oneLine:true,dateFormat:"yy-mm-dd",constrainInput:false})};m.prototype.autoComplete=function(){$(".autocomplete").each(function(){var z=$(this);var A=z.data("dst-field");var y=z.data("dst-extra-field");if($("#form-"+A).val()==""){z.parent().find("input[type=submit]").attr("disabled","disabled")}z.autocomplete({source:z.data("search-url"),minLength:1,select:function(B,C){$("input[name="+A+"]").val(C.item.id);if(y){$("input[name="+y+"]").val(C.item[y])}z.parent().find("input[type=submit]").removeAttr("disabled")}})})};m.prototype.chosen=function(){$(".chosen-select").each(function(){var y=$(this).data("search-threshold");if(y===undefined){y=10}$(this).chosen({width:"180px",no_results_text:$(this).data("notfound"),disable_search_threshold:y})});$(".select-auto-redirect").change(function(){var y=new RegExp($(this).data("redirect-regex"),"g");window.location=$(this).data("redirect-url").replace(y,$(this).val())})};m.prototype.showLoadingIcon=function(){$("body").append('
')};m.prototype.hideLoadingIcon=function(){$("#app-loading-icon").remove()};m.prototype.isVisible=function(){var y="";if(typeof document.hidden!=="undefined"){y="visibilityState"}else{if(typeof document.mozHidden!=="undefined"){y="mozVisibilityState"}else{if(typeof document.msHidden!=="undefined"){y="msVisibilityState"}else{if(typeof document.webkitHidden!=="undefined"){y="webkitVisibilityState"}}}}if(y!=""){return document[y]=="visible"}return true};m.prototype.formatDuration=function(y){if(y>=86400){return Math.round(y/86400)+"d"}else{if(y>=3600){return Math.round(y/3600)+"h"}else{if(y>=60){return Math.round(y/60)+"m"}}}return y+"s"};function d(){this.pasteCatcher=null}d.prototype.execute=function(){this.initialize()};d.prototype.initialize=function(){this.destroy();if(!window.Clipboard){this.pasteCatcher=document.createElement("div");this.pasteCatcher.id="screenshot-pastezone";this.pasteCatcher.contentEditable="true";this.pasteCatcher.style.opacity=0;this.pasteCatcher.style.position="fixed";this.pasteCatcher.style.top=0;this.pasteCatcher.style.right=0;this.pasteCatcher.style.width=0;document.body.insertBefore(this.pasteCatcher,document.body.firstChild);this.pasteCatcher.focus();document.addEventListener("click",this.setFocus.bind(this));document.getElementById("screenshot-zone").addEventListener("click",this.setFocus.bind(this))}window.addEventListener("paste",this.pasteHandler.bind(this))};d.prototype.destroy=function(){if(this.pasteCatcher!=null){document.body.removeChild(this.pasteCatcher)}else{if(document.getElementById("screenshot-pastezone")){document.body.removeChild(document.getElementById("screenshot-pastezone"))}}document.removeEventListener("click",this.setFocus.bind(this));this.pasteCatcher=null};d.prototype.setFocus=function(){if(this.pasteCatcher!==null){this.pasteCatcher.focus()}};d.prototype.pasteHandler=function(D){if(D.clipboardData&&D.clipboardData.items){var B=D.clipboardData.items;if(B){for(var C=0;C
0){$("#file-upload-button").prop("disabled",false);$("#file-dropzone-inner").hide();var C=jQuery("",{id:"file-list"});for(var B=0;B",{id:"file-percentage-"+B}).append("(0%)");var A=jQuery("