PageSourceSearch

https://static.countrywidehealthcare.co.uk/version1790360708/front…/en_GB/Magento_Theme/js/header-topmenu.js

js countrywidehealthcare.co.uk collected 2026-10-04 20:49:37 UTC 2,258 bytes, 67 lines download raw bytes

1(function () {
2    'use strict';
3
4    function initNavMenu() {
5        return {
6            open: null,
7            openSub: null,
8
9            openItem() {
10                this.open = this.$el.dataset.navId;
11                this.openSub = null;
12            },
13            closeAll() {
14                this.open = null;
15                this.openSub = null;
16            },
17            openSubItem() {
18                this.openSub = this.$el.dataset.subId;
19            },
20            closeSubAll() {
21                this.openSub = null;
22            },
23            get isItemOpen() {
24                return this.open === this.$el.dataset.navId;
25            },
26            get isItemChevronClass() {
27                const el = this.$el.closest('[data-nav-id]');
28                return el && this.open === el.dataset.navId ? 'rotate-180' : '';
29            },
30            get isSubItemOpen() {
31                return this.openSub === this.$el.dataset.subId;
32            },
33            get showBudgetMinder() {
34                return Boolean(this.customer && this.customer.budgetMinderAllowed);
35            },
36        };
37    }
38
39    function applyActiveExtraNavLinks() {
40        const currentPath = (window.location.pathname || '').replace(/^\/+|\/+$/g, '');
41        document.querySelectorAll('[data-extra-nav-link="1"]').forEach((link) => {
42            const linkPath = (link.getAttribute('data-extra-nav-path') || '').replace(/^\/+|\/+$/g, '');
43            if (!linkPath) {
44                link.classList.remove('bg-primary/10');
45                return;
46            }
47
48            const isActive = currentPath === linkPath || currentPath.indexOf(linkPath + '/') === 0;
49            link.classList.toggle('bg-primary/10', isActive);
50        });
51    }
52
53    function registerNavMenuComponent() {
54        if (window.Alpine && typeof window.Alpine.data === 'function') {
55            window.Alpine.data('initNavMenu', initNavMenu);
56        }
57    }
58
59    registerNavMenuComponent();
60    window.addEventListener('alpine:init', registerNavMenuComponent, { once: true });
61
62    if (document.readyState === 'loading') {
63        document.addEventListener('DOMContentLoaded', applyActiveExtraNavLinks, { once: true });
64    } else {
65        applyActiveExtraNavLinks();
66    }
67})();

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.