, so loading this one earlier gives it first crack at the * original text. * - Do NOT combine this with data-calltrk-noswap on the same elements — * that attribute blocks the href swap entirely, which defeats the * purpose here. * * SCOPE: * - By default this applies to every `a[href^="tel:"]` on the page. * Narrow the SELECTOR below if you only want this behavior on specific * numbers (e.g. give those links a shared class like * `.static-display-phone` and use that instead). */ (function () { var SELECTOR = 'a[href^="tel:"]'; // Map of element -> original visible text, captured before CallRail swaps it var originalText = new WeakMap(); function snapshot() { document.querySelectorAll(SELECTOR).forEach(function (el) { if (!originalText.has(el)) { originalText.set(el, el.textContent); } }); } function restore(el) { var original = originalText.get(el); if (original && el.textContent !== original) { el.textContent = original; } } // Snapshot as early as possible, and again once the DOM is fully parsed // (covers elements that aren't present yet when this script first runs). snapshot(); document.addEventListener('DOMContentLoaded', snapshot); // Watch for CallRail (or anything else) changing the link's contents. var observer = new MutationObserver(function (mutations) { mutations.forEach(function (m) { var node = m.target.nodeType === 1 ? m.target : m.target.parentElement; var anchor = node && node.closest ? node.closest(SELECTOR) : null; if (anchor) restore(anchor); }); }); function startObserving() { // document.documentElement () always exists as soon as parsing // starts, unlike document.body when this script is placed in . observer.observe(document.documentElement, { childList: true, subtree: true, characterData: true }); } if (document.body) { startObserving(); } else { document.addEventListener('DOMContentLoaded', startObserving); } // Safety net: CallRail's swap can lag slightly after its script loads, // so double-check shortly after window load too. window.addEventListener('load', function () { setTimeout(function () { document.querySelectorAll(SELECTOR).forEach(restore); }, 1500); }); })();

Testimony D.M. – Healed From a Past Abortion

Awesome people, very kind, very sweet and the whole experience helped me grow and heal.

On facilitators

Just awesome people. Very kind, sweet and strong in the Lord

More Blog Posts