(function(){var properties=['direction','boxSizing','width','height','overflowX','overflowY','borderTopWidth','borderRightWidth','borderBottomWidth','borderLeftWidth','borderStyle','paddingTop','paddingRight','paddingBottom','paddingLeft','fontStyle','fontVariant','fontWeight','fontStretch','fontSize','fontSizeAdjust','lineHeight','fontFamily','textAlign','textTransform','textIndent','textDecoration','letterSpacing','wordSpacing','tabSize','MozTabSize'];var isBrowser=(typeof window!=='undefined');var isFirefox=(isBrowser&&window.mozInnerScreenX!=null);function getCaretCoordinates(element,position,options){if(!isBrowser){throw new Error('textarea-caret-position#getCaretCoordinates should only be called in a browser')} var debug=options&&options.debug||!1;if(debug){var el=document.querySelector('#input-textarea-caret-position-mirror-div');if(el)el.parentNode.removeChild(el)} var div=document.createElement('div');div.id='input-textarea-caret-position-mirror-div';document.body.appendChild(div);var style=div.style;var computed=window.getComputedStyle?window.getComputedStyle(element):element.currentStyle;var isInput=element.nodeName==='INPUT';style.whiteSpace='pre-wrap';if(!isInput) style.wordWrap='break-word';style.position='absolute';if(!debug) style.visibility='hidden';properties.forEach(function(prop){if(isInput&&prop==='lineHeight'){style.lineHeight=computed.height}else{style[prop]=computed[prop]}});if(isFirefox){if(element.scrollHeight>parseInt(computed.height)) style.overflowY='scroll'}else{style.overflow='hidden'} div.textContent=element.value.substring(0,position);if(isInput) div.textContent=div.textContent.replace(/\s/g,'\u00a0');var span=document.createElement('span');span.textContent=element.value.substring(position)||'.';div.appendChild(span);var coordinates={top:span.offsetTop+parseInt(computed.borderTopWidth),left:span.offsetLeft+parseInt(computed.borderLeftWidth),height:parseInt(computed.lineHeight)};if(debug){span.style.backgroundColor='#aaa'}else{document.body.removeChild(div)} return coordinates} if(typeof module!='undefined'&&typeof module.exports!='undefined'){module.exports=getCaretCoordinates}else if(isBrowser){window.getCaretCoordinates=getCaretCoordinates}}());(function(){var keyboardeventKeyPolyfill={polyfill:polyfill,keys:{3:'Cancel',6:'Help',8:'Backspace',9:'Tab',12:'Clear',13:'Enter',16:'Shift',17:'Control',18:'Alt',19:'Pause',20:'CapsLock',27:'Escape',28:'Convert',29:'NonConvert',30:'Accept',31:'ModeChange',32:' ',33:'PageUp',34:'PageDown',35:'End',36:'Home',37:'ArrowLeft',38:'ArrowUp',39:'ArrowRight',40:'ArrowDown',41:'Select',42:'Print',43:'Execute',44:'PrintScreen',45:'Insert',46:'Delete',48:['0',')'],49:['1','!'],50:['2','@'],51:['3','#'],52:['4','$'],53:['5','%'],54:['6','^'],55:['7','&'],56:['8','*'],57:['9','('],91:'OS',93:'ContextMenu',144:'NumLock',145:'ScrollLock',181:'VolumeMute',182:'VolumeDown',183:'VolumeUp',186:[';',':'],187:['=','+'],188:[',','<'],189:['-','_'],190:['.','>'],191:['/','?'],192:['`','~'],219:['[','{'],220:['\\','|'],221:[']','}'],222:["'",'"'],224:'Meta',225:'AltGraph',246:'Attn',247:'CrSel',248:'ExSel',249:'EraseEof',250:'Play',251:'ZoomOut'}};var i;for(i=1;i<25;i++){keyboardeventKeyPolyfill.keys[111+i]='F'+i} var letter='';for(i=65;i<91;i++){letter=String.fromCharCode(i);keyboardeventKeyPolyfill.keys[i]=[letter.toLowerCase(),letter.toUpperCase()]} function polyfill(){if(!('KeyboardEvent' in window)||'key' in KeyboardEvent.prototype){return!1} var proto={get:function(x){var key=keyboardeventKeyPolyfill.keys[this.which||this.keyCode];if(Array.isArray(key)){key=key[+this.shiftKey]} return key}};Object.defineProperty(KeyboardEvent.prototype,'key',proto);return proto} keyboardeventKeyPolyfill.polyfill()})();if(!Element.prototype.matches){Element.prototype.matches=Element.prototype.matchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector||Element.prototype.webkitMatchesSelector||function(s){var matches=(this.document||this.ownerDocument).querySelectorAll(s),i=matches.length;while(--i>=0&&matches.item(i)!==this){} return i>-1}} var KB={components:{},utils:{},html:{},http:{},listeners:{clicks:{},changes:{},keys:[],internals:{}}};KB.on=function(eventType,callback){if(!this.listeners.internals.hasOwnProperty(eventType)){this.listeners.internals[eventType]=[]} this.listeners.internals[eventType].push(callback)};KB.trigger=function(eventType,eventData){if(this.listeners.internals.hasOwnProperty(eventType)){for(var i=0;i0){var reset=!0;for(var i=0;i-1){window.location=redirect.split('#')[0]}else if(redirect){window.location=redirect}else if(location){window.location=location}else if(request.getResponseHeader('Content-Type')==='application/json'){try{return JSON.parse(request.responseText)}catch(e){}} return request.responseText} this.execute=function(){var request=new XMLHttpRequest();request.open(method,url,!0);request.setRequestHeader('X-Requested-With','XMLHttpRequest');for(var header in headers){if(headers.hasOwnProperty(header)){request.setRequestHeader(header,headers[header])}} request.onerror=function(){errorCallback()};request.onreadystatechange=function(){if(request.readyState===XMLHttpRequest.DONE){var response=parseResponse(request);switch(request.status){case 200:successCallback(response);return;case 401:authErrorCallback(response);errorCallback(response);break;case 0:netErrorCallback(response);errorCallback(response);break;default:errorCallback(response);break}}};request.send(body);return this};this.success=function(callback){successCallback=callback;return this};this.authError=function(callback){authErrorCallback=callback;return this};this.netError=function(callback){netErrorCallback=callback;return this};this.error=function(callback){errorCallback=callback;return this}};KB.http.get=function(url){return(new KB.http.request('GET',url)).execute()};KB.http.postJson=function(url,body){var headers={'Content-Type':'application/json','Accept':'application/json'};return(new KB.http.request('POST',url,headers,JSON.stringify(body))).execute()};KB.http.postForm=function(url,formElement){var formData=new FormData(formElement);return(new KB.http.request('POST',url,{},formData)).execute()};KB.http.uploadFile=function(url,file,csrf,onProgress,onComplete,onError,onServerError){var fd=new FormData();fd.append('files[]',file);fd.append('csrf_token',csrf);var xhr=new XMLHttpRequest();xhr.upload.addEventListener('progress',onProgress);xhr.upload.addEventListener('error',onError);xhr.open('POST',url,!0);xhr.setRequestHeader('X-Requested-With','XMLHttpRequest');xhr.onreadystatechange=function(){if(xhr.readyState===XMLHttpRequest.DONE){if(xhr.status===200){onComplete()}else if(typeof onServerError!=='undefined'){onServerError(JSON.parse(xhr.responseText))}}};xhr.send(fd)};(function(){var isOpen=!1;function onOverlayClick(e){if(e.target.matches('#modal-overlay')){e.stopPropagation();e.preventDefault();destroy()}} function onCloseButtonClick(){KB.trigger('modal.close')} function onFormSubmit(){KB.trigger('modal.loading');submitForm()} function getForm(){return document.querySelector('#modal-content form:not(.js-modal-ignore-form)')} function submitForm(){var form=getForm();if(form){var url=form.getAttribute('action');if(url){KB.http.postForm(url,form).success(function(response){KB.trigger('modal.stop');if(response){replace(response)}else{destroy()}}).error(function(response){KB.trigger('modal.stop');if(response.hasOwnProperty('message')){window.alert(response.message)}})}}} function afterRendering(){var formElement=KB.find('#modal-content form');if(formElement){formElement.on('submit',onFormSubmit,!1)} var autoFocusElement=document.querySelector('#modal-content input[autofocus]');if(autoFocusElement){autoFocusElement.focus()} KB.render();_KB.datePicker();_KB.autoComplete();_KB.tagAutoComplete();_KB.get('Task').onPopoverOpened();KB.trigger('modal.afterRender')} function replace(html){var contentElement=KB.find('#modal-content');if(contentElement){contentElement.replace(KB.dom('div').attr('id','modal-content').html(html).build());afterRendering()}} function create(html,width,overlayClickDestroy){var closeButtonElement=KB.dom('a').attr('href','#').attr('id','modal-close-button').html('').click(onCloseButtonClick).build();var headerElement=KB.dom('div').attr('id','modal-header').add(closeButtonElement).build();var contentElement=KB.dom('div').attr('id','modal-content').html(html).build();var boxElement=KB.dom('div').attr('id','modal-box').style('width',width).add(headerElement).add(contentElement).build();var overlayElement=KB.dom('div').attr('id','modal-overlay').add(boxElement).build();if(overlayClickDestroy){overlayElement.addEventListener('click',onOverlayClick,!1)} document.body.appendChild(overlayElement);afterRendering()} function destroy(){isOpen=!1;var overlayElement=KB.find('#modal-overlay');if(overlayElement){KB.trigger('modal.beforeDestroy');overlayElement.remove()}} function getWidth(size){var viewport=KB.utils.getViewportSize();if(viewport.width<700){return'99%'} switch(size){case 'large':return viewport.width<1350?'98%':'1350px';case 'medium':return viewport.width<1024?'70%':'1024px'} return viewport.width<800?'75%':'800px'} KB.on('modal.close',function(){destroy()});KB.on('modal.submit',function(){submitForm()});KB.modal={open:function(url,size,overlayClickDestroy){KB.trigger('modal.open');_KB.get('Dropdown').close();destroy();if(typeof overlayClickDestroy==='undefined'){overlayClickDestroy=!0} KB.http.get(url).success(function(response){isOpen=!0;create(response,getWidth(size),overlayClickDestroy)})},close:function(){destroy()},isOpen:function(){return isOpen},replace:function(url){KB.http.get(url).success(function(response){replace(response)})},getForm:getForm,submitForm:submitForm}}());KB.tooltip=function(){function onMouseOver(event){if(!exists()){create(event.target)}} function onMouseLeaveContainer(){setTimeout(destroy,500)} function mouseLeftParent(){setTimeout(destroyIfNotOnTooltip,500)} function mouseOnTooltip(){document.getElementById("tooltip-container").mouseOnTooltip=!0} function destroyIfNotOnTooltip(){var div=document.getElementById("tooltip-container");if(div!=null&&!div.mouseOnTooltip)destroy()} function create(element){var contentElement=element.querySelector("script");if(contentElement){render(element,contentElement.innerHTML);return} var link=element.dataset.href;if(link){fetch(link,function(html){if(html){render(element,html)}})}} function fetch(url,callback){var request=new XMLHttpRequest();request.open("GET",url,!0);request.setRequestHeader("X-Requested-With","XMLHttpRequest");request.onreadystatechange=function(){if(request.readyState===XMLHttpRequest.DONE){if(request.status===200){callback(request.responseText)}}};request.send(null)} function render(element,html){var containerElement=document.createElement("div");containerElement.id="tooltip-container";containerElement.innerHTML=html;containerElement.addEventListener("mouseleave",onMouseLeaveContainer,!1);containerElement.addEventListener("mouseenter",mouseOnTooltip,!1);containerElement.mouseOnTooltip=!1;var elementRect=element.getBoundingClientRect();var top=elementRect.top+window.scrollY+elementRect.height;containerElement.style.top=top+"px";if(elementRect.left>(window.innerWidth-600)){var right=window.innerWidth-elementRect.right-window.scrollX;containerElement.style.right=right+"px"}else{var left=elementRect.left+window.scrollX;containerElement.style.left=left+"px"} document.body.appendChild(containerElement);document.body.onclick=function(event){if(!containerElement.contains(event.target)){destroy()}}} function destroy(){var element=document.getElementById("tooltip-container");if(element){element.parentNode.removeChild(element)}} function exists(){return!!document.getElementById("tooltip-container")} var elements=document.querySelectorAll(".tooltip");for(var i=0;i=86400){return Math.round(d/86400)+"d"}else if(d>=3600){return Math.round(d/3600)+"h"}else if(d>=60){return Math.round(d/60)+"m"} return d+"s"};KB.utils.getSelectionPosition=function(element){var selectionStart,selectionEnd;if(element.value.length0){columns.push([currentValue])}}else{if(j>0){columns[j].push(currentValue);if(typeof columns[0][i]==='undefined'){columns[0].push(0)} columns[0][i]+=currentValue}else{categories.push(outputFormat(inputFormat.parse(currentValue)))}}}} KB.dom(containerElement).add(KB.dom('div').attr('id','chart').build());c3.generate({data:{columns:columns},axis:{x:{type:'category',categories:categories}}})}});KB.component('chart-project-cumulative-flow',function(containerElement,options){this.render=function(){var metrics=options.metrics;var columns=[];var groups=[];var categories=[];var inputFormat=d3.time.format("%Y-%m-%d");var outputFormat=d3.time.format(options.dateFormat);for(var i=0;i0){groups.push(currentValue);columns.push([currentValue])}}else{if(j>0){columns[j-1].push(currentValue)}else{categories.push(outputFormat(inputFormat.parse(currentValue)))}}}} KB.dom(containerElement).add(KB.dom('div').attr('id','chart').build());c3.generate({data:{columns:columns.reverse(),type:'area-spline',groups:[groups],order:null},axis:{x:{type:'category',categories:categories}}})}});KB.component('chart-project-lead-cycle-time',function(containerElement,options){this.render=function(){var metrics=options.metrics;var cycle=[options.labelCycle];var lead=[options.labelLead];var categories=[];var types={};types[options.labelCycle]='area';types[options.labelLead]='area-spline';var colors={};colors[options.labelLead]='#afb42b';colors[options.labelCycle]='#4e342e';for(var i=0;i');$.ajax({cache:!1,url:options.url,success:function(data){KB.dom(containerElement).html('
'+data+'
')}})}});KB.component('file-upload',function(containerElement,options){var inputFileElement=null;var dropzoneElement=null;var files=[];var currentFileIndex=0;function onProgress(e){if(e.lengthComputable){var progress=e.loaded/e.total;var percentage=Math.floor(progress*100);KB.find('#file-progress-'+currentFileIndex).attr('value',progress);KB.find('#file-percentage-'+currentFileIndex).replaceText('('+percentage+'%)')}} function onError(){var errorElement=KB.dom('div').addClass('file-error').text(options.labelUploadError).build();KB.find('#file-item-'+currentFileIndex).add(errorElement)} function onServerError(response){var errorElement=KB.dom('div').addClass('file-error').text(response.message).build();KB.find('#file-item-'+currentFileIndex).add(errorElement);KB.trigger('modal.stop')} function onComplete(){currentFileIndex++;if(currentFileIndex0){KB.http.uploadFile(options.url,files[currentFileIndex],options.csrf,onProgress,onComplete,onError,onServerError)}} function showFiles(){if(files.length>0){KB.trigger('modal.enable');KB.dom(dropzoneElement).empty().add(buildFileListElement())}else{KB.trigger('modal.disable');KB.dom(dropzoneElement).empty().add(buildInnerDropzoneElement())}} function buildFileInputElement(){return KB.dom('input').attr('id','file-input-element').attr('type','file').attr('name','files[]').attr('multiple',!0).on('change',onFileChange).hide().build()} function buildInnerDropzoneElement(){var dropzoneLinkElement=KB.dom('a').attr('href','#').text(options.labelChooseFiles).click(onClickFileBrowser).build();return KB.dom('div').attr('id','file-dropzone-inner').text(options.labelDropzone+' '+options.labelOr+' ').add(dropzoneLinkElement).build()} function buildDropzoneElement(){var dropzoneElement=KB.dom('div').attr('id','file-dropzone').add(buildInnerDropzoneElement()).build();dropzoneElement.ondragover=onDragOver;dropzoneElement.ondrop=onDrop;dropzoneElement.ondragover=onDragOver;return dropzoneElement} function buildFileListItem(index){var isOversize=!1;var progressElement=KB.dom('progress').attr('id','file-progress-'+index).attr('value',0).build();var percentageElement=KB.dom('span').attr('id','file-percentage-'+index).text('(0%)').build();var deleteElement=KB.dom('span').attr('id','file-delete-'+index).html('').on('click',function(){files.splice(index,1);KB.find('#file-item-'+index).remove();showFiles()}).build();var itemElement=KB.dom('li').attr('id','file-item-'+index).add(deleteElement).add(progressElement).text(' '+files[index].name+' ').add(percentageElement);if(files[index].size>options.maxSize){itemElement.add(KB.dom('div').addClass('file-error').text(options.labelOversize).build());isOversize=!0} if(isOversize){KB.trigger('modal.disable')} return itemElement.build()} function buildFileListElement(){var fileListElement=KB.dom('ul').attr('id','file-list').build();for(var i=0;i=options.images.length){index=0} currentImage=options.images[index];break}} renderSlide()} function renderPreviousSlide(){destroySlide();for(var i=0;i1){if(document.activeElement.tagName==='INPUT'||document.activeElement.tagName==='TEXTAREA'){$(document.activeElement).parents("form").submit()}}}} KB.onKey('?',function(){if(!KB.modal.isOpen()){KB.modal.open(KB.find('body').data('keyboardShortcutUrl'))}});KB.onKey('Escape',function(){if(!KB.exists('#suggest-menu')){KB.trigger('modal.close');_KB.get("Dropdown").close()}});KB.onKey('Enter',submitForm,!0,!0);KB.onKey('Enter',submitForm,!0,!1,!0);KB.onKey('b',function(){if(!KB.modal.isOpen()){KB.trigger('board.selector.open')}});if(KB.exists('#board')){KB.onKey('c',function(){if(!KB.modal.isOpen()){_KB.get('BoardHorizontalScrolling').toggle()}});KB.onKey('s',function(){if(!KB.modal.isOpen()){_KB.get('BoardCollapsedMode').toggle()}});KB.onKey('n',function(){if(!KB.modal.isOpen()){KB.modal.open(KB.find('#board').data('taskCreationUrl'),'large',!1)}})} if(KB.exists('#task-view')){KB.onKey('e',function(){if(!KB.modal.isOpen()){KB.modal.open(KB.find('#task-view').data('editUrl'),'large',!1)}});KB.onKey('c',function(){if(!KB.modal.isOpen()){KB.modal.open(KB.find('#task-view').data('commentUrl'),'medium',!1)}});KB.onKey('s',function(){if(!KB.modal.isOpen()){KB.modal.open(KB.find('#task-view').data('subtaskUrl'),'medium',!1)}});KB.onKey('l',function(){if(!KB.modal.isOpen()){KB.modal.open(KB.find('#task-view').data('internalLinkUrl'),'medium',!1)}})} KB.onKey('f',function(){if(!KB.modal.isOpen()){KB.focus('#form-search')}});KB.onKey('r',function(){if(!KB.modal.isOpen()){var reset=$(".filter-reset").data("filter");var input=$("#form-search");input.val(reset);$("form.search").submit()}});KB.onKey('v+o',function(){goToLink('a.view-overview')});KB.onKey('v+b',function(){goToLink('a.view-board')});KB.onKey('v+l',function(){goToLink('a.view-listing')})};document.addEventListener("DOMContentLoaded",function(){function selectAllItems(event){event.preventDefault();var items=document.querySelectorAll("input[data-list-item=selectable]");for(var i=0;i0){showActionMenu()}} function showActionMenu(){var element=document.querySelector(".list-item-actions");if(element){element.classList.remove("list-item-action-hidden")}} function hideActionMenu(){var element=document.querySelector(".list-item-actions");if(element&&!element.classList.contains("list-item-action-hidden")){element.classList.add("list-item-action-hidden")}} function onActionClick(event){event.preventDefault();var selectedItems=document.querySelectorAll("input[data-list-item=selectable]:checked");var taskIDs=[];for(var i=0;i0){result.index=result.index-1} KB.dom(result.items[result.index]).addClass('active')} function moveDown(){var result=resetSelection();if(result.indexvalue2?1:0)})}else{elements.sort(function(a,b){var value1=a['data-label'].toLowerCase();var value2=b['data-label'].toLowerCase();return value1value2?1:0)})} return elements} function filterItems(text,items){var filteredItems=[];var hasActiveItem=!1;for(var i=0;i-1){var item=items[i];if(typeof options.defaultValue!=='undefined'&&String(options.defaultValue)===item['data-value']){item.class+=' active';hasActiveItem=!0} filteredItems.push(item)}} if(!hasActiveItem&&filteredItems.length>0){filteredItems[0].class+=' active'} return filteredItems} function buildDropdownMenu(){var itemElements=filterItems(inputElement.value,buildItems(options.items));var componentPosition=componentElement.getBoundingClientRect();var windowPosition=document.body.scrollTop||document.documentElement.scrollTop;if(itemElements.length===0){return null} return KB.dom('ul').attr('id','select-dropdown-menu').style('top',(windowPosition+componentPosition.bottom)+'px').style('left',componentPosition.left+'px').style('width',componentPosition.width+'px').style('maxHeight',(window.innerHeight-componentPosition.bottom-20)+'px').mouseover(onItemMouseOver).click(onItemClick).for('li',itemElements).build()} function destroyDropdownMenu(){var menuElement=KB.find('#select-dropdown-menu');if(menuElement!==null){menuElement.remove()} document.removeEventListener('keydown',onKeyDown,!1);document.removeEventListener('click',onDocumentClick,!1)} function renderDropdownMenu(){var element=buildDropdownMenu();if(element!==null){document.body.appendChild(element)} document.addEventListener('keydown',onKeyDown,!1);document.addEventListener('click',onDocumentClick,!1)} function getPlaceholderValue(){if(options.defaultValue&&options.defaultValue in options.items){return options.items[options.defaultValue]} if(options.placeholder){return options.placeholder} return''} this.render=function(){KB.on('select.dropdown.loading.start',onLoadingStart);KB.on('select.dropdown.loading.stop',onLoadingStop);KB.on('modal.close',function(){KB.removeListener('select.dropdown.loading.start',onLoadingStart);KB.removeListener('select.dropdown.loading.stop',onLoadingStop)});chevronIconElement=KB.dom('i').attr('class','fa fa-chevron-down select-dropdown-chevron').click(toggleDropdownMenu).build();loadingIconElement=KB.dom('span').hide().addClass('select-loading-icon').add(KB.dom('i').attr('class','fa fa-spinner fa-pulse').build()).build();inputHiddenElement=KB.dom('input').attr('type','hidden').attr('name',options.name).attr('value',options.defaultValue||'').build();inputElement=KB.dom('input').attr('type','text').attr('placeholder',getPlaceholderValue()).addClass('select-dropdown-input').on('focus',toggleDropdownMenu).on('input',onInputChanged,!0).build();componentElement=KB.dom('div').addClass('select-dropdown-input-container').add(inputHiddenElement).add(inputElement).add(chevronIconElement).add(loadingIconElement).build();containerElement.appendChild(componentElement);if(options.onFocus){options.onFocus.forEach(function(eventName){KB.on(eventName,function(){inputElement.focus()})})} window.addEventListener('scroll',onScroll,!1)}});KB.interval(60,function(){var statusUrl=KB.find('body').data('statusUrl');var loginUrl=KB.find('body').data('loginUrl');if(KB.find('.form-login')===null){KB.http.get(statusUrl).authError(function(){window.location=loginUrl})}});KB.component('submit-buttons',function(containerElement,options){var isLoading=!1;var isDisabled=options.disabled||!1;var submitLabel=options.submitLabel;var formActionElement=null;var submitButtonElement=null;function onSubmit(){isLoading=!0;replaceButton();KB.trigger('modal.submit')} function onCancel(){KB.trigger('modal.close')} function onStop(){isLoading=!1;replaceButton()} function onDisable(){isLoading=!1;isDisabled=!0;replaceButton()} function onEnable(){isLoading=!1;isDisabled=!1;replaceButton()} function onHide(){KB.dom(formActionElement).hide()} function onUpdateSubmitLabel(eventData){submitLabel=eventData.submitLabel;replaceButton()} function buildButton(){var button=KB.dom('button').attr('type','submit').attr('class','btn btn-'+(options.color||'blue'));if(KB.modal.isOpen()){button.click(onSubmit)} if(options.tabindex){button.attr('tabindex',options.tabindex)} if(isLoading){button.disable().add(KB.dom('i').attr('class','fa fa-spinner fa-pulse').build()).text(' ')} if(isDisabled){button.disable()} return button.text(submitLabel).build()} function replaceButton(){var buttonElement=buildButton();KB.dom(submitButtonElement).replace(buttonElement);submitButtonElement=buttonElement} this.render=function(){KB.on('modal.stop',onStop);KB.on('modal.disable',onDisable);KB.on('modal.enable',onEnable);KB.on('modal.hide',onHide);KB.on('modal.submit.label',onUpdateSubmitLabel);KB.on('modal.close',function(){KB.removeListener('modal.stop',onStop);KB.removeListener('modal.disable',onDisable);KB.removeListener('modal.enable',onEnable);KB.removeListener('modal.hide',onHide);KB.removeListener('modal.submit.label',onUpdateSubmitLabel)});submitButtonElement=buildButton();var formActionElementBuilder=KB.dom('div').attr('class','form-actions').add(submitButtonElement);if(KB.modal.isOpen()){formActionElementBuilder.text(' '+options.orLabel+' ').add(KB.dom('a').attr('href','#').click(onCancel).text(options.cancelLabel).build())} formActionElement=formActionElementBuilder.build();containerElement.appendChild(formActionElement)}});KB.on('dom.ready',function(){function savePosition(subtaskId,position){var url=$(".subtasks-table").data("save-position-url");$.ajax({cache:!1,url:url,contentType:"application/json",type:"POST",processData:!1,data:JSON.stringify({"subtask_id":subtaskId,"position":position})})} $(".draggable-row-handle").mouseenter(function(){$(this).parent().parent().addClass("draggable-item-hover")}).mouseleave(function(){$(this).parent().parent().removeClass("draggable-item-hover")});$(".subtasks-table tbody").sortable({forcePlaceholderSize:!0,handle:"td:first i",helper:function(e,ui){ui.children().each(function(){$(this).width($(this).width())});return ui},stop:function(event,ui){var subtask=ui.item;subtask.removeClass("draggable-item-selected");savePosition(subtask.data("subtask-id"),subtask.index()+1)},start:function(event,ui){ui.item.addClass("draggable-item-selected")}}).disableSelection()});KB.on('dom.ready',function(){$(document).on('click','.js-subtask-toggle-status',function(e){var el=$(this);var url=el.attr('href');e.preventDefault();$.ajax({cache:!1,url:url,success:function(data){if(url.indexOf('fragment=table')!=-1){$('.subtasks-table').replaceWith(data)}else if(url.indexOf('fragment=rows')!=-1){$(el).closest('.task-list-subtasks').replaceWith(data)}else{$(el).closest('.subtask-title').replaceWith(data)}}})});$(document).on('click','.js-subtask-toggle-timer',function(e){var el=$(this);e.preventDefault();$.ajax({cache:!1,url:el.attr('href'),success:function(data){$(el).closest('.subtask-time-tracking').replaceWith(data)}})})});KB.component('suggest-menu',function(containerElement,options){function onKeyDown(e){switch(KB.utils.getKey(e)){case 'Escape':destroy();break;case 'ArrowUp':e.preventDefault();e.stopImmediatePropagation();moveUp();break;case 'ArrowDown':e.preventDefault();e.stopImmediatePropagation();moveDown();break;case 'Enter':e.preventDefault();e.stopImmediatePropagation();insertSelectedItem();break}} function onClick(){insertSelectedItem()} function onMouseOver(element){if(KB.dom(element).hasClass('suggest-menu-item')){KB.find('.suggest-menu-item.active').removeClass('active');KB.dom(element).addClass('active')}} function insertSelectedItem(){containerElement.focus();var element=KB.find('.suggest-menu-item.active');var value=element.data('value');var trigger=element.data('trigger');var content=containerElement.value;var text=getLastWord(containerElement);var substitute=trigger+value+' ';var selectionPosition=KB.utils.getSelectionPosition(containerElement);var before=content.substring(0,selectionPosition.selectionStart-text.length);var after=content.substring(selectionPosition.selectionEnd);var position=before.length+substitute.length;containerElement.value=before+substitute+after;containerElement.setSelectionRange(position,position);destroy()} function getLastWord(element){var lines=element.value.substring(0,element.selectionEnd).split("\n");var lastLine=lines[lines.length-1];var words=lastLine.split(' ');return words[words.length-1]} function getParentElement(){var selectors=['#modal-content form','#modal-content','body'];for(var i=0;i0){result.index=result.index-1} KB.dom(result.items[result.index]).addClass('active')} function moveDown(){var result=resetSelection();if(result.index0){renderMenu(buildItems(trigger,items))}} function filterItems(text,items){var filteredItems=[];if(text.length===0){return items} for(var i=0;i0){container.add(KB.html.label(options.positionLabel,'form-position')).add(KB.dom('select').attr('id','form-position').for('option',tasks).build()).add(KB.html.radio(options.beforeLabel,'positionChoice','before')).add(KB.html.radio(options.afterLabel,'positionChoice','after'))} return container.build()} this.render=function(){KB.on('modal.submit',onSubmit);KB.on('modal.close',function(){KB.removeListener('modal.submit',onSubmit)});var form=KB.dom('div').add(KB.dom('div').attr('id','message-container').build()).add(KB.html.label(options.swimlaneLabel,'form-swimlanes')).add(buildSwimlaneSelect()).add(KB.html.label(options.columnLabel,'form-columns')).add(buildColumnSelect()).add(buildTasks()).build();containerElement.appendChild(form)}});KB.onClick('.js-template',function(e){var template=KB.dom(e.target).data('template');var target=KB.dom(e.target).data('templateTarget');var targetField=KB.find(target);if(targetField){targetField.build().value=template} _KB.controllers.Dropdown.close()});KB.component('text-editor',function(containerElement,options){var textarea,viewModeElement,writeModeElement,previewElement,selectionStart,selectionEnd;this.render=function(){writeModeElement=buildWriteMode();viewModeElement=buildViewMode();containerElement.appendChild(KB.dom('div').attr('class','text-editor').add(viewModeElement).add(writeModeElement).build());if(options.autofocus){textarea.focus()}};function buildViewMode(){var toolbarElement=KB.dom('div').attr('class','text-editor-toolbar').for('a',[{href:'#',html:' '+options.labelWrite,click:function(){toggleViewMode()}}]).build();previewElement=KB.dom('div').attr('class','text-editor-preview-area markdown').build();return KB.dom('div').attr('class','text-editor-view-mode').add(toolbarElement).add(previewElement).hide().build()} function buildWriteMode(){var toolbarElement=KB.dom('div').attr('class','text-editor-toolbar').for('a',[{href:'#',html:' '+options.labelPreview,click:function(){toggleViewMode()}},{href:'#',html:'',click:function(){insertEnclosedTag('**')}},{href:'#',html:'',click:function(){insertEnclosedTag('_')}},{href:'#',html:'',click:function(){insertEnclosedTag('~~')}},{href:'#',html:'',click:function(){insertLinkTag()}},{href:'#',html:'',click:function(){insertPrependTag('> ')}},{href:'#',html:'',click:function(){insertPrependTag('* ')}},{href:'#',html:'',click:function(){insertBlockTag('```')}}]).build();var textareaElement=KB.dom('textarea');textareaElement.attr('name',options.name);if(options.tabindex){textareaElement.attr('tabindex',options.tabindex)} if(options.required){textareaElement.attr('required','required')} var textWrapper=KB.dom(containerElement).find('script');textareaElement.html(textWrapper.innerHTML);if(options.placeholder){textareaElement.attr('placeholder',options.placeholder)} textarea=textareaElement.build();if(options.suggestOptions){KB.getComponent('suggest-menu',textarea,options.suggestOptions).render()} return KB.dom('div').attr('class','text-editor-write-mode').add(toolbarElement).add(textarea).build()} function toggleViewMode(){KB.dom(previewElement).html(marked(textarea.value,{sanitize:!0}));KB.dom(viewModeElement).toggle();KB.dom(writeModeElement).toggle()} function getSelectedText(){return textarea.value.substring(textarea.selectionStart,textarea.selectionEnd)} function replaceTextRange(s,start,end,substitute){return s.substring(0,start)+substitute+s.substring(end)} function insertEnclosedTag(tag){var selectedText=getSelectedText();insertText(tag+selectedText+tag);setCursorBeforeClosingTag(tag)} function insertBlockTag(tag){var selectedText=getSelectedText();insertText('\n'+tag+'\n'+selectedText+'\n'+tag);setCursorBeforeClosingTag(tag,2)} function insertPrependTag(tag){var selectedText=getSelectedText();if(selectedText.indexOf('\n')===-1){insertText('\n'+tag+selectedText)}else{var lines=selectedText.split('\n');for(var i=0;i0){linkLabel=selectedText;selectionStartOffset=-1*(linkUrl.length+1);selectionEndOffset=selectionStartOffset+linkUrl.length} insertText('['+linkLabel+']('+linkUrl+')');var selectionPosition=KB.utils.getSelectionPosition(textarea);var currentSelectionStart=selectionPosition.selectionStart;textarea.setSelectionRange(currentSelectionStart+selectionStartOffset,currentSelectionStart+selectionEndOffset)} function insertText(replacedText){textarea.focus();var result=!1;var selectionPosition=KB.utils.getSelectionPosition(textarea);selectionStart=selectionPosition.selectionStart;selectionEnd=selectionPosition.selectionEnd;if(document.queryCommandSupported('insertText')){result=document.execCommand('insertText',!1,replacedText)} if(!result){try{document.execCommand('ms-beginUndoUnit')}catch(error){} textarea.value=replaceTextRange(textarea.value,selectionStart,selectionEnd,replacedText);try{document.execCommand('ms-endUndoUnit')}catch(error){}}} function setCursorBeforeClosingTag(tag,offset){offset=offset||0;var position=selectionEnd+tag.length+offset;textarea.setSelectionRange(position,position)}});document.addEventListener('DOMContentLoaded',function(){KB.render();KB.listen();KB.keyboardShortcuts();KB.tooltip();KB.trigger('dom.ready')});var Kanboard={};Kanboard.App=function(){this.controllers={}};Kanboard.App.prototype.get=function(controller){return this.controllers[controller]};Kanboard.App.prototype.execute=function(){for(var className in Kanboard){if(className!=="App"){var controller=new Kanboard[className](this);this.controllers[className]=controller;if(typeof controller.execute==="function"){controller.execute()} if(typeof controller.listen==="function"){controller.listen()} if(typeof controller.focus==="function"){controller.focus()}}} this.focus();this.datePicker();this.autoComplete();this.tagAutoComplete()};Kanboard.App.prototype.focus=function(){$(document).on('focus','.auto-select',function(){$(this).select()});$(document).on('mouseup','.auto-select',function(e){e.preventDefault()})};Kanboard.App.prototype.datePicker=function(){var bodyElement=$("body");var dateFormat=bodyElement.data("js-date-format");var timeFormat=bodyElement.data("js-time-format");var lang=bodyElement.data("js-lang");$.datepicker.setDefaults($.datepicker.regional[lang]);$.timepicker.setDefaults($.timepicker.regional[lang]);$(".form-date").datepicker({showOtherMonths:!0,selectOtherMonths:!0,dateFormat:dateFormat,constrainInput:!1});$(".form-datetime").datetimepicker({dateFormat:dateFormat,timeFormat:timeFormat,constrainInput:!1})};Kanboard.App.prototype.tagAutoComplete=function(){$(".tag-autocomplete").select2({tags:!0})};Kanboard.App.prototype.autoComplete=function(){$(".autocomplete").each(function(){var input=$(this);var field=input.data("dst-field");var extraFields=input.data("dst-extra-fields");if($('#form-'+field).val()===''){input.parent().find("button[type=submit]").attr('disabled','disabled')} input.autocomplete({source:input.data("search-url"),minLength:1,select:function(event,ui){$("input[name="+field+"]").val(ui.item.id);if(extraFields){var fields=extraFields.split(',');for(var i=0;i ')};Kanboard.App.prototype.hideLoadingIcon=function(){$("#app-loading-icon").remove()};Kanboard.BoardCollapsedMode=function(app){this.app=app};Kanboard.BoardCollapsedMode.prototype.toggle=function(){var self=this;this.app.showLoadingIcon();$.ajax({cache:!1,url:$('.filter-display-mode:not([style="display: none;"]) a').attr('href'),success:function(data){$('.filter-display-mode').toggle();self.app.get("BoardDragAndDrop").refresh(data)}})};Kanboard.BoardColumnView=function(app){this.app=app};Kanboard.BoardColumnView.prototype.execute=function(){if(this.app.hasId("board")){this.render()}};Kanboard.BoardColumnView.prototype.listen=function(){var self=this;$(document).on("click",".board-toggle-column-view",function(){self.toggle($(this).data("column-id"))})};Kanboard.BoardColumnView.prototype.onBoardRendered=function(){this.render()};Kanboard.BoardColumnView.prototype.render=function(){var self=this;$(".board-column-header").each(function(){var columnId=$(this).data('column-id');if(localStorage.getItem("hidden_column_"+columnId)){self.hideColumn(columnId)}})};Kanboard.BoardColumnView.prototype.toggle=function(columnId){if(localStorage.getItem("hidden_column_"+columnId)){this.showColumn(columnId)}else{this.hideColumn(columnId)} this.app.get("BoardDragAndDrop").dragAndDrop()};Kanboard.BoardColumnView.prototype.hideColumn=function(columnId){$(".board-column-"+columnId+" .board-column-expanded").hide();$(".board-column-"+columnId+" .board-column-collapsed").show();$(".board-column-header-"+columnId+" .board-column-expanded").hide();$(".board-column-header-"+columnId+" .board-column-collapsed").show();$(".board-column-header-"+columnId).each(function(){$(this).removeClass("board-column-compact");$(this).addClass("board-column-header-collapsed")});$(".board-column-"+columnId).each(function(){$(this).addClass("board-column-task-collapsed")});$(".board-column-"+columnId+" .board-rotation").each(function(){$(this).css("width",$(".board-column-"+columnId+"").height())});localStorage.setItem("hidden_column_"+columnId,1)};Kanboard.BoardColumnView.prototype.showColumn=function(columnId){$(".board-column-"+columnId+" .board-column-expanded").show();$(".board-column-"+columnId+" .board-column-collapsed").hide();$(".board-column-header-"+columnId+" .board-column-expanded").show();$(".board-column-header-"+columnId+" .board-column-collapsed").hide();$(".board-column-header-"+columnId).removeClass("board-column-header-collapsed");$(".board-column-"+columnId).removeClass("board-column-task-collapsed");if(localStorage.getItem("horizontal_scroll")==0){$(".board-column-header-"+columnId).addClass("board-column-compact")} localStorage.removeItem("hidden_column_"+columnId)};Kanboard.BoardHorizontalScrolling=function(app){this.app=app};Kanboard.BoardHorizontalScrolling.prototype.execute=function(){if(this.app.hasId("board")){this.render()}};Kanboard.BoardHorizontalScrolling.prototype.listen=function(){var self=this;$(document).on('click',".filter-toggle-scrolling",function(e){e.preventDefault();self.toggle()})};Kanboard.BoardHorizontalScrolling.prototype.onBoardRendered=function(){this.render()};Kanboard.BoardHorizontalScrolling.prototype.toggle=function(){var scrolling=localStorage.getItem("horizontal_scroll")||1;localStorage.setItem("horizontal_scroll",scrolling==0?1:0);this.render()};Kanboard.BoardHorizontalScrolling.prototype.render=function(){if(localStorage.getItem("horizontal_scroll")==0){$(".filter-wide").show();$(".filter-compact").hide();$("#board-container").addClass("board-container-compact");$("#board th:not(.board-column-header-collapsed)").addClass("board-column-compact")}else{$(".filter-wide").hide();$(".filter-compact").show();$("#board-container").removeClass("board-container-compact");$("#board th").removeClass("board-column-compact")}};Kanboard.BoardPolling=function(app){this.app=app};Kanboard.BoardPolling.prototype.execute=function(){if(this.app.hasId("board")){var interval=parseInt($("#board").attr("data-check-interval"));if(interval>0){window.setInterval(this.check.bind(this),interval*1000)}}};Kanboard.BoardPolling.prototype.check=function(){if(KB.utils.isVisible()&&!this.app.get("BoardDragAndDrop").savingInProgress){var self=this;this.app.showLoadingIcon();$.ajax({cache:!1,url:$("#board").data("check-url"),statusCode:{200:function(data){self.app.get("BoardDragAndDrop").refresh(data)},304:function(){self.app.hideLoadingIcon()}}})}};Kanboard.Column=function(app){this.app=app};Kanboard.Column.prototype.listen=function(){this.dragAndDrop()};Kanboard.Column.prototype.dragAndDrop=function(){var self=this;$(".draggable-row-handle").mouseenter(function(){$(this).parent().parent().addClass("draggable-item-hover")}).mouseleave(function(){$(this).parent().parent().removeClass("draggable-item-hover")});$(".columns-table tbody").sortable({forcePlaceholderSize:!0,handle:"td:first i",helper:function(e,ui){ui.children().each(function(){$(this).width($(this).width())});return ui},stop:function(event,ui){var column=ui.item;column.removeClass("draggable-item-selected");self.savePosition(column.data("column-id"),column.index()+1)},start:function(event,ui){ui.item.addClass("draggable-item-selected")}}).disableSelection()};Kanboard.Column.prototype.savePosition=function(columnId,position){var url=$(".columns-table").data("save-position-url");var self=this;this.app.showLoadingIcon();$.ajax({cache:!1,url:url,contentType:"application/json",type:"POST",processData:!1,data:JSON.stringify({"column_id":columnId,"position":position}),complete:function(){self.app.hideLoadingIcon()}})};Kanboard.Dropdown=function(app){this.app=app};Kanboard.Dropdown.prototype.listen=function(){var self=this;$(document).on('click',function(){self.close()});$(document).on('click','.dropdown-menu',function(e){e.preventDefault();e.stopImmediatePropagation();self.close();var submenu=$(this).next('ul');var offset=$(this).offset();$("body").append(jQuery("
",{"id":"dropdown"}));submenu.clone().appendTo("#dropdown");var clone=$("#dropdown ul");clone.addClass('dropdown-submenu-open');var submenuHeight=clone.outerHeight();var submenuWidth=clone.outerWidth();if(offset.top+submenuHeight-$(window).scrollTop()<$(window).height()||$(window).scrollTop()+offset.top$(window).width()){clone.css('left',offset.left-submenuWidth+$(this).outerWidth())}else{clone.css('left',offset.left)} if(document.getElementById('dropdown')!==null){KB.trigger('dropdown.afterRender')}});$(document).on('click','.dropdown-submenu-open li',function(e){if($(e.target).is('li')){KB.trigger('dropdown.clicked');var element=$(this).find('a:visible');if(element.length>0){element[0].click()}}})};Kanboard.Dropdown.prototype.close=function(){if(document.getElementById('dropdown')!==null){KB.trigger('dropdown.beforeDestroy')} $("#dropdown").remove()};Kanboard.Search=function(app){this.app=app};Kanboard.Search.prototype.focus=function(){$(document).on("focus","#form-search",function(){var input=$("#form-search");if(input[0].setSelectionRange){var len=input.val().length*2;input[0].setSelectionRange(len,len)}})};Kanboard.Search.prototype.listen=function(){$(document).on("click",".filter-helper",function(e){e.preventDefault();var filter=$(this).data("filter");var appendFilter=$(this).data("append-filter");var uniqueFilter=$(this).data("unique-filter");var input=$("#form-search");if(uniqueFilter){var attribute=uniqueFilter.substr(0,uniqueFilter.indexOf(':'));filter=input.val().replace(new RegExp('('+attribute+':[#a-z0-9]+)','g'),'');filter=filter.replace(new RegExp('('+attribute+':"(.+)")','g'),'');filter=filter.trim();filter+=' '+uniqueFilter}else if(appendFilter){filter=input.val()+" "+appendFilter} input.val(filter);$("form.search").submit()})};Kanboard.Swimlane=function(app){this.app=app};Kanboard.Swimlane.prototype.execute=function(){if($(".swimlanes-table").length){this.dragAndDrop()}};Kanboard.Swimlane.prototype.listen=function(){var self=this;$(document).on('click',".board-swimlane-toggle",function(e){e.preventDefault();var swimlaneId=$(this).data('swimlane-id');if(self.isCollapsed(swimlaneId)){self.expand(swimlaneId)}else{self.collapse(swimlaneId)}})};Kanboard.Swimlane.prototype.onBoardRendered=function(){var swimlaneIds=this.getAllCollapsed();for(var i=0;i-1){swimlaneIds.splice(index,1)} localStorage.setItem(this.getStorageKey(),JSON.stringify(swimlaneIds));$('.board-swimlane-columns-'+swimlaneId).css('display','table-row');$('.board-swimlane-tasks-'+swimlaneId).css('display','table-row');$('.hide-icon-swimlane-'+swimlaneId).css('display','inline');$('.show-icon-swimlane-'+swimlaneId).css('display','none')};Kanboard.Swimlane.prototype.collapse=function(swimlaneId){var swimlaneIds=this.getAllCollapsed();if(swimlaneIds.indexOf(swimlaneId)<0){swimlaneIds.push(swimlaneId);localStorage.setItem(this.getStorageKey(),JSON.stringify(swimlaneIds))} $('.board-swimlane-columns-'+swimlaneId+':not(:first-child)').css('display','none');$('.board-swimlane-tasks-'+swimlaneId).css('display','none');$('.hide-icon-swimlane-'+swimlaneId).css('display','none');$('.show-icon-swimlane-'+swimlaneId).css('display','inline')};Kanboard.Swimlane.prototype.isCollapsed=function(swimlaneId){return this.getAllCollapsed().indexOf(swimlaneId)>-1};Kanboard.Swimlane.prototype.getAllCollapsed=function(){return JSON.parse(localStorage.getItem(this.getStorageKey()))||[]};Kanboard.Swimlane.prototype.dragAndDrop=function(){var self=this;$(".draggable-row-handle").mouseenter(function(){$(this).parent().parent().addClass("draggable-item-hover")}).mouseleave(function(){$(this).parent().parent().removeClass("draggable-item-hover")});$(".swimlanes-table tbody").sortable({forcePlaceholderSize:!0,handle:"td:first i",helper:function(e,ui){ui.children().each(function(){$(this).width($(this).width())});return ui},stop:function(event,ui){var swimlane=ui.item;swimlane.removeClass("draggable-item-selected");self.savePosition(swimlane.data("swimlane-id"),swimlane.index()+1)},start:function(event,ui){ui.item.addClass("draggable-item-selected")}}).disableSelection()};Kanboard.Swimlane.prototype.savePosition=function(swimlaneId,position){var url=$(".swimlanes-table").data("save-position-url");var self=this;this.app.showLoadingIcon();$.ajax({cache:!1,url:url,contentType:"application/json",type:"POST",processData:!1,data:JSON.stringify({"swimlane_id":swimlaneId,"position":position}),complete:function(){self.app.hideLoadingIcon()}})};Kanboard.Task=function(app){this.app=app};Kanboard.Task.prototype.onPopoverOpened=function(){var self=this;self.renderColorPicker();$(document).on("click",".assign-me",function(e){var currentId=$(this).data("current-id");var dropdownId="#modal-box #"+$(this).data("target-id");e.preventDefault();if($(dropdownId+' option[value='+currentId+']').length){$(dropdownId).val(currentId)}})};Kanboard.Task.prototype.renderColorPicker=function(){function renderColorOption(color){return $('
'+'
'+'
'+color.text+'
'+'
')} $(".color-picker").select2({minimumResultsForSearch:Infinity,templateResult:renderColorOption,templateSelection:renderColorOption})};Kanboard.BoardDragAndDrop=function(app){this.app=app;this.savingInProgress=!1};Kanboard.BoardDragAndDrop.prototype.execute=function(){if(this.app.hasId("board")){this.executeListeners();this.dragAndDrop()}};Kanboard.BoardDragAndDrop.prototype.dragAndDrop=function(){var self=this;var dropzone=$(".board-task-list");var params={forcePlaceholderSize:!0,tolerance:"pointer",connectWith:".sortable-column:visible",placeholder:"draggable-placeholder",items:".draggable-item",stop:function(event,ui){var task=ui.item;var taskId=task.attr('data-task-id');var taskPosition=task.attr('data-position');var taskColumnId=task.attr('data-column-id');var taskSwimlaneId=task.attr('data-swimlane-id');var newColumnId=task.parent().attr("data-column-id");var newSwimlaneId=task.parent().attr('data-swimlane-id');var newPosition=task.index()+1;task.removeClass("draggable-item-selected");if(newColumnId!=taskColumnId||newSwimlaneId!=taskSwimlaneId||newPosition!=taskPosition){self.changeTaskState(taskId);self.save(taskId,taskColumnId,newColumnId,newPosition,newSwimlaneId)}},start:function(event,ui){ui.item.addClass("draggable-item-selected");ui.placeholder.height(ui.item.height())}};if(isMobile.any){$(".task-board-sort-handle").css("display","inline");params.handle=".task-board-sort-handle"} dropzone.each(function(){$(this).css("min-height",$(this).parent().height())});dropzone.sortable(params)};Kanboard.BoardDragAndDrop.prototype.changeTaskState=function(taskId){var task=$("div[data-task-id="+taskId+"]");task.addClass('task-board-saving-state');task.find('.task-board-saving-icon').show()};Kanboard.BoardDragAndDrop.prototype.save=function(taskId,srcColumnId,dstColumnId,position,swimlaneId){var self=this;self.app.showLoadingIcon();self.savingInProgress=!0;$.ajax({cache:!1,url:$("#board").data("save-url"),contentType:"application/json",type:"POST",processData:!1,data:JSON.stringify({"task_id":taskId,"src_column_id":srcColumnId,"dst_column_id":dstColumnId,"swimlane_id":swimlaneId,"position":position}),success:function(data){self.refresh(data);self.savingInProgress=!1},error:function(){self.app.hideLoadingIcon();self.savingInProgress=!1},statusCode:{403:function(data){window.alert(data.responseJSON.message);document.location.reload(!0)}}})};Kanboard.BoardDragAndDrop.prototype.refresh=function(data){$("#board-container").replaceWith(data);this.app.hideLoadingIcon();this.executeListeners();this.dragAndDrop();KB.tooltip()};Kanboard.BoardDragAndDrop.prototype.executeListeners=function(){for(var className in this.app.controllers){var controller=this.app.get(className);if(typeof controller.onBoardRendered==="function"){controller.onBoardRendered()}}};var _KB=null;jQuery(document).ready(function(){_KB=new Kanboard.App();_KB.execute()})