1/*! 2 3 ========================================================= 4 * Paper Dashboard - v1.1.2 5 ========================================================= 6 7 * Product Page: http://www.creative-tim.com/product/paper-dashboard 8 * Copyright 2017 Creative Tim (http://www.creative-tim.com) 9 * Licensed under MIT (https://github.com/creativetimofficial/paper-dashboard/blob/master/LICENSE.md) 10 11 ========================================================= 12 13 * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 15 */ 16 17 18var fixedTop = false; 19var transparent = true; 20var navbar_initialized = false; 21 22$(document).ready(function(){ 23 window_width = $(window).width(); 24 25 // Init navigation toggle for small screens 26 if(window_width <= 991){ 27 pd.initRightMenu(); 28 } 29 30 // Activate the tooltips 31 $('[rel="tooltip"]').tooltip(); 32 33}); 34 35// activate collapse right menu when the windows is resized 36$(window).resize(function(){ 37 if($(window).width() <= 991){ 38 pd.initRightMenu(); 39 } 40}); 41 42pd = { 43 misc:{ 44 navbar_menu_visible: 0 45 }, 46 checkScrollForTransparentNavbar: debounce(function() { 47 if($(document).scrollTop() > 381 ) { 48 if(transparent) { 49 transparent = false; 50 $('.navbar-color-on-scroll').removeClass('navbar-transparent'); 51 $('.navbar-title').removeClass('hidden'); 52 } 53 } else { 54 if( !transparent ) { 55 transparent = true; 56 $('.navbar-color-on-scroll').addClass('navbar-transparent'); 57 $('.navbar-title').addClass('hidden'); 58 } 59 } 60 }), 61 initRightMenu: function(){ 62 if(!navbar_initialized){ 63 $off_canvas_sidebar = $('nav').find('.navbar-collapse').first().clone(true); 64 65 $sidebar = $('.sidebar'); 66 sidebar_bg_color = $sidebar.data('background-color'); 67 sidebar_active_color = $sidebar.data('active-color'); 68 69 $logo = $sidebar.find('.logo').first(); 70 logo_content = $logo[0].outerHTML; 71 72 ul_content = ''; 73 74 // set the bg color and active color from the default sidebar to the off canvas sidebar; 75 $off_canvas_sidebar.attr('data-background-color',sidebar_bg_color); 76 $off_canvas_sidebar.attr('data-active-color',sidebar_active_color); 77 78 $off_canvas_sidebar.addClass('off-canvas-sidebar'); 79 80 //add the content from the regular header to the right menu 81 $off_canvas_sidebar.children('ul').each(function(){ 82 content_buff = $(this).html(); 83 ul_content = ul_content + content_buff; 84 }); 85 86 // add the content from the sidebar to the right menu 87 content_buff = $sidebar.find('.nav').html(); 88 ul_content = ul_content + '<li class="divider"></li>'+ content_buff; 89 90 ul_content = '<ul class="nav navbar-nav">' + ul_content + '</ul>'; 91 92 navbar_content = logo_content + ul_content; 93 navbar_content = '<div class="sidebar-wrapper">' + navbar_content + '</div>'; 94 95 $off_canvas_sidebar.html(navbar_content); 96 97 $('body').append($off_canvas_sidebar); 98 99 $toggle = $('.navbar-toggle'); 100 101 $off_canvas_sidebar.find('a').removeClass('btn btn-round btn-default'); 102 $off_canvas_sidebar.find('button').removeClass('btn-round btn-fill btn-info btn-primary btn-success btn-danger btn-warning btn-neutral'); 103 $off_canvas_sidebar.find('button').addClass('btn-simple btn-block'); 104 105 $toggle.click(function (){ 106 if(pd.misc.navbar_menu_visible == 1) { 107 $('html').removeClass('nav-open'); 108 pd.misc.navbar_menu_visible = 0; 109 $('#bodyClick').remove(); 110 setTimeout(function(){ 111 $toggle.removeClass('toggled'); 112 }, 400); 113 114 } else { 115 setTimeout(function(){ 116 $toggle.addClass('toggled'); 117 }, 430); 118 119 div = '<div id="bodyClick"></div>'; 120 $(div).appendTo("body").click(function() { 121 $('html').removeClass('nav-open'); 122 pd.misc.navbar_menu_visible = 0; 123 $('#bodyClick').remove(); 124 setTimeout(function(){ 125 $toggle.removeClass('toggled'); 126 }, 400); 127 }); 128 129 $('html').addClass('nav-open'); 130 pd.misc.navbar_menu_visible = 1; 131 132 } 133 }); 134 navbar_initialized = true; 135 } 136 137 } 138} 139 140 141// Returns a function, that, as long as it continues to be invoked, will not 142// be triggered. The function will be called after it stops being called for 143// N milliseconds. If `immediate` is passed, trigger the function on the 144// leading edge, instead of the trailing. 145 146function debounce(func, wait, immediate) { 147 var timeout; 148 return function() { 149 var context = this, args = arguments; 150 clearTimeout(timeout); 151 timeout = setTimeout(function() { 152 timeout = null;
153 if (!immediate) func.apply(context, args); 154 }, wait); 155 if (immediate && !timeout) func.apply(context, args); 156 }; 157};
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.