PageSourceSearch

https://www.longwood.edu/media/site-assets/public-site/javascript/main.js

js longwood.edu collected 2026-10-01 10:36:34 UTC 24,758 bytes, 665 lines download raw bytes

1(function() {
2    var T4hacks, adjustFullPageCurve, checkEventMatch, checkFilterParam, clickableHeaders, closeAlertBar, collageSlotPolyfill, contactBlockIconScaling, controlStickyTabs, filter, fullPageInit, fullPageWatch, galleryLightboxInit, getParameterByName, indentTabs, initSticky, isLarge, isMedium, isSmall, matchHeightsInit, mediumBreakpoint, mobileBreakpoint, photoButtonTeaserHandler, responsiveTabs, slickInit, stickyEngage, tabActivated, tablesInit, tablesResponsify, togglePrimaryNav, twitterQuotePopup, unmatchStackedGrids;
3
4    mediumBreakpoint = 1020;
5
6    mobileBreakpoint = 640;
7
8    isSmall = function() {
9      return matchMedia(Foundation.media_queries.small).matches && !matchMedia(Foundation.media_queries.medium).matches;
10    };
11
12    isMedium = function() {
13      return matchMedia(Foundation.media_queries.medium).matches && !matchMedia(Foundation.media_queries.large).matches;
14    };
15
16    isLarge = function() {
17      return matchMedia(Foundation.media_queries.large).matches;
18    };
19
20    tablesInit = function() {
21      return $('table').each(function(index) {
22        $(this).before('<div class="table-scroll-helper">Scroll right to view more</div>');
23        return $(this).wrap('<div class="table-responsive"></div>');
24      });
25    };
26
27    tablesResponsify = function() {
28      return $('.table-responsive').each(function(index) {
29        if ($(this).find('table').width() > $(this).width()) {
30          $(this).addClass('active');
31          return $(this).prev('.table-scroll-helper').addClass('active');
32        } else {
33          $(this).removeClass('active');
34          return $(this).prev('.table-scroll-helper').removeClass('active');
35        }
36      });
37    };
38
39    galleryLightboxInit = function() {
40      return $('.gallery-carousel').each(function(index) {
41        return $(this).magnificPopup({
42          delegate: 'a.lightbox',
43          type: 'inline',
44          closeOnContentClick: true,
45          preload: [2, 3],
46          removalDelay: 325,
47          mainClass: 'mfp-fade',
48          showCloseBtn: false,
49          gallery: {
50            enabled: true
51          }
52        });
53      });
54    };
55
56    slickInit = function() {
57      var nextArrowStr, prevArrowStr;
58      nextArrowStr = '<button type="button" class="slick-next" aria-label="Next"><i class="fa fa-fw fa-angle-right"></i></button>';
59      prevArrowStr = '<button type="button" class="slick-prev" aria-label="Previous"><i class="fa fa-fw fa-angle-left"></i></button>';
60      $('.slick-slab-carousel').slick({
61        slidesToShow: 3,
62        nextArrow: nextArrowStr,
63        prevArrow: prevArrowStr,
64        responsive: [
65          {
66            breakpoint: mediumBreakpoint,
67            settings: {
68              slidesToShow: 2
69            }
70          }, {
71            breakpoint: mobileBreakpoint,
72            settings: {
73              slidesToShow: 1
74            }
75          }
76        ]
77      });
78      $('.slick-slab-carousel').on('setPosition', function() {
79        $('.slick-track', this).attr('aria-label', 'Slideshow');
80      });
81
82      $('.slick-gallery-carousel').slick({
83        slidesToShow: 5,
84        nextArrow: nextArrowStr,
85        prevArrow: prevArrowStr,
86        responsive: [
87          {
88            breakpoint: mediumBreakpoint,
89            settings: {
90              slidesToShow: 4
91            }
92          }, {
93            breakpoint: mobileBreakpoint,
94            settings: {
95              slidesToShow: 1
96            }
97          }
98        ]
99      });
100      $('.slick-slab-carousel').on('setPosition', function() {
101        $('.slick-track', this).attr('aria-label', 'Gallery carousel');
102		$(this).find('.slick-slide').removeAttr('role');
103      });
104    };
105
106    fullPageInit = function() {
107      var anchors;
108      if (isLarge()) {
109        if (!$('.full-page-nav li').length) {
110          anchors = [];
111          $('.full-page .section').each(function(index) {
112            var sectionAnchor, sectionTitle;
113            sectionTitle = $(this).find('.block-title').html();
114            sectionAnchor = $(this).data('anchor');
115            anchors.push(sectionAnchor);
116            return $('.full-page-nav ul').append('<li data-menuanchor="' + sectionAnchor + '"><a href="#' + sectionAnchor + '">' + sectionTitle + '</a></li>');
117          });
118        }
119        $('.full-page a.full-page-scroll-down').click(function(event) {
120          event.preventDefault();
121          return $.fn.fullpage.moveSectionDown();
122        });
123        return $('.full-page').fullpage({
124          navigation: false,
125          verticalCentered: false,
126          menu: '.full-page-nav',
127          anchors: anchors,
128          onLeave: function(index, nextIndex, direction) {
129            var leavingSection;
130            leavingSection = $(this);
131            if (index === 1 && direction === 'down') {
132              $('.full-page-nav').addClass('active');
133            } else if (nextIndex === 1 && direction === 'up') {
134              $('.full-page-nav').removeClass('active');
135            } else if (index === 2 && direction === 'up') {
136              $('.full-page-nav').removeClass('active');
137            }
138          },
139          afterLoad: function() {
140            return adjustFullPageCurve();
141          }
142        });
143      }
144    };
145
146    fullPageWatch = function() {
147      if ($('.full-page').length) {
148        if (!isLarge()) {
149          $.fn.fullpage.destroy('all');
150        } else {
151          fullPageInit();
152        }
153        adjustFullPageCurve();
154      }
155    };
156
157    adjustFullPageCurve = function() {
158      $('.full-page-curve').each(function(index) {
159        var circle, contentHeight, sectionHeight;
160        circle = $(this).find('.circle-wrapper');
161        sectionHeight = $(this).outerHeight();
162        contentHeight = $(this).find('.content').height() + parseInt($(this).css('padding-top')) + 100;
163        return circle.css('bottom', sectionHeight - contentHeight);
164      });
165    };
166
167    contactBlockIconScaling = function() {
168      var iconRatio;
169      iconRatio = 0.10909090909091;
170      return $('.contact-block').each(function(index) {
171        var contactBlockOffset, contactBlockWidth, uniqueID;
172        uniqueID = 'contact-block' + index;
173        $(this).addClass(uniqueID);
174        contactBlockWidth = $(this).outerWidth();
175        contactBlockOffset = contactBlockWidth * iconRatio;
176        $(this).css('marginTop', contactBlockOffset + 40);
177        return $('<style>.' + uniqueID + '::before{top:-' + contactBlockOffset + 'px !important}</style>').appendTo('head');
178      });
179    };
180
181    twitterQuotePopup = function() {};
182
183    $('a.share-link, a.tweet-link').click(function(event) {
184      var popupHeight, popupLeft, popupTop, popupWidth;
185      event.preventDefault();
186      popupWidth = 600;
187      popupHeight = 600;
188      popupLeft = ($(window).width() / 2) - (popupWidth / 2);
189      popupTop = ($(window).height() / 2) - (popupHeight / 2);
190      return window.open($(this).attr('href'), 'popupWindow', 'width=' + popupWidth + ',height=' + popupHeight + ',scrollbars=yes,left=' + popupLeft + ',top=' + popupTop);
191    });
192
193    matchHeightsInit = function() {
194      $('.nav-list.tools .match').matchHeight();
195      $('.block-button-grid-slab .block-button').matchHeight();
196      $('.block-button-grid .block-button').matchHeight();
197      $('.bond-grid .block-button').matchHeight();
198      return $('.events-list .featured-event .match').matchHeight({
199        target: $('.event-details')
200      });
201    };
202
203    unmatchStackedGrids = function() {
204      if (isSmall()) {
205        $('.block-button-grid-slab .block-button').matchHeight({
206          remove: true
207        });
208        $('.block-button-gri .block-button').matchHeight({
209          remove: true
210        });
211        return $('.bond-grid .block-button').matchHeight({
212          remove: true
213        });
214      }
215    };
216
217    photoButtonTeaserHandler = function() {
218      $('.photo-button-teaser').each(function(index) {
219        var buttonHeight;
220        buttonHeight = $(this).find('a.button').outerHeight();
221        return $(this).find('.button-wrapper').height(buttonHeight);
222      });
223      return $('.photo-button-teaser .photo').hover(function(event) {
224        return $(this).parents('.photo-button-teaser').toggleClass('active');
225      });
226    };
227
228    togglePrimaryNav = function() {
229      return $('header.main-header a.toggle-menu').click(function(event) {
230        $(this).toggleClass('active');
231        return $('.header-primary').slideToggle();
232      });
233    };
234
235    clickableHeaders = function() {
236      return $('.homepage-collage .collage-text a').each(function(index) {
237        var $this, url, wrapper;
238        $this = $(this);
239        url = $this.attr('href');
240        wrapper = $this.parents('.collage-slot');
241        wrapper.css('cursor', 'pointer');
242        return wrapper.click(function() {
243          return window.location = url;
244        });
245      });
246    };
247
248    filter = function() {
249      $('.filtration').each(function(index) {
250        return $(this).find('ul.filters input').each(function(index) {
251          return $(this).click(function(event) {
252            var activeFilter;
253            activeFilter = $(this).data('filter');
254            if (activeFilter === "reset") {
255              return $('ul.filterable li').each(function(index) {
256                return $(this).removeClass('filter-inactive');
257              });
258            } else {
259              return $('ul.filterable li.filterable-item').each(function(index) {
260                var itemFilters;
261                $(this).removeClass('filter-inactive');
262                itemFilters = $(this).data('filter');
263                if (typeof itemFilters !== "undefined") {
264                  if ($(this).data('filter').indexOf(activeFilter) === -1) {
265                    return $(this).addClass('filter-inactive');
266                  }
267                }
268              });
269            }
270          });
271        });
272      });
273      return $('.filtration a.toggle-filters').click(function(event) {
274        event.preventDefault();
275        return $('.filters-wrapper').each(function(index) {
276          return $(this).toggleClass('active');
277        });
278      });
279    };
280
281    stickyEngage = function() {
282      var filterForm;
283      var $stickyFixed = $('.sticky-wrapper.longwood-fixed');
284      var $stickyOriginal = $('.sticky-wrapper.original');
285
286      if ($stickyOriginal.length && $stickyFixed.length) { 
287        if (($(window).scrollTop() + $('body').offset().top) > $stickyOriginal.offset().top) {
288          if ($stickyOriginal.parents('.filtration').length) {
289            filterForm = $stickyOriginal.find('ul.filters');
290            if (filterForm.length && !$stickyFixed.find('ul.filters.keep').length) {
291                filterForm.addClass('keep');
292                if ($stickyFixed.find('.sticky-filter-target').length) {
293                    filterForm.insertAfter($stickyFixed.find('.sticky-filter-target'));
294                    $stickyFixed.find('ul.filters:not(.keep)').remove();
295                } else {
296                }
297            }
298          }
299          $stickyFixed.show();
300          $stickyFixed.find('.page-header').show();
301
302        } else {
303          if ($stickyOriginal.parents('.filtration').length) {
304            filterForm = $stickyFixed.find('ul.filters.keep');
305            if (filterForm.length) {
306                if ($stickyOriginal.find('.sticky-filter-target').length) {
307                    filterForm.insertAfter($stickyOriginal.find('.sticky-filter-target'));
308                    filterForm.removeClass('keep');
309                } else {
310                }
311            }
312          }
313          $stickyFixed.hide();
314        }
315      }
316    };
317
318
319    initSticky = function() {
320      var $original = $('.sticky-wrapper').first();
321      if ($original.length && !$('.sticky-wrapper.longwood-fixed').length) {
322        var $clone = $original.clone(true, true)
323          .addClass('longwood-fixed')
324          .removeClass('original') 
325          .hide();
326        
327        $clone.insertAfter($original);
328        $original.addClass('original'); 
329      }
330
331      $(window).off('scroll.stickyEngage').on('scroll.stickyEngage', stickyEngage);
332      stickyEngage();
333    };
334
335
336    controlStickyTabs = function() {
337      if ($('.tabs-container').length && isLarge()) {
338        if ($('[data-options="deep_linking:true"]')) {
339          return $('.tabs-content .content').each(function(index) {
340            var hash, panelID, target;
341            hash = window.location.hash;
342            panelID = "#" + $(this).attr('id');
343            if (hash && index > 0 || hash === panelID) {
344              if ($(this).hasClass('r-tabs-state-active')) {
345                target = $('.tabs-section .arc-block').offset().top - $('.sticky-wrapper.longwood-fixed').height() - 20;
346                return $('html, body').animate({
347                  scrollTop: target
348                }, 1000);
349              }
350            } else {
351
352            }
353          });
354        }
355      }
356    };
357
358    closeAlertBar = function() {
359      return $('.alert a.close').click(function(event) {
360        event.preventDefault();
361        return $(this).parents('.alert').slideUp();
362      });
363    };
364
365    responsiveTabs = function() {
366      $('.tabs-container').each(function(index) {
367        var thisID;
368        thisID = $(this).attr('id');
369        return $('#' + thisID).responsiveTabs({
370          setHash: true,
371          collapsible: 'accordion',
372          activate: tabActivated,
373          scrollToAccordion: true,
374          scrollToAccordionOnLoad: false
375        });
376      });
377      return indentTabs($('.tabs-container'));
378    };
379
380    tabActivated = function(event, tab) {
381      var $tab, $tabUL, accordionHeaderHeight, hashExists, pageHeaderHeight, ulVis;
382      $tab = $(tab.selector);
383      $tabUL = $tab.parent().parent().siblings().first();
384      hashExists = window.location.hash && $('.tabs-container ' + window.location.hash).length;
385      ulVis = $tabUL.is(':visible');
386      if (!ulVis && hashExists) {
387        if ($('.sticky-wrapper').length) {
388          pageHeaderHeight = $('.sticky-wrapper.longwood-fixed').height();
389        } else {
390          pageHeaderHeight = 0;
391        }
392        accordionHeaderHeight = $tab.prev().height();
393        return $('html, body').animate({
394          scrollTop: $tab.offset().top - pageHeaderHeight - accordionHeaderHeight
395        }, 500);
396      }
397    };
398
399    indentTabs = function($container) {
400      return $container.find('li.indent').each(function(index) {
401        var contentID;
402        contentID = $(this).children('a').first().attr('href');
403        return $container.find('.tabs-content > .r-tabs-panel' + contentID).prev().children('a').first().wrap('<div class="indent"></div>');
404      });
405    };
406
407    checkEventMatch = function() {
408      var eventmatch;
409      eventmatch = false;
410      $('#home-event-list li').each(function() {
411        if ($(this).find('a').attr('content-id') === $('.featured-event').attr('content-id')) {
412          $(this).hide();
413          eventmatch = true;
414        }
415        console.log(eventmatch);
416      });
417      if (!eventmatch) {
418        //console.log($('#home-event-list li').size());
419        if ($('#home-event-list li').length === 4) {
420          $('#home-event-list li').last().hide();
421        }
422      }
423      return $('.breadcrumbs li').each(function() {
424        if ($(this).find('a').text() === 'Secondary Menu') {
425          $(this).hide();
426        }
427      });
428    };
429
430    T4hacks = function() {
431      var letters;
432      $('#advSearchForm select[name="policyOwner"] option, #advSearchForm select[name="formOwner"] option').first().text('Select a department');
433      $('.pagination.intranet-news-landing a').wrap('<li></li>');
434      $('.pagination.intranet-news-landing span.currentpage').wrap('<li class="current"><a href="#"></a></li>');
435      $('.alpha-list.intranet li').each(function() {
436        $(this).addClass($(this).find('a').html().substr(0, 1).toLowerCase());
437      });
438      letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'];
439      $.each(letters, function(idx, val) {
440        $('li.' + val).wrapAll('<li><ul></ul><li>');
441      });
442      $('.alpha-list.intranet li').each(function() {
443        $(this).removeClass();
444      });
445      return $('.alpha-list.intranet > li').each(function() {
446        var letter;
447        letter = $(this).find('a').html().substr(0, 1).toLowerCase();
448        $(this).addClass(letter);
449        $(this).prepend('<h6 class="alpha-header" id="' + letter + '">' + letter.toUpperCase() + '</h6>');
450      });
451    };
452
453    collageSlotPolyfill = function() {
454      return $('.collage-slot-content').each(function() {
455        var $container, imgUrl;
456        $container = $(this);
457        imgUrl = $container.find('img').prop('src');
458        if (imgUrl) {
459          $container.css('backgroundImage', 'url(' + imgUrl + ')').addClass('compat-cover-and-center');
460        }
461      });
462    };
463
464    checkFilterParam = function() {
465      var filterParam;
466      filterParam = getParameterByName('filter');
467      if (filterParam) {
468        $('div.filters-wrapper').addClass('active');
469        $('input#' + filterParam + '.radio').click();
470        document.getElementById(filterParam).checked = true;
471      }
472    };
473
474    getParameterByName = function(name, url) {
475      var regex, results;
476      if (!url) {
477        url = window.location.href;
478      }
479      name = name.replace(/[\[\]]/g, '\\$&');
480      regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)');
481      results = regex.exec(url);
482      if (!results) {
483        return null;
484      }
485      if (!results[2]) {
486        return '';
487      }
488      return decodeURIComponent(results[2].replace(/\+/g, ' '));
489    };
490
491    document.documentElement.setAttribute('data-useragent', navigator.userAgent);
492
493    $(document).foundation();
494
495    $(document).ready(function() {
496      $('.fit-media').fitVids();
497      tablesInit();
498      tablesResponsify();
499      galleryLightboxInit();
500      slickInit();
501      fullPageInit();
502      contactBlockIconScaling();
503      twitterQuotePopup();
504      matchHeightsInit();
505      photoButtonTeaserHandler();
506      togglePrimaryNav();
507      adjustFullPageCurve();
508      filter();
509      initSticky();
510      closeAlertBar();
511      clickableHeaders();
512      checkEventMatch();
513      responsiveTabs();
514      T4hacks();
515      collageSlotPolyfill();
516      $('.homepage-collage .collage-title h1').flexVerticalCenter();
517      return;
518      return Modernizr.addTest('mix-blend-mode', function() {
519        return Modernizr.testProp('mixBlendMode');
520      });
521    });
522
523    $(window).load(function() {
524      checkFilterParam();
525      controlStickyTabs();
526    });
527
528    $(window).resize(function() {
529      fullPageWatch();
530      tablesResponsify();
531      contactBlockIconScaling();
532    });
533
534  }).call(this);
535
536  // Added by Kevin 4/12/2017
537  /**
538   * Cookie plugin
539   *
540   * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
541   * Dual licensed under the MIT and GPL licenses:
542   * http://www.opensource.org/licenses/mit-license.php
543   * http://www.gnu.org/licenses/gpl.html
544   *
545   */
546
547  /**
548   * Create a cookie with the given name and value and other optional parameters.
549   *
550   * @example $.cookie('the_cookie', 'the_value');
551   * @desc Set the value of a cookie.
552   * @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true });
553   * @desc Create a cookie with all available options.
554   * @example $.cookie('the_cookie', 'the_value');
555   * @desc Create a session cookie.
556   * @example $.cookie('the_cookie', null);
557   * @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain
558   *       used when the cookie was set.
559   *
560   * @param String name The name of the cookie.
561   * @param String value The value of the cookie.
562   * @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
563   * @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
564   *                             If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
565   *                             If set to null or omitted, the cookie will be a session cookie and will not be retained
566   *                             when the the browser exits.
567   * @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
568   * @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
569   * @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
570   *                        require a secure protocol (like HTTPS).
571   * @type undefined
572   *
573   * @name $.cookie
574   * @cat Plugins/Cookie
575   * @author Klaus Hartl/[email protected]
576   */
577
578  /**
579   * Get the value of a cookie with the given name.
580   *
581   * @example $.cookie('the_cookie');
582   * @desc Get the value of a cookie.
583   *
584   * @param String name The name of the cookie.
585   * @return The value of the cookie.
586   * @type String
587   *
588   * @name $.cookie
589   * @cat Plugins/Cookie
590   * @author Klaus Hartl/[email protected]
591   */
592  jQuery.cookie = function(name, value, options) {
593      if (typeof value != 'undefined') { // name and value given, set cookie
594          options = options || {};
595          if (value === null) {
596              value = '';
597              options.expires = -1;
598          }
599          var expires = '';
600          if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
601              var date;
602              if (typeof options.expires == 'number') {
603                  date = new Date();
604                  date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
605              } else {
606                  date = options.expires;
607              }
608              expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
609          }
610          // CAUTION: Needed to parenthesize options.path and options.domain
611          // in the following expressions, otherwise they evaluate to undefined
612          // in the packed version for some reason...
613          var path = options.path ? '; path=' + (options.path) : '';
614          var domain = options.domain ? '; domain=' + (options.domain) : '';
615          var secure = options.secure ? '; secure' : '';
616          document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
617      } else { // only name given, get cookie
618          var cookieValue = null;
619          if (document.cookie && document.cookie != '') {
620              var cookies = document.cookie.split(';');
621              for (var i = 0; i < cookies.length; i++) {
622                  var cookie = jQuery.trim(cookies[i]);
623                  // Does this cookie string begin with the name we want?
624                  if (cookie.substring(0, name.length + 1) == (name + '=')) {
625                      cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
626                      break;
627                  }
628              }
629          }
630          return cookieValue;
631      }
632  };
633
634  function createCookie(name,value,days) {
635      var expires = "";
636      if (days) {
637          var date = new Date();
638          date.setTime(date.getTime() + (days*24*60*60*1000));
639          expires = "; expires=" + date.toUTCString();
640      }
641      document.cookie = name + "=" + value + expires + "; path=/";
642  }
643
644  function readCookie(name) {
645      var nameEQ = name + "=";
646      var ca = document.cookie.split(';');
647      for(var i=0;i < ca.length;i++) {
648          var c = ca[i];
649          while (c.charAt(0)==' ') c = c.substring(1,c.length);
650          if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
651      }
652      return null;
653  }
654
655  function eraseCookie(name) {
656      createCookie(name,"",-1);
657  }
658
659
660  if($('li.featured-article').length) {
661      $('li.featured-article').first().closest('div').addClass('news-list-large');
662  }
663
664
665

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.