1(function($) { 2 'use strict'; 3 $(function() { 4 var body = $('body'); 5 var contentWrapper = $('.content-wrapper'); 6 var scroller = $('.container-scroller'); 7 var footer = $('.footer'); 8 var sidebar = $('.sidebar'); 9 10 //Add active class to nav-link based on url dynamically 11 //Active class can be hard coded directly in html file also as required 12 13 function addActiveClass(element) { 14 if (current === "") { 15 //for root url 16 if (element.attr('href').indexOf("index.html") !== -1) { 17 element.parents('.nav-item').last().addClass('active'); 18 if (element.parents('.sub-menu').length) { 19 element.closest('.collapse').addClass('show'); 20 element.addClass('active'); 21 } 22 } 23 } else { 24 //for other url 25 if (element.attr('href').indexOf(current) !== -1) { 26 element.parents('.nav-item').last().addClass('active'); 27 if (element.parents('.sub-menu').length) { 28 element.closest('.collapse').addClass('show'); 29 element.addClass('active'); 30 } 31 if (element.parents('.submenu-item').length) { 32 element.addClass('active'); 33 } 34 } 35 } 36 } 37 38 var current = location.pathname.split("/").slice(-1)[0].replace(/^\/|\/$/g, ''); 39 $('.nav li a', sidebar).each(function() { 40 var $this = $(this); 41 addActiveClass($this); 42 }) 43 44 $('.horizontal-menu .nav li a').each(function() { 45 var $this = $(this); 46 addActiveClass($this); 47 }) 48 49 //Close other submenu in sidebar on opening any 50 51 sidebar.on('show.bs.collapse', '.collapse', function() { 52 sidebar.find('.collapse.show').collapse('hide'); 53 }); 54 55 56 //Change sidebar and content-wrapper height 57 applyStyles(); 58 59 function applyStyles() { 60 //Applying perfect scrollbar 61 if (!body.hasClass("rtl")) { 62 if ($('.settings-panel .tab-content .tab-pane.scroll-wrapper').length) { 63 const settingsPanelScroll = new PerfectScrollbar('.settings-panel .tab-content .tab-pane.scroll-wrapper'); 64 } 65 if ($('.chats').length) { 66 const chatsScroll = new PerfectScrollbar('.chats'); 67 } 68 if (body.hasClass("sidebar-fixed")) { 69 if($('#sidebar').length) { 70 var fixedSidebarScroll = new PerfectScrollbar('#sidebar .nav'); 71 } 72 } 73 } 74 } 75 76 $('[data-toggle="minimize"]').on("click", function() { 77 if ((body.hasClass('sidebar-toggle-display')) || (body.hasClass('sidebar-absolute'))) { 78 body.toggleClass('sidebar-hidden'); 79 } else { 80 body.toggleClass('sidebar-icon-only'); 81 } 82 }); 83 84 //checkbox and radios 85 $(".form-check label,.form-radio label").append('<i class="input-helper"></i>'); 86 87 //Horizontal menu in mobile 88 $('[data-toggle="horizontal-menu-toggle"]').on("click", function() { 89 $(".horizontal-menu .bottom-navbar").toggleClass("header-toggled"); 90 }); 91 // Horizontal menu navigation in mobile menu on click 92 var navItemClicked = $('.horizontal-menu .page-navigation >.nav-item'); 93 navItemClicked.on("click", function(event) { 94 if(window.matchMedia('(max-width: 991px)').matches) { 95 if(!($(this).hasClass('show-submenu'))) { 96 navItemClicked.removeClass('show-submenu'); 97 } 98 $(this).toggleClass('show-submenu'); 99 } 100 }) 101 102 $(window).scroll(function() { 103 if(window.matchMedia('(min-width: 992px)').matches) { 104 var header = $('.horizontal-menu'); 105 if ($(window).scrollTop() >= 70) { 106 $(header).addClass('fixed-on-scroll'); 107 } else { 108 $(header).removeClass('fixed-on-scroll'); 109 } 110 } 111 }); 112 }); 113 114 // focus input when clicking on search icon 115 $('#navbar-search-icon').click(function() { 116 $("#navbar-search-input").focus(); 117 }); 118 119})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.