1 line
9.1 KiB
JavaScript
1 line
9.1 KiB
JavaScript
|
function _init(){"use strict";$.AdminLTE.layout={activate:function(){var e=this;e.fix(),e.fixSidebar(),$(window,".wrapper").resize(function(){e.fix(),e.fixSidebar()})},fix:function(){var e=$(".main-header").outerHeight()+$(".main-footer").outerHeight(),i=$(window).height(),o=$(".sidebar").height();if($("body").hasClass("fixed"))$(".content-wrapper, .right-side").css("min-height",i-$(".main-footer").outerHeight());else{var n;i>=o?($(".content-wrapper, .right-side").css("min-height",i-e),n=i-e):($(".content-wrapper, .right-side").css("min-height",o),n=o);var t=$($.AdminLTE.options.controlSidebarOptions.selector);"undefined"!=typeof t&&t.height()>n&&$(".content-wrapper, .right-side").css("min-height",t.height())}},fixSidebar:function(){return $("body").hasClass("fixed")?("undefined"==typeof $.fn.slimScroll&&window.console&&window.console.error("Error: the fixed layout requires the slimscroll plugin!"),void($.AdminLTE.options.sidebarSlimScroll&&"undefined"!=typeof $.fn.slimScroll&&($(".sidebar").slimScroll({destroy:!0}).height("auto"),$(".sidebar").slimscroll({height:$(window).height()-$(".main-header").height()+"px",color:"rgba(0,0,0,0.2)",size:"3px"})))):void("undefined"!=typeof $.fn.slimScroll&&$(".sidebar").slimScroll({destroy:!0}).height("auto"))}},$.AdminLTE.pushMenu={activate:function(e){var i=$.AdminLTE.options.screenSizes;$(document).on("click",e,function(e){e.preventDefault(),$(window).width()>i.sm-1?$("body").hasClass("sidebar-collapse")?$("body").removeClass("sidebar-collapse").trigger("expanded.pushMenu"):$("body").addClass("sidebar-collapse").trigger("collapsed.pushMenu"):$("body").hasClass("sidebar-open")?$("body").removeClass("sidebar-open").removeClass("sidebar-collapse").trigger("collapsed.pushMenu"):$("body").addClass("sidebar-open").trigger("expanded.pushMenu")}),$(".content-wrapper").click(function(){$(window).width()<=i.sm-1&&$("body").hasClass("sidebar-open")&&$("body").removeClass("sidebar-open")}),($.AdminLTE.options.sidebarExpandOnHover||$("body").hasClass("fixed")&&$("body").hasClass("sidebar-mini"))&&this.expandOnHover()},expandOnHover:function(){var e=this,i=$.AdminLTE.options.screenSizes.sm-1;$(".main-sidebar").hover(function(){$("body").hasClass("sidebar-mini")&&$("body").hasClass("sidebar-collapse")&&$(window).width()>i&&e.expand()},function(){$("body").hasClass("sidebar-mini")&&$("body").hasClass("sidebar-expanded-on-hover")&&$(window).width()>i&&e.collapse()})},expand:function(){$("body").removeClass("sidebar-collapse").addClass("sidebar-expanded-on-hover")},collapse:function(){$("body").hasClass("sidebar-expanded-on-hover")&&$("body").removeClass("sidebar-expanded-on-hover").addClass("sidebar-collapse")}},$.AdminLTE.tree=function(e){var i=this,o=$.AdminLTE.options.animationSpeed;$(document).on("click",e+" li a",function(e){var n=$(this),t=n.next();if(t.is(".treeview-menu")&&t.is(":visible")&&!$("body").hasClass("sidebar-collapse"))t.slideUp(o,function(){t.removeClass("menu-open")}),t.parent("li").not(".actual").removeClass("active");else if(t.is(".treeview-menu")&&!t.is(":visible")){var s=n.parents("ul").first(),a=s.find("ul:visible").slideUp(o);a.removeClass("menu-open");var r=n.parent("li");t.slideDown(o,function(){t.addClass("menu-open"),s.find("li.active").not(".actual").removeClass("active"),r.addClass("active"),i.layout.fix()})}t.is(".treeview-menu")})},$.AdminLTE.controlSidebar={activate:function(){var e=this,i=$.AdminLTE.options.controlSidebarOptions,o=$(i.selector),n=$(i.toggleBtnSelector);n.on("click",function(n){n.preventDefault(),o.hasClass("control-sidebar-open")||$("body").hasClass("control-sidebar-open")?e.close(o,i.slide):e.open(o,i.slide)});var t=$(".control-sidebar-bg");e._fix(t),$("body").hasClass("fixed")?e._fixForFixed(o):$(".content-wrapper, .right-side").height()<o.height()&&e._fixForContent(o)},open:function(e,i){i?e.addClass("control-sidebar-open"):$("body").addClass("control-sidebar-open")},close:function(e,i){i?e.removeClass("control-sidebar-open"):$("body").removeClass("control-sidebar-open")},_fix:function(e){var i=this;$("body").hasClass("layout-boxed")?(e.css
|