1document.documentElement.className += ' js_active '; 2document.documentElement.className += 'ontouchstart' in document.documentElement ? ' vc_mobile ' : ' vc_desktop '; 3(function () { 4 var prefix = [ 5 '-webkit-', 6 '-moz-', 7 '-ms-', 8 '-o-', 9 '' 10 ]; 11 for ( var i = 0; 12 i < prefix.length; 13 i ++ ) { 14 if ( prefix[ i ] + 'transform' in document.documentElement.style ) { 15 document.documentElement.className += " vc_transform "; 16 } 17 } 18})(); 19/* 20 On document ready jQuery will fire set of functions. 21 If you want to override function behavior then copy it to your theme js file 22 with the same name. 23 */ 24function vc_js() { 25 vc_twitterBehaviour(); 26 vc_toggleBehaviour(); 27 vc_tabsBehaviour(); 28 vc_accordionBehaviour(); 29 vc_teaserGrid(); 30 vc_carouselBehaviour(); 31 vc_slidersBehaviour(); 32 vc_prettyPhoto(); 33 vc_googleplus(); 34 vc_pinterest(); 35 vc_progress_bar(); 36 vc_plugin_flexslider(); 37 vc_google_fonts(); 38 vc_gridBehaviour(); 39 vc_rowBehaviour(); 40 vc_ttaActivation(); // @since 4.5 41 jQuery( document ).trigger( 'vc_js' ); 42 window.setTimeout( vc_waypoints, 500 ); 43} 44 45if ( 'function' !== typeof(window[ 'vc_plugin_flexslider' ]) ) { 46 window.vc_plugin_flexslider = function ( $parent ) { 47 var $slider = $parent ? $parent.find( '.wpb_flexslider' ) : jQuery( '.wpb_flexslider' ); 48 $slider.each( function () { 49 var this_element = jQuery( this ); 50 var sliderSpeed = 800, 51 sliderTimeout = parseInt( this_element.attr( 'data-interval' ) ) * 1000, 52 sliderFx = this_element.attr( 'data-flex_fx' ), 53 slideshow = true; 54 if ( 0 === sliderTimeout ) { 55 slideshow = false; 56 } 57 58 this_element.is( ':visible' ) && this_element.flexslider( { 59 animation: sliderFx, 60 slideshow: slideshow, 61 slideshowSpeed: sliderTimeout, 62 sliderSpeed: sliderSpeed, 63 smoothHeight: true 64 } ); 65 } ); 66 }; 67} 68 69/* Twitter 70 ---------------------------------------------------------- */ 71if ( 'function' !== typeof(window[ 'vc_twitterBehaviour' ]) ) { 72 window.vc_twitterBehaviour = function () { 73 jQuery( '.wpb_twitter_widget .tweets' ).each( function ( index ) { 74 var this_element = jQuery( this ), 75 tw_name = this_element.attr( 'data-tw_name' ), 76 tw_count = this_element.attr( 'data-tw_count' ); 77 78 this_element.tweet( { 79 username: tw_name, 80 join_text: "auto", 81 avatar_size: 0, 82 count: tw_count, 83 template: "{avatar}{join}{text}{time}", 84 auto_join_text_default: "", 85 auto_join_text_ed: "", 86 auto_join_text_ing: "", 87 auto_join_text_reply: "", 88 auto_join_text_url: "", 89 loading_text: '<span class="loading_tweets">loading tweets...</span>' 90 } ); 91 } ); 92 }; 93} 94 95/* Google plus 96 ---------------------------------------------------------- */ 97if ( 'function' !== typeof(window[ 'vc_googleplus' ]) ) { 98 window.vc_googleplus = function () { 99 if ( 0 < jQuery( '.wpb_googleplus' ).length ) { 100 (function () { 101 var po = document.createElement( 'script' ); 102 po.type = 'text/javascript'; 103 po.async = true; 104 po.src = 'https://apis.google.com/js/plusone.js'; 105 var s = document.getElementsByTagName( 'script' )[ 0 ]; 106 s.parentNode.insertBefore( po, s ); 107 })(); 108 } 109 } 110} 111 112/* Pinterest 113 ---------------------------------------------------------- */ 114if ( 'function' !== typeof(window[ 'vc_pinterest' ]) ) { 115 window.vc_pinterest = function () { 116 if ( 0 < jQuery( '.wpb_pinterest' ).length ) { 117 (function () { 118 var po = document.createElement( 'script' ); 119 po.type = 'text/javascript'; 120 po.async = true; 121 po.src = 'http://assets.pinterest.com/js/pinit.js'; 122 var s = document.getElementsByTagName( 'script' )[ 0 ]; 123 s.parentNode.insertBefore( po, s ); 124 })(); 125 } 126 } 127} 128 129/* Progress bar 130 ---------------------------------------------------------- */ 131if ( 'function' !== typeof(window[ 'vc_progress_bar' ] ) ) { 132 window.vc_progress_bar = function () { 133 if ( 'undefined' !== typeof(jQuery.fn.waypoint) ) { 134 135 jQuery( '.vc_progress_bar' ).waypoint( function () { 136 jQuery( this ).find( '.vc_single_bar' ).each( function ( index ) { 137 var $this = jQuery( this ), 138 bar = $this.find( '.vc_bar' ), 139 val = bar.data( 'percentage-value' ); 140 141 setTimeout( function () { 142 bar.css( { "width": val + '%' } ); 143 }, index * 200 ); 144 } ); 145 }, { offset: '85%' } ); 146 } 147 } 148} 149 150/* Waypoints magic 151 ---------------------------------------------------------- */ 152if ( 'function' !== typeof(window[ 'vc_waypoints' ] ) ) { 153 window.vc_waypoints = function () { 154 if ( 'undefined' !== typeof(jQuery.fn.waypoint ) ) { 155 jQuery( '.wpb_animate_when_almost_visible:not(.wpb_start_animation)' ).waypoint( function () { 156 jQuery( this ).addClass( 'wpb_start_animation' ); 157 }, { offset: '85%' } ); 158 } 159 } 160} 161 162/* Toggle/FAQ 163 ---------------------------------------------------------- */ 164if ( 'function' !== typeof(window[ 'vc_toggleBehaviour' ] ) ) { 165 window.vc_toggleBehaviour = function ( $el ) { 166 function event( e ) { 167 e && e.preventDefault && e.preventDefault(); 168 var title = jQuery( this ); 169 var element = title.closest( '.vc_toggle' ); 170 var content = element.find( '.vc_toggle_content' ); 171 if ( element.hasClass( 'vc_toggle_active' ) ) { 172 content.slideUp( { 173 duration: 300, 174 complete: function () { 175 element.removeClass( 'vc_toggle_active' ); 176 } 177 } ); 178 } else { 179 content.slideDown( { 180 duration: 300, 181 complete: function () { 182 element.addClass( 'vc_toggle_active' ); 183 } 184 } ); 185 } 186 } 187 188 if ( $el ) { 189 if ( $el.hasClass( 'vc_toggle_title' ) ) { 190 $el.unbind( 'click' ).click( event ); 191 } else { 192 $el.find( ".vc_toggle_title" ).unbind( 'click' ).click( event ); 193 } 194 } else { 195 jQuery( ".vc_toggle_title" ).unbind( 'click' ).on( 'click', event ); 196 } 197 } 198} 199 200/* Tabs + Tours 201 ---------------------------------------------------------- */ 202if ( 'function' !== typeof(window[ 'vc_tabsBehaviour' ] ) ) { 203 window.vc_tabsBehaviour = function ( $tab ) { 204 if ( jQuery.ui ) { 205 var $call = $tab || jQuery( '.wpb_tabs, .wpb_tour' ), 206 ver = jQuery.ui && jQuery.ui.version ? jQuery.ui.version.split( '.' ) : '1.10', 207 old_version = 1 === parseInt( ver[ 0 ] ) && 9 > parseInt( ver[ 1 ] ); 208 $call.each( function ( index ) { 209 var $tabs, 210 interval = jQuery( this ).attr( "data-interval" ), 211 tabs_array = []; 212 // 213 $tabs = jQuery( this ).find( '.wpb_tour_tabs_wrapper' ).tabs( { 214 show: function ( event, ui ) { 215 wpb_prepare_tab_content( event, ui ); 216 }, 217 beforeActivate: function ( event, ui ) { 218 1 !== ui.newPanel.index() && ui.newPanel.find( '.vc_pie_chart:not(.vc_ready)' ); 219 }, 220 activate: function ( event, ui ) { 221 wpb_prepare_tab_content( event, ui ); 222 } 223 } ); 224 if ( interval && 0 < interval ) { 225 try { 226 $tabs.tabs( 'rotate', interval * 1000 ); 227 } catch ( e ) { 228 // nothing. 229 window.console && window.console.log && console.log( e ); 230 } 231 } 232 233 jQuery( this ).find( '.wpb_tab' ).each( function () { 234 tabs_array.push( this.id ); 235 } ); 236 237 jQuery( this ).find( '.wpb_tabs_nav li' ).click( function ( e ) { 238 e.preventDefault(); 239 if ( old_version ) { 240 $tabs.tabs( "select", jQuery( 'a', this ).attr( 'href' ) ); 241 } else { 242 $tabs.tabs( "option", "active", jQuery( this ).index() ); 243 } 244 return false;
245 } ); 246 247 jQuery( this ).find( '.wpb_prev_slide a, .wpb_next_slide a' ).click( function ( e ) { 248 e.preventDefault(); 249 if ( old_version ) { 250 var index = $tabs.tabs( 'option', 'selected' ); 251 if ( jQuery( this ).parent().hasClass( 'wpb_next_slide' ) ) { 252 index ++; 253 } 254 else { 255 index --; 256 } 257 if ( 0 > index ) { 258 index = $tabs.tabs( "length" ) - 1; 259 } 260 else if ( index >= $tabs.tabs( "length" ) ) { 261 index = 0; 262 } 263 $tabs.tabs( "select", index ); 264 } else { 265 var index = $tabs.tabs( "option", "active" ), 266 length = $tabs.find( '.wpb_tab' ).length; 267 268 if ( jQuery( this ).parent().hasClass( 'wpb_next_slide' ) ) { 269 index = (index + 1) >= length ? 0 : index + 1; 270 } else { 271 index = 0 > index - 1 ? length - 1 : index - 1; 272 } 273 274 $tabs.tabs( "option", "active", index ); 275 } 276 277 } ); 278 279 } ); 280 } 281 } 282} 283 284/* Tabs + Tours 285 ---------------------------------------------------------- */ 286if ( 'function' !== typeof(window[ 'vc_accordionBehaviour' ]) ) { 287 window.vc_accordionBehaviour = function () { 288 jQuery( '.wpb_accordion' ).each( function ( index ) { 289 var $this = jQuery( this ); 290 var $tabs, 291 interval = $this.attr( "data-interval" ), 292 active_tab = ! isNaN( jQuery( this ).data( 'active-tab' ) ) && 0 < parseInt( $this.data( 'active-tab' ) ) ? parseInt( $this.data( 'active-tab' ) ) - 1 : false, 293 collapsible = false === active_tab || 'yes' === $this.data( 'collapsible' ); 294 $tabs = $this.find( '.wpb_accordion_wrapper' ).accordion( { 295 header: "> div > h3", 296 autoHeight: false, 297 heightStyle: "content", 298 active: active_tab, 299 collapsible: collapsible, 300 navigation: true, 301 302 activate: vc_accordionActivate, 303 change: function ( event, ui ) { 304 if ( 'undefined' !== typeof(jQuery.fn.isotope) ) { 305 ui.newContent.find( '.isotope' ).isotope( "layout" ); 306 } 307 vc_carouselBehaviour( ui.newPanel ); 308 } 309 } ); 310 if ( true === $this.data( 'vcDisableKeydown' ) ) { 311 $tabs.data( 'uiAccordion' )._keydown = function () { 312 }; 313 } 314 } ); 315 } 316} 317 318/* Teaser grid: isotope 319 ---------------------------------------------------------- */ 320if ( 'function' !== typeof(window[ 'vc_teaserGrid' ]) ) { 321 window.vc_teaserGrid = function () { 322 var layout_modes = { 323 fitrows: 'fitRows', 324 masonry: 'masonry' 325 }; 326 jQuery( '.wpb_grid .teaser_grid_container:not(.wpb_carousel), .wpb_filtered_grid .teaser_grid_container:not(.wpb_carousel)' ).each( function () { 327 var $container = jQuery( this ); 328 var $thumbs = $container.find( '.wpb_thumbnails' ); 329 var layout_mode = $thumbs.attr( 'data-layout-mode' ); 330 $thumbs.isotope( { 331 // options 332 itemSelector: '.isotope-item', 333 layoutMode: ('undefined' === typeof(layout_modes[ layout_mode ]) ? 'fitRows' : layout_modes[ layout_mode ]) 334 } ); 335 $container.find( '.categories_filter a' ).data( 'isotope', $thumbs ).click( function ( e ) { 336 e.preventDefault(); 337 var $thumbs = jQuery( this ).data( 'isotope' ); 338 jQuery( this ).parent().parent().find( '.active' ).removeClass( 'active' ); 339 jQuery( this ).parent().addClass( 'active' ); 340 $thumbs.isotope( { filter: jQuery( this ).attr( 'data-filter' ) } ); 341 } ); 342 jQuery( window ).bind( 'load resize', function () { 343 $thumbs.isotope( "layout" ); 344 } ); 345 } ); 346 } 347} 348 349if ( 'function' !== typeof(window[ 'vc_carouselBehaviour' ]) ) { 350 window.vc_carouselBehaviour = function ( $parent ) { 351 var $carousel = $parent ? $parent.find( ".wpb_carousel" ) : jQuery( ".wpb_carousel" ); 352 $carousel.each( function () { 353 var $this = jQuery( this ); 354 if ( true !== $this.data( 'carousel_enabled' ) && $this.is( ':visible' ) ) { 355 $this.data( 'carousel_enabled', true ); 356 var visible_count = getColumnsCount( jQuery( this ) ), 357 carousel_speed = 500; 358 if ( jQuery( this ).hasClass( 'columns_count_1' ) ) { 359 carousel_speed = 900; 360 } 361 /* Get margin-left value from the css grid and apply it to the carousele li items (margin-right), before carousele initialization */ 362 var carousele_li = jQuery( this ).find( '.wpb_thumbnails-fluid li' ); 363 carousele_li.css( { "margin-right": carousele_li.css( "margin-left" ), "margin-left": 0 } ); 364 365 jQuery( this ).find( '.wpb_wrapper:eq(0)' ).jCarouselLite( { 366 btnNext: jQuery( this ).find( '.next' ), 367 btnPrev: jQuery( this ).find( '.prev' ), 368 visible: visible_count, 369 speed: carousel_speed 370 } ) 371 .width( '100%' ); 372 373 var fluid_ul = jQuery( this ).find( 'ul.wpb_thumbnails-fluid' ); 374 fluid_ul.width( fluid_ul.width() + 300 ); 375 376 jQuery( window ).resize( function () { 377 var before_resize = screen_size; 378 screen_size = getSizeName(); 379 if ( before_resize != screen_size ) { 380 window.setTimeout( 'location.reload()', 20 ); 381 } 382 } ); 383 } 384 385 } ); 386 } 387} 388 389if ( 'function' !== typeof(window[ 'vc_slidersBehaviour' ]) ) { 390 window.vc_slidersBehaviour = function () { 391 jQuery( '.wpb_gallery_slides' ).each( function ( index ) { 392 var this_element = jQuery( this ); 393 var $imagesGrid; 394 395 if ( this_element.hasClass( 'wpb_slider_nivo' ) ) { 396 var sliderSpeed = 800, 397 sliderTimeout = this_element.attr( 'data-interval' ) * 1000; 398 399 if ( 0 === sliderTimeout ) { 400 sliderTimeout = 9999999999; 401 } 402 403 this_element.find( '.nivoSlider' ).nivoSlider( {
404 effect: 'boxRainGrow,boxRain,boxRainReverse,boxRainGrowReverse', // Specify sets like: 'fold,fade,sliceDown' 405 slices: 15, // For slice animations 406 boxCols: 8, // For box animations 407 boxRows: 4, // For box animations 408 animSpeed: sliderSpeed, // Slide transition speed 409 pauseTime: sliderTimeout, // How long each slide will show 410 startSlide: 0, // Set starting Slide (0 index) 411 directionNav: true, // Next & Prev navigation 412 directionNavHide: true, // Only show on hover 413 controlNav: true, // 1,2,3... navigation 414 keyboardNav: false, // Use left & right arrows 415 pauseOnHover: true, // Stop animation while hovering 416 manualAdvance: false, // Force manual transitions 417 prevText: 'Prev', // Prev directionNav text 418 nextText: 'Next' // Next directionNav text 419 } ); 420 } 421 else if ( this_element.hasClass( 'wpb_image_grid' ) ) { 422 if ( jQuery.fn.imagesLoaded ) { 423 $imagesGrid = this_element.find( '.wpb_image_grid_ul' ).imagesLoaded( function () { 424 $imagesGrid.isotope( { 425 // options 426 itemSelector: '.isotope-item', 427 layoutMode: 'fitRows' 428 } ); 429 } ); 430 } else { 431 this_element.find( '.wpb_image_grid_ul' ).isotope( { 432 // options 433 itemSelector: '.isotope-item', 434 layoutMode: 'fitRows' 435 } ); 436 } 437 } 438 } ); 439 } 440} 441 442if ( 'function' !== typeof(window[ 'vc_prettyPhoto' ]) ) { 443 window.vc_prettyPhoto = function () { 444 try { 445 // just in case. maybe prettyphoto isn't loaded on this site 446 if ( jQuery && jQuery.fn && jQuery.fn.prettyPhoto ) { 447 jQuery( 'a.prettyphoto, .gallery-icon a[href*=".jpg"]' ).prettyPhoto( { 448 animationSpeed: 'normal', /* fast/slow/normal */ 449 padding: 15, /* padding for each side of the picture */ 450 opacity: 0.7, /* Value betwee 0 and 1 */ 451 showTitle: true, /* true/false */ 452 allowresize: true, /* true/false */ 453 counter_separator_label: '/', /* The separator for the gallery counter 1 "of" 2 */ 454 //theme: 'light_square', /* light_rounded / dark_rounded / light_square / dark_square */ 455 hideflash: false, /* Hides all the flash object on a page, set to TRUE if flash appears over prettyPhoto */ 456 deeplinking: false, /* Allow prettyPhoto to update the url to enable deeplinking. */ 457 modal: false, /* If set to true, only the close button will close the window */ 458 callback: function () { 459 var url = location.href; 460 var hashtag = (url.indexOf( '#!prettyPhoto' )) ? true : false; 461 if ( hashtag ) { 462 location.hash = "!"; 463 } 464 } /* Called when prettyPhoto is closed */, 465 social_tools: '' 466 } ); 467 } 468 } catch ( err ) { 469 window.console && window.console.log && console.log( err ); 470 } 471 } 472} 473 474if ( 'function' !== typeof(window[ 'vc_google_fonts' ]) ) { 475 window.vc_google_fonts = function () { 476 return false; // TODO: check this for what this is needed 477 } 478} 479window.vcParallaxSkroll = false; 480if ( 'function' !== typeof(window[ 'vc_rowBehaviour' ]) ) { 481 window.vc_rowBehaviour = function () { 482 var $ = window.jQuery; 483 484 function localFunction() { 485 var $elements = $( '[data-vc-full-width="true"]' ); 486 $.each( $elements, function ( key, item ) { 487 var $el = $( this ); 488 $el.addClass( 'vc_hidden' ); 489 490 var $el_full = $el.next( '.vc_row-full-width' ); 491 var el_margin_left = parseInt( $el.css( 'margin-left' ), 10 ); 492 var el_margin_right = parseInt( $el.css( 'margin-right' ), 10 ); 493 var offset = 0 - $el_full.offset().left - el_margin_left; 494 var width = $( window ).width(); 495 $el.css( { 496 'position': 'relative', 497 'left': offset, 498 'box-sizing': 'border-box', 499 'width': $( window ).width() 500 } ); 501 if ( ! $el.data( 'vcStretchContent' ) ) { 502 var padding = (- 1 * offset); 503 if ( 0 > padding ) { 504 padding = 0; 505 } 506 var paddingRight = width - padding - $el_full.width() + el_margin_left + el_margin_right; 507 if ( 0 > paddingRight ) { 508 paddingRight = 0; 509 } 510 $el.css( { 'padding-left': padding + 'px', 'padding-right': paddingRight + 'px' } ); 511 } 512 $el.attr( "data-vc-full-width-init", "true" ); 513 $el.removeClass( 'vc_hidden' ); 514 } ); 515 } 516 517 /** 518 * @todo refactor as plugin. 519 * @returns {*} 520 */
521 function parallaxRow() { 522 var vcSkrollrOptions, vcParallaxSkroll, 523 callSkrollInit = false; 524 if ( vcParallaxSkroll ) { 525 vcParallaxSkroll.destroy(); 526 } 527 $( '.vc_parallax-inner' ).remove(); 528 $( '[data-5p-top-bottom]' ).removeAttr( 'data-5p-top-bottom data-30p-top-bottom' ); 529 $( '[data-vc-parallax]' ).each( function () { 530 var skrollrSpeed, 531 skrollrSize, 532 skrollrStart, 533 skrollrEnd, 534 $parallaxElement, 535 parallaxImage, 536 youtubeId; 537 callSkrollInit = true; // Enable skrollinit; 538 if ( 'on' === $( this ).data( 'vcParallaxOFade' ) ) { 539 $( this ).children().attr( 'data-5p-top-bottom', 'opacity:0;' ).attr( 'data-30p-top-bottom', 540 'opacity:1;' ); 541 } 542 543 skrollrSize = $( this ).data( 'vcParallax' ) * 100; 544 $parallaxElement = $( '<div />' ).addClass( 'vc_parallax-inner' ).appendTo( $( this ) ); 545 $parallaxElement.height( skrollrSize + '%' ); 546 547 parallaxImage = $( this ).data( 'vcParallaxImage' ); 548 549 youtubeId = vcExtractYoutubeId( parallaxImage ); 550 551 if ( youtubeId ) { 552 insertYoutubeVideoAsBackground( $parallaxElement, youtubeId ); 553 } else if ( 'undefined' !== typeof(parallaxImage) ) { 554 $parallaxElement.css( 'background-image', 'url(' + parallaxImage + ')' ); 555 } 556 557 skrollrSpeed = skrollrSize - 100; 558 skrollrStart = - skrollrSpeed; 559 skrollrEnd = 0; 560 561 $parallaxElement.attr( 'data-bottom-top', 'top: ' + skrollrStart + '%;' ).attr( 'data-top-bottom', 562 'top: ' + skrollrEnd + '%;' ); 563 } ); 564 565 if ( callSkrollInit && window.skrollr ) { 566 vcSkrollrOptions = { 567 forceHeight: false, 568 smoothScrolling: false, 569 mobileCheck: function () { 570 return false; 571 } 572 }; 573 vcParallaxSkroll = skrollr.init( vcSkrollrOptions ); 574 return vcParallaxSkroll; 575 } 576 return false; 577 } 578 579 /** 580 * @todo refactor as plugin. 581 * @returns {*} 582 */ 583 function fullHeightRow() { 584 $( '.vc_row-o-full-height:first' ).each( function () { 585 var $window, 586 windowHeight, 587 offsetTop, 588 fullHeight; 589 $window = $( window ); 590 windowHeight = $window.height(); 591 offsetTop = $( this ).offset().top; 592 if ( offsetTop < windowHeight ) { 593 fullHeight = 100 - offsetTop / (windowHeight / 100); 594 $( this ).css( 'min-height', fullHeight + 'vh' ); 595 } 596 } ); 597 598 $( '.vc_row-o-full-height.vc_row-o-content-middle' ).each( function () { 599 var elHeight = $( this ).height(); 600 $( '<div><!-- IE flexbox min height vertical align fixer --></div>' ) 601 .addClass( 'vc_row-full-height-fixer' ) 602 .height( elHeight ) 603 .prependTo( $( this ) ); 604 } ); 605 } 606 607 $( window ).unbind( 'resize.vcRowBehaviour' ).bind( 'resize.vcRowBehaviour', localFunction ); 608 $( window ).bind( 'resize.vcRowBehaviour', fullHeightRow ); 609 localFunction(); 610 fullHeightRow(); 611 initVideoBackgrounds(); // must be called before parallax 612 parallaxRow(); 613 } 614} 615 616if ( 'function' !== typeof(window[ 'vc_gridBehaviour' ]) ) { 617 window.vc_gridBehaviour = function () { 618 jQuery.fn.vcGrid && jQuery( '[data-vc-grid]' ).vcGrid(); 619 } 620} 621/* Helper 622 ---------------------------------------------------------- */ 623if ( 'function' !== typeof(window[ 'getColumnsCount' ]) ) { 624 window.getColumnsCount = function ( el ) { 625 var find = false, 626 i = 1; 627 628 while ( false === find ) { 629 if ( el.hasClass( 'columns_count_' + i ) ) { 630 find = true; 631 return i; 632 } 633 i ++; 634 } 635 } 636} 637 638var screen_size = getSizeName(); 639function getSizeName() { 640 var screen_w = jQuery( window ).width(); 641 642 if ( 1170 < screen_w ) { 643 return 'desktop_wide'; 644 } 645 646 if ( 960 < screen_w && 1169 > screen_w ) { 647 return 'desktop'; 648 } 649 650 if ( 768 < screen_w && 959 > screen_w ) { 651 return 'tablet'; 652 } 653 654 if ( 300 < screen_w && 767 > screen_w ) { 655 return 'mobile'; 656 } 657 658 if ( 300 > screen_w ) { 659 return 'mobile_portrait'; 660 } 661 662 return ''; 663} 664 665function loadScript( url, $obj, callback ) { 666 667 var script = document.createElement( "script" ); 668 script.type = "text/javascript"; 669 670 if ( script.readyState ) { //IE 671 script.onreadystatechange = function () { 672 if ( "loaded" === script.readyState || 673 "complete" === script.readyState ) { 674 script.onreadystatechange = null; 675 callback(); 676 } 677 }; 678 } else { 679 //Others 680 } 681 682 script.src = url; 683 $obj.get( 0 ).appendChild( script ); 684} 685 686if ( 'function' !== typeof(window[ 'wpb_prepare_tab_content' ]) ) { 687 /** 688 * Prepare html to correctly display inside tab container 689 * 690 * @param event - ui tab event 'show' 691 * @param ui - jquery ui tabs object 692 */ 693 window.wpb_prepare_tab_content = function ( event, ui ) { 694 var panel = ui.panel || ui.newPanel, 695 $pie_charts = panel.find( '.vc_pie_chart:not(.vc_ready)' ), 696 $round_charts = panel.find( '.vc_round-chart' ), 697 $line_charts = panel.find( '.vc_line-chart' ), 698 $carousel = panel.find( '[data-ride="vc_carousel"]' ), 699 $ui_panel, $google_maps; 700 vc_carouselBehaviour(); 701 vc_plugin_flexslider( panel ); 702 if ( ui.newPanel.find( '.vc_masonry_media_grid, .vc_masonry_grid' ).length ) { 703 ui.newPanel.find( '.vc_masonry_media_grid, .vc_masonry_grid' ).each( function () { 704 var grid = jQuery( this ).data( 'vcGrid' ); 705 grid && grid.gridBuilder && grid.gridBuilder.setMasonry && grid.gridBuilder.setMasonry(); 706 } ); 707 } 708 if ( panel.find( '.vc_masonry_media_grid, .vc_masonry_grid' ).length ) { 709 panel.find( '.vc_masonry_media_grid, .vc_masonry_grid' ).each( function () { 710 var grid = jQuery( this ).data( 'vcGrid' ); 711 grid && grid.gridBuilder && grid.gridBuilder.setMasonry && grid.gridBuilder.setMasonry(); 712 } ); 713 } 714 $pie_charts.length && jQuery.fn.vcChat && $pie_charts.vcChat(); 715 $round_charts.length && jQuery.fn.vcRoundChart && $round_charts.vcRoundChart( { reload: false } ); 716 $line_charts.length && jQuery.fn.vcLineChart && $line_charts.vcLineChart( { reload: false } ); 717 $carousel.length && jQuery.fn.carousel && $carousel.carousel( 'resizeAction' ); 718 $ui_panel = panel.find( '.isotope, .wpb_image_grid_ul' ); // why var name '$ui_panel'? 719 $google_maps = panel.find( '.wpb_gmaps_widget' ); 720 if ( 0 < $ui_panel.length ) { 721 $ui_panel.isotope( "layout" ); 722 } 723 if ( $google_maps.length && ! $google_maps.is( '.map_ready' ) ) { 724 var $frame = $google_maps.find( 'iframe' ); 725 $frame.attr( 'src', $frame.attr( 'src' ) ); 726 $google_maps.addClass( 'map_ready' ); 727 } 728 if ( panel.parents( '.isotope' ).length ) { 729 panel.parents( '.isotope' ).each( function () { 730 jQuery( this ).isotope( "layout" ); 731 } ); 732 } 733 } 734} 735function vc_ttaActivation() { 736 jQuery( '[data-vc-accordion]' ).on( 'show.vc.accordion', function ( e ) { 737 var $ = window.jQuery, ui = {}; 738 ui.newPanel = $( this ).data( 'vc.accordion' ).getTarget(); 739 window.wpb_prepare_tab_content( e, ui ); 740 } ); 741} 742 743function vc_accordionActivate( event, ui ) { 744 if ( ui.newPanel.length && ui.newHeader.length ) { 745 var $pie_charts = ui.newPanel.find( '.vc_pie_chart:not(.vc_ready)' ), 746 $round_charts = ui.newPanel.find( '.vc_round-chart' ), 747 $line_charts = ui.newPanel.find( '.vc_line-chart' ), 748 $carousel = ui.newPanel.find( '[data-ride="vc_carousel"]' ); 749 if ( 'undefined' !== typeof(jQuery.fn.isotope) ) { 750 ui.newPanel.find( '.isotope, .wpb_image_grid_ul' ).isotope( "layout" ); 751 } 752 if ( ui.newPanel.find( '.vc_masonry_media_grid, .vc_masonry_grid' ).length ) { 753 ui.newPanel.find( '.vc_masonry_media_grid, .vc_masonry_grid' ).each( function () { 754 var grid = jQuery( this ).data( 'vcGrid' ); 755 grid && grid.gridBuilder && grid.gridBuilder.setMasonry && grid.gridBuilder.setMasonry(); 756 } ); 757 } 758 vc_carouselBehaviour( ui.newPanel ); 759 vc_plugin_flexslider( ui.newPanel ); 760 $pie_charts.length && jQuery.fn.vcChat && $pie_charts.vcChat(); 761 $round_charts.length && jQuery.fn.vcRoundChart && $round_charts.vcRoundChart( { reload: false } ); 762 $line_charts.length && jQuery.fn.vcLineChart && $line_charts.vcLineChart( { reload: false } ); 763 $carousel.length && jQuery.fn.carousel && $carousel.carousel( 'resizeAction' ); 764 if ( ui.newPanel.parents( '.isotope' ).length ) { 765 ui.newPanel.parents( '.isotope' ).each( function () { 766 jQuery( this ).isotope( "layout" ); 767 } ); 768 } 769 } 770} 771 772/** 773 * Reinitialize all video backgrounds 774 */
775function initVideoBackgrounds() { 776 jQuery( '.vc_row' ).each( function () { 777 var $row = jQuery( this ), 778 youtubeUrl, 779 youtubeId; 780 781 if ( $row.data( 'vcVideoBg' ) ) { 782 youtubeUrl = $row.data( 'vcVideoBg' ); 783 youtubeId = vcExtractYoutubeId( youtubeUrl ); 784 785 if ( youtubeId ) { 786 $row.find( '.vc_video-bg' ).remove(); 787 insertYoutubeVideoAsBackground( $row, youtubeId ); 788 } 789 790 jQuery( window ).on( 'grid:items:added', function ( event, $grid ) { 791 if ( ! $row.has( $grid ).length ) { 792 return; 793 } 794 795 vcResizeVideoBackground( $row ); 796 } ); 797 } else { 798 $row.find( '.vc_video-bg' ).remove(); 799 } 800 } ); 801} 802 803/** 804 * Insert youtube video into element. 805 * 806 * Video will be w/o controls, muted, autoplaying and looping. 807 */ 808function insertYoutubeVideoAsBackground( $element, youtubeId, counter ) { 809 if ( 'undefined' === typeof( YT.Player ) ) { 810 // wait for youtube iframe api to load. try for 10sec, then abort 811 counter = 'undefined' === typeof( counter ) ? 0 : counter; 812 if ( 100 < counter ) { 813 console.warn( 'Too many attempts to load YouTube api' ); 814 return; 815 } 816 817 setTimeout( function () { 818 insertYoutubeVideoAsBackground( $element, youtubeId, counter ++ ); 819 }, 100 ); 820 821 return; 822 } 823 824 var $container = $element.prepend( '<div class="vc_video-bg"><div class="inner"></div></div>' ).find( '.inner' ); 825 826 new YT.Player( $container[ 0 ], { 827 width: '100%', 828 height: '100%', 829 videoId: youtubeId, 830 playerVars: { 831 playlist: youtubeId, 832 iv_load_policy: 3, // hide annotations 833 enablejsapi: 1, 834 disablekb: 1, 835 autoplay: 1, 836 controls: 0, 837 showinfo: 0, 838 rel: 0, 839 loop: 1 840 }, 841 events: { 842 onReady: function ( event ) { 843 event.target.mute().setLoop( true ); 844 } 845 } 846 } ); 847 848 vcResizeVideoBackground( $element ); 849 850 jQuery( window ).bind( 'resize', function () { 851 vcResizeVideoBackground( $element ); 852 } ); 853} 854 855/** 856 * Resize background video iframe so that video content covers whole area 857 */ 858function vcResizeVideoBackground( $element ) { 859 var iframeW, 860 iframeH, 861 marginLeft, 862 marginTop, 863 containerW = $element.innerWidth(), 864 containerH = $element.innerHeight(), 865 ratio1 = 16, 866 ratio2 = 9; 867 868 if ( ( containerW / containerH ) < ( ratio1 / ratio2 ) ) { 869 iframeW = containerH * (ratio1 / ratio2); 870 iframeH = containerH; 871 872 marginLeft = - Math.round( ( iframeW - containerW ) / 2 ) + 'px'; 873 marginTop = - Math.round( ( iframeH - containerH ) / 2 ) + 'px'; 874 875 iframeW += 'px'; 876 iframeH += 'px'; 877 } else { 878 iframeW = containerW; 879 iframeH = containerW * (ratio2 / ratio1); 880 881 marginTop = - Math.round( ( iframeH - containerH ) / 2 ) + 'px'; 882 marginLeft = - Math.round( ( iframeW - containerW ) / 2 ) + 'px'; 883 884 iframeW += 'px'; 885 iframeH += 'px'; 886 } 887 888 $element.find( '.vc_video-bg iframe' ).css( { 889 maxWidth: '1000%', 890 marginLeft: marginLeft, 891 marginTop: marginTop, 892 width: iframeW, 893 height: iframeH 894 } ); 895} 896 897/** 898 * Extract video ID from youtube url 899 */ 900function vcExtractYoutubeId( url ) { 901 if ( 'undefined' === typeof(url) ) { 902 return false; 903 } 904 905 var id = url.match( /(?:https?:\/{2})?(?:w{3}\.)?youtu(?:be)?\.(?:com|be)(?:\/watch\?v=|\/)([^\s&]+)/ ); 906 907 if ( null !== id ) { 908 return id[ 1 ]; 909 } 910 911 return false; 912} 913jQuery( document ).ready( function ( $ ) { 914 window.vc_js(); 915} );
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.