1//import lazySizes from 'lazysizes'; 2//import 'lazysizes/plugins/native-loading/ls.native-loading'; 3//const { auto } = require("@popperjs/core"); 4//import { Dropdown } from "../../bootstrap.bundle"; 5(function() { 6 if (!Array.prototype.find) { 7 Array.prototype.find = function (predicate) { 8 if (this == null) { 9 throw new TypeError('Array.prototype.find called on null or undefined'); 10 } 11 if (typeof predicate !== 'function') { 12 throw new TypeError('predicate must be a function'); 13 } 14 var list = Object(this); 15 var length = list.length >>> 0; 16 var thisArg = arguments[1]; 17 var value; 18 19 for (var i = 0; i < length; i++) { 20 value = list[i]; 21 if (predicate.call(thisArg, value, i, list)) { 22 return value; 23 } 24 } 25 return undefined; 26 }; 27 } 28}()); 29 30 31//scripts that are required by all/most pages; this script is loaded as part of the Master page. 32$(document).ready(function () { 33 34 /*set up left hand menu*/ 35 // Cache references to DOM nodes. 36 const siteWrapper = document.querySelector('#siteWrapper'); 37 const hamburgerMenuButton = document.querySelector('#hamburgerMenuButton'); 38 const slideoutCloseButton = document.querySelector('#slideoutCloseButton'); 39 40 function openSlideoutDrawer() { 41 siteWrapper.classList.add('slideout-open'); 42 slideoutCloseButton.focus(); 43 } 44 45 function closeSlideoutDrawer() { 46 siteWrapper.classList.remove('slideout-open'); 47 hamburgerMenuButton.focus(); 48 } 49 50 // Bind event listeners. 51 if (hamburgerMenuButton !== null) { 52 hamburgerMenuButton.addEventListener('click', openSlideoutDrawer, false); 53 } 54 if (slideoutCloseButton !== null) { 55 slideoutCloseButton.addEventListener('click', closeSlideoutDrawer, false); 56 } 57 58 $('.back-to-top-link').on('click', function (e) { 59 $("html, body").animate({ scrollTop: 0 }, 500); 60 return false; 61 }); 62 63 $('.see-more-arrow').on('click', function () { 64 $("body,html").animate({ scrollTop: $("#main").offset().top - 124 }, 500); 65 }); 66 67 //$('.carousel-text-indicators').on('click', function ()) { 68 69 //} 70 $('.carousel.slide.facilities-carousel .carousel-text-indicators li').on('click', function () { 71 var itemClicked = $(this); 72 var allItems = $('.carousel-text-indicators li'); 73 setActiveCarouselLink(itemClicked, allItems); 74 }); 75 /*fires after the slide completes*/ 76 $('.carousel.slide.facilities-carousel').on('slide.bs.carousel', function (e) { 77 //find the text indicator with the index of the slide we want it it's data-slide-to element 78 var newIndex = e.to; 79 var carouselTextItem = $('#facilityText-' + newIndex); 80 var allItems = $('.carousel-text-indicators li'); 81 setActiveCarouselLink(carouselTextItem, allItems); 82 }); 83 84 function setActiveCarouselLink(activeItem, allItems) { 85 if (activeItem.hasClass('active')) { 86 //do nothing, the item clicked already has the active class 87 return; 88 } 89 90 $.each(allItems, function () { 91 var currentItem = $(this); 92 currentItem.removeClass('active'); 93 }); 94 activeItem.addClass('active'); 95 } 96 97 $('div.navbar-mega-menu .nav-link.dropdown-toggle').on('keyup', function (e) { 98 e.stopPropagation(); 99 e.preventDefault(); 100 if (e.isComposing || (e.which !== 13 && e.which !== 32 && e.which !== 39 && e.which !== 37)) 101 return; 102 103 if (e.which === 39) { 104 //down - find the nearest link list in our container and move the focus to that: 105 var clickedId = $(this).attr('id'); 106 var menuToToggle = document.getElementById('megaMenuContainer-' + clickedId); 107 var moveToElementArr = menuToToggle.getElementsByClassName('link-list-link'); 108 if (!!moveToElementArr && moveToElementArr.length > 0) { 109 var moveTo = moveToElementArr[0]; 110 $(moveTo).focus(); 111 } 112 return false; 113 } 114 $(this).click(); 115 });
116 117 $('a.link-list-link').on('keyup', function (e) { 118 if (e.isComposing || (e.which !== 39 && e.which !== 37)) 119 return; 120 121 var thisIndex = $(this).data('index') 122 if (e.which === 39) { 123 //find the data-index value for the index 124 var nextIndex = thisIndex + 1; 125 if (nextIndex > 0) { 126 //get the menu item with the expected index value within the current container, which is the UL at parent.parent.parent 127 var list = $(this).parent().parent().parent(); 128 if (list.length > 0) { 129 var nextElement = list.find('[data-index="' + nextIndex + '"]'); 130 if (nextElement.length > 0) { 131 $(nextElement).focus(); 132 } 133 } 134 } 135 } 136 137 if (e.which === 37 && thisIndex > 0) { 138 var nextIndex = thisIndex - 1; 139 if (nextIndex >= 0) { 140 //get the menu item with the expected index value within the current container, which is the UL at parent.parent.parent 141 var list = $(this).parent().parent().parent(); 142 if (list.length > 0) { 143 var nextElement = list.find('[data-index="' + nextIndex + '"]'); 144 if (nextElement.length > 0) { 145 $(nextElement).focus(); 146 } 147 } 148 } 149 } 150 151 if (e.which === 37 && thisIndex === 0) { 152 var menuContainer = $(this).parent().parent().parent().parent(); 153 if (menuContainer.length > 0) { 154 var menuItemId = '#' + $(menuContainer).attr('aria-labelledby'); 155 var menuItem = $(menuItemId); 156 if (!!menuItem && menuItem.length > 0) { 157 menuItem.focus(); 158 } 159 } 160 } 161 }); 162 163 $('div.navbar-mega-menu .nav-link.dropdown-toggle').on('click', function (e) { 164 165 e.stopPropagation(); 166 e.preventDefault(); 167 $('body').addClass('no-scroll'); 168 var clickedId = $(this).attr('id'); 169 var menuToToggle = document.getElementById('megaMenuContainer-' + clickedId); 170 var blockerDiv = $(menuToToggle.parentElement); 171 //menuToToggle.parentElement.style.display = 'block'; 172 //show this menu 173 if (!($(this).hasClass('selected'))) { 174 //hide other menus 175 var allLinks = $('.nav-link.dropdown-toggle'); 176 $.each(allLinks, function () { 177 var l = $(this); 178 l.removeClass('selected'); 179 }); 180 181 $(blockerDiv).addClass('show'); 182 $(menuToToggle).addClass('show'); 183 //also hide all mega menu containers except ours 184 var allmegaMenuContainers = $(".mega-menu-container"); 185 $.each(allmegaMenuContainers, function() { 186 var m = $(this); 187 if (m.attr('id') !== $(menuToToggle).attr('id')) { 188 //we should wait a second to make sure our menu has vanished 189 m.removeClass('show'); 190 } 191 }); 192 193 $(this).addClass('selected'); 194 return false; 195 } 196 197 if ($(this).hasClass('selected')) { 198 //the link that was clicked is selected -- toggle off 199 $(menuToToggle).removeClass('show'); 200 $(this).removeClass('selected'); 201 $('body').removeClass('no-scroll'); 202 blockerDiv.removeClass('show'); 203 //menuToToggle.parentElement.style.display = 'none'; 204 return false; 205 } 206 }); 207 208 function getBaseUrl() { 209 return window.location.host; 210 } 211 212 $('img').on('error', function () { 213 214 //see if we can find the default image hidden item 215 //we don't know how big the image might be so this can be a problem; they're not always defined in terms of height and width. 216 var hiddenItem = $('#defaultImage'); 217 if (hiddenItem != null && hiddenItem != undefined && hiddenItem.length > 0) { 218 var url = hiddenItem.attr("value"); 219 if (url.length > 0) { 220 //this.src = url; 221 return true; 222 } 223 } 224 this.src = 'https://' + getBaseUrl() + '/Content/images/No-course-image-news.jpg'; 225 return true; 226 });
227 228 $(document).on('hidden.bs.collapse', '#searchOptions', function (e) { 229 if (e.target.id === $(this).attr('id')) { 230 $('#mobileSearchFiltersShown').val('false'); 231 var button = $('#searchOptionsCollapseButton'); 232 button.text('Show Filters'); 233 } 234 }); 235 236 $(document).on('shown.bs.collapse','#searchOptions', function (e) { 237 if (e.target.id === $(this).attr('id')) { 238 $('#mobileSearchFiltersShown').val('true'); 239 var button = $('#searchOptionsCollapseButton'); 240 button.text('Hide Filters'); 241 } 242 }); 243 244 $('a.link-list-link').on('click tap', function (e) { 245 var linkVal = $(e.target); 246 window.location.href = linkVal.attr('href'); 247 }); 248 249 //any click on an item that's not the mega menu itself, when no-scroll is present 250 //won't work, needs a blocker (like bs's modal fade) 251 $('div.blocker').on('click', function (e) { 252 e.preventDefault(); 253 e.stopPropagation(); 254 //is there an open menu? If so, close it 255 //remove our no-scroll class from the body 256 $('body').removeClass('no-scroll'); 257 $(this).removeClass('show'); 258 var openMenu = $('.nav-link.dropdown-toggle.selected'); 259 var megaMenuDisplayed = $('.mega-menu-container.show'); 260 if (openMenu != null && openMenu.length > 0) { 261 e.stopPropagation(); 262 e.preventDefault(); 263 $.each(megaMenuDisplayed, function () { 264 var m = $(this); 265 m.removeClass('show'); 266 }); 267 268 $.each(openMenu, function () { 269 var menu = $(this); 270 menu.removeClass('selected'); 271 }); 272 return false; 273 } 274 }); 275 276 (function () { 277 var links = $("a[href^='umb://media/']"); 278 if (links.length > 0) { 279 if (links.attr('href').indexOf('umb://') >= 0) { 280 //we need to get the correct value. 281 //this might be the only way we can do it for now; as users replace links this will improve. 282 links.each(function (l) { 283 var udiToGet = this.href.substring(12); 284 var that = this; 285 $.get('/umbraco/api/DocumentLink/GetDocumentLink?udi=' + udiToGet).done(function (r) { 286 that.href = r; 287 }); 288 }); 289 } 290 } 291 292 //get any links that have a child image 293 var linksWithImages = $('a').has('img'); 294 $.each(linksWithImages, function () { 295 var a = $(this); 296 a.addClass('link-with-image'); 297 }); 298 299 //get cards and convert them as required: 300 var rowsWithCards = $('.row'); 301 $.each(rowsWithCards, function () { 302 var r = $(this); 303 //find the cards - only do macro cards 304 var cards = r.find('.card-beds.card-macro'); 305 if (cards === undefined || cards === null || cards.length === 0) { return; } 306 var fullWidthCards = cards.find('.card-body.full-width'); 307 var positionAbsoluteCards = cards.find('.card-body.position-absolute'); 308 var cardImages = cards.find('img.card-std-img');
309 //don't do this for courses 310 if (fullWidthCards.length > 0 && positionAbsoluteCards.length > 0) { 311 $.each(positionAbsoluteCards, function () { 312 var pac = $(this); 313 pac.removeClass('position-absolute'); 314 pac.addClass('full-width'); 315 }); 316 317 $.each(cardImages, function () { 318 cardImages.removeClass('card-std-img'); 319 }); 320 } 321 }); 322 }()); 323 324 (function() { 325 function appendHighContrastCss() { 326 var hc = '<link rel="stylesheet" href="/assets/css/high-contrast.css" id="hccss"/>'; 327 328 if (!$('#highContrastCss').length) { 329 $('head').append(hc); 330 } else { 331 $('#hccss').remove(); 332 } 333 } 334 }()); 335 336 $('.card-header').on('click', function () { 337 //decide whether the header is now open or closed and switch the image based on that: 338 var imageSrc = null; 339 if ($(this).hasClass('collapsed')) { 340 imageSrc = $(this).data('open-image'); 341 } else { 342 imageSrc = $(this).data('closed-image'); 343 } 344 345 if (imageSrc !== null) { 346 var imageTarget = $(this).children('img'); 347 if (imageTarget !== null && imageTarget !== undefined && imageTarget.length > 0) { 348 imageTarget[0].setAttribute('src', imageSrc); 349 } 350 } 351 }); 352 353 $(document).on('click', '.document-search-result-header', function () { 354 var iconClass = null; 355 if ($(this).hasClass('collapsed')) { 356 iconClass = $(this).data('open-icon'); 357 } else { 358 iconClass = $(this).data('closed-icon'); 359 } 360 361 if (iconClass !== null) { 362 var iconTarget = $(this).find('i'); 363 //console.log('icon class:' + iconClass); 364 //console.log('icon target:' + iconTarget); 365 366 if (iconTarget !== null && iconTarget !== undefined && iconTarget.length > 0) { 367 //console.log('remove classes'); 368 iconTarget.removeClass(); 369 //console.log('adding new class'); 370 iconTarget.addClass(iconClass.toString()); 371 } 372 } 373 }); 374 375 $('.document-search-box-header').on('click', function () { 376 var iconClass = null; 377 if ($(this).hasClass('collapsed')) { 378 iconClass = $(this).data('open-icon'); 379 } else { 380 iconClass = $(this).data('closed-icon'); 381 } 382 383 if (iconClass !== null) { 384 var iconTarget = $(this).find('i'); 385 //console.log('icon class:' + iconClass); 386 //console.log('icon target:' + iconTarget); 387 388 if (iconTarget !== null && iconTarget !== undefined && iconTarget.length > 0) { 389 //console.log('remove classes'); 390 iconTarget.removeClass(); 391 //console.log('adding new class'); 392 iconTarget.addClass(iconClass.toString()); 393 } 394 } 395 }); 396 397 $(function () { 398 if ($('.datepicker').length > 0) { 399 $(".datepicker").datepicker({ dateFormat: "dd/mm/yy", buttonText: '<i class="fal fa-calendar"></i>', showOn: "both" }); 400 } 401 }); 402 403 $(function () { $('a[href*="#"].smoothscroll').click(function () { if (location.pathname.replace(/^\//, "") === this.pathname.replace(/^\//, "") && location.hostname === this.hostname) { var e = $(this.hash); if (e = e.length ? e : $("[name=" + this.hash.slice(1) + "]"), e.length) return $("html, body").animate({ scrollTop: e.offset().top }, 400, "linear"), !1 } }) }); 404 405 $('.card-beds-text, .card-beds.card-beds-image-overlay').on('click', function (e) { 406 var href = $(this).find('a').attr('href'); 407 if (href !== null && href !== undefined && href.length > 0) { 408 window.location.href = href; 409 } 410 }); 411 412 function debounce(func, wait, immediate) { 413 var timeout; 414 return function () { 415 var context = this, args = arguments; 416 var later = function () { 417 timeout = null;
418 if (!immediate) func.apply(context, args); 419 }; 420 var callNow = immediate && !timeout; 421 clearTimeout(timeout); 422 timeout = setTimeout(later, wait); 423 if (callNow) func.apply(context, args); 424 }; 425 } 426 427 $(document).on("click", "#banner-search-submit, #banner-search-btn", function (e) { 428 var form = $(this).closest('form'); 429 var newUrl = $('#banner_resultURL'); 430 window.location.replace(newUrl.val() + '?' + form.serialize()); 431 }); 432 433 $(document).on('click', 'a.search-suggestion', function (e) { 434 e.preventDefault(); 435 var form = $(this).closest('form'); 436 var newUrl = $(this).attr('href'); 437 var suggestion = $(this).data('suggestion'); 438 439 var values = form.serializeArray(); 440 try { 441 values.find(input => input.name === 'SearchTerm').value = suggestion; 442 //values.find(function (input) { return input.name === 'SearchTerm' }).value = suggestion; 443 } 444 catch (err) { 445 values.filter(function (input) { return input.name === 'SearchTerm' }).value = suggestion; 446 } 447 var newValues = $.param(values); 448 window.location.replace(newUrl + '?' + newValues); 449 }); 450 451 $(document).on("click", "#dropdown-search-submit, #submit-search-button, #results-search-submit,#quicklinks-search-btn,#mobile-specific-search-btn", function (e) { 452 e.preventDefault(); 453 var resultsTargetId = this.id === "results-search-submit" ? "#banner_resultURL" : "#dropdown_resultURL"; 454 var form = $(this).closest('form'); 455 var newUrl = $(resultsTargetId); 456 window.location.replace(newUrl.val() + '?' + form.serialize()); 457 }); 458 459 $(document).on("click", 'a.search-category-link,a.search-categories__link', function (e) { 460 e.preventDefault(); 461 var category = $(this).data("category"); 462 var form = $(this).closest('form'); 463 //$('#CategorisedResults_CurrentCategory').val(category); 464 var values = form.serializeArray(); 465 //var newUrl = $(this).attr('href'); 466 try { 467 values.find(input => input.name == 'CategorisedResults.CurrentCategory').value = category; 468 // Reset to page 1 when switching category so the new tab always has results 469 values.find(input => input.name == 'CategorisedResults.CurrentPage').value = 1; 470 } 471 catch (err) { 472 values.filter(function (input) { return input.name == 'CategorisedResults.CurrentCategory' }).value = category; 473 values.filter(function (input) { return input.name == 'CategorisedResults.CurrentPage' }).value = 1; 474 } 475 var newValues = $.param(values); 476 var postUrl = form.attr("action"); 477 $.ajax({
478 url: postUrl, 479 method: 'POST', 480 data: newValues, 481 success: function (data) { 482 //this replaces the search results, which includes what the user just clicked on. 483 $('#search-results').html(data); 484 var searchTerm = $('#SearchTerm').val(); 485 var myHilitor = new Hilitor("search-results"); 486 myHilitor.apply(searchTerm); 487 setSearchFilterVisibility(); 488 } 489 }); 490 491 492 493 }); 494 495 $(document).on("click", 'button.search-page-link', function (e) { 496 e.preventDefault(); 497 var pageNum = $(this).data("page"); 498 var category = $(this).data("category"); 499 var form = $(this).closest('form'); 500 var values = form.serializeArray(); 501 //values.find(function (input) { return input.name == 'CategorisedResults.CurrentPage' }).value = pageNum; 502 //values.find(function (input) { return input.name == 'CategorisedResults.CurrentCategory' }).value = category; 503 values.find(input => input.name == 'CategorisedResults.CurrentPage').value = pageNum; 504 values.find(input => input.name == 'CategorisedResults.CurrentCategory').value = category; 505 506 var newValues = $.param(values); 507 var postUrl = form.attr("action"); 508 $.ajax({
509 url: postUrl, 510 method: 'POST', 511 data: newValues, 512 success: function (data) { 513 $('#search-results').html(data); 514 var searchTerm = $('#SearchTerm').val(); 515 var myHilitor = new Hilitor("search-results"); 516 myHilitor.apply(searchTerm); 517 setSearchFilterVisibility(); 518 } 519 }); 520 521 }); 522 523 $(document).on("input", "#SearchTerm", debounce(function () { 524 525 var searchTermLength = this.value.length; 526 if (searchTermLength >= 3) { 527 var searchTerm = $(this).val(); 528 var form = $('#SearchTerm').closest('form'); 529 530 var searchTermWithoutHyphen = form.find('#SearchTerm'); 531 var newVal = searchTermWithoutHyphen.val().replace("-", ""); 532 searchTermWithoutHyphen.val(newVal); 533 534 var postUrl = form.attr("action"); 535 $.ajax({ 536 url: postUrl, 537 method: 'POST', 538 data: form.serialize(), 539 success: function (data) { 540 $('#search-results').html(data); 541 var myHilitor = new Hilitor("search-results"); // id of the element to parse 542 myHilitor.apply(searchTerm); 543 setSearchFilterVisibility(); 544 } 545 }); 546 } 547 }, 400, false)); 548 549 $(document).on("input", "#banner_SearchTerm", debounce(function () { 550 //e.preventDefault(); 551 //make sure we hide the dropdown if it exists 552 $('#dropdown-search-results-container').hide(); 553 $('#macro-search-results-container').hide(); 554 var searchTerm = this.value; 555 var searchTermLength = searchTerm.length; 556 if (searchTermLength >= 3) { 557 $('#banner-search-results-container').hide(); 558 var form = $("#banner_SearchTerm").closest('form'); 559 560 var postUrl = form.attr("action"); 561 $.ajax({
562 url: postUrl, 563 method: 'POST', 564 data: form.serialize(), 565 success: function (data) { 566 var val = $('#banner_SearchTerm'); 567 $('#banner-search-results').html(data); 568 var myHilitor = new Hilitor("banner-search-results"); // id of the element to parse 569 myHilitor.apply(searchTerm); 570 $('#banner-search-results-container').slideDown(); 571 } 572 }); 573 } 574 575 if (searchTermLength <= 2) { 576 $('#banner-search-results-container').slideUp(); 577 } 578 }, 400, false)); 579 580 $(document).on("input", "#dropdown_SearchTerm", debounce(function () { 581 582 //e.preventDefault(); 583 $('#banner-search-results-container').hide(); 584 $('#macro-search-results-container').hide(); 585 var searchTerm = this.value; 586 var searchTermLength = searchTerm.length; 587 588 if (searchTermLength >= 3) { 589 $('#dropdown-search-results-container').hide(); 590 //var form = $(e.target).closest('form'); 591 var form = $("#dropdown_SearchTerm").closest('form'); 592 //$(form).submit(); 593 var postUrl = form.attr("action"); 594 $.ajax({
595 url: postUrl, 596 method: 'POST', 597 data: form.serialize(), 598 success: function (data) { 599 $('#dropdown-search-results').html(data); 600 var myHilitor = new Hilitor("dropdown-search-results"); // id of the element to parse 601 myHilitor.apply(searchTerm); 602 $('#dropdown-search-results-container').slideDown(); 603 } 604 }); 605 } 606 607 if (searchTermLength <= 2) { 608 $('#dropdown-search-results-container').slideUp(); 609 } 610 }, 400, false)); 611 612 $(document).on("input", "#MacroSearchTerm", debounce(function () { 613 614 $('#banner-search-results-container').hide(); 615 $('#dropdown-search-results-container').hide(); 616 var searchTerm = this.value; 617 var searchTermLength = searchTerm.length; 618 619 if (searchTermLength >= 3) { 620 $('#macro-search-results-container').hide(); 621 //var form = $(e.target).closest('form'); 622 var form = $("#macro_SearchTerm").closest('form'); 623 //$(form).submit(); 624 var postUrl = form.attr("action"); 625 $.ajax({
626 url: postUrl, 627 method: 'POST', 628 data: form.serialize(), 629 success: function (data) { 630 $('#macro-search-results').html(data); 631 var myHilitor = new Hilitor("macro-search-results"); // id of the element to parse 632 myHilitor.apply(searchTerm); 633 $('#macro-search-results-container').slideDown(); 634 } 635 }); 636 } 637 638 if (searchTermLength <= 2) { 639 $('#macro-search-results-container').slideUp(); 640 } 641 }, 400, false)); 642 643 $(document).on("input", "#mobile-specific-popup-search-input", debounce(function () { 644 645 $('#banner-search-results-container').hide(); 646 $('#dropdown-search-results-container').hide(); 647 $('#macro-search-dropdown-results-container').hide(); 648 var container = $('#mobile-specific-popup-search-results-container'); 649 var resultDiv = $('#mobile-specific-popup-search-results'); 650 var searchTerm = this.value; 651 var searchTermLength = searchTerm.length; 652 653 if (searchTermLength >= 2) { 654 container.hide(); 655 //var form = $(e.target).closest('form'); 656 var form = $("#mobile-specific-popup-search-input").closest('form'); 657 //$(form).submit(); 658 var postUrl = form.attr("action"); 659 $.ajax({
660 url: postUrl, 661 method: 'POST', 662 data: form.serialize(), 663 success: function (data) { 664 resultDiv.html(data); 665 var myHilitor = new Hilitor("mobile-specific-popup-search-results"); // id of the element to parse 666 myHilitor.apply(searchTerm); 667 container.removeClass('sr-only'); 668 container.slideDown(); 669 } 670 }); 671 } 672 673 if (searchTermLength < 2) { 674 $('#mobile-specific-search-results-container').slideUp(); 675 } 676 }, 400, false)); 677 678 //run this after the search page loads - this should only apply to the new search page. 679 var searchedTerm = $('#SearchTerm'); 680 var searchResultDiv = $('#search-results'); 681 if (searchedTerm.length > 0 && searchResultDiv.length > 0) { 682 var myHilitor = new Hilitor("search-results"); // id of the element to parse 683 myHilitor.apply(searchedTerm.val()); 684 } 685 //$('#search-results').on('load', function (e) { 686 // var searchTerm = $("#SearchTerm").val(); 687 // var myHilitor = new Hilitor("search-results"); // id of the element to parse 688 // myHilitor.apply(searchTerm); 689 //}); 690 691 // $('[data-navbar-search-btn]').on('mouseenter', function (e) { 692 // e.preventDefault(); 693 // $('#navbar-search-input').removeClass('sr-only-focusable'); 694 // $('#navbar-search-input').removeClass('sr-only'); 695 // $('#navbar-search-input').focus(); 696 // var searchBox = document.getElementById('navbar-search-input'); 697 // //jQuery version didn't work... 698 // searchBox.focus(); 699 // }); 700 701 // $('[data-navbar-search-btn]').on('mouseleave', function (e) { 702 // e.preventDefault(); 703 // //only hide the element if it doesn't currently have focus or is blank (i.e. the user hasn't started typing) 704 // var searchBox = document.getElementById('navbar-search-input'); 705 // if (document.activeElement !== null && (document.activeElement.id !== searchBox.id)) { 706 // $('#navbar-search-input').addClass('sr-only'); 707 // $('#navbar-search-input').addClass('sr-only-focusable'); 708 // searchBox.blur(); 709 // } 710 // }); 711 712 $('#quicklinks-search-input').on('input', function (e) { 713 e.preventDefault(); 714 var searchTerm = this.value; 715 if (searchTerm.length <= 2) return false; 716 717 showSearchPopup('quicklinks-popup', searchTerm, $(this)); 718 //clear the value here -otherwise it will be left over and look confusing. 719 }); 720 721 $('#macro-search-input').on('input', function (e) { 722 e.preventDefault(); 723 var searchTerm = this.value; 724 if (searchTerm.length <= 2) return false; 725 726 showSearchPopup('macro-popup', searchTerm, $(this)); 727 }); 728 729 $('#mobile-specific-quicklinks-search-input').on('input', function (e) { 730 e.preventDefault(); 731 var searchTerm = this.value; 732 if (searchTerm.length <= 2) return false; 733 734 showSearchPopup('mobile-specific-popup', searchTerm, $(this)); 735 }); 736 737 $('[data-navbar-search-btn]').on('click', function (e) { 738 e.preventDefault(); 739 showSearchPopup('banner-popup', '', $(this)); 740 }); 741 742 $('#banner-popup-search').on('shown.bs.modal', function (e) { 743 var searchIcon = $('[data-navbar-search-btn] .fa-search'); 744 var closeIcon = $('[data-navbar-search-btn] .fa-times'); 745 searchIcon.hide(); 746 closeIcon.show(); 747 }); 748 749 $('#banner-popup-search').on('hidden.bs.modal', function (e) { 750 var searchIcon = $('[data-navbar-search-btn] .fa-search'); 751 var closeIcon = $('[data-navbar-search-btn] .fa-times'); 752 closeIcon.hide(); 753 searchIcon.show(); 754 }); 755 756 //$('#banner-popup-search').on('shown.bs.modal', function (event) { 757 758 // var textTriggerInput = $('#navbar-search-input'); 759 // var textTrigger = textTriggerInput.val(); 760 // var modal = $(this)
761 // modal.find('.modal-body input').trigger('focus'); 762 // var modalTextInput = modal.find('.modal-body input'); 763 // setTimeout(function () { $(modalTextInput).val(textTrigger).change() }, 100); 764 // textTriggerInput.val(''); 765 //}); 766 767 //$('#quicklinks-popup-search').on('shown.bs.modal', function (event) { 768 769 // var textTriggerInput = $('#quicklinks-search-input'); 770 // var textTrigger = textTriggerInput.val(); 771 // var modal = $(this) 772 // var modalTextInput = modal.find('.modal-body input'); 773 // modalTextInput.trigger('focus'); 774 775 // //setTimeout(function () { modalTextInput.val(textTrigger); }, 50); 776 // //textTriggerInput.val(''); 777 //}); 778 779 $('.modal').on('shown.bs.modal', function (event) { 780 $(this).find('[autofocus]').focus(); 781 }); 782 783 $('#mobile-quicklinks-search-input').on('input', function (e) { 784 //find our search popup (need to make this generic - put the id in data for this too?) 785 e.preventDefault(); 786 var searchTerm = $(this).val(); 787 if (searchTerm.length <= 3) return false; 788 showSearchPopup('banner-popup', searchTerm, $(this)); 789 }); 790 791 $('#navbar-search-input').on('input', function (e) { 792 //find our search popup (need to make this generic - put the id in data for this too?) 793 e.preventDefault(); 794 var searchTerm = $(this).val(); 795 if (searchTerm.length <= 3) return false; 796 showSearchPopup('banner-popup', searchTerm, $(this)); 797 }); 798 799 function showSearchPopup(searchPopupPrefix, searchTerm, originalSearchInput) { 800 //popup to show 801 var popupId = '#' + searchPopupPrefix + '-search'; 802 //input to add value to 803 var inputId = '#' + searchPopupPrefix + '-search-input'; 804 var searchPopup = $(popupId); 805 if (searchPopup !== undefined && searchPopup !== null && searchPopup.length > 0) { 806 $(searchPopup).modal('toggle'); 807 //find the input and set the text if it exists - can we also set the focus? 808 var searchInput = $(inputId); 809 searchInput.val(searchTerm).change(); 810 setTimeout(function () { $(originalSearchInput).val(''), 1000 }); 811 } 812 } 813 814 //pop-up search functions 815 $(document).on("input", "#quicklinks-popup-search-input", debounce(function () { 816 var searchTerm = this.value; 817 var searchTermLength = searchTerm.length; 818 if (searchTermLength >= 3) { 819 $('#quicklinks-popup-search-results-container').hide(); 820 //var form = $(e.target).closest('form'); 821 var form = $("#quicklinks-popup-search-input").closest('form'); 822 823 //set the value without hyphens before we submit the form 824 var searchTermWithoutHyphen = form.find('#quicklinks-popup-search-input'); 825 var newVal = searchTermWithoutHyphen.val().replace("-", ""); 826 searchTermWithoutHyphen.val(newVal); 827 828 var postUrl = form.attr("action"); 829 $.ajax({
830 url: postUrl, 831 method: 'POST', 832 data: form.serialize(), 833 success: function success(data) { 834 //var val = $('#banner_SearchTerm'); 835 $('#quicklinks-popup-search-results').html(data); 836 var myHilitor = new Hilitor("quicklinks-popup-search-results"); // id of the element to parse 837 myHilitor.apply(searchTerm); 838 $('#quicklinks-popup-search-results-container').removeClass('sr-only'); 839 $('#quicklinks-popup-search-results-container').slideDown(); 840 } 841 }); 842 } 843 844 if (searchTermLength <= 2) { 845 $('#quicklinks-popup-search-results-container').slideUp(); 846 } 847 }, 400, false)); 848 849 $(document).on("input", "#banner-popup-search-input", debounce(function () { 850 var searchTerm = $(this).val(); 851 var searchTermLength = searchTerm.length; 852 if (searchTermLength >= 3) { 853 //$('#banner-popup-search-results-container').hide(); 854 855 //var form = $(e.target).closest('form'); 856 var form = $("#banner-popup-search-input").closest('form'); 857 858 //set the value without hyphens before we submit the form 859 var searchTermWithoutHyphen = form.find('#banner-popup-search-input'); 860 var newVal = searchTermWithoutHyphen.val().replace("-", ""); 861 searchTermWithoutHyphen.val(newVal); 862 863 var postUrl = form.attr("action"); 864 $.ajax({
865 url: postUrl, 866 method: 'POST', 867 data: form.serialize(), 868 success: function success(data) { 869 $('#banner-popup-search-results').html(data); 870 var myHilitor = new Hilitor("banner-popup-search-results"); // id of the element to parse 871 myHilitor.apply(searchTerm); 872 //$('#banner-popup-search-results-container').removeClass('sr-only'); 873 $('#banner-popup-search-results-container').slideDown(); 874 //$('#banner-popup-search-results-container').toggle(); 875 } 876 }); 877 } 878 879 if (searchTermLength <= 2) { 880 $('#banner-popup-search-results-container').slideUp(); 881 } 882 }, 400, false)); 883 884 //pop-up search functions 885 $(document).on("input", "#macro-popup-search-input", debounce(function () { 886 var searchTerm = this.value; 887 var searchTermLength = searchTerm.length; 888 if (searchTermLength >= 3) { 889 $('#macro-popup-search-results-container').hide(); 890 //var form = $(e.target).closest('form'); 891 var form = $("#macro-popup-search-input").closest('form'); 892 893 //set the value without hyphens before we submit the form 894 var searchTermWithoutHyphen = form.find('#macro-popup-search-input'); 895 var newVal = searchTermWithoutHyphen.val().replace("-", ""); 896 searchTermWithoutHyphen.val(newVal); 897 898 var postUrl = form.attr("action"); 899 $.ajax({
900 url: postUrl, 901 method: 'POST', 902 data: form.serialize(), 903 success: function success(data) { 904 //var val = $('#banner_SearchTerm'); 905 $('#macro-popup-search-results').html(data); 906 var myHilitor = new Hilitor("macro-popup-search-results"); // id of the element to parse 907 myHilitor.apply(searchTerm); 908 $('#macro-popup-search-results-container').removeClass('sr-only'); 909 $('#macro-popup-search-results-container').slideDown(); 910 } 911 }); 912 } 913 914 if (searchTermLength <= 2) { 915 $('#macro-popup-search-results-container').slideUp(); 916 } 917 }, 400, false)); 918 919 $(".twitter-slider").slick({ 920 arrows: true, 921 slidesToShow: 4, 922 slidesToScroll: 1, 923 infinite: false, 924 responsive: [ 925 { 926 breakpoint: 1500, 927 settings: { 928 slidesToShow: 3, 929 centerMode: false, /* set centerMode to false to show complete slide instead of 3 */ 930 slidesToScroll: 1, 931 arrows: true // hide arrows on mobile, as we can use touch slide. 932 } 933 }, 934 { 935 breakpoint: 1024, 936 settings: { 937 slidesToShow: 2, 938 centerMode: false, /* set centerMode to false to show complete slide instead of 3 */ 939 slidesToScroll: 1, 940 arrows: false, // hide arrows on mobile, as we can use touch slide. 941 dots: true // hide arrows on mobile, as we can use touch slide. 942 } 943 }, 944 { 945 breakpoint: 768, 946 settings: { 947 slidesToShow: 1, 948 centerMode: false, /* set centerMode to false to show complete slide instead of 3 */ 949 slidesToScroll: 1, 950 arrows: false, 951 dots: true // hide arrows on mobile, as we can use touch slide. 952 } 953 } 954 ] 955 }); 956 957 $(".instagram-slider").slick({ 958 arrows: true, 959 slidesToShow: 4, 960 slidesToScroll: 1, 961 infinite: false, 962 responsive: [ 963 { 964 breakpoint: 1300, 965 settings: { 966 slidesToShow: 3, 967 centerMode: false, /* set centerMode to false to show complete slide instead of 3 */ 968 slidesToScroll: 1, 969 arrows: true 970 } 971 }, 972 { 973 breakpoint: 992, 974 settings: { 975 slidesToShow: 2, 976 centerMode: false, /* set centerMode to false to show complete slide instead of 3 */ 977 slidesToScroll: 1, 978 arrows: false, 979 dots: true //hide arrows on mobile, as we can use touch slide. 980 } 981 }, 982 { 983 breakpoint: 768, 984 settings: { 985 slidesToShow: 1, 986 centerMode: false, /* set centerMode to false to show complete slide instead of 3 */ 987 slidesToScroll: 1, 988 arrows: false, // hide arrows on mobile, as we can use touch slide. 989 dots: true 990 } 991 } 992 ] 993 }); 994 995 $(".events-slider").slick({ 996 arrows: true, 997 slidesToShow: 4, 998 slidesToScroll: 1, 999 infinite: false, 1000 responsive: [ 1001 { 1002 breakpoint: 2000, 1003 settings: { 1004 slidesToShow: 4, 1005 centerMode: false, /* set centerMode to false to show complete slide instead of 3 */ 1006 slidesToScroll: 1, 1007 arrows: true 1008 } 1009 }, 1010 { 1011 breakpoint: 1300, 1012 settings: { 1013 slidesToShow: 3, 1014 centerMode: false, /* set centerMode to false to show complete slide instead of 3 */ 1015 slidesToScroll: 1, 1016 arrows: true 1017 } 1018 }, 1019 { 1020 breakpoint: 992, 1021 settings: { 1022 slidesToShow: 2, 1023 centerMode: false, /* set centerMode to false to show complete slide instead of 3 */ 1024 slidesToScroll: 1,
1025 arrows: false, 1026 dots: true //hide arrows on mobile, as we can use touch slide. 1027 } 1028 }, 1029 { 1030 breakpoint: 768, 1031 settings: { 1032 slidesToShow: 1, 1033 centerMode: false, /* set centerMode to false to show complete slide instead of 3 */ 1034 slidesToScroll: 1, 1035 arrows: false, // hide arrows on mobile, as we can use touch slide. 1036 dots: true 1037 } 1038 } 1039 ] 1040 }); 1041 1042 $('.body-link-list-item').on('mouseover', function (e) { 1043 e.stopPropagation(); 1044 //remove any images already showing 1045 hideBodyLinkImages(); 1046 //get the id of this: 1047 var hoveredElement = $(this); 1048 $(this).addClass('selected'); 1049 var hoveredId = hoveredElement.attr('id'); 1050 //find the related image: 1051 var imageId = hoveredId.replace('item', 'image'); 1052 var imageToShow = $('#' + imageId); 1053 imageToShow.addClass('show'); 1054 }); 1055 1056 /*don't make all the images disappear until we've left the div altogether*/ 1057 $('.body-link-list').on('mouseleave', function (e) { 1058 e.stopPropagation(); 1059 hideBodyLinkImages(); 1060 showFirstBodyLink(); 1061 }); 1062 1063 function hideBodyLinkImages() { 1064 var imageList = $('.link-list-hover-image'); 1065 imageList.removeClass('show'); 1066 var linkList = $('.body-link-list-item'); 1067 linkList.removeClass('selected'); 1068 } 1069 function showFirstBodyLink () { 1070 //find the first item and make it highlighted 1071 var imageList = $('.link-list-hover-image'); 1072 var linkList = $('.body-link-list-item'); 1073 $(imageList[0]).addClass('show'); 1074 $(linkList[0]).addClass('selected'); 1075 } 1076 1077 function setSearchFilterVisibility() { 1078 if ($('#mobileSearchFiltersShown').val() === 'false') { 1079 $('#searchOptions').collapse('hide'); 1080 $('#searchOptionsCollapseButton').text('Show Filters'); 1081 } 1082 } 1083 1084 (function () { 1085 setSearchFilterVisibility(); 1086 })(); 1087 1088 $('.lhm').on('click', function (e) { 1089 e.preventDefault(); 1090 if ($(this).hasClass('collapsed')) { 1091 //this is the left-hand-menu and we need to : 1092 //1) update the title so it says that it collapses the sub-menu now 1093 //2) replace the first child's class with an up arrow 1094 //<i class="fal fa-angle-down fa-2x"></i> 1095 $(this).attr("title", "Closes the sub-menu for this menu item") 1096 $(this).children().removeClass("fa-angle-down").addClass("fa-angle-up"); 1097 } else { 1098 $(this).attr("title", "Shows the sub-menu for this menu item") 1099 $(this).children().removeClass("fa-angle-up").addClass("fa-angle-down"); 1100 1101 } 1102 }); 1103 1104 1105 $('.collapse').on('shown.bs.collapse', function (e) { 1106 e.preventDefault(); 1107 var $card = $(this).closest('.card'); 1108 if ($card.length > 0) { 1109 $('html,body').animate({ 1110 scrollTop: $card.offset().top - 135 1111 }, 300); 1112 } 1113 }); 1114 1115 //check for pop-up existence: 1116 var $alert = $('#alertPopup'); 1117 1118 if ($alert !== null && $alert !== undefined && $alert.length === 1) { 1119 //show the modal 1120 $alert.modal(); 1121 } 1122 1123 $('#showMoreButton').on('click', function (e) { 1124 e.preventDefault(); 1125 var wrapper = $('#showMoreContainer'); 1126 wrapper.addClass('show-more-wrapper'); 1127 $(this).hide(); 1128 }); 1129 1130 $('[id^=showMoreButton]').on('click', function (e) { 1131 e.preventDefault(); 1132 var wrapper = $('[id^=showMoreContainer]'); 1133 wrapper.removeClass("d-none"); 1134 $(this).hide(); 1135 }); 1136 1137 $('span.btn').on('click', function(e) { 1138 //get child as long as it's an <a> tags 1139 var target = $(this).children('a'); 1140 if(target !== undefined && target !== null && target.length > 0) { 1141 var targetPage = target.attr('href'); 1142 //load target page 1143 window.location = targetPage; 1144 } 1145 }); 1146 1147 $('ol.carousel-indicators > li').on('keyup', function (e) { 1148 if (e.which !== 13) { return; } 1149 //get the data attribute for "slide to" and slide to that slide: 1150 var slideTarget = $(this).data('slide-to'); 1151 if (!!slideTarget || slideTarget===0) { 1152 $('#headerCarousel').carousel(slideTarget); 1153 } 1154 });
1155 1156 $('.carousel').on('slid.bs.carousel', function (e) { 1157 //get the target info element 1158 var infoTargetId = $(this).data('carousel-info'); 1159 var infoTarget = $(infoTargetId); 1160 if (infoTarget.length > 0) { 1161 infoTarget.html('<span>A carousel has updated its contents to slide number ' + (e.to + 1) + '</span>'); 1162 } 1163 }); 1164 1165 //$('button.carousel-stop').on('keyup', function (e) { 1166 // if (e.isComposing || (e.which !== 13 && e.which !== 32 && e.which !== 1)) { 1167 // return; 1168 // } 1169 // //get the associated carousel and perform the appopriate action: 1170 // var action = $(this).data('action'); 1171 // var carouselId = $(this).data('controls-carousel'); 1172 // toggleCarouselAnimation(action, carouselId, $(this)); 1173 //}); 1174 1175 $('button.carousel-stop').on('click', function (e) { 1176 //get the associated carousel and perform the appopriate action: 1177 var action = $(this).data('action'); 1178 var carouselId = $(this).data('controls-carousel'); 1179 toggleCarouselAnimation(action, carouselId, $(this)); 1180 1181 }); 1182 1183 function toggleCarouselAnimation(action, carouselId, button) { 1184 if (carouselId.length > 0) { 1185 if (action === 'stop') { 1186 button.data('action', 'start'); 1187 button.html('<i class="fas fa-play"></i><span class="sr-only">Restarts the Carousel Animation</span>'); 1188 $(carouselId).carousel('pause'); 1189 var infoTargetId = $(carouselId).data('carousel-info'); 1190 var infoTarget = $(infoTargetId); 1191 if (infoTarget.length > 0) { 1192 infoTarget.html('<span>The carousel has been paused.</span>') 1193 } 1194 } 1195 1196 if (action === 'start') { 1197 button.data('action', 'stop'); 1198 button.html('<i class="fas fa-stop"></i><span class="sr-only">Stops the Sliding Animation</span>'); 1199 //in this case the slid event will fire 1200 $(carouselId).carousel(); 1201 } 1202 } 1203 } 1204 1205 //can we find a "loading" class? if so, remove it 1206 $(document).on('lazybeforeunveil', function () { 1207 $("div.image-loading").fadeOut(250); 1208 }); 1209 //setTimeout(function () { $("div.image-loading").fadeOut(500); }, 500); 1210 1211 //for any images that are loading, remove their loading indicator by fading it out 1212 //$('img.loading').imageLoad(function () { 1213 // //do stuff 1214 // var that = $(this); 1215 // var loadingIndicator = that.siblings('div.image-loading'); 1216 // loadingIndicator.fadeOut(500); 1217 //}); 1218 1219});
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.