vendor: 11,761 bytes, lines 1-373
1/** 2* jquery-match-height master by @liabru 3* http://brm.io/jquery-match-height/ 4* License: MIT 5*/ 6 7;(function(factory) { // eslint-disable-line no-extra-semi 8 'use strict'; 9 if (typeof define === 'function' && define.amd) { 10 // AMD 11 define(['jquery'], factory); 12 } else if (typeof module !== 'undefined' && module.exports) { 13 // CommonJS 14 module.exports = factory(require('jquery')); 15 } else { 16 // Global 17 factory(jQuery); 18 } 19})(function($) { 20 /* 21 * internal 22 */ 23 24 var _previousResizeWidth = -1, 25 _updateTimeout = -1; 26 27 /* 28 * _parse 29 * value parse utility function 30 */ 31 32 var _parse = function(value) { 33 // parse value and convert NaN to 0 34 return parseFloat(value) || 0; 35 }; 36 37 /* 38 * _rows 39 * utility function returns array of jQuery selections representing each row 40 * (as displayed after float wrapping applied by browser) 41 */ 42 43 var _rows = function(elements) { 44 var tolerance = 1, 45 $elements = $(elements), 46 lastTop = null, 47 rows = []; 48 49 // group elements by their top position 50 $elements.each(function(){ 51 var $that = $(this), 52 top = $that.offset().top - _parse($that.css('margin-top')), 53 lastRow = rows.length > 0 ? rows[rows.length - 1] : null; 54 55 if (lastRow === null) { 56 // first item on the row, so just push it 57 rows.push($that); 58 } else { 59 // if the row top is the same, add to the row group 60 if (Math.floor(Math.abs(lastTop - top)) <= tolerance) { 61 rows[rows.length - 1] = lastRow.add($that); 62 } else { 63 // otherwise start a new row group 64 rows.push($that); 65 } 66 } 67 68 // keep track of the last row top 69 lastTop = top; 70 }); 71 72 return rows; 73 }; 74 75 /* 76 * _parseOptions 77 * handle plugin options 78 */ 79 80 var _parseOptions = function(options) { 81 var opts = { 82 byRow: true, 83 property: 'height', 84 target: null, 85 remove: false 86 }; 87 88 if (typeof options === 'object') { 89 return $.extend(opts, options); 90 } 91 92 if (typeof options === 'boolean') { 93 opts.byRow = options; 94 } else if (options === 'remove') { 95 opts.remove = true; 96 } 97 98 return opts; 99 }; 100 101 /* 102 * matchHeight 103 * plugin definition 104 */ 105 106 var matchHeight = $.fn.matchHeight = function(options) { 107 var opts = _parseOptions(options); 108 109 // handle remove 110 if (opts.remove) { 111 var that = this; 112 113 // remove fixed height from all selected elements 114 this.css(opts.property, ''); 115 116 // remove selected elements from all groups 117 $.each(matchHeight._groups, function(key, group) { 118 group.elements = group.elements.not(that); 119 }); 120 121 // TODO: cleanup empty groups 122 123 return this; 124 } 125 126 if (this.length <= 1 && !opts.target) { 127 return this; 128 } 129 130 // keep track of this group so we can re-apply later on load and resize events 131 matchHeight._groups.push({ 132 elements: this, 133 options: opts 134 }); 135 136 // match each element's height to the tallest element in the selection 137 matchHeight._apply(this, opts); 138 139 return this; 140 }; 141 142 /* 143 * plugin global options 144 */ 145 146 matchHeight.version = 'master'; 147 matchHeight._groups = []; 148 matchHeight._throttle = 80; 149 matchHeight._maintainScroll = false; 150 matchHeight._beforeUpdate = null; 151 matchHeight._afterUpdate = null; 152 matchHeight._rows = _rows; 153 matchHeight._parse = _parse; 154 matchHeight._parseOptions = _parseOptions; 155 156 /* 157 * matchHeight._apply 158 * apply matchHeight to given elements 159 */ 160 161 matchHeight._apply = function(elements, options) { 162 var opts = _parseOptions(options), 163 $elements = $(elements), 164 rows = [$elements]; 165 166 // take note of scroll position 167 var scrollTop = $(window).scrollTop(), 168 htmlHeight = $('html').outerHeight(true); 169 170 // get hidden parents 171 var $hiddenParents = $elements.parents().filter(':hidden'); 172 173 // cache the original inline style 174 $hiddenParents.each(function() { 175 var $that = $(this); 176 $that.data('style-cache', $that.attr('style')); 177 }); 178 179 // temporarily must force hidden parents visible 180 $hiddenParents.css('display', 'block'); 181 182 // get rows if using byRow, otherwise assume one row 183 if (opts.byRow && !opts.target) { 184 185 // must first force an arbitrary equal height so floating elements break evenly 186 $elements.each(function() { 187 var $that = $(this), 188 display = $that.css('display'); 189 190 // temporarily force a usable display value 191 if (display !== 'inline-block' && display !== 'flex' && display !== 'inline-flex') { 192 display = 'block'; 193 } 194 195 // cache the original inline style 196 $that.data('style-cache', $that.attr('style')); 197 198 $that.css({ 199 'display': display, 200 'padding-top': '0', 201 'padding-bottom': '0', 202 'margin-top': '0', 203 'margin-bottom': '0', 204 'border-top-width': '0', 205 'border-bottom-width': '0', 206 'height': '100px', 207 'overflow': 'hidden' 208 }); 209 }); 210 211 // get the array of rows (based on element top position) 212 rows = _rows($elements); 213 214 // revert original inline styles 215 $elements.each(function() { 216 var $that = $(this); 217 $that.attr('style', $that.data('style-cache') || ''); 218 }); 219 } 220 221 $.each(rows, function(key, row) { 222 var $row = $(row), 223 targetHeight = 0; 224 225 if (!opts.target) { 226 // skip apply to rows with only one item 227 if (opts.byRow && $row.length <= 1) { 228 $row.css(opts.property, ''); 229 return; 230 } 231 232 // iterate the row and find the max height 233 $row.each(function(){ 234 var $that = $(this), 235 style = $that.attr('style'), 236 display = $that.css('display'); 237 238 // temporarily force a usable display value 239 if (display !== 'inline-block' && display !== 'flex' && display !== 'inline-flex') { 240 display = 'block'; 241 } 242 243 // ensure we get the correct actual height (and not a previously set height value) 244 var css = { 'display': display }; 245 css[opts.property] = ''; 246 $that.css(css); 247 248 // find the max height (including padding, but not margin) 249 if ($that.outerHeight(false) > targetHeight) { 250 targetHeight = $that.outerHeight(false); 251 } 252 253 // revert styles 254 if (style) { 255 $that.attr('style', style); 256 } else { 257 $that.css('display', ''); 258 } 259 }); 260 } else { 261 // if target set, use the height of the target element 262 targetHeight = opts.target.outerHeight(false); 263 } 264 265 // iterate the row and apply the height to all elements 266 $row.each(function(){ 267 var $that = $(this), 268 verticalPadding = 0; 269 270 // don't apply to a target 271 if (opts.target && $that.is(opts.target)) { 272 return; 273 } 274 275 // handle padding and border correctly (required when not using border-box) 276 if ($that.css('box-sizing') !== 'border-box') { 277 verticalPadding += _parse($that.css('border-top-width')) + _parse($that.css('border-bottom-width')); 278 verticalPadding += _parse($that.css('padding-top')) + _parse($that.css('padding-bottom')); 279 } 280 281 // set the height (accounting for padding and border) 282 $that.css(opts.property, (targetHeight - verticalPadding) + 'px'); 283 }); 284 }); 285 286 // revert hidden parents 287 $hiddenParents.each(function() { 288 var $that = $(this); 289 $that.attr('style', $that.data('style-cache') || null); 290 }); 291 292 // restore scroll position if enabled 293 if (matchHeight._maintainScroll) { 294 $(window).scrollTop((scrollTop / htmlHeight) * $('html').outerHeight(true)); 295 } 296 297 return this; 298 }; 299 300 /* 301 * matchHeight._applyDataApi 302 * applies matchHeight to all elements with a data-match-height attribute 303 */ 304 305 matchHeight._applyDataApi = function() { 306 var groups = {}; 307 308 // generate groups by their groupId set by elements using data-match-height 309 $('[data-match-height], [data-mh]').each(function() { 310 var $this = $(this), 311 groupId = $this.attr('data-mh') || $this.attr('data-match-height'); 312 313 if (groupId in groups) { 314 groups[groupId] = groups[groupId].add($this); 315 } else { 316 groups[groupId] = $this; 317 } 318 }); 319 320 // apply matchHeight to each group 321 $.each(groups, function() { 322 this.matchHeight(true); 323 }); 324 }; 325 326 /* 327 * matchHeight._update 328 * updates matchHeight on all current groups with their correct options 329 */ 330 331 var _update = function(event) { 332 if (matchHeight._beforeUpdate) { 333 matchHeight._beforeUpdate(event, matchHeight._groups); 334 } 335 336 $.each(matchHeight._groups, function() { 337 matchHeight._apply(this.elements, this.options); 338 }); 339 340 if (matchHeight._afterUpdate) { 341 matchHeight._afterUpdate(event, matchHeight._groups); 342 } 343 }; 344 345 matchHeight._update = function(throttle, event) { 346 // prevent update if fired from a resize event 347 // where the viewport width hasn't actually changed 348 // fixes an event looping bug in IE8 349 if (event && event.type === 'resize') { 350 var windowWidth = $(window).width(); 351 if (windowWidth === _previousResizeWidth) { 352 return; 353 } 354 _previousResizeWidth = windowWidth; 355 } 356 357 // throttle updates 358 if (!throttle) { 359 _update(event); 360 } else if (_updateTimeout === -1) { 361 _updateTimeout = setTimeout(function() { 362 _update(event); 363 _updateTimeout = -1; 364 }, matchHeight._throttle); 365 } 366 }; 367 368 /* 369 * bind events 370 */ 371 372 // apply on DOM ready event 373 $(matchHeight._applyDataApi);
374 375 // use on or bind where supported 376 var on = $.fn.on ? 'on' : 'bind'; 377 378 // update heights on load and resize events 379 $(window)[on]('load', function(event) { 380 matchHeight._update(false, event); 381 }); 382 383 // throttled update heights on resize events 384 $(window)[on]('resize orientationchange', function(event) { 385 matchHeight._update(true, event); 386 }); 387 388}); 389 390 391$(document).ready(function() { 392 393 $("a").on("click", function() { 394 $(this).blur(); 395 }); 396 397 $(".btn").on("click", function() { 398 $(this).blur(); 399 }); 400 401 $("button").on("click", function() { 402 $(this).blur(); 403 }); 404 405 $("#currentyear").text(new Date().getFullYear()); 406 407 408 // added try/catch block because we were seeing Uncaught TypeError: $(...).matchHeight is not a function 409 try { 410 console.log("attempting matchHeight()"); 411 // first attempt 412 $(".matchheight").matchHeight(); 413 $(".matchheight2").matchHeight(); 414 console.log("first attempt for matchHeight() was a success!"); 415 } catch(err) { 416 console.log("first attempt for matchHeight() did not work.", err.message); 417 try { 418 // second attempt 419 $(".matchheight").matchHeight(); 420 $(".matchheight2").matchHeight(); 421 console.log("second attempt for matchHeight() was a success!"); 422 } catch(err2) { 423 // now we'll just let it fail 424 console.log("second attempt for matchHeight() did not work.", err2.message); 425 } 426 } 427 428 429 Fancybox.bind('[data-fancybox="single"]', { 430 groupAttr: false, 431 }); 432 433 $(window).on('resize', function() { 434 // added try/catch block because we were seeing Uncaught TypeError: $(...).matchHeight is not a function 435 try { 436 console.log("window resize event. attempting matchHeight()"); 437 // first attempt 438 $(".matchheight").matchHeight(); 439 $(".matchheight2").matchHeight(); 440 console.log("window resize event. first attempt for matchHeight() was a success!"); 441 } catch(err) { 442 console.log("window resize event. first attempt for matchHeight() did not work.", err.message); 443 try { 444 // second attempt 445 $(".matchheight").matchHeight(); 446 $(".matchheight2").matchHeight(); 447 console.log("window resize event. second attempt for matchHeight() was a success!"); 448 } catch(err2) { 449 // now we'll just let it fail 450 console.log("window resize event. second attempt for matchHeight() did not work.", err2.message); 451 } 452 } 453 454 footerHeight(); 455 dfHeight(); 456 fwvHeight(); 457 scHeight(); 458 fcHeight(); 459 fcSlider(); 460 ccHeight(); 461 // biHeight(); 462 flHeight(); 463 displayCheck(); 464 465 }); 466 467 /* desktop header navigation */ 468 469 $(".search-btn-desktop").on("click", function(e) { 470 $(this).toggleClass("active"); 471 $(".header-main-search-form").toggleClass("active"); 472 $(".menu-btn").removeClass("active"); 473 $(".header-main-mobile-nav").slideUp(); 474 $(".header-main-search-form").slideToggle(); 475 if ($(".header-main-search-form").hasClass("active")) { 476 $("input.search-text").focus(); 477 } 478 $(".showSubLinks").removeClass("active"); 479 $(".header-utility-sub").slideUp(); 480 $(".subnav-container button").removeClass("active"); 481 $(".subnav-container .subnav-links").slideUp(); 482 if ($(this).hasClass("active")) { 483 $(this).attr("aria-expanded", "true"); 484 } else { 485 $(this).attr("aria-expanded", "false"); 486 } 487 e.stopPropagation(); 488 }); 489 490 $(".search-btn-mobile").on("click", function(e) { 491 $(this).toggleClass("active"); 492 $(".header-main-search-form").toggleClass("active"); 493 $(".menu-btn").removeClass("active"); 494 $(".header-main-mobile-nav").slideUp(); 495 $(".header-main-search-form").slideToggle(); 496 if ($(this).hasClass("active")) { 497 $(this).attr("aria-expanded", "true"); 498 } else { 499 $(this).attr("aria-expanded", "false"); 500 } 501 e.stopPropagation(); 502 });
503 504 $(".showSubLinks").on("click", function(e) { 505 $(this).toggleClass("active"); 506 $(".header-utility-sub").slideToggle(); 507 if (e.detail === 0) { 508 $("#" + $(this).data("sublinks") + " li:first a").focus(); 509 } 510 $(".search-btn-desktop").removeClass("active"); 511 $(".header-main-search-form").removeClass("active"); 512 $(".header-main-search-form").slideUp(); 513 $(".subnav-container button").removeClass("active"); 514 $(".subnav-container .subnav-links").slideUp(); 515 if ($(this).hasClass("active")) { 516 $(this).attr("aria-expanded", "true"); 517 } else { 518 $(this).attr("aria-expanded", "false"); 519 } 520 e.stopPropagation(); 521 }); 522 523 $(".infofor-link-last").on('keydown', function(e) { 524 e.preventDefault(); 525 if (e.which == 9) { 526 $(".header-main-nav-logo").find($('a')).focus(); 527 } 528 }); 529 530 $(".subsection-link-last").on('keydown', function(e) { 531 e.preventDefault(); 532 if (e.which == 9) { 533 $(".subnav-container button").trigger("click"); 534 $(".breadcrumb").find($('a')).first().focus(); 535 } 536 }); 537 538 $(".header-utility-sub-links").click(function(e) { 539 e.stopPropagation(); 540 }); 541 542 $(".header-main-search-form").click(function(e) { 543 e.stopPropagation(); 544 }); 545 546 $(".subnav-container button").click(function(e) { 547 e.stopPropagation(); 548 }); 549 550 $(document).click(function(e) { 551 if ($(".showSubLinks").hasClass("active")) { 552 $(".showSubLinks").trigger("click"); 553 } 554 if ($(".search-btn-desktop").hasClass("active")) { 555 $(".search-btn-desktop").trigger("click"); 556 } 557 if ($(".subnav-container button").hasClass("active")) { 558 $(".subnav-container button").trigger("click"); 559 } 560 e.stopPropagation(); 561 }); 562 563 $(".showSubMenu").on("mouseover", function() { 564 $(".showSubMenu").removeClass("active"); 565 $(this).addClass("active"); 566 $(".main-link-submenu").removeClass("active"); 567 $("#" + $(this).data("submenu")).addClass("active"); 568 }); 569 570 $(".showSubMenu").focus(function() { 571 $(".showSubMenu").removeClass("active"); 572 $(this).addClass("active"); 573 $(".main-link-submenu").removeClass("active"); 574 $("#" + $(this).data("submenu")).addClass("active"); 575 }); 576 577 $(".showSubMenu").on('keydown', function(e) { 578 e.preventDefault(); 579 if (e.which == 9) { 580 $("#" + $(this).data("submenu") + " .submenu-links .submenu-link-first").focus(); 581 } 582 }); 583 584 $(".showSubMenu").on('keydown', function(e) { 585 if (e.which == 9) { 586 if (e.shiftKey) { 587 e.preventDefault(); 588 $(".main-link-submenu").removeClass("active"); 589 $(".showSubMenu").removeClass("active"); 590 if ($(this).parent().index() == 0) { 591 $(".logo-h1 a").focus(); 592 } else if ($(this).parent().index() == 1) { 593 $(".header-main-nav-links .header-links.desktop-flex>li>a.menulink1").focus(); 594 } else if ($(this).parent().index() == 2) { 595 $(".header-main-nav-links .header-links.desktop-flex>li>a.menulink2").focus(); 596 } 597 } 598 } 599 }); 600 601 $(".submenu-link-first").on('keydown', function(e) { 602 if (e.which == 9) { 603 if (e.shiftKey) { 604 e.preventDefault(); 605 $(".showSubMenu.active").focus(); 606 } 607 } 608 }); 609 610 $(".submenu-link-last").on('keydown', function(e) { 611 e.preventDefault(); 612 if (e.which == 9) { 613 $(".main-link-submenu").removeClass("active"); 614 $(".showSubMenu").removeClass("active"); 615 var currentID = $(this).parent().parent().parent().parent().parent().parent().attr('id'); 616 if ($(".header-main-nav-links").find($('.showSubMenu[data-submenu="' + currentID + '"]')).parent().next().find('a').length > 0) { 617 $(".header-main-nav-links").find($('.showSubMenu[data-submenu="' + currentID + '"]')).parent().next().find('a').focus(); 618 } else { 619 $(".header-main-nav-search.header-search-box").find('button').focus(); 620 } 621 } 622 });
623 624 $(".main-link-submenu").on("mouseover", function() { 625 $('.showSubMenu[data-submenu="' + $(this).attr('id') + '"]').addClass("active"); 626 }); 627 628 $(".showSubMenu").on("mouseleave", function() { 629 if ($(".main-link-submenu:hover")) { 630 $(".main-link-submenu").removeClass("active"); 631 $(".showSubMenu").removeClass("active"); 632 } 633 }); 634 635 $(".main-link-submenu").on("mouseleave", function() { 636 $(".main-link-submenu").removeClass("active"); 637 $(".showSubMenu").removeClass("active"); 638 }); 639 640 /* mobile main navigation */ 641 642 var mobileMenuHeight; 643 644 $(".menu-btn").on("click", function() { 645 $(this).toggleClass("active"); 646 $(".search-btn").removeClass("active"); 647 $(".header-main-search-form").slideUp(); 648 $(".header-main-mobile-nav").slideToggle(); 649 $(".main-mobile").removeClass("active"); 650 $(".main-mobile").addClass("active"); 651 $(".sub-mobile").removeClass("active"); 652 mobileMenuHeight = $(".main-mobile").outerHeight(); 653 $(".main-mobile").height(mobileMenuHeight); 654 $(".sub-mobile").height(mobileMenuHeight); 655 if ($(this).hasClass("active")) { 656 $(this).attr("aria-expanded", "true"); 657 } else { 658 $(this).attr("aria-expanded", "false"); 659 } 660 }); 661 662 $(".showSubLinksMobile").on("click", function() { 663 $(".main-mobile").toggleClass("active"); 664 $(".sub-mobile").toggleClass("active"); 665 }); 666 667 $(".showSubLinksMobileBack").on("click", function() { 668 $(".main-mobile").toggleClass("active"); 669 $(".sub-mobile").toggleClass("active"); 670 671 }); 672 673 /* footer */ 674 675 footerHeight(); 676 677 function footerHeight() { 678 $(".footer-social").height($(".container-xxl.footer-container .footer-content").outerHeight()); 679 } 680 681 $(".footer-links .heading").on("click", function() { 682 if (window.innerWidth < 1023) { 683 if ($(this).hasClass("active")) { 684 $(this).removeClass("active"); 685 $(".footer-links li").hide(); 686 $(".footer-links li.heading").show(); 687 } else { 688 $(".footer-links li").hide(); 689 $(".footer-links li.heading").show(); 690 $(this).parent().find("li").show(); 691 $(this).addClass("active"); 692 } 693 footerHeight(); 694 } 695 }); 696 697 /* sub nav */ 698 699 $(".subnav-container button").on("click", function() { 700 $(this).toggleClass("active"); 701 $(".subnav-container .subnav-links").slideToggle(); 702 $(".header-main-search-form").removeClass("active"); 703 $(".header-main-search-form").slideUp(); 704 $(".showSubLinks").removeClass("active"); 705 $(".header-utility-sub").slideUp(); 706 if ($(this).hasClass("active")) { 707 $(this).attr("aria-expanded", "true"); 708 } else { 709 $(this).attr("aria-expanded", "false"); 710 } 711 }); 712 713 /* banner */ 714 715 // biHeight(); 716 717 $(".banner").on("mouseover", function() { 718 $('.banner .icon-button').css("opacity", "1") 719 }); 720 721 $(".banner").on("mouseleave", function() { 722 $('.banner .icon-button').css("opacity", "0") 723 }); 724 725 function biHeight() { 726 setTimeout(function() { 727 if ($(".banner-media").length) { 728 var bHeight = $(".banner-media-container > *").height(); 729 var bHeight2 = $(".banner-media-container > *").height() * .86; 730 if (window.innerWidth > 1280) { 731 $(".banner").css("height", bHeight).css("min-height", bHeight); 732 $(".banner-text-container-xxl").css("height", bHeight2).css("min-height", bHeight2); 733 } else if (window.innerWidth > 1023) { 734 // console.log(2); 735 $(".banner").css("height", bHeight).css("min-height", bHeight); 736 $(".banner-text-container-xxl").css("height", bHeight).css("min-height", bHeight); 737 } else { 738 // console.log(3); 739 $(".banner").css("height", "auto").css("min-height", "auto"); 740 $(".banner-text-container-xxl").css("height", "auto").css("min-height", "auto"); 741 } 742 } 743 }, 500); 744 } 745 746 $(".banner-video-controls button").on("click", function() { 747 if ($(this).hasClass("play-video")) { 748 $(".banner video:visible").trigger('play'); 749 } else if ($(this).hasClass("pause-video")) { 750 $(".banner video:visible").trigger('pause'); 751 } 752 $(".banner-video-controls button").show(); 753 $(this).hide(); 754 });
755 756 $(".banner-video-controls button").on('keydown', function(e) { 757 // console.log(13); 758 if (e.which == 13) { 759 setTimeout(function() { 760 $(".banner-video-controls button:visible").focus(); 761 }, 100); 762 } 763 }); 764 765 /* sticky cta */ 766 767 var cookieCheck_stickyCTA = getCookie("Belhaven-stickyCTA"); 768 769 if (cookieCheck_stickyCTA == "") { 770 setCookie("Belhaven-stickyCTA", "true", 2147483647); 771 } else { 772 if (cookieCheck_stickyCTA == "false") { 773 $(".sticky-cta").toggleClass("active"); 774 $('.sticky-cta-links').animate({ width: 'toggle' }); 775 $(".sticky-cta-toggle button").attr("aria-expanded", "false") 776 } else { 777 $(".sticky-cta-toggle button").attr("aria-expanded", "true"); 778 } 779 } 780 781 $(".sticky-cta-toggle button").on("click", function() { 782 $(".sticky-cta").toggleClass("active"); 783 $('.sticky-cta-links').animate({ width: 'toggle' }); 784 if ($(".sticky-cta").hasClass("active")) { 785 setCookie("Belhaven-stickyCTA", "true", 2147483647); 786 } else { 787 setCookie("Belhaven-stickyCTA", "false", 2147483647); 788 } 789 if ($(".sticky-cta").hasClass("active")) { 790 $(this).attr("aria-expanded", "true"); 791 } else { 792 $(this).attr("aria-expanded", "false"); 793 } 794 }); 795 796 /* quads */ 797 798 $(".quad1 .quad-top").on("click ", function() { 799 if (window.innerWidth < 767) { 800 if ($(this).parent().hasClass("active")) { 801 $('.quad1 .quad-item').removeClass("active"); 802 $('.quad1 .quad-container').removeClass("active"); 803 $(".quad1 .quad-bottom").slideUp(); 804 } else { 805 $('.quad1 .quad-item').removeClass("active"); 806 $('.quad1 .quad-container').addClass("active"); 807 $(this).parent().addClass("active"); 808 $(".quad1 .quad-bottom").slideUp(); 809 $(this).parent().find(".quad-bottom").slideDown(); 810 } 811 } else { 812 if (!$('.quad1 .quad-container').hasClass("active")) { 813 $('.quad1 .quad-container').removeClass("active"); 814 $('.quad1 .quad-item').removeClass("active"); 815 $(this).parent().toggleClass("active"); 816 $('.quad1 .quad-container').toggleClass("active"); 817 } 818 } 819 }); 820 821 $(".quad1 .quad-close").on("click ", function() { 822 $('.quad1 .quad-container').removeClass("active"); 823 $('.quad1 .quad-item').removeClass("active"); 824 }); 825 826 827 $(".quad2 .quad-top").on("click ", function() { 828 if (window.innerWidth < 768) { 829 if ($(this).parent().hasClass("active")) { 830 $('.quad2 .quad-item').removeClass("active"); 831 $('.quad2 .quad-container').removeClass("active"); 832 $(".quad2 .quad-bottom").slideUp(); 833 } else { 834 $('.quad2 .quad-item').removeClass("active"); 835 $('.quad2 .quad-container').addClass("active"); 836 $(this).parent().addClass("active"); 837 $(".quad2 .quad-bottom").slideUp(); 838 $(this).parent().find(".quad-bottom").slideDown(); 839 } 840 } else { 841 $('.quad2 .quad-item .quad-bottom').hide(); 842 $('.quad2 .quad-item .quad-top').show(); 843 $(this).hide(); 844 $(this).parent().find('.quad-bottom').show(); 845 } 846 }); 847 848 849 /* program-filter */ 850 851 $(".program-filter-button").on("click ", function() { 852 if ($('.program-filter-container').hasClass("active")) { 853 $('.program-filter-container').removeClass("active"); 854 $('.ps-program-filter').removeClass("active"); 855 $('.program-filter-bottom').slideUp(); 856 } else { 857 $('.ps-program-filter').addClass("active"); 858 $('.program-filter-container').addClass("active"); 859 $('.program-filter-bottom').slideDown(); 860 // commented out for the pulse to work properly 861 // setTimeout(function() { 862 // var pfSwiper = document.querySelector('.program-filter-bottom .swiper').swiper; 863 // pfSwiper.slideTo(1); 864 // pfSwiper.slideTo(0); 865 // }, 500); 866 } 867 });
868 869 if ($(".program-filter-bottom .swiper").length) { 870 if (window.innerWidth > 767) { 871 const pfSwiper = new Swiper('.program-filter-bottom .swiper', { 872 direction: 'vertical', 873 maxBackfaceHiddenSlides: 10, 874 keyboard: { 875 enabled: true, 876 onlyInViewport: false, 877 }, 878 observer: true, 879 observeParents: true, 880 pagination: { 881 el: '.swiper-pagination', 882 clickable: true, 883 renderBullet: function(index) { 884 return `<span class="swiper-pagination-bullet" id="${index}"><div class="b-dot"><i class="fas fa-circle"></i></div><div class="b-label">${programFilterSlides[index]}</div></span>`; 885 }, 886 }, 887 on: { 888 slideChange: function(pfSwiper) { 889 $('.program-filter-bottom .swiper .swiper-slide').attr("inert", ""); 890 setTimeout(function() { 891 $('.program-filter-bottom .swiper .swiper-slide.swiper-slide-active').removeAttr("inert"); 892 }, 100); 893 if (!$(".program-filter-bottom .swiper-pagination").hasClass("stop")) { 894 $(".program-filter-bottom .swiper-pagination").addClass("stop"); 895 } 896 } 897 } 898 }); 899 900 $(".program-filter-bottom .swiper").on("keydown", ".swiper-pagination-bullet", function(e) { 901 // e.preventDefault(); 902 if (e.which == 13) { 903 var pfSwiper = document.querySelector('.program-filter-bottom .swiper').swiper; 904 var slideID = $(this).attr('id') 905 pfSwiper.slideTo(slideID); 906 } 907 }); 908 } 909 } 910 911 $(".pfm-item-title").on("click ", function() { 912 if ($(this).parent().hasClass("active")) { 913 $('.pfm-item').removeClass("active"); 914 $('.pfm-item-content').slideUp(); 915 } else { 916 $('.pfm-item').removeClass("active"); 917 $('.pfm-item-content').slideUp(); 918 $(this).parent().toggleClass('active'); 919 $(this).parent().find('.pfm-item-content').slideToggle(); 920 } 921 }); 922 923 $(".pfm-top").on("click ", function() { 924 $(this).toggleClass("active"); 925 $(".pfm-bottom").slideToggle(); 926 }); 927 928 /* dynamic feed */ 929 930 dfHeight(); 931 932 function dfHeight() { 933 if ($(".ps-dynamic-feed").length) { 934 if (window.innerWidth > 1000) { 935 var squarepx = $(".df-tab .dft-item-content").first().outerWidth() * .75; 936 $(".df-tab .dft-item-image").height(squarepx - 7); 937 $(".df-tab .dft-item-content").css("height", "auto"); 938 $(".df-tab .df-tab-v .dft-item-content").height(squarepx); 939 $(".df-tab .df-tab-v .dft-item-image").height(squarepx); 940 } else if (window.innerWidth > 768) { 941 var squarepx = $(".df-tab .dft-item-content").first().outerWidth() * .85; 942 $(".df-tab .dft-item-image").height(squarepx - 7); 943 $(".df-tab .dft-item-content").css("height", "auto"); 944 $(".df-tab .df-tab-v .dft-item-content").height(squarepx); 945 $(".df-tab .df-tab-v .dft-item-image").height(squarepx); 946 } else if (window.innerWidth == 768) { 947 var squarepx = $(".df-tab .dft-item-content").first().outerWidth(); 948 $(".df-tab .dft-item-image").height(squarepx - 7); 949 $(".df-tab .dft-item-content").css("height", "auto"); 950 $(".df-tab .df-tab-v .dft-item-content").height(squarepx); 951 $(".df-tab .df-tab-v .dft-item-image").height(squarepx); 952 } else { 953 var squarepx = $(".df-tab .dft-item-content").first().outerWidth(); 954 $(".df-tab .dft-item-content").height(squarepx); 955 $(".df-tab .dft-item-image").height(squarepx); 956 } 957 } 958 } 959 960 if ($(".ps-dynamic-feed").length) { 961 962 var dftnPages = $(".dft-news.active .df-tab-page"); 963 var dftnActivePages = $(".dft-news.active .df-tab-page.active"); 964 var dftnHiddenPages = $(".dft-news.active .df-tab-page:not(.active)"); 965 966 $(".df-tab-links li>button").on("click ", function() { 967 968 $(".df-tab-links li>button").removeClass("open").addClass("close"); 969 $(".df-tab-links li>button").attr("aria-selected", "false"); 970 $(this).attr("aria-selected", "true"); 971 $(".df-tab-links li>button").removeClass("active"); 972 $(".df-tab").removeClass("active"); 973 $(this).toggleClass("active"); 974 $("#" + $(this).data("tab")).addClass("active");
975 dftnPages.not(":eq(0)").slideUp(); 976 dftnPages.removeClass("active"); 977 dftnPages.first().addClass("active"); 978 $(this).removeClass("close").addClass("open"); 979 dftnHiddenPages = $(".dft-news.active .df-tab-page:not(.active)"); 980 dfHeight(); 981 }); 982 983 $(".df-tab-links li>button").on('keydown', function(e) { 984 if (e.which == 13) { 985 986 $(".df-tab-links li>button").removeClass("open").addClass("close"); 987 $(".df-tab-links li>button").attr("aria-selected", "false"); 988 $(this).attr("aria-selected", "true"); 989 $(".df-tab-links li>button").removeClass("active"); 990 $(".df-tab").removeClass("active"); 991 $(this).toggleClass("active"); 992 $("#" + $(this).data("tab")).addClass("active"); 993 dftnPages.not(":eq(0)").slideUp(); 994 dftnPages.removeClass("active"); 995 dftnPages.first().addClass("active"); 996 $(this).removeClass("close").addClass("open"); 997 dftnHiddenPages = $(".dft-news.active .df-tab-page:not(.active)"); 998 $("#" + $(this).data("tab")).find('a').first().focus(); 999 dfHeight(); 1000 } 1001 }); 1002 1003 if ($(".dft-news.active .df-tab-page").length > 1) { 1004 $(".df-tab-load-more").toggleClass("active"); 1005 } 1006 1007 $(".df-tab-load-more button").on("click ", function() { 1008 if ($(".dft-news.active .df-tab-page").length > 1) { 1009 if (dftnHiddenPages.length == 0) { 1010 dftnPages.not(":eq(0)").slideUp(); 1011 dftnPages.removeClass("active"); 1012 dftnPages.first().addClass("active"); 1013 $(this).removeClass("close").addClass("open"); 1014 dftnHiddenPages = $(".dft-news.active .df-tab-page:not(.active)"); 1015 $('html,body').animate({ 1016 scrollTop: $(".ps-dynamic-feed").offset().top 1017 }); 1018 dfHeight(); 1019 } else if (dftnHiddenPages.length > 0) { 1020 dftnHiddenPages.first().toggleClass("active"); 1021 dftnHiddenPages.first().slideDown(); 1022 // dftnHiddenPages.first().find('a').first().focus(); 1023 dftnHiddenPages = $(".dft-news.active .df-tab-page:not(.active)"); 1024 if (dftnHiddenPages.length == 0) { 1025 $(this).removeClass("open").addClass("close"); 1026 } 1027 dfHeight(); 1028 } 1029 } 1030 1031 }); 1032 1033 $(".df-tab-load-more button").on('keydown', function(e) { 1034 1035 if ($(".dft-news.active .df-tab-page").length > 1) { 1036 if (e.which == 13) { 1037 if (dftnHiddenPages.length == 0) { 1038 dftnPages.not(":eq(0)").slideUp(); 1039 dftnPages.removeClass("active"); 1040 dftnPages.first().addClass("active"); 1041 dftnPages.first().find('a').first().focus(); 1042 $(this).removeClass("close").addClass("open"); 1043 dftnHiddenPages = $(".dft-news.active .df-tab-page:not(.active)"); 1044 $('html,body').animate({ 1045 scrollTop: $(".ps-dynamic-feed").offset().top 1046 }); 1047 dfHeight(); 1048 } else if (dftnHiddenPages.length > 0) { 1049 dftnHiddenPages.first().toggleClass("active"); 1050 dftnHiddenPages.first().slideDown(); 1051 dftnHiddenPages.first().find('a').first().focus(); 1052 dftnHiddenPages = $(".dft-news.active .df-tab-page:not(.active)"); 1053 if (dftnHiddenPages.length == 0) { 1054 $(this).removeClass("open").addClass("close"); 1055 } 1056 dfHeight(); 1057 } 1058 } 1059 } 1060 }); 1061 } 1062 1063 /* full width video */ 1064 1065 fwvHeight(); 1066 1067 function fwvHeight() { 1068 if ($(".ps-full-width-video").length) { 1069 if (window.innerWidth > 767) { 1070 $(".fwv-container").outerHeight($(".ps-full-width-video .container-xxl .fwv-container").outerHeight()); 1071 } else { 1072 $(".fwv-container").css("height", "auto"); 1073 } 1074 } 1075 } 1076 1077 /* story cards */ 1078 1079 scHeight(); 1080 1081 function scHeight() { 1082 if ($(".ps-story-cards").length) { 1083 $(".sc-card-thumb").height($(".sc-card-thumb").first().outerWidth()); 1084 } 1085 } 1086 1087 if ($(".ps-story-cards").length) { 1088 setSCFeatured($(".sc-card-thumb.active"));
1089 } 1090 1091 function setSCFeatured(thumb) { 1092 var scImage = thumb.data("image"); 1093 var scID = thumb.data("id"); 1094 var scTitle = thumb.data("title"); 1095 $('.sc-featured-image a').removeClass('active'); 1096 $('.sc-featured-image a').attr('href', ''); 1097 $('.sc-featured-image').css('background-image', 'url("' + scImage + '")'); 1098 $('.sc-featured-image img').attr('src', scImage); 1099 $('.featured-title h2').text(scTitle); 1100 $('.fc-text').removeClass("active"); 1101 $('#' + scID).addClass("active"); 1102 if (thumb.data("video") != undefined && thumb.data("video") != "") { 1103 var scVideo = thumb.data("video"); 1104 $('.sc-featured-image a').addClass("active"); 1105 $('.sc-featured-image a').attr('href', scVideo); 1106 } 1107 } 1108 1109 $(".sc-card-thumb").on("click ", function() { 1110 $(".sc-card-thumb").removeClass("active"); 1111 $(this).addClass("active"); 1112 setSCFeatured($(this)); 1113 }); 1114 1115 /* factoid cross */ 1116 1117 fcHeight(); 1118 1119 function fcHeight() { 1120 if ($(".ps-factoid-cross").length) { 1121 if (window.innerWidth > 767) { 1122 var fcW = $(".fc-factoid").first().outerWidth() + 'px'; 1123 // console.log(); 1124 $(".fc-factoid").css("height", fcW) 1125 } else { 1126 $(".fc-factoid").css("height", "auto"); 1127 } 1128 } 1129 } 1130 1131 fcSlider(); 1132 1133 function fcSlider() { 1134 if ($(".ps-factoid-cross-mobile").length) { 1135 if (window.innerWidth < 768) { 1136 $('.ps-factoid-cross-mobile .fc-factoid').matchHeight(); 1137 const fcSwiper = new Swiper('.ps-factoid-cross-mobile .swiper', { 1138 spaceBetween: 15, 1139 navigation: { 1140 nextEl: '.ps-factoid-cross-mobile .swiper-button-next', 1141 prevEl: '.ps-factoid-cross-mobile .swiper-button-prev', 1142 }, 1143 }); 1144 } 1145 } 1146 } 1147 1148 /* card cta */ 1149 1150 ccHeight(); 1151 1152 function ccHeight() { 1153 if ($(".ps-card-cta").length) { 1154 if (window.innerWidth > 767) { 1155 var ccpx = $(".card-cta-links a").first().outerWidth(); 1156 $(".card-cta-links a").outerHeight(ccpx); 1157 } 1158 } 1159 } 1160 1161 /* carousel slider */ 1162 1163 if ($(".ps-carousel-slider .swiper").length) { 1164 const csSwiper = new Swiper('.ps-carousel-slider .swiper', { 1165 loop: true, 1166 slidesPerView: 1.1, 1167 centeredSlides: true, 1168 spaceBetween: 5, 1169 maxBackfaceHiddenSlides: 10, 1170 keyboard: { 1171 enabled: true, 1172 onlyInViewport: true, 1173 }, 1174 navigation: { 1175 nextEl: ".ps-carousel-slider .swiper-button-next", 1176 prevEl: ".ps-carousel-slider .swiper-button-prev", 1177 }, 1178 on: { 1179 init: function(csSwiper) { 1180 $('.ps-carousel-slider .swiper .swiper-slide').attr("inert", ""); 1181 setTimeout(function() { 1182 $('.ps-carousel-slider .swiper .swiper-slide.swiper-slide-active').removeAttr("inert"); 1183 }, 100); 1184 }, 1185 1186 slideChange: function(csSwiper) { 1187 $('.ps-carousel-slider .swiper .swiper-slide').attr("inert", ""); 1188 setTimeout(function() { 1189 $('.ps-carousel-slider .swiper .swiper-slide.swiper-slide-active').removeAttr("inert"); 1190 }, 100); 1191 } 1192 } 1193 }); 1194 } 1195 1196 /* faculty listing */ 1197 1198 flHeight(); 1199 1200 function flHeight() { 1201 if ($(".ps-faculty-listing").length) { 1202 $(".ps-faculty-listing .fitem").height($(".ps-faculty-listing .fitem").first().outerWidth()); 1203 } 1204 } 1205 1206 /* images */ 1207 1208 iHeight(); 1209 1210 function iHeight() { 1211 if ($(".ps-image-container").length) { 1212 if (window.innerWidth > 768) { 1213 $(".ps-image-container").each(function() { 1214 $(this).height($(this).find($(".bg-cover")).outerWidth() * .7); 1215 }); 1216 } else { 1217 $(".ps-image-container").css("height", "auto"); 1218 } 1219 } 1220 } 1221 1222 /* program finder */ 1223 1224 $(".pf-container-degrees .pf-button>button").on("click ", function() { 1225 $(".pf-container-degrees").toggleClass("active"); 1226 });
1227 1228 $(document).click(function(e) { 1229 if ($(".pf-container-degrees").hasClass("active")) { 1230 if (e.target.innerText != undefined && e.target.innerText.trim() != "Degrees") { 1231 $(".pf-container-degrees").removeClass("active"); 1232 } 1233 } 1234 }); 1235 1236 /* related programs */ 1237 1238 if ($(".ps-related-programs .swiper").length) { 1239 const rpSwiper = new Swiper('.ps-related-programs .swiper', { 1240 slidesPerView: 1, 1241 breakpoints: { 1242 1024: { 1243 slidesPerView: 2, 1244 spaceBetween: 20 1245 } 1246 }, 1247 spaceBetween: 0, 1248 maxBackfaceHiddenSlides: 10, 1249 keyboard: { 1250 enabled: true, 1251 onlyInViewport: false, 1252 }, 1253 navigation: { 1254 nextEl: ".ps-related-programs .swiper-button-next", 1255 prevEl: ".ps-related-programs .swiper-button-prev", 1256 } 1257 }); 1258 } 1259 1260 /* tabs */ 1261 1262 if ($(".ps-tabs").length) { 1263 1264 var activeTab, tabList, firstTab, lastTab, tabComponent; 1265 var tabCheck = "first"; 1266 1267 $(".ps-tabs .nav-link").on("click ", function(e) { 1268 $(".ps-tabs .nav-tabs.tabs-footer .nav-link").removeClass("active"); 1269 $("." + $(this).attr('id') + "-footer").addClass("active"); 1270 }); 1271 1272 $(".ps-tabs .nav-link").on('keydown', function(e) { 1273 tabList = $(this).parent(); 1274 firstTab = tabList.first('li'); 1275 lastTab = tabList.last('li'); 1276 tabComponent = $(this).parent().parent().parent().parent().parent().parent().parent(); 1277 if (e.which == 9) { 1278 if (!e.shiftKey) { 1279 if ($(this).hasClass("active")) { 1280 activeTab = $(this); 1281 e.preventDefault(); 1282 if ($("#" + $(this).data('bs-target').replace("#", "")).find('a').length > 0) { 1283 $("#" + $(this).data('bs-target').replace("#", "")).find('a').first().focus(); 1284 } else { 1285 activeTab.parent().next('li').find("button").focus(); 1286 } 1287 } else { 1288 if ($(this).parent().is(':last-child')) { 1289 e.preventDefault(); 1290 if (tabComponent.nextAll('section').eq(0).find('a').length > 0) { 1291 tabComponent.nextAll('section').eq(0).find('a').first().focus(); 1292 } else if (tabComponent.nextAll('section').eq(0).find('.swiper-button-next').length > 0) { 1293 tabComponent.nextAll('section').eq(0).find('.swiper-button-next').focus(); 1294 } 1295 } 1296 } 1297 } 1298 } else if (e.which == 13) { 1299 activeTab = $(this); 1300 if ($(this).parent().is(':last-child')) { 1301 tabCheck = "last"; 1302 } else if ($(this).parent().is(':first-child')) { 1303 tabCheck = "first"; 1304 } else { 1305 tabCheck = ""; 1306 } 1307 e.preventDefault(); 1308 activeTab.trigger("click"); 1309 activeTab.focus(); 1310 } 1311 }); 1312 1313 $(".ps-tabs .tab-content a").on('keydown', function(e) { 1314 if (e.which == 9) { 1315 e.preventDefault(); 1316 if (e.shiftKey) { 1317 if ($(this).is($('.tab-content .active a').first())) { 1318 activeTab.focus(); 1319 } 1320 } else { 1321 if ($(this).is($('.tab-content .active a').last())) { 1322 if (tabCheck == "last") { 1323 tabComponent.next().find('a').first().focus(); 1324 } else { 1325 tabList.next('li').find("button").focus(); 1326 } 1327 } 1328 } 1329 } 1330 }); 1331 } 1332 1333 /* testimonials */ 1334 1335 function randomize(a) { 1336 c = a.length; 1337 while (c) b = Math.random() * (--c + 1) | 0, d = a[c], a[c] = a[b], a[b] = d 1338 } 1339 1340 if ($(".ps-testimonial").length) { 1341 1342 randomize(testimonials); 1343 1344 var tSlides = ""; 1345 var tSlide = ""; 1346 1347 var shouldSkip = false;
1348 testimonials.forEach((t, i) => { 1349 if (shouldSkip) { 1350 return; 1351 } 1352 if (i == testimonialsLimit) { 1353 shouldSkip = true; 1354 return; 1355 } 1356 // console.log(i); 1357 tSlide = ''; 1358 tSlide += '<div class="swiper-slide"><div class="ps-testimonial-container ' + t.containerClass + '">'; 1359 if (t.image) { 1360 tSlide += '<div class="timage bg-cover" style="background-image:url(\'' + t.image + '\')">'; 1361 tSlide += '<img alt="' + t.imageAlt + '" src="' + t.image + '" />'; 1362 tSlide += '<div class="toverlay"><div class="tyellow"></div></div></div>'; 1363 } 1364 tSlide += '<div class="tcontent"><div class="w80 content"><p class="quote intro">' + t.text + '</p>'; 1365 tSlide += '<p class="author">' + t.author + '</p>'; 1366 if (t.watermark) { 1367 tSlide += '<img class="logobg" alt="testimonial watermark" src="_files/images/B-logo-cropped.svg">'; 1368 } 1369 tSlide += '</div></div></div></div>'; 1370 tSlides += tSlide; 1371 }); 1372 1373 $(".ps-testimonial .swiper-wrapper").append(tSlides); 1374 1375 tSlider(); 1376 1377 } 1378 1379 function tSlider() { 1380 if ($(".ps-testimonial").length) { 1381 const fcSwiper = new Swiper('.ps-testimonial .swiper', { 1382 slidesPerView: 1, 1383 navigation: { 1384 nextEl: '.ps-testimonial .swiper-button-next', 1385 prevEl: '.ps-testimonial .swiper-button-prev', 1386 }, 1387 }); 1388 } 1389 } 1390 1391 /* accordion scroll */ 1392 1393 if ($(".ps-accordion").length) { 1394 $('.accordion .collapse').on('shown.bs.collapse', function(e) { 1395 var $card = $(this).closest('.accordion-item'); 1396 var $open = $($(this).data('parent')).find('.collapse.show'); 1397 var additionalOffset = 130; 1398 if ($card.prevAll().filter($open.closest('.accordion-item')).length !== 0) { 1399 additionalOffset = $open.height(); 1400 } 1401 $('html,body').animate({ 1402 scrollTop: $card.offset().top - additionalOffset 1403 }, 10); 1404 }); 1405 } 1406 1407 /* programs */ 1408 1409 var activeFilters = ["All"]; 1410 var filters1 = [".all"]; 1411 var filters2 = []; 1412 var filters3 = []; 1413 var regex = /[^A-Za-z0-9]/g; 1414 1415 displayCheck(); 1416 1417 if ($(".ps-programs").length) { 1418 resultCount(); 1419 var urlParams = getURLParams(); 1420 if (urlParams.filters) { 1421 urlParams.filters.split(",").forEach(function(f) { 1422 if (f.includes("bachelor") || f.includes("master") || f.includes("doctoral") || f.includes("certificates") || f.includes("associate")) { 1423 $(".ps-programs .ps-programs-top .filter1").removeClass("active"); 1424 $(".filter1." + f).addClass("active"); 1425 } else { 1426 $("input." + f + ":checkbox").prop("checked", true); 1427 } 1428 }); 1429 checkFilters(); 1430 } 1431 } 1432 1433 $(".ps-programs .ps-programs-top .display button").on("click", function() { 1434 $(".ps-programs .ps-programs-top .display button").toggleClass("active"); 1435 $(".ps-programs .ps-programs-list").toggleClass("thumb"); 1436 $.fn.matchHeight._update() 1437 }); 1438 1439 $(".ps-programs .ps-programs-top .filter1").on("click", function() { 1440 $(".ps-programs .ps-programs-top .filter1").removeClass("active"); 1441 $(this).addClass("active"); 1442 checkFilters(); 1443 }); 1444 1445 $(".ps-programs .ps-programs-side #location-link").on("click", function(e) { 1446 e.preventDefault(); 1447 window.location.href = $(this).attr('data-link'); 1448 }); 1449 1450 $(".ps-programs .ps-programs-side input.filter-checkbox:checkbox").change(function() { 1451 checkFilters(); 1452 }); 1453 1454 $(".ps-programs .ps-programs-side button.reset").on("click", function() { 1455 resetFilter1(); 1456 $(".ps-programs .ps-programs-side input.filter-checkbox:checkbox:checked").each(function() { 1457 $(this).prop("checked", false); 1458 }); 1459 checkFilters(); 1460 });
1461 1462 $('body').on('click', 'a.active-filter', function() { 1463 if ($(this).data("filter").includes("bachelor") || $(this).data("filter").includes("master") || $(this).data("filter").includes("doctoral") || $(this).data("filter").includes("certificates") || $(this).data("filter").includes("associate")) { 1464 resetFilter1(); 1465 checkFilters(); 1466 } else { 1467 $("." + $(this).data("filter") + ":checkbox:checked").each(function() { 1468 $(this).prop("checked", false); 1469 }); 1470 checkFilters(); 1471 } 1472 }); 1473 1474 function resetFilter1() { 1475 filters1 = [".all"]; 1476 $(".ps-programs .ps-programs-top .filter1").removeClass("active"); 1477 $(".ps-programs .ps-programs-top .filter1.all").addClass("active"); 1478 } 1479 1480 function aF() { 1481 $(".active-filters").empty(); 1482 activeFilters.forEach(function(f) { 1483 if (f != "All") { 1484 var afHTML = ""; 1485 afHTML = '<a href="javascript:void(0)" title="Remove ' + f + '" class="active-filter" data-filter="' + f.replace(" Degree", "").replace(regex, "").toLowerCase() + '">x ' + f + '</a>'; 1486 $(".active-filters").append(afHTML); 1487 } 1488 }); 1489 } 1490 1491 function resultCount() { 1492 $(".ps-programs .results span").empty(); 1493 $(".ps-programs .results span").append($(".ps-program.show:not([style*='display: none'])").length); 1494 aF(); 1495 } 1496 1497 function checkFilters() { 1498 activeFilters = []; 1499 filters1 = []; 1500 filters2 = []; 1501 filters3 = []; 1502 1503 $(".filter1.active").each(function() { 1504 filters1.push("." + $(this).data("degree").replace(" Degree", "").replace(regex, "").toLowerCase()); 1505 activeFilters.push($(this).data("degree")); 1506 }); 1507 1508 if ($(".filter2:checkbox:checked").length > 0) { 1509 $(".ps-programs .ps-programs-list .ps-program").removeClass("show"); 1510 $(".filter2:checkbox:checked").each(function() { 1511 var checkedClass = "." + $(this).val().replace(regex, "").toLowerCase(); 1512 activeFilters.push($(this).val()); 1513 filters2.push(checkedClass); 1514 if (filters1.length > 0 && filters3.length > 0) { 1515 filters1.forEach(function(v) { 1516 var updatedClass1 = checkedClass + v; 1517 filters3.forEach(function(v) { 1518 var updatedClass2 = updatedClass1 + v; 1519 $(".ps-program" + updatedClass2).addClass("show"); 1520 }); 1521 }); 1522 } else if (filters1.length == 0 && filters3.length == 0) { 1523 if (filters2.length > 0) { 1524 filters2.forEach(function(v) { 1525 $(".ps-program" + v).addClass("show"); 1526 }); 1527 } 1528 } else { 1529 if (filters1.length > 0) { 1530 filters1.forEach(function(v) { 1531 var updatedClass = checkedClass + v; 1532 $(".ps-program" + updatedClass).addClass("show"); 1533 }); 1534 } 1535 if (filters3.length > 0) { 1536 filters3.forEach(function(v) { 1537 var updatedClass = checkedClass + v; 1538 $(".ps-program" + updatedClass).addClass("show"); 1539 }); 1540 } 1541 } 1542 }); 1543 } 1544 1545 if ($(".filter3:checkbox:checked").length > 0) { 1546 $(".ps-programs .ps-programs-list .ps-program").removeClass("show"); 1547 $(".filter3:checkbox:checked").each(function() { 1548 var checkedClass = "." + $(this).val().replace(regex, "").toLowerCase(); 1549 activeFilters.push($(this).val()); 1550 filters3.push(checkedClass); 1551 if (filters1.length > 0 && filters2.length > 0) { 1552 filters1.forEach(function(v) { 1553 var updatedClass1 = checkedClass + v; 1554 filters2.forEach(function(v2) { 1555 var updatedClass2 = updatedClass1 + v2; 1556 $(".ps-program" + updatedClass2).addClass("show"); 1557 }); 1558 }); 1559 } else if (filters1.length == 0 && filters2.length == 0) { 1560 if (filters3.length > 0) { 1561 filters3.forEach(function(v) { 1562 $(".ps-program" + v).addClass("show"); 1563 }); 1564 } 1565 } else { 1566 if (filters1.length > 0) { 1567 filters1.forEach(function(v) { 1568 var updatedClass = checkedClass + v; 1569 $(".ps-program" + updatedClass).addClass("show"); 1570 }); 1571 } 1572 if (filters2.length > 0) { 1573 filters2.forEach(function(v) { 1574 var updatedClass = checkedClass + v; 1575 $(".ps-program" + updatedClass).addClass("show"); 1576 }); 1577 } 1578 } 1579 }); 1580 } 1581 1582 if ($(".filter2:checkbox:checked").length == 0 && $(".filter3:checkbox:checked").length == 0) { 1583 $(".ps-programs .ps-programs-list .ps-program").removeClass("show"); 1584 filters1.forEach(function(v) { 1585 $(".ps-program" + v).addClass("show"); 1586 }); 1587 } 1588 resultCount(); 1589 updateURL(); 1590 } 1591 1592 function updateURL() { 1593 var afURL = filters1.concat(filters2).concat(filters3); 1594 afURL = "?filters=" + afURL.toString().replaceAll("all,", "").replaceAll(".", ""); 1595 window.history.replaceState(null, null, afURL); 1596 } 1597 1598 function getURLParams() { 1599 var url = document.location.href; 1600 if (url.includes("?")) { 1601 var qs = url.substring(url.indexOf('?') + 1).split('&'); 1602 for (var i = 0, result = {}; i < qs.length; i++) { 1603 qs[i] = qs[i].split('='); 1604 result[qs[i][0]] = decodeURIComponent(qs[i][1]); 1605 } 1606 return result; 1607 } else { 1608 return false 1609 } 1610 } 1611 1612 function displayCheck() { 1613 if ($(".ps-programs").length) { 1614 if (window.innerWidth < 768) {
1615 $(".ps-programs .ps-programs-top .display button").removeClass("active"); 1616 $(".ps-programs .ps-programs-list").removeClass("thumb"); 1617 $(".ps-programs .ps-programs-top .display button.list").addClass("active"); 1618 } 1619 } 1620 } 1621 1622 /* keyboard tabs */ 1623 1624 // uncomment to test keyboard tabs 1625 var body = document.querySelector('body'); 1626 body.addEventListener('keyup', checkTabPress); 1627 1628 function checkTabPress(e) { 1629 "use strict"; 1630 e = e || event; 1631 var activeElement; 1632 if (e.keyCode == 9) { 1633 activeElement = document.activeElement; 1634 console.log(activeElement); 1635 } 1636 } 1637 1638 /* cookies */ 1639 1640 function remove(arrOriginal, elementToRemove) { 1641 return arrOriginal.filter(function(el) { return el !== elementToRemove }); 1642 } 1643 1644 /* cookies */ 1645 1646 function setCookie(cname, cvalue, extime) { 1647 var d = new Date(); 1648 d.setTime(d.getTime() + (extime * 1000)); 1649 var expires = "expires=" + d.toUTCString(); 1650 document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/"; 1651 } 1652 1653 function getCookie(cname) { 1654 var name = cname + "="; 1655 var ca = document.cookie.split(';'); 1656 for (var i = 0; i < ca.length; i++) { 1657 var c = ca[i]; 1658 while (c.charAt(0) == ' ') { 1659 c = c.substring(1); 1660 } 1661 if (c.indexOf(name) == 0) { 1662 return c.substring(name.length, c.length); 1663 } 1664 } 1665 return ""; 1666 } 1667 1668 /* sticky/scroll header */ 1669 1670 var didScroll = true; 1671 var lastScrollTop = 0; 1672 var delta = 1; 1673 var navbarHeight = $('header').outerHeight(); 1674 1675 $(window).scroll(function(event) { 1676 didScroll = true; 1677 }); 1678 1679 setInterval(function() { 1680 if (didScroll) { 1681 hasScrolled(); 1682 didScroll = false; 1683 } 1684 }, 100); 1685 1686 function hasScrolled() { 1687 // console.log(1); 1688 var topM = 0; 1689 var st = $(window).scrollTop(); 1690 if (Math.abs(lastScrollTop - st) <= delta) 1691 return; 1692 if (st > lastScrollTop && st > navbarHeight) { 1693 if ($(".bh-alert").length) { 1694 topM = 128 + $('.bh-alert').outerHeight(); 1695 topM = "-" + topM + "px"; 1696 } else { 1697 topM = "-" + 128 + "px"; 1698 } 1699 $('header').css("top", topM); 1700 } else { 1701 if (st + $(window).height() < $(document).height()) { 1702 $('header').css("top", "0"); 1703 } 1704 } 1705 lastScrollTop = st; 1706 } 1707 1708 /* Alert Banner JS */ 1709 1710 if ($(".bh-alert").length) { 1711 var alertClose = document.getElementsByClassName("alert-closebtn"); 1712 var Ai; 1713 for (Ai = 0; Ai < alertClose.length; Ai++) { 1714 alertClose[Ai].onclick = function() { 1715 var div = this.parentElement; 1716 div.style.opacity = "0"; 1717 setTimeout(function() { 1718 div.style.display = "none"; 1719 }, 200); 1720 $('body').css('margin-top', 0); 1721 } 1722 $('body').css('margin-top', $('.bh-alert').outerHeight()); 1723 } 1724 } 1725 1726});
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.