1var wpAjaxUrl = 'https://olivarezcollege.edu.ph/wp-admin/admin-ajax.php';var flBuilderUrl = 'https://olivarezcollege.edu.ph/wp-content/plugins/bb-plugin/';var FLBuilderLayoutConfig = { 2 anchorLinkAnimations : { 3 duration : 1000, 4 easing : 'swing', 5 offset : 100 6 }, 7 paths : { 8 pluginUrl : 'https://olivarezcollege.edu.ph/wp-content/plugins/bb-plugin/', 9 wpAjaxUrl : 'https://olivarezcollege.edu.ph/wp-admin/admin-ajax.php' 10 }, 11 breakpoints : { 12 small : 768, 13 medium : 992 }, 14 waypoint: { 15 offset: 80 16 } 17}; 18(function($){ 19 20 if(typeof FLBuilderLayout != 'undefined') { 21 return; 22 } 23 24 /** 25 * Helper class with generic logic for a builder layout. 26 * 27 * @class FLBuilderLayout 28 * @since 1.0 29 */ 30 FLBuilderLayout = { 31 32 /** 33 * Initializes a builder layout. 34 * 35 * @since 1.0 36 * @method init 37 */ 38 init: function() 39 { 40 // Destroy existing layout events. 41 FLBuilderLayout._destroy(); 42 43 // Init CSS classes. 44 FLBuilderLayout._initClasses(); 45 46 // Init backgrounds. 47 FLBuilderLayout._initBackgrounds(); 48 49 // Only init if the builder isn't active. 50 if ( 0 === $('.fl-builder-edit').length ) { 51 52 // Init anchor links. 53 FLBuilderLayout._initAnchorLinks(); 54 55 // Init the browser hash. 56 FLBuilderLayout._initHash(); 57 58 // Init module animations. 59 FLBuilderLayout._initModuleAnimations(); 60 61 // Init forms. 62 FLBuilderLayout._initForms(); 63 } 64 }, 65 66 /** 67 * Public method for refreshing Wookmark or MosaicFlow galleries 68 * within an element. 69 * 70 * @since 1.7.4 71 * @method refreshGalleries 72 */ 73 refreshGalleries: function( element ) 74 { 75 var $element = 'undefined' == typeof element ? $( 'body' ) : $( element ), 76 mfContent = $element.find( '.fl-mosaicflow-content' ), 77 wmContent = $element.find( '.fl-gallery' ), 78 mfObject = null; 79 80 if ( mfContent ) { 81 82 mfObject = mfContent.data( 'mosaicflow' ); 83 84 if ( mfObject ) { 85 mfObject.columns = $( [] ); 86 mfObject.columnsHeights = []; 87 mfContent.data( 'mosaicflow', mfObject ); 88 mfContent.mosaicflow( 'refill' ); 89 } 90 } 91 if ( wmContent ) { 92 wmContent.trigger( 'refreshWookmark' ); 93 } 94 }, 95 96 /** 97 * Public method for refreshing Masonry within an element 98 * 99 * @since 1.8.1 100 * @method refreshGridLayout 101 */ 102 refreshGridLayout: function( element ) 103 { 104 var $element = 'undefined' == typeof element ? $( 'body' ) : $( element ), 105 msnryContent = $element.find('.masonry'); 106 107 if ( msnryContent.length ) { 108 msnryContent.masonry('layout'); 109 } 110 }, 111 112 /** 113 * Public method for reloading BxSlider within an element 114 * 115 * @since 1.8.1 116 * @method reloadSlider 117 */ 118 reloadSlider: function( element ) 119 { 120 var $element = 'undefined' == typeof element ? $( 'body' ) : $( element ), 121 bxContent = $element.find('.bx-viewport > div').eq(0), 122 bxObject = null; 123 124 if ( bxContent.length ) { 125 bxObject = bxContent.data( 'bxSlider'); 126 if ( bxObject ) { 127 bxObject.reloadSlider(); 128 } 129 } 130 }, 131 132 /** 133 * Public method for resizing WP audio player 134 * 135 * @since 1.8.2 136 * @method resizeAudio 137 */ 138 resizeAudio: function( element ) 139 { 140 var $element = 'undefined' == typeof element ? $( 'body' ) : $( element ), 141 audioPlayers = $element.find('.wp-audio-shortcode.mejs-audio'), 142 player = null, 143 mejsPlayer = null, 144 rail = null, 145 railWidth = 400; 146 147 if ( audioPlayers.length && typeof mejs !== 'undefined' ) { 148 audioPlayers.each(function(){ 149 player = $(this); 150 mejsPlayer = mejs.players[player.attr('id')]; 151 rail = player.find('.mejs-controls .mejs-time-rail'); 152 var innerMejs = player.find('.mejs-inner'), 153 total = player.find('.mejs-controls .mejs-time-total'); 154 155 if ( typeof mejsPlayer !== 'undefined' ) { 156 railWidth = Math.ceil(player.width() * 0.8); 157 158 if ( innerMejs.length ) { 159 160 rail.css('width', railWidth +'px!important'); 161 //total.width(rail.width() - 10); 162 163 mejsPlayer.options.autosizeProgress = true; 164 165 // webkit has trouble doing this without a delay 166 setTimeout(function () { 167 mejsPlayer.setControlsSize(); 168 }, 50); 169 170 player.find('.mejs-inner').css({ 171 visibility: 'visible', 172 height: 'inherit' 173 }); 174 } 175 } 176 }); 177 } 178 }, 179 180 /** 181 * Public method for preloading WP audio player when it's inside the hidden element 182 * 183 * @since 1.8.2 184 * @method preloadAudio 185 */ 186 preloadAudio: function(element) 187 { 188 var $element = 'undefined' == typeof element ? $( 'body' ) : $( element ), 189 contentWrap = $element.closest('.fl-accordion-item'), 190 audioPlayers = $element.find('.wp-audio-shortcode.mejs-audio'); 191 192 if ( ! contentWrap.hasClass('fl-accordion-item-active') && audioPlayers.find('.mejs-inner').length ) { 193 audioPlayers.find('.mejs-inner').css({ 194 visibility : 'hidden', 195 height: 0 196 }); 197 } 198 }, 199 200 /** 201 * Public method for resizing slideshow momdule within the tab 202 * 203 * @since 1.10.5 204 * @method resizeSlideshow 205 */ 206 resizeSlideshow: function(){ 207 if(typeof YUI !== 'undefined') { 208 YUI().use('node-event-simulate', function(Y) { 209 Y.one(window).simulate("resize"); 210 }); 211 } 212 }, 213 214 /** 215 * Unbinds builder layout events. 216 * 217 * @since 1.0 218 * @access private 219 * @method _destroy 220 */ 221 _destroy: function() 222 { 223 var win = $(window); 224 225 win.off('scroll.fl-bg-parallax'); 226 win.off('resize.fl-bg-video'); 227 }, 228 229 /** 230 * Checks to see if the current device has touch enabled. 231 * 232 * @since 1.0 233 * @access private 234 * @method _isTouch 235 * @return {Boolean} 236 */ 237 _isTouch: function() 238 { 239 if(('ontouchstart' in window) || (window.DocumentTouch && document instanceof DocumentTouch)) { 240 return true; 241 } 242 243 return false;
244 }, 245 246 /** 247 * Checks to see if the current device is mobile. 248 * 249 * @since 1.7 250 * @access private 251 * @method _isMobile 252 * @return {Boolean} 253 */ 254 _isMobile: function() 255 { 256 return /Mobile|Android|Silk\/|Kindle|BlackBerry|Opera Mini|Opera Mobi|webOS/i.test( navigator.userAgent ); 257 }, 258 259 /** 260 * Initializes builder body classes. 261 * 262 * @since 1.0 263 * @access private 264 * @method _initClasses 265 */ 266 _initClasses: function() 267 { 268 var body = $( 'body' ), 269 ua = navigator.userAgent; 270 271 // Add the builder body class. 272 if ( ! body.hasClass( 'archive' ) && $( '.fl-builder-content-primary' ).length > 0 ) { 273 body.addClass('fl-builder'); 274 } 275 276 // Add the builder touch body class. 277 if(FLBuilderLayout._isTouch()) { 278 body.addClass('fl-builder-touch'); 279 } 280 281 // Add the builder mobile body class. 282 if(FLBuilderLayout._isMobile()) { 283 body.addClass('fl-builder-mobile'); 284 } 285 286 // IE11 body class. 287 if ( ua.indexOf( 'Trident/7.0' ) > -1 && ua.indexOf( 'rv:11.0' ) > -1 ) { 288 body.addClass( 'fl-builder-ie-11' ); 289 } 290 }, 291 292 /** 293 * Initializes builder node backgrounds that require 294 * additional JavaScript logic such as parallax. 295 * 296 * @since 1.1.4 297 * @access private
298 * @method _initBackgrounds 299 */ 300 _initBackgrounds: function() 301 { 302 var win = $(window); 303 304 // Init parallax backgrounds. 305 if($('.fl-row-bg-parallax').length > 0 && !FLBuilderLayout._isMobile()) { 306 FLBuilderLayout._scrollParallaxBackgrounds(); 307 FLBuilderLayout._initParallaxBackgrounds(); 308 win.on('scroll.fl-bg-parallax', FLBuilderLayout._scrollParallaxBackgrounds); 309 } 310 311 // Init video backgrounds. 312 if($('.fl-bg-video').length > 0) { 313 FLBuilderLayout._initBgVideos(); 314 FLBuilderLayout._resizeBgVideos(); 315 win.on('resize.fl-bg-video', FLBuilderLayout._resizeBgVideos); 316 } 317 }, 318 319 /** 320 * Initializes all parallax backgrounds in a layout. 321 * 322 * @since 1.1.4 323 * @access private 324 * @method _initParallaxBackgrounds 325 */ 326 _initParallaxBackgrounds: function() 327 { 328 $('.fl-row-bg-parallax').each(FLBuilderLayout._initParallaxBackground); 329 }, 330 331 /** 332 * Initializes a single parallax background. 333 * 334 * @since 1.1.4 335 * @access private 336 * @method _initParallaxBackgrounds 337 */ 338 _initParallaxBackground: function() 339 { 340 var row = $(this), 341 content = row.find('> .fl-row-content-wrap'), 342 src = row.data('parallax-image'), 343 loaded = row.data('parallax-loaded'), 344 img = new Image(); 345 346 if(loaded) { 347 return; 348 } 349 else if(typeof src != 'undefined') { 350 351 $(img).on('load', function() { 352 content.css('background-image', 'url(' + src + ')'); 353 row.data('parallax-loaded', true); 354 }); 355 356 img.src = src; 357 } 358 }, 359 360 /** 361 * Fires when the window is scrolled to adjust 362 * parallax backgrounds. 363 * 364 * @since 1.1.4 365 * @access private 366 * @method _scrollParallaxBackgrounds 367 */ 368 _scrollParallaxBackgrounds: function() 369 { 370 $('.fl-row-bg-parallax').each(FLBuilderLayout._scrollParallaxBackground); 371 }, 372 373 /** 374 * Fires when the window is scrolled to adjust 375 * a single parallax background. 376 * 377 * @since 1.1.4 378 * @access private 379 * @method _scrollParallaxBackground 380 */ 381 _scrollParallaxBackground: function() 382 { 383 var win = $(window), 384 row = $(this), 385 content = row.find('> .fl-row-content-wrap'), 386 speed = row.data('parallax-speed'), 387 offset = content.offset(), 388 yPos = -((win.scrollTop() - offset.top) / speed); 389 390 content.css('background-position', 'center ' + yPos + 'px'); 391 }, 392 393 /** 394 * Initializes all video backgrounds. 395 * 396 * @since 1.6.3.3 397 * @access private 398 * @method _initBgVideos 399 */ 400 _initBgVideos: function() 401 { 402 $('.fl-bg-video').each(FLBuilderLayout._initBgVideo); 403 }, 404 405 /** 406 * Initializes a video background. 407 * 408 * @since 1.6.3.3 409 * @access private 410 * @method _initBgVideo 411 */ 412 _initBgVideo: function() 413 { 414 var wrap = $( this ), 415 width = wrap.data( 'width' ), 416 height = wrap.data( 'height' ), 417 mp4 = wrap.data( 'mp4' ), 418 youtube = wrap.data( 'youtube'), 419 vimeo = wrap.data( 'vimeo'), 420 mp4Type = wrap.data( 'mp4-type' ), 421 webm = wrap.data( 'webm' ), 422 webmType = wrap.data( 'webm-type' ), 423 fallback = wrap.data( 'fallback' ), 424 loaded = wrap.data( 'loaded' ), 425 fallbackTag = '', 426 videoTag = null, 427 mp4Tag = null, 428 webmTag = null; 429 430 // Return if the video has been loaded for this row. 431 if ( loaded ) { 432 return; 433 } 434 435 videoTag = $( '<video autoplay loop muted playsinline></video>' ); 436 437 /** 438 * Add poster image (fallback image) 439 */ 440 if( 'undefined' != typeof fallback && '' != fallback ) { 441 videoTag.attr( 'poster', 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7' ) 442 videoTag.css( 'background', 'transparent url("' + fallback + '") no-repeat center center' ) 443 videoTag.css( 'background-size', 'cover' ) 444 videoTag.css( 'height', '100%' ) 445 } 446 447 // MP4 Source Tag 448 if ( 'undefined' != typeof mp4 && '' != mp4 ) { 449 450 mp4Tag = $( '<source />' ); 451 mp4Tag.attr( 'src', mp4 ); 452 mp4Tag.attr( 'type', mp4Type ); 453 454 videoTag.append( mp4Tag ); 455 } 456 // WebM Source Tag 457 if ( 'undefined' != typeof webm && '' != webm ) { 458 459 webmTag = $( '<source />' ); 460 webmTag.attr( 'src', webm ); 461 webmTag.attr( 'type', webmType ); 462 463 videoTag.append( webmTag ); 464 } 465 466 // Check what video player we are going to load in a row 467 if ( 'undefined' != typeof youtube && ! FLBuilderLayout._isMobile() ) { 468 FLBuilderLayout._initYoutubeBgVideo.apply( this ); 469 } 470 else if ( 'undefined' != typeof vimeo && ! FLBuilderLayout._isMobile() ) { 471 FLBuilderLayout._initVimeoBgVideo.apply( this ); 472 } 473 else { 474 wrap.append( videoTag ); 475 } 476 477 // Mark this video as loaded. 478 wrap.data('loaded', true); 479 }, 480 481 /** 482 * Initializes Youtube video background 483 * 484 * @since 1.9 485 * @access private 486 * @method _initYoutubeBgVideo 487 */ 488 _initYoutubeBgVideo: function() 489 { 490 var playerWrap = $(this), 491 videoId = playerWrap.data('video-id'), 492 videoPlayer = playerWrap.find('.fl-bg-video-player'), 493 enableAudio = playerWrap.data('enable-audio'), 494 startTime = 'undefined' !== typeof playerWrap.data('t') ? playerWrap.data('t') : 0, 495 loop = 'undefined' !== typeof playerWrap.data('loop') ? playerWrap.data('loop') : 1, 496 player; 497 498 if ( videoId ) { 499 FLBuilderLayout._onYoutubeApiReady( function( YT ) { 500 setTimeout( function() { 501 502 player = new YT.Player( videoPlayer[0], { 503 videoId: videoId, 504 events: { 505 onReady: function(event) { 506 if ( "no" === enableAudio ) { 507 event.target.mute(); 508 } 509 else if ("yes" === enableAudio && event.target.isMuted ) { 510 event.target.unMute(); 511 } 512 513 // Store an instance to a parent 514 playerWrap.data('YTPlayer', player); 515 FLBuilderLayout._resizeYoutubeBgVideo.apply(playerWrap); 516 517 event.target.playVideo(); 518 }, 519 onStateChange: function( event ) { 520 if ( event.data === YT.PlayerState.ENDED && 1 === loop ) { 521 player.seekTo( startTime ); 522 } 523 }, 524 onError: function(event) { 525 console.info('YT Error: ' + event.data) 526 FLBuilderLayout._onErrorYoutubeVimeo(playerWrap) 527 } 528 }, 529 playerVars: { 530 controls: 0, 531 showinfo: 0, 532 rel : 0, 533 start: startTime, 534 loop: loop, 535 playlist: 1 === loop ? videoId : '', 536 } 537 } ); 538 }, 1 ); 539 } ); 540 } 541 }, 542 543 /** 544 * On youtube or vimeo error show the fallback image if available. 545 * @since 2.0.7 546 */ 547 _onErrorYoutubeVimeo: function(playerWrap) { 548 549 fallback = playerWrap.data('fallback') || false 550 if( ! fallback ) { 551 return false;
552 } 553 playerWrap.find('iframe').remove() 554 fallbackTag = $( '<div></div>' ); 555 fallbackTag.addClass( 'fl-bg-video-fallback' ); 556 fallbackTag.css( 'background-image', 'url(' + playerWrap.data('fallback') + ')' ); 557 playerWrap.append( fallbackTag ); 558 }, 559 560 /** 561 * Check if Youtube API has been downloaded 562 * 563 * @since 1.9 564 * @access private 565 * @method _onYoutubeApiReady 566 * @param {Function} callback Method to call when YT API has been loaded 567 */ 568 _onYoutubeApiReady: function( callback ) { 569 if ( window.YT && YT.loaded ) { 570 callback( YT ); 571 } else { 572 // If not ready check again by timeout.. 573 setTimeout( function() { 574 FLBuilderLayout._onYoutubeApiReady( callback ); 575 }, 350 ); 576 } 577 }, 578 579 /** 580 * Initializes Vimeo video background 581 * 582 * @since 1.9 583 * @access private 584 * @method _initVimeoBgVideo 585 */ 586 _initVimeoBgVideo: function() 587 { 588 var playerWrap = $(this), 589 videoId = playerWrap.data('video-id'), 590 videoPlayer = playerWrap.find('.fl-bg-video-player'), 591 enableAudio = playerWrap.data('enable-audio'), 592 player, 593 width = playerWrap.outerWidth(); 594 595 if ( typeof Vimeo !== 'undefined' && videoId ) { 596 player = new Vimeo.Player(videoPlayer[0], { 597 id: videoId, 598 loop: true, 599 title: false, 600 portrait: false, 601 background: true, 602 autopause: false 603 }); 604 605 playerWrap.data('VMPlayer', player); 606 if ( "no" === enableAudio ) { 607 player.setVolume(0); 608 } 609 else if ("yes" === enableAudio ) { 610 player.setVolume(1); 611 } 612 613 player.play().catch(function(error) { 614 FLBuilderLayout._onErrorYoutubeVimeo(playerWrap) 615 }); 616 } 617 }, 618 619 /** 620 * Fires when there is an error loading a video 621 * background source and shows the fallback. 622 * 623 * @since 1.6.3.3 624 * @access private 625 * @method _videoBgSourceError 626 * @param {Object} e An event object 627 * @deprecated 2.0.3 628 */ 629 _videoBgSourceError: function( e ) 630 { 631 var source = $( e.target ), 632 wrap = source.closest( '.fl-bg-video' ), 633 vid = wrap.find( 'video' ), 634 fallback = wrap.data( 'fallback' ), 635 fallbackTag = ''; 636 source.remove(); 637 638 if ( vid.find( 'source' ).length ) { 639 // Don't show the fallback if we still have other sources to check. 640 return; 641 } else if ( '' !== fallback ) { 642 fallbackTag = $( '<div></div>' ); 643 fallbackTag.addClass( 'fl-bg-video-fallback' ); 644 fallbackTag.css( 'background-image', 'url(' + fallback + ')' ); 645 wrap.append( fallbackTag ); 646 vid.remove(); 647 } 648 }, 649 650 /** 651 * Fires when the window is resized to resize 652 * all video backgrounds. 653 * 654 * @since 1.1.4 655 * @access private 656 * @method _resizeBgVideos 657 */ 658 _resizeBgVideos: function() 659 { 660 $('.fl-bg-video').each( function() { 661 662 FLBuilderLayout._resizeBgVideo.apply( this ); 663 664 if ( $( this ).parent().find( 'img' ).length > 0 ) { 665 $( this ).parent().imagesLoaded( $.proxy( FLBuilderLayout._resizeBgVideo, this ) ); 666 } 667 } ); 668 }, 669 670 /** 671 * Fires when the window is resized to resize 672 * a single video background. 673 * 674 * @since 1.1.4 675 * @access private 676 * @method _resizeBgVideo 677 */ 678 _resizeBgVideo: function() 679 { 680 if ( 0 === $( this ).find( 'video' ).length && 0 === $( this ).find( 'iframe' ).length ) { 681 return; 682 } 683 684 var wrap = $(this), 685 wrapHeight = wrap.outerHeight(), 686 wrapWidth = wrap.outerWidth(), 687 vid = wrap.find('video'), 688 vidHeight = wrap.data('height'), 689 vidWidth = wrap.data('width'), 690 newWidth = wrapWidth, 691 newHeight = Math.round(vidHeight * wrapWidth/vidWidth), 692 newLeft = 0, 693 newTop = 0, 694 iframe = wrap.find('iframe'); 695 696 if ( vid.length ) { 697 if(vidHeight === '' || typeof vidHeight === 'undefined' || vidWidth === '' || typeof vidWidth === 'undefined') { 698 vid.css({ 699 'left' : '0px', 700 'top' : '0px', 701 'width' : newWidth + 'px' 702 }); 703 704 // Try to set the actual video dimension on 'loadedmetadata' when using URL as video source 705 vid.on('loadedmetadata', FLBuilderLayout._resizeOnLoadedMeta); 706 707 } 708 else { 709 710 if(newHeight < wrapHeight) { 711 newHeight = wrapHeight; 712 newWidth = Math.round(vidWidth * wrapHeight/vidHeight); 713 newLeft = -((newWidth - wrapWidth)/2); 714 } 715 else { 716 newTop = -((newHeight - wrapHeight)/2); 717 } 718 719 vid.css({ 720 'left' : newLeft + 'px', 721 'top' : newTop + 'px', 722 'height' : newHeight + 'px', 723 'width' : newWidth + 'px' 724 }); 725 } 726 } 727 else if ( iframe.length ) { 728 729 // Resize Youtube video player within iframe tag 730 if ( typeof wrap.data('youtube') !== 'undefined' ) { 731 FLBuilderLayout._resizeYoutubeBgVideo.apply(this); 732 } 733 } 734 }, 735 736 /** 737 * Fires when video meta has been loaded. 738 * This will be Triggered when width/height attributes were not specified during video background resizing. 739 * 740 * @since 1.8.5 741 * @access private 742 * @method _resizeOnLoadedMeta 743 */ 744 _resizeOnLoadedMeta: function(){ 745 var video = $(this), 746 wrapHeight = video.parent().outerHeight(), 747 wrapWidth = video.parent().outerWidth(), 748 vidWidth = video[0].videoWidth, 749 vidHeight = video[0].videoHeight, 750 newHeight = Math.round(vidHeight * wrapWidth/vidWidth), 751 newWidth = wrapWidth, 752 newLeft = 0, 753 newTop = 0; 754 755 if(newHeight < wrapHeight) { 756 newHeight = wrapHeight; 757 newWidth = Math.round(vidWidth * wrapHeight/vidHeight); 758 newLeft = -((newWidth - wrapWidth)/2); 759 } 760 else { 761 newTop = -((newHeight - wrapHeight)/2); 762 } 763 764 video.parent().data('width', vidWidth); 765 video.parent().data('height', vidHeight); 766 767 video.css({ 768 'left' : newLeft + 'px', 769 'top' : newTop + 'px', 770 'width' : newWidth + 'px', 771 'height' : newHeight + 'px' 772 }); 773 }, 774 775 /** 776 * Fires when the window is resized to resize 777 * a single Youtube video background. 778 * 779 * @since 1.9 780 * @access private 781 * @method _resizeYoutubeBgVideo 782 */ 783 _resizeYoutubeBgVideo: function() 784 { 785 var wrap = $(this), 786 wrapWidth = wrap.outerWidth(), 787 wrapHeight = wrap.outerHeight(), 788 player = wrap.data('YTPlayer'), 789 video = player ? player.getIframe() : null, 790 aspectRatioSetting = '16:9', // Medium 791 aspectRatioArray = aspectRatioSetting.split( ':' ),
792 aspectRatio = aspectRatioArray[0] / aspectRatioArray[1], 793 ratioWidth = wrapWidth / aspectRatio, 794 ratioHeight = wrapHeight * aspectRatio, 795 isWidthFixed = wrapWidth / wrapHeight > aspectRatio, 796 width = isWidthFixed ? wrapWidth : ratioHeight, 797 height = isWidthFixed ? ratioWidth : wrapHeight; 798 799 if ( video ) { 800 $(video).width( width ).height( height ); 801 } 802 }, 803 804 /** 805 * Initializes module animations. 806 * 807 * @since 1.1.9 808 * @access private 809 * @method _initModuleAnimations 810 */ 811 _initModuleAnimations: function() 812 { 813 if(typeof jQuery.fn.waypoint !== 'undefined' && !FLBuilderLayout._isMobile()) { 814 $('.fl-animation').each( function() { 815 var node = $( this ), 816 nodeTop = node.offset().top, 817 winHeight = $( window ).height(), 818 bodyHeight = $( 'body' ).height(), 819 waypoint = FLBuilderLayoutConfig.waypoint, 820 offset = '80%'; 821 822 if ( typeof waypoint.offset !== undefined ) { 823 offset = FLBuilderLayoutConfig.waypoint.offset + '%'; 824 } 825 826 if ( bodyHeight - nodeTop < winHeight * 0.2 ) { 827 offset = '100%'; 828 } 829 830 node.waypoint({ 831 offset: offset, 832 handler: FLBuilderLayout._doModuleAnimation 833 }); 834 } ); 835 } 836 }, 837 838 /** 839 * Runs a module animation. 840 * 841 * @since 1.1.9 842 * @access private 843 * @method _doModuleAnimation 844 */ 845 _doModuleAnimation: function() 846 { 847 var module = 'undefined' == typeof this.element ? $(this) : $(this.element), 848 delay = parseFloat(module.data('animation-delay')); 849 850 if(!isNaN(delay) && delay > 0) { 851 setTimeout(function(){ 852 module.addClass('fl-animated'); 853 }, delay * 1000); 854 } 855 else { 856 module.addClass('fl-animated'); 857 } 858 }, 859 860 /** 861 * Opens a tab or accordion item if the browser hash is set 862 * to the ID of one on the page. 863 * 864 * @since 1.6.0 865 * @access private 866 * @method _initHash 867 */ 868 _initHash: function() 869 { 870 var hash = window.location.hash.replace( '#', '' ).split( '/' ).shift(), 871 element = null, 872 tabs = null, 873 responsiveLabel = null, 874 tabIndex = null, 875 label = null; 876 877 if ( '' !== hash ) { 878 879 try { 880 881 element = $( '#' + hash ); 882 883 if ( element.length > 0 ) { 884 885 if ( element.hasClass( 'fl-accordion-item' ) ) { 886 setTimeout( function() { 887 element.find( '.fl-accordion-button' ).trigger( 'click' ); 888 }, 100 ); 889 } 890 if ( element.hasClass( 'fl-tabs-panel' ) ) { 891 892 setTimeout( function() { 893 894 tabs = element.closest( '.fl-tabs' ); 895 responsiveLabel = element.find( '.fl-tabs-panel-label' ); 896 tabIndex = responsiveLabel.data( 'index' ); 897 label = tabs.find( '.fl-tabs-labels .fl-tabs-label[data-index=' + tabIndex + ']' ); 898 899 if ( responsiveLabel.is( ':visible' ) ) { 900 responsiveLabel.trigger( 'click' ); 901 } 902 else { 903 label[0].click(); 904 FLBuilderLayout._scrollToElement( element ); 905 } 906 907 }, 100 ); 908 } 909 } 910 } 911 catch( e ) {} 912 } 913 }, 914 915 /** 916 * Initializes all anchor links on the page for smooth scrolling. 917 * 918 * @since 1.4.9 919 * @access private 920 * @method _initAnchorLinks 921 */ 922 _initAnchorLinks: function() 923 { 924 $( 'a' ).each( FLBuilderLayout._initAnchorLink ); 925 }, 926 927 /** 928 * Initializes a single anchor link for smooth scrolling. 929 * 930 * @since 1.4.9 931 * @access private 932 * @method _initAnchorLink 933 */ 934 _initAnchorLink: function() 935 { 936 var link = $( this ), 937 href = link.attr( 'href' ), 938 loc = window.location, 939 id = null, 940 element = null; 941 if ( 'undefined' != typeof href && href.indexOf( '#' ) > -1 && link.closest('svg').length < 1 ) { 942 943 if ( loc.pathname.replace( /^\//, '' ) == this.pathname.replace( /^\//, '' ) && loc.hostname == this.hostname ) { 944 945 try { 946 947 id = href.split( '#' ).pop(); 948 // If there is no ID then we have nowhere to look 949 // Fixes a quirk in jQuery and FireFox 950 if( ! id ) { 951 return; 952 } 953 element = $( '#' + id ); 954 955 if ( element.length > 0 ) { 956 if ( link.hasClass( 'fl-scroll-link' ) || element.hasClass( 'fl-row' ) || element.hasClass( 'fl-col' ) || element.hasClass( 'fl-module' ) ) { 957 $( link ).on( 'click', FLBuilderLayout._scrollToElementOnLinkClick ); 958 } 959 if ( element.hasClass( 'fl-accordion-item' ) ) { 960 $( link ).on( 'click', FLBuilderLayout._scrollToAccordionOnLinkClick ); 961 } 962 if ( element.hasClass( 'fl-tabs-panel' ) ) { 963 $( link ).on( 'click', FLBuilderLayout._scrollToTabOnLinkClick ); 964 } 965 } 966 } 967 catch( e ) {} 968 } 969 } 970 }, 971 972 /** 973 * Scrolls to an element when an anchor link is clicked. 974 * 975 * @since 1.4.9 976 * @access private 977 * @method _scrollToElementOnLinkClick 978 * @param {Object} e An event object. 979 * @param {Function} callback A function to call when the scroll is complete. 980 */ 981 _scrollToElementOnLinkClick: function( e, callback ) 982 { 983 var element = $( '#' + $( this ).attr( 'href' ).split( '#' ).pop() ); 984 985 FLBuilderLayout._scrollToElement( element, callback ); 986 987 e.preventDefault(); 988 }, 989 990 /** 991 * Scrolls to an element. 992 * 993 * @since 1.6.4.5 994 * @access private 995 * @method _scrollToElement 996 * @param {Object} element The element to scroll to. 997 * @param {Function} callback A function to call when the scroll is complete. 998 */ 999 _scrollToElement: function( element, callback ) 1000 { 1001 var config = FLBuilderLayoutConfig.anchorLinkAnimations, 1002 dest = 0, 1003 win = $( window ), 1004 doc = $( document ); 1005 1006 if ( element.length > 0 ) { 1007 1008 if ( element.offset().top > doc.height() - win.height() ) { 1009 dest = doc.height() - win.height(); 1010 } 1011 else { 1012 dest = element.offset().top - config.offset; 1013 } 1014 1015 $( 'html, body' ).animate( { scrollTop: dest }, config.duration, config.easing, function() { 1016 1017 if ( 'undefined' != typeof callback ) { 1018 callback(); 1019 } 1020 1021 if ( undefined != element.attr( 'id' ) ) { 1022 1023 if ( history.pushState ) { 1024 history.pushState( null, null, '#' + element.attr( 'id' ) ); 1025 } 1026 else { 1027 window.location.hash = element.attr( 'id' ); 1028 } 1029 } 1030 } ); 1031 } 1032 }, 1033 1034 /** 1035 * Scrolls to an accordion item when a link is clicked. 1036 * 1037 * @since 1.5.9 1038 * @access private 1039 * @method _scrollToAccordionOnLinkClick 1040 * @param {Object} e An event object. 1041 */ 1042 _scrollToAccordionOnLinkClick: function( e ) 1043 { 1044 var element = $( '#' + $( this ).attr( 'href' ).split( '#' ).pop() ); 1045 1046 if ( element.length > 0 ) { 1047 1048 var callback = function() { 1049 if ( element ) { 1050 element.find( '.fl-accordion-button' ).trigger( 'click' ); 1051 element = false;
1052 } 1053 }; 1054 1055 FLBuilderLayout._scrollToElementOnLinkClick.call( this, e, callback ); 1056 } 1057 }, 1058 1059 /** 1060 * Scrolls to a tab panel when a link is clicked. 1061 * 1062 * @since 1.5.9 1063 * @access private 1064 * @method _scrollToTabOnLinkClick 1065 * @param {Object} e An event object. 1066 */ 1067 _scrollToTabOnLinkClick: function( e ) 1068 { 1069 var element = $( '#' + $( this ).attr( 'href' ).split( '#' ).pop() ), 1070 tabs = null, 1071 label = null, 1072 responsiveLabel = null; 1073 1074 if ( element.length > 0 ) { 1075 1076 tabs = element.closest( '.fl-tabs' ); 1077 responsiveLabel = element.find( '.fl-tabs-panel-label' ); 1078 tabIndex = responsiveLabel.data( 'index' ); 1079 label = tabs.find( '.fl-tabs-labels .fl-tabs-label[data-index=' + tabIndex + ']' ); 1080 1081 if ( responsiveLabel.is( ':visible' ) ) { 1082 1083 var callback = function() { 1084 if ( element ) { 1085 responsiveLabel.trigger( 'click' ); 1086 element = false; 1087 } 1088 }; 1089 1090 FLBuilderLayout._scrollToElementOnLinkClick.call( this, e, callback ); 1091 } 1092 else { 1093 label[0].click(); 1094 FLBuilderLayout._scrollToElement( element ); 1095 } 1096 1097 e.preventDefault(); 1098 } 1099 }, 1100 1101 /** 1102 * Initializes all builder forms on a page. 1103 * 1104 * @since 1.5.4 1105 * @access private 1106 * @method _initForms 1107 */ 1108 _initForms: function() 1109 { 1110 if ( ! FLBuilderLayout._hasPlaceholderSupport ) { 1111 $( '.fl-form-field input' ).each( FLBuilderLayout._initFormFieldPlaceholderFallback ); 1112 } 1113 1114 $( '.fl-form-field input' ).on( 'focus', FLBuilderLayout._clearFormFieldError ); 1115 }, 1116 1117 /** 1118 * Checks to see if the current device has HTML5 1119 * placeholder support. 1120 * 1121 * @since 1.5.4 1122 * @access private 1123 * @method _hasPlaceholderSupport 1124 * @return {Boolean} 1125 */ 1126 _hasPlaceholderSupport: function() 1127 { 1128 var input = document.createElement( 'input' ); 1129 1130 return 'undefined' != input.placeholder; 1131 }, 1132 1133 /** 1134 * Initializes the fallback for when placeholders aren't supported. 1135 * 1136 * @since 1.5.4 1137 * @access private 1138 * @method _initFormFieldPlaceholderFallback 1139 */ 1140 _initFormFieldPlaceholderFallback: function() 1141 { 1142 var field = $( this ), 1143 val = field.val(), 1144 placeholder = field.attr( 'placeholder' ); 1145 1146 if ( 'undefined' != placeholder && '' === val ) { 1147 field.val( placeholder ); 1148 field.on( 'focus', FLBuilderLayout._hideFormFieldPlaceholderFallback ); 1149 field.on( 'blur', FLBuilderLayout._showFormFieldPlaceholderFallback ); 1150 } 1151 }, 1152 1153 /** 1154 * Hides a fallback placeholder on focus. 1155 * 1156 * @since 1.5.4 1157 * @access private 1158 * @method _hideFormFieldPlaceholderFallback 1159 */ 1160 _hideFormFieldPlaceholderFallback: function() 1161 { 1162 var field = $( this ), 1163 val = field.val(), 1164 placeholder = field.attr( 'placeholder' ); 1165 1166 if ( val == placeholder ) { 1167 field.val( '' ); 1168 } 1169 }, 1170 1171 /** 1172 * Shows a fallback placeholder on blur. 1173 * 1174 * @since 1.5.4 1175 * @access private 1176 * @method _showFormFieldPlaceholderFallback 1177 */ 1178 _showFormFieldPlaceholderFallback: function() 1179 { 1180 var field = $( this ), 1181 val = field.val(), 1182 placeholder = field.attr( 'placeholder' ); 1183 1184 if ( '' === val ) { 1185 field.val( placeholder ); 1186 } 1187 }, 1188 1189 /** 1190 * Clears a form field error message. 1191 * 1192 * @since 1.5.4 1193 * @access private 1194 * @method _clearFormFieldError 1195 */ 1196 _clearFormFieldError: function() 1197 { 1198 var field = $( this ); 1199 1200 field.removeClass( 'fl-form-error' ); 1201 field.siblings( '.fl-form-error-message' ).hide(); 1202 } 1203 }; 1204 1205 /* Initializes the builder layout. */ 1206 $(function(){ 1207 FLBuilderLayout.init(); 1208 }); 1209 1210})(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.