p:freeform –>p:freeform –>p:freeform –>p:freeform –>p:freeform –>
(function () {
try {
if (document.querySelector('script[type="application/ld+json"]') &&
Array.prototype.some.call(document.querySelectorAll('script[type="application/ld+json"]'), function (s) {
return /FAQPage/.test(s.textContent || '');
})) {
return;
} function txt(el) {
return (el && (el.innerText || el.textContent) || '').replace(/\s+/g, ' ').trim();
} function pushPair(out, seen, q, a) {
q = (q || '').replace(/\s+/g, ' ').trim();
a = (a || '').replace(/\s+/g, ' ').trim();
if (!q || !a || /Enter Address/i.test(q)) return;
if (seen[q]) return;
seen[q] = 1;
out.push({ q: q, a: a });
} var pairs = [];
var seen = Object.create(null); // Elementor accordion
document.querySelectorAll('.elementor-accordion-item').forEach(function (item) {
var qel = item.querySelector('.elementor-accordion-title, .elementor-tab-title');
var ael = item.querySelector('.elementor-tab-content');
pushPair(pairs, seen, txt(qel), txt(ael));
}); // div.faq blocks (one Q each or multi-h3)
document.querySelectorAll('div.faq').forEach(function (faq) {
var h3s = faq.querySelectorAll('h3');
if (!h3s.length) return;
if (h3s.length === 1) {
var clone = faq.cloneNode(true);
var h = clone.querySelector('h3');
var q = txt(h);
if (h) h.remove();
pushPair(pairs, seen, q, txt(clone));
} else {
h3s.forEach(function (h) {
var q = txt(h);
var parts = [];
for (var n = h.nextSibling; n && !(n.tagName === 'H3' || n.tagName === 'H2'); n = n.nextSibling) {
if (n.nodeType === 3) {
var t = n.textContent.replace(/\s+/g, ' ').trim();
if (t) parts.push(t);
} else if (n.nodeType === 1) {
var t2 = txt(n);
if (t2) parts.push(t2);
}
}
pushPair(pairs, seen, q, parts.join(' '));
});
}
}); // details/summary
document.querySelectorAll('details').forEach(function (d) {
var sm = d.querySelector('summary');
if (!sm) return;
var q = txt(sm);
var clone = d.cloneNode(true);
var sm2 = clone.querySelector('summary');
if (sm2) sm2.remove();
pushPair(pairs, seen, q, txt(clone));
}); // FAQ heading + following h3 siblings (city landers / school)
if (!pairs.length) {
var heads = Array.prototype.filter.call(document.querySelectorAll('h2, h3'), function (h) {
return /FAQs?/i.test(txt(h));
});
heads.forEach(function (head) {
var scope = head.parentElement || document;
var h3s = [];
// Prefer h3s after the heading within parent
var after = false;
Array.prototype.forEach.call(scope.children || [], function (child) {
if (child === head) { after = true; return; }
if (!after) return;
if (child.tagName === 'H2') { after = false; return; }
if (child.tagName === 'H3') h3s.push(child);
});
if (!h3s.length) {
// following siblings of head
for (var n = head.nextSibling; n; n = n.nextSibling) {
if (n.tagName === 'H2') break;
if (n.tagName === 'H3') h3s.push(n);
}
}
h3s.forEach(function (h) {
var q = txt(h);
var parts = [];
for (var n = h.nextSibling; n && n.tagName !== 'H3' && n.tagName !== 'H2'; n = n.nextSibling) {
if (n.nodeType === 3) {
var t = n.textContent.replace(/\s+/g, ' ').trim();
if (t) parts.push(t);
} else if (n.nodeType === 1) {
var t2 = txt(n);
if (t2) parts.push(t2);
}
}
pushPair(pairs, seen, q, parts.join(' '));
});
});
} if (pairs.length < 2) return; var mainEntity = pairs.map(function (p) {
return {
'@type': 'Question',
name: p.q,
acceptedAnswer: { '@type': 'Answer', text: p.a }
};
}); var data = {
'@context': 'https://schema.org',
'@type': 'FAQPage',
'@id': location.href.split('#')[0] + '#faq',
mainEntity: mainEntity
}; var s = document.createElement('script');
s.type = 'application/ld+json';
s.setAttribute('data-bruno-faqpage', '1');
s.text = JSON.stringify(data);
(document.head || document.documentElement).appendChild(s);
} catch (e) {}
})();