1(function($){ 2 "use strict"; 3 4 // Detect Mobile Device 5 var tourmaster_mobile = false; 6 if( navigator.userAgent.match(/Android/i) || navigator.userAgent.match(/webOS/i) || navigator.userAgent.match(/BlackBerry/i) || 7 navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPad/i) || navigator.userAgent.match(/iPod/i) || navigator.userAgent.match(/Windows Phone/i) ){ 8 tourmaster_mobile = true; 9 }else{ 10 tourmaster_mobile = false; 11 } 12 13 // Detect Screen 14 var tourmaster_display = 'desktop'; 15 if( typeof(window.matchMedia) == 'function' ){ 16 $(window).on('resize themename-set-display gdlr-core-element-resize', function(){ 17 if( window.matchMedia('(max-width: 419px)').matches ){ 18 tourmaster_display = 'mobile-portrait'; 19 }else if( window.matchMedia('(max-width: 767px)').matches ){ 20 tourmaster_display = 'mobile-landscape' 21 }else if( window.matchMedia('(max-width: 959px)').matches ){ 22 tourmaster_display = 'tablet' 23 }else{ 24 tourmaster_display = 'desktop'; 25 } 26 }); 27 $(window).trigger('themename-set-display'); 28 }else{ 29 $(window).on('resize themename-set-display gdlr-core-element-resize', function(){ 30 if( $(window).innerWidth() <= 419 ){ 31 tourmaster_display = 'mobile-portrait'; 32 }else if( $(window).innerWidth() <= 767 ){ 33 tourmaster_display = 'mobile-landscape' 34 }else if( $(window).innerWidth() <= 959 ){ 35 tourmaster_display = 'tablet' 36 }else{ 37 tourmaster_display = 'desktop'; 38 } 39 }); 40 $(window).trigger('themename-set-display'); 41 } 42 43 // create the conformation message 44 window.tourmaster_front_confirm_box = function(options){ 45 46 var settings = $.extend({ 47 head: '', 48 text: '', 49 sub: '', 50 yes: '', 51 no: '', 52 success: function(){} 53 }, options); 54 55 var confirm_overlay = $('<div class="tourmaster-conform-box-overlay"></div>').appendTo($('body')); 56 var confirm_button = $('<span class="tourmaster-confirm-box-button tourmaster-yes">' + settings.yes + '</span>'); 57 var decline_button = $('<span class="tourmaster-confirm-box-button tourmaster-no">' + settings.no + '</span>'); 58 59 var confirm_box = $('<div class="tourmaster-confirm-box-wrapper">\ 60 <div class="tourmaster-confirm-box-head">' + settings.head + '</div>\ 61 <div class="tourmaster-confirm-box-content-wrapper" >\ 62 <div class="tourmaster-confirm-box-text">' + settings.text + '</div>\ 63 <div class="tourmaster-confirm-box-sub">' + settings.sub + '</div>\ 64 </div>\ 65 </div>').insertAfter(confirm_overlay); 66 67 68 $('<div class="tourmaster-confirm-box-button-wrapper"></div>') 69 .append(decline_button).append(confirm_button) 70 .appendTo(confirm_box); 71 72 // center the alert box position 73 confirm_box.css({ 74 'margin-left': -(confirm_box.outerWidth() / 2), 75 'margin-top': -(confirm_box.outerHeight() / 2) 76 }); 77 78 // animate the alert box 79 confirm_overlay.css({opacity: 0}).animate({opacity:0.6}, 200); 80 confirm_box.css({opacity: 0}).animate({opacity:1}, 200); 81 82 confirm_button.click(function(){
83 if(typeof(settings.success) == 'function'){ 84 settings.success(); 85 } 86 confirm_overlay.fadeOut(200, function(){ 87 $(this).remove(); 88 }); 89 confirm_box.fadeOut(200, function(){ 90 $(this).remove(); 91 }); 92 }); 93 decline_button.click(function(){ 94 confirm_overlay.fadeOut(200, function(){ 95 $(this).remove(); 96 }); 97 confirm_box.fadeOut(200, function(){ 98 $(this).remove(); 99 }); 100 }); 101 102 } // tourmaster_front_confirm_box 103 104 // tourmaster lightbox 105 $.fn.tourmaster_bind_lightbox = function(){ 106 107 $(this).on('click', function(){ 108 var content = $(this).siblings('[data-tmlb-id="' + $(this).attr('data-tmlb') + '"]'); 109 110 // check for social login plugin 111 if( content.find('.nsl-container-block').length > 0 ){ 112 var lb_content = content.clone(); 113 lb_content.find('.nsl-container-block').replaceWith(content.find('.nsl-container-block').clone(true)); 114 }else if( $(this).attr('data-tmlb') == 'signup' ){ 115 var lb_content = content.clone(true); 116 }else{ 117 var lb_content = content.clone(); 118 } 119 120 tourmaster_lightbox(lb_content); 121 }); 122 123 } 124 window.tourmaster_lightbox = function( content ){ 125 126 var lightbox_wrap = $('<div class="tourmaster-lightbox-wrapper" ></div>').hide(); 127 var lightbox_content_wrap = $('<div class="tourmaster-lightbox-content-cell" ></div>'); 128 lightbox_wrap.append(lightbox_content_wrap); 129 lightbox_content_wrap.wrap($('<div class="tourmaster-lightbox-content-row" ></div>')); 130 131 lightbox_content_wrap.append(content); 132 133 var scrollPos = $(window).scrollTop(); 134 $('html').addClass('tourmaster-lightbox-on'); 135 $('body').append(lightbox_wrap); 136 lightbox_wrap.fadeIn(300); 137 138 // bind lightbox form script 139 tourmaster_form_script(lightbox_wrap); 140 141 // rating action 142 tourmaster_rating(lightbox_wrap); 143 144 // do a lightbox action 145 lightbox_wrap.on('click', '.tourmaster-lightbox-close', function(){ 146 $('html').removeClass('tourmaster-lightbox-on'); 147 $(window).scrollTop(scrollPos); 148 lightbox_wrap.fadeOut(300, function(){ 149 $(this).remove(); 150 }); 151 }); 152 lightbox_wrap.on('lightbox_close', function(){ 153 $('html').removeClass('tourmaster-lightbox-on'); 154 $(window).scrollTop(scrollPos); 155 lightbox_wrap.fadeOut(300, function(){ 156 $(this).remove(); 157 }); 158 }); 159 160 // verify 161 lightbox_content_wrap.find('form').not('.tourmaster-register-form').each(function(){ 162 163 // required field 164 $(this).submit(function(){ 165 var validate = true; 166 var error_box = $(this).find('.tourmaster-lb-submit-error'); 167 error_box.slideUp(200); 168 169 $(this).find('input[data-required], select[data-required], textarea[data-required]').each(function(){ 170 if( !$(this).val() ){ 171 validate = false; 172 } 173 }); 174 175 if( !validate ){ 176 error_box.slideDown(200); 177 } 178 179 return validate; 180 }); 181 182 }); 183 184 } // tourmaster_lightbox 185 186 // ref : http://unscriptable.com/2009/03/20/debouncing-javascript-methods/ 187 // ensure 1 is fired 188 window.tourmaster_debounce = function(func, threshold, execAsap){ 189 190 var timeout; 191 192 return function debounced(){ 193 194 var obj = this, args = arguments; 195 196 function delayed(){ 197 if( !execAsap ){ 198 func.apply(obj, args); 199 } 200 timeout = null; 201 }; 202 203 if( timeout ){ 204 clearTimeout(timeout); 205 }else if( execAsap ){ 206 func.apply(obj, args); 207 } 208 timeout = setTimeout(delayed, threshold); 209 }; 210 } 211 212 // reduce the event occurance 213 window.tourmaster_throttling = function(func, threshold){ 214 215 var timeout; 216 217 return function throttled(){ 218 var obj = this, args = arguments; 219 220 function delayed(){ 221 func.apply(obj, args); 222 timeout = null; 223 }; 224 225 if( !timeout ){ 226 timeout = setTimeout(delayed, threshold); 227 } 228 }; 229 } 230 231 // rating 232 window.tourmaster_rating = function( container ){ 233 234 container.find('.tourmaster-review-form-rating, .tourmaster-tour-search-field-rating').each(function(){ 235 236 $(this).children('.tourmaster-rating-select').click(function(){ 237 $(this).siblings('input').val($(this).attr("data-rating-score")); 238 239 if($(this).is('i')){ $(this).removeClass().addClass('tourmaster-rating-select fa fa-star-half-empty'); } 240 $(this).prevAll('i').removeClass().addClass('tourmaster-rating-select fa fa-star'); 241 $(this).nextAll('i').removeClass().addClass('tourmaster-rating-select fa fa-star-o'); 242 }); 243 244 }); 245 246 } 247 248 // set cookie 249 window.tourmaster_read_cookie = function( cname ){ 250 var name = cname + "="; 251 var decodedCookie = decodeURIComponent(document.cookie); 252 var ca = decodedCookie.split(';'); 253 for( var i = 0; i <ca.length; i++ ) { 254 var c = ca[i]; 255 while( c.charAt(0) == ' ' ){ 256 c = c.substring(1); 257 } 258 if( c.indexOf(name) == 0 ){ 259 return c.substring(name.length, c.length); 260 } 261 } 262 return ""; 263 } 264 window.tourmaster_set_cookie = function( cname, cvalue, expires ){ 265 if( typeof(expires) != 'undefined' ){ 266 if( expires == 0 ){ 267 expires = 86400; 268 } 269 270 var now = new Date(); 271 var new_time = now.getTime() + (parseInt(expires) * 1000); 272 now.setTime(new_time); 273 274 expires = now.toGMTString(); 275 } 276 277 document.cookie = cname + "=" + encodeURIComponent(cvalue) + "; expires=" + expires + "; path=/"; 278 } 279 280 // form script 281 function tourmaster_form_script( container ){ 282 283 if( typeof(container) == 'undefined' ){ 284 var date_select = $('.tourmaster-date-select'); 285 var input_file = $('.tourmaster-file-label'); 286 }else{ 287 var date_select = container.find('.tourmaster-date-select'); 288 var input_file = container.find('.tourmaster-file-label'); 289 } 290 291 // fill the date option 292 date_select.on('change', 'select', function(){ 293 var parent = $(this).closest('.tourmaster-date-select'); 294 var date = 0;
295 var month = 0; 296 var year = 0; 297 298 parent.find('select[data-type]').each(function(){ 299 if( $(this).attr('data-type') == 'date' ){ 300 date = parseInt($(this).val()); 301 }else if( $(this).attr('data-type') == 'month' ){ 302 month = parseInt($(this).val()); 303 }else if( $(this).attr('data-type') == 'year' ){ 304 year = parseInt($(this).val()); 305 } 306 }); 307 308 if( date > 0 && month > 0 && year > 0 ){ 309 parent.siblings('input[name]').val(year + '-' + month + '-' + date); 310 } 311 312 }); 313 314 // input file 315 input_file.on('change', 'input[type="file"]', function(){ 316 var label_text = $(this).siblings('.tourmaster-file-label-text'); 317 318 if( $(this).val() ){ 319 label_text.html($(this).val().split('\\').pop()); 320 }else{ 321 label_text.html(label_text.attr('data-default')); 322 } 323 }); 324 325 } 326 327 $.fn.tourmaster_video_background = function(){ 328 329 if( tourmaster_mobile ){ 330 $(this).children('[data-background-type="video"]').remove(); 331 332 if( $(this).attr('data-video-fallback') ){ 333 $(this).css('background-image', 'url(' + $(this).attr('data-video-fallback') + ')'); 334 } 335 }else{ 336 337 var video_wrapper = $(this); 338 $(this).children('[data-background-type="video"]').each(function(){ 339 340 $(this).tourmaster_set_video_background_position(); 341 $(window).on('load resize', function(){ 342 $(this).tourmaster_set_video_background_position(); 343 }); 344 345 // script for muting the vimeo/youtube player 346 $(this).find('iframe').each(function(){ 347 if( $(this).attr('data-player-type') == 'vimeo' ){ 348 var player = $f($(this)[0]); 349 350 player.addEvent('ready', function() { 351 player.api('setVolume', 0); 352 }); 353 }else if( $(this).attr('data-player-type') == 'youtube' ){ 354 355 // assign the script 356 if( $('body').children('#tourmaster-youtube-api').length == 0 ){ 357 $('body').append('<script type="text/javascript" src="https://www.youtube.com/iframe_api" id="tourmaster-youtube-api" ></script>'); 358 } 359 360 // store to global variable 361 if( typeof(window.tourmaster_ytb) == 'undefined' ){ 362 window.tourmaster_ytb = [$(this)[0]]; 363 }else{ 364 window.tourmaster_ytb.push($(this)[0]); 365 } 366 367 // script loading action 368 window.onYouTubeIframeAPIReady = function(){ 369 for( var key in window.tourmaster_ytb ){ 370 new YT.Player(tourmaster_ytb[key],{ 371 events: { 372 'onReady': function(e){ 373 e.target.mute(); 374 } 375 } 376 }); 377 } 378 } 379 } 380 }); 381 }); 382 } 383 384 } // tourmaster_video_background 385 $.fn.tourmaster_set_video_background_position = function(){ 386 387 var wrapper_bg = $(this).parent(); 388 389 // set video height 390 var ratio = 640 / 360; 391 $(this).each(function(){ 392 if( (wrapper_bg.width() / wrapper_bg.height()) > ratio ){ 393 var v_height = wrapper_bg.width() / ratio; 394 var v_margin = (wrapper_bg.height() - v_height) / 2; 395 $(this).css({width: wrapper_bg.width(), height: v_height, 'margin-left': 0, 'margin-top': v_margin}); 396 }else{ 397 var v_width = wrapper_bg.height() * ratio; 398 var v_margin = (wrapper_bg.width() - v_width) / 2; 399 $(this).css({width: v_width, height: wrapper_bg.height(), 'margin-left': v_margin, 'margin-top': 0}); 400 } 401 }); 402 403 } // tourmaster_set_video_background_position 404 405 /////////////////////////////////////////////////// 406 // goodlayers core function 407 /////////////////////////////////////////////////// 408 409 $.fn.tourmaster_set_flexslider = function( filter_elem ){ 410 411 if( typeof(filter_elem) == 'undefined' ){ 412 var elem = $(this).find('.tourmaster-flexslider'); 413 }else{ 414 var elem = filter_elem.filter('.tourmaster-flexslider'); 415 } 416 417 elem.each(function(){ 418 419 var flex_attr = { 420 namespace: 'tourmaster-flex-', 421 useCSS: false, 422 animation: 'fade', 423 animationLoop: true, 424 prevText: '<i class="arrow_carrot-left"></i>', 425 nextText: '<i class="arrow_carrot-right"></i>' 426 }; 427 428 if( $(this).find('.tourmaster-flexslider').length > 0 ){ 429 $(this).children('ul.slides').addClass('parent-slides'); 430 flex_attr.selector = '.parent-slides > li'; 431 } 432 433 // variable settings 434 if( $(this).attr('data-disable-autoslide') ){ 435 flex_attr.slideshow = false;
436 } 437 if( $(this).attr('data-pausetime') ){ 438 flex_attr.slideshowSpeed = parseInt($(this).attr('data-pausetime')); 439 } 440 if( $(this).attr('data-slidespeed') ){ 441 flex_attr.animationSpeed = parseInt($(this).attr('data-slidespeed')); 442 }else{ 443 flex_attr.animationSpeed = 500; 444 } 445 446 // for carousel 447 if( $(this).attr('data-type') == 'carousel' ){ 448 flex_attr.move = 1; 449 flex_attr.animation = 'slide'; 450 451 // determine the spaces 452 var column_num = parseInt($(this).attr('data-column')); 453 flex_attr.itemMargin = 2 * parseInt($(this).children('ul.slides').children('li:first-child').css('margin-right')); 454 flex_attr.itemWidth = (($(this).width() + flex_attr.itemMargin) / column_num) - (flex_attr.itemMargin); 455 456 flex_attr.minItems = column_num; 457 flex_attr.maxItems = column_num; 458 459 var t = $(this); 460 $(window).resize(function(){ 461 if( t.data('tourmaster_flexslider') ){ 462 var newWidth = ((t.width() + flex_attr.itemMargin) / column_num) - (flex_attr.itemMargin); 463 t.data('tourmaster_flexslider').editItemWidth(newWidth); 464 } 465 }); 466 467 }else if( $(this).attr('data-effect') ){ 468 if( $(this).attr('data-effect') == 'kenburn' ){ 469 flex_attr.animation = 'fade'; 470 }else{ 471 flex_attr.animation = $(this).attr('data-effect'); 472 } 473 } 474 475 // for navigation 476 if( !$(this).attr('data-nav') || $(this).attr('data-nav') == 'both' || $(this).attr('data-nav') == 'navigation' || $(this).attr('data-nav') == 'navigation-outer' ){ 477 if( $(this).attr('data-nav-parent') ){ 478 479 if( $(this).attr('data-nav-type') == 'custom' ){ 480 flex_attr.customDirectionNav = $(this).closest('.' + $(this).attr('data-nav-parent')).find('.flex-prev, .flex-next'); 481 }else{ 482 $(this).closest('.' + $(this).attr('data-nav-parent')).each(function(){ 483 var flex_nav = $('<ul class="tourmaster-flex-direction-nav">' + 484 '<li class="tourmaster-flex-nav-prev"><a class="tourmaster-flex-prev" href="#"><i class="arrow_carrot-left"></i></a></li>' + 485 '<li class="tourmaster-flex-nav-next"><a class="tourmaster-flex-next" href="#"><i class="arrow_carrot-right"></i></a></li>' + 486 '</ul>'); 487 488 var flex_nav_position = $(this).find('.tourmaster-flexslider-nav'); 489 if( flex_nav_position.length ){ 490 flex_nav_position.append(flex_nav); 491 flex_attr.customDirectionNav = flex_nav.find('.tourmaster-flex-prev, .tourmaster-flex-next'); 492 } 493 }); 494 } 495 } 496 }else{ 497 flex_attr.directionNav = false;
498 } 499 if( $(this).attr('data-nav') == 'both' || $(this).attr('data-nav') == 'bullet' ){ 500 flex_attr.controlNav = true; 501 }else{ 502 flex_attr.controlNav = false; 503 } 504 505 // for thumbnail 506 if( $(this).attr('data-thumbnail') ){ 507 var thumbnail_slide = $(this).siblings('.gdlr-core-sly-slider'); 508 509 flex_attr.manualControls = thumbnail_slide.find('ul.slides li') 510 flex_attr.controlNav = true; 511 } 512 513 // center the navigation 514 // add active class for kenburn effects 515 if( $(this).attr('data-vcenter-nav') ){ 516 flex_attr.start = function(slider){ 517 if( slider.directionNav ){ 518 $(window).resize(function(){ 519 slider.directionNav.each(function(){ 520 var margin = -(slider.height() + $(this).outerHeight()) / 2; 521 $(this).css('margin-top', margin); 522 }); 523 }); 524 } 525 if( typeof(slider.slides) != 'undefined' ){ 526 $(window).trigger('resize'); 527 slider.slides.filter('.tourmaster-flex-active-slide').addClass('tourmaster-active').siblings().removeClass('tourmaster-active'); 528 } 529 }; 530 }else{ 531 flex_attr.start = function(slider){ 532 if( typeof(slider.slides) != 'undefined' ){ 533 $(window).trigger('resize'); 534 slider.slides.filter('.tourmaster-flex-active-slide').addClass('tourmaster-active').siblings().removeClass('tourmaster-active'); 535 } 536 } 537 } 538 539 // add the action for class 540 flex_attr.after = function(slider){ 541 slider.slides.filter('.tourmaster-flex-active-slide').addClass('tourmaster-active').siblings().removeClass('tourmaster-active'); 542 } 543 544 // add outer frame class 545 if( $(this).find('.tourmaster-outer-frame-element').length > 0 ){ 546 $(this).addClass('tourmaster-with-outer-frame-element'); 547 } 548 549 $(this).tourmaster_flexslider(flex_attr); 550 }); 551 552 return $(this); 553 554 } // tourmaster-set-flexslier 555 556 $.fn.tourmaster_set_image_height = function(){ 557 558 var all_image = $(this).find('img'); 559 560 all_image.each(function(){ 561 var img_width = $(this).attr('width'); 562 var img_height = $(this).attr('height'); 563 564 if( img_width && img_height ){ 565 var parent_item = $(this).parent('.tourmaster-temp-image-wrap'); 566 567 if( parent_item.length ){ 568 parent_item.height((img_height * $(this).width()) / img_width); 569 }else{ 570 parent_item = $('<div class="tourmaster-temp-image-wrap" ></div>'); 571 parent_item.css('height', ((img_height * $(this).width()) / img_width)); 572 $(this).wrap(parent_item); 573 } 574 }else{ 575 return; 576 } 577 }); 578 $(window).resize(function(e){ 579 all_image.each(function(){ 580 var parent_item = $(this).parent('.tourmaster-temp-image-wrap'); 581 582 if( parent_item.length ){ 583 $(this).unwrap(); 584 } 585 }); 586 587 $(window).unbind('resize', e.handleObj.handler, e); 588 }); 589 590 return $(this); 591 } // tourmaster_set_image_height 592 593 // ajax action 594 function tourmaster_ajax_action(ajax_section, name, value){ 595 596 if( ajax_section.attr('data-target-action') == 'replace' ){ 597 ajax_section.siblings('.' + ajax_section.attr('data-target')).each(function(){ 598 var scroll_pos = $(this).offset().top - 100; 599 if( typeof(window.traveltour_anchor_offset) != 'undefined' ){ 600 scroll_pos = scroll_pos - window.traveltour_anchor_offset; 601 } 602 if( $(window).scrollTop() > scroll_pos ){ 603 $('html, body').animate({scrollTop: scroll_pos}, 600, 'easeOutQuad'); 604 } 605 }); 606 } 607 608 $.ajax({ 609 type: 'POST', 610 url: ajax_section.attr('data-ajax-url'), 611 data: { 612 'action': ajax_section.attr('data-tm-ajax'), 613 'settings': ajax_section.data('settings'),
614 'option': { 'name':name, 'value':value } 615 }, 616 dataType: 'json', 617 beforeSend: function(jqXHR, settings){ 618 // before send action 619 if( ajax_section.attr('data-target-action') == 'replace' ){ 620 ajax_section.siblings('.' + ajax_section.attr('data-target')).animate({opacity: 0}, 150); 621 } 622 }, 623 error: function(jqXHR, textStatus, errorThrown){ 624 console.log(jqXHR, textStatus, errorThrown); 625 }, 626 success: function(data){ 627 628 if( data.status == 'success' ){ 629 if( data.content && ajax_section.attr('data-target') ){ 630 if( ajax_section.attr('data-target-action') == 'append' ){ 631 var content = $(data.content); 632 ajax_section.siblings('.' + ajax_section.attr('data-target')).each(function(){ 633 634 if( typeof($.fn.gdlr_core_animate_list_item) == 'function' ){ 635 if( $(this).attr('data-layout') != 'masonry' || typeof($.fn.isotope) != 'function' ){ 636 content.addClass('gdlr-core-animate-init'); 637 } 638 } 639 640 $(this).append(content); 641 content.tourmaster_flexslider().tourmaster_set_image_height(); 642 643 if( $(this).attr('data-layout') == 'masonry' && typeof($.fn.isotope) == 'function' ){ 644 var addItems = $(this).isotope('addItems', content); 645 $(this).isotope('layoutItems', addItems, true); 646 } 647 648 if( typeof($.fn.gdlr_core_animate_list_item) == 'function' ){ 649 content.gdlr_core_animate_list_item(); 650 } 651 }); 652 653 if( data.load_more ){ 654 if( data.load_more != 'none' ){ 655 var load_more = $(data.load_more); 656 ajax_section.parent().append(load_more); 657 load_more.tourmaster_ajax(load_more); 658 load_more.css('display', 'none').slideDown(100); 659 660 ajax_section.remove(); 661 }else{ 662 ajax_section.slideUp(100, function(){ $(this).remove(); }); 663 } 664 } 665 666 }else if( ajax_section.attr('data-target-action') == 'replace' ){ 667 var content = $(data.content); 668 669 ajax_section.siblings('.' + ajax_section.attr('data-target')).each(function(){ 670 var fix_height = false; 671 var current_height = $(this).height(); 672 $(this).empty().append(content); 673 content.tourmaster_flexslider().tourmaster_set_image_height(); 674 675 if( typeof($.fn.gdlr_core_animate_list_item) == 'function' ){ 676 content.gdlr_core_animate_list_item(); 677 } 678 679 var new_height = $(this).height(); 680 $(this).css({height:current_height, opacity:1}).animate({'height':new_height}, {'duration':400, 'easing':'easeOutExpo', 'complete': function(){ 681 if( !fix_height ){ $(this).css('height',''); } 682 }}); 683 }); 684 685 // pagination 686 if( data.pagination ){ 687 if( ajax_section.is('.tourmaster-pagination, .gdlr-core-pagination') ){ 688 ajax_section.slideUp(100, function(){ $(this).remove(); }); 689 }else{ 690 ajax_section.siblings('.tourmaster-pagination, .gdlr-core-pagination').slide
690Up(100, function(){ $(this).remove(); }); 691 } 692 693 if( data.pagination != 'none' ){ 694 var pagination = $(data.pagination); 695 ajax_section.parent().append(pagination); 696 pagination.tourmaster_ajax(pagination); 697 pagination.css('display', 'none').slideDown(100); 698 } 699 } 700 701 // load more button 702 if( data.load_more ){ 703 ajax_section.siblings('.tourmaster-load-more-wrap, .gdlr-core-load-more-wrap').slideUp(100, function(){ $(this).remove(); }); 704 705 if( data.load_more != 'none' ){ 706 var load_more = $(data.load_more); 707 ajax_section.parent().append(load_more); 708 load_more.tourmaster_ajax(load_more); 709 load_more.css('display', 'none').slideDown(100); 710 } 711 } 712 713 } 714 } 715 716 if( typeof(data.settings) != 'undefined' ){ 717 ajax_section.data('settings', data.settings); 718 } 719 }else{ 720 console.log(data); 721 } 722 } 723 }); 724 725 } // tourmaster_ajax_action 726 727 728 $.fn.tourmaster_lightgallery = function(){ 729 730 // ilightbox 731 var lightgallery = $(this); 732 var lightbox_groups = []; 733 734 lightgallery.each(function(){ 735 if( $(this).attr('data-lightbox-group') ){ 736 if( lightbox_groups.indexOf($(this).attr('data-lightbox-group')) == -1 ){ 737 lightbox_groups.push($(this).attr('data-lightbox-group')); 738 } 739 }else{ 740 $(this).lightGallery({ selector: 'this' }); 741 } 742 }); 743 744 for( var key in lightbox_groups ){ 745 var group_selector = '.tourmaster-lightgallery[data-lightbox-group="' + lightbox_groups[key] + '"]'; 746 747 lightgallery.filter(group_selector).first().lightGallery({ 748 selector: group_selector, 749 selectWithin: 'body', 750 thumbnail: false 751 }); 752 } 753 754 // lightbox gallery 755 if( typeof(filter_elem) == 'undefined' ){ 756 var gallery_lb = $(this).find('[data-gallery-lb]'); 757 }else{ 758 var gallery_lb = filter_elem.filter('[data-gallery-lb]'); 759 } 760 761 gallery_lb.click(function(){ 762 $(this).lightGallery({ 763 dynamic: true, 764 dynamicEl: $(this).data('gallery-lb'), 765 thumbnail: false 766 }); 767 768 return false; 769 }); 770 771 return $(this); 772 } 773 774 $.fn.tourmaster_ajax = function( filter_elem ){ 775 776 if( typeof(filter_elem) == 'undefined' ){ 777 var elem = $(this).find('[data-tm-ajax]'); 778 }else{ 779 var elem = filter_elem.filter('[data-tm-ajax]'); 780 } 781 782 elem.each(function(){ 783 784 var ajax_section = $(this); 785 786 // button click 787 $(this).on('click', 'a', function(){ 788 if( $(this).hasClass('tourmaster-active') ){ 789 return false; 790 } 791 792 $(this).addClass('tourmaster-active').siblings().removeClass('tourmaster-active'); 793 794 var name = $(this).attr('data-ajax-name'); 795 var value = $(this).attr('data-ajax-value'); 796 797 tourmaster_ajax_action(ajax_section, name, value); 798 799 return false; 800 }); 801 802 // filter changed 803 $(this).on('change', 'select', function(){ 804 var name = $(this).attr('data-ajax-name'); 805 var value = $(this).val(); 806 807 tourmaster_ajax_action(ajax_section, name, value); 808 }); 809 810 }); 811 812 } // tourmaster_ajax 813 814 // on document ready 815 $(document).ready(function(){ 816 817 var body = $('body'); 818 819 // ajax action 820 body.tourmaster_ajax(); 821 822 // video bg 823 $('.tourmaster-background-video-wrap').tourmaster_video_background(); 824 825 // confirm button 826 $('[data-confirm]').click(function(){ 827 var confirm_button = $(this); 828 829 tourmaster_front_confirm_box({ 830 head: confirm_button.attr('data-confirm'), 831 text: confirm_button.attr('data-confirm-text'), 832 sub: confirm_button.attr('data-confirm-sub'), 833 yes: confirm_button.attr('data-confirm-yes'), 834 no: confirm_button.attr('data-confirm-no'), 835 success: function(){ 836 window.location.href = confirm_button.attr('href'); 837 } 838 }); 839 840 return false; 841 }); 842 843 // lightbox popup 844 $('[data-tmlb]').tourmaster_bind_lightbox(); 845 846 // register form 847 $('.tourmaster-register-form').submit(function(){ 848 var condition_accepted_input = $(this).find('[name="tourmaster-require-acceptance"]'); 849 850 if( !condition_accepted_input.is(':checked') ){ 851 condition_accepted_input.siblings('.tourmaster-notification-box').slideDown(150); 852 return false;
853 }else{ 854 condition_accepted_input.siblings('.tourmaster-notification-box').slideUp(150); 855 } 856 }); 857 858 // top bar script 859 $('.tourmaster-user-top-bar').each(function(){ 860 // if login 861 if( $(this).hasClass('tourmaster-user') ){ 862 var top_bar_nav = $(this).children('.tourmaster-user-top-bar-nav').children('.tourmaster-user-top-bar-nav-inner'); 863 864 $(this).hover(function(){ 865 top_bar_nav.fadeIn(200); 866 }, function(){ 867 top_bar_nav.fadeOut(200); 868 }) 869 } 870 }); 871 872 // currency switcher 873 $('.tourmaster-currency-switcher').each(function(){ 874 var currency_inner = $(this).children('.tourmaster-currency-switcher-inner'); 875 $(this).hover(function(){ 876 currency_inner.fadeIn(200); 877 }, function(){ 878 currency_inner.fadeOut(200); 879 }) 880 }); 881 882 // refresh login bar 883 $('.tourmaster-user-top-bar.tourmaster-refresh').each(function(){ 884 var user_top_bar = $(this); 885 886 $.ajax({ 887 type: 'POST', 888 url: user_top_bar.attr('data-ajax-url'), 889 data: { action: 'refresh_user_top_bar', redirect: user_top_bar.attr('data-redirect') }, 890 dataType: 'json', 891 success: function(data){ 892 if( typeof(data.content) != 'undefined' ){ 893 var new_top_bar = $(data.content); 894 user_top_bar.replaceWith(new_top_bar); 895 896 // bind lightbox action 897 new_top_bar.find('[data-tmlb]').tourmaster_bind_lightbox(); 898 899 // bind top bar nav 900 if( new_top_bar.hasClass('tourmaster-user') ){ 901 var top_bar_nav = new_top_bar.children('.tourmaster-user-top-bar-nav').children('.tourmaster-user-top-bar-nav-inner'); 902 903 new_top_bar.hover(function(){ 904 top_bar_nav.fadeIn(200); 905 }, function(){ 906 top_bar_nav.fadeOut(200); 907 }) 908 } 909 } 910 } 911 }); 912 }); 913 914 if( body.hasClass('tourmaster-template-register') ){ 915 916 // age combobox set 917 tourmaster_form_script(); 918 919 }else if( body.hasClass('tourmaster-template-user') ){ 920 921 // age combobox set 922 tourmaster_form_script(); 923 924 // print html script 925 $('.tourmaster-print').click(function(){ 926 var printed_id = $(this).attr('data-id'); 927 if( printed_id ){ 928 var printed_content = $($('#' + printed_id).html()); 929 $('body').children().css('display', 'none'); 930 $('body').append(printed_content); 931 window.print(); 932 printed_content.remove(); 933 $('body').children().css('display', ''); 934 } 935 }); 936 937 // upload preview 938 $('input[name="profile-image"]').on('change', function(e){ 939 var temp_image = $(this).closest('label').siblings('img'); 940 941 if( e.target.files && e.target.files[0] ){ 942 var reader = new FileReader(); 943 reader.onload = function(e_reader){ 944 temp_image.attr('src', e_reader.target.result); 945 temp_image.attr('srcset', ''); 946 } 947 reader.readAsDataURL(e.target.files[0]); 948 } 949 }); 950 951 // deposit item expand 952 $('.tourmaster-deposit-item-head').on('click', function(){ 953 var item = $(this).parent(); 954 955 if( item.hasClass('tourmaster-active') ){ 956 $(this).siblings('.tourmaster-deposit-item-content').css({'display': 'block'}).slideUp(150); 957 item.removeClass('tourmaster-active'); 958 }else{ 959 $(this).siblings('.tourmaster-deposit-item-content').slideDown(150); 960 item.addClass('tourmaster-active'); 961 } 962 }); 963 964 } 965 966 }); // document.ready 967 968 // responsive video 969 $.fn.gdlr_core_fluid_video = function( filter_elem ){ 970 971 if( typeof(filter_elem) == 'undefined' ){ 972 var elem = $(this).find('iframe[src*="youtube"], iframe[src*="vimeo"]'); 973 }else{ 974 var elem = filter_elem.filter('iframe[src*="youtube"], iframe[src*="vimeo"]'); 975 } 976 977 elem.each(function(){ 978 979 // ignore if inside slider 980 if( $(this).closest('.ls-container, .master-slider').length <= 0 ){ 981 if( ($(this).is('embed') && $(this).parent('object').length) || $(this).parent('.gdlr-core-fluid-video-wrapper').length ){ return; } 982 if( !$(this).attr('id') ){ $(this).attr('id', 'gdlr-video-' + Math.floor(Math.random()*999999)); } 983 984 var ratio = $(this).height() / $(this).width(); 985 $(this).removeAttr('height').removeAttr('width'); 986 987 try{
988 $(this).wrap('<div class="gdlr-core-fluid-video-wrapper"></div>').parent().css('padding-top', (ratio * 100)+"%"); 989 $(this).attr('src', $(this).attr('src')); 990 }catch(e){} 991 } 992 }); 993 994 return $(this); 995 } 996 997 // gdlr core sync height 998 if( typeof(window.gdlr_core_sync_height) != 'function' ){ 999 1000 window.gdlr_core_sync_height = function( container, filter_elem ){ 1001 1002 // for half height item 1003 this.set_half_height(container); 1004 1005 // sync height 1006 if( typeof(window.gdlr_core_sync_height_elem) != 'undefined' ){ 1007 window.gdlr_core_sync_height_elem.reinit(); 1008 return; 1009 } 1010 window.gdlr_core_sync_height_elem = this; 1011 1012 if( typeof(filter_elem) == 'undefined' ){ 1013 this.elements = container.find('[data-sync-height]'); 1014 }else{ 1015 this.elements = filter_elem.filter('[data-sync-height]'); 1016 } 1017 1018 this.elements_group = []; 1019 this.container = container; 1020 this.init(); 1021 } 1022 gdlr_core_sync_height.prototype = { 1023 1024 init: function(){ 1025 1026 var t = this; 1027 t.group_elements(); 1028 t.set_height(); 1029 1030 $(window).on('load resize gdlr-core-element-resize', function(){ t.set_height(); }); 1031 }, 1032 1033 reinit: function(){ 1034 1035 if( !this.container.is('body, .gdlr-core-page-builder-body') ){ 1036 this.container = this.container.closest('.gdlr-core-page-builder-body'); 1037 } 1038 1039 this.elements = this.container.find('[data-sync-height]'); 1040 this.group_elements(); 1041 this.set_height(); 1042 1043 }, 1044 1045 group_elements: function(){ 1046 1047 var t = this; 1048 1049 // do flipbox first 1050 t.elements.filter('.gdlr-core-flipbox-front, .gdlr-core-feature-box').each(function(){ 1051 if( t.elements_group.indexOf($(this).attr('data-sync-height')) == -1 ){ 1052 t.elements_group.push($(this).attr('data-sync-height')); 1053 } 1054 }); 1055 1056 // do the rest elements 1057 t.elements.each(function(){ 1058 if( t.elements_group.indexOf($(this).attr('data-sync-height')) == -1 ){ 1059 t.elements_group.push($(this).attr('data-sync-height')); 1060 } 1061 }); 1062 }, 1063 1064 set_height: function(){ 1065 1066 var t = this; 1067 1068 // revert to default value 1069 t.elements.css('height', 'auto').children('.gdlr-core-sync-height-pre-spaces').remove(); 1070 t.elements.find('.gdlr-core-sync-height-offset').remove(); 1071 1072 var sync_element = t.elements; 1073 if( tourmaster_display == 'mobile-landscape' || tourmaster_display == 'mobile-portrait' ){ 1074 sync_element = sync_element.filter('.gdlr-core-flipbox-front, .gdlr-core-flipbox-back, .gdlr-core-hover-content-front, .gdlr-core-hover-content-back'); 1075 } 1076 1077 // setting the height by each group 1078 for( var key in t.elements_group ){ 1079 var max_height = 0; 1080 1081 // determine max height 1082 sync_element.filter('[data-sync-height="' + t.elements_group[key] + '"]').each(function(){ 1083 if( $(this).outerHeight() > max_height ){ 1084 max_height = $(this).outerHeight(); 1085 } 1086 }); 1087 1088 // set the height 1089 sync_element.filter('[data-sync-height="' + t.elements_group[key] + '"]').each(function(){ 1090 1091 // set the offset space to the bottom 1092 var offset = parseInt(max_height - $(this).outerHeight()); 1093 var offset_item = $(this).find('[data-sync-height-offset]'); 1094 if( offset_item.length && offset > 0 ){ 1095 $('<div class="gdlr-core-sync-height-offset" ></div>').css('height', offset).insertBefore(offset_item); 1096 } 1097 1098 $(this).css('height', max_height); 1099 1100 // flipbox 1101 if( $(this).hasClass('gdlr-core-flipbox-front') ){ 1102 $(this).parent().css('height', max_height); 1103 } 1104 1105 // center the content if selected 1106 if( $(this).is('[data-sync-height-center]') ){ 1107 var content = $(this).children('.gdlr-core-sync-height-content'); 1108 1109 // determine top padding for centering content 1110 var padding_top = max_height; 1111 if( content.length > 0 ){ 1112 padding_top -= content.outerHeight(); 1113 }else{ 1114 $(this).children().each(function(){ 1115 padding_top -= $(this).outerHeight(); 1116 }); 1117 } 1118 padding_top = padding_top / 2; 1119 padding_top = padding_top - (parseInt($(this).css('padding-top')) + parseInt($(this).css('border-top-width'))); 1120 1121 // insert the spaces 1122 if( padding_top > 0 ){ 1123 var spaces_item = $('<div class="gdlr-core-sync-height-pre-spaces" ></div>').css('padding-top', padding_top); 1124 var space_position = $(this).children('.gdlr-core-sync-height-space-position'); 1125 if( space_position.length > 0 ){
1126 spaces_item.insertBefore(space_position); 1127 }else{ 1128 $(this).prepend(spaces_item); 1129 } 1130 } 1131 } 1132 1133 }); 1134 } 1135 1136 }, 1137 1138 set_half_height: function( container ){ 1139 1140 container.find('.gdlr-core-half-height').each(function(){ 1141 var temp = $(this); 1142 if( !gdlr_core_mobile && (tourmaster_display == 'tablet' || tourmaster_display == 'desktop') ){ 1143 var temp_height = temp.outerHeight(); 1144 temp.gdlr_core_set_image_height(); 1145 temp.css('height', temp_height / 2); 1146 temp.find('img').css('margin-top', -temp_height/4); 1147 } 1148 $(window).on('load resize', function(){ 1149 temp.css('height', 'auto'); 1150 temp.find('img').css('margin-top', '0'); 1151 if( !gdlr_core_mobile && (tourmaster_display == 'tablet' || tourmaster_display == 'desktop') ){ 1152 temp_height = temp.outerHeight(); 1153 temp.gdlr_core_set_image_height(); 1154 temp.css('height', temp_height / 2); 1155 temp.find('img').css('margin-top', -temp_height/4); 1156 } 1157 }); 1158 }); 1159 1160 } 1161 1162 }; // gdlr_core_sync_height.prototype 1163 1164 } 1165 1166 1167 $(document).ready(function(){ 1168 $('body').gdlr_core_fluid_video(); 1169 1170 $('.tourmaster-lightgallery').tourmaster_lightgallery(); 1171 }); 1172 1173 $(window).on('load', function(){ 1174 var body = $('body'); 1175 1176 // flexslider 1177 body.tourmaster_set_flexslider(); 1178 }); 1179 1180})(jQuery); 1181 1182/*! Froogaloop for vimeo api 1183* http://a.vimeocdn.com/js/froogaloop2.min.js */ 1184var Froogaloop=function(){function e(a){return new e.fn.init(a)}function g(a,c,b){if(!b.contentWindow.postMessage)return!1;a=JSON.stringify({method:a,value:c});b.contentWindow.postMessage(a,h)}function l(a){var c,b;try{c=JSON.parse(a.data),b=c.event||c.method}catch(e){}"ready"!=b||k||(k=!0);if(!/^https?:\/\/player.vimeo.com/.test(a.origin))return!1;"*"===h&&(h=a.origin);a=c.value;var m=c.data,f=""===f?null:c.player_id;c=f?d[f][b]:d[b];b=[];if(!c)return!1;void 0!==a&&b.push(a);m&&b.push(m);f&&b.push(f); return 0<b.length?c.apply(null,b):c.call()}function n(a,c,b){b?(d[b]||(d[b]={}),d[b][a]=c):d[a]=c}var d={},k=!1,h="*";e.fn=e.prototype={element:null,init:function(a){"string"===typeof a&&(a=document.getElementById(a));this.element=a;return this},api:function(a,c){if(!this.element||!a)return!1;var b=this.element,d=""!==b.id?b.id:null,e=c&&c.constructor&&c.call&&c.apply?null:c,f=c&&c.constructor&&c.call&&c.apply?c:null;f&&n(a,f,d);g(a,e,b);return this},addEvent:function(a,c){if(!this.element)return!1; var b=this.element,d=""!==b.id?b.id:null;n(a,c,d);"ready"!=a?g("addEventListener",a,b):"ready"==a&&k&&c.call(null,d);return this},removeEvent:function(a){if(!this.element)return!1;var c=this.element,b=""!==c.id?c.id:null;a:{if(b&&d[b]){if(!d[b][a]){b=!1;break a}d[b][a]=null}else{if(!d[a]){b=!1;break a}d[a]=null}b=!0}"ready"!=a&&b&&g("removeEventListener",a,c)}};e.fn.init.prototype=e.fn;window.addEventListener?window.addEventListener("message",l,!1):window.attachEvent("onmessage",l);return window.Froogaloop=window.$f=e}(); 1185 1186// flexslider 1187!function(e){var t=!0;e.tourmaster_flexslider=function(a,n){var i=e(a);i.vars=e.extend({},e.tourmaster_flexslider.defaults,n);var r,s=i.vars.namespace,o=window.navigator&&window.navigator.msPointerEnabled&&window.MSGesture,l=("ontouchstart"in window||o||window.DocumentTouch&&document instanceof DocumentTouch)&&i.vars.touch,c="click touchend MSPointerUp keyup",d="",u="vertical"===i.vars.direction,v=i.vars.reverse,p=i.vars.itemWidth>0,m="fade"===i.vars.animation,f=""!==i.vars.asNavFor,h={};e.data(a,"tourmaster_flexslider",i),h={init:function(){i.animating=!1,i.currentSlide=parseInt(i.vars.startAt?i.vars.startAt:0,10),isNaN(i.currentSlide)&&(i.currentSlide=0),i.animatingTo=i.currentSlide,i.atEnd=0===i.currentSlide||i.currentSlide===i.last,i.containerSelector=i.vars.selector.substr(0,i.vars.selector.search(" ")),i.slides=e(i.vars.selector,i),i.container=e(i.containerSelector,i),i.count=i.slides.length,i.syncExists=e(i.vars.sync).length>0,"slide"===i.vars.animation&&(i.vars.animation="swing"),i.prop=u?"top":"marginLeft",i.args={},i.manualPause=!1,i.stopped=!1,i.started=!1,i.startTimeout=null,i.transitions=!i.vars.video&&!m&&i.vars.useCSS&&function(){var e=document.createElement("div"),t=["perspectiveProperty","WebkitPerspective","MozPerspective","OPerspective","msPerspective"];for(var a in t)if(void 0!==e.style[t[a]])return i.pfx=t[a].replace("Perspective","").toLowerCase(),i.prop="-"+i.pfx+"-transform",!0;return!1}
1187(),i.ensureAnimationEnd="",""!==i.vars.controlsContainer&&(i.controlsContainer=e(i.vars.controlsContainer).length>0&&e(i.vars.controlsContainer)),""!==i.vars.manualControls&&(i.manualControls=e(i.vars.manualControls).length>0&&e(i.vars.manualControls)),""!==i.vars.customDirectionNav&&(i.customDirectionNav=2===e(i.vars.customDirectionNav).length&&e(i.vars.customDirectionNav)),i.vars.randomize&&(i.slides.sort(function(){return Math.round(Math.random())-.5}),i.container.empty().append(i.slides)),i.doMath(),i.setup("init"),i.vars.controlNav&&h.controlNav.setup(),i.vars.directionNav&&h.directionNav.setup(),i.vars.keyboard&&(1===e(i.containerSelector).length||i.vars.multipleKeyboard)&&e(document).bind("keyup",function(e){var t=e.keyCode;if(!i.animating&&(39===t||37===t)){var a=39===t?i.getTarget("next"):37===t&&i.getTarget("prev");i.flexAnimate(a,i.vars.pauseOnAction)}}),i.vars.mousewheel&&i.bind("mousewheel",function(e,t,a,n){e.preventDefault();var r=t<0?i.getTarget("next"):i.getTarget("prev");i.flexAnimate(r,i.vars.pauseOnAction)}),i.vars.pausePlay&&h.pausePlay.setup(),i.vars.slideshow&&i.vars.pauseInvisible&&h.pauseInvisible.init(),i.vars.slideshow&&(i.vars.pauseOnHover&&i.hover(function(){i.manualPlay||i.manualPause||i.pause()},function(){i.manualPause||i.manualPlay||i.stopped||i.play()}),i.vars.pauseInvisible&&h.pauseInvisible.isHidden()||(i.vars.initDelay>0?i.startTimeout=setTimeout(i.play,i.vars.initDelay):i.play())),f&&h.asNav.setup(),l&&i.vars.touch&&h.touch(),(!m||m&&i.vars.smoothHeight)&&e(window).bind("resize orientationchange focus",h.resize),i.find("img").attr("draggable","false"),setTimeout(function(){i.vars.start(i)},200)},asNav:{setup:function(){i.asNav=!0,i.animatingTo=Math.floor(i.currentSlide/i.move),i.currentItem=i.currentSlide,i.slides.removeClass(s+"active-slide").eq(i.currentItem).addClass(s+"active-slide"),o?(a._slider=i,i.slides.each(function(){var t=this;t._gesture=new MSGesture,t._gesture.target=t,t.addEventListener("MSPointerDown",function(e){e.preventDefault(),e.currentTarget._gesture&&e.currentTarget._gesture.addPointer(e.pointerId)},!1),t.addEventListener("MSGestureTap",function(t){t.preventDefault();var a=e(this),n=a.index();e(i.vars.asNavFor).data("tourmaster_flexslider").animating||a.hasClass("active")||(i.direction=i.currentItem<n?"next":"prev",i.flexAnimate(n,i.vars.pauseOnAction,!1,!0,!0))})})):i.slides.on(c,function(t){t.preventDefault();var a=e(this),n=a.index();a.offset().left-e(i).scrollLeft()<=0&&a.hasClass(s+"active-slide")?i.flexAnimate(i.getTarget("prev"),!0):e(i.vars.asNavFor).data("tourmaster_flexslider").animating||a.hasClass(s+"active-slide")||(i.direction=i.currentItem<n?"next":"prev",i.flexAnimate(n,i.vars.pauseOnAction,!1,!0,!0))})}},controlNav:{setup:function(){i.manualControls?h.controlNav.setupManual():h.controlNav.setupPaging()},setupPaging:function(){var t,a,n="thumbnails"===i.vars.controlNav?"control-thumbs":"control-paging",r=1;if(i.controlNavScaffold=e('<ol class="'+s+"control-nav "+s+n+'"></ol>'),i.pagingCount>1)for(var o=0;o<i.pagingCount;o++){if(void 0===(a=i.slides.eq(o)).attr("data-thumb-alt")&&a.attr("data-thumb-alt",""),altText=""!==a.attr("data-thumb-alt")?altText=' alt="'+a.attr("data-thumb-alt")+'"':"",t="thumbnails"===i.vars.controlNav?'<img src="'+a.attr("data-thumb")+'"'+altText+"/>":'<a href="#">'+r+"</a>","thumbnails"===i.vars.controlNav&&!0===i.vars.thumbCaptions){var l=a.attr("data-thumbcaption");""!==l&&void 0!==l&&(t+='<span class="'+s+'caption">'+l+"</span>")}i.controlNavScaffold.append("<li>"+t+"</li>"),r++}i.controlsContainer?e(i.controlsContainer).append(i.controlNavScaffold):i.append(i.controlNavScaffold),h.controlNav.set(),h.controlNav.active(),i.controlNavScaffold.delegate("a, img",c,function(t){if(t.preventDefault(),""===d||d===t.type){var a=e(this),n=i.controlNav.index(a);a.hasClass(s+"active")||(i.direction=n>i.currentSlide?"next":"prev",i.flexAnimate(n,i.vars.pauseOnAction))}""===d&&(d=t.type),h.setToClearWatchedEvent()})},setupManual:function(){i.controlNav=i.manualControls,h.controlNav.active(),i.controlNav.bind(c,function(t){if(t.preventDefault(),""===d||d===t.type){var a=e(this),n=i.
vendor: 12,688 bytes, line 1187
1187controlNav.index(a);a.hasClass(s+"active")||(n>i.currentSlide?i.direction="next":i.direction="prev",i.flexAnimate(n,i.vars.pauseOnAction))}""===d&&(d=t.type),h.setToClearWatchedEvent()})},set:function(){var t="thumbnails"===i.vars.controlNav?"img":"a";i.controlNav=e("."+s+"control-nav li "+t,i.controlsContainer?i.controlsContainer:i)},active:function(){i.controlNav.removeClass(s+"active").eq(i.animatingTo).addClass(s+"active")},update:function(t,a){i.pagingCount>1&&"add"===t?i.controlNavScaffold.append(e('<li><a href="#">'+i.count+"</a></li>")):1===i.pagingCount?i.controlNavScaffold.find("li").remove():i.controlNav.eq(a).closest("li").remove(),h.controlNav.set(),i.pagingCount>1&&i.pagingCount!==i.controlNav.length?i.update(a,t):h.controlNav.active()}},directionNav:{setup:function(){var t=e('<ul class="'+s+'direction-nav"><li class="'+s+'nav-prev"><a class="'+s+'prev" href="#">'+i.vars.prevText+'</a></li><li class="'+s+'nav-next"><a class="'+s+'next" href="#">'+i.vars.nextText+"</a></li></ul>");i.customDirectionNav?i.directionNav=i.customDirectionNav:i.controlsContainer?(e(i.controlsContainer).append(t),i.directionNav=e("."+s+"direction-nav li a",i.controlsContainer)):(i.append(t),i.directionNav=e("."+s+"direction-nav li a",i)),h.directionNav.update(),i.directionNav.bind(c,function(t){t.preventDefault();var a;""!==d&&d!==t.type||(a=e(this).hasClass(s+"next")?i.getTarget("next"):i.getTarget("prev"),i.flexAnimate(a,i.vars.pauseOnAction)),""===d&&(d=t.type),h.setToClearWatchedEvent()})},update:function(){var e=s+"disabled";1===i.pagingCount?i.directionNav.addClass(e).attr("tabindex","-1"):i.vars.animationLoop?i.directionNav.removeClass(e).removeAttr("tabindex"):0===i.animatingTo?i.directionNav.removeClass(e).filter("."+s+"prev").addClass(e).attr("tabindex","-1"):i.animatingTo===i.last?i.directionNav.removeClass(e).filter("."+s+"next").addClass(e).attr("tabindex","-1"):i.directionNav.removeClass(e).removeAttr("tabindex")}},pausePlay:{setup:function(){var t=e('<div class="'+s+'pauseplay"><a href="#"></a></div>');i.controlsContainer?(i.controlsContainer.append(t),i.pausePlay=e("."+s+"pauseplay a",i.controlsContainer)):(i.append(t),i.pausePlay=e("."+s+"pauseplay a",i)),h.pausePlay.update(i.vars.slideshow?s+"pause":s+"play"),i.pausePlay.bind(c,function(t){t.preventDefault(),""!==d&&d!==t.type||(e(this).hasClass(s+"pause")?(i.manualPause=!0,i.manualPlay=!1,i.pause()):(i.manualPause=!1,i.manualPlay=!0,i.play())),""===d&&(d=t.type),h.setToClearWatchedEvent()})},update:function(e){"play"===e?i.pausePlay.removeClass(s+"pause").addClass(s+"play").html(i.vars.playText):i.pausePlay.removeClass(s+"play").addClass(s+"pause").html(i.vars.pauseText)}},touch:function(){var e,t,n,r,s,l,c,d,f,h=!1,g=0,S=0,x=0;o?(a.style.msTouchAction="none",a._gesture=new MSGesture,a._gesture.target=a,a.addEventListener("MSPointerDown",function(e){e.stopPropagation(),i.animating?e.preventDefault():(i.pause(),a._gesture.addPointer(e.pointerId),x=0,r=u?i.h:i.w,l=Number(new Date),n=p&&v&&i.animatingTo===i.last?0:p&&v?i.limit-(i.itemW+i.vars.itemMargin)*i.move*i.animatingTo:p&&i.currentSlide===i.last?i.limit:p?(i.itemW+i.vars.itemMargin)*i.move*i.currentSlide:v?(i.last-i.currentSlide+i.cloneOffset)*r:(i.currentSlide+i.cloneOffset)*r)},!1),a._slider=i,a.addEventListener("MSGestureChange",function(e){e.stopPropagation();var t=e.target._slider;if(t){var i=-e.translationX,o=-e.translationY;s=x+=u?o:i,h=u?Math.abs(x)<Math.abs(-i):Math.abs(x)<Math.abs(-o),e.detail!==e.MSGESTURE_FLAG_INERTIA?(!h||Number(new Date)-l>500)&&(e.preventDefault(),!m&&t.transitions&&(t.vars.animationLoop||(s=x/(0===t.currentSlide&&x<0||t.currentSlide===t.last&&x>0?Math.abs(x)/r+2:1)),t.setProps(n+s,"setTouch"))):setImmediate(function(){a._gesture.stop()})}},!1),a.addEventListener("MSGestureEnd",function(a){a.stopPropagation();var i=a.target._slider;if(i){if(i.animatingTo===i.currentSlide&&!h&&null!==s){var o=v?-s:s,c=o>0?i.getTarget("next"):i.getTarget("prev");i.canAdvance(c)&&(Number(new Date)-l<550&&Math.abs(o)>50||Math.abs(o)>r/2)?i.flexAnimate(c,i.vars.pauseOnAction):m||i.flexAnimate(i.currentSlide,i.vars.pauseOnAction,!0)}e=null,t=null,s=null,n=null,x=0}},!1)):(c=function(s){i.animating?s.preventDefault():(window.navigator.msPointerEnabled||1===s.touches.length)&&(i.pause(),r=u?i.h:i.w,l=Number(new Date),g=s.touches[0].pageX,S=s.touches[0].pageY,n=p&&v&&i.animatingTo===i.last?0:p&&v?i.limit-(i.itemW+i.vars.itemMargin)*i.move*i.animatingTo:p&&i.currentSlide===i.last?i.limit:p?(i.itemW+i.vars.itemMargin)*i.move*i.currentSlide:v?(i.last-i.currentSlide+i.cloneOffset)*r:(i.currentSlide+i.cloneOffset)*r,e=u?S:g,t=u?g:S,a.addEventListener("touchmove",d,!1),a.addEventListener("touchend",f,!1))},d=function(a){g=a.touches[0].pageX,S=a.touches[0].pageY,s=u?e-S:e-g;(!(h=u?Math.abs(s)<Math.abs(g-t):Math.abs(s)<Math.abs(S-t))||Number(new Date)-l>500)&&(a.preventDefault(),!m&&i.transitions&&(i.vars.animationLoop||(s/=0===i.currentSlide&&s<0||i.currentSlide===i.last&&s>0?Math.abs(s)/r+2:1),i.setProps(n+s,"setTouch")))},f=function(o){if(a.removeEventListener("touchmove",d,!1),i.animatingTo===i.currentSlide&&!h&&null!==s){var c=v?-s:s,u=c>0?i.getTarget("next"):i.getTarget("prev");i.canAdvance(u)&&(Number(new Date)-l<550&&Math.abs(c)>50||Math.abs(c)>r/2)?i.flexAnimate(u,i.vars.pauseOnAction):m||i.flexAnimate(i.currentSlide,i.vars.pauseOnAction,!0)}a.removeEventListener("touchend",f,!1),e=null,t=null,s=null,n=null},a.addEventListener("touchstart",c,!1))},resize:function(){!i.animating&&i.is(":visible")&&(p||i.doMath(),m?h.smoothHeight():p?(i.slides.width(i.computedW),i.update(i.pagingCount),i.setProps()):u?(i.viewport.height(i.h),i.setProps(i.h,"setTotal")):(i.vars.smoothHeight&&h.smoothHeight(),i.newSlides.width(i.computedW),i.setProps(i.computedW,"setTotal")))},smoothHeight:function(e){if(!u||m){var t=m?i:i.viewport;e?t.animate({height:i.slides.eq(i.animatingTo).height()},e):t.height(i.slides.eq(i.animatingTo).height())}},sync:function(t){var a=e(i.vars.sync).data("tourmaster_flexslider"),n=i.animatingTo;switch(t){case"animate":a.flexAnimate(n,i.vars.pauseOnAction,!1,!0);break;case"play":a.playing||a.asNav||a.play();break;case"pause":a.pause()}},uniqueID:function(t){return t.filter("[id]").add(t.find("[id]")).each(function(){var t=e(this);t.attr("id",t.attr("id")+"_clone")}),t},pauseInvisible:{visProp:null,init:function(){var e=h.pauseInvisible.getHiddenProp();if(e){var t=e.replace(/[H|h]idden/,"")+"visibilitychange";document.addEventListener(t,function(){h.pauseInvisible.isHidden()?i.startTimeout?clearTimeout(i.startTimeout):i.pause():i.started?i.play():i.vars.initDelay>0?setTimeout(i.play,i.vars.initDelay):i.play()})}},isHidden:function(){var e=h.pauseInvisible.getHiddenProp();return!!e&&document[e]},getHiddenProp:function(){var e=["webkit","moz","ms","o"];if("hidden"in document)return"hidden";for(var t=0;t<e.length;t++)if(e[t]+"Hidden"in document)return e[t]+"Hidden";return null}},setToClearWatchedEvent:function(){clearTimeout(r),r=setTimeout(function(){d=""},3e3)}},i.flexAnimate=function(t,a,n,r,o){if(i.vars.animationLoop||t===i.currentSlide||(i.direction=t>i.currentSlide?"next":"prev"),f&&1===i.pagingCount&&(i.direction=i.currentItem<t?"next":"prev"),!i.animating&&(i.canAdvance(t,o)||n)&&i.is(":visible")){if(f&&r){var c=e(i.vars.asNavFor).data("tourmaster_flexslider");if(i.atEnd=0===t||t===i.count-1,c.flexAnimate(t,!0,!1,!0,o),i.direction=i.currentItem<t?"next":"prev",c.direction=i.direction,Math.ceil((t+1)/i.visible)-1===i.currentSlide||0===t)return i.currentItem=t,i.slides.removeClass(s+"active-slide").eq(t).addClass(s+"active-slide"),!1;i.currentItem=t,i.slides.removeClass(s+"active-slide").eq(t).addClass(s+"active-slide"),t=Math.floor(t/i.visible)}if(i.animating=!0,i.animatingTo=t,a&&i.pause(),i.vars.before(i),i.syncExists&&!o&&h.sync("animate"),i.vars.controlNav&&h.controlNav.active(),p||i.slides.removeClass(s+"active-slide").eq(t).addClass(s+"active-slide"),i.atEnd=0===t||t===i.last,i.vars.directionNav&&h.directionNav.update(),t===i.last&&(i.vars.end(i),i.vars.animationLoop||i.pause()),m)l?(i.slides.eq(i.currentSlide).css({opacity:0,zIndex:1}),i.slides.eq(t).css({opacity:1,zIndex:2}),i.wrapup(x)):(i.slides.eq(i.currentSlide).css({zIndex:1}).animate({opacity:0},i.vars.animationSpeed,i.vars.easing),i.slides.eq(t).css({zIndex:2}).animate({opacity:1},i.vars.animationSpeed,i.vars.easing,i.wrapup));else{var d,g,S,x=u?i.slides.filter(":first").height():i.computedW;p?(d=i.vars.itemMargin,g=(S=(i.itemW+d)*i.move*i.animatingTo)>i.limit&&1!==i.visible?i.limit:S):g=0===i.currentSlide&&t===i.count-1&&i.vars.animationLoop&&"next"!==i.direction?v?(i.count+i.cloneOffset)*x:0:i.currentSlide===i.last&&0===t&&i.vars.animationLoop&&"prev"!==i.direction?v?0:(i.count+1)*x:v?(i.count-1-t+i.cloneOffset)*x:(t+i.cloneOffset)*x,i.setProps(g,"",i.vars.animationSpeed),i.transitions?(i.vars.animationLoop&&i.atEnd||(i.animating=!1,i.currentSlide=i.animatingTo),i.container.unbind("webkitTransitionEnd transitionend"),i.container.bind("webkitTransitionEnd transitionend",function(){clearTimeout(i.ensureAnimationEnd),i.wrapup(x)}),clearTimeout(i.ensureAnimationEnd),i.ensureAnimationEnd=setTimeout(function(){i.wrapup(x)},i.vars.animationSpeed+100)):i.container.animate(i.args,i.vars.animationSpeed,i.vars.easing,function(){i.wrapup(x)})}i.vars.smoothHeight&&h.smoothHeight(i.vars.animationSpeed)}},i.wrapup=function(e){m||p||(0===i.currentSlide&&i.animatingTo===i.last&&i.vars.animationLoop?i.setProps(e,"jumpEnd"):i.currentSlide===i.last&&0===i.animatingTo&&i.vars.animationLoop&&i.setProps(e,"jumpStart")),i.animating=!1,i.currentSlide=i.animatingTo,i.vars.after(i)},i.animateSlides=function(){!i.animating&&t&&i.flexAnimate(i.getTarget("next"))},i.pause=function(){clearInterval(i.animatedSlides),i.animatedSlides=null,i.playing=!1,i.vars.pausePlay&&h.pausePlay.update("play"),i.syncExists&&h.sync("pause")},i.play=function(){i.playing&&clearInterval(i.animatedSlides),i.animatedSlides=i.animatedSlides||setInterval(i.animateSlides,i.vars.slideshowSpeed),i.started=i.playing=!0,i.vars.pausePlay&&h.pausePlay.update("pause"),i.syncExists&&h.sync("play")},i.stop=function(){i.pause(),i.stopped=!0},i.canAdvance=function(e,t){var a=f?i.pagingCount-1:i.last;return!!t||(!(!f||i.currentItem!==i.count-1||0!==e||"prev"!==i.direction)||(!f||0!==i.currentItem||e!==i.pagingCount-1||"next"===i.direction)&&(!(e===i.currentSlide&&!f)&&(!!i.vars.animationLoop||(!i.atEnd||0!==i.currentSlide||e!==a||"next"===i.direction)&&(!i.atEnd||i.currentSlide!==a||0!==e||"next"!==i.direction))))},i.getTarget=function(e){return i.direction=e,"next"===e?i.currentSlide===i.last?0:i.currentSlide+1:0===i.currentSlide?i.last:i.currentSlide-1},i.setProps=function(e,t,a){var n=function(){var a=e||(i.itemW+i.vars.itemMargin)*i.move*i.animatingTo;return-1*function(){if(p)return"setTouch"===t?e:v&&i.animatingTo===i.last?0:v?i.limit-(i.itemW+i.vars.itemMargin)*i.move*i.animatingTo:i.animatingTo===i.last?i.limit:a;switch(t){case"setTotal":return v?(i.count-1-i.currentSlide+i.cloneOffset)*e:(i.currentSlide+i.cloneOffset)*e;case"setTouch":return e;case"jumpEnd":return v?e:i.count*e;case"jumpStart":return v?i.count*e:e;default:return e}}()+"px"}();i.transitions&&(n=u?"translate3d(0,"+n+",0)":"translate3d("+n+",0,0)",a=void 0!==a?a/1e3+"s":"0s",i.container.css("-"+i.pfx+"-transition-duration",a),i.container.css("transition-duration",a)),i.args[i.prop]=n,(i.transitions||void 0===a)&&i.container.css(i.args),i.container.css("transform",n)},i.setup=function(t){if(m)i.slides.css({width:"100%",float:"left",marginRight:"-100%",position:"relative"}),"init"===t&&(l?i.slides.css({opacity:0,display:"block",webkitTransition:"opacity "+i.vars.animationSpeed/1e3+"s ease",zIndex:1}).eq(i.currentSlide).css({opacity:1,zIndex:2}):0==i.vars.fadeFirstSlide?i.slides.css({opacity:0,display:"block",zIndex:1}).eq(i.currentSlide).css({zIndex:2}).css({opacity:1}):i.slides.css({opacity:0,display:"block",zIndex:1}).eq(i.currentSlide).css({zIndex:2}).animate({opacity:1},i.vars.animationSpeed,i.vars.easing)),i.vars.smoothHeight&&h.smoothHeight();else{var a,n;"init"===t&&(i.viewport=e('<div class="'+s+'viewport"></div>').css({overflow:"hidden",position:"relative"}).appendTo(i).append(i.container),i.cloneCount=0,i.cloneOffset=0,v&&(n=e.makeArray(i.slides).reverse(),i.slides=e(n),i.container.empty().append(i.slides))),i.vars.animationLoop&&!p&&(i.cloneCount=2,i.cloneOffset=1,"init"!==t&&i.container.find(".clone").remove(),i.container.append(h.uniqueID(i.slides.first().clone().addClass("clone")).attr("aria-hidden","true")).prepend(h.uniqueID(i.slides.last().clone().addClass("clone")).attr("aria-hidden","true"))),i.newSlides=e(i.vars.selector,i),a=v?i.c
1187ount-1-i.currentSlide+i.cloneOffset:i.currentSlide+i.cloneOffset,u&&!p?(i.container.height(200*(i.count+i.cloneCount)+"%").css("position","absolute").width("100%"),setTimeout(function(){i.newSlides.css({display:"block"}),i.doMath(),i.viewport.height(i.h),i.setProps(a*i.h,"init")},"init"===t?100:0)):(i.container.width(200*(i.count+i.cloneCount)+"%"),i.setProps(a*i.computedW,"init"),setTimeout(function(){i.doMath(),i.newSlides.css({width:i.computedW,marginRight:i.computedM,float:"left",display:"block"}),i.vars.smoothHeight&&h.smoothHeight()},"init"===t?100:0))}p||i.slides.removeClass(s+"active-slide").eq(i.currentSlide).addClass(s+"active-slide"),i.vars.init(i)},i.doMath=function(){var t=i.slides.first(),a=i.vars.itemMargin,n=i.vars.minItems,r=i.vars.maxItems;"function"==typeof window.matchMedia?(window.matchMedia("(max-width: 767px)").matches&&(n=1,r=1),window.matchMedia("(max-width: 419px)").matches&&(n=1,r=1)):(e(window).innerWidth()<767&&(n=1,r=1),e(window).innerWidth()<419&&(n=1,r=1)),i.w=void 0===i.viewport?i.width():i.viewport.width(),i.h=t.height(),i.boxPadding=t.outerWidth()-t.width(),p?(i.itemT=i.vars.itemWidth+a,i.itemM=a,i.minW=n?n*i.itemT:i.w,i.maxW=r?r*i.itemT-a:i.w,i.itemW=i.minW>i.w?(i.w-a*(n-1))/n:i.maxW<i.w?(i.w-a*(r-1))/r:i.vars.itemWidth>i.w?i.w:i.vars.itemWidth,i.visible=Math.floor((i.w+i.itemM)/(i.itemW+i.itemM)),i.move=i.vars.move>0&&i.vars.move<i.visible?i.vars.move:i.visible,i.pagingCount=Math.ceil((i.count-i.visible)/i.move+1),i.last=i.pagingCount-1,i.limit=1===i.pagingCount?0:i.vars.itemWidth>
vendor: 2,836 bytes, line 1187
1187i.w?i.itemW*(i.count-1)+a*(i.count-1):(i.itemW+a)*i.count-i.w-a):(i.itemW=i.w,i.itemM=a,i.pagingCount=i.count,i.last=i.count-1),i.computedW=i.itemW-i.boxPadding,i.computedM=i.itemM},i.update=function(e,t){i.doMath(),p||(e<i.currentSlide?i.currentSlide+=1:e<=i.currentSlide&&0!==e&&(i.currentSlide-=1),i.animatingTo=i.currentSlide),i.vars.controlNav&&!i.manualControls&&("add"===t&&!p||i.pagingCount>i.controlNav.length?h.controlNav.update("add"):("remove"===t&&!p||i.pagingCount<i.controlNav.length)&&(p&&i.currentSlide>i.last&&(i.currentSlide-=1,i.animatingTo-=1),h.controlNav.update("remove",i.last))),i.vars.directionNav&&h.directionNav.update()},i.addSlide=function(t,a){var n=e(t);i.count+=1,i.last=i.count-1,u&&v?void 0!==a?i.slides.eq(i.count-a).after(n):i.container.prepend(n):void 0!==a?i.slides.eq(a).before(n):i.container.append(n),i.update(a,"add"),i.slides=e(i.vars.selector+":not(.clone)",i),i.setup(),i.vars.added(i)},i.removeSlide=function(t){var a=isNaN(t)?i.slides.index(e(t)):t;i.count-=1,i.last=i.count-1,isNaN(t)?e(t,i.slides).remove():u&&v?i.slides.eq(i.last).remove():i.slides.eq(t).remove(),i.doMath(),i.update(a,"remove"),i.slides=e(i.vars.selector+":not(.clone)",i),i.setup(),i.vars.removed(i)},i.editItemWidth=function(e){i.vars.itemWidth=e,h.resize()},h.init()},e(window).blur(function(e){t=!1}).focus(function(e){t=!0}),e.tourmaster_flexslider.defaults={namespace:"tourmaster-flex-",selector:".slides > li",animation:"fade",easing:"swing",direction:"horizontal",reverse:!1,animationLoop:!0,smoothHeight:!1,startAt:0,slideshow:!0,slideshowSpeed:7e3,animationSpeed:600,initDelay:0,randomize:!1,fadeFirstSlide:!0,thumbCaptions:!1,pauseOnAction:!0,pauseOnHover:!1,pauseInvisible:!0,useCSS:!0,touch:!0,video:!1,controlNav:!0,directionNav:!0,prevText:"Previous",nextText:"Next",keyboard:!0,multipleKeyboard:!1,mousewheel:!1,pausePlay:!1,pauseText:"Pause",playText:"Play",controlsContainer:"",manualControls:"",customDirectionNav:"",sync:"",asNavFor:"",itemWidth:0,itemMargin:0,minItems:1,maxItems:0,move:0,allowOneSlide:!0,start:function(){},before:function(){},after:function(){},end:function(){},added:function(){},removed:function(){},init:function(){}},e.fn.tourmaster_flexslider=function(t){if(void 0===t&&(t={}),"object"==typeof t)return this.each(function(){var a=e(this),n=t.selector?t.selector:".slides > li",i=a.find(n);1===i.length&&!0===t.allowOneSlide||0===i.length?(i.fadeIn(400),t.start&&t.start(a)):void 0===a.data("tourmaster_flexslider")&&new e.tourmaster_flexslider(this,t)});var a=e(this).data("tourmaster_flexslider");switch(t){case"play":a.play();break;case"pause":a.pause();break;case"stop":a.stop();break;case"next":a.flexAnimate(a.getTarget("next"),!0);break;case"prev":case"previous":a.flexAnimate(a.getTarget("prev"),!0);break;default:"number"==typeof t&&a.flexAnimate(t,!0)}}}(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.