PageSourceSearch

https://www.bco.org.uk/wp-content/themes/aws-theme1/widgets/search-list-content/js.js

js bco.org.uk collected 2026-10-02 04:44:02 UTC 3,108 bytes, 77 lines download raw bytes

1const customSelect = document.querySelector(".search-list-content-widget--custom-select");
2const selectBtn = document.querySelector(".search-list-content-widget--select-button");
3
4const selectedValue = document.querySelector(".search-list-content-widget--selected-value");
5const optionsList = document.querySelectorAll(".search-list-content-widget--select-dropdown li");
6
7// add click event to select button
8selectBtn.addEventListener("click", () => {
9  // add/remove active class on the container element
10  customSelect.classList.toggle("active");
11  // update the aria-expanded attribute based on the current state
12  selectBtn.setAttribute(
13    "aria-expanded",
14    selectBtn.getAttribute("aria-expanded") === "true" ? "false" : "true"
15  );
16});
17
18
19optionsList.forEach((option) => {
20  function handler(e) {
21    // Click Events
22    if (e.type === "click" && e.clientX !== 0 && e.clientY !== 0) {
23      selectedValue.textContent = this.children[1].textContent;
24      customSelect.classList.remove("active");
25    }
26    // Key Events
27    if (e.key === "Enter") {
28      selectedValue.textContent = this.textContent;
29      customSelect.classList.remove("active");
30    }
31  }
32
33  option.addEventListener("keyup", handler);
34  option.addEventListener("click", handler);
35});
36
37jQuery(document).ready(function(){
38  var check_value = jQuery('#search-list-content-widget--select-dropdown .search-opt:checked').val();
39  console.log(check_value);
40  jQuery('.searchbox_wrap .alm-filter--search').addClass('active').siblings('.searchbox_wrap .alm-filter--group').removeClass('active');
41
42  jQuery('#search-list-content-widget--select-dropdown input[type=radio].search-opt').change(function(){
43  if (this.value == "Keywords") {
44    console.log("Keywords");
45    jQuery('.searchbox_wrap .alm-filter--search').addClass('active').siblings('.searchbox_wrap .alm-filter--group').removeClass('active');
46  }else if (this.value == "Date") {
47    console.log("Date");
48    jQuery('.searchbox_wrap .alm-filter--day').addClass('active').siblings('.searchbox_wrap .alm-filter--group').removeClass('active');
49    jQuery('.searchbox_wrap .alm-filter--meta').addClass('active').siblings('.searchbox_wrap .alm-filter--group').removeClass('active');
50  }
51  else if (this.value == "Category") {
52    console.log("Category");
53    jQuery('.searchbox_wrap .alm-filter--category').addClass('active').siblings('.searchbox_wrap .alm-filter--group').removeClass('active');
54    jQuery('.searchbox_wrap .alm-filter--taxonomy').addClass('active').siblings('.searchbox_wrap .alm-filter--group').removeClass('active');
55  }
56  });
57  });
58/***** Reset ******/
59
60var buttonReset = document.querySelector('button#alm-filters-reset-button');
61
62jQuery('#search-list-content-widget--select-dropdown input[type=radio].search-opt').change(function(e){
63    jQuery( buttonReset ).trigger( "click" );
64});
65
66jQuery(window).on('load', function(){
67    // your logic here
68    jQuery( buttonReset ).trigger( "click" );
69});
70
71window.onbeforeunload = function (e) {
72  jQuery( buttonReset ).trigger( "click" );
73};
74
75window.onload = function (e) {
76  jQuery( buttonReset ).trigger( "click" );
77};

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.