var TimeToFade=1000.0; function adjustheight(id,hidden){ alert(id); alert(hidden); var content = $("#"+id).val(); content = content.replace(/\n/g, '
'); $("#"+hidden).html(content + '
'); var h=$("#"+hidden).height(); $("#"+id).css('height', h); } function textAreaAdjust(id){textarea = window.document.querySelector(id);textarea.style.height = textarea.scrollHeight+3 + "px";} function showtop(id){animatedcollapse.show(id);$('html,body').animate({ scrollTop: 0 },'fast');} function animateFade(lastTick,eid) { var curTick=new Date().getTime(); var elapsedTicks=curTick-lastTick; var element=document.getElementById(eid); if(element.FadeTimeLeft <=elapsedTicks) { element.style.opacity=element.FadeState==1 ? '1' : '0'; element.style.filter='alpha(opacity='+(element.FadeState==1 ? '100' : '0')+')'; element.FadeState=element.FadeState==1 ? 2 : -2; element.style.display="none"; return; } element.FadeTimeLeft -=elapsedTicks; var newOpVal=element.FadeTimeLeft/TimeToFade; if(element.FadeState==1) { newOpVal=1-newOpVal; } element.style.opacity=newOpVal; element.style.filter='alpha(opacity='+(newOpVal*100)+')'; setTimeout("animateFade("+curTick+",'"+eid+"')",33); } function fade(eid) { var element=document.getElementById(eid); if(element==null) return; if(element.FadeState==null) { if(element.style.opacity==null || element.style.opacity=='' || element.style.opacity=='1') { element.FadeState=2; } else { element.FadeState=-2; } } if(element.FadeState==1 || element.FadeState==-1) { element.FadeState=element.FadeState==1 ? -1 : 1; element.FadeTimeLeft=TimeToFade-element.FadeTimeLeft; } else { element.FadeState=element.FadeState==2 ? -1 : 1; element.FadeTimeLeft=TimeToFade; setTimeout("animateFade("+new Date().getTime()+",'"+eid+"')",33); } } (function(){"use strict";function t(t){return"function"==typeof t||"object"==typeof t&&null!==t}function e(t){return"function"==typeof t}function n(t){G=t}function r(t){Q=t}function o(){return function(){process.nextTick(a)}}function i(){return function(){B(a)}}function s(){var t=0,e=new X(a),n=document.createTextNode("");return e.observe(n,{characterData:!0}),function(){n.data=t=++t%2}}function u(){var t=new MessageChannel;return t.port1.onmessage=a,function(){t.port2.postMessage(0)}}function c(){return function(){setTimeout(a,1)}}function a(){for(var t=0;J>t;t+=2){var e=tt[t],n=tt[t+1];e(n),tt[t]=void 0,tt[t+1]=void 0}J=0}function f(){try{var t=require,e=t("vertx");return B=e.runOnLoop||e.runOnContext,i()}catch(n){return c()}}function l(t,e){var n=this,r=new this.constructor(p);void 0===r[rt]&&k(r);var o=n._state;if(o){var i=arguments[o-1];Q(function(){x(o,r,i,n._result)})}else E(n,r,t,e);return r}function h(t){var e=this;if(t&&"object"==typeof t&&t.constructor===e)return t;var n=new e(p);return g(n,t),n}function p(){}function _(){return new TypeError("You cannot resolve a promise with itself")}function d(){return new TypeError("A promises callback cannot return that same promise.")}function v(t){try{return t.then}catch(e){return ut.error=e,ut}}function y(t,e,n,r){try{t.call(e,n,r)}catch(o){return o}}function m(t,e,n){Q(function(t){var r=!1,o=y(n,e,function(n){r||(r=!0,e!==n?g(t,n):S(t,n))},function(e){r||(r=!0,j(t,e))},"Settle: "+(t._label||" unknown promise"));!r&&o&&(r=!0,j(t,o))},t)}function b(t,e){e._state===it?S(t,e._result):e._state===st?j(t,e._result):E(e,void 0,function(e){g(t,e)},function(e){j(t,e)})}function w(t,n,r){n.constructor===t.constructor&&r===et&&constructor.resolve===nt?b(t,n):r===ut?j(t,ut.error):void 0===r?S(t,n):e(r)?m(t,n,r):S(t,n)}function g(e,n){e===n?j(e,_()):t(n)?w(e,n,v(n)):S(e,n)}function A(t){t._onerror&&t._onerror(t._result),T(t)}function S(t,e){t._state===ot&&(t._result=e,t._state=it,0!==t._subscribers.length&&Q(T,t))}function j(t,e){t._state===ot&&(t._state=st,t._result=e,Q(A,t))}function E(t,e,n,r){var o=t._subscribers,i=o.length;t._onerror=null,o[i]=e,o[i+it]=n,o[i+st]=r,0===i&&t._state&&Q(T,t)}function T(t){var e=t._subscribers,n=t._state;if(0!==e.length){for(var r,o,i=t._result,s=0;si;i++)e.resolve(t[i]).then(n,r)}:function(t,e){e(new TypeError("You must pass an array to race."))})}function F(t){var e=this,n=new e(p);return j(n,t),n}function D(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function K(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator,this object constructor cannot be called as a function.")}function L(t){this[rt]=O(),this._result=this._state=void 0,this._subscribers=[],p!==t&&("function"!=typeof t&&D(),this instanceof L?C(this,t):K())}function N(t,e){this._instanceConstructor=t,this.promise=new t(p),this.promise[rt]||k(this.promise),Array.isArray(e)?(this._input=e,this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?S(this.promise,this._result):(this.length=this.length||0,this._enumerate(),0===this._remaining&&S(this.promise,this._result))):j(this.promise,U())}function U(){return new Error("Array Methods must be provided an Array")}function W(){var t;if("undefined"!=typeof global)t=global;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var n=t.Promise;(!n||"[object Promise]"!==Object.prototype.toString.call(n.resolve())||n.cast)&&(t.Promise=pt)}var z;z=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)};var B,G,H,I=z,J=0,Q=function(t,e){tt[J]=t,tt[J+1]=e,J+=2,2===J&&(G?G(a):H())},R="undefined"!=typeof window?window:void 0,V=R||{},X=V.MutationObserver||V.WebKitMutationObserver,Z="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),$="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,tt=new Array(1e3);H=Z?o():X?s():$?u():void 0===R&&"function"==typeof require?f():c();var et=l,nt=h,rt=Math.random().toString(36).substring(16),ot=void 0,it=1,st=2,ut=new M,ct=new M,at=0,ft=Y,lt=q,ht=F,pt=L;L.all=ft,L.race=lt,L.resolve=nt,L.reject=ht,L._setScheduler=n,L._setAsap=r,L._asap=Q,L.prototype={constructor:L,then:et,"catch":function(t){return this.then(null,t)}};var _t=N;N.prototype._enumerate=function(){for(var t=this.length,e=this._input,n=0;this._state===ot&&t>n;n++)this._eachEntry(e[n],n)},N.prototype._eachEntry=function(t,e){var n=this._instanceConstructor,r=n.resolve;if(r===nt){var o=v(t);if(o===et&&t._state!==ot)this._settledAt(t._state,e,t._result);else if("function"!=typeof o)this._remaining--,this._result[e]=t;else if(n===pt){var i=new n(p);w(i,t,o),this._willSettleAt(i,e)}else this._willSettleAt(new n(function(e){e(t)}),e)}else this._willSettleAt(r(t),e)},N.prototype._settledAt=function(t,e,n){var r=this.promise;r._state===ot&&(this._remaining--,t===st?j(r,n):this._result[e]=n),0===this._remaining&&S(r,this._result)},N.prototype._willSettleAt=function(t,e){var n=this;E(t,void 0,function(t){n._settledAt(it,e,t)},function(t){n._settledAt(st,e,t)})};var dt=W,vt={Promise:pt,polyfill:dt};"function"==typeof define&&define.amd?define(function(){return vt}):"undefined"!=typeof module&&module.exports?module.exports=vt:"undefined"!=typeof this&&(this.ES6Promise=vt),dt()}).call(this); function Loadpage(url){var width = screen.availWidth/2;var height = screen.availHeight;windowname=window.open(url,'New Window','width='+width+',height='+height+',top=50,left=50,status=1,scrollbars=1,resizable=1');windowname.focus();} function convertfrom12(){var starttime=document.forms[0].time12hr.value;var time=starttime.match(/(d+):(d+)(w)/);var hours=Number(time[1]);var minutes=Number(time[2]);var meridian=time[3].toLowerCase();if(meridian=='p' && hours<12) {hours=hours+12;}else if(meridian=='a' && hours==12) {hours=hours-12;}document.forms[0].time24hr.value=hours+":"+minutes;} function convertfrom24() {var time=document.forms[0].time24hr.value;time=time.toString().match(/^([01]d|2[0-3])(:)([0-5]d)(:[0-5]d)?$/) || [time];if(time.length > 1) {time=time.slice(1);time[5]=+time[0]<12 ? ' AM' : ' PM';time[0]=+time[0]%12 || 12;}document.forms[0].time12hr.value=time.join('');} function iframeopen(frameurl,title){ $("#iframeajaxframeloading").css("display","block"); if(title!=''){$("#loadingtext").html(title);}else{$("#loadingtext").html('Loading...');} $("#iframeajaxframe").css("display","none"); //showtop("iframeajaxdiv") animatedcollapse.show("iframeajaxdiv"); $('html,body').animate({ scrollTop: 0 },'fast'); $("#iframeajaxframe").attr("src", frameurl); } function truncate(n, len){ var ext = n.substring(n.lastIndexOf(".") + 1, n.length).toLowerCase(); var filename = n.replace('.'+ext,''); if(filename.length <= len) {return n;} filename = filename.substr(0, len) + (n.length > len ? '[...]' : ''); return filename + '.' + ext; } function convert12to24(t){ var starttime=t.time12hr.value; var time=starttime.match(/(d+):(d+)(w)/); var hours=Number(time[1]); var minutes=Number(time[2]); var meridian=time[3].toLowerCase(); if(meridian=='p' && hours<12) {hours=hours+12;} else if(meridian=='a' && hours==12) {hours=hours-12;} return hours+":"+minutes; } function convert24to12(t) { var time=t.time24hr.value; time=time.toString().match(/^([01]d|2[0-3])(:)([0-5]d)(:[0-5]d)?$/) || [time]; if(time.length > 1) {time=time.slice(1); time[5]=+time[0]<12 ? ' AM' : ' PM'; time[0]=+time[0]%12 || 12; } return time.join(''); } function reloadiframe(id){var iframe = document.getElementById(id);iframe.src = iframe.src;} function update_fade(msg){ $("#fademe").css({"display":"unset"}) $("#fademe").html('

'+msg+'

'); setTimeout(function(){fade('fademe')},3000); } function hideanim(form){javascript:animatedcollapse.hide(form);} function getheight() { var viewPortWidth; var viewPortHeight; // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight if (typeof window.innerWidth != 'undefined') { viewPortWidth = window.innerWidth, viewPortHeight = window.innerHeight } // IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document) else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientWidth != 0) { viewPortWidth = document.documentElement.clientWidth, viewPortHeight = document.documentElement.clientHeight } // older versions of IE else { viewPortWidth = document.getElementsByTagName('body')[0].clientWidth, viewPortHeight = document.getElementsByTagName('body')[0].clientHeight } return viewPortHeight; } function sleep(miliseconds) { var currentTime = new Date().getTime(); while (currentTime + miliseconds >= new Date().getTime()) { } } function adjustcontent(offset1,offset2){ var doch = getheight(); $("#pagetext").css("height",doch-offset1); $("#rostertable").css("height",doch-offset2); $(".stickytable").css("height",doch-offset1-1.8*$(".searchbox").height()); } function openInNewTab(url) {var win = window.open(url, '_blank');win.focus();} function confirm_delete(alerttitle,alerttxt,url,confirmtitle,confirmtext){swal.fire({title: alerttitle,html: alerttxt,icon: "warning",showCancelButton: true,confirmButtonText: "Yes, delete it!"}).then(function(res) {if(res.isConfirmed) {location.href=url;swal.fire({title: confirmtitle,text: confirmtext,icon: "success",timer: 2000,showConfirmButton: false});}})} function confirm_reassign(alerttitle,alerttxt,url,confirmtitle,confirmtext){swal.fire({title: alerttitle,html: alerttxt,icon: "warning",showCancelButton: true,confirmButtonText: "Yes, reassign them!"}).then(function(res) {if(res.isConfirmed) {location.href=url;swal.fire({title: confirmtitle,text: confirmtext,icon: "success",timer: 2000,showConfirmButton: false});}})} function confirm_delete_frame(alerttitle,alerttxt,url,confirmtitle,confirmtext,frame){swal.fire({title: alerttitle,html: alerttxt,icon: "warning",showCancelButton: true,confirmButtonText: "Yes, delete it!"}).then(function(res) {if(res.isConfirmed) {document.getElementById(frame).src=url;swal.fire({title: confirmtitle,text: confirmtext,icon: "success",timer: 2000,showConfirmButton: false});}})} function confirm_delete_photo(name,returnurl,frame){swal.fire({title: "Delete Photo?",html: "This will delete photo \""+name+"\". Are you sure?",icon: "warning",showCancelButton: true,confirmButtonText: 'Yes, delete it!'}).then(function(res) {if(res.isConfirmed) {document.getElementById(frame).src=returnurl;swal.fire({title: "Deleted!",text: "",icon: "success",timer: 2000,showConfirmButton: false});}})} function confirm_delete_file(returnurl,frame,name){swal.fire({title: "Delete \""+name+"\"?",html: "This will delete \""+name+"\". Are you sure?",icon: "warning",showCancelButton: true,confirmButtonText: 'Yes, delete it!'}).then(function(res) {if(res.isConfirmed) {document.getElementById(frame).src=returnurl;swal.fire({title: "Deleted!",text: "The file has been deleted!",icon: "success",timer: 2000,showConfirmButton: false});}})} function confirm(alerttitle,alerttxt,confirmbutton,confirmtitle,confirmtext,url,newtab){swal.fire({title: alerttitle,html: alerttxt,icon: "warning",showCancelButton: true,confirmButtonText: ""+confirmbutton}).then(function(res) {if(res.isConfirmed) {if(newtab!=''){openInNewTab(url);}else{location.href=url;swal.fire({title: confirmtitle,text: confirmtext,icon: "success",timer: 2000,showConfirmButton: false});}}})} function confirm_complete(returnurl,frame){swal.fire({title: "",html: "",icon: "warning",showCancelButton: true,confirmButtonText: 'Yes,I\'m Happy!'}).then(function(res) {if(res.isConfirmed) {document.form.submit();swal.fire({title: "Off We Go!",text: "",icon: "success",timer: 2000,showConfirmButton: false});}})} function logout_confirm(location){swal.fire({title: "Logout",html: "Are you sure you want to log out?",icon: "warning",showCancelButton: true,confirmButtonText: 'Yes'}).then(function(res) {if(res.isConfirmed) {window.location.assign(location);}})} function v_name(field,alerttitle,alerttxt,frame){with(field){if(value==null||value==""){swal.fire({title: alerttitle,html: alerttxt,icon: "error", confirmButtonText: "Ok", confirmButtonColor: "#3085d6", allowEscapeKey: true,allowOutsideClick: true,confirmButtonColor: '#3085d6'}).then(function(){if(frame!=''){var myField=document.getElementById(frame).contentDocument.getElementById(field.name);myField.focus();}else{document.getElementById(field.name).focus();}});return false;}else{return true;}}} function v_name_empty(field,alerttitle,alerttxt,frame){ with(field){ if(value!=null&&value!=""){ swal.fire({title: alerttitle,html: alerttxt,icon: "error", confirmButtonText: "Ok", confirmButtonColor: "#3085d6", allowEscapeKey: true,allowOutsideClick: true,confirmButtonColor: '#3085d6'}). then(function(){ if(frame!=''){ var myField=document.getElementById(frame).contentDocument.getElementById(field.name); myField.focus(); } else{ document.getElementById(field.name).focus(); } }); return false; } else{return true;} } } function v_select(field,alerttitle,alerttxt,frame,def){with(field){if(value==null||value==def||value==''){swal.fire({title: alerttitle,html: alerttxt,icon: "error", confirmButtonText: "Ok", confirmButtonColor: "#3085d6", allowEscapeKey: true,allowOutsideClick: true,confirmButtonColor: '#3085d6'}).then(function(){if(frame!=''){var myField=document.getElementById(frame).contentDocument.getElementById(field.name);myField.focus();}else{document.getElementById(field.name).focus();}});return false;}else{return true;}}} function v_number(field,alerttitle,alerttxt,frame){with (field){var pa = /[0-9 ()+][^A-z]/;var regex = new RegExp(pa);if (value==null||value==""||!(regex.test(value))){swal.fire({title: alerttitle,html: alerttxt,icon: "error", confirmButtonText: "Ok", confirmButtonColor: "#3085d6", allowEscapeKey: true,allowOutsideClick: true,confirmButtonColor: '#3085d6'}).then(function(){if(frame!=''){var myField = document.getElementById(frame).contentDocument.getElementById(field.name);myField.focus();}else{document.getElementById(field.name).focus();}});return false;}else{return true;}}} function v_email(field,alerttitle,alerttxt,frame){with(field){apos=value.indexOf("@");dotpos=value.lastIndexOf(".");if(apos<1||dotpos-apos<2){swal.fire({title: alerttitle,html: alerttxt,icon: "error", confirmButtonText: "Ok", confirmButtonColor: "#3085d6", allowEscapeKey: true,allowOutsideClick: true,confirmButtonColor: '#3085d6'}).then(function(){if(frame!=''){var myField=document.getElementById(frame).contentDocument.getElementById(field.name);myField.focus();}else{document.getElementById(field.name).focus();}});return false;}else{return true;}}} function v_checkbox(field,alerttitle,alerttxt,frame){with(field){if(!field.checked){swal.fire({title: alerttitle,html: alerttxt,icon: "error", confirmButtonText: "Ok", confirmButtonColor: "#3085d6", allowEscapeKey: true,allowOutsideClick: true,confirmButtonColor: '#3085d6'}).then(function(){if(frame!=''){var myField=document.getElementById(frame).contentDocument.getElementById(field.name);myField.focus();}else{document.getElementById(field.name).focus();}});return false;}else{return true;}}} function v_checkbox_verify(field,alerttitle,alerttxt,frame){ with(field){ if(!field.checked){ swal.fire({title: alerttitle,html: alerttxt,icon: "warning", confirmButtonText: "Ok", confirmButtonColor: "#3085d6", allowEscapeKey: true,allowOutsideClick: true}).then(function(res){ if(res.isConfirmed) { document.form.submit();swal.fire({ title: "Off We Go!",text: "",icon: "success",timer: 2000,showConfirmButton: false});} });return false;}else{ return true;}}} function v_radio(field,alerttitle,alerttxt,frame){with(field){ var option=document.getElementsByName(field); if (!(option[0].checked || option[1].checked)){swal.fire({title: alerttitle,html: alerttxt,icon: "error", confirmButtonText: "Ok", confirmButtonColor: "#3085d6", allowEscapeKey: true,allowOutsideClick: true,confirmButtonColor: '#3085d6'}).then(function(){if(frame!=''){var myField=document.getElementById(frame).contentDocument.getElementById(field.name);myField.focus();}else{document.getElementById(field.name).focus();}});return false;}else{return true;}}} function radioval(field){ var radios = document.getElementsByName(field); for (var i = 0, length = radios.length; i < length; i++) { if (radios[i].checked) { // do whatever you want with the checked radio return (radios[i].value); break; } } } function login_loadpage(page){$.ajax({type: "GET",url: "https://vps.npbsecurity.com/login/?page="+page,data: "ajaxoutput=yes&iframe=yes",success: function(html){var output=html.split("|||");$("#pagetitle").html(output[0]);$("#pagetext").html(output[1]);},beforeSend:function(){$("#pagetext").html('


');}});return false;} function changetheme(thisform){with(thisform){if(v_name(themeselection,'Theme Selection',"Please select a theme")==false){return false;}document.form.submit();}} function resizeIframe(id) {document.getElementById(id).height=document.getElementById(id).contentDocument.documentElement.scrollHeight+'px';document.getElementById(id).height=document.getElementById(id).contentWindow.document.body.scrollHeight+'px';} function getFrameElement() {var iframes=parent.document.getElementsByTagName('iframe');for(var i=iframes.length; i-->0;) {var iframe=iframes[i];try {var idoc='contentDocument' in iframe? iframe.contentDocument : iframe.contentWindow.document;} catch(e) {continue;}if(idoc===document)return iframe;}return null;} Number.prototype.formatMoney=function(c,d,t){var n=this,c=isNaN(c=Math.abs(c)) ? 2 : c,d=d==undefined ? "." : d,t=t==undefined ? "," : t,s=n<0 ? "-" : "",i=parseInt(n=Math.abs(+n || 0).toFixed(c))+"",j=(j=i.length) > 3 ? j%3 : 0;return s+(j ? i.substr(0,j)+t : "")+i.substr(j).replace(/(\d{3})(?=\d)/g,"$1"+t)+(c ? d+Math.abs(n-i).toFixed(c).slice(2) : "");}; function previewpage(url) { windowname=window.open(url,'previewpane','width=1280,height=768,top=50,left=50,status=1,scrollbars=1,resizable=1'); var frm=document.getElementById("form"); frm.method="post"; frm.action="previewpage.php"; frm.target="previewpane"; frm.submit(); windowname.focus(); } function copyToClipboard(id) { var text=$("#"+id).val(); //getting the text from that particular Row //window.prompt("Copy to clipboard: Ctrl+C,Enter",text); if(window.clipboardData && window.clipboardData.setData) {return clipboardData.setData("Text",text);}// IE specific code path to prevent textarea being shown while dialog is visible. else if(document.queryCommandSupported && document.queryCommandSupported("copy")) { var textarea=document.createElement("textarea"); textarea.value=text; textarea.style.position="fixed"; // Prevent scrolling to bottom of page in MS Edge. document.body.appendChild(textarea); textarea.select(); try { document.execCommand("copy"); // Security exception may be thrown by some browsers. parent.swal.fire({title: 'URL Copied',text: 'The URL "'+textarea.value+'" has been copied to your clipboard. Use CTRL+V to paste.',timer: 3000}); return true;} catch(ex){console.warn("Copy to clipboard failed.",ex);return false;} finally {document.body.removeChild(textarea);} } } /****************************************************jQuery UI Nested Sortable****************************************************/ !function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery","jquery-ui/sortable"],e):e(window.jQuery)}(function(e){"use strict";function t(e,t,s){return e>t&&e=0;s--)if(i=this.items[s],o=i.item[0],(l=this._intersectsWithPointer(i))&&i.instance===this.currentContainer){if(-1!==o.className.indexOf(b.disabledClass))if(2===l){if((p=this.items[s+1])&&p.item.hasClass(b.disabledClass))continue}else if(1===l&&(d=this.items[s-1])&&d.item.hasClass(b.disabledClass))continue;if(u=1===l?"next":"prev",!(o===this.currentItem[0]||this.placeholder[u]()[0]===o||e.contains(this.placeholder[0],o)||"semi-dynamic"===this.options.type&&e.contains(this.element[0],o))){if(this.mouseentered||(e(o).mouseenter(),this.mouseentered=!0),b.isTree&&e(o).hasClass(b.collapsedClass)&&b.expandOnHover&&(this.hovering||(e(o).addClass(b.hoveringClass),this.hovering=window.setTimeout(function(){e(o).removeClass(b.collapsedClass).addClass(b.expandedClass),C.refreshPositions(),C._trigger("expand",t,C._uiHash())},b.expandOnHover))),this.direction=1===l?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(i))break;e(o).mouseleave(),this.mouseentered=!1,e(o).removeClass(b.hoveringClass),this.hovering&&window.clearTimeout(this.hovering),this.hovering=null,!b.protectRoot||this.currentItem[0].parentNode===this.element[0]&&o.parentNode!==this.element[0]?b.protectRoot||this._rearrange(t,i):this.currentItem[0].parentNode!==this.element[0]&&o.parentNode===this.element[0]?(e(o).children(b.listType).length||(o.appendChild(c),b.isTree&&e(o).removeClass(b.leafClass).addClass(b.branchClass+" "+b.expandedClass)),void 0!==(f="down"===this.direction?e(o).prev().children(b.listType):e(o).children(b.listType))[0]&&this._rearrange(t,null,f)):this._rearrange(t,i),this._clearEmpty(o),this._trigger("change",t,this._uiHash());break}}if(function(){var e=this.placeholder.prev();m=e.length?e:null}.call(this),null!=m)for(;"li"!==m[0].nodeName.toLowerCase()||-1!==m[0].className.indexOf(b.disabledClass)||m[0]===this.currentItem[0]||m[0]===this.helper[0];){if(!m[0].previousSibling){m=null;break}m=e(m[0].previousSibling)}if(function(){var e=this.placeholder.next();v=e.length?e:null}.call(this),null!=v)for(;"li"!==v[0].nodeName.toLowerCase()||-1!==v[0].className.indexOf(b.disabledClass)||v[0]===this.currentItem[0]||v[0]===this.helper[0];){if(!v[0].nextSibling){v=null;break}v=e(v[0].nextSibling)}return this.beyondMaxLevels=0,null==n||null!=v||b.protectRoot&&n[0].parentNode==this.element[0]||!(b.rtl&&this.positionAbs.left+this.helper.outerWidth()>n.offset().left+n.outerWidth()||!b.rtl&&this.positionAbs.leftm.offset().left+b.tabSize)?this._isAllowed(n,a,a+h):(this._isAllowed(m,a,a+h+1),m.children(b.listType).length||(m[0].appendChild(c),b.isTree&&m.removeClass(b.leafClass).addClass(b.branchClass+" "+b.expandedClass)),r&&r<=m.offset().top?m.children(b.listType).prepend(this.placeholder):m.children(b.listType)[0].appendChild(this.placeholder[0]),void 0!==n&&this._clearEmpty(n[0]),this._trigger("change",t,this._uiHash())):(n.after(this.placeholder[0]),g=!n.children(b.listItem).children("li:visible:not(.ui-sortable-helper)").length,b.isTree&&g&&n.removeClass(this.options.branchClass+" "+this.options.expandedClass).addClass(this.options.leafClass),void 0!==n&&this._clearEmpty(n[0]),this._trigger("change",t,this._uiHash())),this._contactContainers(t),e.ui.ddmanager&&e.ui.ddmanager.drag(this,t),this._trigger("sort",t,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(t){this.beyondMaxLevels&&(this.placeholder.removeClass(this.options.errorClass),this.domPosition.prev?e(this.domPosition.prev).after(this.placeholder):e(this.domPosition.parent).prepend(this.placeholder),this._trigger("revert",t,this._uiHash())),e("."+this.options.hoveringClass).mouseleave().removeClass(this.options.hoveringClass),this.mouseentered=!1,this.hovering&&window.clearTimeout(this.hovering),this.hovering=null,this._relocate_event=t,this._pid_current=e(this.domPosition.parent).parent().attr("id"),this._sort_current=this.domPosition.prev?e(this.domPosition.prev).next().index():0,e.ui.sortable.prototype._mouseStop.apply(this,arguments)},_intersectsWithSides:function(e){var s=this.options.isTree?.8:.5,i=t(this.positionAbs.top+this.offset.click.top,e.top+e.height*s,e.height),o=t(this.positionAbs.top+this.offset.click.top,e.top-e.height*s,e.height),l=t(this.positionAbs.left+this.offset.click.left,e.left+e.width/2,e.width),r=this._getDragVerticalDirection(),n=this._getDragHorizontalDirection();return this.floating&&n?"right"===n&&l||"left"===n&&!l:r&&("down"===r&&i||"up"===r&&o)},_contactContainers:function(){this.options.protectRoot&&this.currentItem[0].parentNode===this.element[0]||e.ui.sortable.prototype._contactContainers.apply(this,arguments)},_clear:function(){var t,s;for(e.ui.sortable.prototype._clear.apply(this,arguments),this._pid_current===this._uiHash().item.parent().parent().attr("id")&&this._sort_current===this._uiHash().item.index()||this._trigger("relocate",this._relocate_event,this._uiHash()),t=this.items.length-1;t>=0;t--)s=this.items[t].item[0],this._clearEmpty(s)},serialize:function(t){var s=e.extend({},this.options,t),i=this._getItemsAsjQuery(s&&s.connected),o=[];return e(i).each(function(){var t=(e(s.item||this).attr(s.attribute||"id")||"").match(s.expression||/(.+)[-=_](.+)/),i=(e(s.item||this).parent(s.listType).parent(s.items).attr(s.attribute||"id")||"").match(s.expression||/(.+)[-=_](.+)/);t&&o.push((s.key||t[1])+"["+(s.key&&s.expression?t[1]:t[2])+"]="+(i?s.key&&s.expression?i[1]:i[2]:s.rootID))}),!o.length&&s.key&&o.push(s.key+"="),o.join("&")},toHierarchy:function(t){var s=e.extend({},this.options,t),i=[];return e(this.element).children(s.items).each(function(){var t=function t(i){var o,l=(e(i).attr(s.attribute||"id")||"").match(s.expression||/(.+)[-=_](.+)/);var r=e(i).data();r.nestedSortableItem&&delete r.nestedSortableItem;if(l)return o={id:l[2]},o=e.extend({},o,r),e(i).children(s.listType).children(s.items).length>0&&(o.children=[],e(i).children(s.listType).children(s.items).each(function(){var e=t(this);o.children.push(e)})),o}(this);i.push(t)}),i},toArray:function(t){var s=e.extend({},this.options,t),i=s.startDepthCount||0,o=[],l=1;return s.excludeRoot||(o.push({item_id:s.rootID,parent_id:null,depth:i,left:l,right:2*(e(s.items,this.element).length+1)}),l++),e(this.element).children(s.items).each(function(){l=function t(l,r,n){var a,h,p,d=n+1;e(l).children(s.listType).children(s.items).length>0&&(r++,e(l).children(s.listType).children(s.items).each(function(){d=t(e(this),r,d)}),r--);a=(e(l).attr(s.attribute||"id")||"").match(s.expression||/(.+)[-=_](.+)/);r===i?h=s.rootID:(p=e(l).parent(s.listType).parent(s.items).attr(s.attribute||"id").match(s.expression||/(.+)[-=_](.+)/),h=p[2]);if(a){var c=e(l).children("div").data(),u=e.extend(c,{id:a[2],parent_id:h,depth:r,left:n,right:d});o.push(u)}n=d+1;return n}(this,i,l)}),o=o.sort(function(e,t){return e.left-t.left})},_clearEmpty:function(t){var s,i,o,l=this.options,r=e(t).children(l.listType),n=r.has("li").length,a=l.doNotClear||n||l.protectRoot&&e(t)[0]===this.element[0];l.isTree&&(s=t,i=l.branchClass,o=l.leafClass,a&&(i=[o,o=i][0]),e(s).removeClass(i).addClass(o)),a||(r.parent().removeClass(l.expandedClass),r.remove())},_getLevel:function(e){var t,s=1;if(this.options.listType)for(t=e.closest(this.options.listType);t&&t.length>0&&!t.is(".ui-sortable");)s++,t=t.parent().closest(this.options.listType);return s},_getChildLevels:function(t,s){var i=this,o=this.options,l=0;return s=s||0,e(t).children(o.listType).children(o.items).each(function(e,t){l=Math.max(i._getChildLevels(t,s+1),l)}),s?l+1:l},_isAllowed:function(e,t,s){var i=this.options,o=this.placeholder.closest(".ui-sortable").nestedSortable("option","maxLevels"),l=this.currentItem.parent().parent();i.disableParentChange&&(void 0!==e&&!l.is(e)||void 0===e&&l.is("li"))||!i.isAllowed(this.placeholder,e,this.currentItem)?(this.placeholder.addClass(i.errorClass),this.beyondMaxLevels=o=0){var i={timer:null,text:"TD"===t?jQuery(e).html():jQuery(e).val(),cb:n.callback,el:e,type:t,wait:n.wait};n.highlight&&"TD"!==t&&jQuery(e).focus(function(){this.select()});jQuery(e).on("keydown paste cut input",function(e){var u=i.wait,r=!1,a=t;void 0!==e.keyCode&&13==e.keyCode&&"TEXTAREA"!==a&&"TD"!==t&&(console.log("OVERRIDE"),u=1,r=!0);clearTimeout(i.timer),i.timer=setTimeout(function(){var e,t,u;t=r,((u="TD"===(e=i).type?jQuery(e.el).html():jQuery(e.el).val()).length>=n.captureLength&&u!=e.text||t&&(u.length>=n.captureLength||n.allowSubmit)||0==u.length&&e.text)&&(e.text=u,e.cb.call(e.el,u))},u)})}}return this.each(function(){i(this)})}}); /****************************************************custom selectmenu widget****************************************************/ /* this is the custom selectmenu widget extension add multiline and css theming support */ var multilineSelectmenu=$.widget("ui.multilineSelectmenu",$.ui.selectmenu,{_setText:function(e,t){if(t){if(-1!==t.indexOf("|")){var n=t.split("|");t=''+n[0].trim()+"";for(var i=1;i'+n[i].trim()+""}e.html(t)}else e.html(" ")}}); !function(a){a.fn.customselect=function(b,c){var d={csclass:"custom-select",search:!0,numitems:4,searchblank:!1,showblank:!0,searchvalue:!1,hoveropen:!1,emptytext:"",showdisabled:!1,useoptionclass:!1,mobilecheck:function(){return navigator.platform&&navigator.userAgent.match(/(android|iphone|ipad|blackberry)/i)}};b&&"object"==typeof b&&a.extend(d,b);var e="function"==typeof d.mobilecheck?d.mobilecheck.call():d.mobilecheck,f=e?a(this).filter("select"):a(this).filter("select:not([multiple])");return f.each(function(){var f=a(this);f.data("cs-options")&&a.extend(d,f.data("cs-options"));var g=f.parents(d.selector+":first"),h={init:function(){var b={init:function(){b.container(),b.value(),b.subcontainer()},container:function(){g=a("
").addClass(d.csclass).addClass(d.id),e&&(g.addClass(d.csclass+"-mobile"),f.css("opacity",0)),f.before(g),f.appendTo(g),f.off("change",b._onchange).change(b._onchange);var c=null;g.hover(function(){c&&clearTimeout(c),g.addClass(d.csclass+"-hover")},function(){d.hoveropen&&(c=setTimeout(h.close,750)),g.removeClass(d.csclass+"-hover")}),a(document).mouseup(function(){g.is(d.selector+"-open")&&(g.is(d.selector+"-hover")?g.find("input").focus():h.close())})},value:function(){var b=a("").appendTo(g);f.appendTo(g);var c="",e=null;b.click(function(a){a.preventDefault()}).focus(function(){g.addClass(d.csclass+"-focus")}).blur(function(){g.removeClass(d.csclass+"-focus")}),a("html").keyup(function(a){if(b.is(":focus")){var g=a.which,h=f.find("option").not(":disabled");if(g>=48&&90>=g){c+=String.fromCharCode(g).toLowerCase();for(var i=0;i0)&&0==k.indexOf(c)){f.val(j.attr("value")).change();break}}e&&clearTimeout(e),e=setTimeout(function(){c=""},1e3),a.preventDefault()}else if(27==g)e&&clearTimeout(e),c="",a.preventDefault();else if(38==g){var l=f.find("option:selected"),m=h.index(l);m>0?f.val(h.eq(m-1).attr("value")):f.val(h.eq(h.length-1).attr("value")),f.change(),a.preventDefault()}else if(40==g){var l=f.find("option:selected"),m=h.index(l);m0?i.text():d.emptytext),b.removeAttr("class"),d.useoptionclass&&i.attr("class")&&b.addClass(i.attr("class")||""),d.hoveropen?b.mouseover(h.open):b.click(h.toggle)},subcontainer:function(){var b=a("
").appendTo(g),c=a("").appendTo(b);c.keyup(function(b){a.inArray(b.which,[13,38,40])<0&&(d.search?h.search(a(this).val()):(h.searchmove(a(this).val()),a(this).val("")))}).keydown(function(a){switch(a.which){case 13:val=g.find("ul li.active.option-hover").data("value"),disabled=g.find("ul li.active.option-hover").is(".option-disabled"),h.select(val,disabled);break;case 38:h.selectUp();break;case 40:h.selectDown();break;case 27:h.close();break;default:return!0}return a.preventDefault(),!1}).blur(function(){a(this).val("")}),d.search||c.addClass(d.csclass+"-hidden-input");var e=a("
").appendTo(b),i=a("
    ").appendTo(e);f.find("option").each(function(b){var c=a(this).attr("value"),e=a(this).text(),f=a(this).is(":disabled");!(d.showblank||c.length>0)||!d.showdisabled&&f||a("
  • ",{"class":"active"+(0==b?" option-hover":"")+(a(this).is(":disabled")?" option-disabled":"")+(d.useoptionclass&&a(this).attr("class")?" "+a(this).attr("class"):""),"data-value":c,text:e.length>0?e:d.emptytext}).appendTo(i)});var j=i.find("li");i.find("li").click(function(){h.select(a(this).data("value"),a(this).is(".option-disabled"))}),g.find("div div").css({"overflow-y":j.length>d.numitems?"scroll":"visible"})},_onchange:function(){f.val(a(this).val()),h.select(a(this).val())}};f.is("select"+d.selector)&&!f.data("cs-options")&&b.init()},toggle:function(){g.is(d.selector+"-open")?h.close():h.open()},open:function(){e||(g.addClass(d.csclass+"-open"),g.find("input").focus(),g.find("ul li.no-results").hide(),h._selectMove(f.get(0).selectedIndex))},close:function(){g.removeClass(d.csclass+"-open"),g.find("input").val("").blur(),g.find("ul li").not(".no-results").addClass("active");var a=g.find("ul li").not(".no-results");g.find("div div").css({"overflow-y":a.length>d.numitems?"scroll":"visible"}),g.find("a").focus()},search:function(b){b=a.trim(b.toLowerCase());var c=g.find("ul li.no-results").hide(),e=g.find("ul li").not(".no-results");e.each(function(){var c=(a(this).text()+"").toLowerCase(),e=(a(this).data("value")+"").toLowerCase(),f=!1;d.searchblank||e.length>0?d.searchvalue&&e.indexOf(b)>=0?f=!0:c.indexOf(b)>=0&&(f=!0):0==b.length&&(f=!0),f?a(this).addClass("active"):a(this).removeClass("active")}),e=e.filter(".active").filter(":visible"),g.find("div div").css({"overflow-y":e.length>d.numitems?"scroll":"visible"}),e.length>0?h._selectMove(0):c.show()},searchmove:function(b){var c=[];f.find("option").each(function(d){0==a(this).text().toLowerCase().indexOf(b.toLowerCase())&&c.push(d)}),c.length>0&&h._selectMove(c[0])},select:function(a,b){if(!b){f.val()!=a&&f.val(a).change();var c=f.find("option:selected"),e=g.find("a");e.find("span").text(c.text().length>0?c.text():d.emptytext),e.removeAttr("class"),d.useoptionclass&&c.attr("class")&&e.addClass(c.attr("class")||""),h.close()}},selectUp:function(){var a=g.find("ul li.active").not(".no-results"),b=a.index(a.filter(".option-hover")),c=b-1;c=0>c?a.length-1:c,h._selectMove(c)},selectDown:function(){var a=g.find("ul li.active").not(".no-results"),b=a.index(a.filter(".option-hover")),c=b+1;c=c>a.length-1?0:c,h._selectMove(c)},destroy:function(){f.data("cs-options")&&(f.removeData("cs-options").insertAfter(g),g.remove())},_selectMove:function(a){var b=g.find("ul li.active");b.removeClass("option-hover").eq(a).addClass("option-hover");var c=g.find("div div");if("scroll"==c.css("overflow-y")){c.scrollTop(0);var d=b.eq(a);offset=d.offset().top+d.outerHeight()-c.offset().top-c.height(),offset>0&&c.scrollTop(offset)}}},i=b;i&&"object"==typeof i&&(i="init",c=null),d.selector="."+d.csclass,i=i?i:"init","function"==typeof h[i]&&h[i].call(this,c),"destroy"!=i&&f.data("cs-options",d)}),this}}(jQuery); /****************************************************es6-promise****************************************************/ (function(){"use strict";function t(t){return"function"==typeof t||"object"==typeof t&&null!==t}function e(t){return"function"==typeof t}function n(t){G=t}function r(t){Q=t}function o(){return function(){process.nextTick(a)}}function i(){return function(){B(a)}}function s(){var t=0,e=new X(a),n=document.createTextNode("");return e.observe(n,{characterData:!0}),function(){n.data=t=++t%2}}function u(){var t=new MessageChannel;return t.port1.onmessage=a,function(){t.port2.postMessage(0)}}function c(){return function(){setTimeout(a,1)}}function a(){for(var t=0;J>t;t+=2){var e=tt[t],n=tt[t+1];e(n),tt[t]=void 0,tt[t+1]=void 0}J=0}function f(){try{var t=require,e=t("vertx");return B=e.runOnLoop||e.runOnContext,i()}catch(n){return c()}}function l(t,e){var n=this,r=new this.constructor(p);void 0===r[rt]&&k(r);var o=n._state;if(o){var i=arguments[o-1];Q(function(){x(o,r,i,n._result)})}else E(n,r,t,e);return r}function h(t){var e=this;if(t&&"object"==typeof t&&t.constructor===e)return t;var n=new e(p);return g(n,t),n}function p(){}function _(){return new TypeError("You cannot resolve a promise with itself")}function d(){return new TypeError("A promises callback cannot return that same promise.")}function v(t){try{return t.then}catch(e){return ut.error=e,ut}}function y(t,e,n,r){try{t.call(e,n,r)}catch(o){return o}}function m(t,e,n){Q(function(t){var r=!1,o=y(n,e,function(n){r||(r=!0,e!==n?g(t,n):S(t,n))},function(e){r||(r=!0,j(t,e))},"Settle: "+(t._label||" unknown promise"));!r&&o&&(r=!0,j(t,o))},t)}function b(t,e){e._state===it?S(t,e._result):e._state===st?j(t,e._result):E(e,void 0,function(e){g(t,e)},function(e){j(t,e)})}function w(t,n,r){n.constructor===t.constructor&&r===et&&constructor.resolve===nt?b(t,n):r===ut?j(t,ut.error):void 0===r?S(t,n):e(r)?m(t,n,r):S(t,n)}function g(e,n){e===n?j(e,_()):t(n)?w(e,n,v(n)):S(e,n)}function A(t){t._onerror&&t._onerror(t._result),T(t)}function S(t,e){t._state===ot&&(t._result=e,t._state=it,0!==t._subscribers.length&&Q(T,t))}function j(t,e){t._state===ot&&(t._state=st,t._result=e,Q(A,t))}function E(t,e,n,r){var o=t._subscribers,i=o.length;t._onerror=null,o[i]=e,o[i+it]=n,o[i+st]=r,0===i&&t._state&&Q(T,t)}function T(t){var e=t._subscribers,n=t._state;if(0!==e.length){for(var r,o,i=t._result,s=0;si;i++)e.resolve(t[i]).then(n,r)}:function(t,e){e(new TypeError("You must pass an array to race."))})}function F(t){var e=this,n=new e(p);return j(n,t),n}function D(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function K(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function L(t){this[rt]=O(),this._result=this._state=void 0,this._subscribers=[],p!==t&&("function"!=typeof t&&D(),this instanceof L?C(this,t):K())}function N(t,e){this._instanceConstructor=t,this.promise=new t(p),this.promise[rt]||k(this.promise),Array.isArray(e)?(this._input=e,this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?S(this.promise,this._result):(this.length=this.length||0,this._enumerate(),0===this._remaining&&S(this.promise,this._result))):j(this.promise,U())}function U(){return new Error("Array Methods must be provided an Array")}function W(){var t;if("undefined"!=typeof global)t=global;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var n=t.Promise;(!n||"[object Promise]"!==Object.prototype.toString.call(n.resolve())||n.cast)&&(t.Promise=pt)}var z;z=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)};var B,G,H,I=z,J=0,Q=function(t,e){tt[J]=t,tt[J+1]=e,J+=2,2===J&&(G?G(a):H())},R="undefined"!=typeof window?window:void 0,V=R||{},X=V.MutationObserver||V.WebKitMutationObserver,Z="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),$="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,tt=new Array(1e3);H=Z?o():X?s():$?u():void 0===R&&"function"==typeof require?f():c();var et=l,nt=h,rt=Math.random().toString(36).substring(16),ot=void 0,it=1,st=2,ut=new M,ct=new M,at=0,ft=Y,lt=q,ht=F,pt=L;L.all=ft,L.race=lt,L.resolve=nt,L.reject=ht,L._setScheduler=n,L._setAsap=r,L._asap=Q,L.prototype={constructor:L,then:et,"catch":function(t){return this.then(null,t)}};var _t=N;N.prototype._enumerate=function(){for(var t=this.length,e=this._input,n=0;this._state===ot&&t>n;n++)this._eachEntry(e[n],n)},N.prototype._eachEntry=function(t,e){var n=this._instanceConstructor,r=n.resolve;if(r===nt){var o=v(t);if(o===et&&t._state!==ot)this._settledAt(t._state,e,t._result);else if("function"!=typeof o)this._remaining--,this._result[e]=t;else if(n===pt){var i=new n(p);w(i,t,o),this._willSettleAt(i,e)}else this._willSettleAt(new n(function(e){e(t)}),e)}else this._willSettleAt(r(t),e)},N.prototype._settledAt=function(t,e,n){var r=this.promise;r._state===ot&&(this._remaining--,t===st?j(r,n):this._result[e]=n),0===this._remaining&&S(r,this._result)},N.prototype._willSettleAt=function(t,e){var n=this;E(t,void 0,function(t){n._settledAt(it,e,t)},function(t){n._settledAt(st,e,t)})};var dt=W,vt={Promise:pt,polyfill:dt};"function"==typeof define&&define.amd?define(function(){return vt}):"undefined"!=typeof module&&module.exports?module.exports=vt:"undefined"!=typeof this&&(this.ES6Promise=vt),dt()}).call(this);