when pasting into Head Tracking Code. Swap the two placeholder style IDs for your real ones (must match the CSS): COUNTERS: .style-99670 · TABS: .style-99671 ============================================================================ */ (function () { "use strict"; var COUNTERS = ".style-99670"; var TABS = ".style-99671"; var reduce = window.matchMedia && window.matchMedia("(prefers-reduced-motion: reduce)").matches; /* ---- Stat count-up (animates the number when it scrolls into view) ---- */ function initCounters() { var nums = document.querySelectorAll(COUNTERS + " h4.h4-style, " + COUNTERS + " .h4-style"); if (!nums.length) return; function run(el) { var raw = (el.textContent || "").trim(); var m = raw.match(/^(\D*?)([\d,]+(?:\.\d+)?)(.*)$/); // prefix, number, suffix (handles 15:1, 150+, $2M) if (!m) return; var prefix = m[1], target = parseFloat(m[2].replace(/,/g, "")), suffix = m[3]; if (reduce || !window.requestAnimationFrame) { el.textContent = prefix + target.toLocaleString() + suffix; return; } var dur = 1600, t0 = null; function frame(ts) { if (!t0) t0 = ts; var p = Math.min((ts - t0) / dur, 1); var eased = 1 - Math.pow(1 - p, 3); el.textContent = prefix + Math.floor(eased * target).toLocaleString() + suffix; if (p < 1) requestAnimationFrame(frame); else el.textContent = prefix + target.toLocaleString() + suffix; } requestAnimationFrame(frame); } if ("IntersectionObserver" in window) { var io = new IntersectionObserver(function (entries) { entries.forEach(function (e) { if (e.isIntersecting) { run(e.target); io.unobserve(e.target); } }); }, { threshold: 0.4 }); Array.prototype.forEach.call(nums, function (el) { io.observe(el); }); } else { Array.prototype.forEach.call(nums, run); } } /* ---- Tabs (turns each list entry into a tab + panel) ---- */ function initTabs() { var roots = document.querySelectorAll(TABS); if (!roots.length) return; Array.prototype.forEach.call(roots, function (root) { if (root.classList.contains("ndp-tabs-ready")) return; var items = root.querySelectorAll("li.group"); if (items.length < 2) return; var nav = document.createElement("div"); nav.className = "ndp-tabnav"; Array.prototype.forEach.call(items, function (li, i) { var titleEl = li.querySelector("h4, .h4-style"); var label = titleEl ? titleEl.textContent.trim() : "Tab " + (i + 1); if (titleEl) titleEl.style.display = "none"; // hide in-panel title (it's the tab now) var btn = document.createElement("button"); btn.type = "button"; btn.className = "ndp-tab" + (i === 0 ? " is-active" : ""); btn.textContent = label; btn.addEventListener("click", function () { Array.prototype.forEach.call(nav.querySelectorAll(".ndp-tab"), function (b) { b.classList.remove("is-active"); }); Array.prototype.forEach.call(items, function (x) { x.classList.remove("is-active"); }); btn.classList.add("is-active"); li.classList.add("is-active"); }); nav.appendChild(btn); if (i === 0) li.classList.add("is-active"); }); var host = root.querySelector(".content-wrap") || root; host.insertBefore(nav, host.firstChild); root.classList.add("ndp-tabs-ready"); }); } function init() { initCounters(); initTabs(); } if (document.readyState === "loading") document.addEventListener("DOMContentLoaded", init); else init(); })();