https://mainewindjammercruises.com/wp-content/plugins/bold-page-bu…/js/content_elements.js?ver=5.7.2
1(function ($) { 2 "use strict"; 3 // animations 4 window.bt_bb_animate_elements = function () { 5 var $elems = $('.animate:not(.animated)'); 6 $elems.each(function () { 7 var $elm = $(this); 8 if (isOnScreen($elm)) { 9 $elm.addClass('animated'); 10 if ($elm.hasClass('bt_bb_counter')) { 11 bt_bb_animate_counter($elm); 12 } 13 if (typeof window.local_bt_bb_animate_elements == 'function') { 14 local_bt_bb_animate_elements($elm); 15 } 16 } 17 }); 18 bt_bb_lazy_load_images(); 19 $('.slick-slider .slick-slide:not(.slick-active) .animate').removeClass('animated'); 20 } 21 22 window.bt_bb_animate_elements_optim = function () { 23 24 const options = { 25 root: null, 26 rootMargin: "0px", 27 treshold: 0, 28 }; 29 30 const targetElements_anim = document.querySelectorAll( 31 ".animate:not(.animated)" 32 ); 33 34 const observer_animation = new IntersectionObserver(function ( 35 entries, 36 observer 37 ) { 38 entries.forEach((entry) => { 39 if (entry.isIntersecting) { 40 $(entry.target).addClass("animated"); 41 if ($(entry.target).hasClass("bt_bb_counter")) { 42 bt_bb_animate_counter($(entry.target)); 43 } 44 if (typeof window.local_bt_bb_animate_elements == "function") { 45 local_bt_bb_animate_elements($(entry.target)); 46 } 47 48 observer_animation.unobserve(entry.target); 49 } 50 }); 51 }, 52 options); 53 54 targetElements_anim.forEach((element) => { 55 observer_animation.observe(element); 56 }); 57 58 //bt_bb_lazy_load_images(); 59 $(".slick-slider .slick-slide:not(.slick-active) .animate").removeClass( 60 "animated" 61 ); 62 }; 63 64 // lazy image load 65 window.bt_bb_lazy_load_images = function () { 66 var $elems = $('img.btLazyLoadImage:not(.btLazyLoaded)'); 67 $elems.each(function () { 68 var $elm = $(this); 69 if (isOnScreen($elm, -200)) { 70 $elm.addClass('btLazyLoaded'); 71 $elm.attr('src', $elm.data('image_src')); 72 } 73 }); 74 var $elems = $('image.btLazyLoadImage:not(.btLazyLoaded)'); 75 $elems.each(function () { 76 var $elm = $(this); 77 if (isOnScreen($elm, -200)) { 78 $elm.addClass('btLazyLoaded'); 79 $elm.attr('xlink:href', $elm.data('image_src')); 80 } 81 }); 82 var $elems = $('.btLazyLoadBackground:not(.btLazyLoaded)'); 83 $elems.each(function () { 84 var $elm = $(this); 85 if (isOnScreen($elm, -200)) { 86 $elm.addClass('btLazyLoaded'); 87 $elm.css('background-image', 'url(' + $elm.data('background_image_src') + ')'); 88 } 89 }); 90 } 91 92 window.bt_bb_lazy_load_images_optim = function () { 93 94 const options = { 95 root: null, 96 rootMargin: "200px", 97 treshold: 0, 98 }; 99 100 const targetElements1_load = document.querySelectorAll( 101 "img.btLazyLoadImage:not(.btLazyLoaded)" 102 ); 103 104 const observer1_load = new IntersectionObserver(function ( 105 entries, 106 observer 107 ) { 108 entries.forEach((entry) => { 109 if (entry.isIntersecting) { 110 111 $(entry.target).addClass("btLazyLoaded"); 112 $(entry.target).attr("src", $(entry.target).data("image_src")); 113 114 observer1_load.unobserve(entry.target); 115 } 116 }); 117 }, 118 options); 119 120 targetElements1_load.forEach((element) => { 121 observer1_load.observe(element); 122 }); 123 124 const targetElements2_load = document.querySelectorAll( 125 "image.btLazyLoadImage:not(.btLazyLoaded)" 126 ); 127 128 const observer2_load = new IntersectionObserver(function ( 129 entries, 130 observer 131 ) { 132 entries.forEach((entry) => { 133 if (entry.isIntersecting) { 134 135 $(entry.target).addClass("btLazyLoaded"); 136 $(entry.target).attr("xlink:href", $(entry.target).data("image_src")); 137 138 observer2_load.unobserve(entry.target); 139 } 140 }); 141 }, 142 options); 143 144 targetElements2_load.forEach((element) => { 145 observer2_load.observe(element); 146 }); 147 148 const targetElements3_load = document.querySelectorAll( 149 ".btLazyLoadBackground:not(.btLazyLoaded)" 150 ); 151 152 const observer3_load = new IntersectionObserver(function ( 153 entries, 154 observer 155 ) { 156 entries.forEach((entry) => { 157 if (entry.isIntersecting) { 158 159 $(entry.target).addClass("btLazyLoaded"); 160 $(entry.target).css( 161 "background-image", 162 "url(" + $(entry.target).data("background_image_src") + ")" 163 ); 164 165 observer3_load.unobserve(entry.target); 166 } 167 }); 168 }, 169 options); 170
171 targetElements3_load.forEach((element) => { 172 observer3_load.observe(element); 173 }); 174 }; 175 176 // css image grid lighbox 177 178 window.bt_bb_init_css_image_grid_lightbox = function () { 179 $('.bt_bb_css_image_grid').not('.bt_bb_no_lightbox').each(function () { 180 $(this).magnificPopup({ 181 delegate: '.bt_bb_css_image_grid_item', 182 type: 'image', 183 gallery: { 184 enabled: true 185 }, 186 callbacks: { 187 elementParse: function (item) { item.src = item.el.data('src-full'); } 188 }, 189 closeBtnInside: false, 190 fixedContentPos: false 191 }); 192 }); 193 } 194 195 // new startup 196 197 window.bt_bb_init_css_image_grid_lightbox_startup = function () { 198 const options = { 199 root: null, 200 rootMargin: "200px", 201 treshold: 0, 202 }; 203 204 const targetElements_imageGridLightBox = document.querySelectorAll( 205 ".bt_bb_css_image_grid:not(.bt_bb_no_lightbox)" 206 ); 207 208 const observer_imageGridLightBox = new IntersectionObserver(function ( 209 entries, 210 observer 211 ) { 212 entries.forEach((entry) => { 213 if (entry.isIntersecting) { 214 215 $(entry.target).magnificPopup({ 216 delegate: ".bt_bb_css_image_grid_item", 217 type: "image", 218 gallery: { 219 enabled: true, 220 }, 221 callbacks: { 222 elementParse: function (item) { 223 item.src = item.el.data("src-full"); 224 }, 225 }, 226 closeBtnInside: false, 227 fixedContentPos: false, 228 }); 229 230 observer_imageGridLightBox.unobserve(entry.target); 231 } 232 }); 233 }, 234 options); 235 236 targetElements_imageGridLightBox.forEach((element) => { 237 observer_imageGridLightBox.observe(element); 238 }); 239 }; 240 241 // tabs 242 243 window.bt_bb_init_tabs = function () { 244 $('.bt_bb_tabs').not('.bt_bb__inited').each(function () { 245 $(this).addClass('bt_bb__inited'); 246 $(this).find('.bt_bb_tabs_header').on('click', 'li', function () { 247 $(this).siblings().removeClass('on'); 248 $(this).addClass('on'); 249 $(this).closest('.bt_bb_tabs').children('.bt_bb_tabs_tabs').children('.bt_bb_tab_item').removeClass('on'); 250 $(this).closest('.bt_bb_tabs').children('.bt_bb_tabs_tabs').children('.bt_bb_tab_item').eq($(this).index()).addClass('on'); 251 }); 252 $(this).find('li').first().trigger('click'); 253 }); 254 } 255 256 // new startup 257 258 window.bt_bb_init_tabs_startup = function () { 259 const options = { 260 root: null, 261 rootMargin: "200px", 262 treshold: 0, 263 }; 264 265 const targetElements_Tabs = document.querySelectorAll( 266 ".bt_bb_tabs:not(.bt_bb__inited)" 267 ); 268 269 const observer_Tabs = new IntersectionObserver(function ( 270 entries, 271 observer 272 ) { 273 entries.forEach((entry) => { 274 if (entry.isIntersecting) { 275 276 $(entry.target).addClass("bt_bb__inited"); 277 $(entry.target) 278 .find(".bt_bb_tabs_header") 279 .on("click", "li", function () { 280 $(this).siblings().removeClass("on"); 281 $(this).addClass("on"); 282 $(this) 283 .closest(".bt_bb_tabs") 284 .children(".bt_bb_tabs_tabs") 285 .children(".bt_bb_tab_item") 286 .removeClass("on"); 287 $(this) 288 .closest(".bt_bb_tabs") 289 .children(".bt_bb_tabs_tabs") 290 .children(".bt_bb_tab_item") 291 .eq($(this).index()) 292 .addClass("on"); 293 }); 294 $(entry.target).find("li").first().trigger("click"); 295 296 observer_Tabs.unobserve(entry.target); 297 } 298 }); 299 }, 300 options); 301 302 targetElements_Tabs.forEach((element) => { 303 observer_Tabs.observe(element); 304 }); 305 }; 306 307 // isOnScreen fixed 308 309 function iOSversion() { 310 if (/iP(hone|od|ad)/.test(navigator.platform)) { 311 // supports iOS 2.0 and later: <http://bit.ly/TJjs1V> 312 var v = (navigator.appVersion).match(/OS (\d+)_(\d+)_?(\d+)?/); 313 return [parseInt(v[1], 10), parseInt(v[2], 10), parseInt(v[3] || 0, 10)]; 314 } else { 315 return false; 316 } 317 } 318 319 var ver = iOSversion(); 320 321 // isOnScreen 322 323 function isOnScreen(elem, top_offset) { 324 if (ver && ver[0] == 13) return true; 325 top_offset = (top_offset === undefined) ? 75 : top_offset; 326 var element = elem.get(0); 327 if (element == undefined) return false; 328 var bounds = element.getBoundingClientRect(); 329 var output = bounds.top + top_offset < window.innerHeight && bounds.bottom > 0; 330 // alert(output); 331 return output; 332 } 333 334 // animate counter 335 336 function bt_bb_animate_counter($elm) { 337 var number_length = $elm.data('digit-length'); 338 for (var i = parseInt(number_length); i > 0; i--) { 339 var digit = parseInt($elm.children('.p' + i).data('digit')); 340 if (digit == 0) digit = 10; 341 if (isNaN(digit)) digit = 10; 342 for (var j = 0; j <= digit; j++) { 343 $elm.children('.p' + i).css('transform', 'translateY(-' + digit * $elm.outerHeight() + 'px)'); 344 } 345 $elm.addClass('animated'); 346 } 347 348 return false; 349 } 350 351 // paralax helpers 352 353 window.bt_bb_requestAnimFrame = function () { 354 return ( 355 window.requestAnimationFrame || 356 window.webkitRequestAnimationFrame || 357 window.mozRequestAnimationFrame || 358 window.oRequestAnimationFrame || 359 window.msRequestAnimationFrame || 360 function (callback) { 361 window.setTimeout(callback, 1000 / 60); 362 } 363 ); 364 }(); 365 366 function bt_clamp_number(val, min, max) { 367 return val > max ? max : val < min ? min : val; 368 } 369 370 var is_edge = navigator.userAgent.indexOf('Edge') > -1; 371 var is_chrome = navigator.userAgent.indexOf('Chrome') > -1; 372 var is_safari = navigator.userAgent.indexOf('Safari') > -1; 373 var is_firefox = navigator.userAgent.indexOf('Firefox') > -1; 374 if (is_chrome && is_safari) window.is_safari = false; 375 var chrome_version = false; 376 // alert( navigator.userAgent ); 377 // if ( is_chrome ) chrome_version = /Chrome\/([0-9]+)/.exec(navigator.userAgent)[1]; 378 379 window.bt_bb_raf_loop = function () { 380 var win_w = window.innerWidth; 381 var win_h = window.innerHeight; 382 const SPEED_DELTA = 0.0001; 383
384 $('html.bt_bb_backgroud_fixed_supported .bt_bb_parallax').each(function () { 385 if ( window.bt_bb_res !== 'xxl' && window.bt_bb_res !== 'xl') { 386 $(this)[0].style.backgroundPosition = 'center center'; 387 return false; 388 } else { 389 var bounds = $(this).hasClass('bt_bb_background_image_holder') ? this.parentElement.getBoundingClientRect() : this.getBoundingClientRect(); 390 391 if (bounds.top < win_h && bounds.bottom > 0) { 392 var speed = parseFloat($(this).attr('data-parallax')) + SPEED_DELTA; 393 if (speed == 2 + SPEED_DELTA) { 394 // if ( false ) { 395 // skip parallax, use fixed background 396 $(this)[0].style.backgroundAttachment = 'fixed'; 397 } else { 398 399 var offset = parseFloat($(this).attr('data-parallax-offset')); 400 var ypos = offset - bounds.top * speed / 2; 401 ypos = (ypos > -0.5 && ypos < 0.5) ? 0 : ypos; 402 403 $(this)[0].style.backgroundPositionY = ypos + 'px'; 404 } 405 406 // temp if, to support old sections 407 if ($(this).hasClass('bt_bb_background_image_holder')) { 408 409 var bounds_mid = (bounds.top + bounds.bottom) / 2; 410 var scroll_distance = (bounds_mid - win_h / 2) / (win_h); 411 scroll_distance = bt_clamp_number(scroll_distance, 0, 1); 412 413 var ZOOM_START = parseFloat($(this).attr('data-parallax-zoom-start')); 414 var ZOOM_END = parseFloat($(this).attr('data-parallax-zoom-end')); 415 416 if (ZOOM_START >= 0 && ZOOM_END >= 0 && (ZOOM_START != 1 || ZOOM_END != 1)) { 417 var zoom = ZOOM_START + (ZOOM_END - ZOOM_START) * (1 - scroll_distance); 418 $(this)[0].style.transform = ' scale(' + zoom + ')'; 419 } 420 421 var BLUR_START = parseFloat($(this).attr('data-parallax-blur-start')); 422 var BLUR_END = parseFloat($(this).attr('data-parallax-blur-end')); 423 424 if (BLUR_START >= 0 && BLUR_END >= 0 && (BLUR_START != 0 || BLUR_END != 0)) { 425 var blur = BLUR_START + (BLUR_END - BLUR_START) * (1 - scroll_distance); 426 $(this)[0].style.filter = ' blur(' + blur + 'px)'; 427 } 428 429 var OPACITY_START = parseFloat($(this).attr('data-parallax-opacity-start')); 430 var OPACITY_END = parseFloat($(this).attr('data-parallax-opacity-end')); 431 432 if (OPACITY_START >= 0 && OPACITY_END >= 0 && (OPACITY_START != 1 || OPACITY_END != 1)) { 433 var opacity = OPACITY_START + (OPACITY_END - OPACITY_START) * (1 - scroll_distance); 434 $(this)[0].style.opacity = opacity; 435 } 436 } 437 } 438 } 439 }); 440 window.bt_bb_raf_lock = false; 441 } 442 443 // touch screen detect 444 445 window.bt_detect_touch = function () { 446 if (typeof window !== 'undefined') { 447 var bt_has_touch = Boolean( 448 'ontouchstart' in window || 449 window.navigator.maxTouchPoints > 0 || 450 window.navigator.msMaxTouchPoints > 0 || 451 window.DocumentTouch && document instanceof DocumentTouch 452 ); 453 if (bt_has_touch) $('html').addClass('bt_bb_touch'); 454 // Mobile device detection 455 if (/Mobi|Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) { 456 $('html').addClass('bt_bb_mobile'); 457 } 458 } 459 } 460 461 // screen detect 462 463 window.bt_bb_get_screen_resolution = function ( not_resize = false ) { 464 var width = Math.max( document.documentElement.clientWidth, window.innerWidth || 0 ); 465 var res = 'xxl'; 466 if ( width <= 1400 ) res = 'xl'; 467 if ( width <= 1200 ) res = 'lg'; 468 if ( width <= 992) res = 'md'; 469 if ( width <= 768 ) res = 'sm'; 470 if ( width <= 480 ) res = 'xs'; 471 472 window.bt_bb_res = res; 473 474 $( 'html' ).attr( 'data-bt_bb_screen_resolution', window.bt_bb_res ); 475 476 $( '[data-bt-override-class]' ).each(function() { 477 var override_classes = $( this ).data( 'bt-override-class' ); 478 for ( var prefix in override_classes ) { 479 if ( override_classes[ prefix ][ window.bt_bb_res ] !== undefined ) { 480 var new_class = prefix + override_classes[ prefix ][ window.bt_bb_res ]; 481 } else { 482 var new_class = prefix + override_classes[ prefix ]['def']; 483 } 484 $( this ).removeClass( override_classes[ prefix ]['current_class'] ); 485 var animate = false; 486 if ( new_class.includes( ' animate' ) ) { 487 animate = true; 488 if ( not_resize ) $( this ).css( 'transition', 'none' ); 489 } 490 $( this ).addClass( new_class ); 491 if ( animate ) { 492 setTimeout( () => { 493 $( this ).css( 'transition', '' ); 494 }, 0 ); 495 } 496 override_classes[ prefix ]['current_class'] = new_class; 497 $( this ).data( 'override_classes', override_classes ); 498 }; 499 500 }); 501 502 } 503 504 // Test fixed background support for iOS devices 505 506 window.bt_bb_check_ios_fixed_background_support = function () { 507 return (/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream) || 508 (/MacIntel/.test(navigator.platform) && $('html').hasClass('bt_bb_touch')); 509 510 /* /MacIntel/... <- checks iPadPro */ 511 } 512 513 // Test fixed background support 514 515 window.bt_bb_check_fixed_background = function () { 516 var el = document.createElement('div'); 517 try { 518 if (!('backgroundAttachment' in el.style) || bt_bb_check_ios_fixed_background_support()) {
519 $('html').removeClass('bt_bb_backgroud_fixed_supported'); 520 return false; 521 } 522 el.style.backgroundAttachment = 'fixed'; 523 if (('fixed' === el.style.backgroundAttachment)) { 524 $('html').addClass('bt_bb_backgroud_fixed_supported'); 525 return true; 526 } 527 } 528 catch (e) { 529 $('html').removeClass('bt_bb_backgroud_fixed_supported'); 530 return false; 531 } 532 } 533 534 // Countdown timer helpers 535 536 window.bt_bb_countdown = function (elem, selector, i, arr, arr_prev) { 537 538 if (arr[i] !== arr_prev[i] || elem.find(selector).children().eq(0).html() == '') { 539 elem.find(selector).children().addClass('countdown_anim'); 540 elem.find(selector).children().eq(0).html(arr[i]); 541 elem.find(selector).children().eq(1).html(arr_prev[i]); 542 setTimeout(function () { 543 elem.find(selector).children().eq(1).html(elem.find(selector).children().eq(0).html()); 544 elem.find(selector).children().removeClass('countdown_anim'); 545 }, 300); 546 } 547 } 548 549 window.bt_bb_countdown_output = function (elem) { 550 551 var s = elem.attr('data-init-seconds'); 552 if (isNaN(s)) { 553 s = 0; 554 } 555 var delta = s; 556 557 var days = Math.floor(delta / 86400); 558 delta -= days * 86400; 559 560 var hours = Math.floor(delta / 3600) % 24; 561 delta -= hours * 3600; 562 563 var minutes = Math.floor(delta / 60) % 60; 564 delta -= minutes * 60; 565 566 var seconds = delta; 567 568 if (hours < 10) { 569 hours = '0' + hours; 570 } 571 572 if (minutes < 10) { 573 minutes = '0' + minutes; 574 } 575 576 if (seconds < 10) { 577 seconds = '0' + seconds; 578 } 579 580 var seconds_arr_prev = seconds.toString().split(''); 581 var minutes_arr_prev = minutes.toString().split(''); 582 var hours_arr_prev = hours.toString().split(''); 583 584 s = s - 1; 585 if (s < 0) { 586 s = 0; 587 } 588 589 var delta = s; 590 591 var days = Math.floor(delta / 86400); 592 delta -= days * 86400; 593 594 var hours = Math.floor(delta / 3600) % 24; 595 delta -= hours * 3600; 596 597 var minutes = Math.floor(delta / 60) % 60; 598 delta -= minutes * 60; 599 600 var seconds = delta; 601 602 if (hours < 10) { 603 hours = '0' + hours; 604 } 605 606 if (minutes < 10) { 607 minutes = '0' + minutes; 608 } 609 610 if (seconds < 10) { 611 seconds = '0' + seconds; 612 } 613 614 var seconds_arr = seconds.toString().split(''); 615 var minutes_arr = minutes.toString().split(''); 616 var hours_arr = hours.toString().split(''); 617 618 for (var i = 0; i <= 1; i++) { 619 bt_bb_countdown(elem, '.seconds .n' + i, i, seconds_arr, seconds_arr_prev); 620 bt_bb_countdown(elem, '.minutes .n' + i, i, minutes_arr, minutes_arr_prev); 621 bt_bb_countdown(elem, '.hours .n' + i, i, hours_arr, hours_arr_prev); 622 } 623 624 var days_arr = days.toString().split(''); 625 626 var days_html = ''; 627 for (var i = 0; i < days_arr.length; i++) { 628 days_html += '<span>' + days_arr[i] + '</span>'; 629 } 630 631 // Create a text node instead of inserting raw HTML 632 elem.find('.days').html(days_html + '<span class="days_text"><span></span></span>'); 633 634 // Then safely set the text content (not HTML) of the inner span 635 var textContent = elem.find('.days').data('text'); 636 elem.find('.days_text span').text(textContent); // .text() escapes HTML automatically 637 638 elem.attr('data-init-seconds', s); 639 640 } 641 642 function bt_bb_fix_slider_heights() { 643 $('.bt_bb_content_slider.bt_bb_height_keep-height .slick-slider').each(function (index) { 644 $(this).find('.slick-slide').height('auto'); 645 var slickTrack = $(this).find('.slick-track'); 646 var slickTrackHeight = $(slickTrack).height(); 647 $(this).find('.slick-slide').css('height', slickTrackHeight + 'px'); 648 }); 649 } 650 651 function bt_bb_init_elements() { 652 // get row structure 653 654 const options = { 655 root: null, 656 rootMargin: "200px", 657 treshold: 0, 658 }; 659 660 // .bt_bb_section .bt_bb_row 661 662 const targetElements_Row = document.querySelectorAll( 663 ".bt_bb_section .bt_bb_row" 664 ); 665 666 const observer_Row = new IntersectionObserver(function (entries, observer) { 667 entries.forEach((entry) => { 668 if (entry.isIntersecting) { 669 var data_structure = []; 670 $(entry.target).data("structure", "0"); 671 $(entry.target) 672 .find(".bt_bb_column") 673 .each(function (index) { 674 data_structure.push($(this).data("width")); 675 });
676 677 $(entry.target).attr("data-structure", data_structure.join("-")); 678 679 observer_Row.unobserve(entry.target); 680 } 681 }); 682 }, options); 683 684 targetElements_Row.forEach((element) => { 685 observer_Row.observe(element); 686 }); 687 688 // .bt_bb_row_inner 689 690 const targetElements_RowInner = 691 document.querySelectorAll(".bt_bb_row_inner"); 692 693 const observer_RowInner = new IntersectionObserver(function ( 694 entries, 695 observer 696 ) { 697 entries.forEach((entry) => { 698 if (entry.isIntersecting) { 699 var data_structure = []; 700 $(entry.target).data("structure", "0"); 701 $(entry.target) 702 .find(".bt_bb_column_inner") 703 .each(function (index) { 704 data_structure.push($(this).data("width")); 705 }); 706 $(entry.target).attr("data-structure", data_structure.join("-")); 707 708 observer_RowInner.unobserve(entry.target); 709 } 710 }); 711 }, 712 options); 713 714 targetElements_RowInner.forEach((element) => { 715 observer_RowInner.observe(element); 716 }); 717 718 // .slick-slider 719 720 const targetElements_Slick = document.querySelectorAll(".slick-slider"); 721 722 const observer_Slick = new IntersectionObserver(function ( 723 entries, 724 observer 725 ) { 726 entries.forEach((entry) => { 727 if (entry.isIntersecting) { 728 $(entry.target).slick(); 729 730 $(entry.target) 731 .find(".slick-prev") 732 .on("click", function () { 733 $(this).closest(".slick-slider").slick("slickPause"); 734 }); 735 736 $(entry.target) 737 .find(".slick-next") 738 .on("click", function () { 739 $(this).closest(".slick-slider").slick("slickPause"); 740 }); 741 742 $(entry.target) 743 .find(".slick-dots li") 744 .on("click", function () { 745 $(this).closest(".slick-slider").slick("slickPause"); 746 }); 747 748 $( 749 ".bt_bb_slider.bt_bb_use_lightbox .slick-slider .bt_bb_slider_item" 750 ).on("click", function () { 751 $(this).closest(".slick-slider").slick("slickPause"); 752 }); 753 754 observer_Slick.unobserve(entry.target); 755 } 756 }); 757 }, 758 options); 759 760 targetElements_Slick.forEach((element) => { 761 observer_Slick.observe(element); 762 }); 763 764 // .bt_bb_slider.bt_bb_use_lightbox 765 766 const targetElements_lightBox = document.querySelectorAll( 767 ".bt_bb_slider.bt_bb_use_lightbox" 768 ); 769 770 const observer_lightBox = new IntersectionObserver(function ( 771 entries, 772 observer 773 ) { 774 entries.forEach((entry) => { 775 if (entry.isIntersecting) { 776 777 $(entry.target).magnificPopup({ 778 delegate: ".bt_bb_slider_item:not(.slick-cloned)", 779 type: "image", 780 gallery: { 781 enabled: true, 782 }, 783 callbacks: { 784 elementParse: function (item) { 785 item.src = item.el.data("src-full"); 786 }, 787 }, 788 closeBtnInside: false, 789 fixedContentPos: false, 790 }); 791 792 observer_lightBox.unobserve(entry.target); 793 } 794 }); 795 }, 796 options); 797 798 targetElements_lightBox.forEach((element) => { 799 observer_lightBox.observe(element); 800 }); 801 802 // .bt_bb_masonry_image_grid 803 804 const targetElements_masonryImageGrid = document.querySelectorAll( 805 ".bt_bb_masonry_image_grid:not(.bt_bb_no_lightbox)" 806 ); 807 808 const observer_masonryImageGrid = new IntersectionObserver(function ( 809 entries, 810 observer 811 ) { 812 entries.forEach((entry) => { 813 if (entry.isIntersecting) { 814 815 $(entry.target).magnificPopup({ 816 delegate: ".bt_bb_grid_item", 817 type: "image", 818 gallery: { 819 enabled: true, 820 }, 821 callbacks: { 822 elementParse: function (item) { 823 item.src = item.el.data("src-full"); 824 }, 825 }, 826 closeBtnInside: false, 827 fixedContentPos: false, 828 }); 829 830 observer_masonryImageGrid.unobserve(entry.target); 831 } 832 }); 833 }, 834 options); 835 836 targetElements_masonryImageGrid.forEach((element) => { 837 observer_masonryImageGrid.observe(element); 838 }); 839 840 // css image grid lighbox 841 842 window.bt_bb_init_css_image_grid_lightbox_startup(); 843 844 // image lightbox 845 846 $(document).on("click", ".bt_bb_image.bt_bb_use_lightbox a", function () { 847 var url = $(this).attr("href").trim(); 848 849 if (url != "" && url != "#" && url != "#lightbox") { 850 var contentType = 851 url.toLowerCase().includes(".jpg") || 852 url.toLowerCase().includes(".jpeg") || 853 url.toLowerCase().includes(".png") 854 ? "image" 855 : "iframe"; 856 $.magnificPopup.open({ 857 type: contentType, 858 items: { 859 src: url, 860 title: $(this).attr("title"), 861 }, 862 closeBtnInside: false, 863 }); 864 } else { 865 var url = $(this).find("img").attr("data-full_image_src"); 866 $.magnificPopup.open({ 867 type: "image", 868 items: { 869 src: url, 870 title: $(this).attr("title"), 871 }, 872 closeBtnInside: false,
873 fixedContentPos: false, 874 }); 875 return false; 876 } 877 return false; 878 }); 879 880 // button, icon, service lightbox 881 882 $(document).on( 883 "click", 884 ".bt_bb_button.bt_bb_use_lightbox a, .bt_bb_icon.bt_bb_use_lightbox a, .bt_bb_service.bt_bb_use_lightbox a", 885 function () { 886 var url = $(this).attr("href"); 887 var contentType = 888 url.toLowerCase().includes(".jpg") || 889 url.toLowerCase().includes(".jpeg") || 890 url.toLowerCase().includes(".png") 891 ? "image" 892 : "iframe"; 893 894 $.magnificPopup.open({ 895 type: contentType, 896 items: { 897 src: url, 898 title: $(this).attr("title"), 899 }, 900 closeBtnInside: false, 901 }); 902 903 return false; 904 } 905 ); 906 907 // force slider item equal height when keep height is active 908 909 $(".bt_bb_content_slider.bt_bb_height_keep-height .slick-slider").on( 910 "setPosition", 911 function () { 912 bt_bb_fix_slider_heights(); 913 $(this) 914 .find("*[aria-hidden=true] a, *[aria-hidden=true] button") 915 .attr("tabindex", -1); 916 $(this) 917 .find("*[aria-hidden=false] a, *[aria-hidden=false] button") 918 .removeAttr("tabindex"); 919 } 920 ); 921 $(window).on("resize", function (e) { 922 bt_bb_fix_slider_heights(); 923 bt_bb_get_screen_resolution(); 924 }); 925 926 // bt_bb_elements.js resets animated class 927 $(".slick-slider").on( 928 "beforeChange", 929 function (event, slick, currentSlide, nextSlide) { 930 $(this).find(".slick-slide .animated").removeClass("animated"); 931 $(this) 932 .find(".slick-slide[data-slick-index=" + nextSlide + "] .animate") 933 .addClass("animated"); 934 } 935 ); 936 937 // tabs 938 939 window.bt_bb_init_tabs_startup(); 940 941 // Detect touch 942 943 setTimeout(() => { 944 bt_detect_touch(); 945 }, 0); 946 947 // parallax 948 949 bt_bb_check_fixed_background(); 950 951 if ($("html.bt_bb_backgroud_fixed_supported .bt_bb_parallax").length > 0) { 952 window.bt_bb_raf_lock = false; 953 954 $(window).on("mousewheel", function (e) { }); 955 956 $(window).on("scroll", function () { 957 if (!window.bt_bb_raf_lock) { 958 window.bt_bb_raf_lock = true; 959 bt_bb_requestAnimFrame(bt_bb_raf_loop); 960 } 961 }); 962 963 //qbt_bb_requestAnimFrame(bt_bb_raf_loop); 964 965 $(window).on("load", function () { 966 bt_bb_requestAnimFrame(bt_bb_raf_loop); 967 }); 968 } 969 970 // Countdown 971 972 const options_Countdown = { 973 root: null, 974 rootMargin: "1000px", 975 treshold: 0, 976 }; 977 978 const targetElements_Countdown = 979 document.querySelectorAll(".btCountdownHolder"); 980 981 const observer_Countdown = new IntersectionObserver(function ( 982 entries, 983 observer 984 ) { 985 entries.forEach((entry) => { 986 if (entry.isIntersecting) { 987 988 setInterval(function () { 989 bt_bb_countdown_output($(entry.target)); 990 }, 1000); 991 992 observer_Countdown.unobserve(entry.target); 993 } 994 }); 995 }, 996 options_Countdown); 997 998 targetElements_Countdown.forEach((element) => { 999 observer_Countdown.observe(element); 1000 }); 1001 1002 // Accordion 1003 1004 $(".bt_bb_wrapper").on("click", ".bt_bb_accordion_item_title", function () { 1005 var $item = $(this).closest(".bt_bb_accordion_item"); 1006 if (!$item.hasClass("on")) { 1007 $(this) 1008 .closest(".bt_bb_accordion") 1009 .find(".bt_bb_accordion_item.on") 1010 .removeClass("on"); 1011 $item.addClass("on"); 1012 if (!window.bt_bb_initialaccordion) { 1013 var top_of_element = $item.offset().top; 1014 var bottom_of_element = 1015 $item.offset().top + $("#element").outerHeight(); 1016 var bottom_of_screen = 1017 $(window).scrollTop() + $(window).innerHeight(); 1018 var top_of_screen = $(window).scrollTop(); 1019 var diff = top_of_screen - top_of_element; 1020 if (diff > 0) { 1021 $("html").scrollTop($("html").scrollTop() - diff - 15); 1022 } 1023 } else { 1024 window.bt_bb_initialaccordion = false; 1025 } 1026 } else { 1027 $(this).closest(".bt_bb_accordion_item").removeClass("on"); 1028 } 1029 }); 1030 1031 const targetElements_Accordion = 1032 document.querySelectorAll(".bt_bb_accordion"); 1033 1034 const observer_Accordion = new IntersectionObserver(function ( 1035 entries, 1036 observer 1037 ) {
1038 entries.forEach((entry) => { 1039 if (entry.isIntersecting) { 1040 1041 if ($(entry.target).data("closed") != "closed") { 1042 window.bt_bb_initialaccordion = true; 1043 $(entry.target) 1044 .find(".bt_bb_accordion_item_title") 1045 .first() 1046 .click(); 1047 } 1048 1049 observer_Accordion.unobserve(entry.target); 1050 } 1051 }); 1052 }, 1053 options); 1054 1055 targetElements_Accordion.forEach((element) => { 1056 observer_Accordion.observe(element); 1057 }); 1058 } 1059 1060 // google maps 1061 1062 window.bt_bb_gmap_init_static_new = function (map_id) { 1063 var mapElement_jQuery = jQuery('#' + map_id); 1064 if (mapElement_jQuery.data('init-finished') == true) return false; 1065 var zoom = (typeof mapElement_jQuery.data('zoom') !== 'undefined') ? mapElement_jQuery.data('zoom') : 8; 1066 var custom_style = (typeof mapElement_jQuery.data('custom-style') !== 'undefined') ? mapElement_jQuery.data('custom-style').trim() : ''; 1067 var api_key = (typeof mapElement_jQuery.data('api-key') !== 'undefined') ? mapElement_jQuery.data('api-key') : ''; 1068 var height = (typeof mapElement_jQuery.data('height') !== 'undefined') ? mapElement_jQuery.data('height') : 0; 1069 bt_bb_gmap_init_static(map_id, zoom, custom_style, height, api_key); 1070 mapElement_jQuery.data('init-finished', true); 1071 1072 } 1073 1074 window.bt_bb_gmap_init_new = function (map_id) { 1075 var mapElement_jQuery = jQuery('#' + map_id); 1076 if (mapElement_jQuery.data('init-finished') == true) return false; 1077 var zoom = (typeof mapElement_jQuery.data('zoom') !== 'undefined') ? mapElement_jQuery.data('zoom') : 8; 1078 var custom_style = (typeof mapElement_jQuery.data('custom-style') !== 'undefined') ? mapElement_jQuery.data('custom-style').trim() : ''; 1079 bt_bb_gmap_init(map_id, zoom, custom_style); 1080 mapElement_jQuery.data('init-finished', true); 1081 } 1082 1083 document.addEventListener('readystatechange', function () { 1084 if ((document.readyState === 'complete')) { 1085 if (typeof (bt_bb_init_all_maps) !== 'function') { 1086 return false; 1087 } 1088 window.bt_bb_init_all_maps(); 1089 }; 1090 }, false); 1091 1092 // callback from gmaps api 1093 window.bt_bb_init_all_maps = function () { 1094 jQuery('.bt_bb_google_maps_map').each(function (index) { 1095 if (jQuery(this).data('map-type') != 'static') { 1096 bt_bb_gmap_init_new(jQuery(this).attr('id')); 1097 } else { 1098 bt_bb_gmap_init_static_new(jQuery(this).attr('id')); 1099 }; 1100 }); 1101 }; 1102 1103 window.bt_bb_gmap_init_static = function (map_id, zoom, custom_style, height, api_key) { 1104 1105 if (parseInt(height) <= 0) height = 400; 1106 1107 var container = jQuery('#' + map_id).parent(); 1108 var googleApiMapId = document.getElementById(map_id).id; 1109 1110 var locations = container.find('.bt_bb_map_location'); 1111 1112 var center_map = container.data('center'); 1113 if (center_map == 'no') { 1114 center_map = false; 1115 } else { 1116 center_map = true; 1117 } 1118 1119 var lat_sum = 0; 1120 var lng_sum = 0; 1121 var markerStr = ''; 1122 var n = 0; 1123 var colors = ['blue', 'green', 'red', 'purple', 'yellow', 'gray', 'orange', 'white', 'black', 'brown']; 1124 1125 var centerLatLng; 1126 1127 locations.each(function () { 1128 1129 var lat = jQuery(this).data('lat'); 1130 var lng = jQuery(this).data('lng'); 1131 var iconStr = jQuery(this).data('icon') != "" ? 'scale:2%7Cicon:' + jQuery(this).data('icon') : 'size:mid%7Ccolor:' + colors[n]; 1132 1133 lat_sum += parseFloat(lat); 1134 lng_sum += parseFloat(lng); 1135 1136 markerStr += '&markers=' + iconStr + '%7C' + lat + ',' + lng; 1137 1138 centerLatLng = [lat, lng]; 1139 1140 n++; 1141 }); 1142 1143 if (center_map) { 1144 centerLatLng = [lat_sum / n, lng_sum / n]; 1145 } 1146 1147 if (atob(custom_style).startsWith('[')) custom_style = ''; 1148 1149 var img_src = '<img src="https://maps.googleapis.com/maps/api/staticmap?center=' + centerLatLng.toString() + '&zoom=' + zoom + markerStr + '&size=640x' + height + '&scale=2&style=' + atob(custom_style) + '&key=' + api_key + '">'; 1150 container.find('.bt_bb_google_maps_map.bt_bb_map_map').append(img_src).on('click', function () { 1151 1152 var parent = $(this).parent(); 1153 var locations = parent.find('.bt_bb_map_location'); 1154 var active = locations.filter('.bt_bb_map_location_show'); 1155 1156 // OFF state â turn on first 1157 if (active.length === 0) { 1158 locations.first().addClass('bt_bb_map_location_show'); 1159 return; 1160 } 1161 1162 // Last active â turn everything OFF 1163 if (active.is(locations.last())) { 1164 locations.removeClass('bt_bb_map_location_show'); 1165 return; 1166 } 1167 1168 // Normal rotation â next 1169 active 1170 .removeClass('bt_bb_map_location_show') 1171 .next('.bt_bb_map_location') 1172 .addClass('bt_bb_map_location_show'); 1173 }); 1174 1175 locations.eq(0).addClass('bt_bb_map_location_show'); 1176 1177 jQuery('#' + map_id).data('init-finished', true); 1178 1179 } 1180 1181 window.bt_bb_gmap_init = function (map_id, zoom, custom_style) { 1182 1183 var mapElement = document.getElementById(map_id); 1184 1185 var myLatLng = new google.maps.LatLng(0, 0); 1186 1187 var googleApiMapId = mapElement.id; 1188 1189 var mapOptions = { 1190 mapId: googleApiMapId, 1191 zoom: zoom,
1192 center: myLatLng, 1193 scrollwheel: false, 1194 scaleControl: true, 1195 zoomControl: true, 1196 zoomControlOptions: { 1197 style: google.maps.ZoomControlStyle.SMALL, 1198 position: google.maps.ControlPosition.RIGHT_CENTER 1199 }, 1200 streetViewControl: true, 1201 mapTypeControl: true 1202 } 1203 1204 if (mapElement) { 1205 var map = new google.maps.Map(mapElement, mapOptions); 1206 1207 if (custom_style != '' && atob(custom_style).startsWith('[')) { 1208 1209 var style_array = []; 1210 1211 if (custom_style != '') { 1212 style_array = JSON.parse(atob(custom_style)); 1213 } 1214 1215 var customMapType = new google.maps.StyledMapType(style_array, { 1216 name: 'Custom Style' 1217 }); 1218 1219 var customMapTypeId = 'custom_style'; 1220 map.mapTypes.set(customMapTypeId, customMapType); 1221 map.setMapTypeId(customMapTypeId); 1222 } else { 1223 1224 } 1225 1226 var n = 0; 1227 1228 var container = jQuery('#' + map_id).parent(); 1229 1230 var locations = container.find('.bt_bb_map_location'); 1231 1232 var center_map = container.data('center'); 1233 if (center_map == 'no') { 1234 center_map = false; 1235 } else { 1236 center_map = true; 1237 } 1238 1239 var lat_sum = 0; 1240 var lng_sum = 0; 1241 1242 locations.each(function () { 1243 1244 var lat = jQuery(this).data('lat'); 1245 var lng = jQuery(this).data('lng'); 1246 var icon = jQuery(this).data('icon'); 1247 1248 lat_sum += parseFloat(lat); 1249 lng_sum += parseFloat(lng); 1250 1251 var myGlyphImg = document.createElement("img"); 1252 myGlyphImg.src = icon; 1253 myGlyphImg.count = n; 1254 var myLatLng = new google.maps.LatLng(lat, lng); 1255 // console.log( myLatLng ); 1256 // var myLatLng = { lat: -25.344, lng: 131.031 }; 1257 // console.log( map ); 1258 // console.log( myLatLng ); 1259 var marker = new google.maps.marker.AdvancedMarkerElement({ 1260 map, 1261 position: myLatLng, 1262 content: myGlyphImg, 1263 // count: n 1264 }); 1265 marker.count = n; 1266 1267 if (!center_map && n == 0) { 1268 map.setCenter(myLatLng); 1269 } 1270 1271 locations.eq(0).addClass('bt_bb_map_location_show'); 1272 1273 marker.addListener('click', () => { 1274 //map.setZoom( zoom ); 1275 //map.setCenter( marker.getPosition() ); 1276 //console.log( marker.count ); 1277 var reload = true; 1278 if (locations.eq(marker.count).hasClass('bt_bb_map_location_show') && !container.hasClass('bt_bb_map_no_overlay')) reload = false; 1279 container.removeClass('bt_bb_map_no_overlay'); 1280 locations.removeClass('bt_bb_map_location_show'); 1281 if (reload) locations.eq(marker.count).addClass('bt_bb_map_location_show'); 1282 }); 1283 1284 n++; 1285 }); 1286 1287 if (center_map) { 1288 var centerLatLng = new google.maps.LatLng(lat_sum / n, lng_sum / n); 1289 map.setCenter(centerLatLng); 1290 } 1291 } 1292 1293 jQuery('#' + map_id).data('init-finished', true); 1294 1295 } 1296 1297 // leaflet map init 1298 1299 var map = null; 1300 1301 window.bt_bb_leaflet_init = function (map_id, zoom, max_zoom, predefined_style, scroll_wheel, custom_style, zoom_control) { 1302 onImagesLoaded($('#' + map_id).parent(), function () { 1303 bt_bb_leaflet_init_late(map_id, zoom, max_zoom, predefined_style, scroll_wheel, custom_style, zoom_control); 1304 }); 1305 1306 } 1307 1308 window.bt_bb_leaflet_init_late_all = function () { 1309 jQuery('.bt_bb_leaflet_map_map').not('.leaflet-container').each(function () { 1310 window.bt_bb_leaflet_init_late(jQuery(this).attr('id'), jQuery(this).data('zoom'), jQuery(this).data('max_zoom'), jQuery(this).data('predefined_style'), jQuery(this).data('custom_style'), jQuery(this).data('scroll_wheel'), jQuery(this).data('zoom_control')); 1311 }); 1312 } 1313 1314 window.bt_bb_leaflet_init_late = function (map_id, zoom, max_zoom, predefined_style, custom_style, scroll_wheel, zoom_control) { 1315 1316 var lat_center = 0; 1317 var lng_center = 0; 1318 1319 var container = jQuery('#' + map_id).parent(); 1320 var locations = container.find('.bt_bb_leaflet_map_location'); 1321 1322 var center_map = container.data('center'); 1323 1324 if (center_map == 'no') { 1325 center_map = false; 1326 } else { 1327 center_map = true; 1328 } 1329 1330 var markerClusters = L.markerClusterGroup(); 1331 1332 var lat_sum = 0; 1333 var lng_sum = 0; 1334 var n = 0; 1335 1336 locations.each(function () { 1337 1338 var lat = jQuery(this).data('lat'); 1339 var lng = jQuery(this).data('lng'); 1340 var icon = jQuery(this).data('icon'); 1341 lat_sum += parseFloat(lat); 1342 lng_sum += parseFloat(lng); 1343 1344 if (n == 0) { 1345 lat_center = lat; 1346 lng_center = lng; 1347 } 1348 locations.eq(0).addClass('bt_bb_map_location_show'); 1349 locations.eq(0).addClass('bt_bb_map_location_show'); 1350 1351 var myIcon = L.icon({ 1352 iconUrl: icon, 1353 iconRetinaUrl: icon, 1354 iconSize: [45, 58], 1355 iconAnchor: [22, 58], 1356 popupAnchor: [0, -14] 1357 }); 1358 1359 var m = L.marker([lat, lng], { icon: myIcon, id: n, lat: lat, lng: lng }).on("click", markerOnClick); 1360 markerClusters.addLayer(m); 1361 1362 n++; 1363 }); 1364 1365 if (center_map) { 1366 lat_center = lat_sum / n; 1367 lng_center = lng_sum / n; 1368 } 1369
1370 map = L.map(document.getElementById(map_id)).setView([lat_center, lng_center], zoom); 1371 1372 var tiles_arr = []; 1373 1374 if (parseInt(predefined_style) > 0) { 1375 tiles_arr = tiles_arr.concat(map_leaflet_source_arr[predefined_style]); 1376 } 1377 1378 if (custom_style != '') { 1379 custom_style = atob(custom_style); 1380 var tmp_arr = custom_style.split('\n'); 1381 $.each(tmp_arr, function (index, tmp) { 1382 1383 tiles_arr = tiles_arr.concat([tmp.split(',')]); 1384 }); 1385 } 1386 1387 $.each(tiles_arr, function (index, tile) { 1388 L.tileLayer( 1389 tile[0], 1390 { 1391 attribution: tile[1], 1392 maxZoom: max_zoom, 1393 subdomains: ['a', 'b', 'c'] 1394 } 1395 ).addTo(map); 1396 }); 1397 1398 map.addLayer(markerClusters); 1399 1400 if (scroll_wheel == '') { 1401 map.scrollWheelZoom.disable(); 1402 } 1403 1404 map.removeControl(map.zoomControl); 1405 1406 if (zoom_control) { 1407 L.control.zoom({ 1408 position: 'topright' 1409 }).addTo(map); 1410 } 1411 1412 function markerOnClick(e) { 1413 var attributes = e.target.options; 1414 var id = attributes.id; 1415 var reload = true; 1416 if (locations.eq(id).hasClass('bt_bb_leaflet_map_location_show') && !container.hasClass('bt_bb_leaflet_map_no_overlay')) reload = false; 1417 container.removeClass('bt_bb_leaflet_map_no_overlay'); 1418 locations.removeClass('bt_bb_leaflet_map_location_show'); 1419 if (reload) locations.eq(id).addClass('bt_bb_leaflet_map_location_show'); 1420 1421 if (locations.eq(id).hasClass('bt_bb_map_location_show') && !container.hasClass('bt_bb_map_no_overlay')) reload = false; 1422 container.removeClass('bt_bb_map_no_overlay'); 1423 locations.removeClass('bt_bb_map_location_show'); 1424 if (reload) locations.eq(id).addClass('bt_bb_map_location_show'); 1425 } 1426 } 1427 1428 // do event if all images in container are loaded 1429 1430 function onImagesLoaded(container, event) { 1431 var images = container.find('.bt_bb_leaflet_map_content img'); 1432 var loaded = images.length; 1433 if (loaded > 0) { 1434 for (var i = 0; i < images.length; i++) { 1435 if (images[i].complete) { 1436 loaded--; 1437 if (loaded == 0) { 1438 event(); 1439 } 1440 } else { 1441 images[i].addEventListener('load', function () { 1442 loaded--; 1443 if (loaded == 0) { 1444 event(); 1445 } 1446 }); 1447 setTimeout(function () { loaded--; console.log('Image loaded without proof: ' + loaded); if (loaded == 0) { event(); } }, 3000); 1448 } 1449 } 1450 } else { 1451 event(); 1452 } 1453 } 1454 1455 // general init 1456 1457 var bt_bb_init_finished = false; 1458 1459 document.addEventListener('readystatechange', function () { 1460 if (!bt_bb_init_finished && (document.readyState === 'interactive' || document.readyState === 'complete')) { 1461 bt_bb_init_elements(); 1462 1463 window.addEventListener("load", (event) => { 1464 1465 if (!$('body').hasClass('bodyPreloader')) { 1466 bt_bb_animate_elements_optim(); 1467 } else { 1468 setTimeout(function () { 1469 bt_bb_animate_elements_optim(); 1470 }, 500); 1471 } 1472 1473 bt_bb_lazy_load_images_optim(); 1474 1475 if ($('body').hasClass('logged-in') && $('.bt_bb_wrapper').length) { 1476 $(window).on('scroll', function () { 1477 bt_bb_animate_elements(); 1478 }); 1479 } 1480 1481 $(window).on('resize', function (e) { 1482 setTimeout(function () { 1483 var $elems = $('.bt_bb_counter.animated'); 1484 $elems.each(function () { 1485 var $elm = $(this); 1486 $elm.removeClass('animated'); 1487 bt_bb_animate_counter($elm); 1488 }); 1489 }, 1000); 1490 }); 1491 }); 1492 1493 bt_bb_init_finished = true; 1494 1495 } 1496 1497 }, false); 1498 1499 // magnificPopup swipe 1500 1501 function mfp_swipe() { 1502 var touch_start = false; 1503 var touch_end = false; 1504 var one_finger = true; 1505 $(document).on('touchstart', '.mfp-figure figure', function (e) { 1506 const touches = e.changedTouches; 1507 if (touches.length == 1) { 1508 touch_start = touches[0].clientX; 1509 } else { 1510 one_finger = false; 1511 } 1512 }); 1513 $(document).on('touchmove', '.mfp-figure figure', function (e) { 1514 const touches = e.changedTouches; 1515 if (touches.length > 1) { 1516 one_finger = false; 1517 } 1518 }); 1519 $(document).on('touchend', '.mfp-figure figure', function (e) { 1520 const touches = e.changedTouches; 1521 if (touches.length == 1 && one_finger) { 1522 touch_end = touches[0].clientX; 1523 if (touch_start - touch_end < -50) { 1524 $('.mfp-arrow-left').click(); 1525 } else if (touch_start - touch_end > 50) { 1526 $('.mfp-arrow-right').click(); 1527 } 1528 } 1529 one_finger = true; 1530 }); 1531 } 1532 mfp_swipe(); 1533 1534}(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.