1(function($){ 2 jQuery.fn.reverse = [].reverse; 3 $.et_pb_simple_slider = function(el, options) { 4 var settings = $.extend( { 5 slide : '.et-slide', // slide class 6 arrows : '.et-pb-slider-arrows', // arrows container class 7 prev_arrow : '.et-pb-arrow-prev', // left arrow class 8 next_arrow : '.et-pb-arrow-next', // right arrow class 9 controls : '.et-pb-controllers a', // control selector 10 carousel_controls : '.et_pb_carousel_item', // carousel control selector 11 control_active_class : 'et-pb-active-control', // active control class name 12 previous_text : et_custom.previous, // previous arrow text 13 next_text : et_custom.next, // next arrow text 14 fade_speed : 500, // fade effect speed 15 use_arrows : true, // use arrows? 16 use_controls : true, // use controls? 17 manual_arrows : '', // html code for custom arrows 18 append_controls_to : '', // controls are appended to the slider element by default, here you can specify the element it should append to 19 controls_below : false, 20 controls_class : 'et-pb-controllers', // controls container class name 21 slideshow : false, // automattic animation? 22 slideshow_speed : 7000, // automattic animation speed 23 show_progress_bar : false, // show progress bar if automattic animation is active 24 tabs_animation : false, 25 use_carousel : false 26 }, options ); 27 28 var $et_slider = $(el), 29 $et_slide = $et_slider.find( settings.slide ), 30 et_slides_number = $et_slide.length, 31 et_fade_speed = settings.fade_speed, 32 et_active_slide = 0, 33 $et_slider_arrows, 34 $et_slider_prev, 35 $et_slider_next, 36 $et_slider_controls, 37 $et_slider_carousel_controls, 38 et_slider_timer, 39 controls_html = '', 40 carousel_html = '', 41 $progress_bar = null, 42 progress_timer_count = 0, 43 $et_pb_container = $et_slider.find( '.et_pb_container' ), 44 et_pb_container_width = $et_pb_container.width(); 45 46 $et_slider.et_animation_running = false; 47 48 $.data(el, "et_pb_simple_slider", $et_slider); 49 50 $et_slide.eq(0).addClass( 'et-pb-active-slide' ); 51 52 if ( ! settings.tabs_animation ) { 53 if ( !$et_slider.hasClass('et_pb_bg_layout_dark') && !$et_slider.hasClass('et_pb_bg_layout_light') ){ 54 $et_slider.addClass( et_get_bg_layout_color( $et_slide.eq(0) ) ); 55 } 56 } 57 58 if ( settings.use_arrows && et_slides_number > 1 ) { 59 if ( settings.manual_arrows == '' ) 60 $et_slider.append( '<div class="et-pb-slider-arrows"><a class="et-pb-arrow-prev" href="#">' + '<span>' +settings.previous_text + '</span>' + '</a><a class="et-pb-arrow-next" href="#">' + '<span>' + settings.next_text + '</span>' + '</a></div>' ); 61 else 62 $et_slider.append( settings.manual_arrows ); 63 64 $et_slider_arrows = $( settings.arrows ); 65 $et_slider_prev = $et_slider.find( settings.prev_arrow ); 66 $et_slider_next = $et_slider.find( settings.next_arrow ); 67 68 $et_slider_next.click( function(){ 69 if ( $et_slider.et_animation_running ) return false; 70 71 $et_slider.et_slider_move_to( 'next' ); 72 73 return false; 74 } ); 75 76 $et_slider_prev.click( function(){ 77 if ( $et_slider.et_animation_running ) return false; 78 79 $et_slider.et_slider_move_to( 'previous' ); 80 81 return false; 82 } ); 83 } 84 85 if ( settings.use_controls && et_slides_number > 1 ) { 86 for ( var i = 1; i <= et_slides_number; i++ ) { 87 controls_html += '<a href="#"' + ( i == 1 ? ' class="' + settings.control_active_class + '"' : '' ) + '>
87' + i + '</a>'; 88 } 89 90 controls_html = 91 '<div class="' + settings.controls_class + '">' + 92 controls_html + 93 '</div>'; 94 95 if ( settings.append_controls_to == '' ) 96 $et_slider.append( controls_html ); 97 else 98 $( settings.append_controls_to ).append( controls_html ); 99 100 if ( settings.controls_below ) 101 $et_slider_controls = $et_slider.parent().find( settings.controls ); 102 else 103 $et_slider_controls = $et_slider.find( settings.controls ); 104 105 $et_slider_controls.click( function(){ 106 if ( $et_slider.et_animation_running ) return false; 107 108 $et_slider.et_slider_move_to( $(this).index() ); 109 110 return false; 111 } ); 112 } 113 114 if ( settings.use_carousel && et_slides_number > 1 ) { 115 for ( var i = 1; i <= et_slides_number; i++ ) { 116 slide_id = i - 1; 117 image_src = ( $et_slide.eq(slide_id).data('image') !== undefined ) ? 'url(' + $et_slide.eq(slide_id).data('image') + ')' : 'none'; 118 carousel_html += '<div class="et_pb_carousel_item ' + ( i == 1 ? settings.control_active_class : '' ) + '" data-slide-id="'+ slide_id +'">' + 119 '<div class="et_pb_video_overlay" href="#" style="background-image: ' + image_src + ';">' + 120 '<div class="et_pb_video_overlay_hover"><a href="#" class="et_pb_video_play"></a></div>' + 121 '</div>' + 122 '</div>'; 123 } 124 125 carousel_html = 126 '<div class="et_pb_carousel">' + 127 '<div class="et_pb_carousel_items">' + 128 carousel_html + 129 '</div>' + 130 '</div>'; 131 $et_slider.after( carousel_html ); 132 133 $et_slider_carousel_controls = $et_slider.siblings('.et_pb_carousel').find( settings.carousel_controls ); 134 $et_slider_carousel_controls.click( function(){ 135 if ( $et_slider.et_animation_running ) return false; 136 137 var $this = $(this); 138 $et_slide.eq( $this.data('slide-id') ).find('.et_pb_video_overlay').css('display', 'none'); 139 $et_slider.et_slider_move_to( $this.data('slide-id') ); 140 141 return false; 142 } ); 143 } 144 145 if ( settings.slideshow && et_slides_number > 1 ) { 146 $et_slider.hover( function() { 147 $et_slider.addClass( 'et_slider_hovered' ); 148 149 if ( typeof et_slider_timer != 'undefined' ) { 150 clearInterval( et_slider_timer ); 151 } 152 }, function() { 153 $et_slider.removeClass( 'et_slider_hovered' ); 154 155 et_slider_auto_rotate(); 156 } ); 157 } 158 159 et_slider_auto_rotate(); 160 161 function et_slider_auto_rotate(){ 162 if ( settings.slideshow && et_slides_number > 1 && ! $et_slider.hasClass( 'et_slider_hovered' ) ) { 163 et_slider_timer = setTimeout( function() { 164 $et_slider.et_slider_move_to( 'next' ); 165 }, settings.slideshow_speed ); 166 } 167 } 168 169 function et_stop_video( active_slide ) { 170 var $et_video, et_video_src; 171 172 // if there is a video in the slide, stop it when switching to another slide 173 if ( active_slide.has( 'iframe' ).length ) { 174 $et_video = active_slide.find( 'iframe' ); 175 et_video_src = $et_video.attr( 'src' ); 176 177 $et_video.attr( 'src', '' ); 178 $et_video.attr( 'src', et_video_src ); 179 180 } else if ( active_slide.has( 'video' ).length ) { 181 if ( !active_slide.find('.et_pb_section_video_bg').length ) { 182 $et_video = active_slide.find( 'video' ); 183 $et_video[0].pause(); 184 } 185 } 186 } 187 188 function et_fix_slider_content_images() { 189 var $this_slider = $et_slider, 190 $slide_image_container = $this_slider.find( '.et-pb-active-slide .et_pb_slide_image' ); 191 $slide = $slide_image_container.closest( '.et_pb_slide' ), 192 $slider = $slide.closest( '.et_pb_slider' ), 193 slide_height = $slider.innerHeight(), 194 image_height = parseInt( slide_height * 0.8 ); 195 196 $slide_image_container.find( 'img' ).css( 'maxHeight', image_height + 'px' ); 197 198 if ( $slide.hasClass( 'et_pb_media_alignment_center' ) ) { 199 $slide_image_container.css( 'marginTop', '-' + parseInt( $slide_image_container.height() / 2 ) + 'px' ); 200 } 201 202 $slide_image_container.find( 'img' ).addClass( 'active' ); 203 } 204 205 function et_get_bg_layout_color( $slide ) { 206 if ( $slide.hasClass( 'et_pb_bg_layout_dark' ) ) { 207 return 'et_pb_bg_layout_dark'; 208 } 209 210 return 'et_pb_bg_layout_light'; 211 } 212 213 $et_window.load( function() { 214 et_fix_slider_content_images(); 215 } ); 216 217 $et_window.resize( function() { 218 if ( et_pb_container_width !== $et_pb_container.width() ) { 219 et_pb_container_width = $et_pb_container.width(); 220 221 et_fix_slider_content_images(); 222 } 223 } ); 224 225 $et_slider.et_slider_move_to = function ( direction ) { 226 var $active_slide = $et_slide.eq( et_active_slide ), 227 $next_slide; 228 229 $et_slider.et_animation_running = true; 230 231 if ( direction == 'next' || direction == 'previous' ){ 232 233 if ( direction == 'next' ) 234 et_active_slide = ( et_active_slide + 1 ) < et_slides_number ? et_active_slide + 1 : 0; 235 else 236 et_active_slide = ( et_active_slide - 1 ) >= 0 ? et_active_slide - 1 : et_slides_number - 1; 237 238 } else { 239 240 if ( et_active_slide == direction ) { 241 $et_slider.et_animation_running = false;
242 return; 243 } 244 245 et_active_slide = direction; 246 247 } 248 249 if ( typeof et_slider_timer != 'undefined' ) 250 clearInterval( et_slider_timer ); 251 252 $next_slide = $et_slide.eq( et_active_slide ); 253 254 $et_slide.each( function(){ 255 $(this).css( 'zIndex', 1 ); 256 } ); 257 $active_slide.css( 'zIndex', 2 ).removeClass( 'et-pb-active-slide' ); 258 $next_slide.css( { 'display' : 'block', opacity : 0 } ).addClass( 'et-pb-active-slide' ); 259 260 et_fix_slider_content_images(); 261 262 if ( settings.use_controls ) 263 $et_slider_controls.removeClass( settings.control_active_class ).eq( et_active_slide ).addClass( settings.control_active_class ); 264 265 if ( settings.use_carousel ) 266 $et_slider_carousel_controls.removeClass( settings.control_active_class ).eq( et_active_slide ).addClass( settings.control_active_class ); 267 268 if ( ! settings.tabs_animation ) { 269 $next_slide.animate( { opacity : 1 }, et_fade_speed ); 270 $active_slide.addClass( 'et_slide_transition' ).css( { 'display' : 'list-item', 'opacity' : 1 } ).animate( { opacity : 0 }, et_fade_speed, function(){ 271 var active_slide_layout_bg_color = et_get_bg_layout_color( $active_slide ), 272 next_slide_layout_bg_color = et_get_bg_layout_color( $next_slide ); 273 274 $(this).css('display', 'none').removeClass( 'et_slide_transition' ); 275 276 et_stop_video( $active_slide ); 277 278 $et_slider 279 .removeClass( active_slide_layout_bg_color ) 280 .addClass( next_slide_layout_bg_color ); 281 282 $et_slider.et_animation_running = false; 283 } ); 284 } else { 285 $next_slide.css( { 'display' : 'none', opacity : 0 } ); 286 287 $active_slide.addClass( 'et_slide_transition' ).css( { 'display' : 'block', 'opacity' : 1 } ).animate( { opacity : 0 }, et_fade_speed, function(){ 288 $(this).css('display', 'none').removeClass( 'et_slide_transition' ); 289 290 $next_slide.css( { 'display' : 'block', 'opacity' : 0 } ).animate( { opacity : 1 }, et_fade_speed, function() { 291 $et_slider.et_animation_running = false; 292 } ); 293 } ); 294 } 295 296 et_slider_auto_rotate(); 297 } 298 } 299 300 $.fn.et_pb_simple_slider = function( options ) { 301 return this.each(function() { 302 new $.et_pb_simple_slider(this, options); 303 }); 304 } 305 306 var et_hash_module_seperator = '||', 307 et_hash_module_param_seperator = '|'; 308 309 function process_et_hashchange( hash ) { 310 if ( ( hash.indexOf( et_hash_module_seperator, 0 ) ) !== -1 ) { 311 modules = hash.split( et_hash_module_seperator ); 312 for ( var i = 0; i < modules.length; i++ ) { 313 var module_params = modules[i].split( et_hash_module_param_seperator ); 314 var element = module_params[0]; 315 module_params.shift(); 316 if ( $('#' + element ).length ) { 317 $('#' + element ).trigger({ 318 type: "et_hashchange", 319 params: module_params 320 }); 321 } 322 } 323 } else { 324 module_params = hash.split( et_hash_module_param_seperator ); 325 var element = module_params[0]; 326 module_params.shift(); 327 if ( $('#' + element ).length ) { 328 $('#' + element ).trigger({ 329 type: "et_hashchange", 330 params: module_params 331 }); 332 } 333 } 334 } 335 336 function et_set_hash( module_state_hash ) { 337 module_id = module_state_hash.split( et_hash_module_param_seperator )[0]; 338 if ( !$('#' + module_id ).length ) { 339 return; 340 } 341 342 if ( window.location.hash ) { 343 var hash = window.location.hash.substring(1), //Puts hash in variable, and removes the # character 344 new_hash = []; 345 346 if( ( hash.indexOf( et_hash_module_seperator, 0 ) ) !== -1 ) { 347 modules = hash.split( et_hash_module_seperator ); 348 var in_hash = false; 349 for ( var i = 0; i < modules.length; i++ ) { 350 var element = modules[i].split( et_hash_module_param_seperator )[0]; 351 if( element === module_id ) { 352 new_hash.push( module_state_hash ); 353 in_hash = true; 354 } else { 355 new_hash.push( modules[i] ); 356 } 357 } 358 if ( !in_hash ) { 359 new_hash.push( module_state_hash ); 360 } 361 } else { 362 module_params = hash.split( et_hash_module_param_seperator ); 363 var element = module_params[0]; 364 if ( element !== module_id ) { 365 new_hash.push( hash ); 366 } 367 new_hash.push( module_state_hash ); 368 } 369 370 hash = new_hash.join( et_hash_module_seperator ); 371 } else { 372 hash = module_state_hash; 373 } 374 375 var yScroll = document.body.scrollTop; 376 window.location.hash = hash; 377 document.body.scrollTop = yScroll; 378 } 379 380 $.et_pb_simple_carousel = function(el, options) { 381 var settings = $.extend( { 382 slide_duration : 500, 383 }, options ); 384 385 var $et_carousel = $(el), 386 $carousel_items = $et_carousel.find('.et_pb_carousel_items'), 387 $the_carousel_items = $carousel_items.find('.et_pb_carousel_item'); 388 389 $et_carousel.et_animation_running = false;
390 391 $et_carousel.addClass('container-width-change-notify').on('containerWidthChanged', function( event ){ 392 set_carousel_columns( $et_carousel ); 393 set_carousel_height( $et_carousel ); 394 }); 395 396 $carousel_items.data('items', $the_carousel_items.toArray() ); 397 $et_carousel.data('columns_setting_up', false ); 398 399 $carousel_items.prepend('<div class="et-pb-slider-arrows"><a class="et-pb-slider-arrow et-pb-arrow-prev" href="#">' + '<span>' + et_custom.previous + '</span>' + '</a><a class="et-pb-slider-arrow et-pb-arrow-next" href="#">' + '<span>' + et_custom.next + '</span>' + '</a></div>'); 400 401 set_carousel_columns( $et_carousel ); 402 set_carousel_height( $et_carousel ); 403 404 $et_carousel_next = $et_carousel.find( '.et-pb-arrow-next' ); 405 $et_carousel_prev = $et_carousel.find( '.et-pb-arrow-prev' ); 406 407 $et_carousel_next.click( function(){ 408 if ( $et_carousel.et_animation_running ) return false; 409 410 $et_carousel.et_carousel_move_to( 'next' ); 411 412 return false; 413 } ); 414 415 $et_carousel_prev.click( function(){ 416 if ( $et_carousel.et_animation_running ) return false; 417 418 $et_carousel.et_carousel_move_to( 'previous' ); 419 420 return false; 421 } ); 422 423 function set_carousel_height( $the_carousel ) { 424 var carousel_items_width = $the_carousel_items.width(), 425 carousel_items_height = $the_carousel_items.height(); 426 427 $carousel_items.css('height', carousel_items_height + 'px' ); 428 } 429 430 function set_carousel_columns( $the_carousel ) { 431 var columns, 432 $carousel_parent = $the_carousel.parents('.et_pb_column'), 433 carousel_items_width = $carousel_items.width(), 434 carousel_item_count = $the_carousel_items.length; 435 436 if ( $carousel_parent.hasClass('et_pb_column_4_4') || $carousel_parent.hasClass('et_pb_column_3_4') || $carousel_parent.hasClass('et_pb_column_2_3') ) { 437 if ( $et_window.width() < 768 ) { 438 columns = 3; 439 } else { 440 columns = 4; 441 } 442 } else if ( $carousel_parent.hasClass('et_pb_column_1_2') || $carousel_parent.hasClass('et_pb_column_3_8') || $carousel_parent.hasClass('et_pb_column_1_3') ) { 443 columns = 3; 444 } else if ( $carousel_parent.hasClass('et_pb_column_1_4') ) { 445 if ( $et_window.width() > 480 && $et_window.width() < 980 ) { 446 columns = 3; 447 } else { 448 columns = 2; 449 } 450 } 451 452 if ( columns === $carousel_items.data('columns') ) { 453 return; 454 } 455 456 if ( $the_carousel.data('columns_setting_up') ) { 457 return; 458 } 459 460 $the_carousel.data('columns_setting_up', true ); 461 462 // store last setup column 463 $carousel_items.removeClass('columns-' + $carousel_items.data('columns') ); 464 $carousel_items.addClass('columns-' + columns ); 465 $carousel_items.data('columns', columns ); 466 467 // kill all previous groups to get ready to re-group 468 if ( $carousel_items.find('.et-carousel-group').length ) { 469 $the_carousel_items.appendTo( $carousel_items ); 470 $carousel_items.find('.et-carousel-group').remove(); 471 } 472 473 // setup the grouping 474 var the_carousel_items = $carousel_items.data('items'), 475 $carousel_group = $('<div class="et-carousel-group active">').appendTo( $carousel_items ); 476 477 $the_carousel_items.data('position', ''); 478 if ( the_carousel_items.length <= columns ) { 479 $carousel_items.find('.et-pb-slider-arrows').hide(); 480 } else { 481 $carousel_items.find('.et-pb-slider-arrows').show(); 482 } 483 484 for ( position = 1, x=0 ;x < the_carousel_items.length; x++, position++ ) { 485 if ( x < columns ) { 486 $( the_carousel_items[x] ).show(); 487 $( the_carousel_items[x] ).appendTo( $carousel_group ); 488 $( the_carousel_items[x] ).data('position', position ); 489 $( the_carousel_items[x] ).addClass('position_' + position ); 490 } else { 491 position = $( the_carousel_items[x] ).data('position'); 492 $( the_carousel_items[x] ).removeClass('position_' + position ); 493 $( the_carousel_items[x] ).data('position', '' ); 494 $( the_carousel_items[x] ).hide(); 495 } 496 } 497 498 $the_carousel.data('columns_setting_up', false ); 499 500 } /* end set_carousel_columns() */ 501 502 $et_carousel.et_carousel_move_to = function ( direction ) { 503 var $active_carousel_group = $carousel_items.find('.et-carousel-group.active'), 504 items = $carousel_items.data('items'), 505 columns = $carousel_items.data('columns'); 506 507 $et_carousel.et_animation_running = true; 508 509 var left = 0; 510 $active_carousel_group.children().each(function(){ 511 $(this).css({'position':'absolute', 'left': left }); 512 left = left + $(this).outerWidth(true); 513 }); 514 515 if ( direction == 'next' ) { 516 var $next_carousel_group, 517 current_position = 1, 518 next_position = 1, 519 active_items_start = items.indexOf( $active_carousel_group.children().first()[0] ), 520 active_items_end = active_items_start + columns, 521 next_items_start = active_items_end, 522 next_items_end = next_items_start + columns; 523 524 $next_carousel_group = $('<div class="et-carousel-group next" style="display: none;left: 100%;position: absolute;top: 0;">').insertAfter( $active_carousel_group ); 525 $next_carousel_group.css({ 'width': $active_carousel_group.innerWidth() }).show(); 526 527 // this is an endless loop, so it can decide internally when to break out, so that next_position 528 // can get filled up, even to the extent of an element having both and current_ and next_ position
529 for( x = 0, total = 0 ; ; x++, total++ ) { 530 if ( total >= active_items_start && total < active_items_end ) { 531 $( items[x] ).addClass( 'changing_position current_position current_position_' + current_position ); 532 $( items[x] ).data('current_position', current_position ); 533 current_position++; 534 } 535 536 if ( total >= next_items_start && total < next_items_end ) { 537 $( items[x] ).data('next_position', next_position ); 538 $( items[x] ).addClass('changing_position next_position next_position_' + next_position ); 539 540 if ( !$( items[x] ).hasClass( 'current_position' ) ) { 541 $( items[x] ).addClass('container_append'); 542 } else { 543 $( items[x] ).clone(true).appendTo( $active_carousel_group ).hide().addClass('delayed_container_append_dup').attr('id', $( items[x] ).attr('id') + '-dup' ); 544 $( items[x] ).addClass('delayed_container_append'); 545 } 546 547 next_position++; 548 } 549 550 if ( next_position > columns ) { 551 break; 552 } 553 554 if ( x >= ( items.length -1 )) { 555 x = -1; 556 } 557 } 558 559 var sorted = $carousel_items.find('.container_append, .delayed_container_append_dup').sort(function (a, b) { 560 var el_a_position = parseInt( $(a).data('next_position') ); 561 var el_b_position = parseInt( $(b).data('next_position') ); 562 return ( el_a_position < el_b_position ) ? -1 : ( el_a_position > el_b_position ) ? 1 : 0; 563 }); 564 565 $( sorted ).show().appendTo( $next_carousel_group ); 566 567 var left = 0; 568 $next_carousel_group.children().each(function(){ 569 $(this).css({'position':'absolute', 'left': left }); 570 left = left + $(this).outerWidth(true); 571 }); 572 573 $active_carousel_group.animate({ 574 left: '-100%' 575 }, { 576 duration: settings.slide_duration, 577 complete: function() { 578 $carousel_items.find('.delayed_container_append').each(function(){ 579 left = $( '#' + $(this).attr('id') + '-dup' ).css('left'); 580 $(this).css({'position':'absolute', 'left': left }); 581 $(this).appendTo( $next_carousel_group ); 582 }); 583 584 $active_carousel_group.removeClass('active'); 585 $active_carousel_group.children().each(function(){ 586 position = $(this).data('position'); 587 current_position = $(this).data('current_position'); 588 $(this).removeClass('position_' + position + ' ' + 'changing_position current_position current_position_' + current_position ); 589 $(this).data('position', ''); 590 $(this).data('current_position', ''); 591 $(this).hide(); 592 $(this).css({'position': '', 'left': ''}); 593 $(this).appendTo( $carousel_items ); 594 }); 595 596 $active_carousel_group.remove(); 597 598 } 599 } ); 600 601 next_left = $active_carousel_group.width() + parseInt( $the_carousel_items.first().css('marginRight').slice(0, -2) ); 602 $next_carousel_group.addClass('active').css({'position':'absolute', 'top':0, left: next_left }); 603 $next_carousel_group.animate({ 604 left: '0%' 605 }, { 606 duration: settings.slide_duration, 607 complete: function(){ 608 $next_carousel_group.removeClass('next').addClass('active').css({'position':'', 'width':'', 'top':'', 'left': ''}); 609 610 $next_carousel_group.find('.changing_position').each(function( index ){ 611 position = $(this).data('position'); 612 current_position = $(this).data('current_position'); 613 next_position = $(this).data('next_position'); 614 $(this).removeClass('container_append delayed_container_append position_' + position + ' ' + 'changing_position current_position current_position_' + current_position + ' next_position next_position_' + next_position ); 615 $(this).data('current_position', ''); 616 $(this).data('next_position', ''); 617 $(this).data('position', ( index + 1 ) ); 618 }); 619 620 $next_carousel_group.children().css({'position': '', 'left': ''}); 621 $next_carousel_group.find('.delayed_container_append_dup').remove(); 622 623 $et_carousel.et_animation_running = false; 624 } 625 } ); 626 627 } else if ( direction == 'previous' ) { 628 var $prev_carousel_group, 629 current_position = columns, 630 prev_position = columns, 631 columns_span = columns - 1, 632 active_items_start = items.indexOf( $active_carousel_group.children().last(
632)[0] ), 633 active_items_end = active_items_start - columns_span, 634 prev_items_start = active_items_end - 1, 635 prev_items_end = prev_items_start - columns_span; 636 637 $prev_carousel_group = $('<div class="et-carousel-group prev" style="display: none;left: 100%;position: absolute;top: 0;">').insertBefore( $active_carousel_group ); 638 $prev_carousel_group.css({ 'left': '-' + $active_carousel_group.innerWidth(), 'width': $active_carousel_group.innerWidth() }).show(); 639 640 // this is an endless loop, so it can decide internally when to break out, so that next_position 641 // can get filled up, even to the extent of an element having both and current_ and next_ position 642 for( x = ( items.length - 1 ), total = ( items.length - 1 ) ; ; x--, total-- ) { 643 644 if ( total <= active_items_start && total >= active_items_end ) { 645 $( items[x] ).addClass( 'changing_position current_position current_position_' + current_position ); 646 $( items[x] ).data('current_position', current_position ); 647 current_position--; 648 } 649 650 if ( total <= prev_items_start && total >= prev_items_end ) { 651 $( items[x] ).data('prev_position', prev_position ); 652 $( items[x] ).addClass('changing_position prev_position prev_position_' + prev_position ); 653 654 if ( !$( items[x] ).hasClass( 'current_position' ) ) { 655 $( items[x] ).addClass('container_append'); 656 } else { 657 $( items[x] ).clone(true).appendTo( $active_carousel_group ).addClass('delayed_container_append_dup').attr('id', $( items[x] ).attr('id') + '-dup' ); 658 $( items[x] ).addClass('delayed_container_append'); 659 } 660 661 prev_position--; 662 } 663 664 if ( prev_position <= 0 ) { 665 break; 666 } 667 668 if ( x == 0 ) { 669 x = items.length; 670 } 671 } 672 673 var sorted = $carousel_items.find('.container_append, .delayed_container_append_dup').sort(function (a, b) { 674 var el_a_position = parseInt( $(a).data('prev_position') ); 675 var el_b_position = parseInt( $(b).data('prev_position') ); 676 return ( el_a_position < el_b_position ) ? -1 : ( el_a_position > el_b_position ) ? 1 : 0; 677 }); 678 679 $( sorted ).show().appendTo( $prev_carousel_group ); 680 681 var left = 0; 682 $prev_carousel_group.children().each(function(){ 683 $(this).css({'position':'absolute', 'left': left }); 684 left = left + $(this).outerWidth(true); 685 }); 686 687 $active_carousel_group.animate({ 688 left: '100%' 689 }, { 690 duration: settings.slide_duration, 691 complete: function() { 692 $carousel_items.find('.delayed_container_append').reverse().each(function(){ 693 left = $( '#' + $(this).attr('id') + '-dup' ).css('left'); 694 $(this).css({'position':'absolute', 'left': left }); 695 $(this).prependTo( $prev_carousel_group ); 696 }); 697 698 $active_carousel_group.removeClass('active'); 699 $active_carousel_group.children().each(function(){ 700 position = $(this).data('position'); 701 current_position = $(this).data('current_position'); 702 $(this).removeClass('position_' + position + ' ' + 'changing_position current_position current_position_' + current_position ); 703 $(this).data('position', ''); 704 $(this).data('current_position', ''); 705 $(this).hide(); 706 $(this).css({'position': '', 'left': ''}); 707 $(this).appendTo( $carousel_items ); 708 }); 709 710 $active_carousel_group.remove(); 711 } 712 } ); 713 714 prev_left = (-1) * $active_carousel_group.width() - parseInt( $the_carousel_items.first().css('marginRight').slice(0, -2) ); 715 $prev_carousel_group.addClass('active').css({'position':'absolute', 'top':0, left: prev_left }); 716 $prev_carousel_group.animate({ 717 left: '0%' 718 }, { 719 duration: settings.slide_duration, 720 complete: function(){ 721 $prev_carousel_group.removeClass('prev').addClass('active').css({'position':'', 'width':'', 'top':'', 'left': ''}); 722 723 $prev_carousel_group.find('.delayed_container_append_dup').remove(); 724 725 $prev_carousel_group.find('.changing_position').each(function( index ){ 726 position = $(this).data('position'); 727 current_position = $(this).data('current_position'); 728 prev_position = $(this).data('prev_position'); 729 $(this).removeClass('container_append delayed_container_append position_' + position + ' ' + 'changing_position current_position current_position_' + current_position + ' prev_position prev_position_' + prev_position ); 730 $(this).data('current_position', ''); 731 $(this).data('prev_position', ''); 732 position = index + 1; 733 $(this).data('position', position ); 734 $(this).addClass('position_' + position ); 735 }); 736 737 $prev_carousel_group.children().css({'position': '', 'left': ''}); 738 $et_carousel.et_animation_running = false;
739 } 740 } ); 741 } 742 } 743 } 744 745 $.fn.et_pb_simple_carousel = function( options ) { 746 return this.each(function() { 747 new $.et_pb_simple_carousel(this, options); 748 }); 749 } 750 751 var $et_pb_slider = $( '.et_pb_slider' ), 752 $et_pb_tabs = $( '.et_pb_tabs' ), 753 $et_pb_tabs_li = $et_pb_tabs.find( '.et_pb_tabs_controls li' ), 754 $et_pb_video_section = $('.et_pb_section_video_bg'), 755 $et_pb_newsletter_button = $( '.et_pb_newsletter_button' ), 756 $et_pb_filterable_portfolio = $( '.et_pb_filterable_portfolio' ), 757 $et_pb_fullwidth_portfolio = $( '.et_pb_fullwidth_portfolio' ), 758 $et_pb_gallery = $( '.et_pb_gallery' ), 759 $et_pb_countdown_timer = $( '.et_pb_countdown_timer' ), 760 $et_post_gallery = $( '.et_post_gallery' ), 761 $et_lightbox_image = $( '.et_pb_lightbox_image'), 762 $et_pb_map = $( '.et_pb_map_container' ), 763 $et_pb_circle_counter = $( '.et_pb_circle_counter' ), 764 $et_pb_number_counter = $( '.et_pb_number_counter' ), 765 $et_pb_parallax = $( '.et_parallax_bg' ), 766 et_is_mobile_device = navigator.userAgent.match( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/ ), 767 et_is_ipad = navigator.userAgent.match( /iPad/ ), 768 $et_container = $( '.container' ), 769 et_container_width = $et_container.width(), 770 et_is_fixed_nav = $( 'body' ).hasClass( 'et_fixed_nav' ), 771 $main_container_wrapper = $( '#page-container' ), 772 $et_window = $(window), 773 etRecalculateOffset = false, 774 et_header_height, 775 et_header_modifier, 776 et_header_offset, 777 et_primary_header_top; 778 779 $(document).ready( function(){ 780 var $et_top_menu = $( 'ul.nav' ), 781 $et_search_icon = $( '#et_search_icon' ); 782 783 $et_top_menu.find( 'li' ).hover( function() { 784 if ( ! $(this).closest( 'li.mega-menu' ).length || $(this).hasClass( 'mega-menu' ) ) { 785 $(this).addClass( 'et-show-dropdown' ); 786 $(this).removeClass( 'et-hover' ).addClass( 'et-hover' ); 787 } 788 }, function() { 789 var $this_el = $(this); 790 791 $this_el.removeClass( 'et-show-dropdown' ); 792 793 setTimeout( function() { 794 if ( ! $this_el.hasClass( 'et-show-dropdown' ) ) { 795 $this_el.removeClass( 'et-hover' ); 796 } 797 }, 200 ); 798 } ); 799 800 if ( $('ul.et_disable_top_tier').length ) { 801 $("ul.et_disable_top_tier > li > ul").prev('a').attr('href','#'); 802 } 803 804 if ( et_is_mobile_device ) { 805 $( '.et_pb_section_video_bg' ).each( function() { 806 var $this_el = $(this); 807 808 $this_el.css( 'visibility', 'hidden' ).closest( '.et_pb_preload' ).removeClass( 'et_pb_preload' ) 809 } ); 810 811 $( 'body' ).addClass( 'et_mobile_device' ); 812 813 if ( ! et_is_ipad ) { 814 $( 'body' ).addClass( 'et_mobile_device_not_ipad' ); 815 } 816 } 817 818 $et_search_icon.click( function() { 819 var $this_el = $(this), 820 $form = $this_el.siblings( '.et-search-form' ); 821 822 if ( $form.hasClass( 'et-hidden' ) ) { 823 $form.css( { 'display' : 'block', 'opacity' : 0 } ).animate( { opacity : 1 }, 500 ); 824 } else { 825 $form.animate( { opacity : 0 }, 500 ); 826 } 827 828 $form.toggleClass( 'et-hidden' ); 829 } ); 830 831 if ( $et_pb_video_section.length ) { 832 $et_pb_video_section.find( 'video' ).mediaelementplayer( { 833 pauseOtherPlayers: false, 834 success : function( mediaElement, domObject ) { 835 mediaElement.addEventListener( 'loadeddata', function() { 836 et_pb_resize_section_video_bg( $(domObject) ); 837 et_pb_center_video( $(domObject) ); 838 }, false ); 839 840 mediaElement.addEventListener( 'canplay', function() { 841 $(domObject).closest( '.et_pb_preload' ).removeClass( 'et_pb_preload' ); 842 }, false ); 843 } 844 } ); 845 } 846 847 if ( $et_post_gallery.length ) { 848 $et_post_gallery.each(function() { 849 $(this).magnificPopup( { 850 delegate: 'a', 851 type: 'image', 852 removalDelay: 500, 853 gallery: { 854 enabled: true, 855 navigateByImgClick: true 856 }, 857 mainClass: 'mfp-fade', 858 zoom: { 859 enabled: true, 860 duration: 500, 861 opener: function(element) { 862 return element.find('img'); 863 } 864 } 865 } ); 866 } ); 867 } 868 869 if ( $et_lightbox_image.length ) { 870 $et_lightbox_image.magnificPopup( { 871 type: 'image', 872 removalDelay: 500, 873 mainClass: 'mfp-fade', 874 zoom: { 875 enabled: true, 876 duration: 500, 877 opener: function(element) { 878 return element.find('img'); 879 } 880 } 881 } ); 882 } 883 884 if ( $et_pb_slider.length ){ 885 $et_pb_slider.each( function() { 886 var $this_slider = $(this), 887 et_slider_settings = { 888 fade_speed : 700, 889 slide : '.et_pb_slide' 890 } 891 892 if ( $this_slider.hasClass('et_pb_slider_no_arrows') ) 893 et_slider_settings.use_arrows = false;
894 895 if ( $this_slider.hasClass('et_pb_slider_no_pagination') ) 896 et_slider_settings.use_controls = false; 897 898 if ( $this_slider.hasClass('et_slider_auto') ) { 899 var et_slider_autospeed_class_value = /et_slider_speed_(\d+)/g; 900 901 et_slider_settings.slideshow = true; 902 903 et_slider_autospeed = et_slider_autospeed_class_value.exec( $this_slider.attr('class') ); 904 905 et_slider_settings.slideshow_speed = et_slider_autospeed[1]; 906 } 907 908 if ( $this_slider.parent().hasClass('et_pb_video_slider') ) { 909 et_slider_settings.controls_below = true; 910 et_slider_settings.append_controls_to = $this_slider.parent(); 911 912 setTimeout( function() { 913 $( '.et_pb_preload' ).removeClass( 'et_pb_preload' ); 914 }, 500 ); 915 } 916 917 if ( $this_slider.hasClass('et_pb_slider_carousel') ) 918 et_slider_settings.use_carousel = true; 919 920 $this_slider.et_pb_simple_slider( et_slider_settings ); 921 922 } ); 923 } 924 925 $et_pb_carousel = $( '.et_pb_carousel' ); 926 if ( $et_pb_carousel.length ){ 927 $et_pb_carousel.each( function() { 928 var $this_carousel = $(this), 929 et_carousel_settings = { 930 fade_speed : 1000 931 }; 932 933 $this_carousel.et_pb_simple_carousel( et_carousel_settings ); 934 } ); 935 } 936 937 if ( $et_pb_fullwidth_portfolio.length ) { 938 939 function set_fullwidth_portfolio_columns( $the_portfolio, carousel_mode ) { 940 var columns, 941 $portfolio_items = $the_portfolio.find('.et_pb_portfolio_items'), 942 portfolio_items_width = $portfolio_items.width(), 943 $the_portfolio_items = $portfolio_items.find('.et_pb_portfolio_item'), 944 portfolio_item_count = $the_portfolio_items.length; 945 946 // calculate column breakpoints 947 if ( portfolio_items_width >= 1600 ) { 948 columns = 5; 949 } else if ( portfolio_items_width >= 1024 ) { 950 columns = 4; 951 } else if ( portfolio_items_width >= 768 ) { 952 columns = 3; 953 } else if ( portfolio_items_width >= 480 ) { 954 columns = 2; 955 } else { 956 columns = 1; 957 } 958 959 // set height of items 960 portfolio_item_width = portfolio_items_width / columns;
961 portfolio_item_height = portfolio_item_width * .75; 962 963 if ( carousel_mode ) { 964 $portfolio_items.css({ 'height' : portfolio_item_height }); 965 } 966 967 $the_portfolio_items.css({ 'height' : portfolio_item_height }); 968 969 if ( columns === $portfolio_items.data('columns') ) { 970 return; 971 } 972 973 if ( $the_portfolio.data('columns_setting_up') ) { 974 return; 975 } 976 977 $the_portfolio.data('columns_setting_up', true ); 978 979 var portfolio_item_width_percentage = ( 100 / columns ) + '%'; 980 $the_portfolio_items.css({ 'width' : portfolio_item_width_percentage }); 981 982 // store last setup column 983 $portfolio_items.removeClass('columns-' + $portfolio_items.data('columns') ); 984 $portfolio_items.addClass('columns-' + columns ); 985 $portfolio_items.data('columns', columns ); 986 987 if ( !carousel_mode ) { 988 return $the_portfolio.data('columns_setting_up', false ); 989 } 990 991 // kill all previous groups to get ready to re-group 992 if ( $portfolio_items.find('.et_pb_carousel_group').length ) { 993 $the_portfolio_items.appendTo( $portfolio_items ); 994 $portfolio_items.find('.et_pb_carousel_group').remove(); 995 } 996 997 // setup the grouping 998 var the_portfolio_items = $portfolio_items.data('items' ), 999 $carousel_group = $('<div class="et_pb_carousel_group active">').appendTo( $portfolio_items ); 1000 1001 $the_portfolio_items.data('position', ''); 1002 if ( the_portfolio_items.length <= columns ) { 1003 $portfolio_items.find('.et-pb-slider-arrows').hide(); 1004 } else { 1005 $portfolio_items.find('.et-pb-slider-arrows').show(); 1006 } 1007 1008 for ( position = 1, x=0 ;x < the_portfolio_items.length; x++, position++ ) { 1009 if ( x < columns ) { 1010 $( the_portfolio_items[x] ).show(); 1011 $( the_portfolio_items[x] ).appendTo( $carousel_group ); 1012 $( the_portfolio_items[x] ).data('position', position ); 1013 $( the_portfolio_items[x] ).addClass('position_' + position ); 1014 } else { 1015 position = $( the_portfolio_items[x] ).data('position'); 1016 $( the_portfolio_items[x] ).removeClass('position_' + position ); 1017 $( the_portfolio_items[x] ).data('position', '' ); 1018 $( the_portfolio_items[x] ).hide(); 1019 } 1020 } 1021 1022 $the_portfolio.data('columns_setting_up', false ); 1023 1024 } 1025 1026 function et_carousel_auto_rotate( $carousel ) { 1027 if ( 'on' === $carousel.data('auto-rotate') && $carousel.find('.et_pb_portfolio_item').length > $carousel.find('.et_pb_carousel_group .et_pb_portfolio_item').length && ! $carousel.hasClass( 'et_carousel_hovered' ) ) { 1028 1029 et_carousel_timer = setTimeout( function() { 1030 $carousel.find('.et-pb-arrow-next').click(); 1031 }, $carousel.data('auto-rotate-speed') ); 1032 1033 $carousel.data('et_carousel_timer', et_carousel_timer); 1034 } 1035 } 1036 1037 $et_pb_fullwidth_portfolio.each(function(){ 1038 var $the_portfolio = $(this), 1039 $portfolio_items = $the_portfolio.find('.et_pb_portfolio_items'); 1040 1041 $portfolio_items.data('items', $portfolio_items.find('.et_pb_portfolio_item').toArray() ); 1042 $the_portfolio.data('columns_setting_up', false ); 1043 1044 if ( $the_portfolio.hasClass('et_pb_fullwidth_portfolio_carousel') ){ 1045 // add left and right arrows 1046 $portfolio_items.prepend('<div class="et-pb-slider-arrows"><a class="et-pb-arrow-prev" href="#">' + '<span>' + et_custom.previous + '</span>' + '</a><a class="et-pb-arrow-next" href="#">' + '<span>' + et_custom.next + '</span>' + '</a></div>'); 1047 1048 set_fullwidth_portfolio_columns( $the_portfolio, true ); 1049 1050 et_carousel_auto_rotate( $the_portfolio ); 1051 1052 $the_portfolio.hover( 1053 function(){ 1054 $(this).addClass('et_carousel_hovered'); 1055 if ( typeof $(this).data('et_carousel_timer') != 'undefined' ) { 1056 clearInterval( $(this).data('et_carousel_timer') ); 1057 } 1058 }, 1059 function(){ 1060 $(this).removeClass('et_carousel_hovered'); 1061 et_carousel_auto_rotate( $(this) ); 1062 } 1063 ); 1064 1065 $the_portfolio.data('carouseling', false ); 1066 1067 $the_portfolio.on('click', '.et-pb-slider-arrows a', function(e){ 1068 var $the_portfolio = $(this).parents('.et_pb_fullwidth_portfolio'), 1069 $portfolio_items = $the_portfolio.find('.et_pb_portfolio_items'), 1070 $the_portfolio_items = $portfolio_items.find('.et_pb_portfolio_item'), 1071 $active_carousel_group = $portfolio_items.find('.et_pb_carousel_group.active'), 1072 slide_duration = 700, 1073 items = $portfolio_items.data('items'), 1074 columns = $portfolio_items.data('columns'), 1075 item_width = $active_carousel_group.innerWidth() / columns, //$active_carousel_group.children().first().innerWidth(), 1076 original_item_width = ( 100 / columns ) + '%'; 1077 1078 e.preventDefault(); 1079 1080 if ( $the_portfolio.data('carouseling') ) { 1081 return; 1082 } 1083 1084 $the_portfolio.data('carouseling', true); 1085 1086 $active_carousel_group.children().each(function(){ 1087 $(this).css({'width': $(this).innerWidth() + 1, 'position':'absolute', 'left': ( $(this).innerWidth() * ( $(this).data('position') - 1 ) ) }); 1088 }); 1089 1090 if ( $(this).hasClass('et-pb-arrow-next') ) { 1091 var $next_carousel_group, 1092 current_position = 1, 1093 next_position = 1, 1094 active_items_start = items.indexOf( $active_carousel_group.children().first()[0] ), 1095 active_items_end = active_items_start + columns, 1096 next_items_start = active_items_end, 1097 next_items_end = next_items_start + columns; 1098 1099 $next_carousel_group = $('<div class="et_pb_carousel_group next" style="display: none;left: 100%;position: absolute;top: 0;">').insertAfter( $active_carousel_group ); 1100 $next_carousel_group.css({ 'width': $active_carousel_group.innerWidth() }).show(); 1101 1102 // this is an endless loop, so it can decide internally when to break out, so that next_position 1103 // can get filled up, even to the extent of an element having both and current_ and next_ position 1104 for( x = 0, total = 0 ; ; x++, total++ ) { 1105 if ( total >= active_items_start && total < active_items_end ) { 1106 $( items[x] ).addClass( 'changing_position current_position current_position_' + current_position ); 1107 $( items[x] ).data('current_position', current_position ); 1108 current_position++; 1109 } 1110 1111 if ( total >= next_items_start && total < next_items_end ) { 1112 $( items[x] ).data('next_position', next_position ); 1113 $( items[x] ).addClass('changing_position next_position next_position_' + next_position ); 1114 1115 if ( !$( items[x] ).hasClass( 'current_position' ) ) { 1116 $( items[x] ).addClass('container_append'); 1117 } else { 1118 $( items[x] ).clone(true).appendTo( $active_carousel_group ).hide().addClass('delayed_container_append_dup').attr('id', $( items[x] ).attr('id') + '-dup' ); 1119 $( items[x] ).addClass('delayed_container_append'); 1120 } 1121 1122 next_position++; 1123 } 1124 1125 if ( next_position > columns ) { 1126 break; 1127 } 1128 1129 if ( x >= ( items.length -1 )) { 1130 x = -1; 1131 } 1132 } 1133 1134 sorted = $portfolio_items.find('.container_append, .delayed_container_append_dup').sort(function (a, b) { 1135 var el_a_position = parseInt( $(a).data('next_position') ); 1136 var el_b_position = parseInt( $(b).data('next_position') ); 1137 return ( el_a_position < el_b_position ) ? -1 : ( el_a_position > el_b_position ) ? 1 : 0; 1138 }); 1139 1140 $( sorted ).show().appendTo( $next_carousel_group ); 1141 1142 $next_carousel_group.children().each(function(){ 1143 $(this).css({'width': item_width, 'position':'absolute', 'left': ( item_width * ( $(this).data('next_position') - 1 ) ) }); 1144 }); 1145 1146 $active_carousel_group.animate({ 1147 left: '-100%' 1148 }, {
1149 duration: slide_duration, 1150 complete: function() { 1151 $portfolio_items.find('.delayed_container_append').each(function(){ 1152 $(this).css({'width': item_width, 'position':'absolute', 'left': ( item_width * ( $(this).data('next_position') - 1 ) ) }); 1153 $(this).appendTo( $next_carousel_group ); 1154 }); 1155 1156 $active_carousel_group.removeClass('active'); 1157 $active_carousel_group.children().each(function(){ 1158 position = $(this).data('position'); 1159 current_position = $(this).data('current_position'); 1160 $(this).removeClass('position_' + position + ' ' + 'changing_position current_position current_position_' + current_position ); 1161 $(this).data('position', ''); 1162 $(this).data('current_position', ''); 1163 $(this).hide(); 1164 $(this).css({'position': '', 'width': '', 'left': ''}); 1165 $(this).appendTo( $portfolio_items ); 1166 }); 1167 1168 $active_carousel_group.remove(); 1169 1170 et_carousel_auto_rotate( $the_portfolio ); 1171 1172 } 1173 } ); 1174 1175 $next_carousel_group.addClass('active').css({'position':'absolute', 'top':0, left: '100%'}); 1176 $next_carousel_group.animate({ 1177 left: '0%' 1178 }, { 1179 duration: slide_duration, 1180 complete: function(){ 1181 setTimeout(function(){ 1182 $next_carousel_group.removeClass('next').addClass('active').css({'position':'', 'width':'', 'top':'', 'left': ''}); 1183 1184 $next_carousel_group.find('.delayed_container_append_dup').remove(); 1185 1186 $next_carousel_group.find('.changing_position').each(function( index ){ 1187 position = $(this).data('position'); 1188 current_position = $(this).data('current_position'); 1189 next_position = $(this).data('next_position'); 1190 $(this).removeClass('container_append delayed_container_append position_' + position + ' ' + 'changing_position current_position current_position_' + current_position + ' next_position next_position_' + next_position ); 1191 $(this).data('current_position', ''); 1192 $(this).data('next_position', ''); 1193 $(this).data('position', ( index + 1 ) ); 1194 }); 1195 1196 $next_carousel_group.children().css({'position': '', 'width': original_item_width, 'left': ''}); 1197 1198 $the_portfolio.data('carouseling', false); 1199 }, 100 ); 1200 } 1201 } ); 1202 1203 } else { 1204 var $prev_carousel_group, 1205 current_position = columns, 1206 prev_position = columns, 1207 columns_span = columns - 1, 1208 active_items_start = items.indexOf( $active_carousel_group.children().last()[0] ), 1209 active_items_end = active_items_start - columns_span, 1210 prev_items_start = active_items_end - 1, 1211 prev_items_end = prev_items_start - columns_span; 1212 1213 $prev_carousel_group = $('<div class="et_pb_carousel_group prev" style="display: none;left: 100%;position: absolute;top: 0;">').insertBefore( $active_carousel_group ); 1214 $prev_carousel_group.css({ 'left': '-' + $active_carousel_group.innerWidth(), 'width': $active_carousel_group.innerWidth() }).show(); 1215 1216 // this is an endless loop, so it can decide internally when to break out, so that next_position 1217 // can get filled up, even to the extent of an element having both and current_ and next_ position 1218 for( x = ( items.length - 1 ), total = ( items.length - 1 ) ; ; x--, total-- ) { 1219 1220 if ( total <= active_items_start && total >= active_items_end ) { 1221 $( items[x] ).addClass( 'changing_position current_position current_position_' + current_position ); 1222 $( items[x] ).data('current_position', current_position ); 1223 current_position--; 1224 } 1225 1226 if ( total <= prev_items_start && total >= prev_items_end ) { 1227 $( items[x] ).data('prev_position', prev_position ); 1228 $( items[x] ).addClass('changing_position prev_position prev_position_' + prev_position ); 1229 1230 if ( !$( items[x] ).hasClass( 'current_position' ) ) { 1231 $( items[x] ).addClass('container_append'); 1232 } else { 1233 $( items[x] ).clone(true).appendTo( $active_carousel_group ).addClass('delayed_container_append_dup').attr('id', $( items[x] ).attr('id') + '-dup' ); 1234 $( items[x] ).addClass('delayed_container_append'); 1235 } 1236 1237 prev_position--; 1238 } 1239 1240 if ( prev_position <= 0 ) { 1241 break; 1242 } 1243 1244 if ( x == 0 ) { 1245 x = items.length; 1246 } 1247 } 1248 1249 sorted = $portfolio_items.find('.container_append, .delayed_container_append_dup').sort(function (a, b) { 1250 var el_a_position = parseInt( $(a).data('prev_position') ); 1251 var el_b_position = parseInt( $(b).data('prev_position') ); 1252 return ( el_a_position < el_b_position ) ? -1 : ( el_a_position > el_b_position ) ? 1 : 0; 1253 }); 1254 1255 $( sorted ).show().appendTo( $prev_carousel_group ); 1256 1257 $prev_carousel_group.children().each(function(){ 1258 $(this).css({'width': item_width, 'position':'absolute', 'left': ( item_width * ( $(this).data('prev_position') - 1 ) ) }); 1259 }); 1260 1261 $active_carousel_group.animate({ 1262 left: '100%' 1263 }, {
1264 duration: slide_duration, 1265 complete: function() { 1266 $portfolio_items.find('.delayed_container_append').reverse().each(function(){ 1267 $(this).css({'width': item_width, 'position':'absolute', 'left': ( item_width * ( $(this).data('prev_position') - 1 ) ) }); 1268 $(this).prependTo( $prev_carousel_group ); 1269 }); 1270 1271 $active_carousel_group.removeClass('active'); 1272 $active_carousel_group.children().each(function(){ 1273 position = $(this).data('position'); 1274 current_position = $(this).data('current_position'); 1275 $(this).removeClass('position_' + position + ' ' + 'changing_position current_position current_position_' + current_position ); 1276 $(this).data('position', ''); 1277 $(this).data('current_position', ''); 1278 $(this).hide(); 1279 $(this).css({'position': '', 'width': '', 'left': ''}); 1280 $(this).appendTo( $portfolio_items ); 1281 }); 1282 1283 $active_carousel_group.remove(); 1284 } 1285 } ); 1286 1287 $prev_carousel_group.addClass('active').css({'position':'absolute', 'top':0, left: '-100%'}); 1288 $prev_carousel_group.animate({ 1289 left: '0%' 1290 }, { 1291 duration: slide_duration, 1292 complete: function(){ 1293 setTimeout(function(){ 1294 $prev_carousel_group.removeClass('prev').addClass('active').css({'position':'', 'width':'', 'top':'', 'left': ''}); 1295 1296 $prev_carousel_group.find('.delayed_container_append_dup').remove(); 1297 1298 $prev_carousel_group.find('.changing_position').each(function( index ){ 1299 position = $(this).data('position'); 1300 current_position = $(this).data('current_position'); 1301 prev_position = $(this).data('prev_position'); 1302 $(this).removeClass('container_append delayed_container_append position_' + position + ' ' + 'changing_position current_position current_position_' + current_position + ' prev_position prev_position_' + prev_position ); 1303 $(this).data('current_position', ''); 1304 $(this).data('prev_position', ''); 1305 position = index + 1; 1306 $(this).data('position', position ); 1307 $(this).addClass('position_' + position ); 1308 }); 1309 1310 $prev_carousel_group.children().css({'position': '', 'width': original_item_width, 'left': ''}); 1311 $the_portfolio.data('carouseling', false); 1312 }, 100 ); 1313 } 1314 } ); 1315 } 1316 }); 1317 1318 } else { 1319 // setup fullwidth portfolio grid 1320 set_fullwidth_portfolio_columns( $the_portfolio, false ); 1321 } 1322 1323 }); 1324 } 1325 1326 if ( $et_pb_filterable_portfolio.length ) { 1327 1328 $(window).load(function(){ 1329 1330 $et_pb_filterable_portfolio.each(function(){ 1331 var $the_portfolio = $(this), 1332 $the_portfolio_items = $the_portfolio.find('.et_pb_portfolio_items'), 1333 $left_orientatation = true == $the_portfolio.data( 'rtl' ) ? false : true; 1334 1335 $the_portfolio_items.imagesLoaded( function() { 1336 1337 $the_portfolio.show(); //after all the content is loaded we can show the portfolio 1338 1339 $the_portfolio_items.masonry({ 1340 itemSelector : '.et_pb_portfolio_item', 1341 columnWidth : $the_portfolio.find('.column_width').innerWidth(), 1342 gutter : $the_portfolio.find('.gutter_width').innerWidth(), 1343 transitionDuration: 0, 1344 isOriginLeft: $left_orientatation 1345 }); 1346 1347 set_filterable_grid_items( $the_portfolio ); 1348 1349 }); 1350 1351 $the_portfolio.on('click', '.et_pb_portfolio_filter a', function(e){ 1352 e.preventDefault(); 1353 var category_slug = $(this).data('category-slug'); 1354 $the_portfolio_items = $(this).parents('.et_pb_filterable_portfolio').find('.et_pb_portfolio_items'); 1355 1356 if ( 'all' == category_slug ) { 1357 $the_portfolio.find('.et_pb_portfolio_filter a').removeClass('active'); 1358 $the_portfolio.find('.et_pb_portfolio_filter_all a').addClass('active'); 1359 $the_portfolio.find('.et_pb_portfolio_item').removeClass('active'); 1360 $the_portfolio.find('.et_pb_portfolio_item').show(); 1361 $the_portfolio.find('.et_pb_portfolio_item').addClass('active'); 1362 } else { 1363 $the_portfolio.find('.et_pb_portfolio_filter_all').removeClass('active'); 1364 $the_portfolio.find('.et_pb_portfolio_filter a').removeClass('active'); 1365 $the_portfolio.find('.et_pb_portfolio_filter_all a').removeClass('active'); 1366 $(this).addClass('active'); 1367 1368 $the_portfolio_items.find('.et_pb_portfolio_item').hide(); 1369 $the_portfolio_items.find('.et_pb_portfolio_item').removeClass('active'); 1370 $the_portfolio_items.find('.et_pb_portfolio_item.project_category_' + $(this).data('category-slug') ).show(); 1371 $the_portfolio_items.find('.et_pb_portfolio_item.project_category_' + $(this).data('category-slug') ).addClass('active'); 1372 } 1373 1374 set_filterable_grid_items( $the_portfolio ); 1375 setTimeout(function(){ 1376 set_filterable_portfolio_hash( $the_portfolio ); 1377 }, 500 ); 1378 }); 1379 1380 $(this).on('et_hashchange', function( event ){ 1381 var params = event.params; 1382 $the_portfolio = $( '#' + event.target.id ); 1383 1384 if ( !$the_portfolio.find('.et_pb_portfolio_filter a[data-category-slug="' + params[0] + '"]').hasClass('active') ){ 1385 $the_portfolio.find('.et_pb_portfolio_filter a[data-category-slug="' + params[0] + '"]').click(); 1386 } 1387 1388 if ( params[1] ) { 1389 setTimeout(function(){ 1390 if ( !$the_portfolio.find('.et_pb_portofolio_pagination a.page-' + params[1]).hasClass('active') ) { 1391 $the_portfolio.find('.et_pb_portofolio_pagination a.page-' + params[1]).addClass('active').click(); 1392 } 1393 }, 300 ); 1394 } 1395 }); 1396 }); 1397 1398 }); // End $(window).load() 1399 1400 function set_filterable_grid_items( $the_portfolio ) { 1401 var min_height = 0, 1402 $the_portfolio_items = $the_portfolio.find('.et_pb_portfolio_items'), 1403 active_category = $the_portfolio.find('.et_pb_portfolio_filter > a.active').data('category-slug'), 1404 masonry_data = Masonry.data( $the_portfolio_items[0] ); 1405 1406 $the_portfolio_items.masonry('option', { 1407 'columnWidth': $the_portfolio.find('.column_width').innerWidth(), 1408 'gutter': $the_portfolio.find('.gutter_width').innerWidth() 1409 }); 1410 1411 if ( !$the_portfolio.hasClass('et_pb_filterable_portfolio_fullwidth') ) { 1412 $the_portfolio.find( '.et_pb_portfolio_item' ).css({ minHeight : '', height : '' }); 1413 $the_portfolio_items.masonry(); 1414 if ( masonry_data.cols > 1 ) { 1415 $the_portfolio.find( '.et_pb_portfolio_item' ).css({ minHeight : '', height : '' }); 1416 $the_portfolio.find( '.et_pb_portfolio_item' ).each( function() { 1417 if ( $(this).outerHeight() > min_height ) 1418 min_height = parseInt( $(this).outerHeight() ) + parseInt( $(this).css('marginBottom').slice(0, -2) ) + parseInt( $(this).css('marginTop').slice(0, -2) ); 1419 } ); 1420 $the_portfolio.find( '.et_pb_portfolio_item' ).css({ height : min_height, minHeight : min_height }); 1421 } 1422 } 1423 1424 if( 'all' === active_category ) { 1425 $the_portfolio_visible_items = $the_portfolio.find('.et_pb_portfolio_item'); 1426 } else { 1427 $the_portfolio_visible_items = $the_portfolio.find('.et_pb_portfolio_item.project_category_' + active_category); 1428 } 1429 1430 var visible_grid_items = $the_portfolio_visible_items.length, 1431 posts_number = $the_portfolio.data('posts-number'), 1432 pages = Math.ceil( visible_grid_items / posts_number ); 1433 1434 set_filterable_grid_pages( $the_portfolio, pages ); 1435 1436 var visible_grid_items = 0; 1437 var _page = 1; 1438 $the_portfolio.find('.et_pb_portfolio_item').data('page', ''); 1439 $the_portfolio_visible_items.each(function(i){ 1440 visible_grid_items++; 1441 if ( 0 === parseInt( visible_grid_items % posts_number ) ) { 1442 $(this).data('page', _page); 1443 _page++; 1444 } else { 1445 $(this).data('page', _page); 1446 } 1447 }); 1448 1449 $the_portfolio_visible_items.filter(function() { 1450 return $(this).data('page') == 1; 1451 }).show(); 1452 1453 $the_portfolio_visible_items.filter(function() { 1454 return $(this).data('page') != 1; 1455 }).hide(); 1456 1457 $the_portfolio_items.masonry(); 1458 } 1459 1460 function set_filterable_grid_pages( $the_portfolio, pages ) { 1461 $pagination = $the_portfolio.find('.et_pb_portofolio_pagination'); 1462 1463 if ( !$pagination.length ){ 1464 return; 1465 } 1466 1467 $pagination.html('<ul></ul>'); 1468 if ( pages <= 1 ) { 1469 return; 1470 } 1471 1472 $pagination_list = $pagination.children('ul'); 1473 $pagination_list.append('<li class="prev" style="display:none;"><a href="#" data-page="prev" class="page-prev">' + et_custom.prev + '</a></li>'); 1474 for( var page = 1; page <= pages; page++ ) { 1475 var first_page_class = page === 1 ? ' active' : '', 1476 last_page_class = page === pages ? ' last-page' : '', 1477 hidden_page_class = page >= 5 ? ' style="display:none;"' : ''; 1478 $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>'); 1479 } 1480 $pagination_list.append('<li class="next"><a href="#" data-page="next" class="page-next">' + et_custom.next + '</a></li>'); 1481 } 1482 1483 $et_pb_filterable_portfolio.on('click', '.et_pb_portofolio_pagination a', function(e){ 1484 e.preventDefault(); 1485 1486 var to_page = $(this).data('page'), 1487 $the_portfolio = $(this).parents('.et_pb_filterable_portfolio'), 1488 $the_portfolio_items = $the_portfolio.find('.et_pb_portfolio_items'); 1489 1490 et_pb_smooth_scroll( $the_portfolio, false, 800 ); 1491 1492 if ( $(this).hasClass('page-prev') ) { 1493 to_page = parseInt( $(this).parents('ul').find('a.active').data('page') ) - 1; 1494 } else if( $(this).hasClass('page-next') ) { 1495 to_page = parseInt( $(this).parents('ul').find('a.active').data('page') ) + 1; 1496 } 1497 1498 $(this).parents('ul').find('a').removeClass('active'); 1499 $(this).parents('ul').find('a.page-' + to_page ).addClass('active'); 1500 1501 var current_index = $(this).parents('ul').find('a.page-' + to_page ).parent().index(), 1502 total_pages = $(this).parents('ul').find('li.page').length; 1503 1504 $(this).parent().nextUntil('.page-' + ( current_index + 3 ) ).show(); 1505 $(this).parent().prevUntil('.page-' + ( current_index - 3 ) ).show(); 1506 1507 $(this).parents('ul').find('li.page').each(function(i){ 1508 if ( !$(this).hasClass('prev') && !$(this).hasClass('next') ) { 1509 if ( i < ( current_index - 3 ) ) { 1510 $(this).hide(); 1511 } else if( i > ( current_index + 1 ) ) { 1512 $(this).hide(); 1513 } else { 1514 $(this).show(); 1515 } 1516 1517 if ( total_pages - current_index <= 2 && total_pages - i <= 5 ) { 1518 $(this).show(); 1519 } else if( current_index <= 3 && i <= 4 ) { 1520 $(this).show(); 1521 } 1522 1523 } 1524 }); 1525 1526 if ( to_page > 1 ) { 1527 $(this).parents('ul').find('li.prev').show(); 1528 } else { 1529 $(this).parents('ul').find('li.prev').hide(); 1530 } 1531 1532 if ( $(this).parents('ul').find('a.active').hasClass('last-page') ) { 1533 $(this).parents('ul').find('li.next').hide(); 1534 } else { 1535 $(this).parents('ul').find('li.next').show(); 1536 } 1537 1538 $the_portfolio.find('.et_pb_portfolio_item').hide(); 1539 $the_portfolio.find('.et_pb_portfolio_item').filter(function( index ) { 1540 return $(this).data('page') === to_page; 1541 }).show(); 1542 1543 $the_portfolio_items.masonry(); 1544 1545 setTimeout(function(){ 1546 set_filterable_portfolio_hash( $the_portfolio ); 1547 }, 500 ); 1548 }); 1549 1550 function set_filterable_portfolio_hash( $the_portfolio ) { 1551 1552 if ( !$the_portfolio.attr('id') ) { 1553 return; 1554 } 1555 1556 var this_portfolio_state = []; 1557 this_portfolio_state.push( $the_portfolio.attr('id') ); 1558 this_portfolio_state.push( $the_portfolio.find('.et_pb_portfolio_filter > a.active').data('category-slug') ); 1559 1560 if( $the_portfolio.find('.et_pb_portofolio_pagination a.active').length ) { 1561 this_portfolio_state.push( $the_portfolio.find('.et_pb_portofolio_pagination a.active').data('page') ); 1562 } else { 1563 this_portfolio_state.push( 1 ); 1564 } 1565 1566 this_portfolio_state = this_portfolio_state.join( et_hash_module_param_seperator ); 1567 1568 et_set_hash( this_portfolio_state ); 1569 } 1570 } /* end if ( $et_pb_filterable_portfolio.length ) */ 1571 1572 if ( $et_pb_gallery.length ) { 1573 1574 function set_gallery_grid_items( $the_gallery ) { 1575 var $the_gallery_items_container = $the_gallery.find('.et_pb_gallery_items'), 1576 $the_gallery_items = $the_gallery_items_container.find('.et_pb_gallery_item'); 1577 1578 var total_grid_items = $the_gallery_items.length, 1579 posts_number = $the_gallery_items_container.data('per_page'), // TODO: make this depend on col size and how many fit across at a given screenwidth & col size 1580 pages = Math.ceil( total_grid_items / posts_number ); 1581 1582 $the_gallery_items_container.masonry('option', { 1583 'columnWidth': $the_gallery.find('.column_width').innerWidth(), 1584 'gutter': $the_gallery.find('.gutter_width').innerWidth() 1585 }); 1586 1587 set_gallery_grid_pages( $the_gallery, pages ); 1588 1589 var total_grid_items = 0; 1590 var _page = 1; 1591 $the_gallery_items.data('page', ''); 1592 $the_gallery_items.each(function(i){ 1593 total_grid_items++; 1594 if ( 0 === parseInt( total_grid_items % posts_number ) ) { 1595 $(this).data('page', _page); 1596 _page++; 1597 } else { 1598 $(this).data('page', _page); 1599 } 1600 1601 }); 1602 1603 var visible_items = $the_gallery_items.filter(function() { 1604 return $(this).data('page') == 1; 1605 }).show(); 1606 1607 $the_gallery_items.filter(function() { 1608 return $(this).data('page') != 1; 1609 }).hide(); 1610 1611 $the_gallery_items_container.masonry(); 1612 } 1613 1614 function set_gallery_grid_pages( $the_gallery, pages ) { 1615 $pagination = $the_gallery.find('.et_pb_gallery_pagination'); 1616 1617 if ( !$pagination.length ){ 1618 return; 1619 } 1620 1621 $pagination.html('<ul></ul>'); 1622 if ( pages <= 1 ) { 1623 $pagination.hide(); 1624 return; 1625 } 1626 1627 $pagination_list = $pagination.children('ul'); 1628 $pagination_list.append('<li class="prev" style="display:none;"><a href="#" data-page="prev" class="page-prev">' + et_custom.prev + '</a></li>'); 1629 for( var page = 1; page <= pages; page++ ) { 1630 var first_page_class = page === 1 ? ' active' : '', 1631 last_page_class = page === pages ? ' last-page' : '', 1632 hidden_page_class = page >= 5 ? ' style="display:none;"' : ''; 1633 $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>'); 1634 } 1635 $pagination_list.append('<li class="next"><a href="#" data-page="next" class="page-next">' + et_custom.next + '</a></li>'); 1636 } 1637 1638 function set_gallery_hash( $the_gallery ) { 1639 1640 if ( !$the_gallery.attr('id') ) { 1641 return; 1642 } 1643 1644 var this_gallery_state = []; 1645 this_gallery_state.push( $the_gallery.attr('id') ); 1646 1647 if( $the_gallery.find('.et_pb_gallery_pagination a.active').length ) { 1648 this_gallery_state.push( $the_gallery.find('.et_pb_gallery_pagination a.active').data('page') ); 1649 } else { 1650 this_gallery_state.push( 1 ); 1651 } 1652 1653 this_gallery_state = this_gallery_state.join( et_hash_module_param_seperator ); 1654 1655 et_set_hash( this_gallery_state ); 1656 } 1657 1658 $et_pb_gallery.each(function(){ 1659 var $the_gallery = $(this); 1660 1661 if ( $the_gallery.hasClass( 'et_pb_gallery_grid' ) ) { 1662 $the_gallery.imagesLoaded( function() { 1663 1664 $the_gallery.show(); //after all the content is loaded we can show the gallery 1665 1666 $the_gallery.find('.et_pb_gallery_items').masonry({ 1667 itemSelector : '.et_pb_gallery_item', 1668 columnWidth : $the_gallery.find('.column_width').innerWidth(), 1669 gutter : $the_gallery.find('.gutter_width').innerWidth(), 1670 transitionDuration: 0 1671 }); 1672 1673 set_gallery_grid_items( $the_gallery ); 1674 }); 1675 1676 $the_gallery.on('et_hashchange', function( event ){ 1677 var params = event.params; 1678 $the_gallery = $( '#' + event.target.id ); 1679 1680 if ( page_to = params[0] ) { 1681 setTimeout(function(){ 1682 if ( !$the_gallery.find('.et_pb_gallery_pagination a.page-' + page_to ).hasClass('active') ) { 1683 $the_gallery.find('.et_pb_gallery_pagination a.page-' + page_to ).addClass('active').click(); 1684 } 1685 }, 300 ); 1686 } 1687 }); 1688 } else { 1689 $the_gallery.et_pb_simple_slider({ 1690 fade_speed : 700, 1691 slide : '.et_pb_gallery_item' 1692 }); 1693 } 1694 1695 }); 1696 1697 $et_pb_gallery.data('paginating', false );
1697 1698 $et_pb_gallery.on('click', '.et_pb_gallery_pagination a', function(e){ 1699 e.preventDefault(); 1700 1701 var to_page = $(this).data('page'), 1702 $the_gallery = $(this).parents('.et_pb_gallery'), 1703 $the_gallery_items_container = $the_gallery.find('.et_pb_gallery_items'), 1704 $the_gallery_items = $the_gallery_items_container.find('.et_pb_gallery_item'); 1705 1706 if ( $the_gallery.data('paginating') ) { 1707 return; 1708 } 1709 1710 $the_gallery.data('paginating', true ); 1711 1712 if ( $(this).hasClass('page-prev') ) { 1713 to_page = parseInt( $(this).parents('ul').find('a.active').data('page') ) - 1; 1714 } else if( $(this).hasClass('page-next') ) { 1715 to_page = parseInt( $(this).parents('ul').find('a.active').data('page') ) + 1; 1716 } 1717 1718 $(this).parents('ul').find('a').removeClass('active'); 1719 $(this).parents('ul').find('a.page-' + to_page ).addClass('active'); 1720 1721 var current_index = $(this).parents('ul').find('a.page-' + to_page ).parent().index(), 1722 total_pages = $(this).parents('ul').find('li.page').length; 1723 1724 $(this).parent().nextUntil('.page-' + ( current_index + 3 ) ).show(); 1725 $(this).parent().prevUntil('.page-' + ( current_index - 3 ) ).show(); 1726 1727 $(this).parents('ul').find('li.page').each(function(i){ 1728 if ( !$(this).hasClass('prev') && !$(this).hasClass('next') ) { 1729 if ( i < ( current_index - 3 ) ) { 1730 $(this).hide(); 1731 } else if( i > ( current_index + 1 ) ) { 1732 $(this).hide(); 1733 } else { 1734 $(this).show(); 1735 } 1736 1737 if ( total_pages - current_index <= 2 && total_pages - i <= 5 ) { 1738 $(this).show(); 1739 } else if( current_index <= 3 && i <= 4 ) { 1740 $(this).show(); 1741 } 1742 1743 } 1744 }); 1745 1746 if ( to_page > 1 ) { 1747 $(this).parents('ul').find('li.prev').show(); 1748 } else { 1749 $(this).parents('ul').find('li.prev').hide(); 1750 } 1751 1752 if ( $(this).parents('ul').find('a.active').hasClass('last-page') ) { 1753 $(this).parents('ul').find('li.next').hide(); 1754 } else { 1755 $(this).parents('ul').find('li.next').show(); 1756 } 1757 1758 $the_gallery_items.hide(); 1759 var visible_items = $the_gallery_items.filter(function( index ) { 1760 return $(this).data('page') === to_page; 1761 }).show(); 1762 1763 $the_gallery_items_container.masonry(); 1764 $the_gallery.data('paginating', false ); 1765 1766 setTimeout(function(){ 1767 set_gallery_hash( $the_gallery ); 1768 }, 100 ); 1769 1770 $( 'html, body' ).animate( { scrollTop : $the_gallery.offset().top - 200 }, 200 ); 1771 }); 1772 1773 } /* end if ( $et_pb_gallery.length ) */ 1774 1775 function et_countdown_timer( timer ) { 1776 var gmt_offset = timer.data('gmt-offset') * 3600000; 1777 1778 var end_date = new Date( timer.data('end-date') ).getTime(); 1779 end_date = end_date + gmt_offset; 1780 1781 var current_date = new Date(), 1782 month_names = [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "
1782November", "December" ]; 1783 current_date = ( month_names[current_date.getMonth()] ) + ' ' + current_date.getDate() + ' ' + current_date.getFullYear() + ' ' + current_date.getHours() + ':' + current_date.getMinutes() + ':' + current_date.getSeconds(); 1784 current_date = new Date( current_date ).getTime() + gmt_offset; 1785 1786 var seconds_left = ( end_date - current_date ) / 1000; 1787 1788 days = parseInt(seconds_left / 86400); 1789 days = days > 0 ? days : 0; 1790 seconds_left = seconds_left % 86400; 1791 1792 hours = parseInt(seconds_left / 3600); 1793 hours = hours > 0 ? hours : 0; 1794 1795 seconds_left = seconds_left % 3600; 1796 1797 minutes = parseInt(seconds_left / 60); 1798 minutes = minutes > 0 ? minutes : 0; 1799 1800 seconds = parseInt(seconds_left % 60); 1801 seconds = seconds > 0 ? seconds : 0; 1802 1803 if( days == 0 ) { 1804 if ( !timer.find('.days > .value').parent('.section').hasClass('zero') ) { 1805 timer.find('.days > .value').html( '000' ).parent('.section').addClass('zero').next().addClass('zero'); 1806 } 1807 } else { 1808 days_slice = days.toString().length >= 3 ? days.toString().length : 3; 1809 timer.find('.days > .value').html( ('000' + days).slice(-days_slice) ); 1810 } 1811 1812 if( days == 0 && hours == 0 ) { 1813 if ( !timer.find('.hours > .value').parent('.section').hasClass('zero') ) { 1814 timer.find('.hours > .value').html('00').parent('.section').addClass('zero').next().addClass('zero'); 1815 } 1816 } else { 1817 timer.find('.hours > .value').html( ( '0' + hours ).slice(-2) ); 1818 } 1819 1820 if( days == 0 && hours == 0 && minutes == 0 ) { 1821 if ( !timer.find('.minutes > .value').parent('.section').hasClass('zero') ) { 1822 timer.find('.minutes > .value').html('00').parent('.section').addClass('zero').next().addClass('zero'); 1823 } 1824 } else { 1825 timer.find('.minutes > .value').html( ( '0' + minutes ).slice(-2) ); 1826 } 1827 1828 if ( days == 0 && hours == 0 && minutes == 0 && seconds == 0 ) { 1829 if ( !timer.find('.seconds > .value').parent('.section').hasClass('zero') ) { 1830 timer.find('.seconds > .value').html('00').parent('.section').addClass('zero'); 1831 } 1832 } else { 1833 timer.find('.seconds > .value').html( ( '0' + seconds ).slice(-2) ); 1834 } 1835 } 1836 1837 function et_countdown_timer_labels( timer ) { 1838 if ( timer.closest( '.et_pb_column_3_8' ).length || timer.children('.et_pb_countdown_timer_container').width() <= 250 ) {
1839 timer.find('.hours .label').html( timer.find('.hours').data('short') ); 1840 timer.find('.minutes .label').html( timer.find('.minutes').data('short') ); 1841 timer.find('.seconds .label').html( timer.find('.seconds').data('short') ); 1842 } 1843 } 1844 1845 if ( $et_pb_countdown_timer.length ) { 1846 $et_pb_countdown_timer.each(function(){ 1847 var timer = $(this); 1848 et_countdown_timer_labels( timer ); 1849 et_countdown_timer( timer ); 1850 setInterval(function(){ 1851 et_countdown_timer( timer ); 1852 }, 1000); 1853 }); 1854 1855 } 1856 1857 if ( $et_pb_tabs.length ) { 1858 $et_pb_tabs.et_pb_simple_slider( { 1859 use_controls : false, 1860 use_arrows : false, 1861 slide : '.et_pb_all_tabs > div', 1862 tabs_animation : true 1863 } ).on('et_hashchange', function( event ){ 1864 var params = event.params; 1865 var $the_tabs = $( '#' + event.target.id ); 1866 var active_tab = params[0]; 1867 if ( !$the_tabs.find( '.et_pb_tabs_controls li' ).eq( active_tab ).hasClass('et_pb_tab_active') ) { 1868 $the_tabs.find( '.et_pb_tabs_controls li' ).eq( active_tab ).click(); 1869 } 1870 }); 1871 1872 $et_pb_tabs_li.click( function() { 1873 var $this_el = $(this), 1874 $tabs_container = $this_el.closest( '.et_pb_tabs' ).data('et_pb_simple_slider'); 1875 1876 if ( $tabs_container.et_animation_running ) return false; 1877 1878 $this_el.addClass( 'et_pb_tab_active' ).siblings().removeClass( 'et_pb_tab_active' ); 1879 1880 $tabs_container.data('et_pb_simple_slider').et_slider_move_to( $this_el.index() ); 1881 1882 if ( $this_el.closest( '.et_pb_tabs' ).attr('id') ) { 1883 var tab_state = []; 1884 tab_state.push( $this_el.closest( '.et_pb_tabs' ).attr('id') ); 1885 tab_state.push( $this_el.index() ); 1886 tab_state = tab_state.join( et_hash_module_param_seperator ); 1887 et_set_hash( tab_state ); 1888 } 1889 1890 return false; 1891 } ); 1892 } 1893 1894 if ( $et_pb_map.length ) { 1895 google.maps.event.addDomListener(window, 'load', function() { 1896 $et_pb_map.each(function(){ 1897 var $this_map_container = $(this); 1898 var $this_map = $this_map_container.children('.et_pb_map'); 1899 1900 $this_map_container.data('map', new google.maps.Map( $this_map[0], { 1901 zoom: parseInt( $this_map.data('zoom') ), 1902 center: new google.maps.LatLng( parseFloat( $this_map.data('center-lat') ) , parseFloat( $this_map.data('center-lng') )), 1903 mapTypeId: google.maps.MapTypeId.ROADMAP, 1904 scrollwheel: $this_map.data('mouse-wheel') == 'on' ? true : false 1905 })); 1906 1907 $this_map_container.data('bounds', new google.maps.LatLngBounds() ); 1908 $this_map_container.find('.et_pb_map_pin').each(function(){ 1909 var $this_marker = $(this), 1910 position = new google.maps.LatLng( parseFloat( $this_marker.data('lat') ) , parseFloat( $this_marker.data('lng') ) ); 1911 1912 $this_map_container.data('bounds').extend( position ); 1913 1914 var marker = new google.maps.Marker({ 1915 position: position, 1916 map: $this_map_container.data('map'), 1917 title: $this_marker.data('title'), 1918 icon: { url: et_custom.images_uri + '/marker.png', size: new google.maps.Size( 46, 43 ), anchor: new google.maps.Point( 16, 43 ) }, 1919 shape: { coord: [1, 1, 46, 43], type: 'rect' }, 1920 anchorPoint: new google.maps.Point(0, -45) 1921 }); 1922 1923 if ( $this_marker.find('.infowindow').length ) { 1924 var infowindow = new google.maps.InfoWindow({ 1925 content: $this_marker.html() 1926 }); 1927 1928 google.maps.event.addListener(marker, 'click', function() { 1929 infowindow.open( $this_map_container.data('map'), marker ); 1930 }); 1931 } 1932 }); 1933 1934 setTimeout(function(){ 1935 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
1935() ) ) { 1936 $this_map_container.data('map').fitBounds( $this_map_container.data('bounds') ); 1937 } 1938 }, 200 ); 1939 }); 1940 } ); 1941 } 1942 1943 if ( $et_pb_circle_counter.length ){ 1944 1945 function et_pb_circle_counter_init($the_counter, animate) { 1946 $the_counter.easyPieChart({ 1947 easing: 'easeInOutCirc', 1948 animate: { 1949 duration: 1800, 1950 enabled: true 1951 }, 1952 size: $the_counter.width(), 1953 barColor: $the_counter.data('bar-bg-color'), 1954 trackColor: '#000000', 1955 trackAlpha: 0.1, 1956 scaleColor: false, 1957 lineWidth: 5, 1958 onStart: function() { 1959 $(this.el).find('.percent p').css({ 'visibility' : 'visible' }); 1960 }, 1961 onStep: function(from, to, percent) { 1962 $(this.el).find('.percent-value').text( Math.round( parseInt( percent ) ) ); 1963 }, 1964 onStop: function(from, to) { 1965 $(this.el).find('.percent-value').text( $(this.el).data('number-value') ); 1966 } 1967 }); 1968 } 1969 1970 $et_pb_circle_counter.each(function(){ 1971 var $the_counter = $(this); 1972 et_pb_circle_counter_init($the_counter, false); 1973 1974 $the_counter.on('containerWidthChanged', function( event ){ 1975 $the_counter = $( event.target ); 1976 $the_counter.find('canvas').remove(); 1977 $the_counter.removeData('easyPieChart' ); 1978 et_pb_circle_counter_init($the_counter, true); 1979 }); 1980 1981 }); 1982 } 1983 1984 if ( $et_pb_number_counter.length ){ 1985 $et_pb_number_counter.each(function(){ 1986 var $this_counter = $(this); 1987 $this_counter.easyPieChart({ 1988 easing: 'easeInOutCirc', 1989 animate: { 1990 duration: 1800, 1991 enabled: true 1992 }, 1993 size: 0, 1994 trackColor: false, 1995 scaleColor: false, 1996 lineWidth: 0, 1997 onStart: function() { 1998 $(this.el).find('.percent p').css({ 'visibility' : 'visible' }); 1999 }, 2000 onStep: function(from, to, percent) { 2001 if ( percent != to ) 2002 $(this.el).find('.percent-value').text( Math.round( parseInt( percent ) ) ); 2003 }, 2004 onStop: function(from, to) { 2005 $(this.el).find('.percent-value').text( $(this.el).data('number-value') ); 2006 } 2007 }); 2008 }); 2009 } 2010 2011 function et_apply_parallax() { 2012 var $this = $(this), 2013 element_top = $this.offset().top, 2014 window_top = $et_window.scrollTop(), 2015 y_pos = ( ( ( window_top + $et_window.height() ) - element_top ) * 0.3 ), 2016 main_position; 2017 2018 main_position = 'translate(0, ' + y_pos + 'px)'; 2019 2020 $this.find('.et_parallax_bg').css( { 2021 '-webkit-transform' : main_position, 2022 '-moz-transform' : main_position, 2023 '-ms-transform' : main_position, 2024 'transform' : main_position 2025 } ); 2026 } 2027 2028 function et_parallax_set_height() { 2029 var $this = $(this), 2030 bg_height; 2031 2032 bg_height = ( $et_window.height() * 0.3 + $this.innerHeight() ); 2033 2034 $this.find('.et_parallax_bg').css( { 'height' : bg_height } ); 2035 } 2036 2037 $('.et_pb_toggle_title').click( function(){ 2038 var $this_heading = $(this), 2039 $module = $this_heading.closest('.et_pb_toggle'), 2040 $section = $module.parents( '.et_pb_section' ), 2041 $content = $module.find('.et_pb_toggle_content'), 2042 is_accordion = $module.closest( '.et_pb_accordion' ).length, 2043 $accordion_active_toggle; 2044 2045 if ( is_accordion ) { 2046 if ( $module.hasClass('et_pb_toggle_open') ) { 2047 return false; 2048 } 2049 2050 $accordion_active_toggle = $module.siblings('.et_pb_toggle_open'); 2051 } 2052 2053 if ( $content.is( ':animated' ) ) { 2054 return; 2055 } 2056 2057 $content.slideToggle( 700, function() { 2058 if ( $module.hasClass('et_pb_toggle_close') ) { 2059 $module.removeClass('et_pb_toggle_close').addClass('et_pb_toggle_open'); 2060 } else { 2061 $module.removeClass('et_pb_toggle_open').addClass('et_pb_toggle_close'); 2062 } 2063 2064 if ( $section.hasClass( 'et_pb_section_parallax' ) && !$section.children().hasClass( 'et_pb_parallax_css') ) { 2065 $.proxy( et_parallax_set_height, $section )(); 2066 } 2067 } ); 2068 2069 if ( is_accordion ) { 2070 $accordion_active_toggle.find('.et_pb_toggle_content').slideToggle( 700, function() { 2071 $accordion_active_toggle.removeClass( 'et_pb_toggle_open' ).addClass('et_pb_toggle_close'); 2072 } ); 2073 } 2074 } ); 2075 2076 var $et_contact_container = $('.et_pb_contact_form_container'); 2077 2078 if ( $et_contact_container.length ) { 2079 var $et_contact_form = $et_contact_container.find( 'form' ),
2080 $et_contact_submit = $et_contact_container.find( 'input.et_pb_contact_submit' ), 2081 $et_inputs = $et_contact_form.find('input[type=text],textarea'), 2082 et_email_reg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/, 2083 et_contact_error = false, 2084 $et_contact_message = $et_contact_container.find('.et-pb-contact-message'), 2085 et_message = ''; 2086 2087 $et_inputs.live('focus', function(){ 2088 if ( $(this).val() === $(this).siblings('label').text() ) $(this).val(""); 2089 }).live('blur', function(){ 2090 if ($(this).val() === "") $(this).val( $(this).siblings('label').text() ); 2091 }); 2092 2093 $et_contact_form.on('submit', function(event) { 2094 et_contact_error = false; 2095 et_message = '<ul>'; 2096 2097 $et_inputs.removeClass('et_contact_error'); 2098 2099 $et_inputs.each(function(index, domEle){ 2100 if ( $(domEle).val() === '' || $(domEle).val() === $(this).siblings('label').text() ) { 2101 $(domEle).addClass('et_contact_error'); 2102 et_contact_error = true; 2103 2104 var default_value = $(this).siblings('label').text(); 2105 if ( default_value == '' ) default_value = et_custom.captcha; 2106 2107 et_message += '<li>' + et_custom.fill + ' ' + default_value + ' ' + et_custom.field + '</li>'; 2108 } 2109 if ( ($(domEle).attr('id') == 'et_contact_email') && !et_email_reg.test($(domEle).val()) ) { 2110 $(domEle).removeClass('et_contact_error').addClass('et_contact_error'); 2111 et_contact_error = true; 2112 2113 if ( !et_email_reg.test($(domEle).val()) ) et_message += '<li>' + et_custom.invalid + '</li>'; 2114 } 2115 }); 2116 2117 if ( !et_contact_error ) { 2118 $href = $(this).attr('action'); 2119 2120 $et_contact_container.fadeTo('fast',0.2).load($href + ' #' + $et_contact_form.closest('.et_pb_contact_form_container').attr('id'), $(this).serializeArray(), function() { 2121 $et_contact_container.fadeTo('fast',1); 2122 }); 2123 } 2124 2125 et_message += '</ul>'; 2126 2127 if ( et_message != '<ul></ul>' ) 2128 $et_contact_message.html(et_message); 2129 2130 event.preventDefault(); 2131 }); 2132 } 2133 2134 $( '.et_pb_video .et_pb_video_overlay, .et_pb_video_wrap .et_pb_video_overlay' ).click( function() { 2135 var $this = $(this), 2136 $video_image = $this.closest( '.et_pb_video_overlay' ); 2137 2138 $video_image.fadeTo( 500, 0, function() { 2139 var $image = $(this); 2140 2141 $image.css( 'display', 'none' ); 2142 } ); 2143 2144 return false; 2145 } ); 2146 2147 function et_fix_video_wmode( video_wrapper ) { 2148 $( video_wrapper ).each( function() { 2149 if ( $(this).find( 'iframe' ).length ) { 2150 var $this_el = $(this).find( 'iframe' ), 2151 src_attr = $this_el.attr('src'), 2152 wmode_character = src_attr.indexOf( '?' ) == -1 ? '?' : '&', 2153 this_src = src_attr + wmode_character + 'wmode=opaque';
2154 2155 $this_el.attr('src', this_src); 2156 } 2157 } ); 2158 } 2159 2160 function et_pb_resize_section_video_bg( $video ) { 2161 $element = typeof $video !== 'undefined' ? $video.closest( '.et_pb_section_video_bg' ) : $( '.et_pb_section_video_bg' ); 2162 2163 $element.each( function() { 2164 var $this_el = $(this), 2165 ratio = ( typeof $this_el.attr( 'data-ratio' ) !== 'undefined' ) 2166 ? $this_el.attr( 'data-ratio' ) 2167 : $this_el.find('video').attr( 'width' ) / $this_el.find('video').attr( 'height' ), 2168 $video_elements = $this_el.find( '.mejs-video, video, object' ).css( 'margin', 0 ), 2169 $container = $this_el.closest( '.et_pb_section' ).length 2170 ? $this_el.closest( '.et_pb_section' ) 2171 : $this_el.closest( '.et_pb_slides' ), 2172 body_width = $container.width(), 2173 container_height = $container.innerHeight(), 2174 width, height; 2175 2176 if ( typeof $this_el.attr( 'data-ratio' ) == 'undefined' ) 2177 $this_el.attr( 'data-ratio', ratio ); 2178 2179 if ( body_width / container_height < ratio ) { 2180 width = container_height * ratio; 2181 height = container_height; 2182 } else { 2183 width = body_width; 2184 height = body_width / ratio; 2185 } 2186 2187 $video_elements.width( width ).height( height ); 2188 } ); 2189 } 2190 2191 function et_pb_center_video( $video ) { 2192 $element = typeof $video !== 'undefined' ? $video : $( '.et_pb_section_video_bg .mejs-video' ); 2193 2194 $element.each( function() { 2195 var $video_width = $(this).width() / 2; 2196 var $video_width_negative = 0 - $video_width; 2197 $(this).css("margin-left",$video_width_negative ); 2198 2199 if ( typeof $video !== 'undefined' ) { 2200 if ( $video.closest( '.et_pb_slider' ).length && ! $video.closest( '.et_pb_first_video' ).length ) 2201 return false; 2202 } 2203 } ); 2204 } 2205 2206 function et_calculate_header_values() { 2207 var $top_header = $( '#top-header' ), 2208 secondary_nav_height = $top_header.length && $top_header.is( ':visible' ) ? $top_header.innerHeight() : 0, 2209 admin_bar_height = $( '#wpadminbar' ).length ? $( '#wpadminbar' ).innerHeight() : 0; 2210 2211 et_header_height = $( '#main-header' ).innerHeight() + secondary_nav_height - 1, 2212 et_header_modifier = et_header_height <= 90 ? et_header_height - 29 : et_header_height - 56, 2213 et_header_offset = et_header_modifier + admin_bar_height; 2214 2215 et_primary_header_top = secondary_nav_height + admin_bar_height; 2216 } 2217 2218 function et_fix_slider_height() { 2219 if ( ! $et_pb_slider.length ) return; 2220 2221 $et_pb_slider.each( function() { 2222 var $slide = $(this).find( '.et_pb_slide' ), 2223 $slide_container = $slide.find( '.et_pb_container' ), 2224 max_height = 0; 2225 2226 $slide_container.css( 'min-height', 0 ); 2227 2228 $slide.each( function() { 2229 var $this_el = $(this), 2230 height = $this_el.innerHeight(); 2231 2232 if ( max_height < height ) 2233 max_height = height; 2234 } ); 2235 2236 $slide_container.css( 'min-height', max_height ); 2237 } ); 2238 } 2239 2240 var $comment_form = $('#commentform'); 2241 2242 et_pb_form_placeholders_init( $comment_form ); 2243 et_pb_form_placeholders_init( $( '.et_pb_newsletter_form' ) ); 2244 2245 $comment_form.submit(function(){ 2246 et_pb_remove_placeholder_text( $comment_form ); 2247 }); 2248 2249 function et_pb_form_placeholders_init( $form ) { 2250 $form.find('input:text, textarea').each(function(index,domEle){ 2251 var $et_current_input = jQuery(domEle), 2252 $et_comment_label = $et_current_input.siblings('label'), 2253 et_comment_label_value = $et_current_input.siblings('label').text(); 2254 if ( $et_comment_label.length ) { 2255 $et_comment_label.hide(); 2256 if ( $et_current_input.siblings('span.required') ) { 2257 et_comment_label_value += $et_current_input.siblings('span.required').text(); 2258 $et_current_input.siblings('span.required').hide(); 2259 } 2260 $et_current_input.val(et_comment_label_value); 2261 } 2262 }).bind('focus',function(){ 2263 var et_label_text = jQuery(this).siblings('label').text(); 2264 if ( jQuery(this).siblings('span.required').length ) et_label_text += jQuery(this).siblings('span.required').text(); 2265 if (jQuery(this).val() === et_label_text) jQuery(this).val(""); 2266 }).bind('blur',function(){ 2267 var et_label_text = jQuery(this).siblings('label').text(); 2268 if ( jQuery(this).siblings('span.required').length ) et_label_text += jQuery(this).siblings('span.required').text(); 2269 if (jQuery(this).val() === "") jQuery(this).val( et_label_text ); 2270 }); 2271 } 2272 2273 // remove placeholder text before form submission 2274 function et_pb_remove_placeholder_text( $form ) {
2275 $form.find('input:text, textarea').each(function(index,domEle){ 2276 var $et_current_input = jQuery(domEle), 2277 $et_label = $et_current_input.siblings('label'), 2278 et_label_value = $et_current_input.siblings('label').text(); 2279 2280 if ( $et_label.length && $et_label.is(':hidden') ) { 2281 if ( $et_label.text() == $et_current_input.val() ) 2282 $et_current_input.val( '' ); 2283 } 2284 }); 2285 } 2286 2287 et_duplicate_menu( $('#et-top-navigation ul.nav'), $('#et-top-navigation .mobile_nav'), 'mobile_menu', 'et_mobile_menu' ); 2288 2289 $('.et_pb_fullwidth_menu ul.nav').each(function(i) { 2290 i++; 2291 et_duplicate_menu( $(this), $(this).parents('.et_pb_row').find('div .mobile_nav'), 'mobile_menu' + i, 'et_mobile_menu' ); 2292 }); 2293 2294 $('.et_pb_fullwidth_menu').each(function() { 2295 var this_menu = $( this ), 2296 bg_color = this_menu.data( 'bg_color' ); 2297 if ( bg_color ) { 2298 this_menu.find( 'ul' ).css( { 'background-color' : bg_color } ); 2299 } 2300 }); 2301 2302 function et_duplicate_menu( menu, append_to, menu_id, menu_class ){ 2303 append_to.each( function() { 2304 var $this_menu = $(this), 2305 $cloned_nav; 2306 2307 menu.clone().attr('id',menu_id).removeClass().attr('class',menu_class).appendTo( $this_menu ); 2308 $cloned_nav = $this_menu.find('> ul'); 2309 $cloned_nav.find('.menu_slide').remove(); 2310 $cloned_nav.find('li:first').addClass('et_first_mobile_item'); 2311 2312 $cloned_nav.find( 'a' ).on( 'click', function(){ 2313 $this_menu.trigger( 'click' ); 2314 } ); 2315 2316 $this_menu.on( 'click', function(){ 2317 if ( $(this).hasClass('closed') ){ 2318 $(this).removeClass( 'closed' ).addClass( 'opened' ); 2319 $cloned_nav.slideDown( 500 ); 2320 } else { 2321 $(this).removeClass( 'opened' ).addClass( 'closed' ); 2322 $cloned_nav.slideUp( 500 ); 2323 } 2324 return false; 2325 } ); 2326 2327 $this_menu.on( 'click', 'a', function(event){ 2328 event.stopPropagation(); 2329 } ); 2330 } ); 2331 } 2332 2333 if ( $( '#et-secondary-nav' ).length ) { 2334 $('#et-top-navigation #mobile_menu').append( $( '#et-secondary-nav' ).clone().html() ); 2335 } 2336 2337 $et_pb_newsletter_button.click( function( event ) { 2338 if ( $(this).closest( '.et_pb_login_form' ).length || $(this).closest( '.et_pb_feedburner_form' ).length ) { 2339 return; 2340 } 2341 2342 event.preventDefault(); 2343 2344 var $newsletter_container = $(this).closest( '.et_pb_newsletter' ), 2345 $firstname = $newsletter_container.find( 'input[name="et_pb_signup_firstname"]' ), 2346 $lastname = $newsletter_container.find( 'input[name="et_pb_signup_lastname"]' ), 2347 $email = $newsletter_container.find( 'input[name="et_pb_signup_email"]' ), 2348 list_id = $newsletter_container.find( 'input[name="et_pb_signup_list_id"]' ).val(), 2349 $result = $newsletter_container.find( '.et_pb_newsletter_result' ).hide(), 2350 service = $(this).closest( '.et_pb_newsletter_form' ).data( 'service' ) || 'mailchimp'; 2351 2352 $firstname.removeClass( 'et_pb_signup_error' ); 2353 $lastname.removeClass( 'et_pb_signup_error' ); 2354 $email.removeClass( 'et_pb_signup_error' ); 2355 2356 et_pb_remove_placeholder_text( $(this).closest( '.et_pb_newsletter_form' ) ); 2357 2358 if ( $firstname.val() == '' || $email.val() == '' || list_id === '' ) { 2359 if ( $firstname.val() == '' ) $firstname.addClass( 'et_pb_signup_error' ); 2360 2361 if ( $email.val() == '' ) $email.addClass( 'et_pb_signup_error' ); 2362 2363 if ( $firstname.val() == '' ) 2364 $firstname.val( $firstname.siblings( '.et_pb_contact_form_label' ).text() ); 2365 2366 if ( $lastname.val() == '' ) 2367 $lastname.val( $lastname.siblings( '.et_pb_contact_form_label' ).text() ); 2368 2369 if ( $email.val() == '' ) 2370 $email.val( $email.siblings( '.et_pb_contact_form_label' ).text() ); 2371 2372 return; 2373 } 2374 2375 $.ajax( { 2376 type: "POST", 2377 url: et_custom.ajaxurl, 2378 dataType: "json", 2379 data: 2380 { 2381 action : 'et_pb_submit_subscribe_form', 2382 et_load_nonce : et_custom.et_load_nonce, 2383 et_list_id : list_id, 2384 et_firstname : $firstname.val(), 2385 et_lastname : $lastname.val(), 2386 et_email : $email.val(), 2387 et_service : service 2388 }, 2389 beforeSend: function() { 2390 $newsletter_container 2391 .find( '.et_pb_newsletter_button' ) 2392 .addClass( 'et_pb_button_text_loading' ) 2393 .find('.et_subscribe_loader') 2394 .show(); 2395 }, 2396 complete: function(){ 2397 $newsletter_container 2398 .find( '.et_pb_newsletter_button' ) 2399 .removeClass( 'et_pb_button_text_loading' ) 2400 .find('.et_subscribe_loader') 2401 .hide(); 2402 }, 2403 success: function( data ){ 2404 if ( data ) { 2405 if ( data.error ) { 2406 $result.html( data.error ).show(); 2407 } 2408 if ( data.success ) { 2409 $newsletter_container.find( '.et_pb_newsletter_form > p' ).hide(); 2410 $result.html( data.success ).show(); 2411 } 2412 } else { 2413 $result.html( et_custom.subscription_failed ).show(); 2414 } 2415 } 2416 } ); 2417 } ); 2418 2419 function et_change_primary_nav_position() { 2420 var $body = $('body'); 2421 2422 if ( ! $body.hasClass( 'et_vertical_nav' ) && ( $body.hasClass( 'et_fixed_nav' ) ) ) {
2423 $('#main-header').css( 'top', et_primary_header_top ); 2424 } 2425 } 2426 2427 $( window ).resize( function(){ 2428 var containerWidthChanged = et_container_width !== $et_container.width(), 2429 window_width = $et_window.width(); 2430 2431 et_pb_resize_section_video_bg(); 2432 et_pb_center_video(); 2433 2434 et_fix_slider_height(); 2435 2436 if ( $( '.et_pb_blog_grid' ).length ) 2437 $( '.et_pb_blog_grid' ).masonry(); 2438 2439 if ( et_is_fixed_nav && containerWidthChanged ) { 2440 setTimeout( function() { 2441 var $top_header = $( '#top-header' ), 2442 secondary_nav_height = $top_header.length && $top_header.is( ':visible' ) ? $top_header.innerHeight() : 0; 2443 2444 $main_container_wrapper.css( 'paddingTop', $( '#main-header' ).innerHeight() + secondary_nav_height - 1 ); 2445 2446 et_change_primary_nav_position(); 2447 }, 200 ); 2448 } 2449 2450 if ( $( '#wpadminbar' ).length && et_is_fixed_nav && window_width >= 740 && window_width <= 782 ) { 2451 et_calculate_header_values(); 2452 2453 et_change_primary_nav_position(); 2454 } 2455 2456 $et_pb_fullwidth_portfolio.each(function(){ 2457 set_container_height = $(this).hasClass('et_pb_fullwidth_portfolio_carousel') ? true : false; 2458 set_fullwidth_portfolio_columns( $(this), set_container_height ); 2459 }); 2460 2461 if ( containerWidthChanged ) { 2462 $('.container-width-change-notify').trigger('containerWidthChanged'); 2463 2464 setTimeout( function() { 2465 $et_pb_filterable_portfolio.each(function(){ 2466 set_filterable_grid_items( $(this) ); 2467 }); 2468 $et_pb_gallery.each(function(){ 2469 if ( $(this).hasClass( 'et_pb_gallery_grid' ) ) { 2470 set_gallery_grid_items( $(this) ); 2471 } 2472 }); 2473 }, 100 ); 2474 2475 et_container_width = $et_container.width(); 2476 2477 etRecalculateOffset = true; 2478 2479 if ( $et_pb_circle_counter.length ){ 2480 $et_pb_circle_counter.each(function(){ 2481 var $this_counter = $(this); 2482 $this_counter.data('easyPieChart').update( $this_counter.data('number-value') ); 2483 }); 2484 } 2485 } 2486 } ); 2487 2488 $( window ).ready( function(){ 2489 if ( $.fn.fitVids ) { 2490 $( '.et_pb_slide_video' ).fitVids(); 2491 2492 $( '#main-content' ).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']"} ); 2493 } 2494 2495 et_fix_video_wmode('.fluid-width-video-wrapper'); 2496 2497 et_fix_slider_height(); 2498 } ); 2499 2500 $( window ).load( function(){ 2501 if ( et_is_fixed_nav ) { 2502 et_calculate_header_values(); 2503 2504 $main_container_wrapper.css( 'paddingTop', et_header_height - 1 ); 2505 2506 et_change_primary_nav_position(); 2507 } 2508 2509 if ( $( '.et_pb_blog_grid' ).length ) { 2510 $( '.et_pb_blog_grid' ).masonry( { 2511 itemSelector : '.et_pb_post' 2512 } ); 2513 } 2514 2515 setTimeout( function() { 2516 $( '.et_pb_preload' ).removeClass( 'et_pb_preload' ); 2517 }, 500 ); 2518 2519 if ( $.fn.hashchange ) { 2520 $(window).hashchange( function(){ 2521 var hash = window.location.hash.substring(1); 2522 process_et_hashchange( hash ); 2523 }); 2524 $(window).hashchange(); 2525 } 2526 2527 if ( $('p.demo_store').length ) { 2528 $('#footer-bottom').css('margin-bottom' , $('p.demo_store').innerHeight()); 2529 } 2530 2531 if ( $et_pb_parallax.length && !et_is_mobile_device ) { 2532 $et_pb_parallax.each(function(){ 2533 if ( $(this).hasClass('et_pb_parallax_css') ) { 2534 return; 2535 } 2536 2537 var $this_parent = $(this).parent(); 2538 2539 $.proxy( et_parallax_set_height, $this_parent )(); 2540 2541 $.proxy( et_apply_parallax, $this_parent )(); 2542 2543 $et_window.on( 'scroll', $.proxy( et_apply_parallax, $this_parent ) ); 2544 2545 $et_window.on( 'resize', $.proxy( et_parallax_set_height, $this_parent ) ); 2546 $et_window.on( 'resize', $.proxy( et_apply_parallax, $this_parent ) ); 2547 2548 $this_parent.find('.et-learn-more .heading-more').click( function() { 2549 setTimeout(function(){ 2550 $.proxy( et_parallax_set_height, $this_parent )(); 2551 }, 300 ); 2552 }); 2553 }); 2554 } 2555 2556 if ( $('.et_pb_audio_module .mejs-audio').length || $( '.et_audio_content .mejs-audio' ).length ){ 2557 $('.et_pb_audio_module .mejs-audio, .et_audio_content .mejs-audio').each(function(){ 2558 $count_timer = $(this).find('div.mejs-currenttime-container').addClass('custom'); 2559 $(this).find('.mejs-controls div.mejs-duration-container').replaceWith($count_timer); 2560 }); 2561 } 2562 2563 if ( $.fn.waypoint ) { 2564 $( '.et_pb_counter_container, .et-waypoint' ).waypoint( { 2565 offset: '75%', 2566 handler: function() { 2567 $(this).addClass( 'et-animated' ); 2568 } 2569 } ); 2570 2571 if ( $et_pb_circle_counter.length ){ 2572 $et_pb_circle_counter.each(function(){ 2573 var $this_counter = $(this); 2574 $this_counter.waypoint({ 2575 offset: '65%', 2576 handler: function() { 2577 $this_counter.data('easyPieChart').update( $this_counter.data('number-value') ); 2578 } 2579 }); 2580 }); 2581 } 2582 2583 if ( $et_pb_number_counter.length ){ 2584 $et_pb_number_counter.each(function(){ 2585 var $this_counter = $(this); 2586 $this_counter.waypoint({ 2587 offset: '75%', 2588 handler: function() { 2589 $this_counter.data('easyPieChart').update( $this_counter.data('number-value') ); 2590 } 2591 }); 2592 }); 2593 } 2594 2595 if ( et_is_fixed_nav ) { 2596 $('#main-content').waypoint( { 2597 offset: function() { 2598 if ( etRecalculateOffset ) { 2599 et_calculate_header_values(); 2600 2601 etRecalculateOffset = false;
2602 } 2603 2604 return et_header_offset; 2605 }, 2606 handler : function( direction ) { 2607 if ( direction === 'down' ) { 2608 $('#main-header').addClass( 'et-fixed-header' ); 2609 } else { 2610 $('#main-header').removeClass( 'et-fixed-header' ); 2611 } 2612 } 2613 } ); 2614 } 2615 } 2616 2617 } ); 2618 2619 function et_pb_smooth_scroll( $target, $top_section, $speed ) { 2620 var $window_width = $( window ).width(); 2621 2622 if ( $( 'body' ).hasClass( 'et_fixed_nav' ) && $window_width > 980 ) { 2623 $menu_offset = $( '#top-header' ).outerHeight() + $( '#main-header' ).outerHeight() - 1; 2624 } else { 2625 $menu_offset = -1; 2626 } 2627 2628 if ( $ ('#wpadminbar').length && $window_width > 600 ) { 2629 $menu_offset += $( '#wpadminbar' ).outerHeight(); 2630 } 2631 2632 //fix sidenav scroll to top 2633 if ( $top_section ) { 2634 $scroll_position = 0; 2635 } else { 2636 $scroll_position = $target.offset().top - $menu_offset; 2637 } 2638 2639 $( 'html, body' ).animate( { scrollTop : $scroll_position }, $speed ); 2640 } 2641 2642 $( 'a[href*="#"]:not([href="#"])' ).click( function() { 2643 if ( $(this).closest( '.woocommerce-tabs' ).length && $(this).closest( '.tabs' ).length ) { 2644 return false; 2645 } 2646 2647 if ( location.pathname.replace( /^\//,'' ) == this.pathname.replace( /^\//,'' ) && location.hostname == this.hostname ) { 2648 var target = $( this.hash ); 2649 target = target.length ? target : $( '[name=' + this.hash.slice(1) +']' ); 2650 if ( target.length ) { 2651 et_pb_smooth_scroll( target, false, 800 ); 2652 2653 if ( ! $( '#main-header' ).hasClass( 'et-fixed-header' ) && $( 'body' ).hasClass( 'et_fixed_nav' ) && $( window ).width() > 980 ) { 2654 setTimeout(function(){ 2655 et_pb_smooth_scroll( target, false, 200); 2656 }, 500 ); 2657 } 2658 2659 return false; 2660 } 2661 } 2662 }); 2663 2664 if ( $( '.et_pb_section' ).length > 1 && $( '.et_pb_side_nav_page' ).length ) { 2665 var $i=0; 2666 2667 $( '#main-content' ).append( '<ul class="et_pb_side_nav"></ul>' ); 2668 2669 $( '.et_pb_section' ).each( function(){ 2670 if ( $( this ).height() > 0 ) { 2671 $active_class = $i == 0 ? 'active' : ''; 2672 $( '.et_pb_side_nav' ).append( '<li class="side_nav_item"><a href="#" id="side_nav_item_id_' + $i + '" class= "' + $active_class + '">' + $i + '</a></li>' ); 2673 $( this ).addClass( 'et_pb_scroll_' + $i ); 2674 $i++; 2675 } 2676 }); 2677 2678 $side_nav_offset = ( $i * 20 + 40 ) / 2; 2679 $( 'ul.et_pb_side_nav' ).css( 'marginTop', '-' + parseInt( $side_nav_offset) + 'px' ); 2680 $( '.et_pb_side_nav' ).addClass( 'et-visible' ); 2681 2682 2683 $( '.et_pb_side_nav a' ).click( function(){ 2684 $top_section = ( $( this ).text() == "0" ) ? true : false; 2685 $target = $( '.et_pb_scroll_' + $( this ).text() ); 2686 2687 et_pb_smooth_scroll( $target, $top_section, 800); 2688 2689 if ( ! $( '#main-header' ).hasClass( 'et-fixed-header' ) && $( 'body' ).hasClass( 'et_fixed_nav' ) && $( window ).width() > 980 ) { 2690 setTimeout(function(){ 2691 et_pb_smooth_scroll( $target, $top_section, 200); 2692 },500); 2693 } 2694 2695 return false; 2696 }); 2697 2698 $( window ).scroll( function(){ 2699 2700 $add_offset = ( $( 'body' ).hasClass( 'et_fixed_nav' ) ) ? 20 : -90; 2701 2702 if ( $ ( '#wpadminbar' ).length && $( window ).width() > 600 ) { 2703 $add_offset += $( '#wpadminbar' ).outerHeight(); 2704 } 2705 2706 $side_offset = ( $( 'body' ).hasClass( 'et_vertical_nav' ) ) ? $( '#top-header' ).height() + $add_offset + 60 : $( '#top-header' ).height() + $( '#main-header' ).height() + $add_offset; 2707 2708 for ( var $i = 0; $i <= $( '.side_nav_item a' ).length - 1; $i++ ) { 2709 if( $( window ).scrollTop() + $( window ).height() == $( document ).height() ) { 2710 $last = $( '.side_nav_item a' ).length - 1; 2711 $( '.side_nav_item a' ).removeClass( 'active' ); 2712 $( 'a#side_nav_item_id_' + $last ).addClass( 'active' ); 2713 } else { 2714 if ( $( this ).scrollTop() >= $( '.et_pb_scroll_' + $i ).offset().top - $side_offset ) { 2715 $( '.side_nav_item a' ).removeClass( 'active' ); 2716 $( 'a#side_nav_item_id_' + $i ).addClass( 'active' ); 2717 } 2718 } 2719 } 2720 }); 2721 } 2722 2723 if ( $('.et_pb_scroll_top').length ) { 2724 $(window).scroll(function(){ 2725 if ($(this).scrollTop() > 800) { 2726 $('.et_pb_scroll_top').show().removeClass( 'et-hidden' ).addClass( 'et-visible' ); 2727 } else { 2728 $('.et_pb_scroll_top').removeClass( 'et-visible' ).addClass( 'et-hidden' ); 2729 } 2730 }); 2731 2732 //Click event to scroll to top 2733 $('.et_pb_scroll_top').click(function(){ 2734 $('html, body').animate({scrollTop : 0},800); 2735 }); 2736 } 2737 2738 } ); 2739})(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.