1 2(function($) { 3 'use strict'; 4 $(function() { 5 var body = $('body'); 6 var mainWrapper = $('.main-wrapper'); 7 var footer = $('footer'); 8 var sidebar = $('.sidebar'); 9 var navbar = $('.navbar').not('.top-navbar'); 10 11 12 // Enable feather-icons with SVG markup 13 feather.replace(); 14 15 // initializing bootstrap tooltip 16 $('[data-toggle="tooltip"]').tooltip(); 17 18 // initialize clipboard plugin 19 if ($('.btn-clipboard').length) { 20 var clipboard = new ClipboardJS('.btn-clipboard'); 21 22 // Enabling tooltip to all clipboard buttons 23 $('.btn-clipboard').attr('data-toggle', 'tooltip').attr('title', 'Copy to clipboard'); 24 25 // initializing bootstrap tooltip 26 $('[data-toggle="tooltip"]').tooltip(); 27 28 // initially hide btn-clipboard and show after copy 29 clipboard.on('success', function(e) { 30 e.trigger.classList.value = 'btn btn-clipboard btn-current' 31 $('.btn-current').tooltip('hide'); 32 e.trigger.dataset.originalTitle = 'Copied'; 33 $('.btn-current').tooltip('show'); 34 setTimeout(function(){ 35 $('.btn-current').tooltip('hide'); 36 e.trigger.dataset.originalTitle = 'Copy to clipboard'; 37 e.trigger.classList.value = 'btn btn-clipboard' 38 },1000); 39 e.clearSelection(); 40 }); 41 } 42 43 44 // Applying perfect-scrollbar 45 if ($('.sidebar .sidebar-body').length) { 46 const sidebarBodyScroll = new PerfectScrollbar('.sidebar-body'); 47 } 48 if ($('.content-nav-wrapper').length) { 49 const contentNavWrapper = new PerfectScrollbar('.content-nav-wrapper'); 50 } 51 52 // Sidebar toggle to sidebar-folded 53 $('.sidebar-toggler').on('click', function(e) { 54 e.preventDefault(); 55 $('.sidebar-header .sidebar-toggler').toggleClass('active not-active'); 56 if (window.matchMedia('(min-width: 992px)').matches) { 57 e.preventDefault(); 58 body.toggleClass('sidebar-folded'); 59 } else if (window.matchMedia('(max-width: 991px)').matches) { 60 e.preventDefault(); 61 body.toggleClass('sidebar-open'); 62 } 63 }); 64 65 66 // Settings sidebar toggle 67 $('.settings-sidebar-toggler').on('click', function(e) { 68 $('body').toggleClass('settings-open'); 69 }); 70 71 // Sidebar theme settings 72 $("input:radio[name=sidebarThemeSettings]").click(function() { 73 $('body').removeClass('sidebar-light sidebar-dark'); 74 $('body').addClass($(this).val()); 75 }) 76 77 78 // sidebar-folded on large devices 79 function iconSidebar(e) { 80 if (e.matches) { 81 body.addClass('sidebar-folded'); 82 } else { 83 body.removeClass('sidebar-folded'); 84 } 85 } 86 var desktopMedium = window.matchMedia('(min-width:992px) and (max-width: 1199px)'); 87 desktopMedium.addListener(iconSidebar); 88 iconSidebar(desktopMedium); 89 90 91 //Add active class to nav-link based on url dynamically 92 function addActiveClass(element) { 93 if (current === "") { 94 //for root url 95 if (element.attr('href').indexOf("index.html") !== -1) { 96 element.parents('.nav-item').last().addClass('active'); 97 if (element.parents('.sub-menu').length) { 98 element.closest('.collapse').addClass('show'); 99 element.addClass('active'); 100 } 101 } 102 } else { 103 //for other url 104 if (element.attr('href').indexOf(current) !== -1) { 105 element.parents('.nav-item').last().addClass('active'); 106 if (element.parents('.sub-menu').length) { 107 element.closest('.collapse').addClass('show'); 108 element.addClass('active'); 109 } 110 if (element.parents('.submenu-item').length) { 111 element.addClass('active'); 112 } 113 } 114 } 115 } 116 117 var current = location.pathname.split("/").slice(-1)[0].replace(/^\/|\/$/g, ''); 118 $('.nav li a', sidebar).each(function() { 119 var $this = $(this); 120 addActiveClass($this); 121 }); 122 123 $('.horizontal-menu .nav li a').each(function() { 124 var $this = $(this); 125 addActiveClass($this); 126 }) 127 128 129 // open sidebar-folded when hover 130 $(".sidebar .sidebar-body").hover( 131 function () { 132 if (body.hasClass('sidebar-folded')){ 133 body.addClass("open-sidebar-folded"); 134 } 135 }, 136 function () { 137 if (body.hasClass('sidebar-folded')){ 138 body.removeClass("open-sidebar-folded"); 139 } 140 }); 141 142 // close sidebar when click outside on mobile/table 143 $(document).on('click touchstart', function(e){ 144 e.stopPropagation(); 145 146 // closing of sidebar menu when clicking outside of it 147 if (!$(e.target).closest('.sidebar-toggler').length) { 148 var sidebar = $(e.target).closest('.sidebar').length; 149 var sidebarBody = $(e.target).closest('.sidebar-body').length; 150 if (!sidebar && !sidebarBody) { 151 if ($('body').hasClass('sidebar-open')) { 152 $('body').removeClass('sidebar-open'); 153 } 154 } 155 } 156 }); 157 158 // initializing popover 159 $('[data-toggle="popover"]').popover(); 160 161 //checkbox and radios 162 $(".form-check label,.form-radio label").append('<i class="input-frame"></i>'); 163 164 165 166 167 //Horizontal menu in mobile
168 $('[data-toggle="horizontal-menu-toggle"]').on("click", function() { 169 $(".horizontal-menu .bottom-navbar").toggleClass("header-toggled"); 170 }); 171 // Horizontal menu navigation in mobile menu on click 172 var navItemClicked = $('.horizontal-menu .page-navigation >.nav-item'); 173 navItemClicked.on("click", function(event) { 174 if(window.matchMedia('(max-width: 991px)').matches) { 175 if(!($(this).hasClass('show-submenu'))) { 176 navItemClicked.removeClass('show-submenu'); 177 } 178 $(this).toggleClass('show-submenu'); 179 } 180 }) 181 182 $(window).scroll(function() { 183 if(window.matchMedia('(min-width: 992px)').matches) { 184 var header = $('.horizontal-menu'); 185 if ($(window).scrollTop() >= 60) { 186 $(header).addClass('fixed-on-scroll'); 187 } else { 188 $(header).removeClass('fixed-on-scroll'); 189 } 190 } 191 }); 192 193 194 // Prevent body scrolling while sidebar scroll 195 $('.sidebar .sidebar-body').hover(function () { 196 $('body').addClass('overflow-hidden'); 197 }, function () { 198 $('body').removeClass('overflow-hidden'); 199 }); 200 201 202 }); 203})(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.