1var $tm_pb_slider = jQuery( '.tm_pb_slider' ), 2 $tm_pb_tabs = jQuery( '.tm_pb_tabs' ), 3 $tm_pb_tabs_li = $tm_pb_tabs.find( '.tm_pb_tabs_controls li' ), 4 $tm_pb_video_section = jQuery('.tm_pb_section_video_bg'), 5 $tm_pb_newsletter_button = jQuery( '.tm_pb_newsletter_button' ), 6 $tm_pb_filterable_portfolio = jQuery( '.tm_pb_filterable_portfolio' ), 7 $tm_pb_fullwidth_portfolio = jQuery( '.tm_pb_fullwidth_portfolio' ), 8 $tm_pb_gallery = jQuery( '.tm_pb_gallery' ), 9 $tm_pb_countdown_timer = jQuery( '.tm_pb_countdown_timer' ), 10 $tm_post_gallery = jQuery( '.tm_post_gallery' ), 11 $tm_lightbox_image = jQuery( '.tm_pb_lightbox_image'), 12 $tm_pb_map = jQuery( '.tm_pb_map_container' ), 13 $tm_pb_circle_counter = jQuery( '.tm_pb_circle_counter_bar' ), 14 $tm_pb_number_counter = jQuery( '.tm_pb_number_counter' ), 15 $tm_pb_parallax = jQuery( '.tm_parallax_bg' ), 16 $tm_pb_shop = jQuery( '.tm_pb_shop' ), 17 $tm_pb_post_fullwidth = jQuery( '.single.tm_pb_pagebuilder_layout.tm_full_width_page' ), 18 tm_is_mobile_device = navigator.userAgent.match( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/ ), 19 tm_is_ipad = navigator.userAgent.match( /iPad/ ), 20 $tm_container = ! tm_pb_custom.is_builder_plugin_used ? jQuery( '.container' ) : jQuery( '.tm_pb_row' ), 21 tm_container_width = $tm_container.width(), 22 tm_is_fixed_nav = jQuery( 'body' ).hasClass( 'tm_fixed_nav' ), 23 tm_is_vertical_fixed_nav = jQuery( 'body' ).hasClass( 'tm_vertical_fixed' ), 24 tm_is_rtl = jQuery( 'body' ).hasClass( 'rtl' ), 25 tm_hide_nav = jQuery( 'body' ).hasClass( 'tm_hide_nav' ), 26 tm_header_style_left = jQuery( 'body' ).hasClass( 'tm_header_style_left' ), 27 tm_vertical_navigation = jQuery( 'body' ).hasClass( 'tm_vertical_nav' ), 28 $top_header = jQuery('#top-header'), 29 $main_header = jQuery('#main-header'), 30 $main_container_wrapper = jQuery( '#page-container' ), 31 $tm_transparent_nav = jQuery( '.tm_transparent_nav' ), 32 $tm_pb_first_row = jQuery( 'body.tm_pb_pagebuilder_layout .tm_pb_section:first-child' ), 33 $tm_main_content_first_row = jQuery( '#main-content .container:first-child' ), 34 $tm_main_content_first_row_meta_wrapper = $tm_main_content_first_row.find('.tm_post_meta_wrapper:first'), 35 $tm_main_content_first_row_meta_wrapper_title = $tm_main_content_first_row_meta_wrapper.find( 'h1' ), 36 $tm_main_content_first_row_content = $tm_main_content_first_row.find('.entry-content:first'), 37 $tm_single_post = jQuery( 'body.single-post' ), 38 $tm_window = jQuery(window), 39 etRecalculateOffset = false, 40 tm_header_height, 41 tm_header_modifier, 42 tm_header_offset, 43 tm_primary_header_top, 44 $tm_vertical_nav = jQuery('.tm_vertical_nav'), 45 $tm_header_style_split = jQuery('.tm_header_style_split'), 46 $tm_top_navigation = jQuery('#tm-top-navigation'), 47 $logo = jQuery('#logo'), 48 $tm_sticky_image = jQuery('.tm_pb_image_sticky'), 49 $tm_pb_counter_amount = jQuery('.tm_pb_counter_amount'), 50 $tm_pb_carousel = jQuery( '.tm_pb_carousel' ), 51 $tm_menu_selector = tm_pb_custom.is_divi_theme_used ? jQuery( 'ul.nav' ) : jQuery( '.tm_pb_fullwidth_menu ul.nav' ); 52 53jQuery(document).ready( function($){ 54 var $tm_top_menu = $tm_menu_selector, 55 tm_parent_menu_longpress_limit = 300, 56 tm_parent_menu_longpress_start, 57 tm_parent_menu_click = true; 58 59 $( '.tm_pb_posts' ).each( function() { 60 61 var $item = $( this ), 62 loader = '<div class="tm-pb-spinner tm-pb-spinner-double-bounce"><div class="tm-pb-double-bounce1"></div><div class="tm-pb-double-bounce2"></div></div>'; 63 64 $item.on( 'click', '.tm_pb_ajax_more', function( event ) { 65 66 var $this = $( this ), 67 $result = $item.find( '.tm-posts_listing .row' ), 68 pages = $item.data( 'pages' ), 69 data = new Object(); 70 71 event.preventDefault(); 72 73 if ( $this.hasClass( 'in-progress' ) ) { 74 return; 75 } 76 77 data.page = $item.data( 'page' ); 78 data.atts = $item.data( 'atts' ); 79 data.action = 'tm_pb_load_more'; 80 81 $this.addClass( 'in-progress' ).after( loader ); 82 83 $.ajax({ 84 url: window.tm_pb_custom.ajaxurl, 85 type: 'post', 86 dataType: 'json', 87 data: data, 88 error: function() { 89 $this.removeClass( 'in-progress' ).next( '.tm-pb-spinner' ).remove(); 90 } 91 }).done( function( response ) { 92 $result.append( response.data.result ); 93 $item.data( 'page', response.data.page ); 94 $this.removeClass( 'in-progress' ).next( '.tm-pb-spinner' ).remove(); 95 if ( response.data.page == pages ) { 96 $this.addClass( 'btn-hidden' ); 97 } 98 99 }); 100 101 }); 102 103 }); 104 105 if ( $( '.tm_pb_row' ).length ) { 106 $( '.tm_pb_row' ).each( function() { 107 var $this_row = $( this ), 108 row_class = ''; 109 110 row_class = tm_get_column_types( $this_row.find( '>.tm_pb_column' ) ); 111
112 if ( '' !== row_class && ( -1 !== row_class.indexOf( '1-4' ) || '_4col' === row_class ) ) { 113 $this_row.addClass( 'tm_pb_row' + row_class ); 114 } 115 116 if ( $this_row.find( '.tm_pb_row_inner' ).length ) { 117 $this_row.find( '.tm_pb_row_inner' ).each( function() { 118 var $this_row_inner = $( this ); 119 row_class = tm_get_column_types( $this_row_inner.find( '.tm_pb_column' ) ); 120 121 if ( '' !== row_class && -1 !== row_class.indexOf( '1-4' ) ) { 122 $this_row_inner.addClass( 'tm_pb_row' + row_class ); 123 } 124 }); 125 } 126 }); 127 } 128 129 function tm_get_column_types( $columns ) { 130 var row_class = ''; 131 132 if ( $columns.length ) { 133 $columns.each( function() { 134 var $this_column = $( this ), 135 column_type = $this_column.attr( 'class' ).split( 'tm_pb_column_' )[1], 136 column_type_clean = column_type.split( ' ', 1 )[0], 137 column_type_updated = column_type_clean.replace( '_', '-' ).trim(); 138 139 row_class += '_' + column_type_updated; 140 }); 141 142 row_class = '_1-4_1-4_1-4_1-4' === row_class ? '_4col' : row_class; 143 } 144 145 return row_class; 146 } 147 148 $tm_top_menu.find( 'li' ).hover( function() { 149 if ( ! $(this).closest( 'li.mega-menu' ).length || $(this).hasClass( 'mega-menu' ) ) { 150 $(this).addClass( 'tm-show-dropdown' ); 151 $(this).removeClass( 'tm-hover' ).addClass( 'tm-hover' ); 152 } 153 }, function() { 154 var $this_el = $(this); 155 156 $this_el.removeClass( 'tm-show-dropdown' ); 157 158 setTimeout( function() { 159 if ( ! $this_el.hasClass( 'tm-show-dropdown' ) ) { 160 $this_el.removeClass( 'tm-hover' ); 161 } 162 }, 200 ); 163 } ); 164 165 // Dropdown menu adjustment for touch screen 166 $tm_top_menu.find('.menu-item-has-children > a').on( 'touchstart', function(){ 167 tm_parent_menu_longpress_start = new Date().getTime(); 168 } ).on( 'touchend', function(){ 169 var tm_parent_menu_longpress_end = new Date().getTime() 170 if ( tm_parent_menu_longpress_end >= tm_parent_menu_longpress_start + tm_parent_menu_longpress_limit ) { 171 tm_parent_menu_click = true; 172 } else { 173 tm_parent_menu_click = false; 174 175 // Close sub-menu if toggled 176 var $tm_parent_menu = $(this).parent('li'); 177 if ( $tm_parent_menu.hasClass( 'tm-hover') ) { 178 $tm_parent_menu.trigger( 'mouseleave' ); 179 } else { 180 $tm_parent_menu.trigger( 'mouseenter' ); 181 } 182 } 183 tm_parent_menu_longpress_start = 0; 184 } ).click(function() { 185 if ( tm_parent_menu_click ) { 186 return true; 187 } 188 189 return false; 190 } ); 191 192 $tm_top_menu.find( 'li.mega-menu' ).each(function(){ 193 var $li_mega_menu = $(this), 194 $li_mega_menu_item = $li_mega_menu.children( 'ul' ).children( 'li' ), 195 li_mega_menu_item_count = $li_mega_menu_item.length; 196 197 if ( li_mega_menu_item_count < 4 ) { 198 $li_mega_menu.addClass( 'mega-menu-parent mega-menu-parent-' + li_mega_menu_item_count ); 199 } 200 }); 201 202 $tm_sticky_image.each( function() { 203 var $this_el = $(this), 204 $row = $this_el.closest('.tm_pb_row'), 205 $section = $row.closest('.tm_pb_section'), 206 $column = $this_el.closest( '.tm_pb_column' ), 207 sticky_class = 'tm_pb_section_sticky', 208 sticky_mobile_class = 'tm_pb_section_sticky_mobile'; 209 210 // If it is not in the last row, continue 211 if ( ! $row.is( ':last-child' ) ) { 212 return true; 213 } 214 215 // Make sure sticky image is the last element in the column 216 if ( ! $this_el.is( ':last-child' ) ) { 217 return true; 218 } 219 220 // If it is in the last row, find the parent section and attach new class to it 221 if ( ! $section.hasClass( sticky_class ) ) { 222 $section.addClass( sticky_class ); 223 } 224 225 $column.addClass( 'tm_pb_row_sticky' ); 226 227 if ( ! $section.hasClass( sticky_mobile_class ) && $column.is( ':last-child' ) ) { 228 $section.addClass( sticky_mobile_class ); 229 } 230 } ); 231 232 if ( tm_is_mobile_device ) { 233 $( '.tm_pb_section_video_bg' ).each( function() { 234 var $this_el = $(this); 235 236 $this_el.css( 'visibility', 'hidden' ).closest( '.tm_pb_preload' ).removeClass( 'tm_pb_preload' ) 237 } ); 238 239 $( 'body' ).addClass( 'tm_mobile_device' ); 240 241 if ( ! tm_is_ipad ) { 242 $( 'body' ).addClass( 'tm_mobile_device_not_ipad' ); 243 } 244 } 245 246 if ( $tm_pb_video_section.length ) { 247 $tm_pb_video_section.find( 'video' ).mediaelementplayer( { 248 pauseOtherPlayers: false, 249 success : function( mediaElement, domObject ) { 250 mediaElement.addEventListener( 'loadeddata', function() { 251 tm_pb_resize_section_video_bg( $(domObject) );
252 tm_pb_center_video( $(domObject) ); 253 }, false ); 254 255 mediaElement.addEventListener( 'canplay', function() { 256 $(domObject).closest( '.tm_pb_preload' ).removeClass( 'tm_pb_preload' ); 257 }, false ); 258 } 259 } ); 260 } 261 262 if ( $tm_post_gallery.length ) { 263 // swipe support in magnific popup only if gallery exists 264 var magnificPopup = $.magnificPopup.instance; 265 266 $( 'body' ).on( 'swiperight', '.mfp-container', function() { 267 magnificPopup.prev(); 268 } ); 269 $( 'body' ).on( 'swipeleft', '.mfp-container', function() { 270 magnificPopup.next(); 271 } ); 272 273 $tm_post_gallery.each(function() { 274 $(this).magnificPopup( { 275 delegate: 'a', 276 type: 'image', 277 removalDelay: 500, 278 gallery: { 279 enabled: true, 280 navigateByImgClick: true 281 }, 282 mainClass: 'mfp-fade', 283 zoom: { 284 enabled: true, 285 duration: 500, 286 opener: function(element) { 287 return element.find('img'); 288 } 289 } 290 } ); 291 } ); 292 // prevent attaching of any further actions on click 293 $tm_post_gallery.find( 'a' ).unbind( 'click' ); 294 } 295 296 if ( $tm_lightbox_image.length ) { 297 // prevent attaching of any further actions on click 298 $tm_lightbox_image.unbind( 'click' ); 299 $tm_lightbox_image.bind( 'click' ); 300 301 $tm_lightbox_image.magnificPopup( { 302 type: 'image', 303 removalDelay: 500, 304 mainClass: 'mfp-fade', 305 zoom: { 306 enabled: true, 307 duration: 500, 308 opener: function(element) { 309 return element.find('img'); 310 } 311 } 312 } ); 313 } 314 315 if ( $tm_pb_slider.length ) { 316 $tm_pb_slider.each( function() { 317 var $this_slider = $(this), 318 tm_slider_settings = { 319 fade_speed : 700, 320 slide : ! $this_slider.hasClass( 'tm_pb_gallery' ) ? '.tm_pb_slide' : '.tm_pb_gallery_item' 321 } 322 323 if ( $this_slider.hasClass('tm_pb_slider_no_arrows') ) 324 tm_slider_settings.use_arrows = false; 325 326 if ( $this_slider.hasClass('tm_pb_slider_no_pagination') ) 327 tm_slider_settings.use_controls = false; 328 329 if ( $this_slider.hasClass('tm_slider_auto') ) { 330 var tm_slider_autospeed_class_value = /tm_slider_speed_(\d+)/g; 331 332 tm_slider_settings.slideshow = true; 333 334 tm_slider_autospeed = tm_slider_autospeed_class_value.exec( $this_slider.attr('class') ); 335 336 tm_slider_settings.slideshow_speed = tm_slider_autospeed[1]; 337 } 338 339 if ( $this_slider.parent().hasClass('tm_pb_video_slider') ) { 340 tm_slider_settings.controls_below = true; 341 tm_slider_settings.append_controls_to = $this_slider.parent(); 342 343 setTimeout( function() { 344 $( '.tm_pb_preload' ).removeClass( 'tm_pb_preload' ); 345 }, 500 ); 346 } 347 348 if ( $this_slider.hasClass('tm_pb_slider_carousel') ) 349 tm_slider_settings.use_carousel = true; 350 351 $this_slider.tm_pb_simple_slider( tm_slider_settings ); 352 353 } ); 354 } 355
356 $tm_pb_carousel = $( '.tm_pb_carousel' ); 357 if ( $tm_pb_carousel.length ) { 358 $tm_pb_carousel.each( function() { 359 var $this_carousel = $(this), 360 tm_carousel_settings = { 361 fade_speed : 1000 362 }; 363 364 $this_carousel.tm_pb_simple_carousel( tm_carousel_settings ); 365 } ); 366 } 367 368 if ( $tm_pb_fullwidth_portfolio.length ) { 369 370 function set_fullwidth_portfolio_columns( $the_portfolio, carousel_mode ) { 371 var columns, 372 $portfolio_items = $the_portfolio.find('.tm_pb_portfolio_items'), 373 portfolio_items_width = $portfolio_items.width(), 374 $the_portfolio_items = $portfolio_items.find('.tm_pb_portfolio_item'), 375 portfolio_item_count = $the_portfolio_items.length; 376 377 // calculate column breakpoints 378 if ( portfolio_items_width >= 1600 ) { 379 columns = 5; 380 } else if ( portfolio_items_width >= 1024 ) { 381 columns = 4; 382 } else if ( portfolio_items_width >= 768 ) { 383 columns = 3; 384 } else if ( portfolio_items_width >= 480 ) { 385 columns = 2; 386 } else { 387 columns = 1; 388 } 389 390 // set height of items 391 portfolio_item_width = portfolio_items_width / columns;
392 portfolio_item_height = portfolio_item_width * .75; 393 394 if ( carousel_mode ) { 395 $portfolio_items.css({ 'height' : portfolio_item_height }); 396 } 397 398 $the_portfolio_items.css({ 'height' : portfolio_item_height }); 399 400 if ( columns === $portfolio_items.data('portfolio-columns') ) { 401 return; 402 } 403 404 if ( $the_portfolio.data('columns_setting_up') ) { 405 return; 406 } 407 408 $the_portfolio.data('columns_setting_up', true ); 409 410 var portfolio_item_width_percentage = ( 100 / columns ) + '%'; 411 $the_portfolio_items.css({ 'width' : portfolio_item_width_percentage }); 412 413 // store last setup column 414 $portfolio_items.removeClass('columns-' + $portfolio_items.data('portfolio-columns') ); 415 $portfolio_items.addClass('columns-' + columns ); 416 $portfolio_items.data('portfolio-columns', columns ); 417 418 if ( !carousel_mode ) { 419 return $the_portfolio.data('columns_setting_up', false ); 420 } 421 422 // kill all previous groups to get ready to re-group 423 if ( $portfolio_items.find('.tm_pb_carousel_group').length ) { 424 $the_portfolio_items.appendTo( $portfolio_items ); 425 $portfolio_items.find('.tm_pb_carousel_group').remove(); 426 } 427 428 // setup the grouping 429 var the_portfolio_items = $portfolio_items.data('items' ), 430 $carousel_group = $('<div class="tm_pb_carousel_group active">').appendTo( $portfolio_items ); 431 432 $the_portfolio_items.data('position', ''); 433 if ( the_portfolio_items.length <= columns ) { 434 $portfolio_items.find('.tm-pb-slider-arrows').hide(); 435 } else { 436 $portfolio_items.find('.tm-pb-slider-arrows').show(); 437 } 438 439 for ( position = 1, x=0 ;x < the_portfolio_items.length; x++, position++ ) { 440 if ( x < columns ) { 441 $( the_portfolio_items[x] ).show(); 442 $( the_portfolio_items[x] ).appendTo( $carousel_group ); 443 $( the_portfolio_items[x] ).data('position', position ); 444 $( the_portfolio_items[x] ).addClass('position_' + position ); 445 } else { 446 position = $( the_portfolio_items[x] ).data('position'); 447 $( the_portfolio_items[x] ).removeClass('position_' + position ); 448 $( the_portfolio_items[x] ).data('position', '' ); 449 $( the_portfolio_items[x] ).hide(); 450 } 451 } 452 453 $the_portfolio.data('columns_setting_up', false ); 454 455 } 456 457 function tm_carousel_auto_rotate( $carousel ) { 458 if ( 'on' === $carousel.data('auto-rotate') && $carousel.find('.tm_pb_portfolio_item').length > $carousel.find('.tm_pb_carousel_group .tm_pb_portfolio_item').length && ! $carousel.hasClass( 'tm_carousel_hovered' ) ) { 459 460 tm_carousel_timer = setTimeout( function() { 461 $carousel.find('.tm-pb-arrow-next').click(); 462 }, $carousel.data('auto-rotate-speed') ); 463 464 $carousel.data('tm_carousel_timer', tm_carousel_timer); 465 } 466 } 467 468 $tm_pb_fullwidth_portfolio.each(function(){ 469 var $the_portfolio = $(this), 470 $portfolio_items = $the_portfolio.find('.tm_pb_portfolio_items'); 471 472 $portfolio_items.data('items', $portfolio_items.find('.tm_pb_portfolio_item').toArray() ); 473 $the_portfolio.data('columns_setting_up', false ); 474 475 if ( $the_portfolio.hasClass('tm_pb_fullwidth_portfolio_carousel') ) { 476 // add left and right arrows 477 $portfolio_items.prepend('<div class="tm-pb-slider-arrows"><a class="tm-pb-arrow-prev" href="#">' + '<span>' + tm_pb_custom.previous + '</span>' + '</a><a class="tm-pb-arrow-next" href="#">' + '<span>' + tm_pb_custom.next + '</span>' + '</a></div>'); 478 479 set_fullwidth_portfolio_columns( $the_portfolio, true ); 480 481 tm_carousel_auto_rotate( $the_portfolio ); 482 483 // swipe support 484 $the_portfolio.on( 'swiperight', function() { 485 $( this ).find( '.tm-pb-arrow-prev' ).click(); 486 }); 487 $the_portfolio.on( 'swipeleft', function() { 488 $( this ).find( '.tm-pb-arrow-next' ).click(); 489 }); 490 491 $the_portfolio.hover( 492 function(){ 493 $(this).addClass('tm_carousel_hovered'); 494 if ( typeof $(this).data('tm_carousel_timer') != 'undefined' ) { 495 clearInterval( $(this).data('tm_carousel_timer') ); 496 } 497 }, 498 function(){ 499 $(this).removeClass('tm_carousel_hovered'); 500 tm_carousel_auto_rotate( $(this) ); 501 } 502 ); 503 504 $the_portfolio.data('carouseling', false ); 505 506 $the_portfolio.on('click', '.tm-pb-slider-arrows a', function(e){ 507 var $the_portfolio = $(this).parents('.tm_pb_fullwidth_portfolio'), 508 $portfolio_items = $the_portfolio.find('.tm_pb_portfolio_items'), 509 $the_portfolio_items = $portfolio_items.find('.tm_pb_portfolio_item'),
510 $active_carousel_group = $portfolio_items.find('.tm_pb_carousel_group.active'), 511 slide_duration = 700, 512 items = $portfolio_items.data('items'), 513 columns = $portfolio_items.data('portfolio-columns'), 514 item_width = $active_carousel_group.innerWidth() / columns, //$active_carousel_group.children().first().innerWidth(), 515 original_item_width = ( 100 / columns ) + '%'; 516 517 e.preventDefault(); 518 519 if ( $the_portfolio.data('carouseling') ) { 520 return; 521 } 522 523 $the_portfolio.data('carouseling', true); 524 525 $active_carousel_group.children().each(function(){ 526 $(this).css({'width': $(this).innerWidth() + 1, 'position':'absolute', 'left': ( $(this).innerWidth() * ( $(this).data('position') - 1 ) ) }); 527 }); 528 529 if ( $(this).hasClass('tm-pb-arrow-next') ) { 530 var $next_carousel_group, 531 current_position = 1, 532 next_position = 1, 533 active_items_start = items.indexOf( $active_carousel_group.children().first()[0] ), 534 active_items_end = active_items_start + columns, 535 next_items_start = active_items_end, 536 next_items_end = next_items_start + columns; 537 538 $next_carousel_group = $('<div class="tm_pb_carousel_group next" style="display: none;left: 100%;position: absolute;top: 0;">').insertAfter( $active_carousel_group ); 539 $next_carousel_group.css({ 'width': $active_carousel_group.innerWidth() }).show(); 540 541 // this is an endless loop, so it can decide internally when to break out, so that next_position 542 // can get filled up, even to the extent of an element having both and current_ and next_ position 543 for( x = 0, total = 0 ; ; x++, total++ ) { 544 if ( total >= active_items_start && total < active_items_end ) { 545 $( items[x] ).addClass( 'changing_position current_position current_position_' + current_position ); 546 $( items[x] ).data('current_position', current_position ); 547 current_position++; 548 } 549 550 if ( total >= next_items_start && total < next_items_end ) { 551 $( items[x] ).data('next_position', next_position ); 552 $( items[x] ).addClass('changing_position next_position next_position_' + next_position ); 553 554 if ( !$( items[x] ).hasClass( 'current_position' ) ) { 555 $( items[x] ).addClass('container_append'); 556 } else { 557 $( items[x] ).clone(true).appendTo( $active_carousel_group ).hide().addClass('delayed_container_append_dup').attr('id', $( items[x] ).attr('id') + '-dup' ); 558 $( items[x] ).addClass('delayed_container_append'); 559 } 560 561 next_position++; 562 } 563 564 if ( next_position > columns ) { 565 break; 566 } 567 568 if ( x >= ( items.length -1 )) { 569 x = -1; 570 } 571 } 572 573 sorted = $portfolio_items.find('.container_append, .delayed_container_append_dup').sort(function (a, b) { 574 var el_a_position = parseInt( $(a).data('next_position') ); 575 var el_b_position = parseInt( $(b).data('next_position') ); 576 return ( el_a_position < el_b_position ) ? -1 : ( el_a_position > el_b_position ) ? 1 : 0; 577 }); 578 579 $( sorted ).show().appendTo( $next_carousel_group ); 580 581 $next_carousel_group.children().each(function(){ 582 $(this).css({'width': item_width, 'position':'absolute', 'left': ( item_width * ( $(this).data('next_position') - 1 ) ) }); 583 }); 584 585 $active_carousel_group.animate({ 586 left: '-100%' 587 }, { 588 duration: slide_duration, 589 complete: function() { 590 $portfolio_items.find('.delayed_container_append').each(function(){ 591 $(this).css({'width': item_width, 'position':'absolute', 'left': ( item_width * ( $(this).data('next_position') - 1 ) ) }); 592 $(this).appendTo( $next_carousel_group ); 593 }); 594 595 $active_carousel_group.removeClass('active'); 596 $active_carousel_group.children().each(function(){ 597 position = $(this).data('position'); 598 current_position = $(this).data('current_position'); 599 $(this).removeClass('position_' + position + ' ' + 'changing_position current_position current_position_' + current_position ); 600 $(this).data('position', ''); 601 $(this).data('current_position', ''); 602 $(this).hide(); 603 $(this).css({'position': '', 'width': '', 'left': ''}); 604 $(this).appendTo( $portfolio_items ); 605 }); 606 607 $active_carousel_group.remove(); 608 609 tm_carousel_auto_rotate( $the_portfolio ); 610 611 } 612 } ); 613 614 $next_carousel_group.addClass('active').css({'position':'absolute', 'top':0, left: '100%'}); 615 $next_carousel_group.animate({ 616 left: '0%' 617 }, {
618 duration: slide_duration, 619 complete: function(){ 620 setTimeout(function(){ 621 $next_carousel_group.removeClass('next').addClass('active').css({'position':'', 'width':'', 'top':'', 'left': ''}); 622 623 $next_carousel_group.find('.delayed_container_append_dup').remove(); 624 625 $next_carousel_group.find('.changing_position').each(function( index ){ 626 position = $(this).data('position'); 627 current_position = $(this).data('current_position'); 628 next_position = $(this).data('next_position'); 629 $(this).removeClass('container_append delayed_container_append position_' + position + ' ' + 'changing_position current_position current_position_' + current_position + ' next_position next_position_' + next_position ); 630 $(this).data('current_position', ''); 631 $(this).data('next_position', ''); 632 $(this).data('position', ( index + 1 ) ); 633 }); 634 635 $next_carousel_group.children().css({'position': '', 'width': original_item_width, 'left': ''}); 636 637 $the_portfolio.data('carouseling', false); 638 }, 100 ); 639 } 640 } ); 641 642 } else { 643 var $prev_carousel_group, 644 current_position = columns, 645 prev_position = columns, 646 columns_span = columns - 1, 647 active_items_start = items.indexOf( $active_carousel_group.children().last()[0] ), 648 active_items_end = active_items_start - columns_span, 649 prev_items_start = active_items_end - 1, 650 prev_items_end = prev_items_start - columns_span; 651 652 $prev_carousel_group = $('<div class="tm_pb_carousel_group prev" style="display: none;left: 100%;position: absolute;top: 0;">').insertBefore( $active_carousel_group ); 653 $prev_carousel_group.css({ 'left': '-' + $active_carousel_group.innerWidth(), 'width': $active_carousel_group.innerWidth() }).show(); 654 655 // this is an endless loop, so it can decide internally when to break out, so that next_position 656 // can get filled up, even to the extent of an element having both and current_ and next_ position 657 for( x = ( items.length - 1 ), total = ( items.length - 1 ) ; ; x--, total-- ) { 658 659 if ( total <= active_items_start && total >= active_items_end ) { 660 $( items[x] ).addClass( 'changing_position current_position current_position_' + current_position ); 661 $( items[x] ).data('current_position', current_position ); 662 current_position--; 663 } 664 665 if ( total <= prev_items_start && total >= prev_items_end ) { 666 $( items[x] ).data('prev_position', prev_position ); 667 $( items[x] ).addClass('changing_position prev_position prev_position_' + prev_position ); 668 669 if ( !$( items[x] ).hasClass( 'current_position' ) ) { 670 $( items[x] ).addClass('container_append'); 671 } else { 672 $( items[x] ).clone(true).appendTo( $active_carousel_group ).addClass('delayed_container_append_dup').attr('id', $( items[x] ).attr('id') + '-dup' ); 673 $( items[x] ).addClass('delayed_container_append'); 674 } 675 676 prev_position--; 677 } 678 679 if ( prev_position <= 0 ) { 680 break; 681 } 682 683 if ( x == 0 ) { 684 x = items.length; 685 } 686 } 687 688 sorted = $portfolio_items.find('.container_append, .delayed_container_append_dup').sort(function (a, b) { 689 var el_a_position = parseInt( $(a).data('prev_position') ); 690 var el_b_position = parseInt( $(b).data('prev_position') ); 691 return ( el_a_position < el_b_position ) ? -1 : ( el_a_position > el_b_position ) ? 1 : 0; 692 }); 693 694 $( sorted ).show().appendTo( $prev_carousel_group ); 695 696 $prev_carousel_group.children().each(function(){ 697 $(this).css({'width': item_width, 'position':'absolute', 'left': ( item_width * ( $(this).data('prev_position') - 1 ) ) }); 698 }); 699 700 $active_carousel_group.animate({ 701 left: '100%' 702 }, { 703 duration: slide_duration, 704 complete: function() { 705 $portfolio_items.find('.delayed_container_append').reverse().each(function(){ 706 $(this).css({'width': item_width, 'position':'absolute', 'left': ( item_width * ( $(this).data('prev_position') - 1 ) ) }); 707 $(this).prependTo( $prev_carousel_group ); 708 }); 709 710 $active_carousel_group.removeClass('active'); 711 $active_carousel_group.children().each(function(){ 712 position = $(this).data('position'); 713 current_position = $(this).data('current_position'); 714 $(this).removeClass('position_' + position + ' ' + 'changing_position current_position current_position_' + current_position ); 715 $(this).data('position', ''); 716 $(this).data('current_position', ''); 717 $(this).hide(); 718 $(this).css({'position': '', 'width': '', 'left': ''}); 719 $(this).appendTo( $portfolio_items ); 720 }); 721 722 $active_carousel_group.remove(); 723 } 724 } ); 725 726 $prev_carousel_group.addClass('active').css({'position':'absolute', 'top':0, left: '-100%'}); 727 $prev_carousel_group.animate({ 728 left: '0%' 729 }, {
730 duration: slide_duration, 731 complete: function(){ 732 setTimeout(function(){ 733 $prev_carousel_group.removeClass('prev').addClass('active').css({'position':'', 'width':'', 'top':'', 'left': ''}); 734 735 $prev_carousel_group.find('.delayed_container_append_dup').remove(); 736 737 $prev_carousel_group.find('.changing_position').each(function( index ){ 738 position = $(this).data('position'); 739 current_position = $(this).data('current_position'); 740 prev_position = $(this).data('prev_position'); 741 $(this).removeClass('container_append delayed_container_append position_' + position + ' ' + 'changing_position current_position current_position_' + current_position + ' prev_position prev_position_' + prev_position ); 742 $(this).data('current_position', ''); 743 $(this).data('prev_position', ''); 744 position = index + 1; 745 $(this).data('position', position ); 746 $(this).addClass('position_' + position ); 747 }); 748 749 $prev_carousel_group.children().css({'position': '', 'width': original_item_width, 'left': ''}); 750 $the_portfolio.data('carouseling', false); 751 }, 100 ); 752 } 753 } ); 754 } 755 756 return false; 757 }); 758 759 } else { 760 // setup fullwidth portfolio grid 761 set_fullwidth_portfolio_columns( $the_portfolio, false ); 762 } 763 764 }); 765 } 766 767 function tm_audio_module_set() { 768 if ( $( '.tm_pb_audio_module .mejs-audio' ).length || $( '.tm_audio_content .mejs-audio' ).length ) { 769 $( '.tm_audio_container' ).each( function(){ 770 var $this_player = $( this ), 771 $time_rail = $this_player.find( '.mejs-time-rail' ), 772 $time_slider = $this_player.find( '.mejs-time-slider' ); 773 // remove previously added width and min-width attributes to calculate the new sizes accurately 774 $time_rail.removeAttr( 'style' ); 775 $time_slider.removeAttr( 'style' ); 776 777 var $count_timer = $this_player.find( 'div.mejs-currenttime-container' ), 778 player_width = $this_player.width(), 779 controls_play_width = $this_player.find( '.mejs-play' ).outerWidth(), 780 time_width = $this_player.find( '.mejs-currenttime-container' ).outerWidth(), 781 volume_icon_width = $this_player.find( '.mejs-volume-button' ).outerWidth(), 782 volume_bar_width = $this_player.find( '.mejs-horizontal-volume-slider' ).outerWidth(), 783 new_time_rail_width; 784 785 $count_timer.addClass( 'custom' ); 786 $this_player.find( '.mejs-controls div.mejs-duration-container' ).replaceWith( $count_timer ); 787 new_time_rail_width = player_width - ( controls_play_width + time_width + volume_icon_width + volume_bar_width + 100 ); 788 789 if ( 0 < new_time_rail_width ) { 790 $time_rail.attr( 'style', 'min-width: ' + new_time_rail_width + 'px;' ); 791 $time_slider.attr( 'style', 'min-width: ' + new_time_rail_width + 'px;' ); 792 } 793 }); 794 } 795 } 796 797 if ( $('.tm_pb_section_video').length ) { 798 window._wpmejsSettings.pauseOtherPlayers = false; 799 } 800 801 if ( $tm_pb_filterable_portfolio.length ) { 802 803 $(window).load(function(){ 804 805 $tm_pb_filterable_portfolio.each(function(){ 806 var $the_portfolio = $(this), 807 $the_portfolio_items = $the_portfolio.find('.tm_pb_portfolio_items'), 808 $left_orientatation = true == $the_portfolio.data( 'rtl' ) ? false : true; 809 810 $the_portfolio.show(); 811 812 set_filterable_grid_items( $the_portfolio ); 813 814 $the_portfolio.on('click', '.tm_pb_portfolio_filter a', function(e){ 815 e.preventDefault(); 816 var category_slug = $(this).data('category-slug'); 817 $the_portfolio_items = $(this).parents('.tm_pb_filterable_portfolio').find('.tm_pb_portfolio_items'); 818 819 if ( 'all' == category_slug ) { 820 $the_portfolio.find('.tm_pb_portfolio_filter a').removeClass('active'); 821 $the_portfolio.find('.tm_pb_portfolio_filter_all a').addClass('active'); 822 $the_portfolio.find('.tm_pb_portfolio_item').removeClass('active inactive'); 823 $the_portfolio.find('.tm_pb_portfolio_item').show(); 824 $the_portfolio.find('.tm_pb_portfolio_item').addClass('active'); 825 } else { 826 $the_portfolio.find('.tm_pb_portfolio_filter_all').removeClass('active'); 827 $the_portfolio.find('.tm_pb_portfolio_filter a').removeClass('active'); 828 $the_portfolio.find('.tm_pb_portfolio_filter_all a').removeClass('active'); 829 $(this).addClass('active'); 830 831 $the_portfolio_items.find('.tm_pb_portfolio_item').hide(); 832 $the_portfolio_items.find('.tm_pb_portfolio_item').addClass( 'inactive' ); 833 $the_portfolio_items.find('.tm_pb_portfolio_item').removeClass('active'); 834 $the_portfolio_items.find('.tm_pb_portfolio_item.project_category_' + $(this).data('category-slug') ).show(); 835 $the_portfolio_items.find('.tm_pb_portfolio_item.project_category_' + $(this).data('category-slug') ).addClass('active').removeClass( 'inactive' ); 836 } 837 838 set_filterable_grid_items( $the_portfolio ); 839 setTimeout(function(){ 840 set_filterable_portfolio_hash( $the_portfolio ); 841 }, 500 ); 842 }); 843 844 $(this).on('tm_hashchange', function( event ){ 845 var params = event.params; 846 $the_portfolio = $( '#' + event.target.id ); 847 848 if ( !$the_portfolio.find('.tm_pb_portfolio_filter a[data-category-slug="' + params[0] + '"]').hasClass('active') ) { 849 $the_portfolio.find('.tm_pb_portfolio_filter a[data-category-slug="' + params[0] + '"]').click(); 850 } 851 852 if ( params[1] ) { 853 setTimeout(function(){ 854 if ( !$the_portfolio.find('.tm_pb_portofolio_pagination a.page-' + params[1]).hasClass('active') ) { 855 $the_portfolio.find('.tm_pb_portofolio_pagination a.page-' + params[1]).addClass('active').click(); 856 } 857 }, 300 ); 858 } 859 }); 860 }); 861 862 }); // End $(window).load() 863 864 function set_filterable_grid_items( $the_portfolio ) { 865 var active_category = $the_portfolio.find('.tm_pb_portfolio_filter > a.active').data('category-slug'), 866 container_width = $the_portfolio.find( '.tm_pb_portfolio_items' ).innerWidth(), 867 item_width = $the_portfolio.find( '.tm_pb_portfolio_item' ).outerWidth( true ), 868 last_item_margin = item_width - $the_portfolio.find( '.tm_pb_portfolio_item' ).outerWidth(), 869 columns_count = Math.round( ( container_width + last_item_margin ) / item_width ), 870 counter = 1, 871 first_in_row = 1; 872 873 $the_portfolio.find( '.tm_pb_portfolio_item' ).removeClass( 'last_in_row first_in_row' ); 874 $the_portfolio.find( '.tm_pb_portfolio_item' ).each( function() { 875 var $this_el = $( this ); 876 877 if ( ! $this_el.hasClass( 'inactive' ) ) { 878 if ( first_in_row === counter ) { 879 $this_el.addClass( 'first_in_row' ); 880 } 881 882 if ( 0 === counter % columns_count ) { 883 $this_el.addClass( 'last_in_row' ); 884 first_in_row = counter + 1; 885 } 886 counter++; 887 } 888 }); 889 890 if ( 'all' === active_category ) { 891 $the_portfolio_visible_items = $the_portfolio.find('.tm_pb_portfolio_item'); 892 } else { 893 $the_portfolio_visible_items = $the_portfolio.find('.tm_pb_portfolio_item.project_category_' + active_category); 894 } 895 896 var visible_grid_items = $the_portfolio_visible_items.length, 897 posts_number = $the_portfolio.data('posts-number'), 898 pages = Math.ceil( visible_grid_items / posts_number ); 899 900 set_filterable_grid_pages( $the_portfolio, pages ); 901 902 var visible_grid_items = 0; 903 var _page = 1; 904 $the_portfolio.find('.tm_pb_portfolio_item').data('page', ''); 905 $the_portfolio_visible_items.each(function(i){ 906 visible_grid_items++; 907 if ( 0 === parseInt( visible_grid_items % posts_number ) ) { 908 $(this).data('page', _page); 909 _page++; 910 } else { 911 $(this).data('page', _page); 912 } 913 }); 914 915 $the_portfolio_visible_items.filter(function() { 916 return $(this).data('page') == 1; 917 }).show(); 918 919 $the_portfolio_visible_items.filter(function() { 920 return $(this).data('page') != 1; 921 }).hide(); 922 } 923 924 function set_filterable_grid_pages( $the_portfolio, pages ) { 925 $pagination = $the_portfolio.find('.tm_pb_portofolio_pagination'); 926 927 if ( !$pagination.length ) { 928 return; 929 } 930 931 $pagination.html('<ul></ul>'); 932 if ( pages <= 1 ) { 933 return; 934 } 935 936 $pagination_list = $pagination.children('ul'); 937 $pagination_list.append('<li class="prev" style="display:none;"><a href="#" data-page="prev" class="page-prev">' + tm_pb_custom.prev + '</a></li>'); 938 for( var page = 1; page <= pages; page++ ) { 939 var first_page_class = page === 1 ? ' active' : '', 940 last_page_class = page === pages ? ' last-page' : '', 941 hidden_page_class = page >= 5 ? ' style="display:none;"' : ''; 942 $pagination_list.append('<li' + hidden_page_class + ' class="page page-' + page + '"><a href="#" data-page="' + page + '" class="page-' + page + first_page_class + last_page_class + '">' + page + '</a></li>'); 943 } 944 $pagination_list.append('<li class="next"><a href="#" data-page="next" class="page-next">' + tm_pb_custom.next + '</a></li>'); 945 } 946 947 $tm_pb_filterable_portfolio.on('click', '.tm_pb_portofolio_pagination a', function(e){ 948 e.preventDefault(); 949 950 var to_page = $(this).data('page'), 951 $the_portfolio = $(this).parents('.tm_pb_filterable_portfolio'), 952 $the_portfolio_items = $the_portfolio.find('.tm_pb_portfolio_items'); 953 954 tm_pb_smooth_scroll( $the_portfolio, false, 800 ); 955 956 if ( $(this).hasClass('page-prev') ) { 957 to_page = parseInt( $(this).parents('ul').find('a.active').data('page') ) - 1; 958 } else if ( $(this).hasClass('page-next') ) { 959 to_page = parseInt( $(this).parents('ul').find('a.active').data('page') ) + 1; 960 } 961 962 $(this).parents('ul').find('a').removeClass('active'); 963 $(this).parents('ul').find('a.page-' + to_page ).addClass('active'); 964 965 var current_index = $(this).parents('ul').find('a.page-' + to_page ).parent().index(), 966 total_pages = $(this).parents('ul').find('li.page').length; 967 968 $(this).parent().nextUntil('.page-' + ( current_index + 3 ) ).show(); 969 $(this).parent().prevUntil('.page-' + ( current_index - 3 ) ).show(); 970 971 $(this).parents('ul').find('li.page').each(function(i){ 972 if ( !$(this).hasClass('prev') && !$(this).hasClass('next') ) { 973 if ( i < ( current_index - 3 ) ) { 974 $(this).hide(); 975 } else if ( i > ( current_index + 1 ) ) { 976 $(this).hide(); 977 } else { 978 $(this).show(); 979 } 980 981 if ( total_pages - current_index <= 2 && total_pages - i <= 5 ) { 982 $(this).show(); 983 } else if ( current_index <= 3 && i <= 4 ) { 984 $(this).show(); 985 } 986 987 } 988 }); 989 990 if ( to_page > 1 ) { 991 $(this).parents('ul').find('li.prev').show(); 992 } else { 993 $(this).parents('ul').find('li.prev').hide(); 994 } 995 996 if ( $(this).parents('ul').find('a.active').hasClass('last-page') ) { 997 $(this).parents('ul').find('li.next').hide(); 998 } else { 999 $(this).parents('ul').find('li.next').show(); 1000 } 1001 1002 $the_portfolio.find('.tm_pb_portfolio_item').hide(); 1003 $the_portfolio.find('.tm_pb_portfolio_item').filter(function( index ) { 1004 return $(this).data('page') === to_page; 1005 }).show(); 1006 1007 setTimeout(function(){ 1008 set_filterable_portfolio_hash( $the_portfolio ); 1009 }, 500 ); 1010 }); 1011 1012 function set_filterable_portfolio_hash( $the_portfolio ) { 1013 1014 if ( !$the_portfolio.attr('id') ) { 1015 return; 1016 } 1017 1018 var this_portfolio_state = []; 1019 this_portfolio_state.push( $the_portfolio.attr('id') ); 1020 this_portfolio_state.push( $the_portfolio.find('.tm_pb_portfolio_filter > a.active').data('category-slug') ); 1021 1022 if ( $the_portfolio.find('.tm_pb_portofolio_pagination a.active').length ) { 1023 this_portfolio_state.push( $the_portfolio.find('.tm_pb_portofolio_pagination a.active').data('page') ); 1024 } else { 1025 this_portfolio_state.push( 1 ); 1026 } 1027 1028 this_portfolio_state = this_portfolio_state.join( tm_hash_module_param_seperator ); 1029 1030 tm_set_hash( this_portfolio_state ); 1031 } 1032 } /* end if ( $tm_pb_filterable_portfolio.length ) */ 1033 1034 if ( $tm_pb_gallery.length ) { 1035 1036 function set_gallery_grid_items( $the_gallery ) { 1037 var $the_gallery_items_container = $the_gallery.find('.tm_pb_gallery_items'), 1038 $the_gallery_items = $the_gallery_items_container.find('.tm_pb_gallery_item'); 1039 1040 var total_grid_items = $the_gallery_items.length, 1041 posts_number = $the_gallery_items_container.data('per_page'), 1042 pages = Math.ceil( total_grid_items / posts_number ); 1043 1044 set_gallery_grid_pages( $the_gallery, pages ); 1045 1046 var total_grid_items = 0; 1047 var _page = 1; 1048 $the_gallery_items.data('page', ''); 1049 $the_gallery_items.each(function(i){ 1050 total_grid_items++; 1051 if ( 0 === parseInt( total_grid_items % posts_number ) ) { 1052 $(this).data('page', _page); 1053 _page++; 1054 } else { 1055 $(this).data('page', _page); 1056 } 1057 1058 }); 1059 1060 var visible_items = $the_gallery_items.filter(function() { 1061 return $(this).data('page') == 1; 1062 }).show(); 1063 1064 $the_gallery_items.filter(function() { 1065 return $(this).data('page') != 1; 1066 }).hide(); 1067 } 1068 1069 function set_gallery_grid_pages( $the_gallery, pages ) { 1070 $pagination = $the_gallery.find('.tm_pb_gallery_pagination'); 1071 1072 if ( !$pagination.length ) { 1073 return; 1074 } 1075 1076 $pagination.html('<ul></ul>'); 1077 if ( pages <= 1 ) { 1078 $pagination.hide(); 1079 return; 1080 } 1081 1082 $pagination_list = $pagination.children('ul'); 1083 $pagination_list.append('<li class="prev" style="display:none;"><a href="#" data-page="prev" class="page-prev">' + tm_pb_custom.prev + '</a></li>'); 1084 for( var page = 1; page <= pages; page++ ) { 1085 var first_page_class = page === 1 ? ' active' : '', 1086 last_page_class = page === pages ? ' last-page' : '', 1087 hidden_page_class = page >= 5 ? ' style="display:none;"' : ''; 1088 $pagination_list.append('<li' + hidden_page_class + ' class="page page-' + page + '"><a href="#" data-page="' + page + '" class="page-' + page + first_page_class + last_page_class + '">' + page + '</a></li>'); 1089 } 1090 $pagination_list.append('<li class="next"><a href="#" data-page="next" class="page-next">' + tm_pb_custom.next + '</a></li>'); 1091 } 1092 1093 function set_gallery_hash( $the_gallery ) { 1094 1095 if ( !$the_gallery.attr('id') ) { 1096 return; 1097 } 1098 1099 var this_gallery_state = []; 1100 this_gallery_state.push( $the_gallery.attr('id') ); 1101 1102 if ( $the_gallery.find('.tm_pb_gallery_pagination a.active').length ) { 1103 this_gallery_state.push( $the_gallery.find('.tm_pb_gallery_pagination a.active').data('page') ); 1104 } else { 1105 this_gallery_state.push( 1 ); 1106 } 1107 1108 this_gallery_state = this_gallery_state.join( tm_hash_module_param_seperator ); 1109 1110 tm_set_hash( this_gallery_state ); 1111 } 1112 1113 $tm_pb_gallery.each(function(){ 1114 var $the_gallery = $(this); 1115 1116 if ( $the_gallery.hasClass( 'tm_pb_gallery_grid' ) ) { 1117 1118 $the_gallery.show(); 1119 set_gallery_grid_items( $the_gallery ); 1120 1121 $the_gallery.on('tm_hashchange', function( event ){ 1122 var params = event.params; 1123 $the_gallery = $( '#' + event.target.id ); 1124 1125 if ( page_to = params[0] ) { 1126 if ( !$the_gallery.find('.tm_pb_gallery_pagination a.page-' + page_to ).hasClass('active') ) { 1127 $the_gallery.find('.tm_pb_gallery_pagination a.page-' + page_to ).addClass('active').click(); 1128 } 1129 } 1130 }); 1131 } 1132 1133 }); 1134 1135 $tm_pb_gallery.data('paginating', false ); 1136 $tm_pb_gallery.on('click', '.tm_pb_gallery_pagination a', function(e){ 1137 e.preventDefault(); 1138 1139 var to_page = $(this).data('page'), 1140 $the_gallery = $(this).parents('.tm_pb_gallery'), 1141 $the_gallery_items_container = $the_gallery.find('.tm_pb_gallery_items'), 1142 $the_gallery_items = $the_gallery_items_container.find('.tm_pb_gallery_item'); 1143 1144 if ( $the_gallery.data('paginating') ) { 1145 return; 1146 } 1147 1148 $the_gallery.data('paginating', true ); 1149 1150 if ( $(this).hasClass('page-prev') ) { 1151 to_page = parseInt( $(this).parents('ul').find('a.active').data('page') ) - 1; 1152 } else if ( $(this).hasClass('page-next') ) { 1153 to_page = parseInt( $(this).parents('ul').find('a.active').data('page') ) + 1; 1154 } 1155 1156 $(this).parents('ul').find('a').removeClass('active'); 1157 $(this).parents('ul').find('a.page-' + to_page ).addClass('active'); 1158 1159 var current_index = $(this).parents('ul').find('a.page-' + to_page ).parent().index(), 1160 total_pages = $(this).parents('ul').find('li.page').length; 1161 1162 $(this).parent().nextUntil('.page-' + ( current_index + 3 ) ).show(); 1163 $(this).parent().prevUntil('.page-' + ( current_index - 3 ) ).show(); 1164 1165 $(this).parents('ul').find('li.page').each(function(i){ 1166 if ( !$(this).hasClass('prev') && !$(this).hasClass('next') ) { 1167 if ( i < ( current_index - 3 ) ) { 1168 $(this).hide();
1169 } else if ( i > ( current_index + 1 ) ) { 1170 $(this).hide(); 1171 } else { 1172 $(this).show(); 1173 } 1174 1175 if ( total_pages - current_index <= 2 && total_pages - i <= 5 ) { 1176 $(this).show(); 1177 } else if ( current_index <= 3 && i <= 4 ) { 1178 $(this).show(); 1179 } 1180 1181 } 1182 }); 1183 1184 if ( to_page > 1 ) { 1185 $(this).parents('ul').find('li.prev').show(); 1186 } else { 1187 $(this).parents('ul').find('li.prev').hide(); 1188 } 1189 1190 if ( $(this).parents('ul').find('a.active').hasClass('last-page') ) { 1191 $(this).parents('ul').find('li.next').hide(); 1192 } else { 1193 $(this).parents('ul').find('li.next').show(); 1194 } 1195 1196 $the_gallery_items.hide(); 1197 var visible_items = $the_gallery_items.filter(function( index ) { 1198 return $(this).data('page') === to_page; 1199 }).show(); 1200 1201 $the_gallery.data('paginating', false ); 1202 1203 setTimeout(function(){ 1204 set_gallery_hash( $the_gallery ); 1205 }, 100 ); 1206 1207 $( 'html, body' ).animate( { scrollTop : $the_gallery.offset().top - 200 }, 200 ); 1208 }); 1209 1210 } /* end if ( $tm_pb_gallery.length ) */ 1211 1212 if ( $tm_pb_counter_amount.length ) { 1213 $tm_pb_counter_amount.each(function(){ 1214 var $bar_item = $(this), 1215 bar_item_width = $bar_item.attr( 'data-width' ), 1216 bar_item_padding = Math.ceil( parseFloat( $bar_item.css('paddingLeft') ) ) + Math.
1216ceil( parseFloat( $bar_item.css('paddingRight') ) ), 1217 $bar_item_text = $bar_item.children( '.tm_pb_counter_amount_number' ), 1218 bar_item_text_width = $bar_item_text.width() + bar_item_padding; 1219 1220 $bar_item.css({ 1221 'width' : bar_item_width, 1222 'min-width' : bar_item_text_width 1223 }); 1224 }); 1225 } /* $tm_pb_counter_amount.length */ 1226 1227 function tm_countdown_timer( timer ) { 1228 var end_date = parseInt( timer.data( 'end-timestamp') ), 1229 current_date = new Date().getTime() / 1000, 1230 seconds_left = ( end_date - current_date ); 1231 1232 days = parseInt(seconds_left / 86400); 1233 days = days > 0 ? days : 0; 1234 seconds_left = seconds_left % 86400; 1235 1236 hours = parseInt(seconds_left / 3600); 1237 hours = hours > 0 ? hours : 0; 1238 1239 seconds_left = seconds_left % 3600; 1240 1241 minutes = parseInt(seconds_left / 60); 1242 minutes = minutes > 0 ? minutes : 0; 1243 1244 seconds = parseInt(seconds_left % 60); 1245 seconds = seconds > 0 ? seconds : 0; 1246 1247 if ( days == 0 ) { 1248 if ( !timer.find('.days > .value').parent('.section').hasClass('zero') ) { 1249 timer.find('.days > .value').html( '00' ).parent('.section').addClass('zero').next().addClass('zero'); 1250 } 1251 } else { 1252 days_slice = days.toString().length >= 2 ? days.toString().length : 2; 1253 timer.find('.days > .value').html( ('00' + days).slice(-days_slice) ); 1254 } 1255 1256 if ( days == 0 && hours == 0 ) { 1257 if ( !timer.find('.hours > .value').parent('.section').hasClass('zero') ) { 1258 timer.find('.hours > .value').html('00').parent('.section').addClass('zero').next().addClass('zero'); 1259 } 1260 } else { 1261 timer.find('.hours > .value').html( ( '0' + hours ).slice(-2) ); 1262 } 1263 1264 if ( days == 0 && hours == 0 && minutes == 0 ) { 1265 if ( !timer.find('.minutes > .value').parent('.section').hasClass('zero') ) { 1266 timer.find('.minutes > .value').html('00').parent('.section').addClass('zero').next().addClass('zero'); 1267 } 1268 } else { 1269 timer.find('.minutes > .value').html( ( '0' + minutes ).slice(-2) ); 1270 } 1271 1272 if ( days == 0 && hours == 0 && minutes == 0 && seconds == 0 ) { 1273 if ( !timer.find('.seconds > .value').parent('.section').hasClass('zero') ) { 1274 timer.find('.seconds > .value').html('00').parent('.section').addClass('zero'); 1275 } 1276 } else { 1277 timer.find('.seconds > .value').html( ( '0' + seconds ).slice(-2) ); 1278 } 1279 } 1280 1281 function tm_countdown_timer_labels( timer ) { 1282 if ( timer.closest( '.tm_pb_column_3_8' ).length || timer.closest( '.tm_pb_column_1_4' ).length || timer.children('.tm_pb_countdown_timer_container').width() <= 400 ) {
1283 timer.find('.days .label').html( timer.find('.days').data('short') ); 1284 timer.find('.hours .label').html( timer.find('.hours').data('short') ); 1285 timer.find('.minutes .label').html( timer.find('.minutes').data('short') ); 1286 timer.find('.seconds .label').html( timer.find('.seconds').data('short') ); 1287 } else { 1288 timer.find('.days .label').html( timer.find('.days').data('full') ); 1289 timer.find('.hours .label').html( timer.find('.hours').data('full') ); 1290 timer.find('.minutes .label').html( timer.find('.minutes').data('full') ); 1291 timer.find('.seconds .label').html( timer.find('.seconds').data('full') ); 1292 } 1293 } 1294 1295 if ( $tm_pb_countdown_timer.length ) { 1296 $tm_pb_countdown_timer.each(function(){ 1297 var timer = $(this); 1298 tm_countdown_timer_labels( timer ); 1299 tm_countdown_timer( timer ); 1300 setInterval(function(){ 1301 tm_countdown_timer( timer ); 1302 }, 1000); 1303 }); 1304 } 1305 1306 if ( $tm_pb_tabs.length ) { 1307 $tm_pb_tabs.tm_pb_simple_slider( { 1308 use_controls : false, 1309 use_arrows : false, 1310 slide : '.tm_pb_all_tabs > div', 1311 tabs_animation : true 1312 } ).on('tm_hashchange', function( event ){ 1313 var params = event.params; 1314 var $the_tabs = $( '#' + event.target.id ); 1315 var active_tab = params[0]; 1316 if ( !$the_tabs.find( '.tm_pb_tabs_controls li' ).eq( active_tab ).hasClass('tm_pb_tab_active') ) { 1317 $the_tabs.find( '.tm_pb_tabs_controls li' ).eq( active_tab ).click(); 1318 } 1319 }); 1320 1321 $tm_pb_tabs_li.click( function() { 1322 var $this_el = $(this), 1323 $tabs_container = $this_el.closest( '.tm_pb_tabs' ).data('tm_pb_simple_slider'); 1324 1325 if ( $tabs_container.tm_animation_running ) return false; 1326 1327 $this_el.addClass( 'tm_pb_tab_active' ).siblings().removeClass( 'tm_pb_tab_active' ); 1328 1329 $tabs_container.data('tm_pb_simple_slider').tm_slider_move_to( $this_el.index() ); 1330 1331 if ( $this_el.closest( '.tm_pb_tabs' ).attr('id') ) { 1332 var tab_state = []; 1333 tab_state.push( $this_el.closest( '.tm_pb_tabs' ).attr('id') ); 1334 tab_state.push( $this_el.index() ); 1335 tab_state = tab_state.join( tm_hash_module_param_seperator ); 1336 tm_set_hash( tab_state ); 1337 } 1338 1339 return false; 1340 } ); 1341 } 1342 1343 if ( $tm_pb_map.length ) { 1344 google.maps.event.addDomListener(window, 'load', function() { 1345 $tm_pb_map.each(function(){ 1346 var $this_map_container = $(this), 1347 $this_map = $this_map_container.children('.tm_pb_map'), 1348 this_map_grayscale = $this_map_container.data( 'grayscale' ) || 0, 1349 infowindow_active, 1350 marker_icon = $this_map.data( 'marker-icon' ) || [ tm_pb_custom.builder_images_uri + '/marker.png', 34, 53, false ], 1351 map_style = $this_map.data( 'map-style' ); 1352 1353 if ( this_map_grayscale !== 0 ) { 1354 this_map_grayscale = '-' + this_map_grayscale.toString(); 1355 } 1356 1357 $this_map_container.data('map', new google.maps.Map( $this_map[0], { 1358 zoom: parseInt( $this_map.data('zoom') ), 1359 center: new google.maps.LatLng( parseFloat( $this_map.data('center-lat') ) , parseFloat( $this_map.data('center-lng') )), 1360 mapTypeId: google.maps.MapTypeId.ROADMAP, 1361 scrollwheel: $this_map.data('mouse-wheel') == 'on' ? true : false, 1362 panControlOptions: { 1363 position: $this_map_container.is( '.tm_beneath_transparent_nav' ) ? google.maps.ControlPosition.LEFT_BOTTOM : google.maps.ControlPosition.LEFT_TOP 1364 }, 1365 zoomControlOptions: { 1366 position: $this_map_container.is( '.tm_beneath_transparent_nav' ) ? google.maps.ControlPosition.LEFT_BOTTOM : google.maps.ControlPosition.LEFT_TOP 1367 }, 1368 /*styles: [ { 1369 stylers: [ 1370 { saturation: parseInt( this_map_grayscale ) } 1371 ] 1372 } ],*/ 1373 styles: map_style 1374 })); 1375 1376 $this_map_container.data('bounds', new google.maps.LatLngBounds() ); 1377 $this_map_container.find('.tm_pb_map_pin').each(function(){ 1378 1379 var $this_marker = $(this), 1380 position = new google.maps.LatLng( parseFloat( $this_marker.data('lat') ) , parseFloat( $this_marker.data('lng') ) ); 1381 1382 $this_map_container.data('bounds').extend( position ); 1383 1384 var marker = new google.maps.Marker({ 1385 position: position, 1386 map: $this_map_container.data('map'), 1387 title: $this_marker.data('title'), 1388 icon: { 1389 url: marker_icon[0], 1390 size: new google.maps.Size( marker_icon[1], marker_icon[2] ), 1391 anchor: new google.maps.Point( marker_icon[1] / 2, marker_icon[2] ) 1392 }, 1393 //shape: { coord: [1, 1, marker_icon[1], marker_icon[2] ], type: 'rect' }, 1394 //anchorPoint: new google.maps.Point(0, -45), 1395 animation: google.maps.Animation.DROP 1396 }); 1397 1398 if ( $this_marker.find('.infowindow').length ) { 1399 var infowindow = new google.maps.InfoWindow({ 1400 content: $this_marker.html() 1401 }); 1402 1403 google.maps.event.addListener( $this_map_container.data('map'), 'click', function() { 1404 infowindow.close(); 1405 }); 1406 1407 google.maps.event.addListener(marker, 'click', function() { 1408 if( infowindow_active ) { 1409 infowindow_active.close(); 1410 } 1411 infowindow_active = infowindow; 1412 1413 infowindow.open( $this_map_container.data('map'), marker ); 1414 }); 1415 } 1416 }); 1417 1418 google.maps.event.addListener( $this_map_container.data('map'), 'bounds_changed', function() { 1419 1420 if ( !$this_map_container.data('map').getBounds().contains( $this_map_container.data('bounds').getNorthEast() ) || !$this_map_container.data('map').getBounds().contains( $this_map_container.data('bounds').getSouthWest
1420() ) ) { 1421 $this_map_container.data('map').fitBounds( $this_map_container.data('bounds') ); 1422 } 1423 1424 }); 1425 }); 1426 } ); 1427 } 1428 1429 if ( $tm_pb_shop.length ) { 1430 $tm_pb_shop.each( function() { 1431 var $this_el = $(this), 1432 icon = $this_el.data('icon') || ''; 1433 1434 if ( icon === '' ) { 1435 return true; 1436 } 1437 1438 $this_el.find( '.tm_overlay' ) 1439 .attr( 'data-icon', icon ) 1440 .addClass( 'tm_pb_inline_icon' ); 1441 } ); 1442 } 1443 1444 if ( $tm_pb_circle_counter.length ) { 1445 1446 window.tm_pb_circle_counter_init = function($the_counter, animate) { 1447 if ( 0 === $the_counter.width() ) { 1448 return; 1449 } 1450 1451 $the_counter.easyPieChart({ 1452 animate: { 1453 duration: 1800, 1454 enabled: true 1455 }, 1456 size: 0 !== $the_counter.width() ? $the_counter.width() : 10, // set the width to 10 if actual width is 0 to avoid js errors 1457 barColor: $the_counter.data( 'bar-bg-color' ), 1458 trackColor: $the_counter.data( 'color' ) || '#000000', 1459 trackAlpha: $the_counter.data( 'alpha' ) || '0.1', 1460 lineWidth: $the_counter.data( 'circle-width' ) || '5', 1461 size: $the_counter.data( 'circle-size' ) || '110', 1462 scaleColor: false, 1463 lineCap: $the_counter.data( 'bar-type' ) || 'round', 1464 onStart: function() { 1465 $(this.el).find('.percent p').css({ 'visibility' : 'visible' }); 1466 }, 1467 onStep: function(from, to, percent) { 1468 $(this.el).find('.percent-value').text( Math.round( parseInt( percent ) ) ); 1469 }, 1470 onStop: function(from, to) { 1471 $(this.el).find('.percent-value').text( $(this.el).data('number-value') ); 1472 } 1473 }); 1474 } 1475 1476 window.tm_pb_reinit_circle_counters = function( $tm_pb_circle_counter ) { 1477 $tm_pb_circle_counter.each(function(){ 1478 var $the_counter = $(this); 1479 window.tm_pb_circle_counter_init($the_counter, false); 1480 1481 $the_counter.on('containerWidthChanged', function( event ){ 1482 $the_counter = $( event.target ); 1483 $the_counter.find('canvas').remove(); 1484 $the_counter.removeData('easyPieChart' ); 1485 window.tm_pb_circle_counter_init($the_counter, true); 1486 }); 1487 1488 }); 1489 } 1490 window.tm_pb_reinit_circle_counters( $tm_pb_circle_counter ); 1491 } 1492 1493 if ( $tm_pb_number_counter.length ) { 1494 window.tm_pb_reinit_number_counters = function( $tm_pb_number_counter ) { 1495 1496 if ( $.fn.fitText ) { 1497 $tm_pb_number_counter.find( '.percent' ).fitText( 0.3 ); 1498 } 1499 1500 $tm_pb_number_counter.each(function(){ 1501 var $this_counter = $(this); 1502 $this_counter.easyPieChart({ 1503 animate: { 1504 duration: 1800, 1505 enabled: true 1506 }, 1507 size: 0, 1508 trackColor: false, 1509 scaleColor: false, 1510 lineWidth: 0, 1511 onStart: function() { 1512 $(this.el).find('.percent').css({ 'visibility' : 'visible' }); 1513 }, 1514 onStep: function(from, to, percent) { 1515 if ( percent != to ) 1516 $(this.el).find('.percent-value').text( Math.round( parseInt( percent ) ) ); 1517 }, 1518 onStop: function(from, to) { 1519 $(this.el).find('.percent-value').text( $(this.el).data('number-value') ); 1520 } 1521 }); 1522 }); 1523 } 1524 window.tm_pb_reinit_number_counters( $tm_pb_number_counter ); 1525 } 1526 1527 function tm_apply_parallax() { 1528 var $this = $(this), 1529 element_top = $this.offset().top, 1530 window_top = $tm_window.scrollTop(), 1531 y_pos = ( ( ( window_top + $tm_window.height() ) - element_top ) * 0.3 ), 1532 main_position; 1533 1534 main_position = 'translate(0, ' + y_pos + 'px)'; 1535 1536 $this.find('.tm_parallax_bg').css( { 1537 '-webkit-transform' : main_position, 1538 '-moz-transform' : main_position, 1539 '-ms-transform' : main_position, 1540 'transform' : main_position 1541 } ); 1542 } 1543 1544 function tm_parallax_set_height() { 1545 var $this = $(this), 1546 bg_height; 1547 1548 bg_height = ( $tm_window.height() * 0.3 + $this.innerHeight() ); 1549 1550 $this.find('.tm_parallax_bg').css( { 'height' : bg_height } ); 1551 } 1552 1553 $('.tm_pb_toggle_title').click( function(){ 1554 var $this_heading = $(this), 1555 $module = $this_heading.closest('.tm_pb_toggle'), 1556 $section = $module.parents( '.tm_pb_section' ), 1557 $content = $module.find('.tm_pb_toggle_content'), 1558 $accordion = $module.closest( '.tm_pb_accordion' ), 1559 is_accordion = $accordion.length, 1560 is_accordion_toggling = $accordion.hasClass( 'tm_pb_accordion_toggling' ), 1561 $accordion_active_toggle; 1562 1563 if ( is_accordion ) { 1564 if ( $module.hasClass('tm_pb_toggle_open') || is_accordion_toggling ) { 1565 return false;
1566 } 1567 1568 $accordion.addClass( 'tm_pb_accordion_toggling' ); 1569 $accordion_active_toggle = $module.siblings('.tm_pb_toggle_open'); 1570 } 1571 1572 if ( $content.is( ':animated' ) ) { 1573 return; 1574 } 1575 1576 $content.slideToggle( 700, function() { 1577 if ( $module.hasClass('tm_pb_toggle_close') ) { 1578 $module.removeClass('tm_pb_toggle_close').addClass('tm_pb_toggle_open'); 1579 } else { 1580 $module.removeClass('tm_pb_toggle_open').addClass('tm_pb_toggle_close'); 1581 } 1582 1583 if ( $section.hasClass( 'tm_pb_section_parallax' ) && !$section.children().hasClass( 'tm_pb_parallax_css') ) { 1584 $.proxy( tm_parallax_set_height, $section )(); 1585 } 1586 } ); 1587 1588 if ( is_accordion ) { 1589 $accordion_active_toggle.find('.tm_pb_toggle_content').slideToggle( 700, function() { 1590 $accordion_active_toggle.removeClass( 'tm_pb_toggle_open' ).addClass('tm_pb_toggle_close'); 1591 $accordion.removeClass( 'tm_pb_accordion_toggling' ); 1592 } ); 1593 } 1594 } ); 1595 1596 var $tm_contact_container = $( '.tm_pb_contact_form_container' ); 1597 1598 if ( $tm_contact_container.length ) { 1599 $tm_contact_container.each( function() { 1600 var $this_contact_container = $( this ), 1601 $tm_contact_form = $this_contact_container.find( 'form' ), 1602 $tm_contact_submit = $this_contact_container.find( 'input.tm_pb_contact_submit' ),
1603 $tm_inputs = $tm_contact_form.find( 'input[type=text],textarea' ), 1604 tm_email_reg = /^[\w-]+(\.[\w-]+)*@([a-z0-9-]+(\.[a-z0-9-]+)*?\.[a-z]{2,6}|(\d{1,3}\.){3}\d{1,3})(:\d{4})?$/, 1605 redirect_url = typeof $this_contact_container.data( 'redirect_url' ) !== 'undefined' ? $this_contact_container.data( 'redirect_url' ) : ''; 1606 1607 $tm_contact_form.on( 'submit', function( event ) { 1608 var $this_contact_form = $( this ), 1609 $this_inputs = $this_contact_form.find( '.tm_pb_contact_form_input, .tm_pb_contact_captcha' ), 1610 this_tm_contact_error = false, 1611 $tm_contact_message = $this_contact_form.closest( '.tm_pb_contact_form_container' ).find( '.tm-pb-contact-message' ), 1612 tm_message = '', 1613 tm_fields_message = '', 1614 $this_contact_container = $this_contact_form.closest( '.tm_pb_contact_form_container' ), 1615 $captcha_field = $this_contact_form.find( '.tm_pb_contact_captcha' ), 1616 form_unique_id = typeof $this_contact_container.data( 'form_unique_num' ) !== 'undefined' ? $this_contact_container.data( 'form_unique_num' ) : 0, 1617 inputs_list = []; 1618 tm_message = '<ul>'; 1619 1620 $this_inputs.removeClass( 'tm_contact_error' ); 1621 1622 $this_inputs.each( function(){ 1623 var $this_el = $( this ), 1624 this_val = $this_el.val(), 1625 this_label = $this_el.siblings( 'label' ).text(), 1626 field_type = typeof $this_el.data( 'field_type' ) !== 'undefined' ? $this_el.data( 'field_type' ) : 'text', 1627 required_mark = typeof $this_el.data( 'required_mark' ) !== 'undefined' ? $this_el.data( 'required_mark' ) : 'not_required', 1628 original_id = typeof $this_el.data( 'original_id' ) !== 'undefined' ? $this_el.data( 'original_id' ) : '', 1629 field_name; 1630 1631 // add current field data into array of inputs 1632 if ( typeof $this_el.attr( 'id' ) !== 'undefined' ) { 1633 inputs_list.push( { 'field_id' : $this_el.attr( 'id' ), 'original_id' : original_id, 'required_mark' : required_mark, 'field_type' : field_type, 'field_label' : this_label } ); 1634 } 1635 1636 // add error message for the field if it is required and empty 1637 if ( 'required' === required_mark && ( '' === this_val || this_label === this_val || null === this_val ) ) { 1638 $this_el.addClass( 'tm_contact_error' ); 1639 this_tm_contact_error = true; 1640 1641 field_name = $this_el.data( 'original_title' ); 1642 1643 if ( ! field_name ) { 1644 field_name = $this_el.attr( 'name' ); 1645 } 1646 1647 tm_fields_message += '<li>' + field_name + '</li>'; 1648 } 1649 1650 // add error message if email field is not empty and fails the email validation 1651 if ( 'email' === field_type && '' !== this_val && this_label !== this_val && ! tm_email_reg.test( this_val ) ) { 1652 $this_el.addClass( 'tm_contact_error' ); 1653 this_tm_contact_error = true; 1654 1655 if ( ! tm_email_reg.test( this_val ) ) { 1656 tm_message += '<li>' + tm_pb_custom.invalid + '</li>'; 1657 } 1658 } 1659 }); 1660 1661 // check the captcha value if required for current form 1662 if ( $captcha_field.length && '' !== $captcha_field.val() ) { 1663 var first_digit = parseInt( $captcha_field.data( 'first_digit' ) ), 1664 second_digit = parseInt( $captcha_field.data( 'second_digit' ) ); 1665 1666 if ( parseInt( $captcha_field.val() ) !== first_digit + second_digit ) { 1667 1668 tm_message += '<li>' + tm_pb_custom.wrong_captcha + '</li>'; 1669 this_tm_contact_error = true; 1670 1671 // generate new digits for captcha 1672 first_digit = Math.floor( ( Math.random() * 15 ) + 1 ); 1673 second_digit = Math.floor( ( Math.random() * 15 ) + 1 ); 1674 1675 // set new digits for captcha 1676 $captcha_field.data( 'first_digit', first_digit ); 1677 $captcha_field.data( 'second_digit', second_digit ); 1678 1679 // regenerate captcha on page 1680 $this_contact_form.find( '.tm_pb_contact_captcha_question' ).empty().append( first_digit + ' + ' + second_digit ); 1681 } 1682 1683 } 1684 1685 if ( ! this_tm_contact_error ) { 1686 var $href = $( this ).attr( 'action' ), 1687 form_data = $( this ).serializeArray(); 1688 1689 form_data.push( { 'name': 'tm_pb_contact_email_fields_' + form_unique_id, 'value' : JSON.stringify( inputs_list ) } ); 1690 1691 $this_contact_container.fadeTo( 'fast', 0.2 ).load( $href + ' #' + $this_contact_form.closest( '.tm_pb_contact_form_container' ).attr( 'id' ), form_data, function( responseText ) { 1692 // redirect if redirect URL is not empty and no errors in contact form
1693 if ( '' !== redirect_url && ! $( responseText ).find( '.tm_pb_contact_error_text').length ) { 1694 window.location.href = redirect_url; 1695 } 1696 1697 $this_contact_container.fadeTo( 'fast', 1 ); 1698 } ); 1699 } 1700 1701 tm_message += '</ul>'; 1702 1703 if ( '' !== tm_fields_message ) { 1704 if ( tm_message != '<ul></ul>' ) { 1705 tm_message = '<p class="tm_normal_padding">' + tm_pb_custom.contact_error_message + '</p>' + tm_message; 1706 } 1707 1708 tm_fields_message = '<ul>' + tm_fields_message + '</ul>'; 1709 1710 tm_fields_message = '<p>' + tm_pb_custom.fill_message + '</p>' + tm_fields_message; 1711 1712 tm_message = tm_fields_message + tm_message; 1713 } 1714 1715 if ( tm_message != '<ul></ul>' ) { 1716 $tm_contact_message.html( tm_message ); 1717 } 1718 1719 event.preventDefault(); 1720 }); 1721 }); 1722 } 1723 1724 $( '.tm_pb_video .tm_pb_video_overlay, .tm_pb_video_wrap .tm_pb_video_overlay' ).click( function() { 1725 var $this = $(this), 1726 $video_image = $this.closest( '.tm_pb_video_overlay' ); 1727 1728 $video_image.fadeTo( 500, 0, function() { 1729 var $image = $(this); 1730 1731 $image.css( 'display', 'none' ); 1732 } ); 1733 1734 return false; 1735 } ); 1736 1737 function tm_pb_resize_section_video_bg( $video ) { 1738 $element = typeof $video !== 'undefined' ? $video.closest( '.tm_pb_section_video_bg' ) : $( '.tm_pb_section_video_bg' ); 1739 1740 $element.each( function() { 1741 var $this_el = $(this), 1742 ratio = ( typeof $this_el.attr( 'data-ratio' ) !== 'undefined' ) 1743 ? $this_el.attr( 'data-ratio' ) 1744 : $this_el.find('video').attr( 'width' ) / $this_el.find('video').attr( 'height' ), 1745 $video_elements = $this_el.find( '.mejs-video, video, object' ).css( 'margin', 0 ), 1746 $container = $this_el.closest( '.tm_pb_section_video' ).length 1747 ? $this_el.closest( '.tm_pb_section_video' ) 1748 : $this_el.closest( '.tm_pb_slides' ), 1749 body_width = $container.width(), 1750 container_height = $container.innerHeight(), 1751 width, height; 1752 1753 if ( typeof $this_el.attr( 'data-ratio' ) == 'undefined' ) 1754 $this_el.attr( 'data-ratio', ratio ); 1755 1756 if ( body_width / container_height < ratio ) { 1757 width = container_height * ratio; 1758 height = container_height; 1759 } else { 1760 width = body_width; 1761 height = body_width / ratio; 1762 } 1763 1764 $video_elements.width( width ).height( height ); 1765 } ); 1766 } 1767 1768 function tm_pb_center_video( $video ) { 1769 $element = typeof $video !== 'undefined' ? $video : $( '.tm_pb_section_video_bg .mejs-video' ); 1770 1771 $element.each( function() { 1772 var $video_width = $(this).width() / 2; 1773 var $video_width_negative = 0 - $video_width; 1774 $(this).css("margin-left",$video_width_negative ); 1775 1776 if ( typeof $video !== 'undefined' ) { 1777 if ( $video.closest( '.tm_pb_slider' ).length && ! $video.closest( '.tm_pb_first_video' ).length ) 1778 return false; 1779 } 1780 } ); 1781 } 1782 1783 function tm_fix_slider_height() { 1784 if ( ! $tm_pb_slider.length ) return; 1785 1786 $tm_pb_slider.each( function() { 1787 var $slide_section = $(this).parent( '.tm_pb_section' ), 1788 $slide = $(this).find( '.tm_pb_slide' ), 1789 $slide_container = $slide.find( '.tm_pb_container' ), 1790 max_height = 0; 1791 1792 // If this is appears at the first section benath transparent nav, skip it 1793 // leave it to tm_fix_page_container_position() 1794 if ( $slide_section.is( '.tm_pb_section_first' ) ){ 1795 return true; 1796 } 1797 1798 $slide_container.css( 'min-height', 0 ); 1799 1800 $slide.each( function() { 1801 var $this_el = $(this), 1802 height = $this_el.innerHeight(); 1803 1804 if ( max_height < height ) 1805 max_height = height; 1806 } ); 1807 1808 $slide_container.css( 'min-height', max_height ); 1809 } ); 1810 } 1811 1812 /** 1813 * Add conditional class to prevent unwanted dropdown nav 1814 */ 1815 function tm_fix_nav_direction() { 1816 window_width = $(window).width(); 1817 $('.nav li.tm-reverse-direction-nav').removeClass( 'tm-reverse-direction-nav' ); 1818 $('.nav li li ul').each(function(){ 1819 var $dropdown = $(this), 1820 dropdown_width = $dropdown.width(), 1821 dropdown_offset = $dropdown.offset(), 1822 $parents = $dropdown.parents('.nav > li'); 1823 1824 if ( dropdown_offset.left > ( window_width - dropdown_width ) ) { 1825 $parents.addClass( 'tm-reverse-direction-nav' ); 1826 } 1827 }); 1828 } 1829 tm_fix_nav_direction(); 1830 1831 tm_pb_form_placeholders_init( $( '.tm_pb_newsletter_form' ) ); 1832 1833 $('.tm_pb_fullwidth_menu ul.nav').each(function(i) { 1834 i++; 1835 tm_duplicate_menu( $(this), $(this).parents('.tm_pb_row').find('div .mobile_nav'), 'mobile_menu' + i, 'tm_mobile_menu' ); 1836 }); 1837 1838 window.tm_fix_testimonial_inner_width = function() { 1839 var window_width = $( window ).width(); 1840 1841 if( window_width > 767 ){ 1842 $( '.tm_pb_testimonial' ).each( function() { 1843 if ( ! $(this).is(':visible') ) { 1844 return; 1845 } 1846 1847 var $testimonial = $(this), 1848 testimonial_width = $testimonial.width(), 1849 $portrait = $testimonial.find( '.tm_pb_testimonial_portrait' ), 1850 portrait_width = $portrait.width(), 1851 $testimonial_inner= $testimonial.find( '.tm_pb_testimonial_description_inner' ), 1852 $outer_column = $testimonial.closest( '.tm_pb_column' ), 1853 testimonial_inner_width = testimonial_width, 1854 subtract = ! ( $outer_column.hasClass( 'tm_pb_column_1_3' ) || $outer_column.hasClass( 'tm_pb_column_1_4' ) || $outer_column.hasClass( 'tm_pb_column_3_8' ) ) ? portrait_width + 31 : 0; 1855 1856 $testimonial_inner.width( testimonial_inner_width - subtract ); 1857 } ); 1858 } else { 1859 $( '.tm_pb_testimonial_description_inner' ).removeAttr( 'style' ); 1860 } 1861 } 1862 window.tm_fix_testimonial_inner_width(); 1863 1864 window.tm_reinint_waypoint_modules = function() { 1865 if ( $.fn.waypoint ) { 1866 var $tm_pb_circle_counter = $( '.tm_pb_circle_counter_bar' ), 1867 $tm_pb_number_counter = $( '.tm_pb_number_counter' ); 1868 1869 $( '.tm_pb_counter_container, .tm-waypoint' ).waypoint( { 1870 offset: '75%', 1871 handler: function() { 1872 $(this.element).addClass( 'tm-animated' ); 1873 } 1874 } ); 1875 1876 if ( $tm_pb_circle_counter.length ) { 1877 $tm_pb_circle_counter.each(function(){ 1878 var $this_counter = $(this); 1879 if ( ! $this_counter.is( ':visible' ) ) { 1880 return; 1881 } 1882 $this_counter.waypoint({ 1883 offset: '65%', 1884 handler: function() { 1885 $this_counter.data('easyPieChart').update( $this_counter.data('number-value') ); 1886 } 1887 }); 1888 }); 1889 } 1890 1891 if ( $tm_pb_number_counter.length ) { 1892 $tm_pb_number_counter.each(function(){ 1893 var $this_counter = $(this); 1894 $this_counter.waypoint({ 1895 offset: '75%', 1896 handler: function() { 1897 $this_counter.data('easyPieChart').update( $this_counter.data('number-value') ); 1898 } 1899 }); 1900 }); 1901 } 1902 } 1903 } 1904 1905 window.tm_calc_fullscreen_section = function() { 1906 var $tm_window = $(window), 1907 $body = $( 'body' ), 1908 $wpadminbar = $( '#wpadminbar' ), 1909 tm_is_vertical_nav = $body.hasClass( 'tm_vertical_nav' ), 1910 $this_section = $(this), 1911 this_section_index = $this_section.index('.tm_pb_fullwidth_header'), 1912 $header = $this_section.children('.tm_pb_fullwidth_header_container'), 1913 $header_content = $header.children('.header-content-container'), 1914 $header_image = $header.children('.header-image-container'), 1915 sectionHeight = $tm_window.height(), 1916 $wpadminbar = $('#wpadminbar'), 1917 $top_header = $('#top-header'), 1918 $main_header = $('#main-header'), 1919 tm_header_height, 1920 secondary_nav_height; 1921 1922 secondary_nav_height = $top_header.length && $top_header.is( ':visible' ) ? $top_header.innerHe
1922ight() : 0; 1923 tm_header_height = $main_header.length ? $main_header.innerHeight() + secondary_nav_height : 0; 1924 1925 var calc_header_offset = ( $wpadminbar.length ) ? tm_header_height + $wpadminbar.innerHeight() - 1 : tm_header_height - 1; 1926 1927 // Section height adjustment differs in vertical and horizontal nav 1928 if ( $body.hasClass('tm_vertical_nav') ) { 1929 if ( $tm_window.width() >= 980 && $top_header.length ) { 1930 sectionHeight -= $top_header.height(); 1931 } 1932 1933 if ( $wpadminbar.length ) { 1934 sectionHeight -= $wpadminbar.height(); 1935 } 1936 } else { 1937 if ( $body.hasClass('tm_hide_nav' ) ) { 1938 // If user is logged in and hide navigation is in use, adjust the section height 1939 if ( $wpadminbar.length ) { 1940 sectionHeight -= $wpadminbar.height(); 1941 } 1942 1943 // In mobile, header always appears. Adjust the section height 1944 if ( $tm_window.width() < 981 && ! $body.hasClass('tm_transparent_nav') ) { 1945 sectionHeight -= $('#main-header').height(); 1946 } 1947 } else { 1948 if ( $this_section.offset().top <= calc_header_offset + 3 ) { 1949 if ( tm_is_vertical_nav ) { 1950 var $top_header = $('#top-header'), 1951 top_header_height = ( $top_header.length && 0 === $this_section.index( '.tm_pb_fullscreen' ) ) ? $top_header.height() : 0, 1952 wpadminbar_height = ( $wpadminbar.length && 0 === $this_section.index( '.tm_pb_fullscreen' ) ) ? $wpadminbar.height() : 0, 1953 calc_header_offset_vertical = wpadminbar_height + top_header_height; 1954 1955 sectionHeight -= calc_header_offset_vertical; 1956 } else { 1957 sectionHeight -= calc_header_offset; 1958 } 1959 } 1960 } 1961 } 1962 1963 // If the transparent primary nav + hide nav until scroll is being used, 1964 // cancel automatic padding-top added by transparent nav mechanism 1965 if ( $body.hasClass('tm_transparent_nav') && $body.hasClass( 'tm_hide_nav' ) && 0 === this_section_index ) { 1966 $this_section.css( 'padding-top', '' ); 1967 } 1968 1969 $this_section.css('min-height', sectionHeight + 'px' ); 1970 $header.css('min-height', sectionHeight + 'px' ); 1971 1972 if ( $header.hasClass('center') && $header_content.hasClass('bottom') && $header_image.hasClass('bottom') ) { 1973 $header.addClass('bottom-bottom'); 1974 } 1975 1976 if ( $header.hasClass('center') && $header_content.hasClass('center') && $header_image.hasClass('center') ) { 1977 $header.addClass('center-center'); 1978 } 1979 1980 if ( $header.hasClass('center') && $header_content.hasClass('center') && $header_image.hasClass('bottom') ) { 1981 $header.addClass('center-bottom'); 1982 1983 var contentHeight = sectionHeight - $header_image.outerHeight( true ); 1984 1985 if ( contentHeight > 0 ) { 1986 $header_content.css('min-height', contentHeight + 'px' ); 1987 } 1988 } 1989 1990 if ( $header.hasClass('center') && $header_content.hasClass('bottom') && $header_image.hasClass('center') ) { 1991 $header.addClass('bottom-center'); 1992 } 1993 1994 if ( ( $header.hasClass('left') || $header.hasClass('right') ) && !$header_content.length && $header_image.length ) { 1995 $header.css('justify-content', 'flex-end'); 1996 } 1997 1998 if ( $header.hasClass('center') && $header_content.hasClass('bottom') && !$header_image.length ) { 1999 $header_content.find('.header-content').css( 'margin-bottom', 80 + 'px' ); 2000 } 2001 2002 if ( $header_content.hasClass('bottom') && $header_image.hasClass('center') ) { 2003 $header_image.find('.header-image').css( 'margin-bottom', 80 + 'px' ); 2004 $header_image.css('align-self', 'flex-end'); 2005 } 2006 } 2007 2008 $( window ).resize( function(){ 2009 var window_width = $tm_window.width(),
2010 tm_container_css_width = $tm_container.css( 'width' ), 2011 tm_container_width_in_pixel = ( typeof tm_container_css_width !== 'undefined' ) ? tm_container_css_width.substr( -1, 1 ) !== '%' : '', 2012 tm_container_actual_width = ( tm_container_width_in_pixel ) ? $tm_container.width() : ( ( $tm_container.width() / 100 ) * window_width ), // $tm_container.width() doesn't recognize pixel or percentage unit. It's our duty to understand what it returns and convert it properly 2013 containerWidthChanged = tm_container_width !== tm_container_actual_width; 2014 2015 tm_pb_resize_section_video_bg(); 2016 tm_pb_center_video(); 2017 tm_fix_slider_height(); 2018 tm_fix_nav_direction(); 2019 2020 $tm_pb_fullwidth_portfolio.each(function(){ 2021 set_container_height = $(this).hasClass('tm_pb_fullwidth_portfolio_carousel') ? true : false; 2022 set_fullwidth_portfolio_columns( $(this), set_container_height ); 2023 }); 2024 2025 if ( containerWidthChanged ) { 2026 $('.container-width-change-notify').trigger('containerWidthChanged'); 2027 2028 setTimeout( function() { 2029 $tm_pb_filterable_portfolio.each(function(){ 2030 set_filterable_grid_items( $(this) ); 2031 }); 2032 $tm_pb_gallery.each(function(){ 2033 if ( $(this).hasClass( 'tm_pb_gallery_grid' ) ) { 2034 set_gallery_grid_items( $(this) ); 2035 } 2036 }); 2037 }, 100 ); 2038 2039 tm_container_width = tm_container_actual_width; 2040 2041 etRecalculateOffset = true; 2042 2043 if ( $tm_pb_circle_counter.length ) { 2044 $tm_pb_circle_counter.each(function(){ 2045 var $this_counter = $(this); 2046 if ( ! $this_counter.is( ':visible' ) ) { 2047 return; 2048 } 2049 2050 $this_counter.data('easyPieChart').update( $this_counter.data('number-value') ); 2051 }); 2052 } 2053 if ( $tm_pb_countdown_timer.length ) { 2054 $tm_pb_countdown_timer.each(function(){ 2055 var timer = $(this); 2056 tm_countdown_timer_labels( timer ); 2057 } ); 2058 } 2059 } 2060 2061 window.tm_fix_testimonial_inner_width(); 2062 2063 tm_audio_module_set(); 2064 } ); 2065 2066 $( window ).ready( function(){ 2067 if ( $.fn.fitVids ) { 2068 $( '.tm_pb_slide_video' ).fitVids(); 2069 $( '.tm_pb_module' ).fitVids( { customSelector: "iframe[src^='http://www.hulu.com'], iframe[src^='http://www.dailymotion.com'], iframe[src^='http://www.funnyordie.com'], iframe[src^='https://embed-ssl.ted.com'], iframe[src^='http://embed.revision3.com'], iframe[src^='https://flickr.com'], iframe[src^='http://blip.tv'], iframe[src^='http://www.collegehumor.com']"} ); 2070 } 2071 2072 tm_fix_video_wmode('.fluid-width-video-wrapper'); 2073 2074 tm_fix_slider_height(); 2075 } ); 2076 2077 $( window ).load( function(){ 2078 tm_fix_fullscreen_section(); 2079 2080 $( 'section.tm_pb_fullscreen' ).each( function(){ 2081 var $this_section = $( this ); 2082 2083 $.proxy( tm_calc_fullscreen_section, $this_section )(); 2084 2085 $tm_window.on( 'resize', $.proxy( tm_calc_fullscreen_section, $this_section ) ); 2086 }); 2087 2088 $( '.tm_pb_fullwidth_header_scroll a' ).click( function( event ) { 2089 event.preventDefault(); 2090 2091 var $this_section = $(this).parents( 'section' ), 2092 is_next_fullscreen = $this_section.next().hasClass( 'tm_pb_fullscreen' ), 2093 $wpadminbar = $('#wpadminbar'), 2094 wpadminbar_height = ( $wpadminbar.length && ! is_next_fullscreen ) ? $wpadminbar.height() : 0, 2095 main_header_height = is_next_fullscreen || ! tm_is_fixed_nav ? 0 : $main_header.height(), 2096 top_header_height = is_next_fullscreen || ! tm_is_fixed_nav ? 0 : $top_header.height(), 2097 section_bottom = $this_section.offset().top + $this_section.outerHeight( true ) - ( wpadminbar_height + top_header_height + main_header_height ); 2098 2099 if ( $this_section.length ) { 2100 $( 'html, body' ).animate( { scrollTop : section_bottom }, 800 ); 2101 2102 if ( ! $( '#main-header' ).hasClass( 'tm-fixed-header' ) && $( 'body' ).hasClass( 'tm_fixed_nav' ) && $( window ).width() > 980 ) { 2103 setTimeout(function(){ 2104 var section_offset_top = $this_section.offset().top, 2105 section_height = $this_section.outerHeight( true ), 2106 main_header_height = is_next_fullscreen ? 0 : $main_header.height(), 2107 section_bottom = section_offset_top + section_height - ( main_header_height + top_header_height + wpadminbar_height); 2108 2109 $( 'html, body' ).animate( { scrollTop : section_bottom }, 280, 'linear' ); 2110 }, 780 ); 2111 } 2112 } 2113 }); 2114 2115 setTimeout( function() { 2116 $( '.tm_pb_preload' ).removeClass( 'tm_pb_preload' ); 2117 }, 500 ); 2118 2119 if ( $.fn.hashchange ) { 2120 $(window).hashchange( function(){ 2121 var hash = window.location.hash.substring(1); 2122 process_tm_hashchange( hash ); 2123 }); 2124 $(window).hashchange(); 2125 } 2126 2127 if ( $tm_pb_parallax.length && !tm_is_mobile_device ) { 2128 $tm_pb_parallax.each(function(){ 2129 if ( $(this).hasClass('tm_pb_parallax_css') ) { 2130 return; 2131 } 2132 2133 var $this_parent = $(this).parent(); 2134 2135 $.proxy( tm_parallax_set_height, $this_parent )(); 2136 2137 $.proxy( tm_apply_parallax, $this_parent )(); 2138 2139 $tm_window.on( 'scroll', $.proxy( tm_apply_parallax, $this_parent ) ); 2140 2141 $tm_window.on( 'resize', $.proxy( tm_parallax_set_height, $this_parent ) ); 2142 $tm_window.on( 'resize', $.proxy( tm_apply_parallax, $this_parent ) ); 2143 2144 $this_parent.find('.tm-learn-more .heading-more').click( function() { 2145 setTimeout(function(){ 2146 $.proxy( tm_parallax_set_height, $this_parent )(); 2147 }, 300 ); 2148 }); 2149 }); 2150 } 2151 2152 tm_audio_module_set(); 2153 2154 window.tm_reinint_waypoint_modules(); 2155 } ); 2156 2157 if ( $( '.tm_section_specialty' ).length ) { 2158 $( '.tm_section_specialty' ).each( function() { 2159 var this_row = $( this ).find( '.tm_pb_row' ); 2160 2161 this_row.find( '>.tm_pb_column:not(.tm_pb_specialty_column)' ).addClass( 'tm_pb_column_single' ); 2162 }); 2163 } 2164 2165 /** 2166 * In particular browser, map + parallax doesn't play well due the use of CSS 3D transform 2167 */ 2168 if ( $('.tm_pb_section_parallax').length && $('.tm_pb_map').length ) { 2169 $('body').addClass( 'parallax-map-support' ); 2170 } 2171 2172 /** 2173 * Add conditional class for search widget in sidebar module 2174 */ 2175 $('.tm_pb_widget_area ' + tm_pb_custom.widget_search_selector ).each( function() { 2176 var $search_wrap = $(this), 2177 $search_input_submit = $search_wrap.find('input[type="submit"]'), 2178 search_input_submit_text = $search_input_submit.attr( 'value' ), 2179 $search_button = $search_wrap.find('button'), 2180 search_button_text = $search_button.text(), 2181 has_submit_button = $search_input_submit.length || $search_button.length ? true : false, 2182 min_column_width = 150; 2183 2184 if ( ! $search_wrap.find( 'input[type="text"]' ).length && ! $search_wrap.find( 'input[type="search"]' ).length ) { 2185 return; 2186 } 2187 2188 // Mark no button state 2189 if ( ! has_submit_button ) { 2190 $search_wrap.addClass( 'tm-no-submit-button' ); 2191 } 2192 2193 // Mark narrow state 2194 if ( $search_wrap.width() < 150 ) { 2195 $search_wrap.addClass( 'tm-narrow-wrapper' ); 2196 } 2197 2198 // Fixes issue where theme's search button has no text: treat it as non-existent 2199 if ( $search_input_submit.length && ( typeof search_input_submit_text == 'undefined' || search_input_submit_text === '' ) ) { 2200 $search_input_submit.remove(); 2201 $search_wrap.addClass( 'tm-no-submit-button' ); 2202 } 2203 2204 if ( $search_button.length && ( typeof search_button_text == 'undefined' || search_button_text === '' ) ) { 2205 $search_button.remove(); 2206 $search_wrap.addClass( 'tm-no-submit-button' ); 2207 } 2208 2209 } ); 2210 2211 if ( $( '.tm_pb_search' ).length ) { 2212 $( '.tm_pb_search' ).each( function() { 2213 var $this_module = $( this ), 2214 $input_field = $this_module.find( '.tm_pb_s' ), 2215 $button = $this_module.find( '.tm_pb_searchsubmit' ), 2216 input_padding = $this_module.hasClass( 'tm_pb_text_align_right' ) ? 'paddingLeft' : 'paddingRight', 2217 disabled_button = $this_module.hasClass( 'tm_pb_hide_search_button' ); 2218 2219 if ( $button.innerHeight() > $input_field.innerHeight() ) { 2220 $input_field.height( $button.innerHeight() ); 2221 } 2222 2223 if ( ! disabled_button ) { 2224 $input_field.css( input_padding, $button.innerWidth() + 10 ); 2225 } 2226 }); 2227 } 2228 2229 // apply required classes for the Reply buttons in Comments Module 2230 if ( $( '.tm_pb_comments_module' ).length ) { 2231 $( '.tm_pb_comments_module' ).each( function() { 2232 var $comments_module = $( this ), 2233 $comments_module_button = $comments_module.find( '.comment-reply-link' ); 2234 2235 if ( $comments_module_button.length ) { 2236 $comments_module_button.addClass( 'tm_pb_button' ); 2237 2238 if ( typeof $comments_module.data( 'icon' ) !== 'undefined' ) { 2239 $comments_module_button.attr( 'data-icon', $comments_module.data( 'icon' ) ); 2240 $comments_module_button.addClass( 'tm_pb_custom_button_icon' ); 2241 } 2242 } 2243 }); 2244 } 2245 2246 // Carousel Module 2247 if ( $( '.tm_pb_swiper' )[0] ) { 2248 $( '.tm_pb_swiper' ).each( function() { 2249 var $this = $( this ), 2250 settings = $this.data('settings'), 2251 pagination = ( 'on' === settings['pagination'] ) ? true : false , 2252 navigateButton = ( 'on' === settings['navigateButton'] ) ? true : false , 2253 autoplay = ( 'on' === settings['autoplay'] ) ? 3500 : false , 2254 centeredSlides = ( 'on' === settings['centeredSlides'] ) ? true : false , 2255 spaceBetweenSlides = settings['spaceBetweenSlides'] || 0 , 2256 slidesPerView = settings['slidesPerView'], 2257 swiperContainer = $( '.swiper-container', $this ), 2258 swiper = new Swiper( swiperContainer , { 2259 slidesPerView: +slidesPerView, 2260 autoplay: autoplay, 2261 centeredSlides: centeredSlides, 2262 mousewheelControl: false, 2263 paginationClickable: true, 2264 spaceBetween: +spaceBetweenSlides, 2265 speed: 500, 2266 nextButton: ( navigateButton ) ? $('.swiper-button-next', $this) : null, 2267 prevButton: ( navigateButton ) ? $('.swiper-button-prev', $this) : null, 2268 pagination: ( pagination ) ? $('.swiper-pagination', $this) : null, 2269 onInit: function(){ 2270 if ( ! navigateButton ) { 2271 $('.swiper-button-next, .swiper-button-prev', $this).remove(); 2272 } 2273 2274 if ( ! pagination ) { 2275 $('.swiper-pagination', $this).remove(); 2276 } 2277 }, 2278 breakpoints: { 2279 1200: { 2280 slidesPerView: Math.floor( slidesPerView * 0.75 ), 2281 spaceBetween: Math.floor( spaceBetweenSlides * 0.75 ) 2282 }, 2283 992: { 2284 slidesPerView: Math.floor( slidesPerView * 0.5 ), 2285 spaceBetween: Math.floor( spaceBetweenSlides * 0.5 ) 2286 }, 2287 769: { 2288 slidesPerView: ( 0 !== Math.floor( slidesPerView * 0.25 ) ) ? Math.floor( slidesPerView * 0.25 ) : 1 2289 }, 2290 } 2291 }); 2292 }); 2293 2294 $( window ).on( 'load', loadHandler ); 2295 function loadHandler() { 2296 $( '.tm_pb_swiper' ).css({ 'opacity': '1' }); 2297 } 2298 } 2299 2300});
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.