1(function ($) { 2 console.log("invoked"); 3 var loadedClass = 'is-loaded', 4 threads = []; 5 6 // Show comments on demand 7 $('[data-disqus-show]').on('click', function (e) { 8 if (!$('#disqus_thread').hasClass(loadedClass)) { 9 $('#disqus_thread').addClass(loadedClass); 10 $.ajaxSetup({cache: true}); 11 $.getScript('//' + Drupal.settings.disqus.domain + '.disqus.com/embed.js'); 12 $.ajaxSetup({cache: false}); 13 } 14 }); 15 16 /* 17 TURNING OFF AS NOT WORKING ON DEV/STAGE/PRODUCTION SITES 18 // Loop through each comment count element on the page and 19 // add to the `threads` array which is used in the json `thread` 20 // ajax request 21 $('[data-disqus]').each(function () { 22 threads.push('link:' + $(this).attr('data-disqus')); 23 }); 24 25 // If there are URL's 26 if (threads.length !== 0) { 27 28 $.ajax({ 29 type: 'GET', 30 url: 'https://disqus.com/api/3.0/threads/set.jsonp', 31 data: { 32 api_key: window.disqusPublicKey, 33 forum: Drupal.settings.disqus.domain, 34 thread: threads 35 }, 36 cache: false, 37 dataType: 'jsonp', 38 success: function (result) { 39 // Returning an array of response results 40 if ($(result.response).size() > 1) { 41 $.each(result.response, function (item) { 42 // If there are comments, show the item and populate the comment count 43 $('[data-disqus="' + item.link + '"]').show().find('.js-disqus-count').text(item.posts); 44 }); 45 } else { 46 // Single response returned 47 if (result.response.length === 1) { 48 // If there are comments, show the item and populate the comment count 49 $('[data-disqus="' + result.response[0].link + '"]').show().find('.js-disqus-count').text(result.response[0].posts); 50 } 51 } 52 } 53 }); 54 } 55 */ 56 57})(jQuery); 58(function ($) { 59 60 var activeClass = 'is-active', 61 overlayClass = 'is-overlay'; 62 63 function closeOverlay() { 64 $('.overlay').removeClass(activeClass); 65 $('.site-wrapper').removeClass(overlayClass); 66 } 67 68 if ($('.pint-date-selector').length) { 69 $('.pint-date-selector').datepicker({ 70 showButtonPanel: true, 71 closeText: '<i class="icon-close"></i>', 72 showOn: 'both', 73 minDate: '-6W', 74 maxDate: '+6W', 75 dateFormat: 'yymmdd', 76 navigationAsDateFormat: true, 77 prevText: "M", 78 nextText: "M", 79 onClose: function () { 80 // When the picker is closed 81 closeOverlay(); 82 } 83 }).change(function () { 84 // Submit the Drupal form when the picker is changed 85 $('#pint-date-selector-popup-form').find('input.form-submit').click(); 86 closeOverlay(); 87 }).blur(); 88 } 89 90 // Trigger the picker when clicking our custom element 91 $('[data-js="cal-popup"]').on('click', function (e) { 92 e.preventDefault(); 93 $(this).next('form').find('.ui-datepicker-trigger').trigger('click'); 94 $('.overlay').addClass(activeClass); 95 $('.site-wrapper').addClass(overlayClass); 96 }); 97 98 $(document).keydown(function (event) { 99 // ESC key, trigger closing the picker 100 if (event.which === 27) { 101 $('#pint-date-selector-popup-form').find('input.form-submit').click(); 102 } 103 }); 104 105})(jQuery); 106(function ($) { 107 108 var hiddenClass = 'is-hidden', 109 editableClass = 'is-editable', 110 deleteClass = 'is-deletable'; 111 112 // Toggle between edit and view mode 113 $('[data-js="edit"]').on('click', function (e) { 114 e.preventDefault(); 115 // Delete any deletable items 116 $('.is-deletable').parent('.card-list__item, .card-grid__item, .card-feed__item').remove(); 117 // Toggle editable states 118 $('[data-js="edit--inactive"], [data-js="edit--active"]').toggleClass(hiddenClass); 119 $('[data-js="edit--item"]').toggleClass(editableClass); 120 }); 121 122 // Changing the items flag, flag the item to be deleted 123 $('[data-js="edit-item-check"]').on('click', function () { 124 $(this).parents('[data-js="edit--item"]').toggleClass(deleteClass); 125 }); 126 127})(jQuery); 128(function ($) { 129 130 var resizeTimeout, 131 flexElement = $('[data-js="flexmenu"]'), 132 flexStatus = false, 133 desktopSize = 1024, 134 flexedClass = 'is-flexed'; 135 136 // Func to check if the menu should be on or not 137 function checkFlexmenu() { 138 // Do/Undo flexMenu() plugin, check status before recalling though 139 if ($(window).width() >= desktopSize) { 140 141 if (flexStatus === false) { 142 flexElement.flexMenu(); 143 144 //if (!$('body').hasClass('is-subnav')) { 145 flexElement.addClass(flexedClass); 146 //} 147 148 // Remove inline styles if coming from mobile menu 149 $('.panel--mob').removeAttr('style'); 150 flexStatus = true; 151 } 152 } else { 153 if (flexStatus === true) { 154 flexElement.flexMenu({ 155 'undo': true 156 }).removeClass(flexedClass); 157 flexStatus = false;
158 } 159 } 160 } 161 162 // Call check on load 163 checkFlexmenu(); 164 165 // As the window is resize, call function 166 $(window).resize(function () { 167 clearTimeout(resizeTimeout); 168 resizeTimeout = setTimeout(function () { 169 checkFlexmenu(); 170 }, 200); 171 }); 172 173})(jQuery); 174(function ($) { 175 176 var resizeTimeout, 177 collapsedClass = 'is-collapsed', 178 openClass = 'is-active', 179 processClass = 'process-close'; 180 181 function getTotalWidth() { 182 width = 0; 183 $('[data-js="navigator-dropdown"] a').each(function () { 184 // Only take into account the width of enabled linked 185 // items not enabled and any hidden via CSS will 186 // throw off the width of the navigator and show it to 187 // be scrollable when it isn't 188 if (!$(this).hasClass('is-disabled')) { 189 width += parseInt($(this).outerWidth()); 190 } 191 }); 192 return width; 193 } 194 195 function reorderList() { 196 // Reorder list by index 197 $('[data-js="navigator-dropdown"] .navi__list').find('a').sort(function (a, b) { 198 return +a.getAttribute('data-js-navigator-index') - +b.getAttribute('data-js-navigator-index'); 199 }).appendTo('[data-js="navigator-dropdown"] .navi__list'); 200 } 201 202 // Add original ordering for `undo` functionality 203 $('[data-js="navigator-dropdown"] a').each(function (i, el) { 204 $(this).attr('data-js-navigator-index', i); 205 }); 206 207 // Toggle navigator open/closed 208 $('[data-js="navigator-dropdown"]').on('click', 'a.is-active', function (e) { 209 e.preventDefault(); 210 if ($('[data-js="navigator-dropdown"]').hasClass(collapsedClass) && !$('[data-js="navigator-dropdown"]').hasClass(processClass)) { 211 // Toggling 212 $('[data-js="navigator-dropdown"], .navi__list').toggleClass(openClass); 213 } else if ($('[data-js="navigator-dropdown"]').hasClass(collapsedClass) && $('[data-js="navigator-dropdown"]').hasClass(processClass)) { 214 // Close it 215 $('[data-js="navigator-dropdown"], .navi__list').removeClass(openClass).removeClass(processClass); 216 } 217 }); 218 219 // Changing navigator 220 $('[data-js="navigator-dropdown"] .navi__list').on('click', 'a', function (e) { 221 if ($('[data-js="navigator-dropdown"]').hasClass(collapsedClass)) { 222 // Move current active item back into list 223 $('[data-js="navigator-dropdown"] > a').prependTo('[data-js="navigator-dropdown"] .navi__list').removeClass(openClass); 224 // Move active item to the top 225 $(this).prependTo('[data-js="navigator-dropdown"]').addClass(openClass); 226 // Add a processing class as the other .on click event will fire 227 // after this so we can ensure the navigator does get closed 228 $('[data-js="navigator-dropdown"]').addClass(processClass); 229 // Close navigator 230 $('[data-js="navigator-dropdown"], .navi__list').removeClass(openClass); 231 reorderList(); 232 } 233 }); 234 235 function doNavigator() { 236 $('[data-js="navigator-dropdown"]').addClass(collapsedClass); 237 $('.navi__label').hide(); 238 // Move active item to the top 239 $('[data-js="navigator-dropdown"] a.is-active').prependTo('[data-js="navigator-dropdown"]'); 240 } 241 242 function undoNavigator() { 243 $('[data-js="navigator-dropdown"], .navi__list').removeClass(collapsedClass).removeClass(openClass); 244 $('.navi__label').show(); 245 // Move the first item back into the list 246 $('[data-js="navigator-dropdown"] > a').prependTo('[data-js="navigator-dropdown"] .navi__list'); 247 reorderList(); 248 } 249 250 function checkNavigator() { 251 doNavigator(); 252 } 253 254 // Call check on load 255 checkNavigator(); 256 257 // As the window is resized, call function 258 $(window).resize(function () { 259 clearTimeout(resizeTimeout); 260 resizeTimeout = setTimeout(function () { 261 checkNavigator(); 262 }, 200); 263 }); 264 265})(jQuery); 266(function ($) { 267 268 var resizeTimeout, 269 collapsedClass = 'is-collapsed', 270 openClass = 'is-active', 271 processClass = 'process-close', 272 mobileSize = '689', 273 totalWidth = false; 274 275 function getTotalWidth() { 276 width = 0; 277 $('[data-js="navigator"] a').each(function () { 278 // Only take into account the width of enabled linked 279 // items not enabled and any hidden via CSS will 280 // throw off the width of the navigator and show it to 281 // be scrollable when it isn't 282 if (!$(this).hasClass('is-disabled')) { 283 width += parseInt($(this).outerWidth()); 284 } 285 }); 286 return width; 287 } 288 289 function reorderList() { 290 // Reorder list by index 291 $('[data-js="navigator"] .navi__list').find('a').sort(function (a, b) { 292 return +a.getAttribute('data-js-navigator-index') - +b.getAttribute('data-js-navigator-index'); 293 }).appendTo('[data-js="navigator"] .navi__list'); 294 } 295 296 // Add original ordering for `undo` functionality 297 $('[data-js="navigator"] a').each(function (i, el) { 298 $(this).attr('data-js-navigator-index', i); 299 }); 300 301 // Toggle navigator open/closed 302 $('[data-js="navigator"]').on('click', 'a.is-active', function (e) { 303 e.preventDefault(); 304 if ($('[data-js="navigator"]').hasClass(collapsedClass) && !$('[data-js="navigator"]').hasClass(processClass)) { 305 // Toggling 306 $('[data-js="navigator"], .navi__list').toggleClass(openClass); 307 } else if ($('[data-js="navigator"]').hasClass(collapsedClass) && $('[data-js="navigator"]').hasClass(processClass)) { 308 // Close it 309 $('[data-js="navigator"], .navi__list').removeClass(openClass).removeClass(processClass); 310 } 311 }); 312 313 // Changing navigator 314 $('[data-js="navigator"] .navi__list').on('click', 'a', function (e) { 315 if ($('[data-js="navigator"]').hasClass(collapsedClass)) { 316 // Move current active item back into list 317 $('[data-js="navigator"] > a').prependTo('[data-js="navigator"] .navi__list').removeClass(openClass); 318 // Move active item to the top 319 $(this).prependTo('[data-js="navigator"]').addClass(openClass); 320 // Add a processing class as the other .on click event will fire 321 // after this so we can ensure the navigator does get closed 322 $('[data-js="navigator"]').addClass(processClass); 323 324 //Get to link 325 var linkUrl = $(this).attr('href'); 326 window.location.href = linkUrl; 327 328 // Close navigator 329 $('[data-js="navigator"], .navi__list').removeClass(openClass); 330 reorderList(); 331 } 332 }); 333 334 function doNavigator() { 335 $('[data-js="navigator"]').addClass(collapsedClass); 336 $('.navi__label').hide(); 337 // Move active item to the top 338 $('[data-js="navigator"] a.is-active').prependTo('[data-js="navigator"]'); 339 reorderList(); 340 } 341 342 function undoNavigator() { 343 $('[data-js="navigator"], .navi__list').removeClass(collapsedClass).removeClass(openClass); 344 $('.navi__label').show(); 345 // Move the first item back into the list 346 $('[data-js="navigator"] > a').prependTo('[data-js="navigator"] .navi__list'); 347 reorderList(); 348 } 349 350 function checkNavigator() { 351 var windowWidth = $(window).width(); 352 353 if (totalWidth === false) { 354 totalWidth = getTotalWidth(); 355 } 356 357 if (windowWidth <= mobileSize) { 358 // *** Activate dropdown navigator 359 doNavigator(); 360 } else { 361 if (totalWidth > windowWidth) { 362 // *** Activate dropdown navigator 363 doNavigator(); 364 } else { 365 // *** There's enough room, Undo 366 undoNavigator(); 367 } 368 } 369 } 370 371 // Call check on load 372 checkNavigator(); 373 374 // As the window is resized, call function 375 $(window).resize(function () { 376 clearTimeout(resizeTimeout); 377 resizeTimeout = setTimeout(function () { 378 checkNavigator(); 379 }, 200); 380 }); 381 382})(jQuery); 383(function ($) { 384 385 var newsletterEmailTextField = $('#edit-submitted-e-mail-address'), 386 captchaWrapper = $('.newsletter-block-form .captcha'); 387 388 //Hide the recaptcha as default 389 captchaWrapper.hide(); 390 391 //On focus in, show captcha 392 newsletterEmailTextField.focusin( 393 //Show the captcha when the focus is on 394 function () { 395 captchaWrapper.show(); 396 } 397 ); 398})(jQuery); 399 400 401(function ($) { 402 403 var activeClass = 'is-active'; 404 405 function getOverlayItem(parent) { 406 return $('[data-js-overlay-item="' + $(parent).attr('data-js-overlay') + '"]'); 407 } 408 409 // On demand, show overlay 410 $('[data-js-overlay]').on('click', function (e) { 411 e.preventDefault(); 412 $(getOverlayItem(this)).toggleClass(activeClass); 413 }); 414 415 // Close overlay 416 $('[data-js-overlay-close]').on('click', function (e) { 417 e.preventDefault(); 418 $(this).parent('[data-js-overlay-item]').removeClass(activeClass); 419 }); 420 421})(jQuery); 422(function ($) { 423 424 // On demand, remove item completely 425 $('[data-js-remove]').on('click', function (e) { 426 e.preventDefault(); 427 var item = $(this).attr('data-js-remove'), 428 removeItem = $('[data-js-remove-item="' + item + '"]');
429 $(removeItem).slideUp(function () { 430 // When complete, remove 431 $(removeItem).remove(); 432 }); 433 }); 434 435})(jQuery); 436(function ($) { 437 438 var activeClass = 'is-active'; 439 440 // Hide open reveals 441 function hideReveals() { 442 // Loop through any reveal widgets and hide the reveal item 443 $('[data-js-reveal]').each(function () { 444 $(this).removeClass(activeClass).parent('.tooltip').removeClass(activeClass); 445 var item = $(this).attr('data-js-reveal'); 446 $('[data-js-reveal-item="' + item + '"]').addClass('is-hidden').removeAttr('style'); 447 //$('[data-js-reveal-item="' + item + '"]').slideUp(); 448 }); 449 } 450 451 hideReveals(); 452 453 // On demand, show reveal item 454 $('[data-js-reveal]').on('click', function (e) { 455 e.preventDefault(); 456 // Hide any currently open reveals, if the item being clicked isn't to be closed 457 if (!$(this).hasClass(activeClass)) { 458 hideReveals(); 459 } 460 var item = $(this).attr('data-js-reveal'); 461 // Toggle an active state 462 // Don't use $(this) as if multiple elements on a page they are all affected 463 $('[data-js-reveal="' + item + '"]').toggleClass(activeClass).parent('.tooltip').toggleClass(activeClass); 464 // Show the item 465 $('[data-js-reveal-item="' + item + '"]').slideToggle(function () { 466 // Searchbox 467 if (item === 'search-panel') { 468 var textfield = $('[data-js-reveal-item="' + item + '"]').find('.form-text'); 469 if ($(textfield).is(':visible')) { 470 // Note some OS don't listen to .focus() 471 $(textfield).focus(); 472 } else { 473 $(textfield).blur(); 474 } 475 } 476 }); 477 }); 478 479})(jQuery); 480(function ($) { 481 482 var activeClass = 'is-active'; 483 484 function getRolloutItem(parent) { 485 return $('[data-js-rollout-item="' + $(parent).attr('data-js-rollout') + '"]'); 486 } 487 488 // Loop through any rollout widgets and hide the rollout item 489 $('[data-js-rollout]').each(function () { 490 $(this).removeClass(activeClass); 491 $(getRolloutItem(this)).addClass('is-rollout').removeAttr('style'); 492 }); 493 494 // On demand, rollout contents 495 $('[data-js-rollout]').on('click', function (e) { 496 e.preventDefault(); 497 $(this).toggleClass(activeClass).parent('.tooltip').toggleClass(activeClass); 498 $(getRolloutItem(this)).toggleClass(activeClass); 499 }); 500 501})(jQuery); 502(function ($) { 503 504 var activeClass = 'is-active'; 505 506 // On demand, show item 507 $('[data-js-show]').on('click', function (e) { 508 e.preventDefault(); 509 // Toggle an active state 510 $(this).toggleClass(activeClass); 511 // Show the item(s) 512 var items = $(this).attr('data-js-show').split(" "); 513 // `index` in the function is required even though it's not used 514 $.each(items, function (index, item) { 515 $('[data-js-show-item="' + item + '"]').toggleClass(activeClass); 516 // If site navigation, disallow page scroll 517 if (item === 'mob-panel') { 518 $('body').toggleClass('is-overflow'); 519 } 520 if (item === 'main-nav') { 521 // Re-call flexMenu when toggling visibility 522 // as the plugin uses :visible to determine 523 // when to display the `More` dropdown 524 $('.site-bar').one('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd', 525 function () { 526 // Execute after animation ends 527 $('[data-js="flexmenu"]').flexMenu().addClass('is-flexed'); 528 }); 529 } 530 }); 531 }); 532 533})(jQuery); 534(function ($) { 535 536 var popupCenter = function(url, title, w, h) { 537 // Fixes dual-screen position, Most browsers, Firefox 538 var dualScreenLeft = window.screenLeft !== undefined ? window.screenLeft : screen.left, 539 dualScreenTop = window.screenTop !== undefined ? window.screenTop : screen.top, 540 width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width, 541 height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height, 542 left = ((width / 2) - (w / 2)) + dualScreenLeft, 543 top = ((height / 3) - (h / 3)) + dualScreenTop, 544 newWindow = window.open(url, title, 'scrollbars=yes, width=' + w + ', height=' + h + ', top='
544+ top + ', left=' + left); 545 546 // Puts focus on the newWindow 547 if (window.focus) { 548 newWindow.focus(); 549 } 550 }; 551 552 // Open social share windows in a popup 553 $('[data-js="social-share"]').on('click', function(e) { 554 var self = $(this); 555 popupCenter(self.attr('href'), self.attr('title'), 580, 470); 556 e.preventDefault(); 557 }); 558 559})(jQuery); 560(function ($) { 561 562 $('[data-js="ticker"]').cycle({ 563 pause: true, 564 timeout: 5000 565 }); 566 567}(jQuery)); 568(function ($) { 569 570 var resizeTimeout, 571 activeClass = 'is-active', 572 startClass = 'is-start', 573 animatedClass = 'is-animated', 574 animatingClass = 'is-animating'; 575 576 // Returns true if the specified element has been scrolled into the viewport. 577 function isElementInViewport(elem) { 578 var $elem = $(elem); 579 580 // Get the scroll position of the page. 581 var scrollElem = ((navigator.userAgent.toLowerCase().indexOf('webkit') !== -1) ? 'body' : 'html'), 582 viewportTop = $(scrollElem).scrollTop(), 583 viewportBottom = viewportTop + $(window).height(); 584 585 // Get the position of the element on the page. 586 var elemTop = Math.round($elem.offset().top), 587 elemBottom = elemTop + $elem.height(); 588 589 return ((elemTop < viewportBottom) && (elemBottom > viewportTop)); 590 } 591 592 // Check if it's time to start the animation. 593 function checkAnimation() { 594 // If the animation has already been started 595 $('.bar__value').each(function () { 596 if (!$(this).hasClass(animatingClass) || !$(this).hasClass(animatedClass)) { 597 if (isElementInViewport(this)) { 598 // Start the animation, apply the % width 599 $(this).addClass(animatingClass).delay(400).css({ 600 'width': $(this).attr('data-percent') + '%' 601 }).delay(900).addClass(animatedClass); 602 } 603 } 604 }); 605 } 606 607 // When the CSS transition has ended, show the duration 608 $('.bar__value').on('webkitTransitionEnd moztransitionend transitionend oTransitionEnd', function () { 609 $(this).removeClass(animatingClass); 610 $(this).find('.bar__flag').addClass(activeClass); 611 }); 612 613 // Check if the duration is longer than the percentage bar 614 function checkDuration() { 615 $('.bar').each(function () { 616 var barW = $(this).width(), 617 durationW = $(this).find('.bar__flag').width(), 618 progressPercent = $(this).find('.bar__value').attr('data-percent'), 619 progressW = (barW / 100) * progressPercent; 620 621 // Position the duration at the start if it's all long 622 if (progressW <= durationW) { 623 $(this).find('.bar__flag').addClass(startClass); 624 } else { 625 $(this).find('.bar__flag').removeClass(startClass); 626 } 627 }); 628 } 629 630 $(document).ready(function () { 631 if ($('.bar__value').length !== 0) { 632 // Check duration length against percentage for layout 633 checkDuration(); 634 635 // Check before any scrolling 636 checkAnimation(); 637 } 638 }); 639 640 if ($('.bar__value').length !== 0) { 641 // Capture scroll events 642 $(window).scroll(function () { 643 checkAnimation(); 644 }); 645 } 646 647 // As the window is resize, call function 648 $(window).resize(function () { 649 clearTimeout(resizeTimeout); 650 resizeTimeout = setTimeout(function () { 651 checkDuration(); 652 }, 200); 653 }); 654 655})(jQuery); 656(function ($) { 657 658 659 660 Drupal.behaviors.pintPopup = { 661 attach: function (context, settings) { 662 663 if (context == document) { 664 665 666 // Default popup 667 $('[data-popup]').magnificPopup(); 668 669 // iFrame TP 670 $('[data-popup="iframe-tp"]').each(function () { 671 var iframe_url = $(this).attr('href'); 672 $(this).magnificPopup({ 673 showCloseBtn: false, 674 type: 'iframe', 675 676 iframe: { 677 patterns: { 678 hbopaseo: { 679 index: 'hbopaseo.com', 680 src: iframe_url 681 } 682 } 683 } 684 }); 685 }); 686 687 // Required or Standalone options. 688 $('[data-popup="required"], [data-popup="standalone"]').magnificPopup({ 689 showCloseBtn: false, 690 }); 691 692 // iFrame 693 $('[data-popup="iframe"]').magnificPopup({ 694 type: 'iframe', 695 }); 696 697 // AJAX 698 $('[data-popup="ajax"]').magnificPopup({ 699 type: 'ajax' 700 }); 701 702 // end if 703 704 705 }// end context 706 707 } 708 }; 709 710 711})(jQuery); 712 713(function ($) { 714 715 $('[data-scroll=smooth]').on('click', function (e) { 716 e.preventDefault(); 717 718 // If the target exists 719 if (this.hash.length > 0) { 720 var target = $(this.hash) || null; 721 722 if (target === null) {return; } 723 724 // If the target has an offset, smoothly scroll to it (where 16 is the base gutter) 725 if ($(target).offset()) { 726 $('html, body').stop().animate({ 727 'scrollTop': $(target).offset().top - 16 728 }, 900, 'swing', function () { 729 // Put the hash into the URL 730 window.location.hash = target.selector; 731 }); 732 } 733 } 734 }); 735 736})(jQuery); 737(function ($) { 738 739 $('[data-time=ago]').timeago(); 740 741 Drupal.behaviors.timeAgo = { 742 attach: function (context, settings) { 743 $('[data-time=ago]').timeago(); 744 } 745 }; 746 747})(jQuery); 748(function ($) { 749 750 var logoElement = $('.site-bar__logo img'), 751 logoHeight = parseInt(logoElement.css('height'), 10), 752 stopHeight = logoHeight / 2, 753 heroClass = 'is-hero', 754 heroStatus = false, 755 headerClass = 'is-default', 756 heroBarStatus = false, 757 heroBarClass = 'is-hero-bar', 758 heroBarScrollAmount = 120; 759 760 function setLogoSize() { 761 var windowScroll = $(window).scrollTop(), 762 newHeight = logoHeight - Math.round(windowScroll / 4); 763 764 if (newHeight >= stopHeight) { 765 $(logoElement).css('height', newHeight); 766 $('body').addClass(heroClass).removeClass(headerClass); 767 } else { 768 $(logoElement).css('height', stopHeight); 769 $('body').removeClass(heroClass).addClass(headerClass); 770 } 771 } 772 773 function undoHero() { 774 $('body').removeClass(heroClass); 775 $(logoElement).removeAttr('style'); 776 heroStatus = false;
777 } 778 779 // On page load 780 if ($('body').hasClass(heroClass)) { 781 heroStatus = true; 782 setLogoSize(); 783 } 784 785 // On page load 786 if ($('body').hasClass(heroBarClass)) { 787 heroBarStatus = true; 788 } 789 790 // On window scroll 791 $(window).on('scroll', function () { 792 if (heroStatus === true) { 793 setLogoSize(); 794 } 795 796 // On scroll, remove inital state 797 if ($(window).scrollTop() >= heroBarScrollAmount) { 798 if (heroBarStatus === true) { 799 $('body').removeClass(heroBarClass); 800 } 801 } 802 803 // If scrolling back up into that amount, re-add 804 if ($(window).scrollTop() < heroBarScrollAmount) { 805 if (heroBarStatus === true) { 806 $('body').addClass(heroBarClass); 807 } 808 } 809 }); 810 811 // Drupal IPE activated 812 $('.panels-ipe-startedit').on('click', function() { 813 undoHero(); 814 }); 815 816})(jQuery); 817// See: https://developer.mozilla.org/en-US/docs/Web/Guide/Events/Media_events 818window.onload = function() { 819 // Video 820 var video = document.getElementById("feature-video"); 821 822 if (video !== null) { 823 // Controls 824 var controls = document.getElementById("feature-video-controls"); 825 826 // Content 827 var content = document.getElementById("feature-video-content"); 828 829 // Buttons 830 var playButton = document.getElementById("feature-video-pp"), 831 muteButton = document.getElementById("feature-video-mute"), 832 replayButton = document.getElementById("feature-video-replay"); 833 834 // Video played 835 var firstAutoPlay = true; 836 837 video.addEventListener("loadstart", function () { 838 if (firstAutoPlay === true) { 839 firstAutoPlay = false; 840 } 841 }, false); 842 843 // Video playing 844 video.addEventListener("playing", function () { 845 content.className = 'cover__site is-playing'; 846 }, false); 847 848 // Event listener for the play/pause button 849 playButton.addEventListener("click", function () { 850 if (video.paused === true) { 851 // Play the video 852 video.play(); 853 854 playButton.className = 'control control--pause'; 855 } 856 else { 857 // Pause the video 858 video.pause(); 859 860 playButton.className = 'control control--play'; 861 862 // Show content again 863 content.className = 'cover__site'; 864 } 865 }, false); 866 867 868 // Event listener for the mute button 869 muteButton.addEventListener("click", function () { 870 if (video.muted === false) { 871 // Mute the video 872 video.muted = true; 873 874 muteButton.className = 'control control--unmute'; 875 } 876 else { 877 // Unmute the video 878 video.muted = false; 879 880 muteButton.className = 'control control--mute'; 881 } 882 }, false); 883 884 // Video ended 885 video.addEventListener("ended", function () { 886 // Remove the autoplay attribute 887 // It's still go to play again but we'll catch it 888 // via `loadstart` after calling .load() 889 video.removeAttribute('autoplay'); 890 video.load(); 891 // Hide controls 892 playButton.style.display = 'none'; 893 muteButton.style.display = 'none'; 894 // Show replay 895 replayButton.className = 'control control--replay'; 896 // Show content again 897 content.className = 'cover__site'; 898 }, false); 899 900 // Event listener for the replay button 901 replayButton.addEventListener("click", function () { 902 // Replay video 903 video.play(); 904 // Hide replay 905 replayButton.className = 'control control--replay is-hidden'; 906 // Show controls 907 playButton.style.display = 'inline-block'; 908 muteButton.style.display = 'inline-block'; 909 }, false); 910 } 911}; 912(function ($) { 913 914 $('.searchbox form').submit(function (e) { 915 // If the user attempts to submit with no search term, 916 // do nothing 917 if ($(this).find('input[type="text"]').val() === '') { 918 e.preventDefault(); 919 } 920 }); 921 922})(jQuery); 923(function ($) { 924 925 // Global vars 926 var resizeTimeout, 927 gutterWidth = 8, 928 subNavListWidth = 0; 929 930 // Gets the current left scroll position of the sub nav 931 function getScrollPos() { 932 return $('.site-sub__list').scrollLeft(); 933 } 934 935 // Gets the amount to scroll 936 function getScrollAmount() { 937 return ($('.site-sub').outerWidth() / 100) * 50; 938 } 939 940 // Scroll to the end function checker 941 function scrollEndCheck() { 942 // Hide the next button if we've reached the end 943 var lastItemLeftPos = $('.site-sub__list li').last().offset().left, 944 lastItemWidth = $('.site-sub__list li').last().outerWidth(), 945 lastItemScrollPos = Math.round(lastItemLeftPos + lastItemWidth + gutterWidth); 946 947 // Could be out by a number due to rounding 948 if (lastItemScrollPos === $('.site-sub').outerWidth() || 949 (lastItemScrollPos - 1) === $('.site-sub').outerWidth() || 950 (lastItemScrollPos + 1) === $('.site-sub').outerWidth()) { 951 $('[data-js="sub-nav-next"]').hide(); 952 } else { 953 $('[data-js="sub-nav-next"]').show(); 954 } 955 } 956
957 // Func to check set vars and show/hide next button 958 function checkSubNav() { 959 var subNavWidth = $('.site-sub').outerWidth(), 960 checkedScrollPos = getScrollPos(); 961 962 // Reset the width before re-finding it out 963 subNavListWidth = 0; 964 965 // Get the total width of the VISIBLE sub nav items 966 // items with `is-disabled` shouldn't be included 967 // as they throw the width off 968 $('.site-sub__list > li:not(.is-disabled)').each(function () { 969 subNavListWidth += $(this).outerWidth(); 970 }).promise().done(function () { 971 // Show next button 972 if (subNavListWidth > subNavWidth) { 973 if (checkedScrollPos === 0) { 974 $('[data-js="sub-nav-prev"]').hide(); 975 $('[data-js="sub-nav-next"]').show(); 976 } else { 977 scrollEndCheck(); 978 $('[data-js="sub-nav-prev"]').show(); 979 } 980 } else { 981 // Hide the next and prev buttons 982 $('[data-js="sub-nav-next"], [data-js="sub-nav-prev"]').hide(); 983 } 984 }); 985 } 986 987 // Call check on load 988 checkSubNav(); 989 990 // As the window is resized, call function 991 $(window).resize(function () { 992 clearTimeout(resizeTimeout); 993 resizeTimeout = setTimeout(function () { 994 checkSubNav(); 995 }, 200); 996 }); 997 998 // `Click` next button 999 $('[data-js="sub-nav-next"]').click(function (e) { 1000 e.preventDefault(); 1001 1002 var leftPos = getScrollPos(), 1003 scrollAmount = getScrollAmount(); 1004 1005 if (leftPos === 0) { 1006 // Not yet scrolled 1007 $('.site-sub__list').animate({ 1008 scrollLeft: scrollAmount 1009 }, 800, function () { 1010 // Show the prev button 1011 $('[data-js="sub-nav-prev"]').show(); 1012 }); 1013 } else { 1014 // Already scrolled 1015 var newScrollPosition = scrollAmount + leftPos; 1016 1017 $('.site-sub__list').animate({ 1018 scrollLeft: newScrollPosition 1019 }, 800, function () { 1020 scrollEndCheck(); 1021 }); 1022 } 1023 }); 1024 1025 // `Click` previous button 1026 $('[data-js="sub-nav-prev"]').click(function (e) { 1027 e.preventDefault(); 1028 1029 var currentPos = getScrollPos(), 1030 scrollAmount = getScrollAmount(), 1031 newScrollPos = currentPos - scrollAmount; 1032 1033 $('.site-sub__list').animate({ 1034 scrollLeft: newScrollPos 1035 }, 800, function () { 1036 // If no more previous items, hide the previous button 1037 var updatedScrollPos = getScrollPos(); 1038 if (updatedScrollPos === 0) { 1039 $('[data-js="sub-nav-prev"]').hide(); 1040 } else { 1041 $('[data-js="sub-nav-next"]').show(); 1042 } 1043 }); 1044 }); 1045 1046 // `Scroll` binded to sub nav scroll event 1047 $('.site-sub__list').scroll(function () { 1048 checkSubNav(); 1049 }); 1050 1051})(jQuery); 1052// *** Detect if SVG is supported 1053// If not supported replace .SVG extensions with .PNG ones 1054if (!Modernizr.svg) { 1055 var imgs = document.getElementsByTagName('img'); 1056 var svgExtension = /.*\.svg$/; 1057 var l = imgs.length; 1058 for(var i = 0; i < l; i++) { 1059 if(imgs[i].src.match(svgExtension)) { 1060 imgs[i].src = imgs[i].src.slice(0, -3) + 'png'; 1061 //console.log(imgs[i].src); 1062 } 1063 } 1064} 1065(function ($) { 1066 1067 1068 Drupal.behaviors.pintTile = { 1069 attach: function (context, settings) { 1070 1071 if (context == document) { 1072 1073 1074 var $container = $('[data-js="tile"]'); 1075 1076 function doMasonry() { 1077 $container.masonry({ 1078 itemSelector: '[data-js-tile="item"]' 1079 }); 1080 } 1081 1082 if ($('[data-js="tile"]').length !== 0 && !$('html').hasClass('no-mq')) { 1083 // Using Modernizr to only load in tile script if markup 1084 // is present and more than 2 items on the page 1085 // as the scripts are large 1086 if ($('[data-js="tile"]').find('[data-js-tile="item"]').length > 2) { 1087 window.Modernizr.load(); 1088 Modernizr.load({ 1089 load: [Drupal.settings.basePath + Drupal.settings.pathToTheme + '/js/conditional/tile/tile-drupal.js'] 1090 }); 1091 } 1092 1093 if (typeof twttr !== 'undefined') { 1094 twttr.ready(function (twttr) { 1095 twttr.events.bind('loaded', function (event) { 1096 if (event.widgets.length > 0) { 1097 doMasonry(); 1098 } 1099 }); 1100 1101 // Ajax complete, reload twitter embeds js 1102 $('.view-latest-content').ajaxSuccess(function() { 1103 twttr.widgets.load(); 1104 }); 1105 }); 1106 } 1107 1108 }// end if 1109 1110 1111 }// end context 1112 1113 } 1114 }; 1115 1116 1117}(jQuery)); 1118(function($) { 1119 1120 1121 Drupal.behaviors.twitterEmbeds = { 1122 attach: function (context, settings) { 1123 1124 // Trigger twitter widgets load for new items added via ajax 1125 window.twttr = function (d, s, id) { 1126 var t, js, fjs = d.getElementsByTagName(s)[0]; 1127 if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; 1128 js.src = "//platform.twitter.com/widgets.js"; 1129 fjs.parentNode.insertBefore(js, fjs); 1130 return window.twttr || (t = { _e: [], ready: function (f) { t._e.push(f); } }); 1131 }(document, 'script', 'twitter-wjs'); 1132 1133 if (typeof twttr !== 'undefined') { 1134 twttr.ready(function (twttr) { 1135 1136 // Ajax complete, reload twitter embeds js 1137 $('.view-latest-content').ajaxSuccess(function() { 1138 twttr.widgets.load(); 1139 }); 1140 1141 }); 1142 } 1143 } 1144 }; 1145 1146 1147})(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.