PageSourceSearch

https://www.letstalkaboutit.nhs.uk/application/themes/custom/js/scripts.js?_=1

js letstalkaboutit.nhs.uk collected 2026-10-02 12:25:08 UTC 28,082 bytes, 711 lines download raw bytes

1(function ($) {
2    jQuery.extend(jQuery.expr[':'], {
3        focusable: function (el, index, selector) {
4            var $element = $(el);
5            return $element.is(':input:enabled, a[href], area[href], object, [tabindex]') && !$element.is(':hidden');
6        }
7    });
8
9    function focusOnElement($element) {
10        if (!$element.length) {
11            return;
12        }
13        if (!$element.is(':focusable')) {
14            // add tabindex to make focusable and remove again
15            $element.attr('tabindex', -1).on('blur focusout', function () {
16                $(this).removeAttr('tabindex');
17            });
18        }
19        $element.focus();
20    }
21
22    $(document).ready(function () {
23        // if there is a '#' in the URL (someone linking directly to a page with an anchor)
24        if (document.location.hash) {
25            focusOnElement($(document.location.hash));
26        }
27
28        // if the hash has been changed (activation of an in-page link)
29        $(window).bind('hashchange', function () {
30            var hash = '#' + window.location.hash.replace(/^#/, '');
31            focusOnElement($(hash));
32        });
33    });
34})(jQuery);
35
36$(document).ready(function() {
37    $('.ccm-block-share-this-page .print, [href="javascript:window.print();"]').click(function(){
38        window.print();
39        return false;
40    });
41
42    // Header - mobile tool buttons
43    var buttonsWrapper = $('.header .mobile-buttons');
44    var buttons = buttonsWrapper.find('.header-tool-button');
45    var tools = $('.header .header-mobile-tool');
46
47    var searchToggle = $('#search-toggle');
48    var navToggle = $('#nav-toggle');
49    var navWrapper = $('.header .navigation ul.nav.mega');
50    var closeButton = $('.header .header-mobile-tool button.close');
51
52    var searchInput = $('.header .header-mobile-tool .search-form-wrapper input[type="text"]');
53    var searchElements = $('.header .header-mobile-tool .search-form-wrapper input[type="text"], .header .header-mobile-tool .search-form-wrapper button, .header .header-mobile-tool button.close');
54
55    var mobileNav = 991;
56
57    if(mobileNav > window.innerWidth) {
58        // Hide search elements on mobile until opened
59        searchElements.attr('tabindex', '-1').attr('aria-hidden', 'true');
60    }
61    
62    // Hide search elements on mobile until opened but on resize
63    window.addEventListener('resize', function() {
64        if(mobileNav > window.innerWidth) {
65           searchElements.attr('tabindex', '-1').attr('aria-hidden', 'true');
66
67        } else {
68            searchElements.attr('tabindex', '0').attr('aria-hidden', 'false');
69        }
70    });
71
72    buttonsWrapper.on('click', '.header-tool-button', function() {
73        if($(this).attr('aria-expanded') === 'false') {
74            // Close nav
75            navWrapper.css('margin-left', '0');
76            navWrapper.find('ul.sub-menu').hide();
77            navToggle.attr('aria-expanded', 'false');
78            $('.ccm-page').removeClass('nav-open');
79
80            $(this).attr('aria-expanded', 'true');
81
82            var activeTool = $('#' + $(this).attr('data-for'));
83            activeTool.addClass('active');
84            searchElements.attr('tabindex', '0').attr('aria-hidden', 'false');
85            
86            var focusTool = activeTool.find('.' + $(this).attr('data-focus'));
87            if(focusTool.length > 0) {
88                focusTool[0].focus();
89            }
90
91        } else if($(this).attr('aria-expanded') === 'true') {
92            buttons.attr('aria-expanded', 'false');
93            tools.removeClass('active');
94            searchElements.attr('tabindex', '-1').attr('aria-hidden', 'true');
95        }
96    });
97    
98    // Mobile toolbar close button
99    closeButton.on('click', function() {
100        if($(this).attr('id') === 'search-close') {
101            searchToggle.focus();
102        }
103
104        buttons.attr('aria-expanded', 'false');
105        tools.removeClass('active');
106        searchElements.attr('tabindex', '-1').attr('aria-hidden', 'true');
107
108        var id = $(this).closest('.header-mobile-tool').attr('id');
109        buttonsWrapper.find("button[data-for=" + id + "]").focus();
110    });
111
112    // Tabbing past the open mobile toolbar close button (press the close button and redirect focus)
113    closeButton.keydown(function(e) {
114        if(!e.shiftKey && e.keyCode == 9) {
115            e.preventDefault();
116            $(this).click();
117        }
118    });
119
120    // Tabbing back from an open mobile toolbar element (takes you back to the toggle button)
121    searchInput.keydown(function(e) {
122        if(mobileNav > window.innerWidth && (e.shiftKey && e.keyCode == 9)) {
123            e.preventDefault();
124            searchToggle.focus();
125        }
126    });
127
128    // Tabbing from an open search toggle (takes you back into the mobile element)
129    searchToggle.keydown(function(e) {
130        if(mobileNav > window.innerWidth && (!e.shiftKey && e.keyCode == 9) && $(this).attr('aria-expanded') === 'true') {
131            e.preventDefault();
132            searchInput.focus();
133        }
134    });
135
136    // Close mobile nav when click outside
137    $(document).on('click', function () {
138        // Close nav
139        navWrapper.css('margin-left', '0');
140        navWrapper.find('ul.sub-menu').hide();
141        $('#nav-toggle').attr('aria-expanded', 'false');
142        $('.ccm-page').removeClass('nav-open');
143
144        var activeTool = $('#' + $(this).attr('data-for'));
145        activeTool.addClass('active');
146        searchElements.attr('tabindex', '0').attr('aria-hidden', 'false');
147        
148        var focusTool = activeTool.find('.' + $(this).attr('data-focus'));
149        if(focusTool.length > 0) {
150            focusTool[0].focus();
151        }
152    });
153    $('.navigation, .header .mobile-buttons').on('click', function (event) {
154        event.stopPropagation();
155    });
156
157	// Responsive tables
158	var tables = $('.content-block table, .single-accordion table, .accordion table, .document-library table');
159	tables.each(function() {
160		var table = $(this);
161		table.wrap('<div class="table-wrapper"></div>');
162	});
163
164    // Anchor smooth scroll
165    var desktopView = 992;
166    var root = $('html, body');
167    $(document).on('click', 'html:not(.ccm-edit-mode) .ccm-page a[href^="#"]', function() {
168        var href = $.attr(this, 'href');
169        if (href != '#'){
170            var offset = $(href).offset();
171            if (href.match(/^#.+$/) && typeof offset === 'object') {
172                var c5Toolbar = $('html.ccm-toolbar-visible').length ? 48 : 0;
173                var headerTop = window.innerWidth < desktopView ? 44 : 0;
174                root.animate({
175                    scrollTop: offset.top - c5Toolbar - headerTop
176                }, 500);
177                window.location.hash = href;
178                $(href).focus();
179                return false;
180            }
181        }
182    });
183
184    let consentStatus = Cookies.get('cookieconsent_status');
185
186    // Add disclaimer to videos, maps and HTML embeds
187    $('.cke-iframe-wrapper, .video-embed .video, .google-map .map-wrapper, .html-block .iframe-wrapper').each(function() {
188        // Figure out which type of embed this is
189        let blockWrapper = $(this).parent();
190        if (blockWrapper.is('figure')) {
191            blockWrapper = blockWrapper.parent();
192        }
193        const wrapperClasses = blockWrapper.attr('class');
194
195        // Give the type of embed a name
196        let name = 'content';
197        if (wrapperClasses.indexOf('youtube') !== -1) {
198            name = 'Youtube video';
199        } else if (wrapperClasses.indexOf('vimeo') !== -1) {
200            name = 'Vimeo video';
201        } else if (wrapperClasses.indexOf('google-map') !== -1) {
202            name = 'Google Map';
203        }
204
205        // Get the cookies link
206        let cookiesLink = document.getElementById('site').getAttribute('data-cookie');
207        if (!cookiesLink || cookiesLink.length == 0) {
208            cookiesLink = '/cookies';
209        }
210
211        // Add disclaimer (detect cookie consent early and output different versions to avoid JS loading problems)
212        if (consentStatus === 'allow' || consentStatus === true) {
213            var disclaimerHTML = '<div class="disclaimer hide" aria-hidden="true">' +
214                '<div class="disclaimer-wrapper">' +
215                    '<p>Before we can show you this ' + name + ' we need your consent to serve additional third-party cookies.</p>' +
216                    '<div class="disclaimer-links">' +
217                        '<p>' +
218                            '<a href="' + cookiesLink + '#main" tabindex="-1" aria-hidden="true">Read about our cookies</a>' +
219                        '</p>' +
220                        '<button class="button-link" tabindex="-1" aria-hidden="true">Accept additional cookies</button>' +
221                    '</div>' +
222                '</div>' +
223            '</div>';
224        } else {
225            var disclaimerHTML = '<div class="disclaimer">' +
226                '<div class="disclaimer-wrapper">' +
227                    '<p>Before we can show you this ' + name + ' we need your consent to serve additional third-party cookies.</p>' +
228                    '<div class="disclaimer-links">' +
229                        '<p>' +
230                            '<a href="' + cookiesLink + '#main" aria-hidden="true">Read about our cookies</a>' +
231                        '</p>' +
232                        '<button class="button-link" aria-hidden="true">Accept additional cookies</button>' +
233                    '</div>' +
234                '</div>' +
235            '</div>';
236        }
237
238        $(this).prepend(disclaimerHTML);
239    });
240
241    // Disclaimer notice for YouTube, Vimeo and Google Maps
242    $('.disclaimer button.button-link').on('click', function() {
243        // Hide the cookie bar, in case it wasn't already
244        $('.cc-window').css('display', 'none').addClass('cc-invisible');
245        $('.cc-revoke').css('display', 'block');
246
247        // Allow cookies
248        Cookies.set('cookieconsent_status', 'allow');
249        updateCookies('allow');
250    });
251});
252
253function googleTranslateElementInit() {
254    new google.translate.TranslateElement({pageLanguage: 'en'}, 'google_translate_element');
255}
256
257// Auto detect the SLD for cookies
258let secondLevelDomain;
259function getSecondLevelDomain() {
260    if (typeof secondLevelDomain !== 'undefined') {
261        return secondLevelDomain;
262    } else {
263        let domain = document.domain,
264        domainSplit = domain.split('.'),
265        cookieTest = 'ct=' + Date.now();
266
267        // Start at the TLD and work its way down the domain until a cookie can be added
268        for (let i = domainSplit.length - 1; i >= 0; i--) {
269            domain = domainSplit.slice(i).join('.');
270            document.cookie = cookieTest + ';domain=' + domain + ';';
271            if (document.cookie.indexOf(cookieTest) > -1) {
272                // Remove the test cookie
273                document.cookie = cookieTest.split('=')[0] + '=;domain=.' + domain + ';expires=Thu, 01 Jan 1970 00:00:01 GMT;';
274                secondLevelDomain = domain;
275                return domain;
276            }
277        }
278    }
279}
280
281function updateCookies(status) {    
282    let analyticsTag = document.getElementById('site').getAttribute('data-gtag');
283    if (status === 'allow' || status === true) {
284        // Hide the disclaimer on all blocks
285        $('.disclaimer').addClass('hide').attr('aria-hidden', 'true');
286        $('.disclaimer button, .disclaimer a').attr('aria-hidden', 'true').attr('tabindex', '-1');
287
288        // Show the video block button to screen readers/keyboard
289        $('.video-embed .video button.video-btn').attr('aria-hidden', 'false').attr('tabindex', '0');
290
291        // Load iframes
292        const iframes = document.getElementsByTagName('iframe');
293        for (let i = 0; i < iframes.length; i++) {
294            if (iframes[i].getAttribute('data-src') && !iframes[i].getAttribute('src')) {
295                iframes[i].setAttribute('src', iframes[i].getAttribute('data-src'));
296            }
297        }
298        var gaScriptElement = document.getElementById('ga-script');
299        if (typeof gaScriptElement == 'undefined' ||  !gaScriptElement){
300            $('body').append('<script id="ga-script" async src="https://www.googletagmanager.com/gtag/js?id=' + analyticsTag + '"></script>');
301            window.dataLayer = window.dataLayer || [];
302            function gtag(){dataLayer.push(arguments);}
303            gtag('js', new Date());
304            gtag('config', analyticsTag);
305        }
306    } else if (status === 'deny' || status === false) {
307        // Show the disclaimer on all blocks
308        $('.disclaimer').removeClass('hide').attr('aria-hidden', 'false');
309        $('.disclaimer button, .disclaimer a').attr('aria-hidden', 'false').attr('tabindex', '0');
310        
311        // Hide the video block button from screen readers/keyboard
312        $('.video-embed .video button.video-btn').attr('aria-hidden', 'true').attr('tabindex', '-1');
313
314        // Block iframes by removing src
315        const iframes = document.getElementsByTagName('iframe');
316        for (let i = 0; i < iframes.length; i++) {
317            iframes[i].removeAttribute('src');
318        }
319
320        // Some cookies (ours, pretty much) are easy to get rid of - put those here
321        const generalCookies = [
322        ];
323
324        // Remove them
325        for (let i = 0; i < generalCookies.length; i++) {
326            if (Cookies.get(generalCookies[i])) {
327                Cookies.remove(generalCookies[i], {path: '/'});
328            }
329        }
330
331        // Other cookies (Google ones) attach themselves to the second level of the domain, so removal needs to be more specific
332        const sld = getSecondLevelDomain();
333        if (typeof sld == 'string' && sld.length) {
334            let sldCookies = [
335                '_ga',
336                '_gid',
337                '_gat',
338                '__utma',
339                '__utmb',
340                '__utmc',
341                '__utmz',
342                // '_gat_gtag_UA_G-0T9HQKQ881', // For universal analytics, replace with ID and delete below for GA4
343                // '_ga_G-0T9HQKQ881', // For GA4, replace with ID and delete above for universal analytics
344                '_ga_ESDEGT9P52', // For GA4, replace with ID and delete above for universal analytics
345            ];
346            
347            if (typeof analyticsTag !== 'undefined' && analyticsTag) {
348                 sldCookies.push(analyticsTag.replace('G-','_ga_' ));
349            }
350
351            // Remove them
352            for (let i = 0; i < sldCookies.length; i++) {
353                if (Cookies.get(sldCookies[i])) {
354                    Cookies.remove(sldCookies[i], {path: '', domain: sld});
355                }
356            }
357        }
358
359        // Google Maps
360        Cookies.remove('CONSENT', {path: '/', domain: '.google.com'});
361
362        // YouTube No Cookie
363        Cookies.remove('CONSENT', {path: '/', domain: '.youtube-nocookie.com'});
364
365        // Vimeo
366        Cookies.remove('__cf_bm', {path: '/', domain: '.vimeo.com'});
367    }
368}
369
370$(window).on('load', function() {
371    // Cookie bar
372    const link = document.getElementById('site').getAttribute('data-cookie');
373    if (link && link.length > 0 && typeof cookieconsent == 'object') {
374        window.cookieconsent.initialise({
375            'palette': {
376                'popup': {
377                    'background': '#E8EDEE',
378                    'text': '#231F20',
379                    'link': '#005eb8'
380                },
381                'button': {
382                    'background': '#005EB8',
383                    'text': '#FFFFFF',
384                    'hover': '#003087'
385                }
386            },
387            'type': 'opt-in',
388            'revokeBtn': '<button type="button" class="cc-btn cc-revoke" id="cc-revoke" tabindex="0" aria-expanded="false">Cookie options</button>',
389            'content': {
390                'link': 'Learn more about our cookies',
391                'href': link + '#main',
392                'target': '_self',
393                'message': 'We use some cookies necessary to making this website work. We also use additional cookies, such as those to record website analytics, which you can deny the use of. If you do not accept additional cookies, some third-party content may not load.',
394            },
395            'elements': {
396                'deny': '<button type="button" tabindex="0" class="cc-btn cc-deny">Deny additional cookies<span class="visually-hidden"> (and dismiss cookie message)</span></button>',
397                'allow': '<button type="button" tabindex="0" class="cc-btn cc-allow">Accept additional cookies<span class="visually-hidden"> (and dismiss cookie message)</span></button>',
398            },
399            onStatusChange: function(status) {
400                updateCookies(status);
401                cookieconsent.currentStatus = status;
402            },
403        });
404        if (window.cookieconsent.hasInitialised) {
405            const cookieConsentStatus = Cookies.get('cookieconsent_status');
406            updateCookies(cookieConsentStatus);
407            cookieconsent.currentStatus = cookieConsentStatus;
408        }
409        // Jump to top when cookie options button is clicked
410        var cookieOptions = document.getElementById('cc-revoke');
411        cookieOptions.addEventListener('click', () => {
412            document.documentElement.scrollTop = 0;    
413        })
414    } else {
415        const cookieConsentStatus = Cookies.get('cookieconsent_status');
416        updateCookies(cookieConsentStatus);
417    }
418});
419
420// Fixed position header buttons when scrolled away from the top of the page
421$(document).ready(function() {
422    var header_buttons_wrapper = $('.header-main__leave-button');
423    var mobile_header_buttons_wrapper = $('.header-main__mobile-leave-button');
424    var header_main = $('.header-main');
425
426    if ($(window).scrollTop() > header_main.offset().top) {
427        header_buttons_wrapper.addClass('header-main__leave-button--fixed');
428        mobile_header_buttons_wrapper.addClass('header-main__mobile-leave-button--fixed');
429    }
430
431    $(window).on('scroll', function() {
432        if ($(window).scrollTop() > header_main.offset().top) {
433            header_buttons_wrapper.addClass('header-main__leave-button--fixed');
434            mobile_header_buttons_wrapper.addClass('header-main__mobile-leave-button--fixed');
435        } else {
436            header_buttons_wrapper.removeClass('header-main__leave-button--fixed');
437            mobile_header_buttons_wrapper.removeClass('header-main__mobile-leave-button--fixed');
438        }
439    });
440});
441
442// Internal page: "You might also be interested in" carousel
443$(document).ready(function() {
444    // Initialise the carousel
445    if ($.fn.owlCarousel) {
446        var carousel = $('.main__sitewide-list__items .owl-carousel');
447
448        carousel.owlCarousel({
449            items: 2,
450            slideBy: 2,
451            autoplay: false,
452            dots: false,
453            nav: true,
454            navText: [
455                '<span class="visually-hidden">Previous slide</span>',
456                '<span class="visually-hidden">Next slide</span>'
457            ],
458            loop: false,
459            rewind: false,
460            mouseDrag: false,
461            margin: 30,
462
463            responsive: {
464                0: {
465                    items: 1,
466                    slideBy: 1,
467                },
468                768: {
469                    items: 2,
470                    slideBy: 2,
471                },
472                992: {
473                    items: 1,
474                    slideBy: 1,
475                },
476                1200: {
477                    items: 2,
478                    slideBy: 2,
479                },
480            },
481        });
482
483        // Match height on the slides
484        if ($.fn.matchHeight) {
485            $('.main__sitewide-list__heading, .main__sitewide-list__items').matchHeight();
486        }
487
488        // "Progress bar" UI
489        var slide_count = carousel.find('.main__sitewide-list__items__item').length;
490
491        if (slide_count > 1) {
492            $('.main__sitewide-list__wrapper').append('<div class="main__sitewide-list__progress-bar"><div class="main__sitewide-list__progress-bar__bar"></div></div>');
493            var progress_bar = $('.main__sitewide-list__progress-bar__bar');
494            if ($(window).outerWidth() >= 768) {
495                progress_bar.css({
496                    width: (1 / (slide_count - 1) * 100) + '%',
497                });
498            } else {
499                progress_bar.css({
500                    width: (1 / (slide_count) * 100) + '%',
501                });
502            }
503
504            carousel.on('changed.owl.carousel', function(event) {
505                if ($(window).outerWidth() >= 768) {
506                    progress_bar.css({
507                        width: ((event.item.index + 1) / (event.item.count - 1) * 100) + '%',
508                    });
509                } else {
510                    progress_bar.css({
511                        width: ((event.item.index + 1) / (event.item.count) * 100) + '%',
512                    });
513                }
514            });
515
516            // Show/hide the progress bar depending on if all slides are already visisble to the user (babsed on if the left/right buttons have been hidden)
517            if (carousel.find('.owl-nav').hasClass('disabled')) {
518                progress_bar.parent().hide();
519            } else {
520                progress_bar.parent().show();
521            }
522            carousel.on('resized.owl.carousel', function() {
523                if (carousel.find('.owl-nav').hasClass('disabled')) {
524                    progress_bar.parent().hide();
525                } else {
526                    progress_bar.parent().show();
527                }
528            });
529        }
530    }
531});
532
533// Home page: "Clinic notifications" carousel
534$(document).ready(function() {
535    // Initialise the carousel
536    if ($.fn.owlCarousel) {
537        var carousel = $('.main__home-clinic-notifications__items .owl-carousel');
538
539        carousel.owlCarousel({
540            items: 2,
541            slideBy: 2,
542            autoplay: false,
543            dots: false,
544            nav: true,
545            navText: [
546                '<span class="visually-hidden">Previous slide</span>',
547                '<span class="visually-hidden">Next slide</span>'
548            ],
549            loop: false,
550            rewind: false,
551            mouseDrag: false,
552            margin: 30,
553
554            responsive: {
555                0: {
556                    items: 1,
557                    slideBy: 1,
558                },
559                992: {
560                    items: 2,
561                    slideBy: 2,
562                },
563            },
564        });
565
566        // Match height on the slides
567        if ($.fn.matchHeight) {
568            $('.main__home-clinic-notifications__heading, .main__home-clinic-notifications__items').matchHeight();
569        }
570
571        // "Progress bar" UI
572        var slide_count = carousel.find('.main__home-clinic-notifications__items__item').length;
573
574        if (slide_count > 1) {
575            $('.main__home-clinic-notifications__wrapper').append('<div class="main__home-clinic-notifications__progress-bar"><div class="main__home-clinic-notifications__progress-bar__bar"></div></div>');
576            var progress_bar = $('.main__home-clinic-notifications__progress-bar__bar');
577            if ($(window).outerWidth() >= 768) {
578                progress_bar.css({
579                    width: (1 / (slide_count - 1) * 100) + '%',
580                });
581            } else {
582                progress_bar.css({
583                    width: (1 / (slide_count) * 100) + '%',
584                });
585            }
586
587            carousel.on('changed.owl.carousel', function(event) {
588                if ($(window).outerWidth() >= 768) {
589                    progress_bar.css({
590                        width: ((event.item.index + 1) / (event.item.count - 1) * 100) + '%',
591                    });
592                } else {
593                    progress_bar.css({
594                        width: ((event.item.index + 1) / (event.item.count) * 100) + '%',
595                    });
596                }
597            });
598
599            // Show/hide the progress bar depending on if all slides are already visisble to the user (babsed on if the left/right buttons have been hidden)
600            if (carousel.find('.owl-nav').hasClass('disabled')) {
601                progress_bar.parent().hide();
602            } else {
603                progress_bar.parent().show();
604            }
605            carousel.on('resized.owl.carousel', function() {
606                if (carousel.find('.owl-nav').hasClass('disabled')) {
607                    progress_bar.parent().hide();
608                } else {
609                    progress_bar.parent().show();
610                }
611            });
612        }
613    }
614});
615
616// Professionals page: "Clinic notifications" carousel
617$(document).ready(function() {
618    // Initialise the carousel
619    if ($.fn.owlCarousel) {
620        var carousel = $('.main__prof-home-important-updates__items .owl-carousel');
621
622        carousel.owlCarousel({
623            items: 2,
624            slideBy: 2,
625            autoplay: false,
626            dots: false,
627            nav: true,
628            navText: [
629                '<span class="visually-hidden">Previous slide</span>',
630                '<span class="visually-hidden">Next slide</span>'
631            ],
632            loop: false,
633            rewind: false,
634            mouseDrag: false,
635            margin: 30,
636
637            responsive: {
638                0: {
639                    items: 1,
640                    slideBy: 1,
641                },
642                992: {
643                    items: 2,
644                    slideBy: 2,
645                },
646            },
647        });
648
649        // Match height on the slides
650        if ($.fn.matchHeight) {
651            $('.main__prof-home-important-updates__heading, .main__prof-home-important-updates__items').matchHeight();
652        }
653
654        // "Progress bar" UI
655        var slide_count = carousel.find('.main__prof-home-important-updates__items__item').length;
656
657        if (slide_count > 1) {
658            $('.main__prof-home-important-updates__wrapper').append('<div class="main__prof-home-important-updates__progress-bar"><div class="main__prof-home-important-updates__progress-bar__bar"></div></div>');
659            var progress_bar = $('.main__prof-home-important-updates__progress-bar__bar');
660            if ($(window).outerWidth() >= 768) {
661                progress_bar.css({
662                    width: (1 / (slide_count - 1) * 100) + '%',
663                });
664            } else {
665                progress_bar.css({
666                    width: (1 / (slide_count) * 100) + '%',
667                });
668            }
669            
670            carousel.on('changed.owl.carousel', function(event) {
671                if ($(window).outerWidth() >= 768) {
672                    progress_bar.css({
673                        width: ((event.item.index + 1) / (event.item.count - 1) * 100) + '%',
674                    });
675                } else {
676                    progress_bar.css({
677                        width: ((event.item.index + 1) / (event.item.count) * 100) + '%',
678                    });
679                }
680            });
681
682            // Show/hide the progress bar depending on if all slides are already visisble to the user (babsed on if the left/right buttons have been hidden)
683            if (carousel.find('.owl-nav').hasClass('disabled')) {
684                progress_bar.parent().hide();
685            } else {
686                progress_bar.parent().show();
687            }
688            carousel.on('resized.owl.carousel', function() {
689                if (carousel.find('.owl-nav').hasClass('disabled')) {
690                    progress_bar.parent().hide();
691                } else {
692                    progress_bar.parent().show();
693                }
694            });
695        }
696    }
697});
698
699// Home page: match height on orange and blue content areas
700$(document).ready(function() {
701    if ($.fn.matchHeight) {
702        $('.no-edit-mode .main__home-two-column__column__content').matchHeight();
703    }
704});
705
706// Internal pages: sub/sibling page carousel box link match height
707$(document).ready(function() {
708    if ($.fn.matchHeight) {
709        $('.pl-box-link__link__title').matchHeight();
710    }
711});

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.