1 line
131 KiB
JavaScript
1 line
131 KiB
JavaScript
|
"use strict";var KTApp=function(){var t={},e=function(t){var e=t.data("theme")?"tooltip-"+t.data("theme"):"",a="auto"==t.data("width")?"tooltop-auto-width":"",n=t.data("trigger")?t.data("trigger"):"hover";$(t).tooltip({trigger:n,template:'<div class="tooltip '+e+" "+a+'" role="tooltip"> <div class="arrow"></div> <div class="tooltip-inner"></div> </div>'})},a=function(){$('[data-toggle="tooltip"]').each(function(){e($(this))})},n=function(t){var e=t.data("skin")?"popover-"+t.data("skin"):"",a=t.data("trigger")?t.data("trigger"):"hover";t.popover({trigger:a,template:' <div class="popover '+e+'" role="tooltip"> <div class="arrow"></div> <h3 class="popover-header"></h3> <div class="popover-body"></div> </div>'})},i=function(){$('[data-toggle="popover"]').each(function(){n($(this))})},o=function(t,e){t=$(t),new KTCard(t[0],e)},l=function(){$('[data-card="true"]').each(function(){var t=$(this);!0!==t.data("data-card-initialized")&&(o(t,{}),t.data("data-card-initialized",!0))})};return{init:function(e){e&&(t=e),KTApp.initComponents()},initComponents:function(){$('[data-scroll="true"]').each(function(){var t=$(this);KTUtil.scrollInit(this,{mobileNativeScroll:!0,handleWindowResize:!0,rememberPosition:"true"==t.data("remember-position"),height:function(){return KTUtil.isBreakpointDown("lg")&&t.data("mobile-height")?t.data("mobile-height"):t.data("height")}})}),a(),i(),$("body").on("click","[data-close=alert]",function(){$(this).closest(".alert").hide()}),$(".custom-file-input").on("change",function(){var t=$(this).val();$(this).next(".custom-file-label").addClass("selected").html(t)}),l(),"undefined"!=typeof Sticky&&new Sticky('[data-sticky="true"]'),$("body").on("show.bs.dropdown",function(t){var e=$(t.target).find("[data-attach='body']");if(0!==e.length){var a=$(t.target).find(".dropdown-menu").detach();e.data("dropdown-menu",a),$("body").append(a),a.css("display","block"),a.position({my:"right top",at:"right bottom",of:$(t.relatedTarget)})}}),$("body").on("hide.bs.dropdown",function(t){var e=$(t.target).find("[data-attach='body']");if(0!==e.length){var a=e.data("dropdown-menu");$(t.target).append(a.detach()),a.hide()}})},initTooltips:function(){a()},initTooltip:function(t){e(t)},initPopovers:function(){i()},initPopover:function(t){n(t)},initCard:function(t,e){o(t,e)},initCards:function(){l()},initSticky:function(){initSticky()},initAbsoluteDropdown:function(t){!function(t){var e;t&&$("body").on("show.bs.dropdown",t,function(t){e=$(t.target).find(".dropdown-menu"),$("body").append(e.detach()),e.css("display","block"),e.position({my:"right top",at:"right bottom",of:$(t.relatedTarget)})}).on("hide.bs.dropdown",t,function(t){$(t.target).append(e.detach()),e.hide()})}(t)},block:function(t,e){var a,n=$(t),i='<span class="spinner '+((e=$.extend(!0,{opacity:.05,overlayColor:"#000000",type:"",size:"",state:"primary",centerX:!0,centerY:!0,message:"",shadow:!0,width:"auto"},e)).type?"spinner-"+e.type:"")+" "+(e.state?"spinner-"+e.state:"")+" "+(e.size?"spinner-"+e.size:"")+'"></span';if(e.message&&e.message.length>0){var o="blockui "+(!1===e.shadow?"blockui":"");a='<div class="'+o+'"><span>'+e.message+"</span>"+i+"</div>";n=document.createElement("div");$("body").prepend(n),KTUtil.addClass(n,o),n.innerHTML=a,e.width=KTUtil.actualWidth(n)+10,KTUtil.remove(n),"body"==t&&(a='<div class="'+o+'" style="margin-left:-'+e.width/2+'px;"><span>'+e.message+"</span><span>"+i+"</span></div>")}else a=i;var l={message:a,centerY:e.centerY,centerX:e.centerX,css:{top:"30%",left:"50%",border:"0",padding:"0",backgroundColor:"none",width:e.width},overlayCSS:{backgroundColor:e.overlayColor,opacity:e.opacity,cursor:"wait",zIndex:"body"==t?1100:10},onUnblock:function(){n&&n[0]&&(KTUtil.css(n[0],"position",""),KTUtil.css(n[0],"zoom",""))}};"body"==t?(l.css.top="50%",$.blockUI(l)):(n=$(t)).block(l)},unblock:function(t){t&&"body"!=t?$(t).unblock():$.unblockUI()},blockPage:function(t){return KTApp.block("body",t)},unblockPage:function(){return KTApp.unblock("
|