PageSourceSearch

https://www.bco.org.uk/wp-content/themes/aws-theme1/assets/js/script.js

js bco.org.uk collected 2026-10-02 04:43:49 UTC 19,864 bytes, 707 lines download raw bytes

1function myFunction(x) {
2  x.classList.toggle("change");
3}
4
5
6/***** Header js ******/
7jQuery(function() {
8    //caches a jQuery object containing the header element
9    var header = jQuery(".mainheader");
10    jQuery(window).scroll(function() {
11        var scroll = jQuery(window).scrollTop();
12
13        if (scroll >= 50) {
14            header.addClass("scrollHeader");
15        } else {
16            header.removeClass("scrollHeader");
17        }
18    });
19});
20
21
22// Show dropdown on hover
23if(jQuery(window).width() >= 768) {
24    jQuery('.dropdown').mouseover(function () {
25        if(jQuery('.navbar-toggler').is(':hidden')) {
26            jQuery(this).addClass('show').attr('aria-expanded', 'true');
27            jQuery(this).find('.dropdown-menu').addClass('show');
28        }
29    }).mouseout(function () {
30        if(jQuery('.navbar-toggler').is(':hidden')) {
31            jQuery(this).removeClass('show').attr('aria-expanded', 'false');
32            jQuery(this).find('.dropdown-menu').removeClass('show');
33        }
34    });
35}
36
37/*
38jQuery('.header-main--nav .dropdown_opner').on('click', function(e) {
39  jQuery(this).toggleClass("open"); //you can list several class names 
40  jQuery(this).closest("li").toggleClass("menu_open"); //you can list several class names 
41  jQuery(this).closest("li").find("ul").toggleClass("submenu_open"); //you can list several class names 
42  jQuery(this).closest("li").find("ul.dropdown-menu").slideToggle();
43  e.preventDefault();
44});
45
46jQuery('.header-main--nav .sub_dropdown_opner').on('click', function(e) {
47  jQuery(this).toggleClass("open"); //you can list several class names 
48  jQuery(this).closest("li").toggleClass("menu_open"); //you can list several class names 
49  jQuery(this).closest("li").find("ul").toggleClass("submenu_open"); //you can list several class names 
50  jQuery(this).closest("li").find("ul.dropdown-submenu").slideToggle();
51  e.preventDefault();
52});
53*/
54
55// Go to the parent link on click
56jQuery('.dropdown > a').click(function(){
57    location.href = this.href;
58});
59
60//WP ajax search result issue [ Fixed ]
61jQuery("input#keyword").keyup(function() {
62    if (jQuery(this).val().length > 2) {
63      jQuery("#datafetch").show();
64    } else {
65      jQuery("#datafetch").hide();
66    }
67  });
68
69/*
70  jQuery(document).on('click', '#searchAgain', function(){ 
71        jQuery(".search-dropdown--search-input-text-submit").trigger("click");
72  });
73*/
74function clearInput(){
75    var getValue= document.getElementById("keyword");
76      if (getValue.value !="") {
77          getValue.value = "";
78      }
79}
80
81setTimeout(() => {
82    //swiper.autoplay.start();
83}, 5000);
84
85const swiper = new Swiper('.home-hero--carousel', {
86    direction: 'horizontal',
87    loop: true,
88    watchOverflow: true,
89    speed:1500,
90    autoplay: {
91        delay: 10000,
92        disableOnInteraction: false,
93        pauseOnMouseEnter: false,
94      },
95    pagination: {
96      el: '.swiper-pagination',
97      clickable: true,
98    },
99    on: {
100      beforeInit() {
101        const slides = this.el.querySelectorAll('.swiper-slide');
102  
103        if (slides) {
104          this.params.loop = slides.length > 1;
105          this.params.autoplay.enabled = slides.length > 1;
106        }
107      },
108    },
109  });
110//  swiper.autoplay.stop();	  
111
112
113/******** carousel-with-text *****/	  
114const swiper2 = new Swiper('.carousel-text--carousel', {
115    direction: 'horizontal',
116    loop: true,
117    speed:1500,
118    autoplay: {
119      delay: 4000,
120      disableOnInteraction: false,
121      pauseOnMouseEnter: false,
122    },
123    pagination: {
124      el: '.swiper-pagination',
125      clickable: true,
126    },
127    on: {
128      beforeInit() {
129        const slides = this.el.querySelectorAll('.swiper-slide');
130  
131        if (slides) {
132          this.params.loop = slides.length > 1;
133        }
134      },
135    },
136  });	  
137
138  /******** carousel-highlights-widget *****/	
139  const highlightsCarousel = new Swiper('.highlights--carousel', {
140    direction: 'horizontal',
141    loop: true,
142    slidesPerView: 1,
143    slidesPerGroup:1,
144    observer: true,
145    observeParents: true,
146    spaceBetween: 15,
147    speed: 5000,
148    autoplay: {
149      delay: 3000,
150      waitForTransition: true,
151      disableOnInteraction: true,
152    },
153    breakpoints: {
154        576: {
155            slidesPerView: 2,
156            slidesPerGroup:2,
157            spaceBetween: 30,
158        },
159        768: {
160            slidesPerView: 2,
161            slidesPerGroup:2,
162            spaceBetween: 20,
163        },
164        1200: {
165            slidesPerView: 3,
166            slidesPerGroup:3,
167            spaceBetween: 40,
168        },       
169    },
170    navigation: {
171      nextEl: ".highlights-carousel-next",
172      prevEl: ".highlights-carousel-prev",
173  },
174    pagination: {
175        el: '.highlights--pagination',
176        clickable: true,
177    },
178  });
179
180   /******** carousel-Sponsor-logo-widget *****/	
181   setTimeout(() => {
182    //console.log("hello");
183   // swiper3.autoplay.start();
184  }, 5000);
185
186   const swiper3 = new Swiper('.sponsor-logo-carousel--carousel', {
187    direction: 'horizontal',
188    loop: true,
189    speed:1000,
190    autoplay: {
191        delay: 600,
192        disableOnInteraction: false,
193        pauseOnMouseEnter: true,
194      },
195    autoplay: true,
196    slidesPerView: 1,
197    spaceBetween: 15,
198    breakpoints: {
199        576: {
200            slidesPerView: 2,
201            spaceBetween: 30,
202        },
203        768: {
204            slidesPerView: 3,
205            spaceBetween: 75,
206        },
207        1200: {
208            slidesPerView: 5,
209            spaceBetween: 30,
210        },
211    },
212    navigation: {
213        nextEl: ".sponsor-logo-carousel--carousel-next",
214        prevEl: ".sponsor-logo-carousel--carousel-prev",
215    },
216  });
217
218  //swiper3.autoplay.stop();
219
220
221  
222  /*********/
223  const fiveCol = new Swiper('.five-col-img-carousel', {
224    direction: 'horizontal',
225    loop: false,
226    slidesPerView: 1,
227    spaceBetween: 64,
228    // pagination: {
229    //       el: ".five-col-img-carousel-pagination",
230    //       clickable: true,
231    //     },
232    navigation: {
233          nextEl: ".five-col-img-carousel-next",
234          prevEl: ".five-col-img-carousel-prev",
235        },
236    breakpoints: {
237          0:{
238            slidesPerView:1,
239    spaceBetween: 16,
240          },
241          576:{
242              slidesPerView:2,
243    spaceBetween: 16,
244          },
245          768:{
246              slidesPerView:3,
247              spaceBetween: 16,
248          },
249          1024:{
250              slidesPerView:4,
251              spaceBetween: 16,
252          },
253          1366:{
254              slidesPerView:4,
255          },
256          1920:{
257              slidesPerView:5,
258          },
259        },
260  
261    
262  });
263
264  /***********/
265  const publications_library = new Swiper('.publication-library-carousel', {
266    direction: 'horizontal',
267    loop: false,
268    slidesPerView: 1,
269    spaceBetween: 64,
270    // pagination: {
271    //       el: ".publication-library-carousel-pagination",
272    //       clickable: true,
273    //     },
274    navigation: {
275          nextEl: ".publication-library-carousel-next",
276          prevEl: ".publication-library-carousel-prev",
277        },
278    breakpoints: {
279          0:{
280            slidesPerView:1,
281    spaceBetween: 16,
282          },
283          576:{
284              slidesPerView:2,
285    spaceBetween: 16,
286          },
287          768:{
288              slidesPerView:3,
289              spaceBetween: 16,
290          },
291          1024:{
292              slidesPerView:4,
293              spaceBetween: 16,
294          },
295          1366:{
296              slidesPerView:4,
297          },
298          1920:{
299              slidesPerView:5,
300          },
301        },
302  
303    
304  });
305
306/**** Awards Winners *****/
307var awardsWinner = new Swiper('.awards-winners-carousel', {
308    direction: 'horizontal',
309    loop: true,
310    slidesPerView: 4,
311    spaceBetween: 64,
312    observer: true,
313   observeParents: true,
314   watchOverflow: true,
315   //slidesPerGroup: 4,
316  // autoplay: {
317  //   delay: 1200,
318  //   disableOnInteraction: false,
319  //   pauseOnMouseEnter: true,
320  // },
321    // pagination: {
322    //       el: ".awards-winners-carousel-pagination",
323    //       clickable: true,
324    //     },
325    navigation: {
326          nextEl: ".awards-winners-carousel-next",
327          prevEl: ".awards-winners-carousel-prev",
328        },
329    breakpoints: {
330          0:{
331            slidesPerView:1,
332            spaceBetween: 16,
333          },
334          576:{
335              slidesPerView:2,
336    spaceBetween: 16,
337          },
338          768:{
339              slidesPerView:3,
340              spaceBetween: 16,
341          },
342          1024:{
343              slidesPerView:4,
344              spaceBetween: 16,
345          },
346          1366:{
347              slidesPerView:4,
348          },
349          1920:{
350              slidesPerView:4,
351          },
352        },
353  
354    
355  });
356
357  jQuery('button[data-bs-toggle="tab"]').on('shown.bs.tab', function(e) {
358    //console.log("Tab Cliked");
359    var paneTarget = jQuery(e.target).attr('data-bs-target');
360    var $thePane = jQuery('.tab-pane' + paneTarget);
361    var paneIndex = $thePane.index();
362    if ($thePane.find('.swiper').length > 0 && 0 === $thePane.find('.swiper-slide-active').length) {
363        console.log(paneIndex);
364        awardsWinner[paneIndex].update();
365    }
366  });
367
368  /**** Awards Winners Project Image *****/
369var projectImages = new Swiper('.project-image-carousel', {
370    direction: 'horizontal',
371    loop: false,
372    slidesPerView: 1,
373    spaceBetween: 10,
374    observer: true,
375  observeParents: true,
376    navigation: {
377          nextEl: ".project-image-carousel-next",
378          prevEl: ".project-image-carousel-prev",
379        },
380    breakpoints: {
381          0:{
382            slidesPerView:1,
383          },
384          576:{
385              slidesPerView:1,
386          },
387          768:{
388              slidesPerView:1,
389          },
390          1024:{
391              slidesPerView:1,
392          },
393          1366:{
394              slidesPerView:1,
395          },
396          1920:{
397              slidesPerView:1,
398          },
399        },
400        on: {
401          beforeInit() {
402            const slides = this.el.querySelectorAll('.swiper-slide');
403      
404            if (slides) {
405              this.params.loop = slides.length > 1;
406            }
407          },
408        },
409    
410  });
411
412  /**** Latest Product carousel *****/
413var latestProducts = new Swiper('.latest-product-carousel', {
414  direction: 'horizontal',
415  loop: false,
416  slidesPerView: 1,
417  spaceBetween: 64,
418  // pagination: {
419  //       el: ".latest-product-pagination",
420  //       clickable: true,
421  //     },
422  navigation: {
423        nextEl: ".latest-product-carousel-next",
424        prevEl: ".latest-product-carousel-prev",
425      },
426  breakpoints: {
427        0:{
428          slidesPerView:1,
429  spaceBetween: 16,
430        },
431        576:{
432            slidesPerView:2,
433  spaceBetween: 16,
434        },
435        768:{
436            slidesPerView:3,
437            spaceBetween: 16,
438        },
439        1024:{
440            slidesPerView:4,
441            spaceBetween: 16,
442        },
443        1366:{
444            slidesPerView:4,
445        },
446        1920:{
447            slidesPerView:5,
448        },
449      },
450
451  
452});
453
454  // jQuery Ajax for feed Instagram Graph API
455if ( jQuery('#instagram-feed-footer').length != 0 ) {
456
457  var token = 'IGQVJWYzRTcnVBcmN2T0FZAYi1DdFQxWEdYU1lVRTdwQW5qdE9KNFprNVBpV2QzNjlyWXUteVJrQkw0RlNyT0c1Y2czdlZAra0syRkduQklBNXhvM0l6aTg5ZAEpiaEdoczFYY202NkNBYWlDWjRnTUhrSgZDZD';
458  var fields = 'id,media_type,media_url,thumbnail_url,timestamp,permalink,caption';
459  var limit = 6; // Set a number of display items
460
461  jQuery.ajax ( {
462      url: 'https://graph.instagram.com/me/media?fields='+ fields +'&access_token='+ ft_token +'&limit='+ ft_limit,
463      type: 'GET',
464      success: function( response ) {
465          for( var x in response.data ) {
466              var link = response.data[x]['permalink'],
467                  caption = response.data[x]['caption'],
468                  image = response.data[x]['media_url'],
469                  image_video = response.data[x]['thumbnail_url'],
470                  html = '';
471              if ( response.data[x]['media_type'] == 'VIDEO' ) {
472                      html += '<a class="ft-insta-link" href="' + link + '" rel="noopener" target="_blank">';
473                          html += '<img src="' + image_video + '" loading="lazy" alt="' + caption + '" class="insta-image" />';
474                      html += '</a>';
475              } else {
476                      html += '<a class="ft-insta-link" href="' + link + '" rel="noopener" target="_blank">';
477                          html += '<img src="' + image + '" loading="lazy" alt="' + caption + '" class="insta-image" />';
478                      html += '</a>';
479              }
480              jQuery('#instagram-feed-footer').append(html);
481          }
482      },
483      error: function(data) {
484          var html = '<div class="class-no-data">No Images Found</div>';
485          jQuery('#instagram-feed-footer').append(html);
486          }
487  });
488}
489
490
491/**** CF7 Password Field ******/
492jQuery("input.password").each(function() {
493    jQuery(this).attr("type", 'password');
494});
495
496/************/
497
498
499  jQuery(".awards-winners .award_item a.button--read-more").on("click", function() {
500    jQuery("div.award_item").removeClass("activeLnk");
501    jQuery("div[id=" + jQuery(this).attr("data-related") + "]").addClass("activeLnk");
502  });  
503
504  /***********/
505  var pageLink = window.location.href;
506var pageTitle = String(document.title).replace(/\&/g, '%26');
507
508      
509function tbs_click() { window.open(`https://twitter.com/intent/tweet?text=${pageTitle}&url=${pageLink}`,'sharer','toolbar=0,status=0,width=626,height=436');return false; }
510
511function lbs_click() { window.open(`https://www.linkedin.com/sharing/share-offsite/?url=${pageLink}`,'sharer','toolbar=0,status=0,width=626,height=436');return false; }
512
513function rbs_click() { window.open(`https://www.reddit.com/submit?url=${pageLink}`,'sharer','toolbar=0,status=0,width=626,height=436');return false; }
514
515function pbs_click() { window.open(`https://www.pinterest.com/pin/create/button/?&text=${pageTitle}&url=${pageLink}&description=${pageTitle}`,'sharer','toolbar=0,status=0,width=626,height=436');return false; }
516
517
518setTimeout(function(){
519  jQuery( ".fc-daygrid-body .fc-day .fc-event-start" ).each(function() { 
520    var value = jQuery(this).find('.fc-event-title').text();
521    // console.log(value);
522           //jQuery(this).css('cursor','pointer').attr('title', value);
523           jQuery(this).attr({title:value, 'data-bs-title':value, 'data-bs-toggle':'tooltip'});
524   });
525},5000); 
526
527setTimeout(function(){
528jQuery(document).ready(function () {
529  var usedNames = {};
530  $("[data-meta-key='region_memebership_contact_api'] select > option").each(function () {
531      if (usedNames[this.value]) {
532          $(this).remove();
533      } else {
534          usedNames[this.value] = this.text;
535      }
536  });
537});
538},1000); 
539
540jQuery(".awards-parent-tabs li.nav-item").on("click",function() {
541});
542
543jQuery(".awards-child-tabs-wrapper ul li").on("click",function() {
544});
545
546
547
548jQuery(".awards-parent-tabs li.nav-item button").on("click",function() {
549  var id = $(this).attr('id');
550  var text = id;
551  text = text.replace("tab-option", "collapse");
552  
553  if(jQuery("#"+text).find(".swiper-slide.award_item").length > 3 ){
554
555  }
556
557  jQuery('.swiper-button-prev.awards-winners-carousel-prev.swiper-button-lock.swiper-button-disabled').attr('class', 'swiper-button-prev awards-winners-carousel-prev');
558  jQuery('.swiper-button-next.awards-winners-carousel-next.swiper-button-lock.swiper-button-disabled').attr('class', 'swiper-button-next awards-winners-carousel-next');
559
560
561});
562
563
564
565jQuery('.awards-child-tabs-wrapper ul li button').click(function() { 
566  var id = $(this).attr('id');
567  var text = id;
568  text = text.replace("tab-category", "collapse");
569  if(jQuery("#"+text).find(".swiper-slide.award_item").length > 3 ){
570  }
571  jQuery('.swiper-button-prev.awards-winners-carousel-prev.swiper-button-lock.swiper-button-disabled').attr('class', 'swiper-button-prev awards-winners-carousel-prev');
572  jQuery('.swiper-button-next.awards-winners-carousel-next.swiper-button-lock.swiper-button-disabled').attr('class', 'swiper-button-next awards-winners-carousel-next');  
573
574
575  
576
577});
578
579
580const swiper4 = new Swiper('.testimonial-carousel--carousel', {
581  direction: 'horizontal',
582  loop: true,
583  autoplay: {
584    delay: 20000,
585    waitForTransition: true,
586    disableOnInteraction: true,
587  },
588  pagination: {
589    el: '.testimonial-carousel--carousel-pagination',
590    clickable: true,
591  },
592});
593 
594
595
596var url = 'https://'+window.location.hostname + window.location.pathname;
597var hash = url.substring(url.indexOf('#'));
598
599jQuery(".nav.tabs-primary").find("li").each(function(key, val) {
600    if (hash == jQuery(val).attr('id')) {
601        //console.log(val);
602        jQuery(val).click();
603
604    }
605    jQuery(val).click(function(ky, vl) {    
606        //location.hash = jQuery(this).attr('id'); 
607    //history.replaceState({}, '', url+'#'+jQuery(this).attr('id'));
608    //console.log(jQuery(this).attr('id'));
609
610      if(jQuery(this).attr('id') !== undefined){
611        history.replaceState({}, '', url+'#'+jQuery(this).attr('id'));
612      }
613
614    });
615});
616
617
618
619jQuery(document).ready(function($) {
620  $(document).on('click', '.updatecounter', function(e) {
621      var post_id = $(this).data('post-id');
622      $.ajax({
623          url: 'https://'+window.location.hostname+'/wp-admin/admin-ajax.php',
624          method: 'POST',
625          data: {
626              action: 'update_download_counter',
627              post_id: post_id
628          },
629          success: function(response) {
630              console.log('Success:', response);
631          },
632          error: function(error) {
633              console.error('Error:', error);
634          }
635      });
636  });
637});
638
639
640
641jQuery(document).ready(function ($) {
642
643    const $checkbox = $('.yesbehalf input[type="checkbox"]');
644    const $emailWrap = $('.behalf-email');
645    const $emailField = $('input[name="behalf_email"]');
646
647    // Hide initially
648    $emailWrap.hide();
649
650    function toggleBehalfEmail() {
651
652        if ($checkbox.is(':checked')) {
653
654            $emailWrap.slideDown();
655
656        } else {
657
658            $emailWrap.slideUp();
659            //$emailField.val('');
660            //$emailField.removeClass('wpcf7-not-valid');
661
662            //$('.behalf-email .wpcf7-not-valid-tip').remove();
663
664        }
665    }
666
667    toggleBehalfEmail();
668
669    $checkbox.on('change', function () {
670        toggleBehalfEmail();
671    });
672
673
674    // CF7 validation
675    // document.addEventListener('wpcf7submit', function (event) {
676
677    //     $('.behalf-email .wpcf7-not-valid-tip').remove();
678    //     $emailField.removeClass('wpcf7-not-valid');
679
680    //     if ($checkbox.is(':checked') && $emailField.val().trim() === '') {
681
682    //         event.preventDefault();
683
684    //         $emailField.addClass('wpcf7-not-valid');
685
686    //         $emailField.after(
687    //             '<span class="wpcf7-not-valid-tip">Email is required.</span>'
688    //         );
689
690    //         return false;
691    //     }
692
693    // }, true);
694
695});
696
697
698// Redirect after successful submit
699document.addEventListener('wpcf7mailsent', function (event) {
700
701    if (event.detail.contactFormId == 91037) {
702
703        window.location.href = '/membership-application-form/thank-you';
704
705    }
706
707}, false);

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.