1var $html = $('html'); 2var $body = $('body'); 3 4$(document).ready(function () { 5 // showCases(); 6 registerFilters(); 7 addFiltersClass(); 8 popupPlugin(); 9 cookieMsg(); 10 defaultTabs(); 11 responsiveTabs(); 12 backToTop(); 13 headerSearch(); 14 menuMobile(); 15 menuDropHover(); 16 equalheight('.same-height, .threecolumns-layout h1'); 17 initAnchorLinks(); 18 initTabs(); 19 scrollToActiveTab(); 20 accordion(); 21 newAccordion(); 22 initSelectForTabs(); 23 searchNumeric(); 24 fileInput(); 25 formTweaks(); 26 27 $(window).on('hashchange', function () { 28 scrollToActiveTab(); 29 }); 30 31 32 if ($("#search-complainant").length) { 33 searchAutocompleteComplainant(); 34 } 35 36 if ($("#search-respondent").length) { 37 searchAutocompleteRespondent(); 38 } 39 40 if ($(".search-keywords").length) { 41 searchMultiple(); 42 } 43 44 if ($("#search-clause").length) { 45 $("#search-clause").numericInput({ allowFloat: true, allowNegative: true }); 46 } 47 48 //init 49 $(document).ready(function () { 50 $('.fileUploader').uploader({ 51 MessageAreaText: "No files selected. Please select a file." 52 }); 53 }); 54 55 56 $(document).ajaxStart(function () { 57 58 }); 59 60 $(document).ajaxComplete(function () { 61 62 }); 63 64 document.addEventListener("keydown", onKeyDownPressed); 65}); 66 67$(window).on('load', function () { 68 equalheight('.same-height'); 69}); 70 71$(document).on("windowresize", function () { 72 // code for back to desktopview 73 if ($(window).width() >= 768) { 74 $(".responsive-tabs-menu a.responsive-current").each(function () { 75 var tab = $(this).attr("href"); 76 $(tab).fadeIn(); 77 $(tab).siblings().hide(); 78 }); 79 }; 80}); 81 82$(window).resize(function (e) { 83 equalheight('.same-height'); 84}); 85 86function headerSearch() { 87 $('.btn_search-open').on('click', function (event) { 88 event.preventDefault(); 89 $body.addClass('search-opened'); 90 }); 91 92 $('.btn-search_close').replaceWith($('.btn-search_close').clone()); 93 94 $('.btn-search_close').on('click', function (event) { 95 event.preventDefault(); 96 $body.removeClass('search-opened'); 97 }); 98} 99 100function fileInput() { 101 $.fn.uploader = function (options) { 102 var settings = $.extend({ 103 MessageAreaText: "No files selected.", 104 MessageAreaTextWithFiles: "File List:", 105 DefaultErrorMessage: "Unable to open this file.", 106 BadTypeErrorMessage: "We cannot accept this file type at this time.", 107 acceptedFileTypes: ['pdf', 'jpg', 'gif', 'jpeg', 'bmp', 'tif', 'tiff', 'png', 'xps', 'doc', 'docx', 108 'fax', 'wmp', 'ico', 'txt', 'cs', 'rtf', 'xls', 'xlsx'] 109 }, options); 110 111 var uploadId = 1; 112 var fileList = $('<ul class="file-list"></ul>'); 113 var hiddenInputs = $('<div class="hidden-inputs hidden"></div>'); 114 $('.file-uploader__message-area').after(fileList); 115 $('.file-list').after(hiddenInputs); 116 117 $('.file-chooser__input').on('change', function () { 118 var file = $('.file-chooser__input').val(); 119 var fileName = (file.match(/([^\\\/]+)$/)[0]); 120 121 $('.file-chooser').removeClass('error'); 122 $('.error-message').remove(); 123 124 var check = checkFile(fileName); 125 if (check === "valid") { 126 $('.hidden-inputs').append($('.file-chooser__input')); 127 var newInput = $('.file-chooser__input').clone({ withDataAndEvents: true }); 128 newInput[0].value = ""; 129 $('.file-chooser').append(newInput); 130 $('.file-list').append('<li style="display: none;"><span class="file-list__name">' + fileName + '</span><button class="removal-button" data-uploadid="' + uploadId + '"></button></li>'); 131 $('.file-list').find("li:last").show(800); 132 $('.removal-button').on('click', function (e) { 133 e.preventDefault(); 134 $('.hidden-inputs input[data-uploadid="' + $(this).data('uploadid') + '"]').remove(); 135 $(this).parent().hide("puff").delay(10).queue(function () { $(this).remove(); }); 136 }); 137 $('.hidden-inputs .file-chooser__input').removeClass('file-chooser__input').attr('data-uploadId', uploadId); 138 uploadId++; 139 140 } else { 141 $('.file-chooser').addClass("error"); 142 var errorText = options.DefaultErrorMessage || settings.DefaultErrorMessage; 143 144 if (check === "badFileName") { 145 errorText = options.BadTypeErrorMessage || settings.BadTypeErrorMessage; 146 } 147 148 $('.file-chooser__input').after('<p class="error-message">' + errorText + '</p>'); 149 } 150 }); 151 152 var checkFile = function (fileName) {
153 var accepted = "invalid", 154 acceptedFileTypes = this.acceptedFileTypes || settings.acceptedFileTypes, 155 regex; 156 157 for (var i = 0; i < acceptedFileTypes.length; i++) { 158 regex = new RegExp("\\." + acceptedFileTypes[i] + "$", "i"); 159 160 if (regex.test(fileName)) { 161 accepted = "valid"; 162 break; 163 } else { 164 accepted = "badFileName"; 165 } 166 } 167 168 return accepted; 169 }; 170 }; 171} 172 173// function showCases() { 174// $( ".applicable-code").on('click', function() { 175// console.log(111); 176// $(".cases").addClass('active'); 177// }); 178 179// $('.cases .btn-close').on('click', function() { 180// $(".cases").removeClass('active'); 181// }); 182// } 183 184function setItemsCounter() { 185 var itemsCount = ($("#input-items-counter").val()); 186 $("#items-counter").text(itemsCount); 187 //console.log('items count updated'); 188 //history.pushState({page: 1}, "title 1", "?page=1") 189 190 191 192 var currentPageQueryString = ($("#input-currentpage-query").val()); 193 history.pushState(currentPageQueryString, document.title, currentPageQueryString); 194} 195 196 197function adviceFilterApplied() { 198 if ($("#input-currentpage-query").val() !== '') { 199 var currentPageQueryString = ($("#input-currentpage-query").val()); 200 history.pushState(currentPageQueryString, document.title, currentPageQueryString); 201 } 202} 203 204equalheight = function (container) { 205 var currentTallest = 0, 206 currentRowStart = 0, 207 rowDivs = new Array(), 208 $el, 209 topPosition = 0; 210 $(container).each(function () { 211 $el = $(this); 212 $($el).height('auto'); 213 topPostion = $el.position().top; 214 215 if (currentRowStart != topPostion) { 216 for (currentDiv = 0; currentDiv < rowDivs.length; currentDiv++) { 217 rowDivs[currentDiv].height(currentTallest); 218 } 219 rowDivs.length = 0; // empty the array 220 currentRowStart = topPostion; 221 currentTallest = $el.height(); 222 rowDivs.push($el); 223 } else { 224 rowDivs.push($el); 225 currentTallest = (currentTallest < $el.height()) ? ($el.height()) : (currentTallest); 226 } 227 for (currentDiv = 0; currentDiv < rowDivs.length; currentDiv++) { 228 rowDivs[currentDiv].height(currentTallest); 229 } 230 }); 231} 232 233function cookieMsg() { 234 function setCookie(name, value, options) { 235 236 options = options || {}; 237 238 var expires = options.expires; 239 240 if (typeof expires == "number" && expires) { 241 var d = new Date(); 242 d.setDate(d.getDate() + expires); 243 expires = options.expires = d; 244 } 245 if (expires && expires.toUTCString) { 246 options.expires = expires.toUTCString(); 247 } 248 249 value = encodeURIComponent(value); 250 251 var updatedCookie = name + "=" + value; 252 253 for (var propName in options) { 254 updatedCookie += "; " + propName; 255 var propValue = options[propName]; 256 if (propValue !== true) { 257 updatedCookie += "=" + propValue; 258 } 259 } 260 261 document.cookie = updatedCookie + ";path=/"; 262 } 263 264 function getCookie(name) { 265 var matches = document.cookie.match(new RegExp( 266 "(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)" 267 )); 268 return matches ? decodeURIComponent(matches[1]) : undefined; 269 } 270 271 function checkCookie() { 272 var cookieMsg = getCookie('pmcpa_cookiemessage_dismissed'); 273 $('body').addClass('view-cookie'); 274 275 function cookieBtn() { 276 $('body').removeClass('view-cookie'); 277 setCookie("pmcpa_cookiemessage_dismissed", "true", { expires: 365 }); 278 setTimeout(function () { 279 $('.cookies-box').hide(); 280 }, 200); 281 return false; 282 } 283 284 $('.cookie-btn').on('click', function () { 285 cookieBtn(); 286 }); 287 288 if (cookieMsg) { 289 cookieBtn(); 290 } 291 } 292 checkCookie(); 293} 294 295function initSelectForTabs() { 296 $(".search-area-form").each(function (index) { 297 var select = $('#choose-search'); 298 299 var initialSelectState = $(select).find(':selected').attr("value") 300 $('.search-area-form') 301 .find($('#' + initialSelectState)) 302 .addClass('active').attr('name', 'term') 303 .find('select').attr('name', 'term'); 304 305 select.change(function () { 306 var currentAttrValue = $(this).find(':selected').attr("value") 307 $('.search-area-item') 308 .removeClass('active') 309 .removeAttr('name') 310 .find('select') 311 .removeAttr('name'); 312 313 $('.search-area-form') 314 .find($('#' + currentAttrValue)) 315 .addClass('active').attr('name', 'term') 316 .find('select').attr('name', 'term'); 317 }); 318 });
319} 320 321function searchNumeric() { 322 (function (b) { 323 var c = { allowFloat: false, allowNegative: false }; 324 b.fn.numericInput = function (e) { 325 var f = b.extend({}, c, e); 326 var d = f.allowFloat; 327 var g = f.allowNegative; 328 this.keypress(function (j) { 329 var i = j.which; 330 var h = b(this).val(); 331 if (i > 0 && (i < 48 || i > 57)) { 332 if (d == true && i == 46) { 333 if (g == true && a(this) == 0 && h.charAt(0) == "-") { 334 return false 335 } 336 if (h.match(/[.]/)) { 337 return false 338 } 339 } 340 else { 341 if (g == true && i == 45) { 342 if (h.charAt(0) == "-") { 343 return false 344 } 345 if (a(this) != 0) { 346 return false 347 } 348 } 349 else { 350 if (i == 8) { 351 return true 352 } 353 else { 354 return false 355 } 356 } 357 } 358 } 359 else { 360 if (i > 0 && (i >= 48 && i <= 57)) { 361 if (g == true && h.charAt(0) == "-" && a(this) == 0) { 362 return false 363 } 364 } 365 } 366 }); 367 return this 368 }; 369 function a(d) { 370 if (d.selectionStart) { 371 return d.selectionStart 372 } 373 else { 374 if (document.selection) { 375 d.focus(); 376 var f = document.selection.createRange(); 377 if (f == null) { 378 return 0 379 } 380 var e = d.createTextRange(), g = e.duplicate(); 381 e.moveToBookmark(f.getBookmark()); 382 g.setEndPoint("EndToStart", e); 383 return g.text.length 384 } 385 } 386 return 0 387 } 388 }(jQuery)); 389} 390 391function registerFilters() { 392 $(document).on("change", "#filter1, #filter2, #filter3", function (event) { 393 event.preventDefault(); 394 var form = $(this).closest("#filtersForm"); 395 $(form).submit(); 396 }); 397 398 $(document).on("change", "#filterYear", function (event) { 399 event.preventDefault(); 400 var form = $(this).closest("#filtersForm"); 401 $(form).submit(); 402 }); 403 404 $(document).on("change", "#filterDate", function (event) { 405 event.preventDefault(); 406 var form = $(this).closest("#filtersForm"); 407 $(form).submit(); 408 }); 409 410 $(document).on("click", "#clearCasesFormFilters", function (event) { 411 event.preventDefault(); 412 413 if (window.location.href.indexOf("&a=") > -1) { 414 415 var url = window.location.href; 416 417 var urlparts = window.location.href.split('?'); 418 if (urlparts.length >= 2) { 419 var partsToRemove = ['a', 'y', 'o']; 420 //var prefix = encodeURIComponent(parameter) + '='; 421 var pars = urlparts[1].split(/[&;]/g); 422 423 //reverse iteration as may be destructive 424 for (var i = pars.length; i-- > 0;) { 425 //idiom for string.startsWith 426 var param = pars[i].substring(0, pars[i].indexOf('=')); 427 if (partsToRemove.indexOf(param) > -1) { 428 pars.splice(i, 1); 429 } 430 else if (param === 'page') { 431 pars[i] = 'page=1'; 432 } 433 } 434 435 url = urlparts[0] + '?' + pars.join('&'); 436 } 437 438 window.location.replace(url); 439 //alert(url); 440 } 441 else { 442 $("#filtersForm")[0].reset(); 443 var form = $(this).closest("#filtersForm"); 444 $(form).submit(); 445 } 446 447 }); 448 449 $(document).on("click", "#clearFormFilters", function (event) { 450 event.preventDefault(); 451 $("#filtersForm")[0].reset(); 452 var form = $(this).closest("#filtersForm"); 453 $(form).submit(); 454 }); 455 456 $(document).on("click", "#resetFormFilters", function (event) { 457 event.preventDefault(); 458 $("#filtersForm")[0].reset(); 459 $("#filterYear")[0].selectedIndex = 0; 460 $("#filterDate")[0].selectedIndex = 0; 461 var form = $(this).closest("#filtersForm"); 462 $(form).submit(); 463 }); 464 465 $(document).on("click", "#clearFiltersParams", function (event) { 466 event.preventDefault(); 467 $("#filtersForm")[0].reset(); 468 // $("#button-1, #button-2, #button-3").val("false"); 469 $("#button-1, #button-2, #button-3").removeAttr('checked'); 470 var form = $(this).closest("#filtersForm"); 471 $(form).submit(); 472 }); 473 474 $(document).on("change", "#button-1, #button-2, #button-3, #order-by-select", function (event) { 475 var form = $(this).closest("#filtersForm"); 476 $(form).submit(); 477 });
478 479 $(document).on("change", "#ongoing-select", function (event) { 480 event.preventDefault(); 481 $("#pagination").remove(); 482 var form = $(this).closest("#ongoingCasesForm"); 483 $(form).submit(); 484 }); 485 486 $(document).on("change", "#topic-select", function (event) { 487 event.preventDefault(); 488 var form = $(this).closest("#adviceByTopicForm"); 489 $(form).submit(); 490 }); 491 492 $(document).on("change", "#search-by-clause", function (event) { 493 event.preventDefault(); 494 var form = $(this).closest("#adviceByTopicForm"); 495 $(form).submit(); 496 }); 497 498 $(document).on("click", "#viewAllAdvices", function (event) { 499 event.preventDefault(); 500 $("#adviceByTopicForm")[0].reset(); 501 var form = $(this).closest("#adviceByTopicForm"); 502 $(form).submit(); 503 }); 504 505 $(document).on("click", ".filters-area a", function (event) { 506 event.preventDefault(); 507 var form = $(this).closest("#publicationsFiltersForm"); 508 $('#filterId').val($(this).data('filter')); 509 $(form).submit(); 510 }); 511 512 $(document).on("change", "#breach-criteria-select, #applicable-year-select, #year-received-select", function (event) { 513 var form = $(this).closest("#filtersForm"); 514 $(form).submit(); 515 }); 516} 517 518function addFiltersClass() { 519 $(".filters-area .btn-filter-primary").on("click", function (e) { 520 e.preventDefault(); 521 $('.btn-filter-primary').removeClass('active'); 522 $(this).addClass("active"); 523 }); 524 525 $(".btn-filter-clear").on("click", function (e) { 526 e.preventDefault(); 527 $('.filters-area a ').removeClass('active'); 528 }); 529} 530 531function searchAutocompleteRespondent() { 532 var aCountries = [], 533 cache = {}; 534 $('#search-respondent').autocomplete({ 535 delay: 500, 536 minLength: 2, 537 create: function (event, ui) { 538 $.ajax({
539 url: "https://codepen.io/blackjacques/pen/gvJVYo.html", 540 dataType: "text", 541 success: function (data) { 542 //debugger; 543 aCountries = data.split('\n').map(function (currentValue, index, arr) { 544 var labelValuePair = currentValue.split(':'); 545 return { 546 label: labelValuePair[1], 547 value: labelValuePair[0] 548 }; 549 }); 550 } 551 }); 552 }, 553 source: function (request, response) { 554 var term = request.term.toLowerCase(); 555 if (!(term in cache)) { 556 var matcher = new RegExp("\\b" + $.ui.autocomplete.escapeRegex(term), "i"); 557 cache[term] = aCountries.filter(function (item) { 558 return matcher.test(item.label); 559 }); 560 } 561 response(cache[term]); 562 }, 563 select: function (event, ui) { 564 event.preventDefault(); 565 $(event.target).val(ui.item.label); 566 }, 567 focus: function (event, ui) { 568 event.preventDefault(); 569 $(event.target).val(ui.item.label); 570 } 571 }) 572} 573 574function searchAutocompleteComplainant() { 575 var aCountries = [], 576 cache = {}; 577 $('#search-complainant').autocomplete({ 578 delay: 500, 579 minLength: 2, 580 create: function (event, ui) { 581 $.ajax({
582 url: "https://codepen.io/blackjacques/pen/gvJVYo.html", 583 dataType: "text", 584 success: function (data) { 585 //debugger; 586 aCountries = data.split('\n').map(function (currentValue, index, arr) { 587 var labelValuePair = currentValue.split(':'); 588 return { 589 label: labelValuePair[1], 590 value: labelValuePair[0] 591 }; 592 }); 593 } 594 }); 595 }, 596 source: function (request, response) { 597 var term = request.term.toLowerCase(); 598 if (!(term in cache)) { 599 var matcher = new RegExp("\\b" + $.ui.autocomplete.escapeRegex(term), "i"); 600 cache[term] = aCountries.filter(function (item) { 601 return matcher.test(item.label); 602 }); 603 } 604 response(cache[term]); 605 }, 606 select: function (event, ui) { 607 event.preventDefault(); 608 $(event.target).val(ui.item.label); 609 }, 610 focus: function (event, ui) { 611 event.preventDefault(); 612 $(event.target).val(ui.item.label); 613 } 614 }) 615} 616 617function searchMultiple() { 618 var items = ['France', 'Italy', 'Malta', 'England', 619 'Australia', 'Spain', 'Scotland']; 620 621 function split(val) { 622 return val.split(/,\s*/); 623 } 624 625 function extractLast(term) { 626 return split(term).pop(); 627 } 628 629 $(".search-keywords").autocomplete({ 630 minLength: 0, 631 source: function (request, response) { 632 response($.ui.autocomplete.filter( 633 items, extractLast(request.term))); 634 }, 635 focus: function () { 636 return false; 637 }, 638 select: function (event, ui) { 639 var terms = split(this.value); 640 // remove the current input 641 terms.pop(); 642 // add the selected item 643 terms.push(ui.item.value); 644 // add placeholder to get the comma-and-space at the end 645 terms.push(""); 646 this.value = terms.join(", "); 647 return false; 648 } 649 }); 650} 651 652function responsiveTabs() { 653 var active = "responsive-current", 654 wrapper = ".responsive-tab-content", 655 heading = "responsive-heading"; 656 657 // code for creating accodion heading 658 $('<h2></h2>', { 659 class: heading + ' responsive-destophide', 660 }).insertBefore(wrapper); 661 // code for creating accodion panel 662 $(".responsive-tabs-menu a").each(function () { 663 var tab = $(this).attr("href"); 664 $(this).clone().appendTo($(tab).prev($('.' + heading))); 665 }); 666 // code For tabs 667 $(".responsive-tabs-menu a").click(function (event) { 668 event.preventDefault(); 669 $(this).addClass(active); 670 $(this).parent().siblings().children().removeClass(active); 671 var tab = $(this).attr("href"); 672 $(wrapper).not(tab).css("display", "none").removeClass('active'); 673 $(tab).fadeIn().addClass('active'); 674 675 $(".responsive-tabs-menu a").each(function () { 676 var tab = $(this).attr("href"); 677 $(this).clone().appendTo($(tab).prev($('.' + heading))); 678 }); 679 $('.' + heading + ' a').prev().remove(); 680 }); 681 682 683 // code for accodion function 684 $(document).on('click', '.responsive-heading a', function (e) { 685 e.preventDefault(); 686 if (!$(this).hasClass(active)) { 687 $(this).addClass(active); 688 $(this).parent().siblings('.' + heading).children().removeClass(active); 689 $(this).parent().next().slideDown(); 690 $(this).parent().next().siblings(wrapper).slideUp(); 691 } 692 else { 693 $(this).removeClass(active); 694 $(this).parent().next().slideUp(); 695 } 696 }); 697 698 // code for back to desktopview 699 if ($(window).width() >= 768) { 700 $(".responsive-tabs-menu a.responsive-current").each(function () { 701 var tab = $(this).attr("href"); 702 $(tab).fadeIn(); 703 $(tab).siblings().hide(); 704 }); 705 }; 706};
707 708function defaultTabs() { 709 // show first content by default 710 $('#tabs-nav li:first-child').addClass('active'); 711 $('.content').hide(); 712 $('.content:first').show(); 713 714 // click function 715 $('#tabs-nav li').click(function () { 716 $('#tabs-nav li').removeClass('active'); 717 $(this).addClass('active'); 718 $('.content').hide(); 719 720 var activeTab = $(this).find('a').attr('href'); 721 $(activeTab).fadeIn(); 722 return false; 723 }); 724}; 725 726function backToTop() { 727 // browser window scroll (in pixels) after which the "back to top" link is shown 728 var offset = 300, 729 //browser window scroll (in pixels) after which the "back to top" link opacity is reduced 730 offset_opacity = 1200, 731 //duration of the top scrolling animation (in ms) 732 scroll_top_duration = 700, 733 //grab the "back to top" link 734 $back_to_top = $('.cd-top'); 735 736 //hide or show the "back to top" link 737 $(window).scroll(function () { 738 ($(this).scrollTop() > offset) ? $back_to_top.addClass('cd-is-visible') : $back_to_top.removeClass('cd-is-visible cd-fade-out'); 739 if ($(this).scrollTop() > offset_opacity) { 740 $back_to_top.addClass('cd-fade-out'); 741 } 742 }); 743 744 //smooth scroll to top 745 $back_to_top.on('click', function (event) { 746 event.preventDefault(); 747 748 // var searchArea = $(".search-area"); 749 // var destination = searchArea.length ? searchArea.offset().top : 0; 750 751 // $('body,html').animate({scrollTop: destination}, scroll_top_duration); 752 $('body,html').animate({ scrollTop: 0 }, scroll_top_duration); 753 }); 754 755 if (location.search.length) { 756 var searchArea = $(".search-area"); 757 var destination = searchArea.length ? searchArea.offset().top : 0; 758 759 $('body,html').animate({ scrollTop: destination }, scroll_top_duration); 760 } else { 761 $('body,html').animate({ scrollTop: 0 }, scroll_top_duration); 762 } 763}; 764 765function accordion() { 766 $(".desktop-accordion>li>a").on('click', function (e) { 767 e.preventDefault(); // Prevent jump caused by <a> 768 769 var current_li = $(this).parent(); 770 var clicked_title = $(this); 771 772 $(".desktop-accordion li .slide").each(function (i, el) { 773 if ($(el).parent().is(current_li)) { 774 775 // Toggle accordion 776 $(el).prev().toggleClass("active"); 777 778 // After expand/collapse finishes, scroll to the clicked title 779 $(el).slideToggle(function () { 780 $('html, body').animate({ 781 scrollTop: clicked_title.offset().top 782 }, 400); // smooth scroll 783 }); 784 785 } else { 786 $(el).prev().removeClass("active"); 787 $(el).slideUp(); 788 } 789 }); 790 }); 791 792 $('.desktop-accordion li > .slide').hide(); 793 794}; 795 796function newAccordion() { 797 if ($('.tab-accordeon .accordion').length) { 798 $('.tab-accordeon .accordion').removeClass('desktop-accordion').addClass('mobile-accordion'); 799 $(".mobile-accordion>li>a").on('click', function () { 800 var current_li = $(this).parent(); 801 $(".mobile-accordion li .slide").each(function (i, el) { 802 if ($(el).parent().is(current_li)) { 803 $(el).prev().toggleClass("active"); 804 $(el).slideToggle(); 805 } else { 806 $(el).prev().removeClass("active"); 807 $(el).slideUp(); 808 } 809 }); 810 }); 811 $('.mobile-accordion li > .slide').hide(); 812 $('.mobile-accordion>li>a').first().addClass("active"); 813 $('.mobile-accordion li > .slide').first().show(); 814 } 815} 816 817function menuMobile() { 818 var $menuBtn = $('.burger-btn'), 819 $menuDrop = $('.nav-container'); 820 821 $menuBtn.on('click', function () { 822 if (window.innerWidth <= 1024 && !$menuDrop.hasClass('open-menu')) { 823 showHideHamburgerMenu($menuDrop, $menuBtn, false); 824 } else { 825 showHideHamburgerMenu($menuDrop, $menuBtn, true); 826 } 827 }); 828 829 $(window).resize(function(event) { 830 //ios detects scroll action as resize, so ignore the scroll action 831 if (event && event.type && event.type.toLowerCase() === 'scroll') 832 return; 833 834 if (window.innerWidth >= 1024) { 835 //close mobile search 836 $body.removeClass('search-opened'); 837 //close any open navigation menus 838 $('.main-nav_item').removeClass('open-item'); 839 840 showHideHamburgerMenu($menuDrop, $menuBtn, true); 841 } 842}); 843} 844 845function showHideHamburgerMenu(menuDrop, menuBtn, hide){ 846 if(hide){ 847 menuDrop.removeClass('open-menu'); 848 menuBtn.removeClass('open'); 849 menuBtn.find('button').attr('aria-label', 'Open menu'); 850 menuBtn.find('button').attr('aria-expanded', 'false'); 851 } 852 else{ 853 menuDrop.addClass('open-menu'); 854 menuBtn.addClass('open'); 855 menuBtn.find('button').attr('aria-label', 'Close menu'); 856 menuBtn.find('button').attr('aria-expanded', 'true'); 857 } 858} 859 860function menuDropHover() { 861 jQuery('.main-nav_item').each(function () { 862 var item = jQuery(this); 863 var drop = item.find('>ul'); 864 var link = item.find('a').eq(0); 865 if (drop.length) { 866 item.addClass('has-drop-down'); 867 if (link.length) link.addClass('has-drop-down-a'); 868 } 869 }); 870 871 $('.main-nav>ul>li').mouseenter(function() { 872 873 if (window.innerWidth > 1024) {
874 //close all open navigation items 875 closeAllNavigationItems(); 876 showHideNavigationItem(this, true); 877 } 878 }); 879 880 $('.main-nav>ul>li').mouseleave(function() { 881 if (window.innerWidth > 1024) { 882 showHideNavigationItem(this, false); 883 } 884 }); 885 886 //click event handler on the navigation item to open/close it 887 $('.main-nav_item').on('click', function (evt) { 888 889 //if the clicked item is the anchor tag, then dont expand/collapse the navigation item 890 if(evt.target && evt.target.nodeName && evt.target.nodeName.toLowerCase() === "a" ) 891 return; 892 893 if ($(this).hasClass('open-item')) { 894 showHideNavigationItem(this, false); 895 } else { 896 //close all open navigation items 897 $('.main-nav_item').removeClass('open-item'); 898 899 showHideNavigationItem(this, true); 900 } 901 }); 902 903 //focusout event handler on the last link in a navigation item 904 //used to close the navigation item if focus goes away from it 905 $('.main-nav_item > .drop > li:last-of-type').on('focusout', function () { 906 let navItem = $(this).parent('.drop').parent('.main-nav_item'); 907 showHideNavigationItem(navItem, false); 908 }); 909} 910 911function closeAllNavigationItems(){ 912 let subNavItems = document.querySelectorAll('.main-nav>ul>li'); 913 subNavItems.forEach((item) => showHideNavigationItem(item, false)); 914} 915 916function showHideNavigationItem(targetElement, show){ 917 if(show){ 918 $(targetElement).addClass('open-item'); 919 $(targetElement).find('button').attr('aria-label', 'Hide navigation dropdown'); 920 $(targetElement).find('img').attr('alt', 'Hide navigation dropdown icon'); 921 } 922 else{ 923 $(targetElement).removeClass('open-item'); 924 $(targetElement).find('button').attr('aria-label', 'Show navigation dropdown'); 925 $(targetElement).find('img').attr('alt', 'Show navigation dropdown icon'); 926 } 927} 928 929function scrollToHash(hash) { 930 var target = $(hash); 931 var scrollTo = ""; 932 if (target.length) { 933 setTimeout(function () { 934 if (document.getElementById("stickyHeaderBig")) { 935 scrollTo = target.offset().top - document.getElementById("stickyHeaderBig").scrollHeight - 190; 936 $('body, html').animate({ scrollTop: scrollTo + 'px' }, 800); 937 } 938 else { 939 scrollTo = target.offset().top; 940 $('body, html').animate({ scrollTop: scrollTo + 'px' }, 800); 941 } 942 }, 200); 943 } 944} 945 946function initAnchorLinks() { 947 // This code was written before Cludo was put in place and clashes with clude, 948 // therefore the if statement is here to prevent this code from running on Cludo search resutls pages 949 if ($('.CludoCasesSearch, .SearchResultsPage, .CompletedCasesPage').length < 1) { 950 var locationTarget = window.location.hash; 951 952 if (locationTarget.length) { 953 scrollToHash(locationTarget); 954 } 955 956 $('.js-anchor-link').click(function (e) { 957 e.preventDefault(); 958 var hash = $(this).attr('href'); 959 scrollToHash(hash); 960 }); 961 } 962}; 963 964// content tabs init 965function initTabs() { 966 jQuery('.tabset').tabset({ 967 tabLinks: 'a.tab-link', 968 checkHash: true, 969 addToParent: true, 970 }); 971} 972 973function scrollToActiveTab() { 974 if (location.hash.slice(-6) == '-slide') { 975 var $tab = $(location.hash.slice(0, -6)); 976 // open tab if it closed 977 if ($tab.hasClass('js-tab-hidden')) { 978 $('.tab-link[href="' + location.hash + '"]').trigger('click'); 979 }; 980 //var scrollPos = $(window).scrollTop(); 981 //$('body').css({ 982 // 'position': 'fixed', 983 // 'overflow': 'hidden', 984 // 'top': '-' + scrollPos + 'px' 985 //}) 986 setTimeout(function () { 987 if (document.getElementById("stickyHeaderBig")) { 988 //$([document.documentElement, document.body]).animate({ 989 // scrollTop: $tab.closest('.tab-content').prev().offset().top - document.getElementById("stickyHeaderBig").scrollHeight - 340 // CHANGED FROM 150 TO 130 TO CONSIDER THE STICKY HEADER NOW 990 //}, 800); 991 } 992 else { 993 $([document.documentElement, document.body]).animate({ 994 scrollTop: $tab.closest('.tab-content').prev().offset().top - 150 995 }, 800); 996 } 997 }, 900); 998 } 999} 1000 1001// jQuery popup plugin 1002 1003function popupPlugin() { 1004 // jQuery extend functions for popup 1005 (function ($) { 1006 $.fn.openPopup = function (settings) { 1007 var elem = $(this); 1008 // Establish our default settings 1009 var settings = $.extend({ 1010 anim: 'fade' 1011 }, settings); 1012 elem.show(); 1013 elem.find('.popup-content').addClass(settings.anim + 'In'); 1014 } 1015 1016 $.fn.closePopup = function (settings) { 1017 var elem = $(this); 1018 // Establish our default settings 1019 var settings = $.extend({ 1020 anim: 'fade' 1021 }, settings); 1022 elem.find('.popup-content').removeClass(settings.anim + 'In').addClass(settings.anim + 'Out'); 1023 1024 setTimeout(function () { 1025 elem.hide(); 1026 elem.find('.popup-content').removeClass(settings.anim + 'Out') 1027 }, 0); 1028 } 1029 1030 }(jQuery)); 1031 1032 // Click functions for popup 1033 $('.open-popup').click(function (event) { 1034 event.preventDefault(); 1035 $('body').addClass('popup-active'); 1036 $('#' + $(this).data('id')).openPopup({ 1037 anim: (!$(this).attr('data-animation') || $(this).data('animation') == null) ? 'fade' : $(this).data('animation') 1038 }); 1039 });
1040 $('.close-popup').click(function (event) { 1041 event.preventDefault(); 1042 $('body').removeClass('popup-active'); 1043 $('#' + $(this).data('id')).closePopup({ 1044 anim: (!$(this).attr('data-animation') || $(this).data('animation') == null) ? 'fade' : $(this).data('animation') 1045 }); 1046 }); 1047 1048 // To open/close the popup at any functions call the below 1049 // $('#popup_default').openPopup(); 1050 // $('#popup_default').closePopup(); 1051} 1052 1053function formTweaks() { 1054 if ($('input:hidden[id=FormName][value="Alert Subscriptions"]').length > 0) { 1055 //alert('it exists'); 1056 $('.umbraco-forms-field*.checkbox span.umbraco-forms-tooltip, .umbraco-forms-field*.checkbox label').each(function () { 1057 var encodedStr = $(this).html(); 1058 var decoded = $("<div/>").html(encodedStr).text(); 1059 $(this).html(decoded); 1060 }); 1061 } 1062}; 1063 1064/* 1065 * jQuery Tabs plugin 1066 */ 1067 1068; (function ($, $win) { 1069 'use strict'; 1070 1071 function Tabset($holder, options) { 1072 this.$holder = $holder; 1073 this.options = options; 1074 1075 this.init(); 1076 } 1077 1078 Tabset.prototype = { 1079 init: function () { 1080 this.$tabLinks = this.$holder.find(this.options.tabLinks); 1081 1082 this.setStartActiveIndex(); 1083 this.setActiveTab(); 1084 1085 if (this.options.autoHeight) { 1086 this.$tabHolder = $(this.$tabLinks.eq(0).attr(this.options.attrib).slice(0, -6)).parent(); 1087 } 1088 1089 this.makeCallback('onInit', this); 1090 }, 1091 1092 setStartActiveIndex: function () { 1093 var $classTargets = this.getClassTarget(this.$tabLinks); 1094 var $activeLink = $classTargets.filter('.' + this.options.activeClass); 1095 var $hashLink = this.$tabLinks.filter('[' + this.options.attrib + '="' + location.hash + '"]'); 1096 var activeIndex; 1097 1098 if (this.options.checkHash && $hashLink.length) { 1099 $activeLink = $hashLink; 1100 } 1101 1102 if ($activeLink.data('index')) { 1103 activeIndex = $activeLink.data('index') - 1; 1104 } else { 1105 activeIndex = -1; 1106 } 1107 1108 this.activeTabIndex = this.prevTabIndex = (activeIndex === -1 ? (this.options.defaultTab ? 0 : null) : activeIndex); 1109 }, 1110 1111 setActiveTab: function () { 1112 var self = this; 1113 1114 this.$tabLinks.each(function (i, link) { 1115 var $link = $(link); 1116 var $classTarget = self.getClassTarget($link); 1117 var $tab = $($link.attr(self.options.attrib).slice(0, -6)); 1118 1119 if (i !== self.activeTabIndex) { 1120 $classTarget.removeClass(self.options.activeClass); 1121 $tab.addClass(self.options.tabHiddenClass).removeClass(self.options.activeClass); 1122 } else { 1123 $classTarget.addClass(self.options.activeClass); 1124 $('.tab-accordeon').html(''); 1125 $tab.children().clone().appendTo($classTarget.find('.tab-accordeon')); 1126 $tab.removeClass(self.options.tabHiddenClass).addClass(self.options.activeClass); 1127 } 1128 1129 self.attachTabLink($link, i); 1130 }); 1131 }, 1132 1133 attachTabLink: function ($link, i) { 1134 var self = this; 1135 1136 $link.on(this.options.event + '.tabset', function (e) { 1137 e.preventDefault(); 1138 1139 if (self.activeTabIndex === self.prevTabIndex && self.activeTabIndex !== i) { 1140 self.activeTabIndex = i; 1141 self.switchTabs(); 1142 } 1143 if (self.options.checkHash) { 1144 location.hash = jQuery(this).attr('href').split('#')[1] 1145 } 1146 }); 1147 }, 1148 1149 resizeHolder: function (height) { 1150 var self = this; 1151 1152 if (height) { 1153 this.$tabHolder.height(height); 1154 setTimeout(function () { 1155 self.$tabHolder.addClass('transition'); 1156 }, 10); 1157 } else { 1158 self.$tabHolder.removeClass('transition').height(''); 1159 } 1160 }, 1161 1162 switchTabs: function () { 1163 var self = this; 1164 1165 var prevL = this.prevTabIndex; 1166 var $prevLink = this.$tabLinks.filter(function () { 1167 return $(this).attr("data-index") == prevL; 1168 }); 1169 1170 var nextL = this.activeTabIndex; 1171 var $nextLink = this.$tabLinks.filter(function () { 1172 return $(this).attr("data-index") == nextL; 1173 }); 1174 1175 var usePrevTab = false; 1176 if ($prevLink.length > 0) { 1177 usePrevTab = true; 1178 var $prevTab = this.getTab($prevLink); 1179 } 1180 1181 var $nextTab = this.getTab($nextLink); 1182 1183 if (usePrevTab) { 1184 $prevTab.removeClass(this.options.activeClass); 1185 } 1186 1187 if (self.haveTabHolder()) { 1188 if (usePrevTab) { 1189 this.resizeHolder($prevTab.outerHeight()); 1190 } 1191 } 1192 1193 setTimeout(function () { 1194 self.getClassTarget($prevLink).removeClass(self.options.activeClass); 1195 1196 if (usePrevTab) { 1197 $prevTab.addClass(self.options.tabHiddenClass); 1198 } 1199 1200 $nextTab.removeClass(self.options.tabHiddenClass).addClass(self.options.activeClass); 1201 self.$tabLinks.eq(self.activeTabIndex).next().html(''); 1202 $nextTab.children().clone().appendTo(self.$tabLinks.eq(self.activeTabIndex).next()); 1203 1204 self.getClassTarget($nextLink).addClass(self.options.activeClass); 1205 1206 if (self.haveTabHolder()) { 1207 self.resizeHolder($nextTab.outerHeight()); 1208 1209 setTimeout(function () { 1210 self.resizeHolder(); 1211 self.prevTabIndex = self.activeTabIndex; 1212 self.makeCallback('onChange', self); 1213 }, self.options.animSpeed); 1214 } else { 1215 self.prevTabIndex = self.activeTabIndex; 1216 } 1217 }, this.options.autoHeight ? this.options.animSpeed : 1); 1218 }, 1219 1220 getClassTarget: function ($link) { 1221 return this.options.addToParent ? $link.parent() : $link; 1222 }, 1223 1224 getActiveTab: function () { 1225 return this.getTab(this.$tabLinks.eq(this.activeTabIndex)); 1226 }, 1227 1228 getTab: function ($link) { 1229 return $($link.attr(this.options.attrib).slice(0, -6)); 1230 }, 1231 1232 haveTabHolder: function () { 1233 return this.$tabHolder && this.$tabHolder.length; 1234 }, 1235 1236 destroy: function () { 1237 var self = this; 1238 1239 this.$tabLinks.off('.tabset').each(function () { 1240 var $link = $(this); 1241 1242 self.getClassTarget($link).removeClass(self.options.activeClass); 1243 $($link.attr(self.options.attrib).slice(0, -6)).removeClass(self.options.activeClass + ' ' + self.options.tabHiddenClass); 1244 }); 1245 1246 this.$holder.removeData('Tabset'); 1247 }, 1248 1249 makeCallback: function (name) { 1250 if (typeof this.options[name] === 'function') { 1251 var args = Array.prototype.slice.call(arguments); 1252 args.shift(); 1253 this.options[name].apply(this, args); 1254 } 1255 } 1256 }; 1257 1258 $.fn.tabset = function (opt) { 1259 var args = Array.prototype.slice.call(arguments); 1260 var method = args[0]; 1261 1262 var options = $.extend({ 1263 activeClass: 'active', 1264 addToParent: true, 1265 autoHeight: false, 1266 checkHash: false, 1267 defaultTab: false, 1268 animSpeed: 500, 1269 tabLinks: 'a', 1270 attrib: 'href', 1271 event: 'click', 1272 tabHiddenClass: 'js-tab-hidden' 1273 }, opt); 1274 options.autoHeight = options.autoHeight; 1275 1276 return this.each(function () { 1277 var $holder = jQuery('body'); 1278 var instance = $holder.data('Tabset'); 1279 1280 if (typeof opt === 'object' || typeof opt === 'undefined') { 1281 $holder.data('Tabset', new Tabset($holder, options)); 1282 } else if (typeof method === 'string' && instance) { 1283 if (typeof instance[method] === 'function') { 1284 args.shift(); 1285 instance[method].apply(instance, args); 1286 } 1287 } 1288 });
1289 }; 1290}(jQuery, jQuery(window))); 1291 1292//startblock - Interactive Code Enhancements 1293$(document).ready(function () { 1294 1295 var tabs = document.querySelectorAll('.ag-tab-link'); 1296 tabs.forEach((elem) => { 1297 elem.addEventListener('click', (e) => { 1298 if (e.target.classList.contains("tab-link")) {//Fix for the tab toggle issue(Supplementary Information, Cases Advice) 1299 if (e.target.parentElement.classList.contains("active")) { 1300 e.target.parentElement.classList.remove("active"); 1301 elem.parentElement.parentElement.nextElementSibling.style.display = "none"; 1302 } 1303 else { 1304 e.target.parentElement.classList.add("active"); 1305 elem.parentElement.parentElement.nextElementSibling.style.display = "flex"; 1306 } 1307 } 1308 else {//Fix for the sub clause tab toggle issue in mobile 1309 if (e.target.classList.contains("active")) { 1310 e.target.classList.remove("active"); 1311 e.target.nextElementSibling.style.display = "none"; 1312 } 1313 else { 1314 e.target.classList.add("active"); 1315 e.target.nextElementSibling.style.display = "block"; 1316 } 1317 } 1318 }); 1319 }); 1320 1321 document.querySelectorAll(".code-dialog").forEach((elem) => { //initialize modal for all 6 sections 1322 var selector = "#" + elem.id; 1323 $(selector).dialog({ 1324 autoOpen: false, 1325 draggable: false, 1326 resizable: false, 1327 modal: true, 1328 closeOnEscape: true, 1329 width: "70%", 1330 classes: { 1331 "ui-dialog": "ui-dialog-override" 1332 } 1333 }); 1334 }); 1335 $('.codeSection').on("click", function (e) { //open modal on section click 1336 var selector = "#" + $(this).data('sectionitem'); 1337 $(selector).parent().css({ position: "fixed" }); 1338 $(selector).dialog("open"); 1339 $(selector).dialog('widget').position({ my: "center", at: "center", of: window }); 1340 $(".ui-dialog-titlebar").hide(); 1341 $(".ui-dialog-titlebar-close").remove(); 1342 $(".ui-widget-overlay").css("background", "#000").css("opacity", "0.7"); 1343 }); 1344 $('.popup-close').on("click", function (e) { // close modal 1345 $(this).closest('.ui-dialog-content').dialog('close'); 1346 }); 1347 1348 // initialize index modal 1349 $("#code-index-popup").dialog({ 1350 autoOpen: false, 1351 draggable: false, 1352 resizable: false, 1353 modal: true, 1354 closeOnEscape: true, 1355 width: "70%", 1356 classes: { 1357 "ui-dialog": "ui-dialog-override" 1358 } 1359 }); 1360 1361 $('.close-index').on("click", function (e) { //close for mobile 1362 $(this).closest('.ui-dialog-content').dialog('close'); 1363 }); 1364 1365 1366 // logic for expand and collapse of section inside the index modal 1367 var indexTitleElement = document.querySelectorAll(".section-index-title"); 1368 indexTitleElement.forEach((elem) => { 1369 elem.addEventListener('click', (e) => { 1370 var panel = elem.nextElementSibling; 1371 if (panel.classList.contains('active')) { 1372 //collapse 1373 panel.classList.remove('active'); 1374 elem.classList.remove('active'); 1375 elem.firstElementChild.nextElementSibling.classList.remove('active'); 1376 } 1377 else { 1378 //expand 1379 var activeElements = Array.from(panel.parentElement.parentElement.getElementsByClassName("active")); 1380 activeElements.forEach((elem) => { 1381 elem.classList.remove('active'); 1382 }); 1383 panel.classList.add('active'); 1384 elem.classList.add('active'); 1385 elem.firstElementChild.nextElementSibling.classList.add('active'); 1386 1387 } 1388 }); 1389 }); 1390 1391 //open index modal on code content page 1392 $('.codeclause-index__btn').on("click", function (e) { 1393 $("#code-index-popup").parent().css({ position: "fixed" }); 1394 $("#code-index-popup").dialog("open"); 1395 $("#code-index-popup").dialog('widget').position({ my: "center", at: "center", of: window }); 1396 $(".ui-dialog-titlebar").hide(); 1397 $(".ui-dialog-titlebar-close").remove(); 1398 $(".ui-widget-overlay").css("background", "#000").css("opacity", "0.7"); 1399 }); 1400 1401 //open index modal on clause page 1402 $('.index-btn').on("click", function (e) { 1403 $("#code-index-popup").parent().css({ position: "fixed" }); 1404 $("#code-index-popup").dialog("open"); 1405 1406 if (document.documentElement.clientWidth < 767) {//for mobile 1407 $("#code-index-popup").dialog('widget').position({ my: "center", at: "center", of: window }); 1408 document.getElementById("code-index-popup").style.marginRight = "0px"; 1409 } 1410 else { // above mobile 1411 $("#code-index-popup").dialog('widget').position({ my: "right", at: "right", of: window }); 1412 document.getElementById("code-index-popup").style.marginRight = "100px"; 1413 } 1414 1415 $(".ui-dialog-titlebar").hide(); 1416 $(".ui-dialog-titlebar-close").remove(); 1417 $(".ui-widget-overlay").css("background", "#000").css("opacity", "0.7"); 1418 }); 1419}); 1420
1421var stickyNavScrollTimer; 1422window.onscroll = function () { 1423 clearTimeout(stickyNavScrollTimer); 1424 stickyNavScrollTimer = setTimeout(stickToTop, 10); // A timeout has been added which fires the scroll method after 10ms (instead of continuously firing it) which will lead to performance improvement 1425}; 1426 1427 1428 1429function stickToTop() { 1430 var headerBig = document.getElementById("stickyHeaderBig"); 1431 if(headerBig) 1432 { 1433 var sticky = headerBig.offsetTop; 1434 var bottombtns = document.querySelectorAll(".bottom-btns a"); 1435 var clauseIntro = document.querySelector(".heading-enhance h2"); 1436 1437 var subclauseNav = document.getElementById("subclause-enhancednav"); 1438 var stickyIndex = subclauseNav.offsetTop; 1439 1440 if (window.pageYOffset > sticky) { //stick to top 1441 1442 bottombtns.forEach((elem) => { 1443 if (elem.classList.contains('btn-toTop')) { 1444 elem.style.display = 'block'; 1445 } 1446 else { 1447 elem.style.display = 'none'; 1448 } 1449 }); 1450 clauseIntro.style.display = 'none'; 1451 headerBig.classList.add("sticky"); 1452 1453 } else { //do not stick to top 1454 1455 bottombtns.forEach((elem) => { 1456 if (elem.classList.contains('btn-toTop')) { 1457 elem.style.display = 'none'; 1458 } 1459 else { 1460 elem.style.display = 'block'; 1461 } 1462 }); 1463 clauseIntro.style.display = 'block'; 1464 headerBig.classList.remove("sticky"); 1465 } 1466 1467 stickyIndex = subclauseNav.offsetTop; 1468 var clauseIndexBtn = document.getElementById("clause-index"); 1469 if (window.pageYOffset > stickyIndex) { //stick to top 1470 if (document.documentElement.clientWidth > 767) { 1471 1472 clauseIndexBtn.classList.add("stickyIndexBtn"); 1473 clauseIndexBtn.style.top = document.querySelector('#stickyHeaderBig').offsetHeight + "px"; 1474 1475 } 1476 else { 1477 clauseIndexBtn.style.top = "initial"; 1478 } 1479 } 1480 else 1481 { 1482 //do not stick to top 1483 if (document.documentElement.clientWidth > 767) { 1484 1485 clauseIndexBtn.classList.remove("stickyIndexBtn"); 1486 clauseIndexBtn.style.top = "initial"; 1487 } 1488 else { 1489 clauseIndexBtn.style.top = "initial"; 1490 } 1491 } 1492 } 1493} 1494 1495function onKeyDownPressed(event){ 1496 if (event.key && event.key.toLowerCase() === "escape") { 1497 //If escape key is pressed, then close all the navigation items 1498 closeAllNavigationItems(); 1499 } 1500} 1501//endblock - Interactive Code Enhancements
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.