PageSourceSearch

https://cheshiredentalcentre.co.uk/assets/js/cheshire-custom.js?v=1.29.0

js cheshiredentalcentre.co.uk collected 2026-10-05 21:59:49 UTC 4,678 bytes, 133 lines download raw bytes

1(function () {
2'use strict';
3function initExamCards() {
4var cards = document.querySelectorAll('.testing-item-card');
5function makeTabbable(card) {
6if (card.getAttribute('tabindex') !== '0') card.setAttribute('tabindex', '0');
7}
8Array.prototype.forEach.call(cards, function (card) {
9var titleEl = card.querySelector('.testing-card-title');
10var title = titleEl ? titleEl.textContent.replace(/\s+/g, ' ').trim() : 'Examination item';
11makeTabbable(card);
12card.setAttribute('role', 'button');
13card.setAttribute('aria-expanded', 'false');
14card.setAttribute('aria-label', title + ' — show what we check');
15new MutationObserver(function () {
16makeTabbable(card);
17}).observe(card, { attributes: true, attributeFilter: ['tabindex'] });
18function toggle() {
19var open = !card.classList.contains('cdc-open');
20card.classList.toggle('cdc-open', open);
21card.classList.toggle('cdc-closed', !open);
22card.setAttribute('aria-expanded', open ? 'true' : 'false');
23}
24card.addEventListener('click', toggle);
25card.addEventListener('keydown', function (e) {
26if (e.key === 'Enter' || e.key === ' ' || e.key === 'Spacebar') {
27e.preventDefault();
28toggle();
29}
30});
31card.addEventListener('mouseleave', function () {
32card.classList.remove('cdc-closed');
33});
34});
35window.addEventListener('load', function () {
36Array.prototype.forEach.call(cards, makeTabbable);
37window.setTimeout(function () {
38Array.prototype.forEach.call(cards, makeTabbable);
39}, 1200);
40});
41}
42function initMobileNavClose() {
43document.addEventListener('click', function (e) {
44var menuEl = document.querySelector('.navbar .w-nav-menu');
45if (!menuEl || !e.target || !e.target.closest) return;
46var link = e.target.closest('a');
47if (!link || !menuEl.contains(link)) return;
48var href = link.getAttribute('href') || '';
49if (href.charAt(0) !== '#' && href.indexOf('tel:') !== 0) return;
50var btn = document.querySelector('.navbar .menu-button');
51if (btn && btn.classList.contains('w--open')) {
52window.setTimeout(function () {
53if (!btn.classList.contains('w--open')) return;
54if (window.jQuery) { window.jQuery(btn).trigger('click'); }
55else { btn.click(); }
56}, 120);
57}
58}, true);
59}
60function initMobileTreatments() {
61var dd = document.querySelector('.nav-dropdown');
62if (!dd) return;
63var toggle = dd.querySelector('.nav-dropdown-toggle');
64if (!toggle) return;
65var mq = window.matchMedia('(max-width: 991px)');
66function closeGroups() {
67Array.prototype.forEach.call(dd.querySelectorAll('.cdc-mega-group[open]'), function (d) {
68d.open = false;
69});
70}
71function setOpen(open) {
72dd.classList.toggle('cdc-mega-open', open);
73toggle.setAttribute('aria-expanded', open ? 'true' : 'false');
74if (!open) closeGroups();
75}
76toggle.addEventListener('click', function (e) {
77if (!mq.matches) return;
78e.preventDefault();
79setOpen(!dd.classList.contains('cdc-mega-open'));
80});
81toggle.addEventListener('keydown', function (e) {
82if (!mq.matches) return;
83if (e.key === 'Enter' || e.key === ' ' || e.key === 'Spacebar') {
84e.preventDefault();
85setOpen(!dd.classList.contains('cdc-mega-open'));
86}
87});
88document.addEventListener('click', function (e) {
89if (!mq.matches || !dd.classList.contains('cdc-mega-open')) return;
90if (e.target && e.target.closest && e.target.closest('.nav-dropdown') === dd) return;
91setOpen(false);
92}, true);
93function onChange() { if (!mq.matches) setOpen(false); }
94if (mq.addEventListener) { mq.addEventListener('change', onChange); }
95else if (mq.addListener) { mq.addListener(onChange); }
96}
97var invisalignPopupStorageKey = 'cdcInvisalignPopupDismissed';
98function rememberInvisalignPopupDismissal() {
99try { window.sessionStorage.setItem(invisalignPopupStorageKey, '1'); }
100catch (storageError) {  }
101}
102function wasInvisalignPopupDismissed() {
103try { return window.sessionStorage.getItem(invisalignPopupStorageKey) === '1'; }
104catch (storageError) { return false; }
105}
106function initInvisalignPopup() {
107var popup = document.querySelector('[data-cdc-invisalign-popup]');
108if (!popup || typeof popup.showModal !== 'function' || wasInvisalignPopupDismissed()) return;
109function dismiss() {
110rememberInvisalignPopupDismissal();
111if (popup.open) popup.close();
112}
113Array.prototype.forEach.call(popup.querySelectorAll('[data-cdc-invisalign-dismiss]'), function (button) {
114button.addEventListener('click', dismiss);
115});
116popup.addEventListener('click', function (event) {
117if (event.target === popup) dismiss();
118});
119popup.addEventListener('cancel', rememberInvisalignPopupDismissal);
120window.setTimeout(function () { if (!popup.open) popup.showModal(); }, 1400);
121}
122function init() {
123initExamCards();
124initMobileNavClose();
125initMobileTreatments();
126initInvisalignPopup();
127}
128if (document.readyState === 'loading') {
129document.addEventListener('DOMContentLoaded', init);
130} else {
131init();
132}
133})();

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.