1!function ($) { 2 3 4 // --> Initialize 5 $(document).ready(function() { 6 7 if( ! isThemeCustomizer() ) { 8 $(document).trigger( 'sectionStart' ) 9 } 10 11 12 $.plCommon.init() 13 14 15 16 $.plMobilizer.init() 17 18 $(".fitvids").fitVids(); // fit videos 19 20 $.plSupersized.init() 21 22 $.plNavigation.init() 23 24 $.plParallax.init() 25 26 $.plKarma.init() 27 28 $.plGallery.init() 29 30 $.plVideos.init() 31 32 $.plSocial.init() 33 34 $.plAnimate.initAnimation() 35 36 $('.pl-credit').show() 37 38 $.ResizeCanvasVids.init() 39 40 $.BodyClass.init() 41 42 // Master resize trigger 43 $(window).trigger('resize') 44 45 }) 46 47 /** 48 * code from https://gist.github.com/matthewspencer/71b7973837a39db6a49f 49 */ 50 function isThemeCustomizer() { 51 if ( window.parent.location === window.location ) { 52 return false; 53 } 54 if ( null === window.parent.document.getElementById( 'customize-preview' ) ) { 55 return false; 56 } 57 return true; 58 } 59 60 function getPLFixedHeight(){ 61 62 return $('.pl-fixed-top').height() + $('#wpadminbar').height() + $('.pl-toolbox').height() 63 64 } 65 66 function shuffle(o){ //v1.0 67 for(var j, x, i = o.length; i; j = parseInt(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x); 68 return o; 69 }; 70 71 function plRandSort(c) { 72 var o = new Array(); 73 for (var i = 0; i < c; i++) { 74 o.push(i); 75 76 } 77 return shuffle(o); 78 } 79 80 81 $(window).load(function() { 82 $.plCommon.plVerticalCenter('.pl-centerer', '.pl-centered') 83 // $('.pl-section').on('plresize', function(){ 84 // $.plCommon.plVerticalCenter('.pl-centerer', '.pl-centered') 85 // }) 86 }) 87 88 $.BodyClass = { 89 init: function(){ 90 $(window).resize(function () { 91 $.BodyClass.doResize() 92 }) 93 $.BodyClass.doResize() 94 } 95 , doResize: function(){ 96 $(document.body).removeClass('pl-res-phone pl-res-tablet pl-res-desktop') 97 var width = $(window).width() 98 if( width < 480 ) { 99 $(document.body).addClass('pl-res-phone') 100 } else if( width < 1024 ){ 101 $(document.body).addClass('pl-res-tablet') 102 } else { 103 $(document.body).addClass('pl-res-desktop') 104 } 105 } 106 } 107 108 $.plSupersized = { 109 init: function(){ 110 if ($("#supersized").length > 0){ 111 $(".site-wrap").addClass('supersized') 112 jQuery.supersized({ slides: [{ image : supersize_image.url }]}) 113 } 114 } 115 } 116 117 $.ResizeCanvasVids = { 118 init: function(){ 119 $.ResizeCanvasVids.checkLoop() 120 } 121 122 , checkLoop: function(){ 123 124 $('.bg-video').each( function(){ 125 var video = this 126 $(video).hide() 127 var intervalId = setInterval(function() { 128 if (video.readyState === 4) { 129 $(window).trigger('resize') 130 clearInterval(intervalId) 131 $(video).fadeIn('slow') 132 return false 133 } else { 134 plPrint('nope') 135 } 136 }, 100); 137 }) 138 } 139 } 140 141 $.plVideos = { 142 init: function(){ 143 144 145 $(window).resize(function () { 146 147 $(".bg-video").each(function () { 148 149 150 151 var vid = $(this) 152 , canvas = vid.closest('.bg-video-canvas') 153 , viewport = vid.parent() 154 155 if( plIsset( this.videoWidth ) ){ 156 157 var width = parseInt( this.videoWidth ) 158 , height = parseInt( this.videoHeight ) 159 160 canvas.attr('data-height', height) 161 canvas.attr('data-width', width) 162 163 } else { 164 165 var width = parseInt( canvas.attr('data-width') ) 166 , height = parseInt( canvas.attr('data-height') ) 167 168 } 169 170 $.plVideos.resizeToCover( vid, canvas, viewport, height, width ) 171 172 173 174 }) 175 176 }) 177 178 179 180 // $('.bg-video-canvas').on('plresize', function(){ 181 // $(window).trigger('resize') 182 // }) 183 184 } 185 186 , resizeToCover: function( vid, canvas, viewport, vH, vW ){ 187 188 189 var canvasWidth = canvas.width() 190 , canvasHeight = canvas.height() 191 192 viewport.width( canvasWidth ) 193 viewport.height( canvasHeight ) 194 195 var scale_h = canvasWidth / vW 196 var scale_v = canvasHeight / vH 197 var scale = scale_h > scale_v ? scale_h : scale_v 198 199 // don't allow scaled width < minimum video width 200 if (scale * vW < 300) { 201 scale = 300 / vW 202 } 203 204 // console.log('scale ' + scale ) 205 // console.log('canvasWidth ' + canvasWidth ) 206 // console.log('canvasHeight ' + canvasHeight ) 207 // console.log('vW ' + scale * vW ) 208 // console.log('vH ' + scale * vH ) 209 // 210 // vid.css('border', '5px solid red') 211 // now scale the video 212 vid.width(scale * vW); 213 vid.height(scale * vH); 214 215 // and center it by scrolling the video viewport 216 viewport.scrollLeft(( vid.width() - canvasWidth ) / 2); 217 viewport.scrollTop(( vid.height() - canvasHeight ) / 2); 218 219 } 220 } 221 222 $.plGallery = { 223 init: function(){ 224 //gallery 225 $('.flex-gallery').each(function(){ 226 227 var gallery = $(this) 228 , animate = gallery.data('animate') || true 229 , smoothHeight = gallery.data('smoothheight') || true 230 , transition = gallery.data('transition') || 'fade' 231 232 233 gallery.imagesLoaded( function(instance){ 234 235 236 237 gallery.flexslider({ 238 animation: transition 239 , smoothHeight: smoothHeight 240 , slideshow: animate 241 }) 242 243 if( gallery.find('.slides li').length <= 1 ){ 244 gallery.find('.flex-direction-nav').hide() 245 } 246 247 ////gallery slider add arrows 248 $('.flex-gallery .flex-direction-nav li a.flex-next').html('<i class="icon icon-angle-right"></i>') 249 $('.flex-gallery .flex-direction-nav li a.flex-prev').html('<i class="icon icon-angle-left"></i>') 250 251 }); 252 253 }); 254 255 256 257 } 258 } 259 260 261 262 $.plKarma = { 263 264 init: function(){ 265 266 $('body').on('click','.pl-karma', function() { 267 268 var karmaLink = $(this) 269 , id = karmaLink.attr('id') 270 271 if( karmaLink.hasClass('loved') ) 272 return false 273 274 if( karmaLink.hasClass('inactive') ) 275 return false;
276 277 var passData = { 278 action: 'pl_karma', 279 karma_id: id 280 } 281 282 $.post( plKarma.ajaxurl, passData, function( data ){ 283 284 karmaLink 285 .find( '.pl-social-count' ) 286 .html( data ) 287 .end() 288 .addClass( 'loved' ) 289 .attr( 'title', 'You already gave karma!' ) 290 .end() 291 .find( 'span') 292 .css({ 'opacity': 1, 'width':'auto' } ) 293 294 }); 295 296 karmaLink 297 .addClass('inactive') 298 299 return false 300 }) 301 } 302 303 304 } 305 306 $.plNavigation = { 307 init: function(){ 308 309 var that = this 310 311 // Bootstrap style dropdowns 312 that.initDrops() 313 314 // Superfish style dropdowns 315 that.initSFMenu() 316 317 } 318 , initSFMenu: function(){ 319 $('.sf-menu').each(function(){ 320 321 if( $(this).hasClass('dd-toggle-click') ){ 322 $(this).superclick({ 323 delay: 300, 324 speed: 'fast', 325 speedOut: 'fast', 326 animation: {opacity:'show'} 327 }) 328 } else { 329 $(this).superfish({ 330 delay: 800, 331 speed: 'fast', 332 speedOut: 'fast', 333 animation: {opacity:'show'} 334 }) 335 } 336 337 // needs display: table for appro rendering. so we use visible 338 $(this).find('.sub-menu').css('visibility', 'visible') 339 340 var offset = $(this).data('offset') || false 341 342 if( offset ){ 343 $(this) 344 .find('> li > ul') 345 .css('top', offset) 346 } 347 348 $(this).find('.megamenu').each(function(){ 349 var cols = $(this).find('> .sub-menu > li').length 350 351 $(this).addClass('mega-col-'+cols) 352 }) 353 354 $(this).find('.panelmenu').each(function(){ 355 var cols = $(this).find('> .sub-menu > li').length 356 , colWidth = 180 357 , menuWidth = cols * colWidth 358 , fromLeft = $(this).offset().left 359 , winWidth = $(window).width() 360 , setClass 361 362 if( fromLeft > (winWidth / 2) ){ 363 setClass = 'panel-right' 364 } else 365 setClass = 'panel-left' 366 367 $(this) 368 .addClass( setClass ) 369 .find('> .sub-menu') 370 .css('width', menuWidth) 371 372 }) 373 374 }) 375 } 376 , initDrops: function(){ 377 378 var a = 1 379 380 $(".pl-dropdown > li > ul").each(function(){ 381 382 var b = "" 383 384 $(this).addClass("dropdown-menu"); 385 386 if( $(this).siblings("a").children("i").length===0 ){ 387 b = ' <i class="icon icon-caret-down"></i>' 388 } 389 390 $(this).siblings("a") 391 .addClass("dropdown-toggle") 392 .attr( "href", "#m" + a ) 393 .attr("data-toggle","dropdown") 394 .append(b) 395 .parent() 396 .attr( "id", "m" + a++ ) 397 .addClass("dropdown") 398 399 $(this) 400 .find('.sub-menu') 401 .addClass("dropdown-menu") 402 .parent() 403 .addClass('dropdown-submenu') 404 }) 405 406 $(".dropdown-toggle").dropdown() 407 408 } 409 } 410 411 $.plParallax = { 412 413 414 init: function(speed){ 415 416 var that = this 417 var width = $(window).width() 418 419 if( $('.pl-parallax-alt').length >= 1){ 420 421 $(window).scroll(function(){ 422 423 $('.pl-parallax-alt').each( function( element ){ 424 425 var scrolltop = $(window).scrollTop() 426 var scrollwindow = scrolltop + $(window).height(); 427 var sectionoffset = $(this).offset().top; 428 var backgroundscroll = scrollwindow - sectionoffset; 429 if( scrollwindow > sectionoffset ) { 430 $(this).css("backgroundPosition", "50% " + -(backgroundscroll/6) + "px"); 431 $(this).css("background-attachment", "fixed") 432 $(this).css("background-size", "cover") 433 $(this).css("background-repeat", "no-repeat") 434 } 435 }) 436 }) 437 } 438 439 if( $('.pl-parallax').length >= 1){ 440 $('.pl-parallax').each( function( element ){ 441 $(this).parallax( '50%', .5, true, 'background' ) 442 }) 443 } 444 445 if( $('.pl-parallax-new').length >= 1 ) { 446 if( width > 1024 ) { 447 $('.pl-parallax-new').each( function( element ){ 448 var speed = $(this).attr("class").match(/paraspeed-([0-9])\b/) 449 var direction = $(this).attr("class").match(/paradirection-([a-z]+)\b/) 450 var layer = $(this).attr("class").match(/paralayer-([a-z]+)\b/) 451// $(this).css('background-repeat', 'no-repeat') 452 $(this).attr('data-enllax-ratio', speed[1] / 10 ) 453 $(this).attr('data-enllax-direction', direction[1] ) 454 $(this).attr('data-enllax-type', layer[1] ) 455 }) 456 $(window).enllax() 457 } 458 } 459 460 if( $('.pl-scroll-translate').length >= 1){ 461 462 $('.pl-scroll-translate .pl-area-wrap').each(function(element){ 463 464 $(this).parallax('50%', .4, true, 'translate') 465 }) 466 } 467 that.windowSizer() 468 } 469 470 , windowSizer: function(){ 471 472 if( $('.pl-window-height').length >= 1 ){ 473 474 $(window).resize(function () { 475 476 $('.pl-window-height').each(function(element){ 477 478 var theArea = $(this) 479 , windowHeight = $(window).height() - getPLFixedHeight() 480 , theContent = theArea.find('.pl-area-wrap') 481 , contentHeight = theContent.outerHeight() 482 , offsetMargin = (contentHeight / 2) * -1 483 484 if( windowHeight > (contentHeight + 20) ){ 485 486 theArea.height(windowHeight).css('min-height', 'auto') 487 488 489 } else { 490 theArea.height(contentHeight + 20).css('min-height', 'auto') 491 } 492 493 theContent.css('margin-top', offsetMargin).fadeIn(1000) 494 495 }) 496 497 }) 498 499 } 500 } 501 502 } 503 504 $.plMobilizer = { 505 506 init: function(){ 507 var that = this 508 509 that.mobileMenu() 510 } 511 512 , mobileMenu: function(){ 513 var that = this 514 , theBody = $('body') 515 , menuToggle = $('.mm-toggle') 516 , siteWrap = $('.site-wrap') 517 , mobileMenu = $('.pl-mobile-menu') 518 519 menuToggle.on('click.mmToggle', function(e){ 520 521 e.stopPropagation() 522 // mobileMenu.css('max-height', siteWrap.height()) 523 524 if( !siteWrap.hasClass('show-mobile-menu') ){ 525 526 siteWrap.addClass('show-mobile-menu') 527 mobileMenu.addClass('show-menu') 528 529 530 $('.site-wrap, .mm-close').one('click', function(){ 531 siteWrap.removeClass('show-mobile-menu') 532 mobileMenu.removeClass('show-menu') 533 }) 534 } else { 535 siteWrap.removeClass('show-mobile-menu') 536 mobileMenu.removeClass('show-menu') 537 } 538 }) 539 } 540 } 541 542 $.plSocial = { 543 544 init: function(){ 545 546 var that = this 547 548 if ( $('.pl-social-counters').length) { 549 550 var title = $('title') 551 552 that.shareTitle = encodeURI( $("meta[property='pl-share-title']").attr('content') ) 553 that.shareDesc = encodeURI( $("meta[property='pl-share-desc']").attr('content') ) 554 that.shareImg = encodeURI( $("meta[property='pl-share-img']").attr('content') ) 555 that.shareLocation = window.location 556 557 that.loadSocialCounts() 558 } 559 560 } 561 562 , loadSocialCounts: function(){ 563 var that = this 564 565 that.facebook() 566 that.twitter() 567 that.pinterest() 568 that.linkedin() 569 570 } 571 , pinterest: function(){ 572 573 var that = this 574 , url = '//api.pinterest.com/v1/urls/count.json?url='+that.shareLocation+'&callback=?' 575 , shareBtn = $('[data-social="pinterest"]') 576 577 578 that.fetchCount(url, shareBtn) 579 580 shareBtn.click( function(){ 581 582 var shareUrl = '//pinterest.com/pin/create/button/?url='+that.shareLocation+'&media='+that.shareImg+'&description='+that.shareTitle 583 584 that.openWindow( shareUrl, 'pinterestShare') 585 586 return false;
587 588 }) 589 590 } 591 592 , twitter: function(){ 593 594 var that = this 595 , url = '//urls.api.twitter.com/1/urls/count.json?url='+that.shareLocation+'&callback=?' 596 , shareBtn = $('[data-social="twitter"]') 597 598 599 that.fetchCount(url, shareBtn) 600 601 602 shareBtn.click( function(){ 603 604 var shareUrl = '//twitter.com/intent/tweet?text='+ that.shareTitle +' '+that.shareLocation 605 606 that.openWindow( shareUrl, 'twitterShare') 607 608 return false; 609 610 }) 611 612 613 } 614 615 , linkedin: function(){ 616 617 var that = this 618 , url = '//www.linkedin.com/countserv/count/share?url='+that.shareLocation+'&callback=?' 619 , shareBtn = $('[data-social="linkedin"]') 620 621 622 that.fetchCount(url, shareBtn) 623 624 625 shareBtn.click( function(){ 626 627 var shareUrl = '//www.linkedin.com/shareArticle?url='+that.shareLocation+'&title='+that.shareTitle+'&summary='+that.shareDesc 628 629 630 that.openWindow( shareUrl, 'linkedInShare') 631 632 return false; 633 634 }) 635 636 637 } 638 639 , facebook: function(){ 640 641 var that = this 642 , url = "//graph.facebook.com/?id="+ that.shareLocation +'&callback=?' 643 , shareBtn = $('[data-social="facebook"]') 644 645 646 that.fetchCount(url, shareBtn) 647 648 shareBtn.click( function(){ 649 650 var shareUrl = '//www.facebook.com/sharer/sharer.php?u='+that.shareLocation 651 652 that.openWindow( shareUrl, 'fbShare') 653 654 return false; 655 656 }) 657 658 } 659 660 , openWindow: function( url, name ){ 661 662 var setup = "height=380,width=660,resizable=0,toolbar=0,menubar=0,status=0,location=0,scrollbars=0" 663 664 window.open( url, name, setup ) 665 666 } 667 668 , fetchCount: function( url, btn ){ 669 670 var that = this 671 , editor = $( 'body' ).hasClass('pl-editor') 672 673 // if in the editor, dont do this ... saves loadtime! 674 if( editor ) { 675 return false 676 } 677 678 // SHARE COUNT 679 $.getJSON( url, function( data ) { 680 681 var theCount = ( (data.count != 0) && (data.count != undefined) && (data.count != null) ) ? data.count : 0 682 683 theCount = ( (data.shares != 0) && (data.shares != undefined) && (data.shares != null) ) ? data.shares : theCount 684 685 btn 686 .find('.pl-social-count') 687 .html( theCount ) 688 689 that.loadInButton() 690 691 }) 692 693 } 694 , loadInButton: function(){ 695 696 } 697 } 698 699 $.plAnimate = { 700 701 initAnimation: function(){ 702 703 var that = this 704 705 $.plAnimate.plWaypoints() 706 707 } 708 709 , plWaypoints: function(selector, options_passed){ 710 711 var defaults = { 712 offset: '85%' // 'bottom-in-view' 713 , triggerOnce: true 714 } 715 , options = $.extend({}, defaults, options_passed) 716 , delay = 150 717 718 $('.pl-animation-group') 719 .find('.pl-animation') 720 .addClass('pla-group') 721 722 $('.pl-animation:not(.pla-group)').each(function(){ 723 724 var element = $(this) 725 726 element.appear(function() { 727 728 if( element.hasClass('pl-slidedown') ){ 729 730 var endHeight = element.find('.pl-end-height').outerHeight() 731 732 element.css('height', endHeight) 733 734 } 735 736 737 $(this) 738 .addClass('animation-loaded') 739 .trigger('animation_loaded') 740 741 }) 742 743 }) 744 745 $('.pl-animation-group').each(function(){ 746 747 var element = $(this) 748 749 element.appear(function() { 750 751 var animationNum = $(this).find('.pl-animation').size() 752 , randomLoad = plRandSort(animationNum) 753 754 755 756 $(this) 757 .find('.pl-animation') 758 .each( function(i){ 759 var element = $(this) 760 761 setTimeout( 762 function(){ 763 element 764 .addClass('animation-loaded hovered') 765 766 setTimeout(function(){ 767 element.removeClass('hovered'); 768 }, 700); 769 } 770 , (i * 200) 771 ); 772 }) 773 774 }) 775 776 }) 777 778 779 780 $('.pl-counter').each(function(){ 781 782 var cntr = $(this) 783 784 cntr.appear( function() { 785 786 var the_number = parseInt( cntr.text() ) 787 788 cntr.countTo({ 789 from: 0 790 , to: the_number 791 , speed: 2000 792 , refreshInterval: 30 793 , formatter: function( value, options){ 794 795 value = Math.round( value ) 796 var n = value.toString() 797 798 n = n.replace(/\B(?=(\d{3})+(?!\d))/g, ",") 799 800 return n 801 } 802 }) 803 804 }) 805 806 }) 807 } 808 809 } 810 811 $.plCommon = { 812 813 init: function(){ 814 var that = this 815 that.setFixedHeight() 816 817 // $.resize.delay = 100 // resize throttle 818 819 var fixedTop = $('.pl-fixed-top') 820 , fixedOffset = ( plIsset( fixedTop[0] ) ) ? fixedTop[0].offsetTop : 0 821 822 // fixedTop.on('plresize', function(){ 823 // that.setHeight() 824 // }) 825 826 $(document).on('ready scroll', function() { 827 var docScroll = $(document).scrollTop() 828 829 if (docScroll >= fixedOffset) { 830 fixedTop.addClass('is-fixed'); 831 fixedTop.removeClass('is-not-fixed'); 832 } else { 833 fixedTop.addClass('is-not-fixed'); 834 fixedTop.removeClass('is-fixed') 835 } 836 837 }) 838 839 $('.pl-make-link').on('click', function(){ 840 var url = $(this).data('href') || '#' 841 , newWindow = $(this).attr('target') || false 842 843 if( newWindow ) 844 window.open( url, newWindow ) 845 else 846 window.location.href = url 847 848 }) 849 850 that.handleSearchfield() 851 852 853 } 854 855 , handleSearchfield: function(){ 856 857 858 859 $('.searchfield').on('focus', function(e){ 860 861 $(this).parent().parent().addClass('has-focus') 862 863 }).on( 'blur', function(e){ 864 865 $(this).parent().parent().removeClass('has-focus') 866 867 }) 868 869 $('.pl-searcher').on('click touchstart', function(e){ 870 871 e.stopPropagation() 872 873 var searchForm = $(this) 874 875 $(this).addClass('has-focus').parent().find( '.searchfield' ).focus() 876 877 $('body').on('click touchstart', function(e){ 878 searchForm.removeClass('has-focus') 879 }) 880 }) 881 882 } 883 884 , setFixedHeight: function(){ 885 886 var height = $('.pl-fixed-top').height() 887 888 $('.fixed-top-pusher').height(height) 889 890 } 891 892 , plVerticalCenter: function( container, element, offset ) { 893 894 jQuery( container ).each(function(){ 895 896 var colHeight = jQuery(this).height() 897 , centeredElement = jQuery(this).find( element ) 898 , infoHeight = centeredElement.height() 899 , offCenter = offset || 0 900 901 centeredElement.css('margin-top', ((colHeight / 2) - (infoHeight / 2 )) + offCenter ) 902 }) 903 904 } 905 906 907 } 908 909}(window.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.