1/*========================================================================================= 2 File Name: app.js 3 Description: Template related app JS. 4 ---------------------------------------------------------------------------------------- 5 Item Name: Modern Admin - Clean Bootstrap 4 Dashboard HTML Template 6 Version: 1.0 7 Author: Pixinvent 8 Author URL: hhttp://www.themeforest.net/user/pixinvent 9==========================================================================================*/ 10 11(function(window, document, $) { 12 'use strict'; 13 var $html = $('html'); 14 var $body = $('body'); 15 16 17 $(window).on('load',function(){ 18 var rtl; 19 var compactMenu = false; // Set it to true, if you want default menu to be compact 20 21 if($('html').data('textdirection') == 'rtl'){ 22 rtl = true; 23 } 24 25 setTimeout(function(){ 26 $html.removeClass('loading').addClass('loaded'); 27 }, 1200); 28 29 $.app.menu.init(compactMenu); 30 31 // Navigation configurations 32 var config = { 33 speed: 300 // set speed to expand / collpase menu 34 }; 35 if($.app.nav.initialized === false){ 36 $.app.nav.init(config); 37 } 38 39 Unison.on('change', function(bp) { 40 $.app.menu.change(); 41 }); 42 43 // Tooltip Initialization 44 $('[data-toggle="tooltip"]').tooltip({ 45 container:'body' 46 }); 47 48 // Top Navbars - Hide on Scroll 49 if ($(".navbar-hide-on-scroll").length > 0) { 50 $(".navbar-hide-on-scroll.fixed-top").headroom({ 51 "offset": 205, 52 "tolerance": 5, 53 "classes": { 54 // when element is initialised 55 initial : "headroom", 56 // when scrolling up 57 pinned : "headroom--pinned-top", 58 // when scrolling down 59 unpinned : "headroom--unpinned-top", 60 } 61 }); 62 // Bottom Navbars - Hide on Scroll 63 $(".navbar-hide-on-scroll.fixed-bottom").headroom({ 64 "offset": 205, 65 "tolerance": 5, 66 "classes": { 67 // when element is initialised 68 initial : "headroom", 69 // when scrolling up 70 pinned : "headroom--pinned-bottom", 71 // when scrolling down 72 unpinned : "headroom--unpinned-bottom", 73 } 74 }); 75 } 76
77 //Match content & menu height for content menu 78 setTimeout(function(){ 79 if($('body').hasClass('vertical-content-menu')){ 80 setContentMenuHeight(); 81 } 82 },500); 83 function setContentMenuHeight(){ 84 var menuHeight = $('.main-menu').height(); 85 var bodyHeight = $('.content-body').height(); 86 if(bodyHeight<menuHeight){ 87 $('.content-body').css('height',menuHeight); 88 } 89 } 90 91 // Collapsible Card 92 $('a[data-action="collapse"]').on('click',function(e){ 93 e.preventDefault(); 94 $(this).closest('.card').children('.card-content').collapse('toggle'); 95 $(this).closest('.card').find('[data-action="collapse"] i').toggleClass('ft-minus ft-plus'); 96 97 }); 98 99 // Toggle fullscreen 100 $('a[data-action="expand"]').on('click',function(e){ 101 e.preventDefault(); 102 $(this).closest('.card').find('[data-action="expand"] i').toggleClass('ft-maximize ft-minimize'); 103 $(this).closest('.card').toggleClass('card-fullscreen'); 104 }); 105 106 // Notifications & messages scrollable 107 if($('.scrollable-container').length > 0){ 108 $('.scrollable-container').perfectScrollbar({ 109 theme:"dark" 110 }); 111 } 112 113 // Reload Card 114 $('a[data-action="reload"]').on('click',function(){ 115 var block_ele = $(this).closest('.card'); 116 117 // Block Element 118 block_ele.block({ 119 message: '<div class="ft-refresh-cw icon-spin font-medium-2"></div>', 120 timeout: 2000, //unblock after 2 seconds 121 overlayCSS: { 122 backgroundColor: '#FFF', 123 cursor: 'wait', 124 }, 125 css: { 126 border: 0, 127 padding: 0, 128 backgroundColor: 'none' 129 } 130 }); 131 }); 132 133 // Close Card 134 $('a[data-action="close"]').on('click',function(){ 135 $(this).closest('.card').removeClass().slideUp('fast'); 136 }); 137 138 // Match the height of each card in a row 139 setTimeout(function(){ 140 $('.row.match-height').each(function() { 141 $(this).find('.card').not('.card .card').matchHeight(); // Not .card .card prevents collapsible cards from taking height 142 }); 143 },500); 144 145 146 $('.card .heading-elements a[data-action="collapse"]').on('click',function(){ 147 var $this = $(this), 148 card = $this.closest('.card'); 149 var cardHeight; 150 151 if(parseInt(card[0].style.height,10) > 0){ 152 cardHeight = card.css('height'); 153 card.css('height','').attr('data-height', cardHeight); 154 } 155 else{ 156 if(card.data('height')){ 157 cardHeight = card.data('height'); 158 card.css('height',cardHeight).attr('data-height', ''); 159 } 160 } 161 }); 162 163 // Add open class to parent list item if subitem is active except compact menu 164 var menuType = $body.data('menu'); 165 if(menuType != 'vertical-compact-menu' && menuType != 'horizontal-menu' && compactMenu === false ){ 166 if( $body.data('menu') == 'vertical-menu-modern' ){ 167 if( localStorage.getItem("menuLocked") === "true"){ 168 $(".main-menu-content").find('li.active').parents('li').addClass('open'); 169 } 170 } 171 else{ 172 $(".main-menu-content").find('li.active').parents('li').addClass('open'); 173 } 174 } 175 if(menuType == 'vertical-compact-menu' || menuType == 'horizontal-menu'){ 176 $(".main-menu-content").find('li.active').parents('li:not(.nav-item)').addClass('open'); 177 $(".main-menu-content").find('li.active').parents('li').addClass('active'); 178 } 179 180 //card heading actions buttons small screen support 181 $(".heading-elements-toggle").on("click",function(){ 182 $(this).parent().children(".heading-elements").toggleClass("visible"); 183 }); 184 185 // Dynamic height for the chartjs div for the chart animations to work 186 var chartjsDiv = $('.chartjs'), 187 canvasHeight = chartjsDiv.children('canvas').attr('height'); 188 chartjsDiv.css('height', canvasHeight); 189 190 if($body.hasClass('boxed-layout')){ 191 if($body.hasClass('vertical-overlay-menu') || $body.hasClass('vertical-compact-menu')){ 192 var menuWidth= $('.main-menu').width(); 193 var contentPosition = $('.app-content').position().left; 194 var menuPositionAdjust = contentPosition-menuWidth; 195 if($body.hasClass('menu-flipped')){ 196 $('.main-menu').css('right',menuPositionAdjust+'px'); 197 }else{ 198 $('.main-menu').css('left',menuPositionAdjust+'px'); 199 } 200 } 201 } 202 203 $('.nav-link-search').on('click',function(){ 204 var $this = $(this), 205 searchInput = $(this).siblings('.search-input'); 206 207 if(searchInput.hasClass('open')){ 208 searchInput.removeClass('open'); 209 } 210 else{ 211 searchInput.addClass('open'); 212 } 213 }); 214 });
215 216 217 $(document).on('click', '.menu-toggle, .modern-nav-toggle', function(e) { 218 e.preventDefault(); 219 220 // Toggle menu 221 $.app.menu.toggle(); 222 223 setTimeout(function(){ 224 $(window).trigger( "resize" ); 225 },200); 226 227 if($('#collapsed-sidebar').length > 0){ 228 setTimeout(function(){ 229 if($body.hasClass('menu-expanded') || $body.hasClass('menu-open')){ 230 $('#collapsed-sidebar').prop('checked', false); 231 } 232 else{ 233 $('#collapsed-sidebar').prop('checked', true); 234 } 235 },1000); 236 } 237 238 return false; 239 }); 240 241 /*$('.modern-nav-toggle').on('click',function(){ 242 var $this = $(this), 243 icon = $this.find('.toggle-icon').attr('data-ticon'); 244 245 if(icon == 'ft-toggle-right'){ 246 $this.find('.toggle-icon').attr('data-ticon','ft-toggle-left') 247 .removeClass('ft-toggle-right').addClass('ft-toggle-left'); 248 } 249 else{ 250 $this.find('.toggle-icon').attr('data-ticon','ft-toggle-right') 251 .removeClass('ft-toggle-left').addClass('ft-toggle-right'); 252 } 253 254 $.app.menu.toggle(); 255 });*/ 256 257 $(document).on('click', '.open-navbar-container', function(e) { 258 259 var currentBreakpoint = Unison.fetch.now(); 260 261 // Init drilldown on small screen 262 $.app.menu.drillDownMenu(currentBreakpoint.name); 263 264 // return false; 265 }); 266 267 $(document).on('click', '.main-menu-footer .footer-toggle', function(e) { 268 e.preventDefault(); 269 $(this).find('i').toggleClass('pe-is-i-angle-down pe-is-i-angle-up'); 270 $('.main-menu-footer').toggleClass('footer-close footer-open'); 271 return false; 272 }); 273 274 // Add Children Class 275 $('.navigation').find('li').has('ul').addClass('has-sub'); 276 277 $('.carousel').carousel({ 278 interval: 2000 279 }); 280 281 // Page full screen 282 $('.nav-link-expand').on('click', function(e) { 283 if (typeof screenfull != 'undefined'){ 284 if (screenfull.enabled) { 285 screenfull.toggle(); 286 } 287 } 288 }); 289 if (typeof screenfull != 'undefined'){ 290 if (screenfull.enabled) { 291 $(document).on(screenfull.raw.fullscreenchange, function(){ 292 if(screenfull.isFullscreen){ 293 $('.nav-link-expand').find('i').toggleClass('ft-minimize ft-maximize'); 294 } 295 else{ 296 $('.nav-link-expand').find('i').toggleClass('ft-maximize ft-minimize'); 297 } 298 }); 299 } 300 } 301 302 $(document).on('click', '.mega-dropdown-menu', function(e) { 303 e.stopPropagation(); 304 }); 305 306 $(document).ready(function(){ 307 308 /********************************** 309 * Form Wizard Step Icon 310 **********************************/ 311 $('.step-icon').each(function(){ 312 var $this = $(this); 313 if($this.siblings('span.step').length > 0){ 314 $this.siblings('span.step').empty(); 315 $(this).appendTo($(this).siblings('span.step')); 316 } 317 }); 318 }); 319 320 // Update manual scroller when window is resized 321 $(window).resize(function() { 322 $.app.menu.manualScroller.updateHeight(); 323 }); 324 325 // TODO : Tabs dropdown fix, remove this code once fixed in bootstrap 4. 326 $('.nav.nav-tabs a.dropdown-item').on('click',function(){ 327 var $this = $(this), 328 href = $this.attr('href'); 329 var tabs = $this.closest('.nav'); 330 tabs.find('.nav-link').removeClass('active'); 331 $this.closest('.nav-item').find('.nav-link').addClass('active'); 332 $this.closest('.dropdown-menu').find('.dropdown-item').removeClass('active'); 333 $this.addClass('active'); 334 tabs.next().find(href).siblings('.tab-pane').removeClass('active in').attr('aria-expanded',false); 335 $(href).addClass('active in').attr('aria-expanded','true'); 336 });
337 338 $('#sidebar-page-navigation').on('click', 'a.nav-link', function(e){ 339 e.preventDefault(); 340 e.stopPropagation(); 341 var $this = $(this), 342 href= $this.attr('href'); 343 var offset = $(href).offset(); 344 var scrollto = offset.top - 80; // minus fixed header height 345 $('html, body').animate({scrollTop:scrollto}, 0); 346 setTimeout(function(){ 347 $this.parent('.nav-item').siblings('.nav-item').children('.nav-link').removeClass('active'); 348 $this.addClass('active'); 349 }, 100); 350 }); 351 352})(window, document, 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.