modern.min.js
9.32 KB
$(document).ready(function(){function e(){document.fullScreenElement&&null!==document.fullScreenElement||!document.mozFullScreen&&!document.webkitIsFullScreen?document.documentElement.requestFullScreen?document.documentElement.requestFullScreen():document.documentElement.mozRequestFullScreen?document.documentElement.mozRequestFullScreen():document.documentElement.webkitRequestFullScreen&&document.documentElement.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT):document.cancelFullScreen?document.cancelFullScreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitCancelFullScreen&&document.webkitCancelFullScreen()}function a(e){$(e).block({message:'<img src="assets/images/reload.gif" width="20px" alt="">',css:{border:"none",padding:"0px",width:"20px",height:"20px",backgroundColor:"transparent"},overlayCSS:{backgroundColor:"#fff",opacity:.9,cursor:"wait"}})}function o(e){$(e).unblock()}$(".show-search").click(function(){$(".search-form").css("margin-top","0"),$(".search-input").focus()}),$(".close-search").click(function(){$(".search-form").css("margin-top","-60px")}),$(".toggle-fullscreen").click(function(){e()}),Waves.displayEffect(),$('[data-toggle~="tooltip"]').tooltip({container:"body"});var n=Array.prototype.slice.call(document.querySelectorAll(".js-switch"));n.forEach(function(e){new Switchery(e,{color:"#23B7E5"})}),$(".panel-collapse").click(function(){$(this).closest(".panel").children(".panel-body").slideToggle("fast")}),$(".panel-reload").click(function(){var e=$(this).closest(".panel").children(".panel-body");a(e),window.setTimeout(function(){o(e)},1e3)}),$(".panel-remove").click(function(){$(this).closest(".panel").hide()}),$(".push-sidebar").click(function(){var e=$(".sidebar");e.hasClass("visible")?(e.removeClass("visible"),$(".page-inner").removeClass("sidebar-visible")):(e.addClass("visible"),$(".page-inner").addClass("sidebar-visible"))}),$(".sortable").sortable({connectWith:".sortable",items:".panel",helper:"original",revert:!0,placeholder:"panel-placeholder",forcePlaceholderSize:!0,opacity:.95,cursor:"move"});var s=$("input[type=checkbox]:not(.switchery), input[type=radio]:not(.no-uniform)");s.size()>0&&s.each(function(){$(this).uniform()}),$.fn.toggleAttr=function(e,a){var o=void 0===a;return this.each(function(){o&&!$(this).is("["+e+"]")||!o&&a?$(this).attr(e,e):$(this).removeAttr(e)})};$(".sidebar .accordion-menu li .sub-menu").slideUp(0),$(".sidebar .accordion-menu li.open .sub-menu").slideDown(0),$(".small-sidebar .sidebar .accordion-menu li.open .sub-menu").hide(0),$(".sidebar .accordion-menu > li.droplink > a").click(function(){if(!$("body").hasClass(".small-sidebar")&&!$("body").hasClass(".page-horizontal-bar")&&!$("body").hasClass(".hover-menu")){{var e=$(".sidebar .menu"),a=($(".page-sidebar-inner"),$(".page-content"),$(this).next());$(this)}return e.find("li").removeClass("open"),$(".sub-menu").slideUp(200,function(){c()}),c(),a.is(":visible")?a.slideUp(200,function(){c()}):($(this).parent("li").addClass("open"),$(this).next(".sub-menu").slideDown(200,function(){c()})),!1}}),$(".sidebar .accordion-menu .sub-menu li.droplink > a").click(function(){{var e=$(this).parent().parent(),a=($(".page-sidebar-inner"),$(".page-content"),$(this).next());$(this)}return e.find("li").removeClass("open"),c(),a.is(":visible")?a.slideUp(200,function(){c()}):($(this).parent("li").addClass("open"),$(this).next(".sub-menu").slideDown(200,function(){c()})),!1});var c=function(){{var e,a=$(".page-inner"),o=$(".page-sidebar"),n=$("body"),s=$(".page-footer").outerHeight();$(".page-content").height()}a.attr("style","min-height:"+o.height()+"px !important"),n.hasClass("page-sidebar-fixed")?e=o.height()+s:(e=o.height()+s,e<$(window).height()&&(e=$(window).height())),e>=a.height()&&a.attr("style","min-height:"+e+"px !important")};c(),window.onresize=c,$(".slimscroll").slimscroll({allowPageScroll:!0});var t=document.querySelector(".fixed-header-check"),i=document.querySelector(".fixed-sidebar-check"),l=document.querySelector(".horizontal-bar-check"),d=document.querySelector(".toggle-sidebar-check"),r=document.querySelector(".boxed-layout-check"),h=document.querySelector(".compact-menu-check"),u=document.querySelector(".hover-menu-check"),b=function(){$("body").hasClass("small-sidebar")&&1==d.checked&&d.click(),$("body").hasClass("page-header-fixed")||0!=t.checked||t.click(),$("body").hasClass("page-sidebar-fixed")&&1==i.checked&&i.click(),$("body").hasClass("page-horizontal-bar")&&1==l.checked&&l.click(),$("body").hasClass("compact-menu")&&1==h.checked&&h.click(),$("body").hasClass("hover-menu")&&1==u.checked&&u.click(),$(".page-content").hasClass("container")&&1==r.checked&&r.click(),$(".theme-color").attr("href","assets/css/themes/white.css"),c()},m=$(".navbar .logo-box a span").text(),p=m.slice(0,1),g=function(){$("body").toggleClass("small-sidebar"),$(".navbar .logo-box a span").html($(".navbar .logo-box a span").text()==p?m:p),c()},f=function(){$("body").hasClass("page-horizontal-bar")&&$("body").hasClass("page-sidebar-fixed")&&$("body").hasClass("page-header-fixed")&&(i.click(),alert("Static header isn't compatible with fixed horizontal nav mode. Modern will set static mode on horizontal nav.")),$("body").toggleClass("page-header-fixed"),c()},k=function(){!$("body").hasClass("page-horizontal-bar")||$("body").hasClass("page-sidebar-fixed")||$("body").hasClass("page-header-fixed")||(t.click(),alert("Fixed horizontal nav isn't compatible with static header mode. Modern will set fixed mode on header.")),$("body").hasClass("hover-menu")&&!$("body").hasClass("page-sidebar-fixed")&&(u.click(),alert("Fixed sidebar isn't compatible with hover menu mode. Modern will set accordion mode on menu.")),$("body").toggleClass("page-sidebar-fixed"),$("body").hasClass(".page-sidebar-fixed")&&$(".page-sidebar-inner").slimScroll({destroy:!0}),$(".page-sidebar-inner").slimScroll(),c()},y=function(){$(".sidebar").toggleClass("horizontal-bar"),$(".sidebar").toggleClass("page-sidebar"),$("body").toggleClass("page-horizontal-bar"),$("body").hasClass("page-sidebar-fixed")&&!$("body").hasClass("page-header-fixed")&&(t.click(),alert("Static header isn't compatible with fixed horizontal nav mode. Modern will set static mode on horizontal nav.")),c()},C=function(){$(".page-content").toggleClass("container"),c()},v=function(){$("body").toggleClass("compact-menu"),c()},x=function(){!$("body").hasClass("hover-menu")&&$("body").hasClass("page-sidebar-fixed")&&(i.click(),alert("Fixed sidebar isn't compatible with hover menu mode. Modern will set static mode on sidebar.")),$("body").toggleClass("hover-menu"),c()};if($(".small-sidebar .navbar .logo-box a span").html($(".navbar .logo-box a span").text()==p?m:p),$(".theme-settings").length||$(".sidebar-toggle").click(function(){g()}),$(".theme-settings").length&&(t.onchange=function(){f()},i.onchange=function(){k()},l.onchange=function(){y()},d.onchange=function(){g()},h.onchange=function(){v()},u.onchange=function(){x()},r.onchange=function(){C()},$(".sidebar-toggle").click(function(){d.click()}),$(".reset-options").click(function(){b()}),$(".colorbox").click(function(){var e=$(this).attr("data-css");return $(".theme-color").attr("href","assets/css/themes/"+e+".css"),!1}),$("body").hasClass("page-sidebar-fixed")||1!=i.checked||$("body").addClass("page-sidebar-fixed"),$("body").hasClass("page-sidebar-fixed")&&0==i.checked&&$(".fixed-sidebar-check").prop("checked",!0),$("body").hasClass("page-header-fixed")||1!=t.checked||$("body").addClass("page-header-fixed"),$("body").hasClass("page-header-fixed")&&0==t.checked&&$(".fixed-header-check").prop("checked",!0),$("body").hasClass("page-horizontal-bar")||1!=l.checked||($("body").addClass("page-horizontal-bar"),$(".sidebar").addClass("horizontal-bar"),$(".sidebar").removeClass("page-sidebar")),$("body").hasClass("page-horizontal-bar")&&0==l.checked&&$(".horizontal-bar-check").prop("checked",!0),$("body").hasClass("small-sidebar")||1!=d.checked||$("body").addClass("small-sidebar"),$("body").hasClass("small-sidebar")&&0==d.checked&&$(".horizontal-bar-check").prop("checked",!0),$(".page-content").hasClass("container")||1!=r.checked||$(".toggle-sidebar-check").addClass("container"),$(".page-content").hasClass("container")&&0==r.checked&&$(".boxed-layout-check").prop("checked",!0),$(".page-content").hasClass("container")||1!=r.checked||$(".toggle-sidebar-check").addClass("container"),$(".page-content").hasClass("container")&&0==r.checked&&$(".boxed-layout-check").prop("checked",!0),$(".page-content").hasClass("container")||1!=r.checked||$(".toggle-sidebar-check").addClass("container"),$(".page-content").hasClass("container")&&0==r.checked&&$(".boxed-layout-check").prop("checked",!0)),$(".chat").length){{var w=document.getElementById("cbp-spmenu-s1"),S=document.getElementById("showRight"),z=document.getElementById("closeRight"),E=document.getElementById("cbp-spmenu-s2"),F=document.getElementById("closeRight2");document.body}S.onclick=function(){classie.toggle(w,"cbp-spmenu-open")},z.onclick=function(){classie.toggle(w,"cbp-spmenu-open")},F.onclick=function(){classie.toggle(E,"cbp-spmenu-open")},$(".showRight2").click(function(){classie.toggle(E,"cbp-spmenu-open")}),$(".chat-write form input").keypress(function(e){if(13==e.which&&0==!$(this).val().length)$('<div class="chat-item chat-item-right"><div class="chat-message">'+$(this).val()+"</div></div>").insertAfter(".chat .chat-item:last-child"),$(this).val("");else if(13==e.which)return;$(".chat").slimscroll({allowPageScroll:!0})})}});