1/*! 2 3 ========================================================= 4 * Paper Kit 2 PRO - v2.1.0 5 ========================================================= 6 7 * Product Page: http://www.creative-tim.com/product/paper-kit-2-pro 8 * Copyright 2017 Creative Tim (http://www.creative-tim.com) 9 * License Creative Tim (https://www.creative-tim.com/license) 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 16var searchVisible = 0; 17var transparent = true; 18 19var transparentDemo = true; 20var fixedTop = false; 21 22var toggle_initialized = false; 23 24var didScroll; 25var lastScrollTop = 0; 26var delta = 5; 27var navbarHeight = 0; 28 29$(document).ready(function(){ 30 window_width = $(window).width(); 31 32 33 // Activate the tooltips 34 $('[data-toggle="tooltip"]').tooltip(); 35 36 // Activate the switches with icons 37 if($('.switch').length != 0){ 38 $('.switch')['bootstrapSwitch'](); 39 } 40 // Activate regular switches 41 if($("[data-toggle='switch']").length != 0){ 42 $("[data-toggle='switch']").bootstrapSwitch(); 43 } 44 45 // Activate bootstrap-select 46 if($(".selectpicker").length != 0){ 47 $(".selectpicker").selectpicker(); 48 } 49 50 $('.modal').appendTo('body'); 51 52 if($(".tagsinput").length != 0){ 53 $(".tagsinput").tagsInput(); 54 } 55 56 // Limit number of characters in limited textarea 57 $('.textarea-limited').keyup(function () { 58 var max = $(this).attr('maxlength'); 59 var len = $(this).val().length; 60 if (len >= max) { 61 $('#textarea-limited-message').text(' you have reached the limit'); 62 } else { 63 var char = max - len; 64 $('#textarea-limited-message').text(char + ' characters left'); 65 } 66 }); 67 68 if (window_width >= 768) { 69 big_image = $('.page-header[data-parallax="true"]'); 70 71 if(big_image.length != 0){ 72 $(window).on('scroll', pk.checkScrollForPresentationPage); 73 } 74 } 75 76 77 if($("#datetimepicker").length != 0){ 78 $('#datetimepicker').datetimepicker({ 79 icons: { 80 time: "fa fa-clock-o", 81 date: "fa fa-calendar", 82 up: "fa fa-chevron-up", 83 down: "fa fa-chevron-down", 84 previous: 'fa fa-chevron-left', 85 next: 'fa fa-chevron-right', 86 today: 'fa fa-screenshot', 87 clear: 'fa fa-trash', 88 close: 'fa fa-remove' 89 } 90 }); 91 92 }; 93 94 // Change the collor of navbar collapse 95 $('#navbarToggler').on('show.bs.collapse', function () { 96 if( $('nav').hasClass('navbar-transparent') && $(document).scrollTop() < 50 ){ 97 $('.navbar').addClass('no-transition'); 98 $('nav').removeClass('navbar-transparent'); 99 } 100 }).on('hidden.bs.collapse', function () { 101 102 if($(document).scrollTop() < 50 ){ 103 $('.navbar').removeClass('no-transition'); 104 $('nav:first-of-type').addClass('navbar-transparent'); 105 106 } 107 }); 108 109 // Navbar color change on scroll 110 if($('.navbar[color-on-scroll]').length != 0){ 111 $(window).on('scroll', pk.checkScrollForTransparentNavbar) 112 } 113 114 $('.btn-tooltip').tooltip(); 115 $('.label-tooltip').tooltip(); 116 117 // Carousel 118 $('.carousel').carousel({ 119 interval: 20000 120 }); 121 122 $('.form-control').on("focus", function(){ 123 $(this).parent('.input-group').addClass("input-group-focus"); 124 }).on("blur", function(){ 125 $(this).parent(".input-group").removeClass("input-group-focus"); 126 }); 127 128 // Init popovers 129 pk.initPopovers(); 130 131 // Init Sliders 132 pk.initSliders(); 133 134 // Init video header 135 pk.initVideoBackground(); 136 137 // Activate Navbar 138 if($('.nav-down').length != 0){ 139 pk.checkScrollForMovingNavbar(); 140 }; 141 142}); 143 144$(document).on('click', '.navbar-toggler', function(){ 145 $toggle = $(this); 146 if(pk.misc.navbar_menu_visible == 1) { 147 $('html').removeClass('nav-open'); 148 pk.misc.navbar_menu_visible = 0; 149 setTimeout(function(){ 150 $toggle.removeClass('toggled'); 151 $('#bodyClick').remove(); 152 }, 550); 153 } else { 154 setTimeout(function(){ 155 $toggle.addClass('toggled'); 156 }, 580); 157 158 div = '<div id="bodyClick"></div>'; 159 $(div).appendTo("body").click(function() { 160 $('html').removeClass('nav-open'); 161 pk.misc.navbar_menu_visible = 0; 162 $('#bodyClick').remove(); 163 setTimeout(function(){ 164 $toggle.removeClass('toggled'); 165 }, 550); 166 }); 167 168 169 170 $('html').addClass('nav-open'); 171 pk.misc.navbar_menu_visible = 1; 172 } 173}); 174 175 176pk = { 177 misc:{ 178 navbar_menu_visible: 0 179 }, 180 checkScrollForTransparentNavbar: debounce(function() { 181 if($(document).scrollTop() > $(".navbar").attr("color-on-scroll") ) { 182 if(transparent) { 183 transparent = false;
184 $('.navbar[color-on-scroll]').removeClass('navbar-transparent'); 185 } 186 } else { 187 if( !transparent ) { 188 transparent = true; 189 $('.navbar[color-on-scroll]').addClass('navbar-transparent'); 190 } 191 } 192 }, 17), 193 194 checkScrollForMovingNavbar: function(){ 195 196 // Hide Header on on scroll down 197 navbarHeight = $('.navbar').outerHeight(); 198 199 $(window).scroll(function(event){ 200 didScroll = true; 201 }); 202 203 setInterval(function() { 204 if (didScroll) { 205 hasScrolled(); 206 didScroll = false; 207 } 208 }, 250); 209 210 211 }, 212 213 checkScrollForPresentationPage: debounce(function(){ 214 oVal = ($(window).scrollTop() / 3); 215 big_image.css({ 216 'transform':'translate3d(0,' + oVal +'px,0)', 217 '-webkit-transform':'translate3d(0,' + oVal +'px,0)', 218 '-ms-transform':'translate3d(0,' + oVal +'px,0)', 219 '-o-transform':'translate3d(0,' + oVal +'px,0)' 220 }); 221 }, 4), 222 223 initVideoBackground: function(){ 224 $('[data-toggle="video"]').click(function(){ 225 id_video = $(this).data('video'); 226 video = $('#' + id_video).get(0); 227 228 parent = $(this).parent('div').parent('div'); 229 230 if(video.paused){ 231 video.play(); 232 $(this).html('<i class="fa fa-pause"></i> Pause Video'); 233 parent.addClass('state-play'); 234 } else { 235 video.pause(); 236 $(this).html('<i class="fa fa-play"></i> Play Video'); 237 parent.removeClass('state-play'); 238 } 239 }); 240 }, 241 242 initPopovers: function(){ 243 if($('[data-toggle="popover"]').length != 0){ 244 $('body').append('<div class="popover-filter"></div>'); 245 246 // Activate Popovers 247 $('[data-toggle="popover"]').popover().on('show.bs.popover', function () { 248 $('.popover-filter').click(function(){ 249 $(this).removeClass('in'); 250 $('[data-toggle="popover"]').popover('hide'); 251 }); 252 $('.popover-filter').addClass('in'); 253 }).on('hide.bs.popover', function(){ 254 $('.popover-filter').removeClass('in'); 255 }); 256 257 } 258 }, 259 260 initSliders: function(){ 261 // Sliders for demo purpose in refine cards section 262 if($('#sliderRegular').length != 0 ){ 263 var rangeSlider = document.getElementById('sliderRegular'); 264 noUiSlider.create(rangeSlider, { 265 start: [ 5000 ], 266 range: { 267 'min': [ 2000 ], 268 'max': [ 10000 ] 269 } 270 }); 271 } 272 if($('#sliderDouble').length != 0){ 273 var slider = document.getElementById('sliderDouble'); 274 noUiSlider.create(slider, { 275 start: [20, 80], 276 connect: true, 277 range: { 278 'min': 0, 279 'max': 100 280 } 281 }); 282 } 283 284 }, 285 286 287} 288 289demo = { 290 initPickColor: function(){ 291 $('.pick-class-label').click(function(){ 292 var new_class = $(this).attr('new-class'); 293 var old_class = $('#display-buttons').attr('data-class'); 294 var display_div = $('#display-buttons'); 295 if(display_div.length) { 296 var display_buttons = display_div.find('.btn'); 297 display_buttons.removeClass(old_class); 298 display_buttons.addClass(new_class); 299 display_div.attr('data-class', new_class); 300 } 301 }); 302 } 303} 304 305// Returns a function, that, as long as it continues to be invoked, will not 306// be triggered. The function will be called after it stops being called for 307// N milliseconds. If `immediate` is passed, trigger the function on the 308// leading edge, instead of the trailing. 309 310function debounce(func, wait, immediate) { 311 var timeout; 312 return function() { 313 var context = this, args = arguments; 314 clearTimeout(timeout); 315 timeout = setTimeout(function() { 316 timeout = null;
317 if (!immediate) func.apply(context, args); 318 }, wait); 319 if (immediate && !timeout) func.apply(context, args); 320 }; 321}; 322 323function hasScrolled() { 324 var st = $(this).scrollTop(); 325 // Make sure they scroll more than delta 326 if(Math.abs(lastScrollTop - st) <= delta) 327 return; 328 329 // If they scrolled down and are past the navbar, add class .nav-up. 330 // This is necessary so you never see what is "behind" the navbar. 331 if (st > lastScrollTop && st > navbarHeight){ 332 // Scroll Down 333 $('.navbar.nav-down').removeClass('nav-down').addClass('nav-up'); 334 } else { 335 // Scroll Up 336 if(st + $(window).height() < $(document).height()) { 337 $('.navbar.nav-up').removeClass('nav-up').addClass('nav-down'); 338 } 339 } 340 341 lastScrollTop = st; 342};
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.