1(function($){ 2 "use strict"; 3 4 var kingster_mobile = false; 5 if( navigator.userAgent.match(/Android/i) || navigator.userAgent.match(/webOS/i) || navigator.userAgent.match(/BlackBerry/i) || 6 navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPad/i) || navigator.userAgent.match(/iPod/i) || navigator.userAgent.match(/Windows Phone/i) ){ 7 kingster_mobile = true; 8 }else{ 9 kingster_mobile = false; 10 } 11 12 var kingster_display = 'desktop'; 13 if( typeof(window.matchMedia) == 'function' ){ 14 $(window).on('resize kingster-set-display', function(){ 15 if( window.matchMedia('(max-width: 419px)').matches ){ 16 kingster_display = 'mobile-portrait'; 17 }else if( window.matchMedia('(max-width: 767px)').matches ){ 18 kingster_display = 'mobile-landscape' 19 }else if( window.matchMedia('(max-width: 959px)').matches ){ 20 kingster_display = 'tablet' 21 }else{ 22 kingster_display = 'desktop'; 23 } 24 }); 25 $(window).trigger('kingster-set-display'); 26 }else{ 27 $(window).on('resize kingster-set-display', function(){ 28 if( $(window).innerWidth() <= 419 ){ 29 kingster_display = 'mobile-portrait'; 30 }else if( $(window).innerWidth() <= 767 ){ 31 kingster_display = 'mobile-landscape' 32 }else if( $(window).innerWidth() <= 959 ){ 33 kingster_display = 'tablet' 34 }else{ 35 kingster_display = 'desktop'; 36 } 37 }); 38 $(window).trigger('kingster-set-display'); 39 } 40 41 // ref : http://unscriptable.com/2009/03/20/debouncing-javascript-methods/ 42 // ensure 1 is fired 43 var kingster_debounce = function(func, threshold, execAsap){ 44 45 var timeout; 46 47 return function debounced(){ 48 49 var obj = this, args = arguments; 50 51 function delayed(){ 52 if( !execAsap ){ 53 func.apply(obj, args); 54 } 55 timeout = null; 56 }; 57 58 if( timeout ){ 59 clearTimeout(timeout); 60 }else if( execAsap ){ 61 func.apply(obj, args); 62 } 63 timeout = setTimeout(delayed, threshold); 64 }; 65 } 66 67 // reduce the event occurance 68 var kingster_throttling = function(func, threshold){ 69 70 var timeout; 71 72 return function throttled(){ 73 var obj = this, args = arguments; 74 75 function delayed(){ 76 func.apply(obj, args); 77 timeout = null; 78 }; 79 80 if( !timeout ){ 81 timeout = setTimeout(delayed, threshold); 82 } 83 }; 84 } 85 86 ///////////////////////// 87 // menu handle function 88 ///////////////////////// 89 var kingster_sf_menu = function( menu ){ 90 91 if( menu.length == 0 ) return; 92 93 this.main_menu = menu; 94 95 this.slide_bar = this.main_menu.children('.kingster-navigation-slide-bar'); 96 this.slide_bar_val = { width: 0, left: 0 }; 97 this.slide_bar_offset = '2'; 98 99 this.current_menu = this.main_menu.children('.sf-menu').children('.current-menu-item, .current-menu-ancestor').children('a'); 100 101 this.init(); 102 103 } // kingster_sf_menu 104 105 kingster_sf_menu.prototype = { 106 107 init: function(){ 108 109 var t = this; 110 111 // sf menu mod 112 t.sf_menu_mod(); 113 114 // init superfish menu 115 if(typeof($.fn.superfish) == 'function'){ 116 t.main_menu.superfish({ delay: 400, speed: 'fast' }); 117 118 t.sf_menu_position(); 119 $(window).resize(kingster_debounce(function(){ 120 t.sf_menu_position(); 121 }, 300)); 122 } 123 124 // init the slidebar 125 if( t.slide_bar.length > 0 ){ 126 t.init_slidebar(); 127 } 128 129 }, // init 130 131 sf_menu_mod: function(){ 132 133 // create the mega menu script 134 this.main_menu.find('.sf-mega > ul').each(function(){ 135 var mega_content = $('<div></div>'); 136 var mega_row = $('<div class="sf-mega-section-wrap" ></div>'); 137 var mega_column_size = 0; 138 139 $(this).children('li').each(function(){ 140 var column_size = parseInt($(this).attr('data-size')); 141 if( mega_column_size + column_size <= 60 ){ 142 mega_column_size += column_size; 143 }else{ 144 mega_column_size = column_size; 145 mega_content.append(mega_row); 146 mega_row = $('<div class="sf-mega-section-wrap" ></div>'); 147 } 148 149 mega_row.append( $('<div class="sf-mega-section" ></div>') 150 .addClass('kingster-column-' + column_size) 151 .html( $('<div class="sf-mega-section-inner" ></div>') 152 .addClass($(this).attr('class')) 153 .attr('id', $(this).attr('id')) 154 .html($(this).html()) 155 ) 156 ); 157 }); 158 159 mega_content.append(mega_row); 160 $(this).replaceWith(mega_content.html()); 161 }); 162 163 }, // sf_menu_mod 164 165 sf_menu_position: function(){ 166 167 if( kingster_display == 'mobile-landscape' || kingster_display == 'mobile-portrait' || kingster_display == 'tablet' ) return; 168 169 // submenu of normal menu 170 var body_wrapper = $('.kingster-body-wrapper'); 171 var sub_normal_menu = this.main_menu.find('.sf-menu > li.kingster-normal-menu .sub-menu'); 172 173 sub_normal_menu.css({display: 'block'}
173).removeClass('sub-menu-right'); 174 sub_normal_menu.each(function(){ 175 if( $(this).offset().left + $(this).width() > body_wrapper.outerWidth() ){ 176 $(this).addClass('sub-menu-right'); 177 } 178 }); 179 sub_normal_menu.css({display: 'none'}); 180 181 // submenu of mega menu 182 this.main_menu.find('.sf-menu > li.kingster-mega-menu .sf-mega').each(function(){ 183 if( !$(this).hasClass('sf-mega-full') ){ 184 185 $(this).css({ display: 'block' }); 186 187 // set the position 188 $(this).css({ right: '', 'margin-left': -(($(this).width() - $(this).parent().outerWidth()) / 2) }); 189 190 // if exceed the screen 191 if( $(this).offset().left + $(this).width() > $(window).width() ){ 192 $(this).css({ right: 0, 'margin-left': '' }); 193 } 194 195 $(this).css({ display: 'none' }); 196 } 197 198 }); 199 200 }, // sf_menu_position 201 202 init_slidebar: function(){ 203 204 var t = this; 205 206 t.init_slidebar_pos(); 207 $(window).load(function(){ t.init_slidebar_pos(); }); 208 209 // animate slidebar 210 if( !kingster_mobile ){ 211 t.main_menu.children('.sf-menu').children('li').on({ 212 mouseenter: function(){ 213 var nav_element = $(this).children('a'); 214 215 if( nav_element.length > 0 ){ 216 t.slide_bar.animate({ width: nav_element.outerWidth() + (2 * t.slide_bar_offset), left: nav_element.position().left - t.slide_bar_offset }, { queue: false, duration: 250 }); 217 } 218 }, 219 mouseleave: function(){ 220 t.slide_bar.animate({ width: t.slide_bar_val.width, left: t.slide_bar_val.left }, { queue: false, duration: 250 }); 221 } 222 }); 223 } 224 225 // window resize event 226 $(window).on('resize', function(){ t.init_slidebar_pos(); }); 227 $(window).on('kingster-navigation-slider-bar-init', function(){ 228 t.current_menu = t.main_menu.children('.sf-menu').children('.current-menu-item, .current-menu-ancestor').children('a'); 229 t.animate_slidebar_pos(); 230 }); 231 $(window).on('kingster-navigation-slider-bar-animate', function(){ t.animate_slidebar_pos(); }); 232 233 }, // init_slidebar 234 235 init_slidebar_pos: function(){ 236 237 if( kingster_display == 'mobile-landscape' || kingster_display == 'mobile-portrait' || kingster_display == 'tablet' ) return; 238 239 var t = this; 240 241 if( t.current_menu.length > 0 ){ 242 t.slide_bar_val = { width: t.current_menu.outerWidth() + (2 * t.slide_bar_offset), left: t.current_menu.position().left - t.slide_bar_offset }; 243 }else{ 244 t.slide_bar_val = { width: 0, left: t.main_menu.children('ul').children('li:first-child').position().left } 245 } 246 t.slide_bar.css({ width: t.slide_bar_val.width, left: t.slide_bar_val.left, display: 'block' }); 247 248 }, // set_slidebar_pos 249 animate_slidebar_pos: function(){ 250 251 if( kingster_display == 'mobile-landscape' || kingster_display == 'mobile-portrait' || kingster_display == 'tablet' ) return; 252 253 var t = this; 254 255 if( t.current_menu.length > 0 ){ 256 t.slide_bar_val = { width: t.current_menu.outerWidth() + (2 * t.slide_bar_offset), left: t.current_menu.position().left - t.slide_bar_offset }; 257 }else{ 258 t.slide_bar_val = { width: 0, left: t.main_menu.children('ul').children('li:first-child').position().left } 259 } 260 t.slide_bar.animate({ width: t.slide_bar_val.width, left: t.slide_bar_val.left }, { queue: false, duration: 250 }); 261 262 } // set_slidebar_pos 263 264 }; // kingster_sf_menu.prototype 265 266 ///////////////////////// 267 // mobile menu 268 ///////////////////////// 269 $.fn.kingster_mobile_menu = function( args ){ 270 271 var menu_button = $(this).siblings('.kingster-mm-menu-button'); 272 var options = { 273 navbar: { title: '<span class="mmenu-custom-close" ></span>' }, 274 extensions: [ 'pagedim-black' ], 275 276 }; 277 var extensions = { 278 offCanvas: { pageNodetype: '.kingster-body-outer-wrapper' } 279 }; 280 281 // remove the wrap for submenu 282 $(this).find('a[href="#"]').each(function(){ 283 var content = $(this).html(); 284 $('<span class="kingster-mm-menu-blank" ></span>').html(content).insertBefore($(this)); 285 $(this).remove(); 286 }); 287
288 if( $(this).attr('data-slide') ){ 289 var html_class = 'kingster-mmenu-' + $(this).attr('data-slide'); 290 $('html').addClass(html_class); 291 292 options.offCanvas = { position : $(this).attr('data-slide') }; 293 } 294 295 $(this).mmenu(options, extensions); 296 297 var menu_api = $(this).data('mmenu'); 298 $(this).find('a').not('.mm-next, .mm-prev').on('click', function(){ 299 menu_api.close(); 300 }); 301 $(this).find('.mmenu-custom-close').on('click', function(){ 302 menu_api.close(); 303 }); 304 // $(window).resize(function(){ 305 // menu_api.close(); 306 // }); 307 308 // add class active to button 309 menu_api.bind('open', function($panel){ 310 menu_button.addClass('kingster-active'); 311 }); 312 menu_api.bind('close', function($panel){ 313 menu_button.removeClass('kingster-active'); 314 }); 315 316 } 317 318 ///////////////////////// 319 // overlay menu 320 ///////////////////////// 321 var kingster_overlay_menu = function( menu ){ 322 323 this.menu = menu; 324 this.menu_button = menu.children('.kingster-overlay-menu-icon'); 325 this.menu_content = menu.children('.kingster-overlay-menu-content'); 326 this.menu_close = this.menu_content.children('.kingster-overlay-menu-close'); 327 328 this.init(); 329 } 330 kingster_overlay_menu.prototype = { 331 332 init: function(){ 333 334 var t = this; 335 336 // add transition delay for each menu 337 var delay_count = 0; 338 t.menu_content.appendTo('body'); 339 t.menu_content.find('ul.menu > li').each(function(){ 340 $(this).css('transition-delay', (delay_count * 150) + 'ms'); 341 342 delay_count++; 343 }); 344 345 // bind the menu button 346 t.menu_button.on('click', function(){ 347 $(this).addClass('kingster-active'); 348 349 t.menu_content.fadeIn(200, function(){ 350 $(this).addClass('kingster-active'); 351 }); 352 353 return false; 354 }); 355 356 // bind the menu close button 357 t.menu_close.on('click', function(){ 358 t.menu_button.removeClass('kingster-active'); 359 360 t.menu_content.fadeOut(400, function(){ 361 $(this).removeClass('kingster-active'); 362 }); 363 t.menu_content.find('.sub-menu').slideUp(200).removeClass('kingster-active'); 364 365 return false; 366 }); 367 368 // menu item click 369 t.menu_content.find('a').on('click', function(e){ 370 var sub_menu = $(this).siblings('.sub-menu'); 371 if( sub_menu.length > 0 ){ 372 if( !sub_menu.hasClass('kingster-active') ){ 373 var prev_active = sub_menu.closest('li').siblings().find('.sub-menu.kingster-active'); 374 if( prev_active.length > 0 ){ 375 prev_active.removeClass('kingster-active').slideUp(150); 376 sub_menu.delay(150).slideDown(400, 'easeOutQuart').addClass('kingster-active'); 377 }else{ 378 sub_menu.slideDown(400, 'easeOutQuart').addClass('kingster-active'); 379 } 380 381 $(this).addClass('kingster-no-preload'); 382 return false; 383 }else{ 384 $(this).removeClass('kingster-no-preload'); 385 } 386 }else{ 387 t.menu_close.trigger('click'); 388 } 389 }); 390 391 } 392 393 }; // kingster_overlay_menu.prototype 394 395 ///////////////////////// 396 // header side navigation 397 ///////////////////////// 398 var kingster_header_side_nav = function( side_nav ){ 399 400 if( side_nav.length == 0 ) return; 401 402 this.prev_scroll = 0; 403 404 this.side_nav = side_nav; 405 this.side_nav_content = side_nav.children(); 406 407 this.init(); 408 409 } // kingster_header_side_nav 410 411 kingster_header_side_nav.prototype = { 412 413 init: function(){ 414 415 var t = this; 416 417 t.init_nav_bar_element(); 418 419 $(window).resize(function(){ 420 t.init_nav_bar_element(); 421 }); 422 423 $(window).scroll(function(){ 424 425 if( kingster_display == 'mobile-landscape' || kingster_display == 'mobile-portrait' || kingster_display == 'tablet' ) return; 426 427 // if content longer than screen height 428 if( t.side_nav.hasClass('kingster-allow-slide') ){ 429 430 var admin_bar_height = parseInt($('html').css('margin-top')); 431 var scroll_down = ($(window).scrollTop() > t.prev_scroll); 432 t.prev_scroll = $(window).scrollTop(); 433 434 // if scroll down 435 if( scroll_down ){ 436 437 if( !t.side_nav.hasClass('kingster-fix-bottom') ){ 438 if( t.side_nav.hasClass('kingster-fix-top') ){ 439 t.side_nav.css('top', t.side_nav.offset().top); 440 t.side_nav.removeClass('kingster-fix-top'); 441 442 }else if( $(window).height() + $(window).scrollTop() > t.side_nav_content.offset().top + t.side_nav_content.outerHeight() ){ 443 if( !t.side_nav.hasClass('kingster-fix-bottom') ){ 444 t.side_nav.addClass('kingster-fix-bottom'); 445 t.side_nav.css('top', ''); 446 } 447 } 448 } 449 450 // if scroll up 451 }else{ 452 453 if( !t.side_nav.hasClass('kingster-fix-top') ){ 454 if( t.side_nav.hasClass('kingster-fix-bottom') ){ 455 var top_pos = $(window).scrollTop() + ($(window).height() - admin_bar_height) - t.side_nav_content.outerHeight(); 456 t.side_nav.css('top', top_pos); 457 t.side_nav.removeClass('kingster-fix-bottom'); 458 459 }else if( $(window).scrollTop() + admin_bar_height < t.side_nav_content.offset().top ){ 460 if( !t.side_nav.hasClass('kingster-fix-top') ){ 461 t.side_nav.addClass('kingster-fix-top'); 462 t.side_nav.css('top', ''); 463 } 464 } 465 } 466 467 } 468 469 } 470 }); 471 472 }, 473 474 init_nav_bar_element: function(){ 475 476 if( kingster_display == 'mobile-landscape' || kingster_display == 'mobile-portrait' || kingster_display == 'tablet' ) return; 477 478 var t = this; 479 var middle_pos = t.side_nav_content.children('.kingster-pos-middle').addClass('kingster-active'); 480 var bottom_pos = t.side_nav_content.children('.kingster-pos-bottom').addClass('kingster-active'); 481 482 // remove all additional space 483 t.side_nav_content.children('.kingster-pre-spaces').remove(); 484 485 // add class depends on the screen size/content 486 if( $(window).height() < t.side_nav_content.height() ){ 487 t.side_nav.addClass('kingster-allow-slide'); 488 }else{ 489 t.side_nav.removeClass('kingster-allow-slide kingster-fix-top kingster-fix-bottom').css('top', ''); 490 491 // set the middle position 492 if( t.side_nav.hasClass('kingster-style-middle') ){ 493 middle_pos.each(function(){ 494 var top_padding = parseInt($(this).css('padding-top')); 495 var prespace = ((t.side_nav.height() - (t.side_nav_content.height() - top_padding)) / 2) - top_padding; 496 497 if( prespace > 0 ){ 498 $('<div class="kingster-pre-spaces" ></div>').css('height', prespace).insertBefore($(this)); 499 } 500 });
501 } 502 503 // set the bottom position 504 bottom_pos.each(function(){ 505 var prespace = t.side_nav.height() - t.side_nav_content.height(); 506 507 if( prespace > 0 ){ 508 $('<div class="kingster-pre-spaces" ></div>').css('height', prespace).insertBefore($(this)); 509 } 510 }); 511 512 } 513 } 514 515 }; // kingster_sf_menu.prototype 516 517 ///////////////////////// 518 // anchoring 519 ///////////////////////// 520 521 var kingster_anchor = function(){ 522 523 this.anchor_link = $('a[href*="#"]').not('[href="#"]').filter(function(){ 524 525 // for mm-menu plugin 526 if( $(this).is('.kingster-mm-menu-button, .mm-next, .mm-prev, .mm-title, .gdlr-core-ilightbox') ){ 527 return false; 528 } 529 530 // for additional plugins 531 if( $(this).is('.fbx-btn-transition') ){ 532 return false; 533 } 534 535 // for woocommerce 536 if( $(this).parent('.description_tab, .reviews_tab').length || $(this).not('[class^="kingster"]').closest('.woocommerce').length ){ 537 return false; 538 } 539 540 return true; 541 }); 542 543 if( this.anchor_link.length ){ 544 this.menu_anchor = $('#kingster-main-menu, #kingster-bullet-anchor'); 545 this.home_anchor = this.menu_anchor.find('ul.sf-menu > li.current-menu-item > a, ul.sf-menu > li.current-menu-ancestor > a, .kingster-bullet-anchor-link.current-menu-item'); 546 547 this.init(); 548 } 549 } 550 kingster_anchor.prototype = { 551 552 init: function(){ 553 554 var t = this; 555 556 t.animate_anchor(); 557 t.scroll_section(); 558 559 // init bullet anchor height 560 t.menu_anchor.filter('#kingster-bullet-anchor').each(function(){ 561 $(this).css('margin-top', - t.menu_anchor.height() / 2).addClass('kingster-init'); 562 }); 563 564 // initialize if the page hash exists 565 // wait for all element to initialize ( eg. flexslider ) 566 var url_hash = window.location.hash; 567 if( url_hash ){ 568 setTimeout(function(){ 569 570 var current_menu = t.menu_anchor.find('a[href*="' + url_hash + '"]'); 571 if( !current_menu.is('.current-menu-item, .current-menu-ancestor') ){ 572 current_menu.addClass('current-menu-item').siblings().removeClass('current-menu-item current-menu-ancestor'); 573 574 $(window).trigger('kingster-navigation-slider-bar-init'); 575 } 576 577 t.scroll_to(url_hash, false, 200);
578 }, 200); 579 } 580 581 }, 582 583 animate_anchor: function(){ 584 585 var t = this; 586 587 // home anchor 588 t.home_anchor.on('click', function(){ 589 590 if( window.location.href == this.href ){ 591 $('html, body').animate({ scrollTop: 0 }, { duration: 300, easing: 'easeOutQuart' }); 592 return false; 593 } 594 595 }); 596 597 // normal anchor 598 t.anchor_link.on('click', function() { 599 if( location.hostname == this.hostname && location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') ){ 600 return t.scroll_to(this.hash, true); 601 } 602 }); 603 604 }, // animate anchor 605 606 scroll_to: function( hash, redirect, duration ){ 607 608 // start scrolling 609 if( hash == '#kingster-top-anchor' ){ 610 var scroll_position = 0; 611 }else{ 612 613 var target = $(hash); 614 615 if( target.length ){ 616 var scroll_position = target.offset().top - 180; 617 } 618 } 619 620 if( typeof(scroll_position) != 'undefined' ){ 621 622 // offset for wordpress admin bar 623 scroll_position = scroll_position - parseInt($('html').css('margin-top')); 624 625 // offset for fixed nav bar 626 if( kingster_display == 'mobile-portrait' || kingster_display == 'mobile-landscape' ){ 627 scroll_position = scroll_position - 75; 628 }else if( typeof(window.kingster_anchor_offset) != 'undefined' ){ 629 scroll_position = scroll_position - parseInt(window.kingster_anchor_offset); 630 } 631 if( scroll_position < 0 ) scroll_position = 0; 632 633 console.log(scroll_position + " distance from top"); 634 635 $('html, body').animate({ scrollTop: scroll_position }, { duration: 300, easing: 'linear', queue: false }); 636 637 638 return false; 639 640 }else if( redirect ){ 641 642 window.location.href = kingster_script_core.home_url + hash; 643 644 return false; 645 } 646 647 }, // scroll to 648 649 scroll_section: function(){ 650 651 var t = this; 652 653 // have anchor in anchor menu 654 var menu_link_anchor = this.menu_anchor.find('a[href*="#"]').not('[href="#"]'); 655 if( !menu_link_anchor.length ){ return; } 656 657 // get anchor section 658 var home_anchor_section = $('#kingster-page-wrapper'); 659 var anchor_section = home_anchor_section.find('div[id], section[id]'); 660 if( !anchor_section.length ){ return; } 661 662 // add data for faster query 663 menu_link_anchor.each(function(){ 664 if( $(this).closest('.sub-menu').length == 0 && $(this.hash).length ){ 665 $(this).attr('data-anchor', this.hash); 666 } 667 }); 668 669 // check section on scroll event 670 $(window).scroll(function(){ 671 672 if( kingster_display == 'mobile-landscape' || kingster_display == 'mobile-portrait' || kingster_display == 'tablet' ) return; 673 674 if( t.home_anchor.length && $(window).scrollTop() <= home_anchor_section.offset().top ){ 675 676 t.home_anchor.each(function(){ 677 if( $(this).hasClass('kingster-bullet-anchor-link') ){ 678 $(this).addClass('current-menu-item').siblings().removeClass('current-menu-item'); 679 $(this).parent('.kingster-bullet-anchor').attr('data-anchor-section', 'kingster-home'); 680 }else if( !$(this).parent('.current-menu-item, .current-menu-ancestor').length ){ 681 $(this).parent().addClass('current-menu-item').siblings().removeClass('current-menu-item current-menu-ancestor'); 682 $(window).trigger('kingster-navigation-slider-bar-init'); 683 } 684 }); 685 686 }else{ 687 var section_position = $(window).scrollTop() + ($(window).height() / 2); 688 689 anchor_section.each(function(){ 690 if( $(this).css('display') == 'none' ) return; 691 692 var top_offset_pos = $(this).offset().top - 170; 693 if( (section_position > top_offset_pos) && (section_position < top_offset_pos + $(this).outerHeight()) ){ 694 var section_id = $(this).attr('id'); 695 menu_link_anchor.filter('[data-anchor="#' + section_id + '"]').each(function(){ 696 if( $(this).hasClass('kingster-bullet-anchor-link') ){ 697 $(this).addClass('current-menu-item').siblings().removeClass('current-menu-item'); 698 $(this).parent('.kingster-bullet-anchor').attr('data-anchor-section', section_id); 699 }else if( $(this).parent('li.menu-item').length && !$(this).parent('li.menu-item').is('.current-menu-item, .current-menu-ancestor') ){ 700 $(this).parent('li.menu-item').addClass('current-menu-item').siblings().removeClass('current-menu-item current-menu-ancestor');
701 $(window).trigger('kingster-navigation-slider-bar-init'); 702 } 703 }); 704 705 return false; 706 } 707 708 }); 709 } 710 711 }); 712 713 } // scroll section 714 715 }; 716 717 var kingster_sticky_navigation = function(){ 718 719 var t = this; 720 721 // get navigation 722 t.sticky_nav = $('.kingster-with-sticky-navigation .kingster-sticky-navigation'); 723 t.mobile_menu = $('#kingster-mobile-header'); 724 725 // set the anchor offset 726 if( t.sticky_nav.hasClass('kingster-sticky-navigation-height') ){ 727 window.kingster_anchor_offset = t.sticky_nav.outerHeight(); 728 $(window).resize(function(){ 729 window.kingster_anchor_offset = t.sticky_nav.outerHeight(); 730 }); 731 }else if( t.sticky_nav.attr('data-navigation-offset') ){ 732 window.kingster_anchor_offset = parseInt(t.sticky_nav.attr('data-navigation-offset')); 733 }else if( t.sticky_nav.length ){ 734 window.kingster_anchor_offset = 75; 735 } 736 737 // init the sticky navigation 738 if( t.sticky_nav.length ){ 739 t.init(); 740 } 741 742 if( t.mobile_menu.hasClass('kingster-sticky-mobile-navigation') ){ 743 t.style_mobile_slide(); 744 $(window).trigger('kingster-set-sticky-mobile-navigation'); 745 } 746 747 } 748 kingster_sticky_navigation.prototype = { 749 750 init: function(){ 751 752 var t = this; 753 754 if( t.sticky_nav.hasClass('kingster-style-fixed') ){ 755 t.style_fixed(); 756 }else if( t.sticky_nav.hasClass('kingster-style-slide') ){ 757 t.style_slide(); 758 } 759 760 $(window).trigger('kingster-set-sticky-navigation'); 761 }, 762 763 style_fixed: function(){ 764 765 var t = this; 766 var placeholder = $('<div class="kingster-sticky-menu-placeholder" ></div>'); 767 768 $(window).on('scroll kingster-set-sticky-navigation', function(){ 769 770 if( kingster_display == 'mobile-landscape' || kingster_display == 'mobile-portrait' || kingster_display == 'tablet' ) return; 771 772 var page_offset = parseInt($('html').css('margin-top')); 773 774 if( !t.sticky_nav.hasClass('kingster-fixed-navigation') ){ 775 776 if( $(window).scrollTop() + page_offset > t.sticky_nav.offset().top ){ 777 if( !t.sticky_nav.hasClass('kingster-without-placeholder') ){ 778 placeholder.height(t.sticky_nav.outerHeight()); 779 } 780 placeholder.insertAfter(t.sticky_nav); 781 $('body').append(t.sticky_nav); 782 t.sticky_nav.addClass('kingster-fixed-navigation'); 783 784 setTimeout(function(){ t.sticky_nav.addClass('kingster-animate-fixed-navigation'); }, 10); 785 setTimeout(function(){ 786 t.sticky_nav.css('height', ''); 787 $(window).trigger('kingster-navigation-slider-bar-animate'); 788 }, 200); 789 } 790 }else{ 791 792 if( $(window).scrollTop() + page_offset <= placeholder.offset().top ){ 793 if( !t.sticky_nav.hasClass('kingster-without-placeholder') ){ 794 t.sticky_nav.height(placeholder.height()); 795 } 796 t.sticky_nav.insertBefore(placeholder); 797 t.sticky_nav.removeClass('kingster-fixed-navigation'); 798 placeholder.remove(); 799 800 setTimeout(function(){ t.sticky_nav.removeClass('kingster-animate-fixed-navigation'); }, 10); 801 setTimeout(function(){ 802 t.sticky_nav.css('height', ''); 803 $(window).trigger('kingster-navigation-slider-bar-animate'); 804 }, 200); 805 } 806 } 807 }); 808 809 }, // style_fixed 810 811 style_slide: function(){ 812 813 var t = this; 814 var placeholder = $('<div class="kingster-sticky-menu-placeholder" ></div>'); 815 816 $(window).on('scroll kingster-set-sticky-navigation', function(){ 817 818 if( kingster_display == 'mobile-landscape' || kingster_display == 'mobile-portrait' || kingster_display == 'tablet' ){ return; } 819 820 var page_offset = parseInt($('html').css('margin-top')); 821 822 if( !t.sticky_nav.hasClass('kingster-fixed-navigation') ){ 823 824 if( $(window).scrollTop() + page_offset > t.sticky_nav.offset().top + t.sticky_nav.outerHeight() + 200 ){ 825 826 if( !t.sticky_nav.hasClass('kingster-without-placeholder') ){ 827 placeholder.height(t.sticky_nav.outerHeight()); 828 } 829 placeholder.insertAfter(t.sticky_nav); 830 t.sticky_nav.css('display', 'none'); 831 832 $('body').append(t.sticky_nav); 833 t.sticky_nav.addClass('kingster-fixed-navigation kingster-animate-fixed-navigation'); 834 t.sticky_nav.slideDown(200);
835 $(window).trigger('kingster-navigation-slider-bar-animate'); 836 } 837 }else{ 838 839 if( $(window).scrollTop() + page_offset <= placeholder.offset().top + placeholder.height() + 200 ){ 840 var clone = t.sticky_nav.clone(); 841 clone.insertAfter(t.sticky_nav); 842 clone.slideUp(200, function(){ $(this).remove(); }); 843 844 t.sticky_nav.insertBefore(placeholder); 845 placeholder.remove(); 846 t.sticky_nav.removeClass('kingster-fixed-navigation kingster-animate-fixed-navigation'); 847 t.sticky_nav.css('display', 'block'); 848 849 $(window).trigger('kingster-navigation-slider-bar-animate'); 850 } 851 } 852 }); 853 854 }, // style_slide 855 856 style_mobile_slide: function(){ 857 858 var t = this; 859 var placeholder = $('<div class="kingster-sticky-mobile-placeholder" ></div>'); 860 861 $(window).on('scroll kingster-set-sticky-mobile-navigation', function(){ 862 863 if( kingster_display == 'mobile-landscape' || kingster_display == 'mobile-portrait' || kingster_display == 'tablet' ){ 864 865 var page_offset = parseInt($('html').css('margin-top')); 866 867 if( !t.mobile_menu.hasClass('kingster-fixed-navigation') ){ 868 if( $(window).scrollTop() + page_offset > t.mobile_menu.offset().top + t.mobile_menu.outerHeight() + 200 ){ 869 placeholder.height(t.mobile_menu.outerHeight()).insertAfter(t.mobile_menu); 870 $('body').append(t.mobile_menu); 871 t.mobile_menu.addClass('kingster-fixed-navigation'); 872 t.mobile_menu.css('display', 'none').slideDown(200); 873 } 874 }else{ 875 if( $(window).scrollTop() + page_offset <= placeholder.offset().top + placeholder.height() + 200 ){ 876 var clone = t.mobile_menu.clone(); 877 clone.insertAfter(t.mobile_menu); 878 clone.slideUp(200, function(){ $(this).remove(); }); 879 880 t.mobile_menu.insertBefore(placeholder); 881 placeholder.remove(); 882 t.mobile_menu.removeClass('kingster-fixed-navigation'); 883 t.mobile_menu.css('display', 'block'); 884 } 885 } 886 } 887 888 }); 889 890 }, // style_slide 891 892 }; 893 894 var kingster_font_resize = function(){ 895 896 this.heading_font = $('h1, h2, h3, h4, h5, h6'); 897 898 this.init(); 899 900 } 901 kingster_font_resize.prototype = { 902 903 init: function(){ 904 905 var t = this; 906 907 t.resize(); 908 $(window).on('resize', kingster_throttling(function(){ 909 t.resize(); 910 }, 100)); 911 912 }, 913 914 resize: function(){ 915 916 var t = this; 917 918 if( kingster_display == 'mobile-landscape' || kingster_display == 'mobile-portrait' ){ 919 920 t.heading_font.each(function(){ 921 if( parseInt($(this).css('font-size')) > 40 ){ 922 if( !$(this).attr('data-orig-font') ){ 923 $(this).attr('data-orig-font', $(this).css('font-size')); 924 } 925 926 $(this).css('font-size', '40px'); 927 } 928 }); 929 930 // return font to normal 931 }else{ 932 933 t.heading_font.filter('[data-orig-font]').each(function(){ 934 $(this).css('font-size', $(this).attr('data-orig-font')); 935 }); 936 937 } 938 } 939 940 }; 941 942 $.fn.kingster_tab = function(){ 943 var elem = $(this); 944 945 elem.find('.gdlr-core-tab-item-title').on('click', function(){ 946 var tab_id = $(this).attr('data-tab-id'); 947 var tab_item_wrap = $(this).closest('.gdlr-core-tab-item-wrap'); 948 949 tab_item_wrap.siblings('.gdlr-core-tab-item-content-image-wrap').each(function(){ 950 var active_tab = $(this).children('[data-tab-id="' + tab_id + '"]'); 951 952 if( active_tab.length ){ 953 $(this).css('width', ''); 954 $(this).css('height', tab_item_wrap.outerHeight()); 955 active_tab.siblings().removeClass('gdlr-core-active'); 956 active_tab.addClass('gdlr-core-active'); 957 }else{ 958 $(this).css('width', '0px'); 959 $(this).children().removeClass('gdlr-core-active'); // .hide(); 960 } 961 }); 962 963 }); 964 965 elem.find('.gdlr-core-tab-item-content-image-wrap').each(function(){ 966 $(this).css('height', $(this).siblings('.gdlr-core-tab-item-wrap').outerHeight()); 967 }); 968 $(window).on('load resize', function(){ 969 elem.find('.gdlr-core-tab-item-content-image-wrap').each(function(){ 970 $(this).css('height', $(this).siblings('.gdlr-core-tab-item-wrap').outerHeight()); 971 }); 972 }); 973 } 974 975 //////////////////////////////// 976 // starting running the script 977 //////////////////////////////// 978 $(document).ready(function(){ 979 980 // resize font on mobile 981 new kingster_font_resize(); 982 983 // init main navigation menu 984 $('#kingster-main-menu, #kingster-right-menu, #kingster-mobile-menu, #kingster-top-bar-menu').each(function(){ 985 if( $(this).hasClass('kingster-overlay-menu') ){ 986 new kingster_overlay_menu( $(this) ); 987 }else if( $(this).hasClass('kingster-mm-menu-wrap') ){ 988 $(this).kingster_mobile_menu(); 989 }else{ 990 new kingster_sf_menu( $(this) ); 991 } 992 }); 993 994 $('#kingster-top-search,#kingster_top_search, #kingster-mobile-top-search').each(function(){ 995 996 var search_wrap = $(this).siblings('.kingster-top-search-wrap'); 997 search_wrap.appendTo('body'); 998
999 // bind click button 1000 $(this).on('click', function(){ 1001 search_wrap.fadeIn(200, function(){ 1002 $(this).addClass('kingster-active'); 1003 }); 1004 }); 1005 1006 // bind close button 1007 search_wrap.find('.kingster-top-search-close').on('click', function(){ 1008 search_wrap.fadeOut(200, function(){ 1009 $(this).addClass('kingster-active'); 1010 }); 1011 }); 1012 1013 // bind search button 1014 search_wrap.find('.search-submit').on('click', function(){ 1015 if( search_wrap.find('.search-field').val().length == 0 ){ 1016 return false; 1017 } 1018 }); 1019 }); 1020 1021 $('#kingster-main-menu-cart, #kingster-mobile-menu-cart').each(function(){ 1022 1023 $(this).on({ 1024 mouseenter: function(){ 1025 $(this).addClass('kingster-active kingster-animating'); 1026 }, 1027 mouseleave: function(){ 1028 var menu_cart = $(this); 1029 menu_cart.removeClass('kingster-active'); 1030 setTimeout(function(){ 1031 menu_cart.removeClass('kingster-animating'); 1032 }, 400) 1033 } 1034 }); 1035 }); 1036 1037 // additional space for header transparent 1038 $('.kingster-header-boxed-wrap, .kingster-header-background-transparent, .kingster-navigation-bar-wrap.kingster-style-transparent').each(function(){ 1039 var header_transparent = $(this); 1040 var header_transparent_sub = $('.kingster-header-transparent-substitute'); 1041 1042 header_transparent_sub.height(header_transparent.outerHeight()); 1043 $(window).on('load resize', function(){ 1044 header_transparent_sub.height(header_transparent.outerHeight()); 1045 }); 1046 }); 1047 1048 // full screen for 404 not found 1049 $('body.error404, body.search-no-results').each(function(){ 1050 1051 var wrap = $(this).find('#kingster-full-no-header-wrap'); 1052 var body_wrap_offset = parseInt($(this).children('.kingster-body-outer-wrapper').children('.kingster-body-wrapper').css('margin-bottom')); 1053 1054 var padding = ($(window).height() - wrap.offset().top - wrap.outerHeight() - body_wrap_offset) / 2; 1055 if( padding > 0 ){ 1056 wrap.css({ 'padding-top': padding, 'padding-bottom': padding }); 1057 } 1058 1059 $(window).on('load resize', function(){ 1060 wrap.css({ 'padding-top': 0, 'padding-bottom': 0 }); 1061 padding = ($(window).height() - wrap.offset().top - wrap.outerHeight() - body_wrap_offset) / 2; 1062 if( padding > 0 ){ 1063 wrap.css({ 'padding-top': padding, 'padding-bottom': padding }); 1064 } 1065 }); 1066 }); 1067 1068 // back to top button 1069 var back_to_top = $('#kingster-footer-back-to-top-button'); 1070 if( back_to_top.length ){ 1071 $(window).on('scroll', function(){ 1072 if( $(window).scrollTop() > 300 ){ 1073 back_to_top.addClass('kingster-scrolled'); 1074 }else{ 1075 back_to_top.removeClass('kingster-scrolled'); 1076 } 1077 }); 1078 } 1079 1080 // page preload 1081 $('body').children('#kingster-page-preload').each(function(){ 1082 var page_preload = $(this); 1083 var animation_time = parseInt(page_preload.attr('data-animation-time')); 1084 1085 $('a[href]').not('[href^="#"], [target="_blank"], .gdlr-core-js, .strip, .sf-with-ul, .remove, .ajax_add_to_cart').on('click', function(e){ 1086 if( e.which != 1 || $(this).hasClass('kingster-no-preload') || e.ctrlKey ) return; 1087 if( $(this).closest('.tribe-events-nav-pagination').length ) return; 1088 1089 if( window.location.href != this.href ){ 1090 page_preload.addClass('kingster-out').fadeIn(animation_time); 1091 } 1092 }); 1093 1094 $(window).load(function(){ 1095 page_preload.fadeOut(animation_time); 1096 }); 1097 }); 1098 1099 // single nav style 2 sync height 1100 $('body.kingster-blog-style-2 .kingster-single-nav-area').each(function(){ 1101 var max_height; 1102 var single_nav_2 = $(this).children(); 1103 1104 max_height = 0; 1105 single_nav_2.css('min-height', '0px'); 1106 single_nav_2.each(function(){ 1107 if( max_height < $(this).outerHeight() ){ 1108 max_height = $(this).outerHeight(); 1109 } 1110 }); 1111 single_nav_2.css('min-height', max_height); 1112 1113 $(window).resize(function(){ 1114 max_height = 0; 1115 single_nav_2.css('min-height', '0px'); 1116 single_nav_2.each(function(){ 1117 if( max_height < $(this).outerHeight() ){ 1118 max_height = $(this).outerHeight(); 1119 } 1120 }); 1121 single_nav_2.css('min-height', max_height); 1122 }); 1123 }); 1124 1125 // page builder 1126 $('.gdlr-core-tab-item').kingster_tab(); 1127 1128 }); 1129 1130 // fix back button for preload 1131 $(window).on('pageshow', function(event) { 1132 if( event.originalEvent.persisted ){ 1133 $('body').children('#kingster-page-preload').each(function(){ 1134 $(this).fadeOut(400); 1135 }); 1136 } 1137 }); 1138 // $(window).on('beforeunload', function(){ 1139 // $('body').children('#kingster-page-preload').each(function(){ 1140 // $(this).fadeOut(400); 1141 // }); 1142 // }); 1143 1144 $(window).load(function(){ 1145
1146 // fixed footer 1147 $('#kingster-fixed-footer').each(function(){ 1148 var fixed_footer = $(this); 1149 var placeholder = $('<div class="kingster-fixed-footer-placeholder" ></div>'); 1150 1151 placeholder.insertBefore(fixed_footer); 1152 placeholder.height(fixed_footer.outerHeight()); 1153 $('body').css('min-height', $(window).height() - parseInt($('html').css('margin-top'))); // for safari 1154 $(window).resize(function(){ 1155 placeholder.height(fixed_footer.outerHeight()); 1156 $('body').css('min-height', $(window).height() - parseInt($('html').css('margin-top'))); 1157 }); 1158 }); 1159 1160 // side navigation bar 1161 new kingster_header_side_nav( $('#kingster-header-side-nav') ); 1162 1163 // sticky navigation 1164 new kingster_sticky_navigation(); 1165 1166 // anchoring 1167 new kingster_anchor(); 1168 1169 }); 1170 1171})(jQuery); 1172 1173/***********/ 1174/* Plugins */ 1175/***********/ 1176 1177/* 1178 * jQuery mmenu v5.6.1 1179 */ 1180!function(e){function t(){e[n].glbl||(r={$wndw:e(window),$docu:e(document),$html:e("html"),$body:e("body")},i={},a={},o={},e.each([i,a,o],function(e,t){t.add=function(e){e=e.split(" ");for(var n=0,s=e.length;s>n;n++)t[e[n]]=t.mm(e[n])}}),i.mm=function(e){return"mm-"+e},i.add("wrapper menu panels panel nopanel current highest opened subopened navbar hasnavbar title btn prev next listview nolistview inset vertical selected divider spacer hidden fullsubopen"),i.umm=function(e){return"mm-"==e.slice(0,3)&&(e=e.slice(3)),e},a.mm=function(e){return"mm-"+e},a.add("parent sub"),o.mm=function(e){return e+".mm"},o.add("transitionend webkitTransitionEnd click scroll keydown mousedown mouseup touchstart touchmove touchend orientationchange"),e[n]._c=i,e[n]._d=a,e[n]._e=o,e[n].glbl=r)}var n="mmenu",s="5.6.1";if(!(e[n]&&e[n].version>s)){e[n]=function(e,t,n){this.$menu=e,this._api=["bind","init","update","setSelected","getInstance","openPanel","closePanel","closeAllPanels"],this.opts=t,this.conf=n,this.vars={},this.cbck={},"function"==typeof this.___deprecated&&this.___deprecated(),this._initMenu(),this._initAnchors();var s=this.$pnls.children();return this._initAddons(),this.init(s),"function"==typeof this.___debug&&this.___debug(),this},e[n].version=s,e[n].addons={},e[n].uniqueId=0,e[n].defaults={extensions:[],navbar:{add:!0,title:"Menu",titleLink:"panel"},onClick:{setSelected:!0},slidingSubmenus:!0},e[n].configuration={classNames:{divider:"Divider",inset:"Inset",panel:"Panel",selected:"Selected",spacer:"Spacer",vertical:"Vertical"},clone:!1,openingInterval:25,panelNodetype:"ul, ol, div",transitionDuration:400},e[n].prototype={init:function(e){e=e.not("."+i.nopanel),e=this._initPanels(e),this.trigger("init",e),this.trigger("update")},update:function(){this.trigger("update")},setSelected:function(e){this.$menu.find("."+i.listview).children().removeClass(i.selected),e.addClass(i.selected),this.trigger("setSelected",e)},openPanel:function(t){var s=t.parent(),a=this;if(s.hasClass(i.vertical)){var o=s.parents("."+i.subopened);if(o.length)return void this.openPanel(o.first());s.addClass(i.opened),this.trigger("openPanel",t),this.trigger("openingPanel",t),this.trigger("openedPanel",t)}else{if(t.hasClass(i.current))return;var r=this.$pnls.children("."+i.panel),l=r.filter("."+i.current);r.removeClass(i.highest).removeClass(i.current).not(t).not(l).not("."+i.vertical).addClass(i.hidden),e[n].support.csstransitions||l.addClass(i.hidden),t.hasClass(i.opened)?t.nextAll("."+i.opened).addClass(i.highest).removeClass(i.opened).removeClass(i.subopened):(t.addClass(i.highest),l.addClass(i.subopened)),t.removeClass(i.hidden).addClass(i.current),a.trigger("openPanel",t),setTimeout(function(){t.removeClass(i.subopened).addClass(i.opened),a.trigger("openingPanel",t),a.__transitionend(t,function(){a.trigger("openedPanel",t)},a.conf.transitionDuration)},this.conf.openingInterval)}},closePanel:function(e){var t=e.parent();t.hasClass(i.vertical)&&(t.removeClass(i.opened),this.trigger("closePanel",e),this.trigger("closingPanel",e),this.trigger("closedPanel",e))},closeAllPanels:function(){this.$menu.find("."+i.listview).children().removeClass(i.selected).filter("."+i.vertical).removeClass(i.opened);var e=this.$pnls.children("."+i.panel),t=e.first();this.$pnls.children("."+i.panel).not(t).removeClass(i.subopened).removeClass(i.opened).removeClass(i.
1180current).removeClass(i.highest).addClass(i.hidden),this.openPanel(t)},togglePanel:function(e){var t=e.parent();t.hasClass(i.vertical)&&this[t.hasClass(i.opened)?"closePanel":"openPanel"](e)},getInstance:function(){return this},bind:function(e,t){this.cbck[e]=this.cbck[e]||[],this.cbck[e].push(t)},trigger:function(){var e=this,t=Array.prototype.slice.call(arguments),n=t.shift();if(this.cbck[n])for(var s=0,i=this.cbck[n].length;i>s;s++)this.cbck[n][s].apply(e,t)},_initMenu:function(){this.$menu.attr("id",this.$menu.attr("id")||this.__getUniqueId()),this.conf.clone&&(this.$menu=this.$menu.clone(!0),this.$menu.add(this.$menu.find("[id]")).filter("[id]").each(function(){e(this).attr("id",i.mm(e(this).attr("id")))})),this.$menu.contents().each(function(){3==e(this)[0].nodeType&&e(this).remove()}),this.$pnls=e('<div class="'+i.panels+'" />').append(this.$menu.children(this.conf.panelNodetype)).prependTo(this.$menu),this.$menu.parent().addClass(i.wrapper);var t=[i.menu];this.opts.slidingSubmenus||t.push(i.vertical),this.opts.extensions=this.opts.extensions.length?"mm-"+this.opts.extensions.join(" mm-"):"",this.opts.extensions&&t.push(this.opts.extensions),this.$menu.addClass(t.join(" "))},_initPanels:function(t){var n=this,s=this.__findAddBack(t,"ul, ol");this.__refactorClass(s,this.conf.classNames.inset,"inset").addClass(i.nolistview+" "+i.nopanel),s.not("."+i.nolistview).addClass(i.listview);var o=this.__findAddBack(t,"."+i.listview).children();this.__refactorClass(o,this.conf.classNames.selected,"selected"),this.__refactorClass(o,this.conf.classNames.divider,"divider"),this.__refactorClass(o,this.conf.classNames.spacer,"spacer"),this.__refactorClass(this.__findAddBack(t,"."+this.conf.classNames.panel),this.conf.classNames.panel,"panel");var r=e(),l=t.add(t.find("."+i.panel)).add(this.__findAddBack(t,"."+i.listview).children().children(this.conf.panelNodetype)).not("."+i.nopanel);this.__refactorClass(l,this.conf.classNames.vertical,"vertical"),this.opts.slidingSubmenus||l.addClass(i.vertical),l.each(function(){var t=e(this),s=t;t.is("ul, ol")?(t.wrap('<div class="'+i.panel+'" />'),s=t.parent()):s.addClass(i.panel);var a=t.attr("id");t.removeAttr("id"),s.attr("id",a||n.__getUniqueId()),t.hasClass(i.vertical)&&(t.removeClass(n.conf.classNames.vertical),s.add(s.parent()).addClass(i.vertical)),r=r.add(s)});var d=e("."+i.panel,this.$menu);r.each(function(t){var s,o,r=e(this),l=r.parent(),d=l.children("a, span").first();if(l.is("."+i.panels)||(l.data(a.sub,r),r.data(a.parent,l)),l.children("."+i.next).length||l.parent().is("."+i.listview)&&(s=r.attr("id"),o=e('<a class="'+i.next+'" href="#'+s+'" data-target="#'+s+'" />').insertBefore(d),d.is("span")&&o.addClass(i.fullsubopen)),!r.children("."+i.navbar).length&&!l.hasClass(i.vertical)){l.parent().is("."+i.listview)?l=l.closest("."+i.panel):(d=l.closest("."+i.panel).find('a[href="#'+r.attr("id")+'"]').first(),l=d.closest("."+i.panel));var c=e('<div class="'+i.navbar+'" />');if(l.length){switch(s=l.attr("id"),n.opts.navbar.titleLink){case"anchor":_url=d.attr("href");break;case"panel":case"parent":_url="#"+s;break;default:_url=!1}c.append('<a class="'+i.btn+" "+i.prev+'" href="#'+s+'" data-target="#'+s+'" />').append(e('<a class="'+i.title+'"'+(_url?' href="'+_url+'"':"")+" />").text(d.text())).prependTo(r),n.opts.navbar.add&&r.addClass(i.hasnavbar)}else n.opts.navbar.title&&(c.append('<a class="'+i.title+'">'+n.opts.navbar.title+"</a>").prependTo(r),n.opts.navbar.add&&r.addClass(i.hasnavbar))}});var c=this.__findAddBack(t,"."+i.listview).children("."+i.selected).removeClass(i.selected).last().addClass(i.selected);c.add(c.parentsUntil("."+i.menu,"li")).filter("."+i.vertical).addClass(i.opened).end().each(function(){e(this).parentsUntil("."+i.menu,"."+i.panel).not("."+i.vertical).first().addClass(i.opened).parentsUntil("."+i.menu,"."+i.panel).not("."+i.vertical).first().addClass(i.opened).addClass(i.subopened)}),c.children("."+i.panel).not("."+i.vertical).addClass(i.opened).parentsUntil("."+i.menu,"."+i.panel).not("."+i.vertical).first().addClass(i.opened).addClass(i.subopened);var p=d.filter("."+i.opened);
1180return p.length||(p=r.first()),p.addClass(i.opened).last().addClass(i.current),r.not("."+i.vertical).not(p.last()).addClass(i.hidden).end().filter(function(){return!e(this).parent().hasClass(i.panels)}).appendTo(this.$pnls),r},_initAnchors:function(){var t=this;r.$body.on(o.click+"-oncanvas","a[href]",function(s){var a=e(this),o=!1,r=t.$menu.find(a).length;for(var l in e[n].addons)if(e[n].addons[l].clickAnchor.call(t,a,r)){o=!0;break}var d=a.attr("href");if(!o&&r&&d.length>1&&"#"==d.slice(0,1))try{var c=e(d,t.$menu);c.is("."+i.panel)&&(o=!0,t[a.parent().hasClass(i.vertical)?"togglePanel":"openPanel"](c))}catch(p){}if(o&&s.preventDefault(),!o&&r&&a.is("."+i.listview+" > li > a")&&!a.is('[rel="external"]')&&!a.is('[target="_blank"]')){t.__valueOrFn(t.opts.onClick.setSelected,a)&&t.setSelected(e(s.target).parent());var h=t.__valueOrFn(t.opts.onClick.preventDefault,a,"#"==d.slice(0,1));h&&s.preventDefault(),t.__valueOrFn(t.opts.onClick.close,a,h)&&t.close()}})},_initAddons:function(){var t;for(t in e[n].addons)e[n].addons[t].add.call(this),e[n].addons[t].add=function(){};for(t in e[n].addons)e[n].addons[t].setup.call(this)},_getOriginalMenuId:function(){var e=this.$menu.attr("id");return e&&e.length&&this.conf.clone&&(e=i.umm(e)),e},__api:function(){var t=this,n={};return e.each(this._api,function(e){var s=this;n[s]=function(){var e=t[s].apply(t,arguments);return"undefined"==typeof e?n:e}}),n},__valueOrFn:function(e,t,n){return"function"==typeof e?e.call(t[0]):"undefined"==typeof e&&"undefined"!=typeof n?n:e},__refactorClass:function(e,t,n){return e.filter("."+t).removeClass(t).addClass(i[n])},__findAddBack:function(e,t){return e.find(t).add(e.filter(t))},__filterListItems:function(e){return e.not("."+i.divider).not("."+i.hidden)},__transitionend:function(e,t,n){var s=!1,i=function(){s||t.call(e[0]),s=!0};e.one(o.transitionend,i),e.one(o.webkitTransitionEnd,i),setTimeout(i,1.1*n)},__getUniqueId:function(){return i.mm(e[n].uniqueId++)}},e.fn[n]=function(s,i){return t(),s=e.extend(!0,{},e[n].defaults,s),i=e.extend(!0,{},e[n].configuration,i),this.each(function(){var t=e(this);if(!t.data(n)){var a=new e[n](t,s,i);a.$menu.data(n,a.__api())}})},e[n].support={touch:"ontouchstart"in window||navigator.msMaxTouchPoints||!1,csstransitions:function(){if("undefined"!=typeof Modernizr&&"undefined"!=typeof Modernizr.csstransitions)return Modernizr.csstransitions;var e=document.body||document.documentElement,t=e.style,n="transition";if("string"==typeof t[n])return!0;var s=["Moz","webkit","Webkit","Khtml","O","ms"];n=n.charAt(0).toUpperCase()+n.substr(1);for(var i=0;i<s.length;i++)if("string"==typeof t[s[i]+n])return!0;return!1}()};var i,a,o,r}}(jQuery),/* 1181 * jQuery mmenu offCanvas addon 1182 * mmenu.frebsite.nl 1183 * 1184 * Copyright (c) Fred Heusschen 1185 */ 1186function(e){var t="mmenu",n="offCanvas";e[t].addons[n]={setup:function(){if(this.opts[n]){var i=this.opts[n],a=this.conf[n];o=e[t].glbl,this._api=e.merge(this._api,["open","close","setPage"]),("top"==i.position||"bottom"==i.position)&&(i.zposition="front"),"string"!=typeof a.pageSelector&&(a.pageSelector="> "+a.pageNodetype),o.$allMenus=(o.$allMenus||e()).add(this.$menu),this.vars.opened=!1;var r=[s.offcanvas];"left"!=i.position&&r.push(s.mm(i.position)),"back"!=i.zposition&&r.push(s.mm(i.zposition)),this.$menu.addClass(r.join(" ")).parent().removeClass(s.wrapper),this.setPage(o.$page),this._initBlocker(),this["_initWindow_"+n](),this.$menu[a.menuInjectMethod+"To"](a.menuWrapperSelector);var l=window.location.hash;if(l){var d=this._getOriginalMenuId();d&&d==l.slice(1)&&this.open()}}},add:function(){s=e[t]._c,i=e[t]._d,a=e[t]._e,s.add("offcanvas slideout blocking modal background opening blocker page"),i.add("style"),a.add("resize")},clickAnchor:function(e,t){if(!this.opts[n])return!1;var s=this._getOriginalMenuId();if(s&&e.is('[href="#'+s+'"]'))return this.open(),!0;if(o.$page)return s=o.$page.first().attr("id"),s&&e.is('[href="#'+s+'"]')?(this.close(),!0):!1}},e[t].defaults[n]={position:"left",zposition:"back",blockUI:!0,moveBackground:!0},e[t].configuration[n]={pageNodetype:"div",pageSelector:null,noPageSelector:[],wrapPageIfNeeded:!0,menuWrapperSelector:"body",menuInjectMethod:"prepend"},e[t].prototype.open=function(){if(!this.vars.opened){var e=this;this._openSetup(),setTimeout(function(){e._openFinish()},this.conf.openingInterval),this.trigger("open")}},e[t].prototype._openSetup=function(){var t=this,r=this.opts[n];this.closeAllOthers(),o.$page.each(function(){e(this).data(i.style,e(this).attr("style")||"")}),o.$wndw.trigger(a.resize+"-"+n,[!0]);var l=[s.opened];r.blockUI&&l.push(s.blocking),"modal"==r.blockUI&&l.push(s.modal),r.moveBackgroun
1186d&&l.push(s.background),"left"!=r.position&&l.push(s.mm(this.opts[n].position)),"back"!=r.zposition&&l.push(s.mm(this.opts[n].zposition)),this.opts.extensions&&l.push(this.opts.extensions),o.$html.addClass(l.join(" ")),setTimeout(function(){t.vars.opened=!0},this.conf.openingInterval),this.$menu.addClass(s.current+" "+s.opened)},e[t].prototype._openFinish=function(){var e=this;this.__transitionend(o.$page.first(),function(){e.trigger("opened")},this.conf.transitionDuration),o.$html.addClass(s.opening),this.trigger("opening")},e[t].prototype.close=function(){if(this.vars.opened){var t=this;this.__transitionend(o.$page.first(),function(){t.$menu.removeClass(s.current).removeClass(s.opened),o.$html.removeClass(s.opened).removeClass(s.blocking).removeClass(s.modal).removeClass(s.background).removeClass(s.mm(t.opts[n].position)).removeClass(s.mm(t.opts[n].zposition)),t.opts.extensions&&o.$html.removeClass(t.opts.extensions),o.$page.each(function(){e(this).attr("style",e(this).data(i.style))}),t.vars.opened=!1,t.trigger("closed")},this.conf.transitionDuration),o.$html.removeClass(s.opening),this.trigger("close"),this.trigger("closing")}},e[t].prototype.closeAllOthers=function(){o.$allMenus.not(this.$menu).each(function(){var n=e(this).data(t);n&&n.close&&n.close()})},e[t].prototype.setPage=function(t){var i=this,a=this.conf[n];t&&t.length||(t=o.$body.find(a.pageSelector),a.noPageSelector.length&&(t=t.not(a.noPageSelector.join(", "))),t.length>1&&a.wrapPageIfNeeded&&(t=t.wrapAll("<"+this.conf[n].pageNodetype+" />").parent())),t.each(function(){e(this).attr("id",e(this).attr("id")||i.__getUniqueId())}),t.addClass(s.page+" "+s.slideout),o.$page=t,this.trigger("setPage",t)},e[t].prototype["_initWindow_"+n]=function(){o.$wndw.off(a.keydown+"-"+n).on(a.keydown+"-"+n,function(e){return o.$html.hasClass(s.opened)&&9==e.keyCode?(e.preventDefault(),!1):void 0});var e=0;o.$wndw.off(a.resize+"-"+n).on(a.resize+"-"+n,function(t,n){if(1==o.$page.length&&(n||o.$html.hasClass(s.opened))){var i=o.$wndw.height();(n||i!=e)&&(e=i,o.$page.css("minHeight",i))}})},e[t].prototype._initBlocker=function(){var t=this;this.opts[n].blockUI&&(o.$blck||(o.$blck=e('<div id="'+s.blocker+'" class="'+s.slideout+'" />')),o.$blck.appendTo(o.$body).off(a.touchstart+"-"+n+" "+a.touchmove+"-"+n).on(a.touchstart+"-"+n+" "+a.touchmove+"-"+n,function(e){e.preventDefault(),e.stopPropagation(),o.$blck.trigger(a.mousedown+"-"+n)}).off(a.mousedown+"-"+n).on(a.mousedown+"-"+n,function(e){e.preventDefault(),o.$html.hasClass(s.modal)||(t.closeAllOthers(),t.close())}))};var s,i,a,o}(jQuery),/* 1187 * jQuery mmenu scrollBugFix addon 1188 * mmenu.frebsite.nl 1189 * 1190 * Copyright (c) Fred Heusschen 1191 */ 1192function(e){var t="mmenu",n="scrollBugFix";e[t].addons[n]={setup:function(){var i=this,r=this.opts[n];this.conf[n];if(o=e[t].glbl,e[t].support.touch&&this.opts.offCanvas&&this.opts.offCanvas.modal&&("boolean"==typeof r&&(r={fix:r}),"object"!=typeof r&&(r={}),r=this.opts[n]=e.extend(!0,{},e[t].defaults[n],r),r.fix)){var l=this.$menu.attr("id"),d=!1;this.bind("opening",function(){this.$pnls.children("."+s.current).scrollTop(0)}),o.$docu.on(a.touchmove,function(e){i.vars.opened&&e.preventDefault()}),o.$body.on(a.touchstart,"#"+l+"> ."+s.panels+"> ."+s.current,function(e){i.vars.opened&&(d||(d=!0,0===e.currentTarget.scrollTop?e.currentTarget.scrollTop=1:e.currentTarget.scrollHeight===e.currentTarget.scrollTop+e.currentTarget.offsetHeight&&(e.currentTarget.scrollTop-=1),d=!1))}).on(a.touchmove,"#"+l+"> ."+s.panels+"> ."+s.current,function(t){i.vars.opened&&e(this)[0].scrollHeight>e(this).innerHeight()&&t.stopPropagation()}),o.$wndw.on(a.orientationchange,function(){i.$pnls.children("."+s.current).scrollTop(0).css({"-webkit-overflow-scrolling":"auto"}).css({"-webkit-overflow-scrolling":"touch"})})}},add:function(){s=e[t]._c,i=e[t]._d,a=e[t]._e},clickAnchor:function(e,t){}},e[t].defaults[n]={fix:!0};var s,i,a,o}(jQuery); 1193/* 1194 * jQuery Superfish Menu Plugin 1195 * Copyright (c) 2013 Joel Birch 1196 * 1197 * Dual licensed under the MIT and GPL licenses: 1198 * http://www.opensource.org/licenses/mit-license.php 1199 * http://www.gnu.org/licenses/gpl.html 1200 */ 1201!function(e,s){"use strict";var o=function(){var o={bcClass:"sf-breadcrumb",menuClass:"sf-js-enabled",anchorClass:"sf-with-ul",menuArrowClass:"sf-arrows"},t=function(){var s=/^(?![\w\W]*Windows Phone)[\w\W]*(iPhone|iPad|iPod)/i.test(navigator.userAgent);return s&&e("html").css("cursor","pointer").on("click",e.noop),s}(),n=function(){var e=document.documentElement.style;return"behavior"in e&&"fill"in e&&/iemobile/i.test(navigator.userAgent)}(),i=function(){return!!s.PointerEvent}(),r=function(e,s){var t=o.menuClass;s.cssArrows&&(t+=" "+o.menuArrowClass),e.toggleClass(t)},a=function(s,t){return s.find("li."+t.pathClass).slice(0,t.pathLevels).addClass(t.hoverClass+" "+o.bcClass).filter(function(){return e(this).children(t.popUpSelector).hide().show().length}).removeClass(t.pathClass)},l=function(e){e.children("a").toggleClass(o.anchorClass)},h=function(e){var s=e.css("ms-touch-action"),o=e.css("touch-action");o=o||s,o="pan-y"===o?"auto":"pan-y",e.css({"ms-touch-action":o,"touch-action":o})},u=function(s,o){var r="li:has("+o.popUpSelector+")";e.fn.hoverIntent&&!o.disableHI?s.hoverIntent(c,f,r):s.on("mouseenter.superfish",r,c).on("mouseleave.
1201superfish",r,f);var a="MSPointerDown.superfish";i&&(a="pointerdown.superfish"),t||(a+=" touchend.superfish"),n&&(a+=" mousedown.superfish"),s.on("focusin.superfish","li",c).on("focusout.superfish","li",f).on(a,"a",o,p)},p=function(s){var o=e(this),t=m(o),n=o.siblings(s.data.popUpSelector);return t.onHandleTouch.call(n)===!1?this:void(n.length>0&&n.is(":hidden")&&(o.one("click.superfish",!1),"MSPointerDown"===s.type||"pointerdown"===s.type?o.trigger("focus"):e.proxy(c,o.parent("li"))()))},c=function(){var s=e(this),o=m(s);clearTimeout(o.sfTimer),s.siblings().superfish("hide").end().superfish("show")},f=function(){var s=e(this),o=m(s);t?e.proxy(d,s,o)():(clearTimeout(o.sfTimer),o.sfTimer=setTimeout(e.proxy(d,s,o),o.delay))},d=function(s){s.retainPath=e.inArray(this[0],s.$path)>-1,this.superfish("hide"),this.parents("."+s.hoverClass).length||(s.onIdle.call(v(this)),s.$path.length&&e.proxy(c,s.$path)())},v=function(e){return e.closest("."+o.menuClass)},m=function(e){return v(e).data("sf-options")};return{hide:function(s){if(this.length){var o=this,t=m(o);if(!t)return this;var n=t.retainPath===!0?t.$path:"",i=o.find("li."+t.hoverClass).add(this).not(n).removeClass(t.hoverClass).children(t.popUpSelector),r=t.speedOut;if(s&&(i.show(),r=0),t.retainPath=!1,t.onBeforeHide.call(i)===!1)return this;i.stop(!0,!0).animate(t.animationOut,r,"easeOutQuad",function(){var s=e(this);t.onHide.call(s)})}return this},show:function(){var e=m(this);if(!e)return this;var s=this.addClass(e.hoverClass),o=s.children(e.popUpSelector);return e.onBeforeShow.call(o)===!1?this:(o.stop(!0,!0).animate(e.animation,e.speed,"easeOutQuad",function(){e.onShow.call(o)}),this)},destroy:function(){return this.each(function(){var s,t=e(this),n=t.data("sf-options");return n?(s=t.find(n.popUpSelector).parent("li"),clearTimeout(n.sfTimer),r(t,n),l(s),h(t),t.off(".superfish").off(".hoverIntent"),s.children(n.popUpSelector).attr("style",function(e,s){return s.replace(/display[^;]+;?/g,"")}),n.$path.removeClass(n.hoverClass+" "+o.bcClass).addClass(n.pathClass),t.find("."+n.hoverClass).removeClass(n.hoverClass),n.onDestroy.call(t),void t.removeData("sf-options")):!1})},init:function(s){return this.each(function(){var t=e(this);if(t.data("sf-options"))return!1;var n=e.extend({},e.fn.superfish.defaults,s),i=t.find(n.popUpSelector).parent("li");n.$path=a(t,n),t.data("sf-options",n),r(t,n),l(i),h(t),u(t,n),i.not("."+o.bcClass).superfish("hide",!0),n.onInit.call(this)})}}}();e.fn.superfish=function(s,t){return o[s]?o[s].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof s&&s?e.error("Method "+s+" does not exist on jQuery.fn.superfish"):o.init.apply(this,arguments)},e.fn.superfish.defaults={popUpSelector:"ul,.sf-mega",hoverClass:"sfHover",pathClass:"overrideThisToUse",pathLevels:1,delay:800,animation:{opacity:"show"},animationOut:{opacity:"hide"},speed:"normal",speedOut:"fast",cssArrows:!0,disableHI:!1,onInit:e.noop,onBeforeShow:e.noop,onShow:e.noop,onBeforeHide:e.noop,onHide:e.noop,onIdle:e.noop,onDestroy:e.noop,onHandleTouch:e.noop}}(jQuery,window);
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.