diff --git a/public/assets/backend/js/behaviour/general.js b/public/assets/backend/js/behaviour/general.js index 1f015f790..225043f9d 100644 --- a/public/assets/backend/js/behaviour/general.js +++ b/public/assets/backend/js/behaviour/general.js @@ -1529,7 +1529,7 @@ var App = function () { return raw; }, genTable: function (rows, formatters) { - var h = ''; + var h = '
'; var th = '', bd = ''; for (var i = 0; i < rows.length; i++) { var v = rows[i]; @@ -1571,7 +1571,7 @@ var App = function () { $(window).off().on('resize', function () { $modal.css({ height: $(window).height(), width: '100%', 'max-width': '100%', left: 0, top: 0, transform: 'none' }); $modal.find('.md-content').css('height', $(window).height()); - $('#log-show-content').css('height', $(window).height() - 200); + $('#log-show-content').css('height', $(window).height() - 140); }); $('#log-show-last-lines').on('change', function (r) { var target = $(this).data('target'); @@ -1623,15 +1623,17 @@ var App = function () { if (typeof (r.Data.list) != 'undefined') { var wp = function (raw, index) { return '
'+App.htmlEncode(raw)+'
'; + }, wp2 = function (raw, index) { + return '
'+App.htmlEncode(raw)+'
'; }; var h = '
' + App.genTable(r.Data.list, { 'StatusCode': function (raw, index) { return '' + raw + ''; }, 'Brower': wp, - 'UserAgent': wp, - 'URI': wp, - 'Referer': wp, + 'UserAgent': wp2, + 'URI': wp2, + 'Referer': wp2, '': function (raw, index) { return App.htmlEncode(raw); } diff --git a/public/assets/backend/js/behaviour/general.min.js b/public/assets/backend/js/behaviour/general.min.js index 506047dfe..9b1c902ff 100644 --- a/public/assets/backend/js/behaviour/general.min.js +++ b/public/assets/backend/js/behaviour/general.min.js @@ -1 +1 @@ -var App=function(){var a={tooltip:true,popover:true,nanoScroller:true,nestableLists:true,hiddenElements:true,bootstrapSwitch:true,dateTime:true,select2:true,tags:true,slider:true};var t=function(){$(".wizard-ux").wizard();$(".wizard-ux").on("changed",function(){$(".bslider").slider()});$(".wizard-next").on("click",function(t){$(".wizard-ux").wizard("next");t.preventDefault()});$(".wizard-previous").on("click",function(t){$(".wizard-ux").wizard("previous");t.preventDefault()})};function n(t){var e=$("#sidebar-collapse")[0];var a=$("#cl-wrapper");if(a.hasClass("sb-collapsed")){$(".fa",e).addClass("fa-angle-left").removeClass("fa-angle-right");a.removeClass("sb-collapsed")}else{$(".fa",e).removeClass("fa-angle-left").addClass("fa-angle-right");a.addClass("sb-collapsed")}}function e(){var i=window.location.pathname.replace(/^\//,"").replace(/[^\w]/g,"-");$(".page-aside").each(function(t){var e=$(this).attr("page-key")||i;var a=$(this),n=e+".page-aside-"+t;$(this).find(".header > .collapse-button").on("click",function(){a.addClass("collapsed");store.set(n,"collapsed");a.trigger("collapsed");g()});$(this).children(".collapsed-button").on("click",function(){a.removeClass("collapsed");store.set(n,"");a.trigger("expanded");g()});if(store.get(n)=="collapsed"){$(this).find(".header > .collapse-button").trigger("click")}})}function r(){var t=$("#main-container > .page-aside");var e=t.width();if(e<270){t.find(".header > .collapse-button").trigger("click");return}g()}function o(t){var e=t.children();if(e.length<1)return null;switch(e[0].tagName.toUpperCase()){case"TABLE":return e;default:return o(e)}}function g(t){if(t==null)t="#cl-wrapper > .cl-body .table-responsive";var e=t instanceof jQuery?t:$(t);var i=$("#pcont").offset().left,r=$(window).width()-i;e.each(function(){var t=$(this).offset().left-i;var e=r-t*2;var a=$(this).data("width");if(a&&a==e)return;$(this).data("width",e);var n=o($(this));if(n==null)return;if(n.outerWidth()>e){$(this).addClass("overflow").css("max-width",e)}else{$(this).removeClass("overflow").css("max-width",e)}})}var s=$("");var l=/&|<|>| |\'|\"/g,c={"&":"&","<":"<",">":">"," ":" ","'":"'",'"':"""};var f=/&|<|>| |'|"/g,d={"&":"&","<":"<",">":">"," ":" ","'":"'",""":'"'};var p=/\n| |\t/g,u={"\n":"
"," ":"  ","\t":"    "};function h(t,e){if(($("#cl-wrapper").hasClass("sb-collapsed")||$(window).width()>755&&$(window).width()<963)&&$("ul",t).length>0){$(t).removeClass("ocult");var a=$("ul",t);if(!$(".dropdown-header",t).length){var n='";a.prepend(n)}s.appendTo("body");var i=$(t).offset().top+8-$(window).scrollTop();var r=$(t).width();s.css({top:i,left:r+8});s.html('");s.show();a.css("top",i)}else{s.hide()}}function v(){var t=220;var e=500;var a=$('');a.appendTo("body");$(window).on("scroll",function(){if($(this).scrollTop()>t){$(".back-to-top").fadeIn(e)}else{$(".back-to-top").fadeOut(e)}});$(".back-to-top").on("click",function(t){t.preventDefault();$("html, body").animate({scrollTop:0},e);return false})}var w=null,m=null;return{clientID:{},i18n:{SYS_INFO:"System Information",UPLOAD_ERR:"Upload Error",PLEASE_SELECT_FOR_OPERATE:"Please select the item you want to operate",PLEASE_SELECT_FOR_REMOVE:"Please select the item you want to delete",CONFIRM_REMOVE:"Are you sure you want to delete them?",SELECTED_ITEMS:"You have selected %d items",SUCCESS:"The operation was successful",FAILURE:"Operation failed",UPLOADING:"File uploading, please wait...",UPLOAD_SUCCEED:"Upload successfully",BUTTON_UPLOAD:"Upload"},lang:"en",sprintf:sprintfWrapper.init,t:function(t){if(typeof App.i18n[t]=="undefined"){if(arguments.length<2)return t;return App.sprintf.apply(this,arguments)}if(arguments.length<2)return App.i18n[t];arguments[0]=App.i18n[t];return App.sprintf.apply(this,arguments)},langInfo:function(){if(w!=null)return w;var t=App.lang.split("-",2);w={encoding:t[0],country:""};if(t.length>1)w.country=t[1].toUpperCase();return w},langTag:function(t){var e=App.langInfo();if(e.country){if(t==null){t="-"}return e.encoding+t+e.country}return e.encoding},initTool:function(){s.on("mouseenter",function(t){$(this).addClass("over")}).on("mouseleave",function(){$(this).removeClass("over");s.fadeOut("fast")});$(document).on("click",function(){s.hide()});$(document).on("touchstart click",function(t){s.fadeOut("fast")});s.on("click",function(t){t.stopPropagation()})},initLeftNav:function(){$(".cl-vnavigation li ul").each(function(){$(this).parent().addClass("parent")});$(".cl-vnavigation li ul li.active").each(function(){$(this).parent().show().parent().addClass("open")});if(!$(".cl-vnavigation").data("initclick")){$(".cl-vnavigation").data("initclick",true);$(".cl-vnavigation").on("click",".parent > a",function(t){$(".cl-vnavigation .parent.open > ul").not($(this).parent().find("ul")).slideUp(300,"swing",function(){$(this).parent().removeClass("open")});var e=$(this).parent().find("ul");e.slideToggle(300,"swing",function(){var t=$(this).parent();if(t.hasClass("open")){t.removeClass("open")}else{t.addClass("open")}$("#cl-wrapper .nscroller").nanoScroller({preventPageScrolling:true})});t.preventDefault()})}$(".cl-vnavigation li").on("mouseenter",function(t){h(this,t)}).on("mouseleave",function(t){s.removeClass("over");setTimeout(function(){if(!s.hasClass("over")&&!$(".cl-vnavigation li:hover").length>0){s.hide()}},500)});$(".cl-vnavigation li").on("click",function(t){if(($("#cl-wrapper").hasClass("sb-collapsed")||$(window).width()>755&&$(window).width()<963)&&$("ul",this).length>0&&!($(window).width()<755)){h(this,t);t.stopPropagation()}})},initLeftNavAjax:function(t,e){App.markNavByURL(t);App.attachPjax(e,{onclick:function(t){if($(t).data("marknav")){App.unmarkNav($(t),$(t).data("marknav"));App.markNav($(t),$(t).data("marknav"))}},onend:function(t,e,a){$(a.container).find('[data-popover="popover"]').popover();$(a.container).find('.ttip, [data-toggle="tooltip"]').tooltip()}});App.attachAjaxURL(e)},init:function(t){$.extend(a,t);App.initLeftNav();App.initTool();App.showRequriedInputStar();$(".cl-toggle").on("click",function(t){var e=$(".cl-vnavigation");e.slideToggle(300,"swing",function(){});t.preventDefault()});$("#sidebar-collapse").on("click",function(){n()});if($("#cl-wrapper").hasClass("fixed-menu")){var i=$("#cl-wrapper .menu-space");i.addClass("nano nscroller");function e(){var t=$("#cl-wrapper .collapse-button");var e=t.outerHeight();var a=$("#head-nav").height();var n=$(window).height()-(t.is(":visible")?e:0)-a;i.css("height",n);$("#cl-wrapper .nscroller").nanoScroller({preventPageScrolling:true})}$(window).on("resize",function(){e()});e();$("#cl-wrapper .nscroller").nanoScroller({preventPageScrolling:true})}else{$(window).on("resize",function(){if($(window).width()>767){var t=$("#head-nav").height();$("#cl-wrapper").css("padding-top",t)}})}v();if($(".ui-datepicker").length>0)$(".ui-datepicker").datepicker();if(a.tooltip){$('.ttip, [data-toggle="tooltip"]').tooltip()}if(a.popover){$('[data-popover="popover"]').popover()}if(a.nanoScroller){$(".nscroller:not(.has-scrollbar)").nanoScroller()}if(a.bootstrapSwitch){if($(".switch:not(.has-switch)").length>0)$(".switch:not(.has-switch)").bootstrapSwitch()}if(a.dateTime){if($(".datetime").length>0)$(".datetime").datetimepicker({autoclose:true})}if(a.select2){if($(".select2").length>0)$(".select2").select2({width:"100%"})}if(a.tags){if($(".tags").length>0)$(".tags").select2({tags:0,width:"100%"})}if(a.slider){if($(".bslider").length>0)$(".bslider").slider()}if(a.hiddenElements){$(".dropdown").on("shown.bs.dropdown",function(){$(".nscroller").nanoScroller()});$(".nav-tabs").on("shown.bs.tab",function(t){$(".nscroller").nanoScroller()})}App.startLazyload();App.autoFixedThead();$(window).trigger("scroll")},autoFixedThead:function(t){if(t==null)t="";var e=function(){return $(window).width()>=753?$("#head-nav").height():0};App.topFloatThead(t+"thead.auto-fixed",e)},pageAside:function(t){e(t)},tableReponsiveInit:function(t){r(t)},tableReponsive:function(t){g(t)},toggleSideBar:function(){n()},wizard:function(){t()},markNavByURL:function(t){if(!t)t=window.location.pathname;if(t=="/index")return;var e=$('#leftnav a[href="'+BACKEND_URL+t+'"]');if(e.length<1)e=$('#leftnav a[href="'+t+'"]');App.markNav(e,"left");var a=$('#topnav a[href="'+BACKEND_URL+t+'"]:first');if(a.length<1)a=$('#topnav a[href="'+t+'"]:first');App.markNav(a,"top")},markNav:function(t,e){if(t.length<1)return;var a=t.parent("li").addClass("active");switch(e){case"left":a.parent(".from-left").show().parent("li").addClass("open");var n=$("#leftnav").attr("data-project");var i=$('#topnav li[data-project="'+n+'"]');if(i.length>0&&!i.hasClass("active")){i.addClass("active").siblings(".active").removeClass("active").find(".active").removeClass("active")}break;case"top":a.parent(".from-top").parent("li").addClass("active").siblings("li.active").removeClass("active");break}},unmarkNav:function(t,e){var a=t.parent("li");var n=a.siblings("li.active");if(n.length>0){n.removeClass("active");return}switch(e){case"left":if(a.parent("ul.sub-menu").length>0){var i=$(".col-menu-2").children("li.open");if(i.length>0)i.removeClass("open").find("li.active").removeClass("active")}$("#leftnav > .open").removeClass("open").children("ul.sub-menu").hide().children("li.active").removeClass("active");$("#leftnav .active").removeClass("active");break;case"top":var r=a.parent("ul.dropdown-menu.from-top");if(r.length>0){n=r.parent("li").addClass("active").siblings("li.active")}if(n.length>0){n.removeClass("active").children("ul.dropdown-menu.from-top").children("li.active").removeClass("active")}break}},message:function(t,e){if(typeof t=="string"){switch(t){case"remove":var a=e;return $.gritter.remove(a);case"clear":return $.gritter.removeAll(e||{})}}var n={title:App.i18n.SYS_INFO,text:"",image:"",class_name:"clean",sticky:false};if(typeof t!="object")t={text:t,class_name:"clean"};if(typeof t.type!="undefined"&&t.type)t.class_name=t.type;t=$.extend({},n,t||{});switch(t.class_name){case"dark":case"primary":case"clean":case"info":if(t.title)t.title=' '+App.t(t.title);break;case"error":t.class_name="danger";case"danger":if(t.title)t.title=' '+App.t(t.title);break;case"warning":if(t.title)t.title=' '+App.t(t.title);break;case"success":if(t.title)t.title=' '+App.t(t.title);break}if(e!=null)t.sticky=e;if(t.text)t.text=App.t(t.text);var a=$.gritter.add(t);return a},attachAjaxURL:function(t){if(t==null)t=document;$(t).on("click","[data-ajax-url]",function(){var n=$(this),t=n.data("ajax-confirm");if(n.data("processing")){alert(App.t("Processing, please wait for the operation to complete"));return}if(t&&!confirm(t))return;n.data("processing",true);var e=n.data("ajax-url"),a=n.data("ajax-method")||"get",i=n.data("ajax-params")||{},r=n.attr("title")||App.i18n.SYS_INFO,o=n.data("ajax-accept")||"html",s=n.data("ajax-target"),l=n.data("ajax-callback"),c=n.data("ajax-toggle"),f=n.data("ajax-onsuccess"),d=n.data("ajax-reload")||false;if(!r)r=n.text();var p=n.children(".fa");var u=c&&p.length>0;if(u){p.addClass("fa-spin")}else{App.loading("show")}n.trigger("processing");if(typeof i==="function")i=i.apply(this,arguments);i=App.setClientID(i);$[a](e,i||{},function(t){n.data("processing",false);n.trigger("finished",arguments);if(u){p.removeClass("fa-spin")}else{App.loading("hide")}if(l)return l.apply(this,arguments);if(s){var e;if(o=="json"){if(t.Code!=1){return App.message({title:r,text:t.Info,type:"error",time:5e3,sticky:false})}e=t.Data}else{e=t}$(s).html(e);n.trigger("partial.loaded",arguments);$(s).trigger("partial.loaded",arguments);if(f)window.setTimeout(f,0);return}if(t.Code==1){if(f)window.setTimeout(f,2e3);if(d)window.setTimeout(function(){window.location.reload()},2e3)}if(o=="json"){return App.message({title:r,text:t.Info,type:t.Code==1?"success":"error",time:5e3,sticky:false})}App.message({title:r,text:t,time:5e3,sticky:false})},o).error(function(t,e,a){n.data("processing",false);n.trigger("finished",arguments);if(u){p.removeClass("fa-spin")}else{App.loading("hide")}App.message({title:r,text:t.responseText,type:"error",time:5e3,sticky:false})})})},startLazyload:function(t){if(t==null)t=document;$(t).find("[lazyload-url]:not([loaded])").each(function(){var n=$(this);n.attr("loaded","1");var t=n.attr("lazyload-url"),e=n.attr("lazyload-method")||"get",a=n.attr("lazyload-params")||{},i=n.attr("title")||App.i18n.SYS_INFO,r=n.attr("lazyload-accept")||"html",o=n.attr("lazyload-target"),s=n.attr("lazyload-onsuccess");if(!i)i=n.text();if(!o)o=this;$(o).html('');if(typeof a==="function")a=a.apply(this,arguments);a=App.setClientID(a||{});$.ajax({type:e,url:t,async:true,dataType:r,data:a||{},success:function(t){n.trigger("finished",arguments);var e;if(r=="json"){if(t.Code!=1){$(o).html(''+t.Info+" ");return}e=t.Data.html||""}else{e=t}$(o).html(e);if(s)window.setTimeout(s,0)},error:function(t,e,a){n.trigger("finished",arguments);$(o).html(''+t.responseText+" ")}})})},postFormData:function(t,e,a,n,i){var r=$(t);var o=new FormData(r[0]);if(e){for(var s in e){o.append(s,e[s])}}var l=App.getClientID();if(l)o.append("notifyClientID",l);if(!i)i="json";var c=r.attr("action");$.ajax({type:"post",url:c,data:o,dataType:i,cache:false,processData:false,contentType:false}).success(function(t){a&&a.apply(this,arguments)}).error(function(t,e,a){n&&n.apply(this,arguments)})},attachPjax:function(t,e,f){if(!$.support.pjax)return;if(t==null)t="a";if(f==null)f=5e3;var a={onclick:null,onsend:null,oncomplete:null,ontimeout:null,onstart:null,onend:null};var d=$.extend({},a,e||{});$(document).on("click",t+"[data-pjax]",function(t){var e=$(this).data("pjax"),a=$(this).data("keepjs");var n=$(this).data("onclick"),i=$(this).data("toggleclass");$.pjax.click(t,e,{timeout:f,keepjs:a});if(d.onclick)d.onclick(this);if(n&&typeof window[n]=="function")window[n](this);if(i){var r=i.split(":"),o,s;if(r.length>1){o=r[0];i=r[1]}i=i.replace(/^\./g,"");if(o){var l=o.indexOf("."),c;if(l>0){c=o.substring(l+1);o=o.substring(0,l)}switch(o){case"parent":s=$(this).parent(c);break;case"parents":s=$(this).parents(c);break;case"closest":s=$(this).closest(c);break;default:s=$(this).parent(c);break}}else{s=$(this)}s.addClass(i).siblings("."+i).removeClass(i)}$(".sp_result_area").remove();$(".tox").remove();$(".select2-hidden-accessible").remove();$(".select2-sizer").remove();$(".select2-drop").remove();$("#select2-drop-mask").remove()}).on("pjax:send",function(t,e,a){App.loading("show");if(d.onsend)d.onsend(t,e,a)}).on("pjax:complete",function(t,e,a,n){App.loading("hide");if(d.oncomplete)d.oncomplete(t,e,a,n)}).on("pjax:timeout",function(t,e,a){console.log("timeout");App.loading("hide");if(d.ontimeout)d.ontimeout(t,e,a)}).on("pjax:start",function(t,e,a){if(d.onstart)d.onstart(t,e,a)}).on("pjax:end",function(t,e,a){App.loading("hide");if(d.onend)d.onend(t,e,a);if(a.container){App.bottomFloat(a.container+" .pagination");App.bottomFloat(a.container+" .form-submit-group",0,true);$(a.container+" .switch:not(.has-switch)").bootstrapSwitch();App.autoFixedThead(a.container+" ")}if(a.type=="GET")$("#global-search-form").attr("action",a.url);App.startLazyload(a.container);App.formWithNotify()})},attachTurn:function(t,e){var a={elem:t,target:$(t).data("target"),show:{Y:true,N:false},event:"click"};if(typeof e=="string"){a.target=e;e={}}var i=$.extend(a,e||{});if(i.event==null)i.event="click";if($(i.elem).length<1)return;$(i.elem).on(i.event,function(){var t=$(this).val(),e=$(i.target);var a=$(this).data("turn");if(a){a=a=="on"||a=="1"||a=="true"||a=="Y";if(a){e.show()}else{e.hide()}}else if(typeof a!="undefined"){e.hide()}if(i.prop){for(var n in i.prop){e.prop(n,i.prop.prop[t])}return}if(t in i.show){if(i.show[t]){e.show()}else{e.hide()}}});switch($(i.elem)[0].tagName.toUpperCase()){case"INPUT":$(i.elem+":checked").trigger(i.event);break;case"SELECT":if(!$(i.elem).children("option:first").prop("selected")){$(i.elem).trigger(i.event)}break}},wsURL:function(t){var e="ws:";if(window.location.protocol=="https:")e="wss:";var a=String(t).indexOf("//");if(a==-1){t=e+"//"+window.location.host+t}else{t=e+String(t).substring(a)}return t},websocket:function(e,t,a){t=App.wsURL(t);var n=new WebSocket(t);n.onopen=function(t){console.log("Websocket Server is connected");if(a!=null&&typeof a==="function")a.apply(this,arguments)};n.onclose=function(t){console.log("Websocket Server is disconnected")};n.onmessage=function(t){e(t.data)};n.onerror=function(t){console.dir(t)};if(a!=null&&typeof a=="object"){n=$.extend({},n,a)}return n},notifyRecvDefault:function(t,e,a){var n="notify-default-shower",i="notify-default-shower-body";var r="#"+n,o="#"+i;if(a==null)a=false;if(a&&!t){if($(r).length>0)$(o).slideUp("slow",function(){$(r).remove()});return}if($(r).length<1){$("body").append('
\t\t\t\t
\t\t\t\t
\t\t\t\t
');if(!a){var s=window.setInterval(function(){var t=Number($(r).attr("updated")||0);if((new Date).getTime()-t>5e3&&!$("#loading-status").is(":visible")){window.clearInterval(s);$(o).slideUp("slow",function(){$(r).remove()})}},1e3)}}$(r).attr("updated",(new Date).getTime());if(e)t="["+Number(e).toFixed(2)+"%] "+t;$(o).text(t)},formWithNotify:function(){if(typeof App.clientID["notify"]=="undefined"||!App.clientID["notify"])return;var t=$("#pcont").find("form[notify]");if(t.length<1)return;var e=t.find("input[name=notifyClientID]");if(e.length<1){t.append('')}else if(e.val()!=App.clientID["notify"]){e.val(App.clientID["notify"])}},getClientID:function(t){if(t==null||!t)t="notify";if(typeof App.clientID[t]=="undefined")return null;return App.clientID[t]},setClientID:function(t,e){var a=App.getClientID(e);if(!a)return t;if(typeof t=="array"){t=append({name:"notifyClientID",value:a})}else{t["notifyClientID"]=a}return t},notifyListen:function(){var l={notify:0,element:0,modal:0},c={notify:20,element:50,modal:50};App.websocket(function(t){var e=$.parseJSON(t);if(!e){App.message({text:t||"Websocket Server is disconnected",type:"error"});return false}if(typeof App.clientID["notify"]=="undefined"){App.clientID["notify"]=e.client_id;App.formWithNotify()}if(typeof e.content=="undefined"||!e.content){return false}switch(e.mode){case"-":break;case"element":var a=$("#notify-element-"+e.type);if(a.length<1){var n="recv_notice_"+e.type;if(typeof window[n]!="undefined"){return window[n](e)}if(e.status>0){console.info(e.content)}else{console.error(e.content)}App.notifyRecvDefault(e.content,e.progress?e.progress.percent:0);return false}if(l[e.mode]>=c[e.mode]){a.find("li:first").remove();l[e.mode]--}if(e.title){var i="badge-danger";if(e.status>0)i="badge-success";t=''+App.text2html(e.title)+" "+App.text2html(e.content)}else{t=App.text2html(e.content)}a.append("
  • "+t+"
  • ");l[e.mode]++;break;case"modal":var a=$("#notify-modal-"+e.type);if(a.length<1){var n="recv_notice_"+e.type;if(typeof window[n]!="undefined"){return window[n](e)}if(e.status>0){console.info(e.content)}else{console.error(e.content)}App.notifyRecvDefault(e.content,e.progress?e.progress.percent:0);return false}if(e.title){var i="badge-danger";if(e.status>0)i="badge-success";t=''+App.text2html(e.title)+" "+App.text2html(e.content)}else{t=App.text2html(e.content,e.progress?e.progress.percent:0)}if(!a.data("shown")){l[e.mode]=0;a.data("shown",true);var r=a.find(".modal-body"),o=r.children("ul.modal-body-ul");if(o.length<1){r.html('")}else{o.html("
  • "+t+"
  • ")}a.niftyModal("show",{afterOpen:function(t){},afterClose:function(t){a.data("shown",false)}})}else{var s=$("#notify-modal-"+e.type+"-container");if(l[e.mode]>=c[e.mode]){s.find("li:first").remove();l[e.mode]--}s.append("
  • "+t+"
  • ")}l[e.mode]++;break;case"notify":var a=$("#notice-message-container");if(a.length<1){App.message({title:App.i18n.SYS_INFO,text:'',sticky:true});a=$("#notice-message-container")}if(l[e.mode]>=c[e.mode]){a.find("li:first").remove();l[e.mode]--}if(e.title){var i="badge-danger";if(e.status>0)i="badge-success";t=''+App.text2html(e.title)+""+App.text2html(e.content)}else{t=App.text2html(e.content)}a.append("
  • "+t+"
  • ");l[e.mode]++;break;default:if(e.status>0){console.info(e.content)}else{console.error(e.content)}App.notifyRecvDefault(e.content,e.progress?e.progress.percent:0);break}return true},BACKEND_URL+"/user/notice")},text2html:function(t,e){t=String(t);if(!e)t.replace(/<|>/g,function(t){return t=="<"?"<":">"});return App.textNl2br(t)},ifTextNl2br:function(t){t=String(t);if(/<[^>]+>/.test(t))return t;return App.textNl2br(t)},textNl2br:function(t){return t.replace(p,function(t){return u[t]})},trimSpace:function(t){return String(t).replace(/^[\s]+|[\s]+$/g,"")},checkedAll:function(t,e){return $(e).not(":disabled").prop("checked",$(t).prop("checked"))},attachCheckedAll:function(t,e,a){$(t).on("ifChecked ifUnchecked click",function(){App.checkedAll(this,e);if(a)$(a).text($(e+":checked").length)})},alertBlock:function(t,e,a){switch(a){case"info":if(e==null)e="Info!";return'
    \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'+e+" "+t+"
    ";case"warn":if(e==null)e="Alert!";return'
    \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'+e+" "+t+"
    ";case"error":if(e==null)e="Error!";return'
    \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'+e+" "+t+"
    ";default:if(e==null)e="Success!";return'
    \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'+e+" "+t+"
    "}},alertBlockx:function(t,e,a){switch(a){case"info":if(e==null)e="Info!";return'
    \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t
    \t\t\t\t\t\t\t\t'+e+" "+t+"
    ";case"warn":if(e==null)e="Alert!";return'
    \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t
    \t\t\t\t\t\t\t\t'+e+" "+t+"
    ";case"error":if(e==null)e="Error!";return'
    \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t
    \t\t\t\t\t\t\t\t'+e+" "+t+"
    ";default:if(e==null)e="Success!";return'
    \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t
    \t\t\t\t\t\t\t\t'+e+" "+t+"
    "}},showDbLog:function(t,e){if(e==null)e=".block-flat:first";if(typeof t.length=="undefined")t=[t];for(var a=0;a0){for(var r=0;r'+n.SQLs[r]+""}else{i+=''+n.SQL+""}var o="success";if(n.Error){i+="("+n.Error+")";o="error"}else{i+="("+n.Elapsed+")"}$(e).before(App.alertBlockx(i,null,o))}},loading:function(t){var e=$("#loading-status");switch(t){case"show":if(e.length>0){e.show()}else{$("body").append('
    ')}break;case"hide":if(e.length>0){e.hide()}}},insertAtCursor:function(t,e,a,n){if(typeof TextAreaEditor!="undefined"){TextAreaEditor.setSelectText(t,e,a,n);return}if(document.selection){t.focus();sel=document.selection.createRange();sel.text=e;sel.select()}else if(t.selectionStart||t.selectionStart=="0"){var i=t.selectionStart;var r=t.selectionEnd;var o=t.scrollTop;t.value=t.value.substring(0,i)+e+t.value.substring(r,t.value.length);if(o>0)t.scrollTop=o;t.focus();t.selectionStart=i+e.length;t.selectionEnd=i+e.length}else{t.value+=e;t.focus()}},attachInsertableCode:function(t){var e={selector:"",isHTML:false,posStart:null,posEnd:null,posStartChar:null,posEndChar:null};var i=$.extend(e,t||{});if(i.isHTML==null)i.isHTML=false;if(i.selector==null)i.selector="";var a="",r="";if(i.isHTML){a="html";r="html"}else{a="text";r="text"}var n=".insertable-code-"+a+"[data-target]";var o=typeof i.selector=="string"?$(i.selector+n):$(i.selector).find(n);o.each(function(){if($(this).data("insertable-code-attached"))return;$(this).data("insertable-code-attached",true);var t=$(this).children("code");var n=$($(this).data("target"));$(this).children("code:not(.clickable)").addClass("clickable");t.on("click",function(){var t=$(this)[r]();var e=i.posStart,a=i.posEnd;if(i.posStartChar!==null){e=t.indexOf(i.posStartChar)+1}if(i.posEndChar!==null){if(e===null)e=0;a=t.indexOf(i.posEndChar,e)-1}App.insertAtCursor(n[0],t,e,a)})})},searchFS:function(t,i,r,o,s){if(i==null)i=10;if(o==null)o=BACKEND_URL+"/user/autocomplete_path";$(t).typeahead({hint:true,highlight:true,minLength:1},{source:function(t,e,a){var n={query:t,size:i,type:r};if(s){n=s(n);if(!n){e([]);return}}$.ajax({url:o,type:"get",data:n,dataType:"json",async:false,success:function(t){var a=[];if(!t.Data)return;$.each(t.Data,function(t,e){a.push(e)});e(a)}})},limit:i})},randomString:function(t){t=t||32;var e="ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678";var a=e.length;var n="";for(i=0;i=a){if($(e).hasClass("always-bottom")){$(e).removeClass("always-bottom");$(e).next(".fixed-placeholder").hide()}return}if(!$(e).hasClass("always-bottom")){$(e).addClass("always-bottom");if($(e).next(".fixed-placeholder").length>0){$(e).next(".fixed-placeholder").show()}else{$(e).after('
    ')}}})})},topFloat:function(t,r,o){if($(t).length<1)return;if(r==null)r=0;$(t).not("[disabled-fixed]").each(function(){$(this).attr("disabled-fixed","fixed");var e=this;var a=$(e).offset().top;var n=$(e).outerWidth(),i=$(e).outerHeight();if(!o)o=$(e).data("auto-width");if(o)$(e).css("width",n);$(window).on("scroll",function(){var t=$(this).scrollTop();if(t<=a){if($(e).hasClass("always-top")){$(e).removeClass("always-top");$(e).next(".fixed-placeholder").hide()}return}if(!$(e).hasClass("always-top")){$(e).addClass("always-top").css("top",r);if($(e).next(".fixed-placeholder").length>0){$(e).next(".fixed-placeholder").show()}else{$(e).after('
    ')}}})})},topFloatRawThead:function(t,e){if($(t).length<1)return;var r=null;if(typeof e=="function"){r=e}else{if(e==null)e=0;r=function(){return e}}$(t).not("[disabled-fixed]").each(function(){$(this).attr("disabled-fixed","fixed");var d=this,p=$(d).parent("table"),u=p.closest(".table-responsive");var h=u.length>0;var n=$(d).offset().top,t=Number(String(p.css("margin-top")).replace(/px$/,""));$(d).css({"background-color":"white"});p.data("originalMarginTop",t);var i=function(t){if(t==null)t=false;if(h){g(u);if(!u.hasClass("overflow")){$(d).css({width:"auto","overflow-x":"unset"})}}var e=p.width(),a=$(window).scrollLeft();var n=$(d).width(),i=1;if(!t){if(Math.abs(e-n)>1){i=n/e}if(p.data("offset-left")!=p.offset().left){$(d).css({left:p.offset().left})}else if(p.data("scroll-left")!=a){var r=p.offset().left-a;$(d).css({left:r});if(i==1)return}}var o=$(d).data("ratio")||0;$(d).data("ratio",i);p.data("offset-left",p.offset().left);p.data("scroll-left",a);var s=p.children("colgroup").length>0?p.children("colgroup").children("col"):p.children("col"),l=$(d).find("td,th");if(s.length<1){var c="";$(d).css({width:p.width()});l.each(function(){var t=$(this).outerWidth(),e=t*i;c+='
    ';$(this).css({"min-width":e,width:e,"max-width":"auto"})});p.prepend(c);return}if(o==i)return;$(d).css({width:e});var f=p.children("tbody").length>0?p.children("tbody").children("tr:first").find("td"):p.children("tr:first").find("td");l.each(function(t){var e=s.eq(t),a=f.eq(t);var n=!a||e.outerWidth()>a.outerWidth()?e.outerWidth():a.outerWidth();$(this).css({width:n})})};i(true);window.setTimeout(function(){i()},500);$(window).on("scroll resize",function(){i();var t=$(this).scrollTop(),e=p.height()+n-$(d).outerHeight()*2;if(t<=n||t>=e){if($(d).hasClass("always-top")){$(d).removeClass("always-top");p.css({"margin-top":p.data("originalMarginTop")})}if(h){$(d).off("scroll").data("scroll-reponsive",false);u.off("scroll").data("scroll-thead",false)}return}if(p.height()>$(window).height()){if(!$(d).hasClass("always-top")){$(d).addClass("always-top");p.css({"margin-top":p.data("originalMarginTop")+$(d).height()})}var a={top:r()};if(h){if(!u.data("scroll-thead")){u.on("scroll",function(){$(d).css({left:u.offset().left+$(this).scrollLeft()*-1})}).data("scroll-thead",true)}}$(d).css(a)}})});$(window).trigger("scroll")},topFloatThead:function(t,e,a){if(!a)return App.topFloatRawThead(t,e);if($(t).length<1)return;var o=null;if(typeof e=="function"){o=e}else{if(e==null)e=0;o=function(){return e}}$(t).not("[disabled-fixed]").each(function(){$(this).attr("disabled-fixed","fixed");var a=this,n=$(a).parent("table"),s=n.closest(".table-responsive");var l=s.length>0;var i=$(a).offset().top,t=$(a).data("copy");if(t){$("#tableCopy"+t).remove()}else{t=Math.random();$(a).data("copy",t)}var c=$('
    ');var f=$('
    ');var d=$(a).clone();f.append(d);c.html(f);var r=function(i){if(i==null)i=false;if(!i){var t=l?s.width():n.width();if(c.width()!=t){c.css({width:t})}else if(f.data("scroll-left")!=$(window).scrollLeft()){f.css({left:$(a).offset().left-$(window).scrollLeft()});return}else{return}}f.data("offset-left",n.offset().left);f.data("scroll-left",$(window).scrollLeft());var r=d.find("td,th"),o=$(a).find("td,th");o.each(function(t){var e=r.eq(t);e.css({width:$(this).outerWidth()});if(!i)return;var a=e.find("input:checkbox");if(a.length<1)return;var n=o.find("input:checkbox");a.each(function(t){n.eq(t).on("click change",function(){a.prop("checked",$(this).prop("checked"))})})});var t=l?s.width():n.width(),e=$(a).outerHeight();f.css({width:t,height:e})};r(true);c.hide();n.after(c);window.setTimeout(function(){r()},500);$(window).on("scroll",function(){r();var t=$(this).scrollTop(),e=n.height()+i-$(a).outerHeight()*2;if(t<=i||t>=e)return c.hide();c.show()});if(s.length>0&&!s.data("scroll-thead")){s.on("scroll",function(){f.css({left:$(this).scrollLeft()*-1})}).data("scroll-thead",true)}})},getImgNaturalDimensions:function(t,e){if(t&&t.naturalWidth){e({w:t.naturalWidth,h:t.naturalHeight});return}var a=new Image;a.onload=function(){e({w:a.width,h:a.height})};if(t)a.src=t.src},reportBug:function(t){$.post(t,{panic:$("#panic-content").html(),url:window.location.href},function(t){},"json")},replaceURLParam:function(t,e,a){if(a==null)a=window.location.href;e=encodeURIComponent(e);var n=String(a).indexOf("?");if(n<0)return a+"?"+t+"="+e;var i=a.substring(n),r=new RegExp("([\\?&]"+t+"=)[^&]*(&|$)");if(!r.test(i))return a+"&"+t+"="+e;a=a.substring(0,n);i=i.replace(r,"$1"+e+"$2");return a+i},switchLang:function(t){window.location=App.replaceURLParam("lang",t)},extends:function(t,e){var a=function(){};a.prototype=e.prototype;t.prototype=new a;t.prototype.constructor=t},formatBytes:function(t,e){if(e==null)e=2;var a=["YB","ZB","EB","PB","TB","GB","MB","KB","B"];var n=a.length;for(n--;n>0&&t>1024;n--){t/=1024}return t.toFixed(e)+a[n]},format:function(t,e,a){if(a){if(typeof a[e.y]=="function")return a[e.y](t,e.x);if(typeof a[""]=="function")return a[""](t,e.x)}return t},genTable:function(t,e){var a='';var n="",i="";for(var r=0;r'+s+""}i+="";for(var s in o)i+='";i+=""}n+="";i+="";a+=n+i+"
    '+App.format(o[s],{x:r,y:s},e)+"
    ";return a},httpStatusColor:function(t){if(t>=500)return"danger";if(t>=400)return"warning";if(t>=300)return"info";return"success"},htmlEncode:function(t){if(!t)return t;return String(t).replace(l,function(t){return c[t]})},htmlDecode:function(t){if(!t)return t;return String(t).replace(f,function(t){return d[t]})},logShow:function(t,e,l){var a=$(t).data("modal-title"),n=$("#log-show-modal");if(a)n.find(".modal-header h3").text(a);if(!n.data("init")){n.data("init",true);$(window).off().on("resize",function(){n.css({height:$(window).height(),width:"100%","max-width":"100%",left:0,top:0,transform:"none"});n.find(".md-content").css("height",$(window).height());$("#log-show-content").css("height",$(window).height()-200)});$("#log-show-last-lines").on("change",function(t){var e=$(this).data("target");if(!e)return;var a=$(this).val();e.data("last-lines",a);e.trigger("click")});$("#log-show-charset").on("change",function(t){var e=$(this).data("target");if(!e)return;var a=$(this).val();e.data("charset",a);e.trigger("click")});n.find(".modal-footer .btn-refresh").on("click",function(t){var e=$("#log-show-last-lines").data("target");if(!e)return;e.trigger("click")});$(window).trigger("resize")}if(l==null)l="";var i=function(t){var e=$(t).data("url");var a=$(t).data("last-lines");if(a==null)a=100;$("#log-show-last-lines").data("target",$(t));var n=null;if($("#log-show-charset").length>0){$("#log-show-charset").data(`target`,$(t));n=$(t).data("charset")}var o="log-show-content",s="#"+o;var i=$("#log-show-modal");i.niftyModal("show",{afterOpen:function(r){var t={lastLines:a,pipe:l};if(n)t.charset=n;$.get(e,t,function(t){if(t.Code==1){var e=r.find(".modal-header .modal-subtitle");if(typeof t.Data.title!="undefined"){if(t.Data.title)t.Data.title=" ("+t.Data.title+")";e.html(t.Data.title)}else{e.empty()}if(typeof t.Data.list!="undefined"){var a=function(t,e){return'
    '+App.htmlEncode(t)+"
    "};var n='
    '+App.genTable(t.Data.list,{StatusCode:function(t,e){return''+t+""},Brower:a,UserAgent:a,URI:a,Referer:a,"":function(t,e){return App.htmlEncode(t)}})+"
    ";$(s).parent(".modal-body").css("padding",0);$(s).replaceWith(n)}else{if($(s)[0].tagName.toUpperCase()!="TEXTAREA"){$(s).replaceWith("")}$(s).text(t.Data.content)}if(typeof t.Data.charset!="undefined"&&$("#log-show-charset").length>0&&$("#log-show-charset").val()!=t.Data.charset){$("#log-show-charset").find('option[value="'+t.Data.charset+'"]').prop("selected",true)}$(window).trigger("resize");var i=$(s)[0];i.scrollTop=i.scrollHeight}else{$(s).text(t.Info)}},"json")},afterClose:function(t){$("#log-show-last-lines").find("option:selected").prop("selected",false);if($("#log-show-charset").length>0)$("#log-show-charset").find("option:selected").prop("selected",false)}})};if(e)return i(t);$(t).on("click",function(){i(this)})},tableSorting:function(t){t=t==null?"":t+" ";function f(t,e){var a,n,i;if(!e){a="fa-arrow-up";i="up";n="fa-arrow-down"}else{a="fa-arrow-down";i="down";n="fa-arrow-up"}if(t.length>0){var r=t.children(".fa");if(r.length<1){t.append('')}else{r.removeClass(n).addClass(a)}t.addClass("sort-active sort-"+i);t.siblings(".sort-active").removeClass("sort-active").removeClass("sort-up").removeClass("sort-down").find(".fa").remove()}}$(t+'[sort-current!=""]').each(function(){var t=String($(this).attr("sort-current"));var e=t.substring(0,1)=="-";if(e)t=t.substring(1);var a=$(this).find('[sort="'+t+'"]');if(a.length<1&&t){a=$(this).find('[sort="-'+t+'"]')}f(a,e)});$(t+"[sort-current] [sort]").css("cursor","pointer").on("click",function(t){var e=$(this).parents("[sort-current]");var a=e.attr("sort-current");var n=e.attr("sort-url")||window.location.href;var i=e.attr("sort-trigger")||e.data("sort-trigger");var r=$(this).attr("sort");if(a&&(a==r||a=="-"+r)){var o=/^\-/;a=o.test(a)?a.replace(o,""):"-"+a}else{a=r}e.attr("sort-current",a);n=App.replaceURLParam("sort",a,n);if(i){e.data("sort-url",n);var s=a.substring(0,1)=="-";f($(this),s);window.setTimeout(i,0)}else{var l=e.attr("sort-setto");if(l){var c=$(this);$.get(n,{},function(t,e,a){if(String(a.getResponseHeader("Content-Type")).split(";")[0]=="application/json"){try{t=JSON.parse(t)}catch(t){return App.message({text:t,type:"error"})}if(t.Code!=1)return App.message({text:t.Info,type:"error"});t=t.Data.html}$(l).html(t);if($(l).length>0&&$(l)[0].tagName.toUpperCase()=="TBODY"){var n=c.parents("[sort-current]");var i=n.attr("sort-current");var r=i.substring(0,1)=="-";f(c,r)}},"html")}else{window.location=n}}})},switchStatus:function(e,a,t,n){if(a==null)a=$(e).data("type");var i=$(e).val();var r=$(e).data("v-checked")||i||"N",o=$(e).data("v-unchecked")||(r=="N"?"Y":"N");if(a){var s=String(a).split("=");a=s[0];if(s.length>1&&s[1]){var l=s[1].split("|");if(l[0]==r){r=l[0];o=l[1]}else{r=l[1];o=l[0]}}}if(t==null)t=$(e).data("url");var c=$(e),f=e.checked?r:o,d={id:c.data("id")};d[a]=f;if(String(t).charAt(0)!="/")t=BACKEND_URL+"/"+t;$.get(t,d,function(t){if(t.Code==1){c.attr("data-"+a,f);c.prop("checked",f==i)}App.message({title:App.i18n.SYS_INFO,text:t.Info,time:5e3,sticky:false,class_name:t.Code==1?"success":"error"});if(n)n.call(e,t)},"json")},bindSwitch:function(t,e,a,n,i){if(e==null)e="click";var r=new RegExp("switch-([\\w\\d]+)");$(t).on(e,function(){if(n==null){var t=String($(this).attr("class")).match(r);n=t[1]}App.switchStatus(this,n,a,i)})},removeSelected:function(t,e,a,n){return App.opSelected(t,e,a,n,App.i18n.CONFIRM_REMOVE,App.i18n.PLEASE_SELECT_FOR_REMOVE)},opSelected:function(t,e,a,n,i,r){if(a==null){a=window.location.href}else if(String(a).charAt(0)!="/"){a=BACKEND_URL+"/"+a}if(e==null)e="id";var o=[];$(t).each(function(){if($(this).is(":checked")&&!$(this).prop("disabled"))o.push({name:e,value:$(this).val()})});if(o.length<1){App.message({title:App.i18n.SYS_INFO,text:r||App.i18n.PLEASE_SELECT_FOR_OPERATE,type:"warning"});return false}var s=i;if(s){s+="\n"+App.sprintf(App.i18n.SELECTED_ITEMS,o.length);if(!confirm(s))return false}App.loading("show");$.get(a,o,function(t){App.loading("hide");if(n&&typeof n==="function")return n();var e={title:App.i18n.SYS_INFO,text:t.Info,type:""};if(t.Code==1){e.type="success";if(!e.text)e.text="操作成功"}else{e.type="error";if(!e.text)e.text="操作失败"}App.message(e);window.setTimeout(function(){window.location.reload()},2e3)},"json");return true},parseBool:function(t){switch(String(t).toLowerCase()){case"0":case"false":case"n":case"no":case"off":case"null":return false;default:return true}},progressMonitor:function(e,a){NProgress.start();var n=window.setInterval(function(){var t=e()/a;if(t>=1){NProgress.set(1);window.clearInterval(n)}else{NProgress.set(t)}},50)},floatAtoi:function(t,e){var a={bottom:"7",right:"6",top:"5",left:"8",leftBottom:"4",rightBottom:"3",leftTop:"1",rightTop:"2"};if(typeof a[t]!=="undefined")return a[t];return e},float:function(t,e,a,n,i){if(!e)e="ajax";if(!a)a=e=="remind"?"rel":"src";if(!n)n="5-7";else{var r=String(n).split("-");var o=[];for(var s=0;s '+App.i18n.BUTTON_UPLOAD,previewTableContainer:"#previewTableContainer",url:"",previewTableShow:false,uploadProgress:function(t){var e=t*100;if(e>100){$.LoadingOverlay("hide");return}$.LoadingOverlay("progress",e)}};var r=$.extend({},i,e||{});var o=$(t).uploadPreviewer(r);$(t).data("uploadPreviewer",o);$(t).on("file-preview:changed",function(t){var e={image:ASSETS_URL+"/images/nging-gear.png",progress:false,maxSize:40,size:30,text:App.i18n.UPLOADING};if(r.uploadProgress){e.progress=true;e.progressFixedMargin="5px 0 0 0";e.image=""}$.LoadingOverlay("show",e);o.submit(function(t){$.LoadingOverlay("hide");if(t.Code==1){App.message({text:App.i18n.UPLOAD_SUCCEED,type:"success"});if(a!=null)a(t)}else{App.message({text:t.Info,type:"error"});if(n!=null)n(t)}},function(){if(n!=null)n()})})}},showRequriedInputStar:function(){$("form:not([required-redstar])").each(function(){$(this).attr("required-redstar","1");$(this).find("[required]").each(function(){var t=$(this).parent(".input-group");if(t.length>0){if(!t.hasClass("required"))t.addClass("required");return}t=$(this).closest('.form-group,div[class*="col-"]');if(t.length<1)return;var e;if(t.hasClass("form-group")){e=t.children(".control-label")}else{e=t.prev(".control-label")}if(e.length<1||e.hasClass("required"))return;e.addClass("required")})})},pushState:function(t,e,a){if(!window.history||!window.history.pushState)return;window.history.pushState(t,e,a)},replaceState:function(t,e,a){if(!window.history||!window.history.replaceState)return;window.history.replaceState(t,e,a)},formatJSON:function(t){t=$.trim(t);var e=t.substring(0,1);if(e=="["||e=="{"){var a=JSON.parse(t);t=JSON.stringify(a,null,"\t");return t}return""},formatJSONFromInnerHTML:function(t){if(t.data("jsonformatted"))return;t.data("jsonformatted",true);var e=App.formatJSON(t.html());if(e!="")t.html(e)},rewriteFormValueAsArray:function(t,e,a){var n=0;for(var i=0;in){r.value=a[n];n++}else{r.value=""}}}for(var i=n;i"+a+"").css({position:"absolute",display:"none",top:e+5,left:t+5,border:"1px solid #000",padding:"5px",color:"#fff","border-radius":"2px","font-size":"11px","background-color":"#000",opacity:.8}).appendTo("body").fadeIn(200)},plotHover:function(t,n){$(t).on("plothover",function(t,e,a){if(!a){$("#plot-tooltip").remove();m=null;return}if(m==a.dataIndex)return;m=a.dataIndex;$("#plot-tooltip").remove();if(n==null)n=function(t,e,a){var n=a.datapoint[0].toFixed(2),i=a.datapoint[1].toFixed(2);return a.series.label+" of "+n+" = "+i};App.plotTooltip(a.pageX,a.pageY,n.call(this,t,e,a))})},template:function(t,e,a){var n=$(t).attr("tpl"),i=String(n).split("=>");n=$.trim(i[0]).replace(/^#/,"");if($("#"+n).length<1)throw new Error("not found template: "+(typeof t=="string"?t:$(t).attr("id"))+"=>"+n);if(i.length>1){t=$.trim(i[1]);if($(t).length<1)throw new Error("[template] not found wrapper: "+t)}$(t).html(template(n,e));if(a==null)return;$(t).find("ul.pagination li > a[page]").on("click",function(){if($(this).closest("li.disabled").length>0)return;a($(this).attr("page"))});$(t).find("ul.pagination").on("refresh",function(){var t=1;if($(this).data("page")){t=$(this).data("page");$(this).data("page",false)}else{t=$(this).find("li.active > a[page]").data("page")||1}a(t)})},pagination:function(t,e){var a=[],n=t.page,i=t.pages;if(!e)e=10;var r=i-n,o=1,s=0;if(re)break;a.push(l)}var c={size:t.size,page:n,rows:t.rows,pages:i,pageNumbers:a};return c},withPagination:function(t,e,a){var n=App.pagination(t,e);if(a==null)a="tpl-pagination";t.pagination=template(a,n);return t},captchaUpdate:function(t,e){if(App.captchaHasError(e.Code)&&e.Data&&typeof e.Data.captchaIdent!=="undefined"){if(false==t instanceof jQuery)t=$(t);var a=t.find("input#"+e.Data.captchaIdent);a.val(e.Data.captchaID);a.siblings("img").attr("src",e.Data.captchaURL);if(e.Data.captchaName)t.find('input[name="'+e.Data.captchaName+'"]').focus()}},captchaHasError:function(t){return t>=-11&&t<=-9},treeToggle:function(t,a){var e={expandFirst:false,ajax:null,onclick:null};a=$.extend(e,a||{});if(!t)t=".treeview";var n=function(){var t=$(this).children(".fa"),e;if(t.length>0){e=$(this).next("ul.tree")}else if($(this).hasClass("fa")){t=$(this);e=$(this).parent().next("ul.tree")}else{return}if(t.hasClass("fa-folder-o")){t.removeClass("fa-folder-o").addClass("fa-folder-open-o")}else{t.removeClass("fa-folder-open-o").addClass("fa-folder-o")}e.toggle(300,function(){$(this).parent().toggleClass("open");$(".tree .nscroller").nanoScroller({preventPageScrolling:true});$(window).trigger("resize")})};$(t).on("click",".tree-toggler",function(){var t=this;if(typeof a.onclick==="function")a.onclick.apply(t,arguments);if($(t).data("loaded")||!a.ajax)return n.apply(t);$(t).data("loaded",true);var e=a.ajax;if(typeof a.ajax==="function"){e=a.ajax.apply(t,arguments)}if(typeof e.data==="function"){e.data=e.data.apply(t,arguments)}$.ajax(e).done(function(){n.apply(t,arguments)})});if(a.expandFirst)$(t+" label.tree-toggler:first").trigger("click")},isFunction:function(t){return typeof t==="function"},currentURL:function(){if(typeof window.IS_BACKEND!="undefined"&&window.IS_BACKEND){return BACKEND_URL}return FRONTEND_URL},makeCheckerForUpgrade:function(t,e,a,n){var i=0,r=false;if(t==null||!t)t=5;var o=function(){if(r)return;r=true;$.post(BACKEND_URL+"/manager/upgrade?t="+(new Date).getTime(),{local:true},function(t){r=false;if(t.Code!=1){if(n)n();return App.message({text:t.Info,type:"error"},true)}if(e!=t.Data.local.Number){if(n)n();return App.message({text:App.t("启动新版本失败!程序没有更新成功,当前启动的依然是旧版 v%s。自动升级功能可能不支持当前系统,建议您手动执行升级脚本进行升级。",t.Data.local.Number),type:"error"},true)}if(a)a();return App.message({text:App.t("恭喜,程序已经成功升级到 v%s",t.Data.local.Number),type:"success"},true)},"json").error(function(){i++;if(i0){e.attr("attached","1");e.on("click",function(){if(!confirm(App.t("建议升级前先备份相关文件和数据库,以防万一。")+"\n"+App.t("确定现在升级吗?")))return;var t=$(this);var n=function(){t.prop("disabled",true);t.prepend('')};n();var i=function(){t.prop("disabled",false);t.children("i").remove()};var r=$("#self-upgrade-modal"),o=r.data("version");$.post(BACKEND_URL+"/manager/upgrade",{download:true,notifyClientID:App.clientID["notify"]||"any",nonce:r.data("nonce"),version:o},function(t){i();if(t.Code!=1)return App.message({text:t.Info,type:"error"});if(t.Data&&"nonce"in t.Data){if(!confirm(App.t("程序已经成功更新,是否现在重启?"))){r.niftyModal("hide");return}App.loading("show");n();App.notifyRecvDefault(App.t("正在重启中,请稍候..."),0,true);var e=function(){App.loading("hide");App.notifyRecvDefault("",0,true);i();r.niftyModal("hide")};var a=App.makeCheckerForUpgrade(5,o,e,e);$.post(BACKEND_URL+"/manager/upgrade",{exit:true,nonce:t.Data.nonce},function(t){e();if(t.Code!=1)return App.message({text:t.Info,type:"error"});return App.message({text:t.Info,type:"success"})},"json").error(function(){window.setTimeout(a,2e3)});window.setTimeout(a,5e4);return}r.niftyModal("hide");return App.message({text:t.Info,type:"success"})}).error(function(t,e,a){i()})})}$.get(BACKEND_URL+"/manager/upgrade",{version:t},function(t){if(t.Code!=1){if(t.Code<-2||t.Code==0)console.debug(t.Info);return}if(!t.Data.isNew)return App.message({text:App.t("当前程序已经是版本 v%s,无需升级",t.Data.local.Number),type:"success"});var e=t.Data.remote,a=App.t("发布时间:")+" "+new Date(e.released_at*1e3).toLocaleString(LANGUAGE||"zh-cn",{dateStyle:"long"});n.find(".modal-header>h3").html(App.t("新版本: v%s",e.version));n.find(".modal-body").html('
    '+e.description+'
    '+a+"
    ");n.data("nonce",t.Data.nonce);n.data("version",e.version);n.niftyModal("show",{})},"json")}}}();$(function(){$("body").css({opacity:1,"margin-left":0})}); \ No newline at end of file +var App=function(){var a={tooltip:true,popover:true,nanoScroller:true,nestableLists:true,hiddenElements:true,bootstrapSwitch:true,dateTime:true,select2:true,tags:true,slider:true};var t=function(){$(".wizard-ux").wizard();$(".wizard-ux").on("changed",function(){$(".bslider").slider()});$(".wizard-next").on("click",function(t){$(".wizard-ux").wizard("next");t.preventDefault()});$(".wizard-previous").on("click",function(t){$(".wizard-ux").wizard("previous");t.preventDefault()})};function n(t){var e=$("#sidebar-collapse")[0];var a=$("#cl-wrapper");if(a.hasClass("sb-collapsed")){$(".fa",e).addClass("fa-angle-left").removeClass("fa-angle-right");a.removeClass("sb-collapsed")}else{$(".fa",e).removeClass("fa-angle-left").addClass("fa-angle-right");a.addClass("sb-collapsed")}}function e(){var i=window.location.pathname.replace(/^\//,"").replace(/[^\w]/g,"-");$(".page-aside").each(function(t){var e=$(this).attr("page-key")||i;var a=$(this),n=e+".page-aside-"+t;$(this).find(".header > .collapse-button").on("click",function(){a.addClass("collapsed");store.set(n,"collapsed");a.trigger("collapsed");g()});$(this).children(".collapsed-button").on("click",function(){a.removeClass("collapsed");store.set(n,"");a.trigger("expanded");g()});if(store.get(n)=="collapsed"){$(this).find(".header > .collapse-button").trigger("click")}})}function r(){var t=$("#main-container > .page-aside");var e=t.width();if(e<270){t.find(".header > .collapse-button").trigger("click");return}g()}function o(t){var e=t.children();if(e.length<1)return null;switch(e[0].tagName.toUpperCase()){case"TABLE":return e;default:return o(e)}}function g(t){if(t==null)t="#cl-wrapper > .cl-body .table-responsive";var e=t instanceof jQuery?t:$(t);var i=$("#pcont").offset().left,r=$(window).width()-i;e.each(function(){var t=$(this).offset().left-i;var e=r-t*2;var a=$(this).data("width");if(a&&a==e)return;$(this).data("width",e);var n=o($(this));if(n==null)return;if(n.outerWidth()>e){$(this).addClass("overflow").css("max-width",e)}else{$(this).removeClass("overflow").css("max-width",e)}})}var s=$("");var l=/&|<|>| |\'|\"/g,c={"&":"&","<":"<",">":">"," ":" ","'":"'",'"':"""};var f=/&|<|>| |'|"/g,d={"&":"&","<":"<",">":">"," ":" ","'":"'",""":'"'};var p=/\n| |\t/g,u={"\n":"
    "," ":"  ","\t":"    "};function h(t,e){if(($("#cl-wrapper").hasClass("sb-collapsed")||$(window).width()>755&&$(window).width()<963)&&$("ul",t).length>0){$(t).removeClass("ocult");var a=$("ul",t);if(!$(".dropdown-header",t).length){var n='";a.prepend(n)}s.appendTo("body");var i=$(t).offset().top+8-$(window).scrollTop();var r=$(t).width();s.css({top:i,left:r+8});s.html('");s.show();a.css("top",i)}else{s.hide()}}function v(){var t=220;var e=500;var a=$('');a.appendTo("body");$(window).on("scroll",function(){if($(this).scrollTop()>t){$(".back-to-top").fadeIn(e)}else{$(".back-to-top").fadeOut(e)}});$(".back-to-top").on("click",function(t){t.preventDefault();$("html, body").animate({scrollTop:0},e);return false})}var w=null,m=null;return{clientID:{},i18n:{SYS_INFO:"System Information",UPLOAD_ERR:"Upload Error",PLEASE_SELECT_FOR_OPERATE:"Please select the item you want to operate",PLEASE_SELECT_FOR_REMOVE:"Please select the item you want to delete",CONFIRM_REMOVE:"Are you sure you want to delete them?",SELECTED_ITEMS:"You have selected %d items",SUCCESS:"The operation was successful",FAILURE:"Operation failed",UPLOADING:"File uploading, please wait...",UPLOAD_SUCCEED:"Upload successfully",BUTTON_UPLOAD:"Upload"},lang:"en",sprintf:sprintfWrapper.init,t:function(t){if(typeof App.i18n[t]=="undefined"){if(arguments.length<2)return t;return App.sprintf.apply(this,arguments)}if(arguments.length<2)return App.i18n[t];arguments[0]=App.i18n[t];return App.sprintf.apply(this,arguments)},langInfo:function(){if(w!=null)return w;var t=App.lang.split("-",2);w={encoding:t[0],country:""};if(t.length>1)w.country=t[1].toUpperCase();return w},langTag:function(t){var e=App.langInfo();if(e.country){if(t==null){t="-"}return e.encoding+t+e.country}return e.encoding},initTool:function(){s.on("mouseenter",function(t){$(this).addClass("over")}).on("mouseleave",function(){$(this).removeClass("over");s.fadeOut("fast")});$(document).on("click",function(){s.hide()});$(document).on("touchstart click",function(t){s.fadeOut("fast")});s.on("click",function(t){t.stopPropagation()})},initLeftNav:function(){$(".cl-vnavigation li ul").each(function(){$(this).parent().addClass("parent")});$(".cl-vnavigation li ul li.active").each(function(){$(this).parent().show().parent().addClass("open")});if(!$(".cl-vnavigation").data("initclick")){$(".cl-vnavigation").data("initclick",true);$(".cl-vnavigation").on("click",".parent > a",function(t){$(".cl-vnavigation .parent.open > ul").not($(this).parent().find("ul")).slideUp(300,"swing",function(){$(this).parent().removeClass("open")});var e=$(this).parent().find("ul");e.slideToggle(300,"swing",function(){var t=$(this).parent();if(t.hasClass("open")){t.removeClass("open")}else{t.addClass("open")}$("#cl-wrapper .nscroller").nanoScroller({preventPageScrolling:true})});t.preventDefault()})}$(".cl-vnavigation li").on("mouseenter",function(t){h(this,t)}).on("mouseleave",function(t){s.removeClass("over");setTimeout(function(){if(!s.hasClass("over")&&!$(".cl-vnavigation li:hover").length>0){s.hide()}},500)});$(".cl-vnavigation li").on("click",function(t){if(($("#cl-wrapper").hasClass("sb-collapsed")||$(window).width()>755&&$(window).width()<963)&&$("ul",this).length>0&&!($(window).width()<755)){h(this,t);t.stopPropagation()}})},initLeftNavAjax:function(t,e){App.markNavByURL(t);App.attachPjax(e,{onclick:function(t){if($(t).data("marknav")){App.unmarkNav($(t),$(t).data("marknav"));App.markNav($(t),$(t).data("marknav"))}},onend:function(t,e,a){$(a.container).find('[data-popover="popover"]').popover();$(a.container).find('.ttip, [data-toggle="tooltip"]').tooltip()}});App.attachAjaxURL(e)},init:function(t){$.extend(a,t);App.initLeftNav();App.initTool();App.showRequriedInputStar();$(".cl-toggle").on("click",function(t){var e=$(".cl-vnavigation");e.slideToggle(300,"swing",function(){});t.preventDefault()});$("#sidebar-collapse").on("click",function(){n()});if($("#cl-wrapper").hasClass("fixed-menu")){var i=$("#cl-wrapper .menu-space");i.addClass("nano nscroller");function e(){var t=$("#cl-wrapper .collapse-button");var e=t.outerHeight();var a=$("#head-nav").height();var n=$(window).height()-(t.is(":visible")?e:0)-a;i.css("height",n);$("#cl-wrapper .nscroller").nanoScroller({preventPageScrolling:true})}$(window).on("resize",function(){e()});e();$("#cl-wrapper .nscroller").nanoScroller({preventPageScrolling:true})}else{$(window).on("resize",function(){if($(window).width()>767){var t=$("#head-nav").height();$("#cl-wrapper").css("padding-top",t)}})}v();if($(".ui-datepicker").length>0)$(".ui-datepicker").datepicker();if(a.tooltip){$('.ttip, [data-toggle="tooltip"]').tooltip()}if(a.popover){$('[data-popover="popover"]').popover()}if(a.nanoScroller){$(".nscroller:not(.has-scrollbar)").nanoScroller()}if(a.bootstrapSwitch){if($(".switch:not(.has-switch)").length>0)$(".switch:not(.has-switch)").bootstrapSwitch()}if(a.dateTime){if($(".datetime").length>0)$(".datetime").datetimepicker({autoclose:true})}if(a.select2){if($(".select2").length>0)$(".select2").select2({width:"100%"})}if(a.tags){if($(".tags").length>0)$(".tags").select2({tags:0,width:"100%"})}if(a.slider){if($(".bslider").length>0)$(".bslider").slider()}if(a.hiddenElements){$(".dropdown").on("shown.bs.dropdown",function(){$(".nscroller").nanoScroller()});$(".nav-tabs").on("shown.bs.tab",function(t){$(".nscroller").nanoScroller()})}App.startLazyload();App.autoFixedThead();$(window).trigger("scroll")},autoFixedThead:function(t){if(t==null)t="";var e=function(){return $(window).width()>=753?$("#head-nav").height():0};App.topFloatThead(t+"thead.auto-fixed",e)},pageAside:function(t){e(t)},tableReponsiveInit:function(t){r(t)},tableReponsive:function(t){g(t)},toggleSideBar:function(){n()},wizard:function(){t()},markNavByURL:function(t){if(!t)t=window.location.pathname;if(t=="/index")return;var e=$('#leftnav a[href="'+BACKEND_URL+t+'"]');if(e.length<1)e=$('#leftnav a[href="'+t+'"]');App.markNav(e,"left");var a=$('#topnav a[href="'+BACKEND_URL+t+'"]:first');if(a.length<1)a=$('#topnav a[href="'+t+'"]:first');App.markNav(a,"top")},markNav:function(t,e){if(t.length<1)return;var a=t.parent("li").addClass("active");switch(e){case"left":a.parent(".from-left").show().parent("li").addClass("open");var n=$("#leftnav").attr("data-project");var i=$('#topnav li[data-project="'+n+'"]');if(i.length>0&&!i.hasClass("active")){i.addClass("active").siblings(".active").removeClass("active").find(".active").removeClass("active")}break;case"top":a.parent(".from-top").parent("li").addClass("active").siblings("li.active").removeClass("active");break}},unmarkNav:function(t,e){var a=t.parent("li");var n=a.siblings("li.active");if(n.length>0){n.removeClass("active");return}switch(e){case"left":if(a.parent("ul.sub-menu").length>0){var i=$(".col-menu-2").children("li.open");if(i.length>0)i.removeClass("open").find("li.active").removeClass("active")}$("#leftnav > .open").removeClass("open").children("ul.sub-menu").hide().children("li.active").removeClass("active");$("#leftnav .active").removeClass("active");break;case"top":var r=a.parent("ul.dropdown-menu.from-top");if(r.length>0){n=r.parent("li").addClass("active").siblings("li.active")}if(n.length>0){n.removeClass("active").children("ul.dropdown-menu.from-top").children("li.active").removeClass("active")}break}},message:function(t,e){if(typeof t=="string"){switch(t){case"remove":var a=e;return $.gritter.remove(a);case"clear":return $.gritter.removeAll(e||{})}}var n={title:App.i18n.SYS_INFO,text:"",image:"",class_name:"clean",sticky:false};if(typeof t!="object")t={text:t,class_name:"clean"};if(typeof t.type!="undefined"&&t.type)t.class_name=t.type;t=$.extend({},n,t||{});switch(t.class_name){case"dark":case"primary":case"clean":case"info":if(t.title)t.title=' '+App.t(t.title);break;case"error":t.class_name="danger";case"danger":if(t.title)t.title=' '+App.t(t.title);break;case"warning":if(t.title)t.title=' '+App.t(t.title);break;case"success":if(t.title)t.title=' '+App.t(t.title);break}if(e!=null)t.sticky=e;if(t.text)t.text=App.t(t.text);var a=$.gritter.add(t);return a},attachAjaxURL:function(t){if(t==null)t=document;$(t).on("click","[data-ajax-url]",function(){var n=$(this),t=n.data("ajax-confirm");if(n.data("processing")){alert(App.t("Processing, please wait for the operation to complete"));return}if(t&&!confirm(t))return;n.data("processing",true);var e=n.data("ajax-url"),a=n.data("ajax-method")||"get",i=n.data("ajax-params")||{},r=n.attr("title")||App.i18n.SYS_INFO,o=n.data("ajax-accept")||"html",s=n.data("ajax-target"),l=n.data("ajax-callback"),c=n.data("ajax-toggle"),f=n.data("ajax-onsuccess"),d=n.data("ajax-reload")||false;if(!r)r=n.text();var p=n.children(".fa");var u=c&&p.length>0;if(u){p.addClass("fa-spin")}else{App.loading("show")}n.trigger("processing");if(typeof i==="function")i=i.apply(this,arguments);i=App.setClientID(i);$[a](e,i||{},function(t){n.data("processing",false);n.trigger("finished",arguments);if(u){p.removeClass("fa-spin")}else{App.loading("hide")}if(l)return l.apply(this,arguments);if(s){var e;if(o=="json"){if(t.Code!=1){return App.message({title:r,text:t.Info,type:"error",time:5e3,sticky:false})}e=t.Data}else{e=t}$(s).html(e);n.trigger("partial.loaded",arguments);$(s).trigger("partial.loaded",arguments);if(f)window.setTimeout(f,0);return}if(t.Code==1){if(f)window.setTimeout(f,2e3);if(d)window.setTimeout(function(){window.location.reload()},2e3)}if(o=="json"){return App.message({title:r,text:t.Info,type:t.Code==1?"success":"error",time:5e3,sticky:false})}App.message({title:r,text:t,time:5e3,sticky:false})},o).error(function(t,e,a){n.data("processing",false);n.trigger("finished",arguments);if(u){p.removeClass("fa-spin")}else{App.loading("hide")}App.message({title:r,text:t.responseText,type:"error",time:5e3,sticky:false})})})},startLazyload:function(t){if(t==null)t=document;$(t).find("[lazyload-url]:not([loaded])").each(function(){var n=$(this);n.attr("loaded","1");var t=n.attr("lazyload-url"),e=n.attr("lazyload-method")||"get",a=n.attr("lazyload-params")||{},i=n.attr("title")||App.i18n.SYS_INFO,r=n.attr("lazyload-accept")||"html",o=n.attr("lazyload-target"),s=n.attr("lazyload-onsuccess");if(!i)i=n.text();if(!o)o=this;$(o).html('');if(typeof a==="function")a=a.apply(this,arguments);a=App.setClientID(a||{});$.ajax({type:e,url:t,async:true,dataType:r,data:a||{},success:function(t){n.trigger("finished",arguments);var e;if(r=="json"){if(t.Code!=1){$(o).html(''+t.Info+" ");return}e=t.Data.html||""}else{e=t}$(o).html(e);if(s)window.setTimeout(s,0)},error:function(t,e,a){n.trigger("finished",arguments);$(o).html(''+t.responseText+" ")}})})},postFormData:function(t,e,a,n,i){var r=$(t);var o=new FormData(r[0]);if(e){for(var s in e){o.append(s,e[s])}}var l=App.getClientID();if(l)o.append("notifyClientID",l);if(!i)i="json";var c=r.attr("action");$.ajax({type:"post",url:c,data:o,dataType:i,cache:false,processData:false,contentType:false}).success(function(t){a&&a.apply(this,arguments)}).error(function(t,e,a){n&&n.apply(this,arguments)})},attachPjax:function(t,e,f){if(!$.support.pjax)return;if(t==null)t="a";if(f==null)f=5e3;var a={onclick:null,onsend:null,oncomplete:null,ontimeout:null,onstart:null,onend:null};var d=$.extend({},a,e||{});$(document).on("click",t+"[data-pjax]",function(t){var e=$(this).data("pjax"),a=$(this).data("keepjs");var n=$(this).data("onclick"),i=$(this).data("toggleclass");$.pjax.click(t,e,{timeout:f,keepjs:a});if(d.onclick)d.onclick(this);if(n&&typeof window[n]=="function")window[n](this);if(i){var r=i.split(":"),o,s;if(r.length>1){o=r[0];i=r[1]}i=i.replace(/^\./g,"");if(o){var l=o.indexOf("."),c;if(l>0){c=o.substring(l+1);o=o.substring(0,l)}switch(o){case"parent":s=$(this).parent(c);break;case"parents":s=$(this).parents(c);break;case"closest":s=$(this).closest(c);break;default:s=$(this).parent(c);break}}else{s=$(this)}s.addClass(i).siblings("."+i).removeClass(i)}$(".sp_result_area").remove();$(".tox").remove();$(".select2-hidden-accessible").remove();$(".select2-sizer").remove();$(".select2-drop").remove();$("#select2-drop-mask").remove()}).on("pjax:send",function(t,e,a){App.loading("show");if(d.onsend)d.onsend(t,e,a)}).on("pjax:complete",function(t,e,a,n){App.loading("hide");if(d.oncomplete)d.oncomplete(t,e,a,n)}).on("pjax:timeout",function(t,e,a){console.log("timeout");App.loading("hide");if(d.ontimeout)d.ontimeout(t,e,a)}).on("pjax:start",function(t,e,a){if(d.onstart)d.onstart(t,e,a)}).on("pjax:end",function(t,e,a){App.loading("hide");if(d.onend)d.onend(t,e,a);if(a.container){App.bottomFloat(a.container+" .pagination");App.bottomFloat(a.container+" .form-submit-group",0,true);$(a.container+" .switch:not(.has-switch)").bootstrapSwitch();App.autoFixedThead(a.container+" ")}if(a.type=="GET")$("#global-search-form").attr("action",a.url);App.startLazyload(a.container);App.formWithNotify()})},attachTurn:function(t,e){var a={elem:t,target:$(t).data("target"),show:{Y:true,N:false},event:"click"};if(typeof e=="string"){a.target=e;e={}}var i=$.extend(a,e||{});if(i.event==null)i.event="click";if($(i.elem).length<1)return;$(i.elem).on(i.event,function(){var t=$(this).val(),e=$(i.target);var a=$(this).data("turn");if(a){a=a=="on"||a=="1"||a=="true"||a=="Y";if(a){e.show()}else{e.hide()}}else if(typeof a!="undefined"){e.hide()}if(i.prop){for(var n in i.prop){e.prop(n,i.prop.prop[t])}return}if(t in i.show){if(i.show[t]){e.show()}else{e.hide()}}});switch($(i.elem)[0].tagName.toUpperCase()){case"INPUT":$(i.elem+":checked").trigger(i.event);break;case"SELECT":if(!$(i.elem).children("option:first").prop("selected")){$(i.elem).trigger(i.event)}break}},wsURL:function(t){var e="ws:";if(window.location.protocol=="https:")e="wss:";var a=String(t).indexOf("//");if(a==-1){t=e+"//"+window.location.host+t}else{t=e+String(t).substring(a)}return t},websocket:function(e,t,a){t=App.wsURL(t);var n=new WebSocket(t);n.onopen=function(t){console.log("Websocket Server is connected");if(a!=null&&typeof a==="function")a.apply(this,arguments)};n.onclose=function(t){console.log("Websocket Server is disconnected")};n.onmessage=function(t){e(t.data)};n.onerror=function(t){console.dir(t)};if(a!=null&&typeof a=="object"){n=$.extend({},n,a)}return n},notifyRecvDefault:function(t,e,a){var n="notify-default-shower",i="notify-default-shower-body";var r="#"+n,o="#"+i;if(a==null)a=false;if(a&&!t){if($(r).length>0)$(o).slideUp("slow",function(){$(r).remove()});return}if($(r).length<1){$("body").append('
    \t\t\t\t
    \t\t\t\t
    \t\t\t\t');if(!a){var s=window.setInterval(function(){var t=Number($(r).attr("updated")||0);if((new Date).getTime()-t>5e3&&!$("#loading-status").is(":visible")){window.clearInterval(s);$(o).slideUp("slow",function(){$(r).remove()})}},1e3)}}$(r).attr("updated",(new Date).getTime());if(e)t="["+Number(e).toFixed(2)+"%] "+t;$(o).text(t)},formWithNotify:function(){if(typeof App.clientID["notify"]=="undefined"||!App.clientID["notify"])return;var t=$("#pcont").find("form[notify]");if(t.length<1)return;var e=t.find("input[name=notifyClientID]");if(e.length<1){t.append('')}else if(e.val()!=App.clientID["notify"]){e.val(App.clientID["notify"])}},getClientID:function(t){if(t==null||!t)t="notify";if(typeof App.clientID[t]=="undefined")return null;return App.clientID[t]},setClientID:function(t,e){var a=App.getClientID(e);if(!a)return t;if(typeof t=="array"){t=append({name:"notifyClientID",value:a})}else{t["notifyClientID"]=a}return t},notifyListen:function(){var l={notify:0,element:0,modal:0},c={notify:20,element:50,modal:50};App.websocket(function(t){var e=$.parseJSON(t);if(!e){App.message({text:t||"Websocket Server is disconnected",type:"error"});return false}if(typeof App.clientID["notify"]=="undefined"){App.clientID["notify"]=e.client_id;App.formWithNotify()}if(typeof e.content=="undefined"||!e.content){return false}switch(e.mode){case"-":break;case"element":var a=$("#notify-element-"+e.type);if(a.length<1){var n="recv_notice_"+e.type;if(typeof window[n]!="undefined"){return window[n](e)}if(e.status>0){console.info(e.content)}else{console.error(e.content)}App.notifyRecvDefault(e.content,e.progress?e.progress.percent:0);return false}if(l[e.mode]>=c[e.mode]){a.find("li:first").remove();l[e.mode]--}if(e.title){var i="badge-danger";if(e.status>0)i="badge-success";t=''+App.text2html(e.title)+" "+App.text2html(e.content)}else{t=App.text2html(e.content)}a.append("
  • "+t+"
  • ");l[e.mode]++;break;case"modal":var a=$("#notify-modal-"+e.type);if(a.length<1){var n="recv_notice_"+e.type;if(typeof window[n]!="undefined"){return window[n](e)}if(e.status>0){console.info(e.content)}else{console.error(e.content)}App.notifyRecvDefault(e.content,e.progress?e.progress.percent:0);return false}if(e.title){var i="badge-danger";if(e.status>0)i="badge-success";t=''+App.text2html(e.title)+" "+App.text2html(e.content)}else{t=App.text2html(e.content,e.progress?e.progress.percent:0)}if(!a.data("shown")){l[e.mode]=0;a.data("shown",true);var r=a.find(".modal-body"),o=r.children("ul.modal-body-ul");if(o.length<1){r.html('")}else{o.html("
  • "+t+"
  • ")}a.niftyModal("show",{afterOpen:function(t){},afterClose:function(t){a.data("shown",false)}})}else{var s=$("#notify-modal-"+e.type+"-container");if(l[e.mode]>=c[e.mode]){s.find("li:first").remove();l[e.mode]--}s.append("
  • "+t+"
  • ")}l[e.mode]++;break;case"notify":var a=$("#notice-message-container");if(a.length<1){App.message({title:App.i18n.SYS_INFO,text:'
      ',sticky:true});a=$("#notice-message-container")}if(l[e.mode]>=c[e.mode]){a.find("li:first").remove();l[e.mode]--}if(e.title){var i="badge-danger";if(e.status>0)i="badge-success";t=''+App.text2html(e.title)+""+App.text2html(e.content)}else{t=App.text2html(e.content)}a.append("
    • "+t+"
    • ");l[e.mode]++;break;default:if(e.status>0){console.info(e.content)}else{console.error(e.content)}App.notifyRecvDefault(e.content,e.progress?e.progress.percent:0);break}return true},BACKEND_URL+"/user/notice")},text2html:function(t,e){t=String(t);if(!e)t.replace(/<|>/g,function(t){return t=="<"?"<":">"});return App.textNl2br(t)},ifTextNl2br:function(t){t=String(t);if(/<[^>]+>/.test(t))return t;return App.textNl2br(t)},textNl2br:function(t){return t.replace(p,function(t){return u[t]})},trimSpace:function(t){return String(t).replace(/^[\s]+|[\s]+$/g,"")},checkedAll:function(t,e){return $(e).not(":disabled").prop("checked",$(t).prop("checked"))},attachCheckedAll:function(t,e,a){$(t).on("ifChecked ifUnchecked click",function(){App.checkedAll(this,e);if(a)$(a).text($(e+":checked").length)})},alertBlock:function(t,e,a){switch(a){case"info":if(e==null)e="Info!";return'
      \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'+e+" "+t+"
      ";case"warn":if(e==null)e="Alert!";return'
      \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'+e+" "+t+"
      ";case"error":if(e==null)e="Error!";return'
      \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'+e+" "+t+"
      ";default:if(e==null)e="Success!";return'
      \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'+e+" "+t+"
      "}},alertBlockx:function(t,e,a){switch(a){case"info":if(e==null)e="Info!";return'
      \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t
      \t\t\t\t\t\t\t\t'+e+" "+t+"
      ";case"warn":if(e==null)e="Alert!";return'
      \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t
      \t\t\t\t\t\t\t\t'+e+" "+t+"
      ";case"error":if(e==null)e="Error!";return'
      \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t
      \t\t\t\t\t\t\t\t'+e+" "+t+"
      ";default:if(e==null)e="Success!";return'
      \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t
      \t\t\t\t\t\t\t\t'+e+" "+t+"
      "}},showDbLog:function(t,e){if(e==null)e=".block-flat:first";if(typeof t.length=="undefined")t=[t];for(var a=0;a0){for(var r=0;r'+n.SQLs[r]+""}else{i+=''+n.SQL+""}var o="success";if(n.Error){i+="("+n.Error+")";o="error"}else{i+="("+n.Elapsed+")"}$(e).before(App.alertBlockx(i,null,o))}},loading:function(t){var e=$("#loading-status");switch(t){case"show":if(e.length>0){e.show()}else{$("body").append('
      ')}break;case"hide":if(e.length>0){e.hide()}}},insertAtCursor:function(t,e,a,n){if(typeof TextAreaEditor!="undefined"){TextAreaEditor.setSelectText(t,e,a,n);return}if(document.selection){t.focus();sel=document.selection.createRange();sel.text=e;sel.select()}else if(t.selectionStart||t.selectionStart=="0"){var i=t.selectionStart;var r=t.selectionEnd;var o=t.scrollTop;t.value=t.value.substring(0,i)+e+t.value.substring(r,t.value.length);if(o>0)t.scrollTop=o;t.focus();t.selectionStart=i+e.length;t.selectionEnd=i+e.length}else{t.value+=e;t.focus()}},attachInsertableCode:function(t){var e={selector:"",isHTML:false,posStart:null,posEnd:null,posStartChar:null,posEndChar:null};var i=$.extend(e,t||{});if(i.isHTML==null)i.isHTML=false;if(i.selector==null)i.selector="";var a="",r="";if(i.isHTML){a="html";r="html"}else{a="text";r="text"}var n=".insertable-code-"+a+"[data-target]";var o=typeof i.selector=="string"?$(i.selector+n):$(i.selector).find(n);o.each(function(){if($(this).data("insertable-code-attached"))return;$(this).data("insertable-code-attached",true);var t=$(this).children("code");var n=$($(this).data("target"));$(this).children("code:not(.clickable)").addClass("clickable");t.on("click",function(){var t=$(this)[r]();var e=i.posStart,a=i.posEnd;if(i.posStartChar!==null){e=t.indexOf(i.posStartChar)+1}if(i.posEndChar!==null){if(e===null)e=0;a=t.indexOf(i.posEndChar,e)-1}App.insertAtCursor(n[0],t,e,a)})})},searchFS:function(t,i,r,o,s){if(i==null)i=10;if(o==null)o=BACKEND_URL+"/user/autocomplete_path";$(t).typeahead({hint:true,highlight:true,minLength:1},{source:function(t,e,a){var n={query:t,size:i,type:r};if(s){n=s(n);if(!n){e([]);return}}$.ajax({url:o,type:"get",data:n,dataType:"json",async:false,success:function(t){var a=[];if(!t.Data)return;$.each(t.Data,function(t,e){a.push(e)});e(a)}})},limit:i})},randomString:function(t){t=t||32;var e="ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678";var a=e.length;var n="";for(i=0;i=a){if($(e).hasClass("always-bottom")){$(e).removeClass("always-bottom");$(e).next(".fixed-placeholder").hide()}return}if(!$(e).hasClass("always-bottom")){$(e).addClass("always-bottom");if($(e).next(".fixed-placeholder").length>0){$(e).next(".fixed-placeholder").show()}else{$(e).after('
      ')}}})})},topFloat:function(t,r,o){if($(t).length<1)return;if(r==null)r=0;$(t).not("[disabled-fixed]").each(function(){$(this).attr("disabled-fixed","fixed");var e=this;var a=$(e).offset().top;var n=$(e).outerWidth(),i=$(e).outerHeight();if(!o)o=$(e).data("auto-width");if(o)$(e).css("width",n);$(window).on("scroll",function(){var t=$(this).scrollTop();if(t<=a){if($(e).hasClass("always-top")){$(e).removeClass("always-top");$(e).next(".fixed-placeholder").hide()}return}if(!$(e).hasClass("always-top")){$(e).addClass("always-top").css("top",r);if($(e).next(".fixed-placeholder").length>0){$(e).next(".fixed-placeholder").show()}else{$(e).after('
      ')}}})})},topFloatRawThead:function(t,e){if($(t).length<1)return;var r=null;if(typeof e=="function"){r=e}else{if(e==null)e=0;r=function(){return e}}$(t).not("[disabled-fixed]").each(function(){$(this).attr("disabled-fixed","fixed");var d=this,p=$(d).parent("table"),u=p.closest(".table-responsive");var h=u.length>0;var n=$(d).offset().top,t=Number(String(p.css("margin-top")).replace(/px$/,""));$(d).css({"background-color":"white"});p.data("originalMarginTop",t);var i=function(t){if(t==null)t=false;if(h){g(u);if(!u.hasClass("overflow")){$(d).css({width:"auto","overflow-x":"unset"})}}var e=p.width(),a=$(window).scrollLeft();var n=$(d).width(),i=1;if(!t){if(Math.abs(e-n)>1){i=n/e}if(p.data("offset-left")!=p.offset().left){$(d).css({left:p.offset().left})}else if(p.data("scroll-left")!=a){var r=p.offset().left-a;$(d).css({left:r});if(i==1)return}}var o=$(d).data("ratio")||0;$(d).data("ratio",i);p.data("offset-left",p.offset().left);p.data("scroll-left",a);var s=p.children("colgroup").length>0?p.children("colgroup").children("col"):p.children("col"),l=$(d).find("td,th");if(s.length<1){var c="";$(d).css({width:p.width()});l.each(function(){var t=$(this).outerWidth(),e=t*i;c+='';$(this).css({"min-width":e,width:e,"max-width":"auto"})});p.prepend(c);return}if(o==i)return;$(d).css({width:e});var f=p.children("tbody").length>0?p.children("tbody").children("tr:first").find("td"):p.children("tr:first").find("td");l.each(function(t){var e=s.eq(t),a=f.eq(t);var n=!a||e.outerWidth()>a.outerWidth()?e.outerWidth():a.outerWidth();$(this).css({width:n})})};i(true);window.setTimeout(function(){i()},500);$(window).on("scroll resize",function(){i();var t=$(this).scrollTop(),e=p.height()+n-$(d).outerHeight()*2;if(t<=n||t>=e){if($(d).hasClass("always-top")){$(d).removeClass("always-top");p.css({"margin-top":p.data("originalMarginTop")})}if(h){$(d).off("scroll").data("scroll-reponsive",false);u.off("scroll").data("scroll-thead",false)}return}if(p.height()>$(window).height()){if(!$(d).hasClass("always-top")){$(d).addClass("always-top");p.css({"margin-top":p.data("originalMarginTop")+$(d).height()})}var a={top:r()};if(h){if(!u.data("scroll-thead")){u.on("scroll",function(){$(d).css({left:u.offset().left+$(this).scrollLeft()*-1})}).data("scroll-thead",true)}}$(d).css(a)}})});$(window).trigger("scroll")},topFloatThead:function(t,e,a){if(!a)return App.topFloatRawThead(t,e);if($(t).length<1)return;var o=null;if(typeof e=="function"){o=e}else{if(e==null)e=0;o=function(){return e}}$(t).not("[disabled-fixed]").each(function(){$(this).attr("disabled-fixed","fixed");var a=this,n=$(a).parent("table"),s=n.closest(".table-responsive");var l=s.length>0;var i=$(a).offset().top,t=$(a).data("copy");if(t){$("#tableCopy"+t).remove()}else{t=Math.random();$(a).data("copy",t)}var c=$('
      ');var f=$('
      ');var d=$(a).clone();f.append(d);c.html(f);var r=function(i){if(i==null)i=false;if(!i){var t=l?s.width():n.width();if(c.width()!=t){c.css({width:t})}else if(f.data("scroll-left")!=$(window).scrollLeft()){f.css({left:$(a).offset().left-$(window).scrollLeft()});return}else{return}}f.data("offset-left",n.offset().left);f.data("scroll-left",$(window).scrollLeft());var r=d.find("td,th"),o=$(a).find("td,th");o.each(function(t){var e=r.eq(t);e.css({width:$(this).outerWidth()});if(!i)return;var a=e.find("input:checkbox");if(a.length<1)return;var n=o.find("input:checkbox");a.each(function(t){n.eq(t).on("click change",function(){a.prop("checked",$(this).prop("checked"))})})});var t=l?s.width():n.width(),e=$(a).outerHeight();f.css({width:t,height:e})};r(true);c.hide();n.after(c);window.setTimeout(function(){r()},500);$(window).on("scroll",function(){r();var t=$(this).scrollTop(),e=n.height()+i-$(a).outerHeight()*2;if(t<=i||t>=e)return c.hide();c.show()});if(s.length>0&&!s.data("scroll-thead")){s.on("scroll",function(){f.css({left:$(this).scrollLeft()*-1})}).data("scroll-thead",true)}})},getImgNaturalDimensions:function(t,e){if(t&&t.naturalWidth){e({w:t.naturalWidth,h:t.naturalHeight});return}var a=new Image;a.onload=function(){e({w:a.width,h:a.height})};if(t)a.src=t.src},reportBug:function(t){$.post(t,{panic:$("#panic-content").html(),url:window.location.href},function(t){},"json")},replaceURLParam:function(t,e,a){if(a==null)a=window.location.href;e=encodeURIComponent(e);var n=String(a).indexOf("?");if(n<0)return a+"?"+t+"="+e;var i=a.substring(n),r=new RegExp("([\\?&]"+t+"=)[^&]*(&|$)");if(!r.test(i))return a+"&"+t+"="+e;a=a.substring(0,n);i=i.replace(r,"$1"+e+"$2");return a+i},switchLang:function(t){window.location=App.replaceURLParam("lang",t)},extends:function(t,e){var a=function(){};a.prototype=e.prototype;t.prototype=new a;t.prototype.constructor=t},formatBytes:function(t,e){if(e==null)e=2;var a=["YB","ZB","EB","PB","TB","GB","MB","KB","B"];var n=a.length;for(n--;n>0&&t>1024;n--){t/=1024}return t.toFixed(e)+a[n]},format:function(t,e,a){if(a){if(typeof a[e.y]=="function")return a[e.y](t,e.x);if(typeof a[""]=="function")return a[""](t,e.x)}return t},genTable:function(t,e){var a='';var n="",i="";for(var r=0;r'+s+""}i+="";for(var s in o)i+='";i+=""}n+="";i+="";a+=n+i+"
      '+App.format(o[s],{x:r,y:s},e)+"
      ";return a},httpStatusColor:function(t){if(t>=500)return"danger";if(t>=400)return"warning";if(t>=300)return"info";return"success"},htmlEncode:function(t){if(!t)return t;return String(t).replace(l,function(t){return c[t]})},htmlDecode:function(t){if(!t)return t;return String(t).replace(f,function(t){return d[t]})},logShow:function(t,e,r){var a=$(t).data("modal-title"),n=$("#log-show-modal");if(a)n.find(".modal-header h3").text(a);if(!n.data("init")){n.data("init",true);$(window).off().on("resize",function(){n.css({height:$(window).height(),width:"100%","max-width":"100%",left:0,top:0,transform:"none"});n.find(".md-content").css("height",$(window).height());$("#log-show-content").css("height",$(window).height()-140)});$("#log-show-last-lines").on("change",function(t){var e=$(this).data("target");if(!e)return;var a=$(this).val();e.data("last-lines",a);e.trigger("click")});$("#log-show-charset").on("change",function(t){var e=$(this).data("target");if(!e)return;var a=$(this).val();e.data("charset",a);e.trigger("click")});n.find(".modal-footer .btn-refresh").on("click",function(t){var e=$("#log-show-last-lines").data("target");if(!e)return;e.trigger("click")});$(window).trigger("resize")}if(r==null)r="";var i=function(t){var e=$(t).data("url");var a=$(t).data("last-lines");if(a==null)a=100;$("#log-show-last-lines").data("target",$(t));var n=null;if($("#log-show-charset").length>0){$("#log-show-charset").data(`target`,$(t));n=$(t).data("charset")}var s="log-show-content",l="#"+s;var i=$("#log-show-modal");i.niftyModal("show",{afterOpen:function(o){var t={lastLines:a,pipe:r};if(n)t.charset=n;$.get(e,t,function(t){if(t.Code==1){var e=o.find(".modal-header .modal-subtitle");if(typeof t.Data.title!="undefined"){if(t.Data.title)t.Data.title=" ("+t.Data.title+")";e.html(t.Data.title)}else{e.empty()}if(typeof t.Data.list!="undefined"){var a=function(t,e){return'
      '+App.htmlEncode(t)+"
      "},n=function(t,e){return'
      '+App.htmlEncode(t)+"
      "};var i='
      '+App.genTable(t.Data.list,{StatusCode:function(t,e){return''+t+""},Brower:a,UserAgent:n,URI:n,Referer:n,"":function(t,e){return App.htmlEncode(t)}})+"
      ";$(l).parent(".modal-body").css("padding",0);$(l).replaceWith(i)}else{if($(l)[0].tagName.toUpperCase()!="TEXTAREA"){$(l).replaceWith("")}$(l).text(t.Data.content)}if(typeof t.Data.charset!="undefined"&&$("#log-show-charset").length>0&&$("#log-show-charset").val()!=t.Data.charset){$("#log-show-charset").find('option[value="'+t.Data.charset+'"]').prop("selected",true)}$(window).trigger("resize");var r=$(l)[0];r.scrollTop=r.scrollHeight}else{$(l).text(t.Info)}},"json")},afterClose:function(t){$("#log-show-last-lines").find("option:selected").prop("selected",false);if($("#log-show-charset").length>0)$("#log-show-charset").find("option:selected").prop("selected",false)}})};if(e)return i(t);$(t).on("click",function(){i(this)})},tableSorting:function(t){t=t==null?"":t+" ";function f(t,e){var a,n,i;if(!e){a="fa-arrow-up";i="up";n="fa-arrow-down"}else{a="fa-arrow-down";i="down";n="fa-arrow-up"}if(t.length>0){var r=t.children(".fa");if(r.length<1){t.append('')}else{r.removeClass(n).addClass(a)}t.addClass("sort-active sort-"+i);t.siblings(".sort-active").removeClass("sort-active").removeClass("sort-up").removeClass("sort-down").find(".fa").remove()}}$(t+'[sort-current!=""]').each(function(){var t=String($(this).attr("sort-current"));var e=t.substring(0,1)=="-";if(e)t=t.substring(1);var a=$(this).find('[sort="'+t+'"]');if(a.length<1&&t){a=$(this).find('[sort="-'+t+'"]')}f(a,e)});$(t+"[sort-current] [sort]").css("cursor","pointer").on("click",function(t){var e=$(this).parents("[sort-current]");var a=e.attr("sort-current");var n=e.attr("sort-url")||window.location.href;var i=e.attr("sort-trigger")||e.data("sort-trigger");var r=$(this).attr("sort");if(a&&(a==r||a=="-"+r)){var o=/^\-/;a=o.test(a)?a.replace(o,""):"-"+a}else{a=r}e.attr("sort-current",a);n=App.replaceURLParam("sort",a,n);if(i){e.data("sort-url",n);var s=a.substring(0,1)=="-";f($(this),s);window.setTimeout(i,0)}else{var l=e.attr("sort-setto");if(l){var c=$(this);$.get(n,{},function(t,e,a){if(String(a.getResponseHeader("Content-Type")).split(";")[0]=="application/json"){try{t=JSON.parse(t)}catch(t){return App.message({text:t,type:"error"})}if(t.Code!=1)return App.message({text:t.Info,type:"error"});t=t.Data.html}$(l).html(t);if($(l).length>0&&$(l)[0].tagName.toUpperCase()=="TBODY"){var n=c.parents("[sort-current]");var i=n.attr("sort-current");var r=i.substring(0,1)=="-";f(c,r)}},"html")}else{window.location=n}}})},switchStatus:function(e,a,t,n){if(a==null)a=$(e).data("type");var i=$(e).val();var r=$(e).data("v-checked")||i||"N",o=$(e).data("v-unchecked")||(r=="N"?"Y":"N");if(a){var s=String(a).split("=");a=s[0];if(s.length>1&&s[1]){var l=s[1].split("|");if(l[0]==r){r=l[0];o=l[1]}else{r=l[1];o=l[0]}}}if(t==null)t=$(e).data("url");var c=$(e),f=e.checked?r:o,d={id:c.data("id")};d[a]=f;if(String(t).charAt(0)!="/")t=BACKEND_URL+"/"+t;$.get(t,d,function(t){if(t.Code==1){c.attr("data-"+a,f);c.prop("checked",f==i)}App.message({title:App.i18n.SYS_INFO,text:t.Info,time:5e3,sticky:false,class_name:t.Code==1?"success":"error"});if(n)n.call(e,t)},"json")},bindSwitch:function(t,e,a,n,i){if(e==null)e="click";var r=new RegExp("switch-([\\w\\d]+)");$(t).on(e,function(){if(n==null){var t=String($(this).attr("class")).match(r);n=t[1]}App.switchStatus(this,n,a,i)})},removeSelected:function(t,e,a,n){return App.opSelected(t,e,a,n,App.i18n.CONFIRM_REMOVE,App.i18n.PLEASE_SELECT_FOR_REMOVE)},opSelected:function(t,e,a,n,i,r){if(a==null){a=window.location.href}else if(String(a).charAt(0)!="/"){a=BACKEND_URL+"/"+a}if(e==null)e="id";var o=[];$(t).each(function(){if($(this).is(":checked")&&!$(this).prop("disabled"))o.push({name:e,value:$(this).val()})});if(o.length<1){App.message({title:App.i18n.SYS_INFO,text:r||App.i18n.PLEASE_SELECT_FOR_OPERATE,type:"warning"});return false}var s=i;if(s){s+="\n"+App.sprintf(App.i18n.SELECTED_ITEMS,o.length);if(!confirm(s))return false}App.loading("show");$.get(a,o,function(t){App.loading("hide");if(n&&typeof n==="function")return n();var e={title:App.i18n.SYS_INFO,text:t.Info,type:""};if(t.Code==1){e.type="success";if(!e.text)e.text="操作成功"}else{e.type="error";if(!e.text)e.text="操作失败"}App.message(e);window.setTimeout(function(){window.location.reload()},2e3)},"json");return true},parseBool:function(t){switch(String(t).toLowerCase()){case"0":case"false":case"n":case"no":case"off":case"null":return false;default:return true}},progressMonitor:function(e,a){NProgress.start();var n=window.setInterval(function(){var t=e()/a;if(t>=1){NProgress.set(1);window.clearInterval(n)}else{NProgress.set(t)}},50)},floatAtoi:function(t,e){var a={bottom:"7",right:"6",top:"5",left:"8",leftBottom:"4",rightBottom:"3",leftTop:"1",rightTop:"2"};if(typeof a[t]!=="undefined")return a[t];return e},float:function(t,e,a,n,i){if(!e)e="ajax";if(!a)a=e=="remind"?"rel":"src";if(!n)n="5-7";else{var r=String(n).split("-");var o=[];for(var s=0;s '+App.i18n.BUTTON_UPLOAD,previewTableContainer:"#previewTableContainer",url:"",previewTableShow:false,uploadProgress:function(t){var e=t*100;if(e>100){$.LoadingOverlay("hide");return}$.LoadingOverlay("progress",e)}};var r=$.extend({},i,e||{});var o=$(t).uploadPreviewer(r);$(t).data("uploadPreviewer",o);$(t).on("file-preview:changed",function(t){var e={image:ASSETS_URL+"/images/nging-gear.png",progress:false,maxSize:40,size:30,text:App.i18n.UPLOADING};if(r.uploadProgress){e.progress=true;e.progressFixedMargin="5px 0 0 0";e.image=""}$.LoadingOverlay("show",e);o.submit(function(t){$.LoadingOverlay("hide");if(t.Code==1){App.message({text:App.i18n.UPLOAD_SUCCEED,type:"success"});if(a!=null)a(t)}else{App.message({text:t.Info,type:"error"});if(n!=null)n(t)}},function(){if(n!=null)n()})})}},showRequriedInputStar:function(){$("form:not([required-redstar])").each(function(){$(this).attr("required-redstar","1");$(this).find("[required]").each(function(){var t=$(this).parent(".input-group");if(t.length>0){if(!t.hasClass("required"))t.addClass("required");return}t=$(this).closest('.form-group,div[class*="col-"]');if(t.length<1)return;var e;if(t.hasClass("form-group")){e=t.children(".control-label")}else{e=t.prev(".control-label")}if(e.length<1||e.hasClass("required"))return;e.addClass("required")})})},pushState:function(t,e,a){if(!window.history||!window.history.pushState)return;window.history.pushState(t,e,a)},replaceState:function(t,e,a){if(!window.history||!window.history.replaceState)return;window.history.replaceState(t,e,a)},formatJSON:function(t){t=$.trim(t);var e=t.substring(0,1);if(e=="["||e=="{"){var a=JSON.parse(t);t=JSON.stringify(a,null,"\t");return t}return""},formatJSONFromInnerHTML:function(t){if(t.data("jsonformatted"))return;t.data("jsonformatted",true);var e=App.formatJSON(t.html());if(e!="")t.html(e)},rewriteFormValueAsArray:function(t,e,a){var n=0;for(var i=0;in){r.value=a[n];n++}else{r.value=""}}}for(var i=n;i"+a+"").css({position:"absolute",display:"none",top:e+5,left:t+5,border:"1px solid #000",padding:"5px",color:"#fff","border-radius":"2px","font-size":"11px","background-color":"#000",opacity:.8}).appendTo("body").fadeIn(200)},plotHover:function(t,n){$(t).on("plothover",function(t,e,a){if(!a){$("#plot-tooltip").remove();m=null;return}if(m==a.dataIndex)return;m=a.dataIndex;$("#plot-tooltip").remove();if(n==null)n=function(t,e,a){var n=a.datapoint[0].toFixed(2),i=a.datapoint[1].toFixed(2);return a.series.label+" of "+n+" = "+i};App.plotTooltip(a.pageX,a.pageY,n.call(this,t,e,a))})},template:function(t,e,a){var n=$(t).attr("tpl"),i=String(n).split("=>");n=$.trim(i[0]).replace(/^#/,"");if($("#"+n).length<1)throw new Error("not found template: "+(typeof t=="string"?t:$(t).attr("id"))+"=>"+n);if(i.length>1){t=$.trim(i[1]);if($(t).length<1)throw new Error("[template] not found wrapper: "+t)}$(t).html(template(n,e));if(a==null)return;$(t).find("ul.pagination li > a[page]").on("click",function(){if($(this).closest("li.disabled").length>0)return;a($(this).attr("page"))});$(t).find("ul.pagination").on("refresh",function(){var t=1;if($(this).data("page")){t=$(this).data("page");$(this).data("page",false)}else{t=$(this).find("li.active > a[page]").data("page")||1}a(t)})},pagination:function(t,e){var a=[],n=t.page,i=t.pages;if(!e)e=10;var r=i-n,o=1,s=0;if(re)break;a.push(l)}var c={size:t.size,page:n,rows:t.rows,pages:i,pageNumbers:a};return c},withPagination:function(t,e,a){var n=App.pagination(t,e);if(a==null)a="tpl-pagination";t.pagination=template(a,n);return t},captchaUpdate:function(t,e){if(App.captchaHasError(e.Code)&&e.Data&&typeof e.Data.captchaIdent!=="undefined"){if(false==t instanceof jQuery)t=$(t);var a=t.find("input#"+e.Data.captchaIdent);a.val(e.Data.captchaID);a.siblings("img").attr("src",e.Data.captchaURL);if(e.Data.captchaName)t.find('input[name="'+e.Data.captchaName+'"]').focus()}},captchaHasError:function(t){return t>=-11&&t<=-9},treeToggle:function(t,a){var e={expandFirst:false,ajax:null,onclick:null};a=$.extend(e,a||{});if(!t)t=".treeview";var n=function(){var t=$(this).children(".fa"),e;if(t.length>0){e=$(this).next("ul.tree")}else if($(this).hasClass("fa")){t=$(this);e=$(this).parent().next("ul.tree")}else{return}if(t.hasClass("fa-folder-o")){t.removeClass("fa-folder-o").addClass("fa-folder-open-o")}else{t.removeClass("fa-folder-open-o").addClass("fa-folder-o")}e.toggle(300,function(){$(this).parent().toggleClass("open");$(".tree .nscroller").nanoScroller({preventPageScrolling:true});$(window).trigger("resize")})};$(t).on("click",".tree-toggler",function(){var t=this;if(typeof a.onclick==="function")a.onclick.apply(t,arguments);if($(t).data("loaded")||!a.ajax)return n.apply(t);$(t).data("loaded",true);var e=a.ajax;if(typeof a.ajax==="function"){e=a.ajax.apply(t,arguments)}if(typeof e.data==="function"){e.data=e.data.apply(t,arguments)}$.ajax(e).done(function(){n.apply(t,arguments)})});if(a.expandFirst)$(t+" label.tree-toggler:first").trigger("click")},isFunction:function(t){return typeof t==="function"},currentURL:function(){if(typeof window.IS_BACKEND!="undefined"&&window.IS_BACKEND){return BACKEND_URL}return FRONTEND_URL},makeCheckerForUpgrade:function(t,e,a,n){var i=0,r=false;if(t==null||!t)t=5;var o=function(){if(r)return;r=true;$.post(BACKEND_URL+"/manager/upgrade?t="+(new Date).getTime(),{local:true},function(t){r=false;if(t.Code!=1){if(n)n();return App.message({text:t.Info,type:"error"},true)}if(e!=t.Data.local.Number){if(n)n();return App.message({text:App.t("启动新版本失败!程序没有更新成功,当前启动的依然是旧版 v%s。自动升级功能可能不支持当前系统,建议您手动执行升级脚本进行升级。",t.Data.local.Number),type:"error"},true)}if(a)a();return App.message({text:App.t("恭喜,程序已经成功升级到 v%s",t.Data.local.Number),type:"success"},true)},"json").error(function(){i++;if(i0){e.attr("attached","1");e.on("click",function(){if(!confirm(App.t("建议升级前先备份相关文件和数据库,以防万一。")+"\n"+App.t("确定现在升级吗?")))return;var t=$(this);var n=function(){t.prop("disabled",true);t.prepend('')};n();var i=function(){t.prop("disabled",false);t.children("i").remove()};var r=$("#self-upgrade-modal"),o=r.data("version");$.post(BACKEND_URL+"/manager/upgrade",{download:true,notifyClientID:App.clientID["notify"]||"any",nonce:r.data("nonce"),version:o},function(t){i();if(t.Code!=1)return App.message({text:t.Info,type:"error"});if(t.Data&&"nonce"in t.Data){if(!confirm(App.t("程序已经成功更新,是否现在重启?"))){r.niftyModal("hide");return}App.loading("show");n();App.notifyRecvDefault(App.t("正在重启中,请稍候..."),0,true);var e=function(){App.loading("hide");App.notifyRecvDefault("",0,true);i();r.niftyModal("hide")};var a=App.makeCheckerForUpgrade(5,o,e,e);$.post(BACKEND_URL+"/manager/upgrade",{exit:true,nonce:t.Data.nonce},function(t){e();if(t.Code!=1)return App.message({text:t.Info,type:"error"});return App.message({text:t.Info,type:"success"})},"json").error(function(){window.setTimeout(a,2e3)});window.setTimeout(a,5e4);return}r.niftyModal("hide");return App.message({text:t.Info,type:"success"})}).error(function(t,e,a){i()})})}$.get(BACKEND_URL+"/manager/upgrade",{version:t},function(t){if(t.Code!=1){if(t.Code<-2||t.Code==0)console.debug(t.Info);return}if(!t.Data.isNew)return App.message({text:App.t("当前程序已经是版本 v%s,无需升级",t.Data.local.Number),type:"success"});var e=t.Data.remote,a=App.t("发布时间:")+" "+new Date(e.released_at*1e3).toLocaleString(LANGUAGE||"zh-cn",{dateStyle:"long"});n.find(".modal-header>h3").html(App.t("新版本: v%s",e.version));n.find(".modal-body").html('
      '+e.description+'
      '+a+"
      ");n.data("nonce",t.Data.nonce);n.data("version",e.version);n.niftyModal("show",{})},"json")}}}();$(function(){$("body").css({opacity:1,"margin-left":0})}); \ No newline at end of file