1/* Debounce 2--------------------------------------------------------------------------------------------- */ 3window.debounce = function(func, wait, immediate) { 4 var timeout; 5 return function() { 6 var context = this, args = arguments; 7 var later = function() { 8 timeout = null; 9 if (!immediate) func.apply(context, args); 10 }; 11 var callNow = immediate && !timeout; 12 clearTimeout(timeout); 13 timeout = setTimeout(later, wait); 14 if (callNow) func.apply(context, args); 15 }; 16}; 17 18jQuery( document ).ready(function() { 19 20 if ( ! jQuery( '.behavior-thumbnail-youtube-player' ).length ) { 21 return; 22 } 23 if ( ! jQuery( '.thumbnail-youtube-player' ).length ) { 24 return; 25 } 26 27 window.onYouTubeIframeAPIReady = function onYouTubeIframeAPIReady() { 28 29 jQuery( '.thumbnail-youtube-player' ).each(function() { 30 31 var player, 32 self = jQuery( this ), 33 youtubeid = self.data( 'youtubeid' ), 34 placement = self.find( '.thumbnail-inner' ).find( '.yt-placement' ) 35 36 if ( ! placement.length ) { 37 self.find( '.thumbnail-inner' ).prepend( '<div class="yt-placement" />' ) 38 placement = self.find( '.thumbnail-inner' ).find( '.yt-placement' ) 39 } 40 41 if ( ! placement.attr( 'id' ) ) { 42 placement.attr( 'id', 'yt-' + Date.now() ) 43 } 44 45 var placement_id = placement.attr( 'id' ) 46 47 player = new YT.Player( placement_id, { 48 videoId: youtubeid, 49 height: 720, 50 width: 1280, 51 events: { 52 onReady: onPlayerReady, 53 onStateChange: onPlayerStateChange 54 } 55 }); 56 57 function onPlayerReady(event) { 58 59 self.data( 'player', player ) 60 self.on( 'click', function(e) { 61 event.target.setVolume(0); 62 event.target.playVideo(); 63 self.addClass( 'played' ); 64 setTimeout( function(){ 65 event.target.setVolume(3); 66 }, 300 ) 67 }) 68 self.find( '.thumbnail-inner' ).fitVids() 69 70 } 71 function onPlayerStateChange(event) {} 72 73 }) 74 75 } 76 77}); 78 79( function( $ ) { 80 81 /** 82 * Youtube API load for video playing 83 */ 84 $( window ).on( 'elementor/frontend/init', function() { 85 86 if ( ! jQuery( '.behavior-thumbnail-youtube-player' ).length ) { 87 return; 88 } 89 if ( ! jQuery( '.thumbnail-youtube-player' ).length ) { 90 return; 91 } 92 93 // only load when we have player button available 94 var tag = document.createElement( 'script' ); 95 tag.id = 'iframe-demo'; 96 tag.src = 'https://www.youtube.com/iframe_api'; 97 var firstScriptTag = document.getElementsByTagName('script')[0]; 98 firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); 99 100 }) 101 102 /** 103 * BUTTON BEHAVIOUR 104 */ 105 $( window ).on( 'elementor/frontend/init', function() { 106 107 elementorFrontend.hooks.addAction( 'frontend/element_ready/fox_btn.default', function( $scope, $ ) { 108 109 $( document ).on( 'click', '.btn-popup', function( e ) { 110 e.preventDefault() 111 112 var self = $( this ), 113 popup_selector = self.data( 'popup' ) 114 115 if ( ! $( popup_selector ).length ) { 116 return 117 } 118 119 $( 'html' ).addClass( 'openning-popup' ) 120 $( popup_selector ).addClass( 'showing' ) 121 122 }); 123 124 $( document ).on( 'click', '.el-popup-overlay', function( e ) { 125 e.preventDefault() 126 127 var self = $( this ), 128 the_popup = self.prev( '.el-popup' ) 129 130 if ( ! $( the_popup ).length ) { 131 return 132 } 133 134 $( 'html' ).removeClass( 'openning-popup' ) 135 the_popup.removeClass( 'showing' ) 136 137 }); 138 139 $( document ).on( 'click', '.popup-close', function( e ) { 140 e.preventDefault() 141 142 var self = $( this ), 143 the_popup = self.closest( '.el-popup' ) 144 145 if ( ! $( the_popup ).length ) { 146 return 147 } 148 149 $( 'html' ).removeClass( 'openning-popup' ) 150 the_popup.removeClass( 'showing' ) 151 152 }); 153 154 // close the form by escape 155 // since 1.7.3 156 $( document ).on( 'keydown', function( e ) { 157 // ESCAPE key pressed 158 if (e.keyCode == 27) { 159 $( 'html' ).removeClass( 'openning-popup' ) 160 $( '.el-popup' ).removeClass( 'showing' ) // close all 161 } 162 }); 163 164 }); 165 166 /** 167 * search form, since 1.7.3 168 */ 169 elementorFrontend.hooks.addAction( 'frontend/element_ready/fox_search.default', function( $scope, $ ) { 170 171 $( document ).on( 'click', '.form-showup-click .search-hit-btn', function( e ) { 172 e.preventDefault(); 173 var form_click = $( this ).closest( '.form-showup-click' ) 174 form_click.addClass( 'showing_form' ) 175 }) 176 177 // close the form 178 $( document ).on( 'click', function( e ) { 179 if ( ! $( e.target ).is( '.form-showup-click' ) && ! $( e.target ).closest( '.form-showup-click' ).length ) { 180 $( '.form-showup-click' ).removeClass( 'showing_form' ) 181 } 182 }); 183 184 // close the form by escape 185 $( document ).on( 'keydown', function( e ) { 186 // ESCAPE key pressed 187 if (e.keyCode == 27) { 188 $( '.form-showup-click' ).removeClass( 'showing_form' ) 189 } 190 }); 191 192 }); 193 194 }); 195 196 /** 197 * POST SLIDER 198 */ 199 $( window ).on( 'elementor/frontend/init', function() { 200 201 elementorFrontend.hooks.addAction( 'frontend/element_ready/post-slider.default', function( $scope, $ ) { 202 203 if ( ! $().flexslider ) return; 204 if ( ! $().imagesLoaded ) return; 205 206 $( '.fox-flexslider.blog-slider' ).each( function() { 207 208 var $this = $( this ), 209 defaultOptions = { 210 animation: 'fade', 211 smoothHeight : false, 212 animationSpeed : 500, 213 slideshowSpeed : 5000, 214 directionNav : true, 215 slideshow : true, 216 controlNav : false, 217 pauseOnHover: true, 218 219 prevText : '<i class="fa fa-angle-left"></i>', 220 nextText : '<i class="fa fa-angle-right"></i>', 221 222 start : function( slider ) { 223 $this.addClass('loaded');
224 slider.find( 'img' ).trigger( 'flexslider_complete' ); 225 } 226 }, 227 args = $( this ).data( 'options' ), 228 options = $.extend( defaultOptions, args ); 229 230 $this.imagesLoaded( function() { 231 $this.addClass( 'loaded' ) 232 $this.find( '.flexslider' ).flexslider( options ); 233 }); 234 235 }); 236 237 }); 238 239 }); 240 241 var masonry_behavior = function( $scope, $ ) { 242 243 if ( ! $().masonry ) return; 244 if ( ! $().imagesLoaded ) return; 245 246 var run = debounce( function() { 247 248 $( '.fox-masonry' ).each(function() { 249 250 var grid = $( this ); 251 252 grid.imagesLoaded(function() { 253 254 var itemSelector = '.fox-masonry-item'; 255 if ( grid.hasClass( 'blog-newspaper' ) ) { 256 itemSelector = '.post-newspaper'; 257 } 258 259 grid 260 .addClass( 'loaded' ) 261 .masonry({ 262 itemSelector: itemSelector, 263 columnWidth: '.grid-sizer', 264 percentPosition: true, 265 }) 266 .find( itemSelector ).each(function() { 267 268 var item = $( this ); 269 270 item.bind('inview', function(event, isInView, visiblePartX, visiblePartY) { 271 if (isInView) { 272 item.addClass( 'inview' ); 273 } // inview 274 }); // bind inview 275 276 }); 277 278 }); 279 280 }); 281 282 }, 100 ); 283 284 run(); 285 $( window ).resize( function(){ run() }); 286 287 } 288 289 /** 290 * POST MASONRY 291 */ 292 $( window ).on( 'elementor/frontend/init', function() { 293 294 elementorFrontend.hooks.addAction( 'frontend/element_ready/post-masonry.default', masonry_behavior ); 295 elementorFrontend.hooks.addAction( 'frontend/element_ready/post-newspaper.default', masonry_behavior ); 296 297 }); 298 299 /** 300 * HORIZONTAL NAV 301 */ 302 var hnav_behavior = function() { 303 var navSelector = $( '.el-nav.hnav > .nav-inner' ); 304 305 // APPENDING a caret 306 navSelector.each(function() { 307 $( this ).find( '> ul.menu > li > ul' ).append( '<span class="caret" />' ); // since 4.0 308 }); 309 310 // MEGA 311 var setup_mega = function() { 312 313 var outerContainer = navSelector.closest( '.container, .elementor-container' ) 314 if ( outerContainer.length ) { 315 var outerContainerLeft = outerContainer.offset().left, 316 outerContainerWidth = outerContainer.outerWidth() 317 } else { 318 var outerContainerWidth = screen.width - 100 319 } 320 321 navSelector.find( 'ul.menu > li.mega' ).each(function() { 322 323 var li = $( this ); 324 325 // COLUMN 326 var col = li.find( '> ul' ).find( ' > li' ).length; 327 if ( li.hasClass( 'menu-item-object-category' ) ) col = 3; 328 329 if ( col > 0 ) { 330 li.addClass( 'column-' + col ); 331 } 332 if ( col >= 4 ) { 333 li.addClass( 'mega-full' ); 334 } 335 336 // please don't add for mega menu 337 if ( ! li.hasClass( 'menu-item-object-category' ) && ! li.find( '> ul .mega-sep' ).length ) { 338 for ( var i = 1; i <= col -1; i++ ) { 339 li.find( '> ul' ).append( '<span class="mega-sep mega-sep-' + i + '"></span>' ) 340 } 341 } 342 343 // ADJUST DROPDOWN ACCORDINGLY 344 // MEGA POSITION 345 var lis = li.parent().find( '> li' ), 346 li_pos = lis.index( li ), 347 ul = li.find( '>ul' ) 348 349 // margin left is a formula of column + position 350 var marginLeft = 0; 351 if ( li_pos == 2 ) { 352 if ( col == 3 ) { 353 marginLeft = 200; 354 } 355 } else if ( li_pos + 2 >= lis.length ) { 356 if ( col == 2 ) { 357 marginLeft = 320; 358 } else if ( col == 3 ) { 359 marginLeft = 520; 360 } 361 } else if ( li_pos >= 3 ) { 362 if ( col == 2 ) { 363 marginLeft = 200; 364 } else if ( col == 3 ) { 365 marginLeft = 300; 366 } 367 } 368 369 if ( col >= 4 ) { 370 371 li.addClass( 'mega-full' ); 372 ul.css('width', outerContainerWidth) 373 var translateX = li.offset().left - outerContainerLeft 374 375 } else { 376 377 /* ------------------- adjust the position of menu correctly */ 378 var dropdown_width = ul.outerWidth(), 379 translateX = dropdown_width/2 - li.outerWidth()/2 - 30, // the ideal one, 60 is a small factor 380 li_away_left = li.offset().left - outerContainerLeft, 381 li_away_right = outerContainerWidth - ( li_away_left + li.outerWidth() ) 382 383 // this means it's way too left, so don't translate left too much 384 if ( li_away_left < translateX ) { 385 translateX = li_away_left - 40 386 387 // this means it's way too right, so we translate left as much as we can 388 } else if ( li_away_right < translateX ) { 389 translateX = dropdown_width - ( outerContainerWidth - li_away_left ) + 40 390 } 391 392 } 393 394 ul.css({ 395 transform: 'translate(-' + translateX + 'px,0)', 396 }) 397 398 /** 399 * since 5.6 400 * right edge problem 401 */ 402 // li.find( '>ul' ).outerWidth() 403 404 /* 405 if ( marginLeft > 0 ) { 406 407 li.find( '>ul' ).css({ 408 left: '50%', 409 'transform': 'translateX(-' + marginLeft + 'px)', 410 }); 411 412 li.find( '> ul > .caret' ).css({ 413 left: '-10px', 414 'transform': 'translateX(' + marginLeft + 'px)', 415 }); 416 417 } 418 */ 419 420 }); 421 422 } 423 424 setup_mega(); 425 426 var run_superfish = function() { 427 428 if ( $().superfish ) { 429 430 var args = { 431 delay: 0, 432 speed: 400, 433 speedOut: 100, 434 animation: { 435 opacity : 'show', 436 }, 437 }; 438 439 navSelector.each(function() { 440 441 $( this ).find( 'ul.menu' ).superfish( args ); 442 443 }); 444 445 } 446 447 } 448 449 // this runs when window is fully loaded 450 run_superfish(); 451 $( window ).on( 'resize', run_superfish ); 452 453 } 454 455 /** 456 * VERTICAL NAV 457 */ 458 var vnav_behavior = function() { 459 460 /** 461 * dropdown markup first 462 */ 463 $( '.vnav' ).each(function(){ 464 var self = $( this ) 465 self.find( 'li.menu-item-has-children' ).each(function(){ 466 var li = $( this ) 467 if ( ! li.find( '>a>.caret' ).length ) { 468 li.find( '>a' ).append('<u class="caret"><i class="fa fa-angle-down"></i></u>') 469 } 470 }) 471 }) 472 473 $( document ).on( 'click', '.vnav li.menu-item-has-children > a', function( e ) { 474 var self = $( this ), 475 href = self.attr( 'href' ), 476 target = $( e.target ), 477 li = self.parent(), 478 ul = li.parent() 479 480 if ( ! href || '#' == href ) { 481 e.preventDefault() 482 } 483 484 console.log( target.attr( 'class' ) ) 485 486 if ( target.hasClass( 'caret' ) || target.parent().hasClass( 'caret' ) ) { 487 e.preventDefault() 488 } 489 490 // ah, we don't open mega items 491 if ( ! li.find('>ul').length ) { 492 return 493 } 494 495 // if we're clicking to the active one 496 if ( li.hasClass( 'active' ) ) { 497 498 li.find( '>
498ul' ).slideUp( 'fast', 'linear', function() { 499 li.removeClass( 'active' ) 500 }) 501 502 // otherwise 503 } else { 504 505 ul.find( '>li' ).each( function() { 506 var ul_li = $( this ) 507 if ( ul_li.hasClass( 'active' ) ) { 508 ul_li.find( '>ul' ).slideUp( 'fast', 'linear', function() { 509 ul_li.removeClass( 'active' ); 510 }); 511 } 512 }) 513 514 li.find( '>ul' ).slideDown( 'fast', 'linear', function(){ 515 li.addClass( 'active' ) 516 }) 517 518 519 } 520 }); 521 } 522 $( window ).on( 'elementor/frontend/init', function() { 523 vnav_behavior() 524 elementorFrontend.hooks.addAction( 'frontend/element_ready/fox_nav.default', function( $scope, $ ) { 525 vnav_behavior() 526 hnav_behavior() 527 }); 528 }) 529 530 /** 531 * SHARE 532 */ 533 $( window ).on( 'elementor/frontend/init', function() { 534 var Config = { 535 Link: "a.share", 536 Width: 800, 537 Height: 600 538 }; 539 540 $( document ).on( 'click', 'a.share', function( e ) { 541 542 e = (e ? e : window.event); 543 var t = $(this); 544 545 // popup position 546 var 547 px = Math.floor(((screen.availWidth || 1024) - Config.Width) / 2), 548 py = Math.floor(((screen.availHeight || 700) - Config.Height) / 2); 549 550 // open popup 551 if(t.attr('href')) { 552 var popup = window.open(t.attr('href'), "social", 553 "width="+Config.Width+",height="+Config.Height+ 554 ",left="+px+",top="+py+ 555 ",location=0,menubar=0,toolbar=0,status=0,scrollbars=1,resizable=1"); 556 if (popup) { 557 popup.focus(); 558 if (e.preventDefault) e.preventDefault(); 559 e.returnValue = false; 560 } 561 562 return !!popup; 563 } 564 }); // click 565 }) 566 567 $( window ).on( 'elementor/frontend/init', function() { 568 //hook name is 'frontend/element_ready/{widget-name}.{skin} - i dont know how skins work yet, so for now presume it will 569 //always be 'default', so for example 'frontend/element_ready/slick-slider.default' 570 //$scope is a jquery wrapped parent element 571 572 if ( typeof WITHEMES !== 'undefined' ) { 573 elementorFrontend.hooks.addAction( 'frontend/element_ready/post-masonry.default', function( $scope, $ ) { 574 WITHEMES.reInit(); 575 }); 576 577 elementorFrontend.hooks.addAction( 'frontend/element_ready/post-standard.default', function( $scope, $ ) { 578 WITHEMES.reInit(); 579 }); 580 581 elementorFrontend.hooks.addAction( 'frontend/element_ready/post-newspaper.default', function( $scope, $ ) { 582 WITHEMES.reInit(); 583 }); 584 585 /* 586 elementorFrontend.hooks.addAction( 'frontend/element_ready/post-slider.default', function( $scope, $ ) { 587 WITHEMES.reInit(); 588 }); 589 */ 590 591 elementorFrontend.hooks.addAction( 'frontend/element_ready/post-group-1.default', function( $scope, $ ) { 592 WITHEMES.reInit(); 593 }); 594 595 elementorFrontend.hooks.addAction( 'frontend/element_ready/post-group-2.default', function( $scope, $ ) { 596 WITHEMES.reInit(); 597 }); 598 } 599 600 }); 601 602} )( jQuery ); 603 604 605jQuery(document).ready(function( $ ) { 606 607 $( '.fox-sticky-section' ).each( function() { 608 609 var self = $( this ), 610 height_Element = self.next() 611 612 if ( ! height_Element.length || ! height_Element.is( 'sticky-section-height' ) ) { 613 self.after( '<div class="sticky-section-height" />' ) 614 } 615 height_Element = self.next() 616 height_Element.css({ 617 height: self.outerHeight(), 618 }) 619 620 var self_top = self.offset().top, 621 self_height = self.outerHeight() 622 623 624 // on scroll 625 $( window ).on( 'scroll', function() { 626 627 var windowTop = $( window ).scrollTop() 628 629 // a safe distance 630 if ( windowTop > self_top + self_height + 200 ) { 631 self.addClass('before-sticky is-sticky'); 632 } else if ( windowTop > self_top + self_height ) { 633 self.removeClass('is-sticky'); 634 self.addClass('before-sticky'); 635 } else { 636 self.removeClass('is-sticky before-sticky'); 637 } 638 639 }); 640 641 // on resize 642 // recompute the height of height element 643 $( window ).on( 'resize', function() { 644 height_Element.css({ 645 height: self.outerHeight(), 646 }) 647 }) 648 649 }); // seach sticky section 650 651});
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.