PageSourceSearch

https://joshshapiro.org/wp-content/themes/mosaic-sections-theme/js/theme.common.js?ver=1.6.0

js joshshapiro.org collected 2026-10-02 06:37:32 UTC 53,853 bytes, 1,981 lines download raw bytes

1jQuery( function ( $ ) {
2  placeholderShiv( $ );
3  bindTestimonials.init();
4  responsiveVideos( $ );
5  headerScroll( $ );
6  acgNavGlide.init( 'nav.nav-glide' );
7  fancyRecentPosts.init();
8  stickyNav.init( 'body > .container' );
9  megaMenu.init();
10  videoLightbox.init();
11
12  // intentional, based on images loading (http://stackoverflow.com/questions/18849296/masonry-js-overlapping-items)
13  jQuery( window ).on( 'load', function () {
14    acgMasonry.init( 'div.slides' );
15    // To use lightbox, add "lightbox" class to the parent container
16  } );
17
18  acgMasonry.init( '.team' );
19
20  $( '.lightbox .gallery' ).acgLightbox();
21
22  // Used for Responsive Scrollable Menu.  Causes the pact to scroll to the top when the menu is expanded.
23  //$( 'input.toggle' ).change( function () {
24  //  if ( $( this ).is( ':checked' ) ) {
25  //    $( 'body, html' ).animate( { scrollTop: 0 }, 350 );
26  //  }
27  //} );
28
29  //stickySidebar.init( '.sidebar', 'aside', '.with-sidebar-content-wrapper' );
30
31  // Used to dim the Team Members on About Us Page
32  $( '#team li' ).hover(
33    // This is the "mouse over" function.  Triggers on hover
34    function () {
35      // Find all siblings (li's other than the one hovered) and add the dim class
36      $( this ).siblings().addClass( 'dim' );
37    },
38    // This is the "mouse out" function. Triggers on end of hover
39    function () {
40      // Find ALL li's within the team list and remove the dim class
41      $( this ).closest( 'ul' ).find( 'li' ).removeClass( 'dim' );
42    }
43  );
44
45  // Used to add a class to the Image Widget description
46  $( '.widget_sp_image-description a' ).hover(
47    function () {
48      $( this ).closest( 'li' ).find( 'img' ).addClass( 'hovered' );
49    },
50    function () {
51      $( this ).closest( 'li' ).find( 'img' ).removeClass( 'hovered' );
52    }
53  );
54
55  $( window ).on( 'resize', adjustSubNavTop );
56  adjustSubNavTop();
57
58  videoEmbedShortcode.init();
59} );
60
61const videoLightbox = (function ( $ ) {
62  let $videos;
63  let $modal;
64  let $overlay;
65  let videoID;
66  let player;
67  let isIOS;
68
69  function prepVideos() {
70    if ( !$videos.length ) {
71      return;
72    }
73
74    isIOS = navigator.userAgent.match( /(iPad)|(iPhone)|(iPod)/i ) !== null;
75
76    $videos.each( function () {
77      $( this ).attr( 'data-video', getYouTubeID( $( this ).attr( 'href' ) ) );
78      $( this ).attr( 'href', '#' );
79      $( this ).on( 'click', function () {
80        videoID = $( this ).attr( 'data-video' );
81        openVideo();
82      } );
83    } );
84
85    let $body   = $( 'body' );
86    let $script = '<script src="https://www.youtube.com/iframe_api"></script>';
87    $body.append( $script );
88
89    $modal = '<div class="video-modal-overlay"></div>';
90    $body.append( $modal );
91
92    $modal = '<div class="video-modal-container"><div class="video-modal-dialog"><div id="video-modal-player"></div></div></div>';
93    $body.append( $modal );
94
95    $modal   = $( '.video-modal-container' );
96    $overlay = $( '.video-modal-overlay' );
97
98    $modal.on( 'click', function () {
99      closeVideo();
100    } );
101
102    $modal.find( '.video-modal-dialog' ).on( 'click', function ( e ) {
103      e.stopPropagation();
104    } );
105  }
106
107  // Extracts the Youtube video ID from a well formed Youtube URL
108  function getYouTubeID( link ) {
109    if ( !link ) {
110      return '';
111    }
112
113    // Assumed Youtube URL formats
114    // https://www.youtube.com/watch?v=Pe0jFDPHkzo
115    // https://youtu.be/Pe0jFDPHkzo
116    // https://www.youtube.com/v/Pe0jFDPHkzo
117    // and more
118
119    //See http://stackoverflow.com/a/6904504/4360074
120    let youtubeidreg = /(?:youtube\.com\/(?:[^\/]+\/.+\/|(?:v|e(?:mbed)?)\/|.*[?&]v=)|youtu\.be\/)([^"&?\/ ]{11})/i;
121    let id           = youtubeidreg.exec( link ); // return Youtube video ID portion of link
122    return (id) ? id[ 1 ] : '';
123  }
124
125  function openVideo() {
126    if ( !videoID ) {
127      return;
128    }
129
130    $modal.addClass( 'open' );
131    $overlay.addClass( 'open' );
132    if ( 'undefined' === typeof player ) {
133      player = new YT.Player( 'video-modal-player', {
134        videoId: videoID,
135        playerVars: { autoplay: 1 }
136      } );
137    } else {
138      if ( isIOS ) {
139        player.cueVideoById( videoID );
140      } else {
141        player.loadVideoById( videoID );
142      }
143    }
144
145    setTimeout( function () {
146      responsiveVideos( $ );
147    }, 500 );
148  }
149
150  function closeVideo() {
151    $modal.removeClass( 'open' );
152    $overlay.removeClass( 'open' );
153    player.stopVideo();
154  }
155
156  return {
157    init: function () {
158      $videos = $( '.video-lightbox' );
159      prepVideos();
160    }
161  }
162}
162)( jQuery );
163
164function adjustSubNavTop() {
165  // Set up correct "top" value for sub-nav based on actual height
166  jQuery( 'nav#main ul.menu > li' ).not( 'div.mega-menu li' ).each(
167    function () {
168      let top = jQuery( 'nav#main ul.menu > li' ).outerHeight();
169      jQuery( this ).children( 'ul.sub-menu' ).first().css( { top: top } );
170    }
171  );
172}
173
174/**
175 * Gets called to handle rendering image placeholder for `mst-video` shortcode
176 * @see /includes/shortcodes.php L:64
177 *
178 * @type {{init}}
179 */
180var videoEmbedShortcode = (function ( $ ) {
181  var $videos;
182
183  function loadShortcodeVideos() {
184    $videos = $( ".mst-video" );
185
186    //TODO: Wire up better fallback. Perhaps add a class to body if shortcode is on the page.
187    if ( !$videos ) {
188      return;
189    }
190
191    $videos.each( loadVideo );
192  }
193
194  /**
195   * Load placeholder image for video
196   *
197   * @param index
198   * @param el
199   */
200  function loadVideo( index, el ) {
201    var $el    = $( el );
202    var source = $el.data( 'image' );
203
204    var $image = $( '<img />' );
205    $image.attr( 'src', source );
206
207    if ( $el.hasClass( 'lazyload' ) ) {
208      lazyLoadImage( $image, $el );
209    } else {
210      $el.append( $image );
211    }
212
213    $el.on( 'click', createIFrame );
214  }
215
216  /**
217   * Lazy load image placeholder for video
218   *
219   * @param $image
220   * @param $el
221   */
222  function lazyLoadImage( $image, $el ) {
223    $image.on( "load", function () {
224      $el.appendChild( $image );
225    } );
226  }
227
228  /**
229   * Create video iframe where 'this' is the jQuery element with the class 'mst-video'
230   */
231  function createIFrame() {
232    var $iframe      = $( '<iframe/>' );
233    var $video       = $( this );
234    var iframeWidth  = $video.width();
235    var iframeHeight = $video.height();
236
237    var hideRelatedVideos = '';
238
239    if ( $video.data( 'hide-related-videos' ) ) {
240      hideRelatedVideos = '&rel=0';
241    }
242
243    $iframe.attr( {
244      "width": iframeWidth,
245      "height": iframeHeight,
246      "frameborder": "0",
247      "allowfullscreen": "",
248      "webkitallowfullscreen": "",
249      "mozallowfullscreen": "",
250      "src": $video.data( 'video' ) + "?autoplay=1" + hideRelatedVideos
251    } );
252
253    $video.html( "" );
254    $video.addClass( 'showing-video' );
255    $video.append( $iframe );
256  }
257
258  return {
259    init: function () {
260      loadShortcodeVideos();
261    }
262  }
263})( jQuery );
264
265/**
266 * Code to cause navigation to be "sticky" at the top of the page.
267 * May need altering depending on markup, but should work if
268 * called stickyNav.init();
269 */
270
271var stickyNav = {};
272
273stickyNav = (function ( $ ) {
274  var $header;
275  var $nav;
276  var $body;
277  var top;
278  var header_height;
279  var nav_height;
280  var sticky       = false;
281  var original_css = {};
282  var headerOffset = 0;
283
284  function checkSticky() {
285    top = $( window ).scrollTop();
286    if ( top > headerOffset ) { // header_height
287      stick();
288    } else {
289      unstick();
290    }
291  }
292
293  function stick() {
294    $body.css( {
295      paddingTop: original_css.body.paddingTop + header_height
296      //'background-position': 'center ' + height + 'px'
297    } );
298
299    if ( sticky ) {
300      return;
301    }
302
303    /**
304     * NO padding on body: Content jumps, but image stays neat, does not jump
305     * WITH padding on body: Content jumps, image moves down
306     *
307     */
308    var bg  = $header.data( 'background' );
309    var css = {
310      position: 'fixed',
311      left: 0,
312      top: 0,
313      zIndex: 99998
314    };
315
316    if ( bg ) {
317      css[ 'background' ] = bg;
318    }
319
320    $header.css( css );
321    $nav.css( css );
322
323    sticky = true;
324  }
325
326  function unstick() {
327    if ( !sticky ) {
328      return;
329    }
330
331    $body.css( original_css.body );
332    $nav.css( original_css.nav );
333    $header.css( original_css.header );
334
335    sticky = false;
336  }
337
338  return {
339    init: function ( sel ) {
340      if ( $( '.header.sticky' ).length <= 0 ) {
341        return;
342      }
343
344      $body = (sel) ? $( sel ) : $( 'body' );
345
346      $header       = $( '.header.sticky' );
347      headerOffset  = $header.offset().top;
348      $nav          = $( '.nav-wrapper.sticky' );
349      header_height = $header.outerHeight();
350      nav_height    = $nav.outerHeight();
351
352      original_css.nav                 = {};
353      original_css.nav.position        = $nav.css( 'position' );
354      original_css.nav.left            = $nav.css( 'left' );
355      original_css.nav.top             = $nav.css( 'top' );
356      original_css.nav.backgroundColor = $nav.css( 'background' );
357
358      original_css.header                 = {};
359      original_css.header.position        = $header.css( 'position' );
360      original_css.header.left            = $header.css( 'left' );
361      original_css.header.top             = $header.css( 'top' );
362      original_css.header.backgroundColor = $header.css( 'background' );
363
364      original_css.body            = {};
365      original_css.body.paddingTop = parseInt( $body.css( 'padding-top' ) );
366
367      $( window ).scroll( function () {
368        checkSticky();
369      } );
370    }
371  }
372})( jQuery );
373
374/**
375 * Header Scroll
376 */
377function headerScroll( $ ) {
378  var $header = $( '.header' );
379  var offset  = $header.offset().top;
380
381  $( window ).scroll( function () {
382    if ( $( window ).scrollTop() > offset ) {
383      $header.addClass( 'scrolled' );
384    } else {
385      $header.removeClass( 'scrolled' );
386    }
387  } );
388}
389
390var stickySidebar = {};
391
392stickySidebar = (function ( $ ) {
393  var $stickySidebar;
394  var $sidebarContainer;
395  var $contentWrapper;
396  var windowScrollTop;
397  var startSticky;
398  var stopSticky;
399  var top;
400  var bottom;
401
402  /**
403   * Calculates start of 'sticky' sidebar
404   *
405   * @returns {number} start
406   */
407  function calculateStart() {
408    var start = $stickySidebar.offset().top;
409
410    if ( $( '.header.sticky' ).length > 0 ) {
411      start = start - $( '.header.sticky' ).outerHeight();
412    }
413
414    return start;
415  }
416
417  /**
418   * Calculates end of 'sticky' sidebar
419   *
420   * @returns {number}
421   */
422  function calculateStop() {
423    var stop;
424    var endOfContainer = $contentWrapper.offset().top + $contentWrapper.outerHeight();
425
426    stop = endOfContainer - $stickySidebar.outerHeight();
427
428    if ( $( '.header.sticky' ).length > 0 ) {
429      var tmp = stop;
430      stop    = tmp - $( '.header.sticky' ).outerHeight();
431    }
432
433    return stop;
434  }
435
436  /**
437   * Calculates correct CSS 'top' value
438   *
439   * @returns {number} top
440   */
441  function calculateTop() {
442    var top = 0;
443
444    if ( $( '.header.sticky' ).length > 0 ) {
445      top = $( '.header.sticky' ).outerHeight();
446    }
447
448    return top;
449  }
450
451  /**
452   * Calculate when the 'sidebar' reached the ends of the main content container
453   *
454   * @returns {int}
455   */
456  function calculateBottom() {
457    return -$contentWrapper.outerHeight() + $stickySidebar.outerHeight();
458  }
459
460  /**
461   * Helper function for setting CSS props
462   *
463   * @param {jQuery} $el
464   * @param {object} options
465   */
466  function setCSSProps( $el, options ) {
467    $el.css( options );
468  }
469
470  function setStickySidebar() {
471    windowScrollTop = $( window ).scrollTop();
472    $stickySidebar.addClass( 'sticky-sidebar' );
473
474    var options = {
475      position: 'relative',
476      top: '',
477      bottom: ''
478    };
479
480    if ( windowScrollTop >= startSticky && windowScrollTop < stopSticky ) {
481      options = {
482        position: 'fixed',
483        top: top,
484        bottom: ''
485      };
486    }
487
488    if ( windowScrollTop >= stopSticky ) {
489      options = {
490        position: 'absolute',
491        top: '',
492        bottom: bottom
493      };
494    }
495
496    setCSSProps( $stickySidebar, options );
497  }
498
499  function removeStickyness() {
500    var options = {
501      position: '',
502      top: '',
503      bottom: ''
504    };
505
506    setCSSProps( $stickySidebar, options );
507  }
508
509  return {
510    init: function ( sel, container, contentWrapper ) {
511      $contentWrapper   = $( contentWrapper );
512      $sidebarContainer = $( container, $contentWrapper );
513      $stickySidebar    = $( sel, $contentWrapper );
514
515      if ( !stickySidebar ) {
516        return;
517      }
518
519      $( window ).on( 'load resize', function () {
520        startSticky = calculateStart();
521        stopSticky  = calculateStop();
522        top         = calculateTop();
523        bottom      = calculateBottom();
524
525        $stickySidebar.width( $sidebarContainer.width() );
526
527        $( window ).scroll( function () {
528          if ( $( window ).scrollTop() > 0 && $( window ).width() > 992 ) {
529            setStickySidebar();
530          } else {
531            removeStickyness();
532          }
533        } );
534      } );
535    }
536  }
537}
537)( jQuery );
538
539/**
540 * Code to provide shiv to placeholders
541 */
542function placeholderShiv( $ ) {
543  // Test for native browser support, exit if it exists
544  var i = document.createElement( 'input' );
545  if ( 'placeholder' in i ) {
546    return;
547  }
548
549  $( 'input[placeholder], textarea[placeholder], select[placeholder]' ).focus(
550    function () {
551      if ( $( this ).val() == $( this ).attr( 'data-original-ph' ) ) {
552        $( this ).val( '' );
553        $( this ).removeClass( 'placeholder' );
554      }
555    }
556  ).blur( function () {
557      if ( $( this ).val() == '' ) {
558        $( this ).val( $( this ).attr( 'data-original-ph' ) );
559        $( this ).addClass( 'placeholder' );
560      }
561    }
562  ).each( function () {
563      $( this ).attr( 'data-original-ph', $( this ).attr( 'placeholder' ) );
564      if ( $( this ).is( ':required' ) ) {
565        $( this ).addClass( 'required' );
566      }
567    }
568  ).trigger( 'blur' );
569
570  $( 'input[placeholder], textarea[placeholder], select[placeholder]' ).closest( 'form' ).submit(
571    function () {
572      $( 'input[placeholder], textarea[placeholder], select[placeholder]' ).each(
573        function () {
574          if ( $( this ).val() == $( this ).attr( 'data-original-ph' ) ) {
575            $( this ).val( '' );
576            $( this ).removeClass( 'placeholder' );
577          }
578        }
579      );
580    }
581  );
582}
583
584/**
585 * Code for BindTestimonials
586 *
587 */
588var bindTestimonials = (function () {
589  var $;
590  var testi_container;
591  var testi_controls;
592  var animate      = false;
593  var controls     = false;
594  var controlsMove = false;
595  var auto         = false;
596  var max_height   = 0;
597  var testi_pause  = false;
598  var testi_delay  = 5000;
599  var testiTimer;
600  var testiDebounceTimer;
601  var running      = false;
602
603  function runTestimonials() {
604    if ( testi_pause ) {
605      return;
606    }
607
608    running = true;
609    incrementTestimonial( 1, true );
610  }
611
612  function incrementTestimonial( dir, auto ) {
613    var cur = testi_container.find( 'li:visible' ).first();
614    var nex = (dir > 0) ? cur.next() : cur.prev();
615
616    if ( nex.length < 1 ) {
617      var sel = (dir > 0) ? 'li:first' : 'li:last';
618      nex     = testi_container.find( sel );
619    }
620
621    if ( !auto ) {
622      var top = testi_container.offset().top;
623      $( 'html, body' ).animate( { scrollTop: top } );
624    }
625
626    cur.fadeOut( 500, function () {
627      testi_container.children( 'li' ).removeClass( 'active' );
628      nex.addClass( 'active' ).fadeIn( 500 );
629      clearTimeout( testiTimer );
630
631      if ( auto ) {
632        testiTimer = setTimeout( function () {
633          runTestimonials();
634        }, testi_delay );
635      }
636    } );
637
638    testi_controls.fadeOut( 400, function () {
639      testi_controls.fadeIn( 700 );
640    } );
641  }
642
643  function testiDebounce() {
644    clearTimeout( testiDebounceTimer );
645
646    testiDebounceTimer = setTimeout( function () {
647      setMaxHeight();
648      //runTestimonials();
649    }, 300 );
650  }
651
652  /**
653   * Only run when we're animating.  This sets the viewport to a single testimonial
654   */
655  function setMaxHeight() {
656    if ( controlsMove ) {
657      setMaxHeightWidget();
658    } else {
659      setMaxHeightItems();
660    }
661
662    testi_container.children( 'li' ).hide();
663
664    if ( testi_container.children( 'li.active' ).length < 1 ) {
665      testi_container.children( 'li:first' ).show();
666    } else {
667      testi_container.children( 'li.active' ).show();
668    }
669  }
670
671  function setMaxHeightItems() {
672    // Without this, the height calculation may be incorrect (if there's an item at the top with a margin)
673    testi_container.children( 'li' ).css( { paddingTop: '1px', position: 'relative', height: 'auto' } );
674    // Get the maximimum height of all the li elements, so we can set the entire thing to the right height
675    max_height = Math.max.apply( null, $( ".widget_acg_testimonials_widget li" ).map( function () {
676      return $( this ).outerHeight();
677    } ).get() );
678
679    testi_container.css( { height: max_height, position: 'relative' } );
680
681    testi_container.children( 'li' ).css( { position: 'absolute', top: 0, left: 0, height: max_height } );
682  }
683
684  /**
685   * Only run when we're animating.  This sets the viewport to a single testimonial
686   */
687  function setMaxHeightWidget() {
688    // Without this, the hieght calculation may be incorrect (if there's an item at the top with a margin)
689    testi_container.children( 'li' ).css( { paddingTop: '1px', position: 'relative', height: 'auto' } );
690    // Get the maximimum height of all the li elements, so we can set the entire thing to the right height
691    max_height = Math.max.apply( null, $( ".widget_acg_testimonials_widget li" ).map( function () {
692      return $( this ).outerHeight();
693    } ).get() );
694
695    max_height += testi_controls.outerHeight();
696
697    testi_container.closest( '.widget' ).css( { height: max_height, position: 'relative' } );
698  }
699
700  function setAnimation() {
701    if ( testi_container.hasClass( 'animate-controls' ) ) {
702      controls = true;
703    }
704
705    if ( testi_container.hasClass( 'action-animate' ) ) {
706      animate = true;
707    }
708
709    if ( testi_container.hasClass( 'animate-animate' ) ) {
710      auto = true;
711    }
712
713    if ( testi_container.hasClass( 'controls-move' ) ) {
714      controlsMove = true;
715    }
716  }
717
718  function animationStyles() {
719    if ( animate ) {
720      setMaxHeight();
721    }
722
723    if ( controls ) {
724      $( '.testi_controls li.control a' ).click(
725        function () {
726          var dir = $( this ).hasClass( 'prev' ) ? -1 : 1;
727          incrementTestimonial( dir, false );
728        }
729      );
730
731      $( '.testi_controls a.pause' ).click(
732        function () {
733          testi_pause = (testi_pause == false);
734          if ( !testi_pause ) {
735            $( this ).html( 'Pause' ).removeClass( 'paused' );
736            incrementTestimonial( 1, true );
737          } else {
738            $( this ).html( 'Unpause' ).addClass( 'paused' );
739          }
740        }
741      );
742    }
743
744    if ( auto ) {
745      runTestimonials();
746    }
747  }
748
749  function startAnimation() {
750    if ( animate ) {
751      $( window ).on( 'resize', testiDebounce );
752    }
753
754    if ( auto ) {
755      runTestimonials();
756    }
757  }
758
759  return {
760    init: function () {
761      $               = jQuery;
762      testi_container = $( '.widget_acg_testimonials_widget > ul:first' );
763      if ( testi_container.length < 1 || testi_container.find( 'li' ).length < 1 ) {
764        return;
765      }
766
767      testi_controls = $( '.widget_acg_testimonials_widget > ul.testi_controls' );
768
769      testi_delay = $( '.widget_acg_testimonials_widget > ul:first' ).attr( 'data-delay' ) || 5000;
770
771      setAnimation();
772      animationStyles();
773      startAnimation();
774    }
775  }
776})();
777
778/**
779 * Code to make videos responsive
780 * @param jQuery - $
781 */
782function responsiveVideos( $ ) {
783  // Find all YouTube and Vimeo videos
784  var $allVideos = $( "iframe[src*='//player.vimeo.com'], iframe[src*='//www.youtube.com']" );
785  if ( typeof $allVideos != 'undefined' && $allVideos ) {
786    // Figure out and save aspect ratio for each video
787    $allVideos.each( function () {
788      var w = $( this ).attr( 'width' );
789      var h = $( this ).attr( 'height' );
790
791      if ( isNaN( parseFloat( w ) ) || isNaN( parseFloat( h ) ) ) {
792        w = $( this ).width();
793        h = $( this ).height();
794      }
795
796      var a = h / w;
797      $( this )
798        .data( 'aspectRatio', a )
799        .removeAttr( 'height' )
800        .removeAttr( 'width' );
801
802    } );
803  }
804
805  // When the window is resized
806  $( window ).resize( function () {
807    // Resize all videos according to their own aspect ratio
808    $allVideos.each( function () {
809      var newWidth = $( this ).parent().width();
810      var $el      = $( this );
811      $el.width( newWidth ).height( newWidth * $el.data( 'aspectRatio' ) );
812    } );
813
814    // Kick off one resize to fix all videos on page load
815  } ).resize();
816}
817
818/**
819 * Code for Fancy RecentPosts
820 */
821var fancyRecentPosts = {};
822
823fancyRecentPosts = (function () {
824  var $;
825  var container;
826  var on;
827  var current;
828  var mask;
829  var top;
830  var left;
831  var width;
832  var height;
833  var timeout;
834
835  function bindPosts() {
836    container.css( { position: 'relative', overflow: 'hidden' } );
837    container.find( 'li' ).hoverIntent(
838      function () {
839        setOn( true, $( this ) );
840      }
841    );
842
843    container.hoverIntent(
844      function () {
845        on = true;
846      },
847      function ( e ) {
848        on = false;
849        clearOn( e );
850      }
851    );
852  }
853
854  function setOn( on, el ) {
855    clearTimeout( timeout );
856    if ( $( el )[ 0 ] === $( current )[ 0 ] ) {
857      return;
858    }
859    current    = el;
860    var offset = current.position();
861    top        = offset.top;
862    left       = current.offset().left;
863    width      = current.width();
864    height     = current.height();
865
866    if ( !on ) {
867      mask.css( { left: left } );
868    }
869
870    on = true;
871    animateHere();
872  }
873
874  function clearOn( e ) {
875    timeout = setTimeout( function () {
876        top     = (e.pageY < (container.position().top + 10)) ? (mask.height() * -1) : container.height();
877        top *= 1.05;
878        on      = false;
879        current = null
880        mask.stop( true, true ).animate( { top: top, left: left }, 100 );
881      }
882      , 150 );
883  }
884
885  function setupMask() {
886    var el = $( '<a />' );
887    el.prop( 'id', 'mask' );
888    el.css( { position: 'absolute', left: 0, top: -1000, zIndex: '255555' } );
889    container.append( el );
890    mask = container.find( '#mask' );
891    mask.css( 'z-index', 2 );
892  }
893
894  function animateHere() {
895    setContents();
896    mask.css( { width: width, height: height } );
897    if ( Math.abs( left - mask.position().left ) > 5 ) {
898      mask.animate( { left: left }, 200, function () {
899        mask.animate( { top: top }, 200 );
900      } );
901    } else {
902      mask.animate( { top: top } );
903    }
904  }
905
906  function setContents() {
907    mask.html( current.find( '.content' ).html() );
908    mask.attr( 'href', current.find( 'a' ).attr( 'href' ) );
909  }
910
911  return {
912    init: function () {
913      $ = jQuery;
914      if ( $( '.widget_recent_posts_featured_image_author ul.fancy_hover' ).length > 0 ) {
915        container = $( '.widget_recent_posts_featured_image_author' );
916        container.find( 'ul' ).wrap( '<div class="mask_container" />' );
917        container = container.find( 'div.mask_container' );
918        container.find( 'ul' ).css( 'z-index', 1 );
919        bindPosts();
920        setupMask();
921      } else {
922        return;
923      }
924    }
925  }
926})();
927
928/**
929 * Code to add navigation line that glides / animates left / right on hover.
930 * Usage:
931 * add the class "nav-glide" to any nav to enable this.
932 * Add the class "nav-glide-include-padding" to cause the line to be as wide as the whole LI (rather than just the text)
933 * Style the elements to get the desired look:
934 * .nav-line - this will allow you to present a line across the whole navigation
935 * .nav-glider  the element that underlines the current / hovered li
936 */
937
938var acgNavGlide = {};
939
940acgNavGlide = (function () {
941  var $;
942  var timer;
943  var bound;
944
945  function setUp( el ) {
946    $( window ).bind( 'resize.glider', function () {
947      checkIfResponsive( el );
948    } );
949
950    checkIfResponsive( el );
951  }
952
953  function bind( el ) {
954    var ul = el.find( 'ul' ).first();
955
956    var left = ul.position().left;
957    var w    = 0;
958    ul.children( 'li' ).each( function () {
959      w += $( this ).outerWidth();
960    } );
961    var pad = getPadding( ul.children( 'li' ).first() );
962
963    var line = $( '<div class="nav-line"></div>' );
964    line.css( { width: w, left: left } );
965
966    var liner = $( '<div class="nav-liner"></div>' );
967    liner.css( { position: 'relative', width: '100%' } );
968
969    var span = $( '<span class="glider"></span>' );
970    span.css( { left: '-999em' } );
971
972    liner.append( span );
973    line.append( liner );
974    ul.after( line );
975
976    var active = getActiveElement( ul );
977    moveTo( active );
978
979    ul.children( 'li' ).hoverIntent(
980      function () {
981        glideTo( $( this ) );
982      },
983      function () {
984        if ( !$( this ).closest( 'ul' ).is( ':hover' ) ) {
985          var li = getActiveElement( $( this ).closest( 'ul' ) );
986          timer  = setTimeout( function () {
987            glideTo( li )
988          }, 450 );
989        }
990      }
991    );
992
993    bound = true;
994  }
995
996  function glideTo( el ) {
997    clearTimeout( timer );
998    var left = getLeft( el );
999    var w    = getWidth( el );
1000    el.closest( 'nav' ).find( 'span.glider' ).stop().animate( { left: left, width: w }, 'easeInQuad' );
1001  }
1002
1003  function moveTo( el ) {
1004    var left = getLeft( el );
1005    var w    = getWidth( el );
1006    el.closest( 'nav' ).find( 'span.glider' ).css( { left: left, width: w } );
1007  }
1008
1009  function getWidth( el ) {
1010    var w   = el.width();
1011    var pad = getPadding( el );
1012    w -= pad;
1013    return w;
1014  }
1015
1016  function getLeft( el ) {
1017    var left = el.position().left;
1018    var pad  = getPadding( el );
1019    left += (pad / 2);
1020    return left;
1021  }
1022
1023  function getPadding( el ) {
1024    if ( el.closest( 'nav' ).hasClass( 'nav-glide-include-padding' ) ) {
1025      return 0;
1026    }
1027    var pad = el.innerWidth() - el.width();
1028    pad += (el.find( 'a' ).first().innerWidth() - el.find( 'a' ).first().width());
1029    return pad;
1030  }
1031
1032  function getActiveElement( ul ) {
1033    var current = ul.children( '.current-menu-ancestor' );
1034    if ( !current.length ) {
1035      current = ul.children( '.current-menu-item' )
1036    }
1037    if ( !current.length ) {
1038      // How did we get here?
1039    }
1040    return current;
1041  }
1042
1043  /**
1044   * This effect causes mobile devices to require a double-tap to go to the page.
1045   * So, with this function, we watch to see if the menu is responsive or not, and
1046   * unbind the effects if so.
1047   */
1048  function checkIfResponsive( el ) {
1049    responsive = (el.find( 'label.toggle' ).is( ':visible' )) ? true : false;
1050
1051    if ( responsive ) {
1052      if ( bound ) {
1053        var ul = el.find( 'ul' ).first();
1054        ul.children( 'li' ).unbind( 'hoverIntent' );
1055        ul.children( 'li' ).unbind( "mouseenter" ).unbind( "mouseleave" );
1056        ul.children( 'li' ).removeProp( 'hoverIntent_t' );
1057        ul.children( 'li' ).removeProp( 'hoverIntent_s' );
1058        bound = false;
1059      }
1060    } else {
1061      if ( !bound ) {
1062        bind( el );
1063      }
1064    }
1065  }
1066
1067  return {
1068    init: function ( sel ) {
1069      $ = jQuery;
1070
1071      $( sel ).each( function () {
1072        setUp( $( this ) );
1073      } );
1074    }
1075  }
1076})();
1077
1078//Provides lightbox for Gallery with specific class from template.
1079var acgLightbox = {};
1080
1081(function ( $ ) {
1082  $.fn.acgLightbox = function () {
1083    return this.each( function () {
1084      var h;
1085      var p;
1086      var w;
1087      var s;
1088      var item_name;
1089      var $container          = $( this );
1090      var $items;
1091      var blur;
1092      var lbwrap;
1093      var lb;
1094      var curdisplay;
1095      var prev;
1096      var next;
1097      var close;
1098      var KEYCODE_LEFT_ARROW  = 37;
1099      var KEYCODE_RIGHT_ARROW = 39;
1100      var KEYCODE_ENTER       = 13;
1101      var KEYCODE_ESC         = 27;
1102
1103      $container.find( 'br' ).remove();
1104      item_name = '.gallery-item';
1105      assignData();
1106      setPort();
1107      bindEvents();
1108
1109      function removeBlur() {
1110        $( '#blur, #lbwrap' ).fadeOut( 500, function () {
1111          $( this ).remove();
1112        } );
1113      }
1114
1115      function setPort() {
1116        h = $( document ).height();
1117        p = $( window ).height();
1118        w = $( window ).width();
1119        s = $( document ).scrollTop();
1120      }
1121
1122      function showLightbox() {
1123        blur = $( '<div />' );
1124        blur.attr( 'id', 'blur' );
1125        blur.css( {
1126          position: 'absolute',
1127          top: 0,
1128          left: 0,
1129          width: '100%',
1130          height: h,
1131          background: 'black',
1132          opacity: .7,
1133          zIndex: 255555
1134        } );
1135        blur.click(
1136          function () {
1137            removeBlur();
1138          }
1139        );
1140
1141        $( 'body' ).append( blur );
1142
1143        lbwrap = $( '<div />' );
1144        lbwrap.attr( 'id', 'lbwrap' );
1145        lbwrap.css( {
1146          position: 'absolute',
1147          top: 0,
1148          left: 0,
1149          width: '100%',
1150          height: h,
1151          background: 'transparent',
1152          zIndex: 255556,
1153          textAlign: 'center'
1154        } );
1155
1156        lb = $( '<div />' );
1157        lb.attr( 'id', 'lightbox' );
1158        lb.css( {
1159          position: 'relative',
1160          boxSizing: 'content-box',
1161          margin: '0 auto',
1162          width: 0,
1163          height: 0,
1164          marginTop: (p / 2)
1165        } );
1166
1167        close = $( '<a href="javascript:void(0);" class="fa fa-times close"><span>X</span></a>' );
1168        lb.append( close );
1169
1170        close.click(
1171          function ( event ) {
1172            event.stopPropagation();
1173            removeBlur();
1174          }
1175        );
1176
1177        lbwrap.append( lb );
1178
1179        $( 'body' ).append( lbwrap );
1180      }
1181
1182      function setCounts() {
1183        if ( lb.find( 'p' ).length <= 0 ) {
1184          var p = $( '<p />' );
1185          p.attr( 'class', 'controlwrapper' );
1186          //p.css({color: '#aaa', fontSize: '13px', textAlign: 'left', padding: 0, fontFamily: 'Arial, Helvetica, SansSerif', position: 'absolute', left: 10, bottom: 0, width: '100%'});
1187          curdisplay = $( '<span class="current" />' );
1188          //p.append(curdisplay);
1189          //p.append(' of ' + (galleryImages.length));
1190
1191          var controls = $( '<span />' );
1192          controls.attr( 'class', 'controls' );
1193          //controls.css({float: 'right', marginRight: 10, textAlign: 'right'});
1194          html = '';
1195
1196          //var css = {display: 'inline-block', color: 'white', padding: '0 5px'};
1197          prev = $( '<a class="prev" href="javascript:void(0);"><i class="fa fa-arrow-left"></i></a>' );
1198          next = $( '<a class="next" href="javascript:void(0);"><i class="fa fa-arrow-right"></i></a>' );
1199
1200          //prev.css(css);
1201          //next.css(css);
1202
1203          controls.append( prev );
1204          controls.append( next );
1205
1206          prev.click(
1207            function ( event ) {
1208              event.stopPropagation();
1209              incrementImage( -1 );
1210            }
1211          );
1212
1213          next.click(
1214            function ( event ) {
1215              event.stopPropagation();
1216              incrementImage( 1 );
1217            }
1218          );
1219
1220          p.append( controls );
1221          lb.append( p );
1222        }
1223
1224        if ( current > 0 ) {
1225          prev.show();
1226        } else {
1227          prev.hide();
1228        }
1229
1230        if ( current < ($items.length - 1) ) {
1231          next.show();
1232        } else {
1233          next.hide();
1234        }
1235
1236        curdisplay.html( parseFloat( current ) + 1 );
1237      }
1238
1239      function setCaption() {
1240        lb.find( '.lb-caption-container' ).remove();
1241        var lbcontainer = $( '<div class="lb-caption-container"></div>' );
1242        lb.append( lbcontainer );
1243        var title = $( '[data-index="' + current + '"] dd.wp-title-text' ).html();
1244        lbcontainer.append( '<div class="lb-title">' + title + '</div>' );
1245        var caption = $( '[data-index="' + current + '"] dd.wp-caption-text' ).html();
1246        lbcontainer.append( '<div class="lb-caption">' + caption + '</div>' );
1247      }
1248
1249      function incrementImage( add ) {
1250        current = parseFloat( current );
1251
1252        if ( isNaN( current ) ) {
1253          current = 0;
1254        }
1255
1256        current += add;
1257
1258        if ( current > ($items.length - 1) ) {
1259          current = 0;
1260        } else if ( current < 0 ) {
1261          current = $items.length - 1;
1262        }
1263
1264        transitionImage( true );
1265      }
1266
1267      function transitionImage( hide ) {
1268        setPort();
1269
1270        var img = $items.eq( current ).attr( 'data-src' );
1271        if ( !img ) {
1272          img = $( galleryImages[ current ] );
1273        } else {
1274          img = $( '<img src="' + img + '">' );
1275        }
1276
1277        var iw = img[ 0 ].width;
1278        var ih = img[ 0 ].height;
1279        var ip = iw / ih;
1280        var tw = iw * .9;
1281        var th = ih * .9;
1282
1283        if ( tw > w ) {
1284          tw = (w - 40);
1285          th = tw / ip;
1286        }
1287
1288        if ( (th + 60) > p ) {
1289          th = (p - 70);
1290          tw = th * ip
1291        }
1292
1293        var lw = tw;
1294        var lh = th + 0;
1295
1296        var mt = (s + (p - lh) / 2) - 15;
1297
1298        var int = 400;
1299        if ( hide ) {
1300          lb.find( 'img, .lb-caption' ).remove();
1301          img.css( { width: tw, height: th } );
1302        } else {
1303          int = 200;
1304          lb.find( 'img' ).stop( true, true ).animate( { width: tw, height: th }, int );
1305        }
1306
1307        close.hide();
1308
1309        lb.stop( true, true ).animate( { width: lw, height: lh, marginTop: mt }, int, function () {
1310          if ( hide ) {
1311            close.fadeIn();
1312            lb.prepend( img );
1313            setCaption();
1314            setCounts();
1315          }
1316        } );
1317      }
1318
1319      function assignData() {
1320        $items = $container.find( item_name );
1321        $container.find( item_name ).each(
1322          function () {
1323            $( this ).attr( 'data-index', $( this ).index() ).addClass( 'item' );
1324          }
1325        );
1326      }
1327
1328      function bindEvents() {
1329        $container.on( 'click', '.item a', function ( event ) {
1330          event.preventDefault();
1331          current = $( this ).closest( '.item' ).attr( 'data-index' );
1332          showLightbox();
1333          setCounts();
1334
1335          lbwrap.click(
1336            function () {
1337              removeBlur();
1338            }
1339          );
1340
1341          lb.click(
1342            function ( event ) {
1343              event.stopPropagation();
1344              incrementImage( 1 );
1345            }
1346          );
1347
1348          transitionImage( true );
1349        } );
1350
1351        $( window ).resize( function () {
1352            if ( lb && lb.is( ':visible' ) ) {
1353              transitionImage( false );
1354            }
1355          }
1356        );
1357
1358        $( document ).keyup( function ( e ) {
1359          if ( e.keyCode == KEYCODE_LEFT_ARROW ) {
1360            incrementImage( -1 );
1361          }
1362          if ( e.keyCode == KEYCODE_RIGHT_ARROW ) {
1363            incrementImage( 1 );
1364          }
1365          if ( e.keyCode == KEYCODE_ESC ) {
1366            removeBlur();
1367          }
1368        } );
1369      }
1370
1371    } );
1372  }
1373}
1373)( jQuery );
1374
1375//Customized Masonry class.  Provides lightbox, initiates Masonry.
1376var acgMasonry = {};
1377
1378acgMasonry = (function () {
1379  var $;
1380  var h;
1381  var p;
1382  var w;
1383  var s;
1384  var blur;
1385  var lbwrap;
1386  var lb;
1387  var close;
1388
1389  var socialMediaTemplate = {
1390    linkedin: 'LinkedIn',
1391    facebook: 'Facebook',
1392    twitter: 'Twitter',
1393    google_plus: ' Google Plus'
1394  };
1395
1396  var metaDataTemaplate = [
1397    'facebook',
1398    'linkedin',
1399    'twitter',
1400    'google_plus',
1401    'external_link_text',
1402    'external_link_url'
1403  ];
1404
1405  //var KEYCODE_LEFT_ARROW  = 37;
1406  //var KEYCODE_RIGHT_ARROW = 39;
1407  //var KEYCODE_ESC         = 27;
1408  var $container;
1409  var $member;
1410  var maxWidth;
1411  var debounce;
1412
1413  function removeBlur() {
1414    $( '#blur, #lbwrap' ).fadeOut( 500, function () {
1415      $( this ).remove();
1416    } );
1417  }
1418
1419  function setPort() {
1420    h = $( document ).height();
1421    p = $( window ).height();
1422    w = $( window ).width();
1423    s = $( document ).scrollTop();
1424  }
1425
1426  function showLightbox() {
1427    blur = $( '<div />' );
1428    blur.attr( 'id', 'blur' );
1429    blur.css( {
1430      position: 'fixed',
1431      top: 0,
1432      left: 0,
1433      width: '100%',
1434      height: '100%',
1435      background: 'black',
1436      opacity: .7,
1437      zIndex: 255555
1438    } );
1439    blur.click(
1440      function () {
1441        removeBlur();
1442      }
1443    );
1444
1445    $( 'body' ).append( blur );
1446
1447    lbwrap = $( '<div />' );
1448    lbwrap.attr( 'id', 'lbwrap' );
1449    lbwrap.css( {
1450      position: 'fixed',
1451      top: 0,
1452      left: 0,
1453      width: '100%',
1454      height: '100%',
1455      background: 'transparent',
1456      zIndex: 255556,
1457    } );
1458
1459    lb = $( '<div />' );
1460    lb.attr( 'id', 'lightbox' );
1461    lb.addClass( 'lightbox-content' );
1462    lb.css( {
1463      position: 'absolute',
1464      boxSizing: 'content-box'
1465    } );
1466
1467    close = $( '<a href="javascript:void(0);" class="fa fa-times close"><span>X</span></a>' );
1468    lb.append( close );
1469
1470    lb.append( retrieveTeamMember() );
1471
1472    close.click(
1473      function ( event ) {
1474        event.stopPropagation();
1475        removeBlur();
1476      }
1477    );
1478
1479    lbwrap.append( lb );
1480
1481    $( 'body' ).append( lbwrap );
1482  }
1483
1484  /**
1485   * Create and return HTML elements with member data (using mosaicTeamData as the array that holds 
1485serialized team data)
1486   *
1487   * @returns {*|jQuery|HTMLElement}
1488   */
1489  function retrieveTeamMember() {
1490    var memberID       = $member.data( 'id' );
1491    var memberData     = mosaicTeamData[ memberID ];
1492    var memberMetaData = memberData.meta_data;
1493
1494    var contentWrapper = $( '<div/>' );
1495    contentWrapper.attr( 'class', 'team-member-wrapper' );
1496
1497    var memberInfoWrapper = $( '<div/>' ).attr( 'class', 'team-member-info' );
1498
1499    var title    = $( '<h1/>' ).append( memberData.title );
1500    var position = $( '<h2/>' ).append( memberMetaData[ 'position' ] );
1501    var bio      = $( '<div />' ).addClass( 'bio' ).append( memberData.bio );
1502
1503    memberInfoWrapper.append( title, position, bio );
1504
1505    // Check for team member photo
1506    if ( memberData.image ) {
1507      contentWrapper.append( createImage( memberData.image, 'Team Member Photo', 'team-member-photo' ) );
1508    }
1509
1510    // Create anchor links for social media
1511    metaDataTemaplate.forEach( function ( value ) {
1512      if ( value.indexOf( 'external' ) === -1 && memberMetaData[ value ] ) {
1513        var metaWrapper = $( '<div/>' ).addClass( value );
1514        var anchor      = createAnchorLink( memberMetaData[ value ], socialMediaTemplate[ value ], memberMetaData[ value ] );
1515
1516        metaWrapper.append( anchor );
1517        memberInfoWrapper.append( metaWrapper );
1518      }
1519    } );
1520
1521    //Create anchor link with external_link fields
1522    if ( memberMetaData.external_link_text && memberMetaData.external_link_url ) {
1523      var metaWrapper = $( '<div/>' ).attr( 'class', 'external_link_text' );
1524      var anchor      = createAnchorLink( memberMetaData.external_link_url, memberMetaData.external_link_text, 'external_link_text' );
1525
1526      metaWrapper.append( anchor );
1527      memberInfoWrapper.append( metaWrapper );
1528    }
1529
1530    contentWrapper.append( memberInfoWrapper );
1531
1532    return contentWrapper;
1533  }
1534
1535  /**
1536   * Create an 'a' HTML element
1537   *
1538   * @param url
1539   * @param text
1540   * @param className
1541   * @returns {void | * | jQuery}
1542   */
1543  function createAnchorLink( url, text, className ) {
1544    return $( "<a target='_blank'/>" ).attr( 'href', url ).addClass( className ).append( text );
1545  }
1546
1547  /**
1548   * Create a 'img' HTML element and wrap it in a 'div'
1549   *
1550   * @param src
1551   * @param alt
1552   * @param wrapperClass
1553   * @returns {*|void|jQuery}
1554   */
1555  function createImage( src, alt, wrapperClass ) {
1556    var wrapper = $( '<div/>' ).addClass( wrapperClass );
1557    var img     = $( '<img />' ).attr( {
1558      src: src,
1559      alt: alt
1560    } );
1561
1562    wrapper.append( img );
1563
1564    return wrapper;
1565  }
1566
1567  function bindEvents() {
1568    $container.on( 'click', '.team-member', function ( event ) {
1569      event.preventDefault();
1570      $member = $( this );
1571      current = $( this ).closest( 'li' ).attr( 'data-index' );
1572
1573      if ( !current ) {
1574        current = $( this ).closest( '.item' ).attr( 'data-id' );
1575      }
1576
1577      showLightbox();
1578
1579      lbwrap.click(
1580        function () {
1581          removeBlur();
1582        }
1583      );
1584
1585      lb.click(
1586        function ( event ) {
1587          event.stopPropagation();
1588        }
1589      );
1590    } );
1591
1592    $( window ).resize( function () {
1593        clearTimeout( debounce );
1594      }
1595    );
1596
1597    $( document ).keyup( function ( e ) {
1598      removeBlur();
1599    } );
1600  }
1601
1602  return {
1603    init: function ( sel ) {
1604      $          = jQuery;
1605      $container = $( sel );
1606      setPort();
1607      bindEvents();
1608    }
1609
1610  }
1611})();
1612
1613var megaMenu = (function ( $ ) {
1614  var $megaMenus;
1615
1616  /**
1617   * Set up the event bindings to display / hide the mega menus
1618   */
1619  function bindEvents() {
1620    $megaMenus.each( function () {
1621      var mID = $( this ).data( 'menu-id' );
1622      var $li = $( this ).closest( 'li.menu-item-' + mID );
1623
1624      $li.data( 'menu-id', mID );
1625
1626      $li.on( 'mouseenter', function () {
1627        positionMegaMenu( $( this ) );
1628
1629        $( document ).on( 'scroll', function () {
1630          hideMegaMenu( $( this ) );
1631        } )
1632      } );
1633
1634      $li.on( 'mouseleave', function () {
1635        hideMegaMenu( $( this ) );
1636      } )
1637    } );
1638  }
1639
1640  /**
1641   * Render the appropriate mega menu item
1642   *
1643   * @param {jQuery} $li - the hovered LI item
1644   * @param menuID
1645   */
1646  function positionMegaMenu( $li ) {
1647    var $megaMenu = $li.find( 'div.mega-menu' );
1648    var top       = $li.offset().top;
1649    var liHeight  = $li.outerHeight();
1650    var scroll    = $( window ).scrollTop();
1651    top += liHeight - scroll;
1652
1653    $megaMenu.css( {
1654      position: 'fixed',
1655      top: top,
1656      display: 'block'
1657    } );
1658  }
1659
1660  function hideMegaMenu( $li ) {
1661    var $megaMenu = $li.find( 'div.mega-menu' );
1662
1663    $megaMenu.css( {
1664      display: 'none'
1665    } );
1666  }
1667
1668  return {
1669    init: function () {
1670      $megaMenus = $( 'nav#main div.mega-menu' );
1671      if ( !$megaMenus.length ) {
1672        return;
1673      }
1674
1675      bindEvents();
1676    }
1677  }
1678}
1678)( jQuery );
1679
1680/*!
1681 * imagesLoaded PACKAGED v3.1.8
1682 * JavaScript is all like "You images are done yet or what?"
1683 * MIT License
1684 */
1685(function () {
1686  function e() {
1687  }
1688
1689  function t( e, t ) {
1690    for ( var n = e.length; n--; ) if ( e[ n ].listener === t ) return n;
1691    return -1
1692  }
1693
1694  function n( e ) {
1695    return function () {
1696      return this[ e ].apply( this, arguments )
1697    }
1698  }
1699
1700  var i = e.prototype, r = this, o = r.EventEmitter;
1701  i.getListeners = function ( e ) {
1702    var t, n, i = this._getEvents();
1703    if ( "object" == typeof e ) {
1704      t = {};
1705      for ( n in i ) i.hasOwnProperty( n ) && e.test( n ) && (t[ n ] = i[ n ])
1706    } else t = i[ e ] || (i[ e ] = []);
1707    return t
1708  }, i.flattenListeners = function ( e ) {
1709    var t, n = [];
1710    for ( t = 0; e.length > t; t += 1 ) n.push( e[ t ].listener );
1711    return n
1712  }, i.getListenersAsObject = function ( e ) {
1713    var t, n = this.getListeners( e );
1714    return n instanceof Array && (t = {}, t[ e ] = n), t || n
1715  }, i.addListener = function ( e, n ) {
1716    var i, r = this.getListenersAsObject( e ), o = "object" == typeof n;
1717    for ( i in r ) r.hasOwnProperty( i ) && -1 === t( r[ i ], n ) && r[ i ].push( o ? n : {
1718      listener: n,
1719      once: !1
1720    } );
1721    return this
1722  }, i.on = n( "addListener" ), i.addOnceListener = function ( e, t ) {
1723    return this.addListener( e, { listener: t, once: !0 } )
1724  }, i.once = n( "addOnceListener" ), i.defineEvent = function ( e ) {
1725    return this.getListeners( e ), this
1726  }, i.defineEvents = function ( e ) {
1727    for ( var t = 0; e.length > t; t += 1 ) this.defineEvent( e[ t ] );
1728    return this
1729  }, i.removeListener = function ( e, n ) {
1730    var i, r, o = this.getListenersAsObject( e );
1731    for ( r in o ) o.hasOwnProperty( r ) && (i = t( o[ r ], n ), -1 !== i && o[ r ].splice( i, 1 ));
1732    return this
1733  }, i.off = n( "removeListener" ), i.addListeners = function ( e, t ) {
1734    return this.manipulateListeners( !1, e, t )
1735  }, i.removeListeners = function ( e, t ) {
1736    return this.manipulateListeners( !0, e, t )
1737  }, i.manipulateListeners = function ( e, t, n ) {
1738    var i, r, o = e ? this.removeListener : this.addListener, s = e ? this.removeListeners : this.addListeners;
1739    if ( "object" != typeof t || t instanceof RegExp ) for ( i = n.length; i--; ) o.call( this, t, n[ i ] ); else for ( i in t ) t.hasOwnProperty( i ) && (r = t[ i ]) && ("function" == typeof r ? o.call( this, i, r ) : s.call( this, i, r ));
1740    return this
1741  }, i.removeEvent = function ( e ) {
1742    var t, n = typeof e, i = this._getEvents();
1743    if ( "string" === n ) delete i[ e ]; else if ( "object" === n ) for ( t in i ) i.hasOwnProperty( t ) && e.test( t ) && delete i[ t ]; else delete this._events;
1744    return this
1745  }, i.removeAllListeners = n( "removeEvent" ), i.emitEvent = function ( e, t ) {
1746    var n, i, r, o, s = this.getListenersAsObject( e );
1747    for ( r in s ) if ( s.hasOwnProperty( r ) ) for ( i = s[ r ].length; i--; ) n = s[ r ][ i ], n.once === !0 && this.removeListener( e, n.listener ), o = n.listener.apply( this, t || [] ), o === this._getOnceReturnValue() && this.removeListener( e, n.listener );
1748    return this
1749  }, i.trigger = n( "emitEvent" ), i.emit = function ( e ) {
1750    var t = Array.prototype.slice.call( arguments, 1 );
1751    return this.emitEvent( e, t )
1752  }, i.setOnceReturnValue = function ( e ) {
1753    return this._onceReturnValue = e, this
1754  }, i._getOnceReturnValue = function () {
1755    return this.hasOwnProperty( "_onceReturnValue" ) ? this._onceReturnValue : !0
1756  }, i._getEvents = function () {
1757    return this._events || (this._events = {})
1758  }, e.noConflict = function () {
1759    return r.EventEmitter = o, e
1760  }, "function" == typeof define && define.amd ? define( "eventEmitter/EventEmitter", [], function () {
1761    return e
1762  } ) : "object" == typeof module && module.exports ? module.exports = e : this.EventEmitter = e
1763}).call( this ), function ( e ) {
1764  function t( t ) {
1765    var n = e.event;
1766    return n.target = n.target || n.srcElement || t, n
1767  }
1768
1769  var n = document.documentElement, i = function () {
1770  };
1771  n.addEventListener ? i = function ( e, t, n ) {
1772    e.addEventListener( t, n, !1 )
1773  } : n.attachEvent && (i = function ( e, n, i ) {
1774    e[ n + i ] = i.handleEvent ? function () {
1775      var n = t( e );
1776      i.handleEvent.call( i, n )
1777    } : function () {
1778      var n = t( e );
1779      i.call( e, n )
1780    }, e.attachEvent( "on" + n, e[ n + i ] )
1781  });
1782  var r = function () {
1783  };
1784  n.removeEventListener ? r = function ( e, t, n ) {
1785    e.removeEventListener( t, n, !1 )
1786  } : n.detachEvent && (r = function ( e, t, n ) {
1787    e.detachEvent( "on" + t, e[ t + n ] );
1788    try {
1789      delete e[ t + n ]
1790    } catch ( i ) {
1791      e[ t + n ] = void 0
1792    }
1793  });
1794  var o = { bind: i, unbind: r };
1795  "function" == typeof define && define.amd ? define( "eventie/eventie", o ) : e.eventie = o
1796}( this ), function ( e, t ) {
1797  "function" == typeof define && define.amd ? define( ["eventEmitter/EventEmitter", "eventie/eventie"], function ( n, i ) {
1798    return t( e, n, i )
1799  } ) : "object" == typeof exports ? module.exports = t( e, require( "wolfy87-eventemitter" ), require( "eventie" ) ) : e.imagesLoaded = t( e, e.EventEmitter, e.eventie )
1800}( window, function ( e, t, n ) {
1801  function i( e, t ) {
1802    for ( var n in t ) e[ n ] = t[ n ];
1803    return e
1804  }
1805
1806  function r( e ) {
1807    return "[object Array]" === d.call( e )
1808  }
1809
1810  function o( e ) {
1811    var t = [];
1812    if ( r( e ) ) t = e; else if ( "number" == typeof e.length ) for ( var n = 0,
1813                                                                           i = e.length; i > n; n++ ) t.push( e[ n ] ); else t.push( e );
1814    return t
1815  }
1816
1817  function s( e, t, n ) {
1818    if ( !(this instanceof s) ) return new s( e, t );
1819    "string" == typeof e && (e = document.querySelectorAll( e )), this.elements = o( e ), this.options = i( {}, this.options ), "function" == typeof t ? n = t : i( this.options, t ), n && this.on( "always", n ), this.getImages(), a && (this.jqDeferred = new a.Deferred);
1820    var r = this;
1821    setTimeout( function () {
1822      r.check()
1823    } )
1824  }
1825
1826  function f( e ) {
1827    this.img = e
1828  }
1829
1830  function c( e ) {
1831    this.src = e, v[ e ] = this
1832  }
1833
1834  var a = e.jQuery, u = e.console, h = u !== void 0, d = Object.prototype.toString;
1835  s.prototype = new t, s.prototype.options = {}, s.prototype.getImages = function () {
1836    this.images = [];
1837    for ( var e = 0, t = this.elements.length; t > e; e++ ) {
1838      var n = this.elements[ e ];
1839      "IMG" === n.nodeName && this.addImage( n );
1840      var i = n.nodeType;
1841      if ( i && (1 === i || 9 === i || 11 === i) ) for ( var r = n.querySelectorAll( "img" ), o = 0,
1842                                                             s                                  = r.length; s > o; o++ ) {
1843        var f = r[ o ];
1844        this.addImage( f )
1845      }
1846    }
1847  }, s.prototype.addImage = function ( e ) {
1848    var t = new f( e );
1849    this.images.push( t )
1850  }, s.prototype.check = function () {
1851    function e( e, r ) {
1852      return t.options.debug && h && u.log( "confirm", e, r ), t.progress( e ), n++, n === i && t.complete(), !0
1853    }
1854
1855    var t = this, n = 0, i = this.images.length;
1856    if ( this.hasAnyBroken = !1, !i ) return this.complete(), void 0;
1857    for ( var r = 0; i > r; r++ ) {
1858      var o = this.images[ r ];
1859      o.on( "confirm", e ), o.check()
1860    }
1861  }, s.prototype.progress = function ( e ) {
1862    this.hasAnyBroken = this.hasAnyBroken || !e.isLoaded;
1863    var t             = this;
1864    setTimeout( function () {
1865      t.emit( "progress", t, e ), t.jqDeferred && t.jqDeferred.notify && t.jqDeferred.notify( t, e )
1866    } )
1867  }, s.prototype.complete = function () {
1868    var e           = this.hasAnyBroken ? "fail" : "done";
1869    this.isComplete = !0;
1870    var t           = this;
1871    setTimeout( function () {
1872      if ( t.emit( e, t ), t.emit( "always", t ), t.jqDeferred ) {
1873        var n = t.hasAnyBroken ? "reject" : "resolve";
1874        t.jqDeferred[ n ]( t )
1875      }
1876    } )
1877  }, a && (a.fn.imagesLoaded = function ( e, t ) {
1878    var n = new s( this, e, t );
1879    return n.jqDeferred.promise( a( this ) )
1880  }), f.prototype = new t, f.prototype.check = function () {
1881    var e = v[ this.img.src ] || new c( this.img.src );
1882    if ( e.isConfirmed ) return this.confirm( e.isLoaded, "cached was confirmed" ), void 0;
1883    if ( this.img.complete && void 0 !== this.img.naturalWidth ) return this.confirm( 0 !== this.img.naturalWidth, "naturalWidth" ), void 0;
1884    var t = this;
1885    e.on( "confirm", function ( e, n ) {
1886      return t.confirm( e.isLoaded, n ), !0
1887    } ), e.check()
1888  }, f.prototype.confirm = function ( e, t ) {
1889    this.isLoaded = e, this.emit( "confirm", this, t )
1890  };
1891  var v = {};
1892  return c.prototype = new t, c.prototype.check = function () {
1893    if ( !this.isChecked ) {
1894      var e = new Image;
1895      n.bind( e, "load", this ), n.bind( e, "error", this ), e.src = this.src, this.isChecked = !0
1896    }
1897  }, c.prototype.handleEvent = function ( e ) {
1898    var t = "on" + e.type;
1899    this[ t ] && this[ t ]( e )
1900  }, c.prototype.onload = function ( e ) {
1901    this.confirm( !0, "onload" ), this.unbindProxyEvents( e )
1902  }, c.prototype.onerror = function ( e ) {
1903    this.confirm( !1, "onerror" ), this.unbindProxyEvents( e )
1904  }, c.prototype.confirm = function ( e, t ) {
1905    this.isConfirmed = !0, this.isLoaded = e, this.emit( "confirm", this, t )
1906  }, c.prototype.unbindProxyEvents = function ( e ) {
1907    n.unbind( e.target, "load", this ), n.unbind( e.target, "error", this )
1908  }, s
1909} );
1910
1911/*!
1912 * hoverIntent v1.8.0 // 2014.06.29 // jQuery v1.9.1+
1913 * http://cherne.net/brian/resources/jquery.hoverIntent.html
1914 *
1915 * You may use hoverIntent under the terms of the MIT license. Basically that
1916 * means you are free to use hoverIntent as long as this header is left intact.
1917 * Copyright 2007, 2014 Brian Cherne
1918 */
1919(function ( $ ) {
1920  $.fn.hoverIntent = function ( handlerIn, handlerOut, selector ) {
1921    var cfg = { interval: 100, sensitivity: 6, timeout: 0 };
1922    if ( typeof handlerIn === "object" ) {
1923      cfg = $.extend( cfg, handlerIn )
1924    } else {
1925      if ( $.isFunction( handlerOut ) ) {
1926        cfg = $.extend( cfg, { over: handlerIn, out: handlerOut, selector: selector } )
1927      } else {
1928        cfg = $.extend( cfg, { over: handlerIn, out: handlerIn, selector: handlerOut } )
1929      }
1930    }
1931    var cX, cY, pX, pY;
1932    var track       = function ( ev ) {
1933      cX = ev.pageX;
1934      cY = ev.pageY
1935    };
1936    var compare     = function ( ev, ob ) {
1937      ob.hoverIntent_t = clearTimeout( ob.hoverIntent_t );
1938      if ( Math.sqrt( (pX - cX) * (pX - cX) + (pY - cY) * (pY - cY) ) < cfg.sensitivity ) {
1939        $( ob ).off( "mousemove.hoverIntent", track );
1940        ob.hoverIntent_s = true;
1941        return cfg.over.apply( ob, [ev] )
1942      } else {
1943        pX               = cX;
1944        pY               = cY;
1945        ob.hoverIntent_t = setTimeout( function () {
1946          compare( ev, ob )
1947        }, cfg.interval )
1948      }
1949    };
1950    var delay       = function ( ev, ob ) {
1951      ob.hoverIntent_t = clearTimeout( ob.hoverIntent_t );
1952      ob.hoverIntent_s = false;
1953      return cfg.out.apply( ob, [ev] )
1954    };
1955    var handleHover = function ( e ) {
1956      var ev = $.extend( {}, e );
1957      var ob = this;
1958      if ( ob.hoverIntent_t ) {
1959        ob.hoverIntent_t = clearTimeout( ob.hoverIntent_t )
1960      }
1961      if ( e.type === "mouseenter" ) {
1962        pX = ev.pageX;
1963        pY = ev.pageY;
1964        $( ob ).on( "mousemove.hoverIntent", track );
1965        if ( !ob.hoverIntent_s ) {
1966          ob.hoverIntent_t = setTimeout( function () {
1967            compare( ev, ob )
1968          }, cfg.interval )
1969        }
1970      } else {
1971        $( ob ).off( "mousemove.hoverIntent", track );
1972        if ( ob.hoverIntent_s ) {
1973          ob.hoverIntent_t = setTimeout( function () {
1974            delay( ev, ob )
1975          }, cfg.timeout )
1976        }
1977      }
1978    };
1979    return this.on( { "mouseenter.hoverIntent": handleHover, "mouseleave.hoverIntent": handleHover }, cfg.selector )
1980  }
1981})( 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.