"
);
}
function isDonorListPage() {
return !!(document.querySelector(".sanatan-donorlist-page, #sanatan-donorlist") || /\/donorlist\/?$/.test(location.pathname));
}
function cleanDonorListPage() {
if (!isDonorListPage()) return;
if (!document.getElementById("sanatan-donorlist-clean")) {
var s = document.createElement("style");
s.id = "sanatan-donorlist-clean";
s.textContent = "body:has(.sanatan-donorlist-page) #site-header,body:has(.sanatan-donorlist-page) .site-header,body:has(.sanatan-donorlist-page) #site-footer,body:has(.sanatan-donorlist-page) .site-footer,body:has(.sanatan-donorlist-page) .entry-title,body:has(.sanatan-donorlist-page) #updates,body:has(.sanatan-donorlist-page) .sanatan-updates{display:none!important}";
document.head.appendChild(s);
}
var updates = document.getElementById("updates");
if (updates && updates.parentNode) updates.parentNode.removeChild(updates);
}
function applyProgress() {
document.querySelectorAll(".sanatan-progress").forEach(function (el) {
if (el.parentNode) el.parentNode.removeChild(el);
});
}
function renderSevas(data) {
var sevas = document.getElementById("sevas");
if (!sevas) return;
var p = data.products || {};
var cards = [
productCard({
product: "sqft",
title: "Donate 1 sq.ft",
img: "https://drive.google.com/thumbnail?id=1lguWIrgx63_invzNnUb_k7gOeAg9Dyp0&sz=s1600",
desc: "The construction of Sri Aadi Varahi Amma and Sri Run Mukteshwar Mahadev temple is currently paused due to insufficient funds. With support from donors, only the foundational structure has been completed. To resume and complete the temple, materials like bricks, cement, iron, sand, paints, and other essentials are urgently needed. You can donate these items directly or contribute funds for specific materials. By supporting this cause, you become a Dharma Palaka and uphold the glory of Sanatana Dharma. During the Pratishta Karyakrama, your Gotra-name will be included in the Sankalpa, and Veda Pandits will pray to the deities for your family's wellbeing and spiritual upliftment.",
obtained: (p.sqft && p.sqft.obtained) || 0,
goal: (p.sqft && p.sqft.goal) || 5175,
price: (p.sqft && p.sqft.price) || 2616,
}),
productCard({
product: "varahi",
title: "Sri Adi Varahi Amma Vigraha and Pooja Samagri",
img: "https://drive.google.com/thumbnail?id=1oNDgIM8B0bLl8ASddSmWQekl8h0rxgYC&sz=s1200",
desc: "As part of the temple completion, we aim to install the Vigraha (idol) of Sri Aadi Varahi Amma, along with Abharanas, Alankara Samagri, and daily Puja Samagri. Donating towards these sacred items grants you the Punya of serving Veda Mata and ensures your offerings are used in Nitya Puja (daily worship). This divine service blesses your entire Vamsha (family lineage) with Punya, Bhakti, Jnana, Aayu, Aarogya, and Aishwarya. During the Pratishta Karyakrama, your Gotra-name will be chanted in the Sankalpa, and Veda Pandits will invoke blessings from Gayatri Devi on your behalf.",
obtained: (p.varahi && p.varahi.obtained) || 0,
goal: (p.varahi && p.varahi.goal) || 500,
price: (p.varahi && p.varahi.price) || 301,
}),
productCard({
product: "nandi",
title: "Donate to Sri Run Mukteshwar Shivalinga with Nandi",
img: "https://drive.google.com/thumbnail?id=1SaODiu3ZF8rzaOOJfqtRea-p3CV8a2Hp&sz=s1200",
desc: "Help us install the Vigraha (idol) of Sri Run Mukteshwar Shivalinga with Nandi by donating towards Abharanas, Alankara Samagri, and Puja Samagri. These offerings will be used in the temple's daily worship, bringing continuous Punya and divine grace to your entire Vamsha. Contributing to this cause is an opportunity to participate in the eternal service of the divine and to receive the blessings of Veda Mata. During the Pratishta Karyakrama, your Gotra-name will be chanted in the Sankalpa, and Veda Pandits will offer prayers to Gayatri Devi for your holistic wellbeing.",
obtained: (p.nandi && p.nandi.obtained) || 0,
goal: (p.nandi && p.nandi.goal) || 500,
price: (p.nandi && p.nandi.price) || 1350,
}),
productCard({
product: "pratishta",
title: "Donate to Pratishta Karyakrama",
img: "https://sanatanintl.org/wp-content/uploads/2026/09/pratishta-karyakrama.jpg",
desc: "The Pratishta Karyakrama is the sacred installation of Sri Aadi Varahi Amma and Sri Run Mukteshwar Mahadev, along with 27 Shivalingas and 27 Homa Kundas. Performed by expert Veda Pandits, the event involves powerful Shanti Homas and rituals as prescribed by the Vedas and Puranas. This divine ceremony incurs a high cost but brings unmatched spiritual rewards. By donating, you become a part of this Daiva Karyakrama and receive the blessings of the deities. Your Gotra-name will be recited during the Sankalpa, and Veda Pandits will seek divine grace for your health, prosperity, and spiritual growth.",
obtained: (p.pratishta && p.pratishta.obtained) || 0,
goal: (p.pratishta && p.pratishta.goal) || 500,
price: (p.pratishta && p.pratishta.price) || 1350,
}),
];
sevas.innerHTML = '
' + cards.join("") + "
";
bindSevaAddButtons();
if (!window.__sanatanStepBound) {
window.__sanatanStepBound = true;
document.addEventListener("click", function (e) {
var add = e.target.closest(".sanatan-add-btn");
if (add && add.closest(".sanatan-stepper")) {
var wrapAdd = add.closest(".sanatan-stepper");
var countAdd = wrapAdd.querySelector(".sanatan-step-count");
if (countAdd) countAdd.textContent = "1";
wrapAdd.classList.add("has-qty");
syncCartFromSteppers();
return;
}
var step = e.target.closest(".sanatan-step");
if (step) {
var wrap = step.closest(".sanatan-stepper");
var countEl = wrap.querySelector(".sanatan-step-count");
var n = parseInt(countEl.textContent, 10) || 0;
if (step.classList.contains("plus")) n += 1;
if (step.classList.contains("minus")) n = Math.max(0, n - 1);
countEl.textContent = n;
wrap.classList.toggle("has-qty", n > 0);
syncCartFromSteppers();
}
if (e.target.closest(".sanatan-donate-keep")) {
openDonate();
}
});
}
}
function bindSevaAddButtons() {
document.querySelectorAll(".sanatan-stepper .sanatan-add-btn").forEach(function (add) {
if (add.dataset.sanatanBound === "1") return;
add.dataset.sanatanBound = "1";
add.addEventListener("click", function (e) {
e.preventDefault();
e.stopPropagation();
var wrap = add.closest(".sanatan-stepper");
if (!wrap) return;
var countEl = wrap.querySelector(".sanatan-step-count");
if (countEl) countEl.textContent = "1";
wrap.classList.add("has-qty");
syncCartFromSteppers();
});
});
}
function resetSteppers() {
document.querySelectorAll(".sanatan-stepper").forEach(function (wrap) {
var countEl = wrap.querySelector(".sanatan-step-count");
if (countEl) countEl.textContent = "0";
wrap.classList.remove("has-qty");
});
}
function cartLines() {
var items = [];
document.querySelectorAll(".sanatan-stepper").forEach(function (wrap) {
var n = parseInt((wrap.querySelector(".sanatan-step-count") || {}).textContent, 10) || 0;
var product = wrap.getAttribute("data-product") || "";
var price = parseInt(wrap.getAttribute("data-price"), 10) || 0;
if (n > 0 && product) {
items.push({ product: product, qty: n, price: price });
}
});
return items;
}
function cartTotal() {
var total = 0;
document.querySelectorAll(".sanatan-stepper").forEach(function (wrap) {
var n = parseInt((wrap.querySelector(".sanatan-step-count") || {}).textContent, 10) || 0;
var price = parseInt(wrap.getAttribute("data-price"), 10) || 0;
total += n * price;
});
return total;
}
function syncCartFromSteppers() {
var total = cartTotal();
setDonationAmount(total > 0 ? total : 2116);
}
function removeGallery() {
var nav = document.getElementById("navMenu");
if (nav) {
nav.querySelectorAll('a[href="#gallery"]').forEach(function (a) {
var li = a.closest("li");
if (li && li.parentNode) li.parentNode.removeChild(li);
});
}
var gallery = document.getElementById("gallery");
if (gallery) {
gallery.style.display = "none";
gallery.setAttribute("hidden", "hidden");
}
}
function addUpdatesTab() {
var nav = document.getElementById("navMenu");
if (!nav) return;
removeGallery();
if (!nav.querySelector('a[href="#updates"]')) {
var li = document.createElement("li");
li.innerHTML = 'Updates';
nav.appendChild(li);
}
}
function showCampaignPanel(id) {
var sevas = document.getElementById("sevas");
var updates = document.getElementById("updates");
var progress = document.querySelector(".sanatan-progress");
if (sevas) sevas.style.display = "";
if (progress) progress.style.display = "";
if (updates) {
updates.style.display = "block";
updates.classList.add("is-visible");
}
var nav = document.getElementById("navMenu");
if (nav) {
nav.querySelectorAll("a").forEach(function (a) {
a.classList.toggle("active", a.getAttribute("href") === "#" + id);
});
}
var target = document.getElementById(id);
if (target && target.scrollIntoView) {
target.scrollIntoView({ behavior: "smooth", block: "start" });
}
}
function wireCampaignTabs() {
var nav = document.getElementById("navMenu");
var sevas = document.getElementById("sevas");
var updates = document.getElementById("updates");
if (!nav || nav.dataset.sanatanTabs === "1") return;
nav.dataset.sanatanTabs = "1";
placeUpdatesBeforeContact(updates);
if (updates) {
updates.style.display = "block";
updates.classList.add("is-visible");
}
nav.addEventListener("click", function (e) {
var a = e.target.closest('a[href="#updates"], a[href="#sevas"]');
if (!a) return;
e.preventDefault();
showCampaignPanel(a.getAttribute("href").slice(1));
});
}
function updatesInnerHtml(data) {
var updates = data.updates || [];
var inner = "