seo management

const PLANS = { "red_2599_3m": { price: 25.99, validity: "3 Months", type: "RED" }, "red_3599_3m": { price: 35.99, validity: "3 Months", type: "RED" }, "red_5899_15m": { price: 58.99, validity: "15 Months", type: "RED" }, "gold_4599_6m": { price: 45.99, validity: "6 Months", type: "GOLD" }, "gold_7899_15m":{ price: 78.99, validity: "15 Months", type: "GOLD" }, "gold_3599_6m": { price: 35.99, validity: "6 Months", type: "GOLD" } }; function getQueryParam(name){ const url = new URL(window.location.href); return url.searchParams.get(name); } function money(v){ return `$${Number(v).toFixed(2)}`; } function loadOrderFromStorage(){ try{ return JSON.parse(localStorage.getItem("fastgift_order") || "null"); }catch(e){ return null; } } function saveOrder(order){ localStorage.setItem("fastgift_order", JSON.stringify(order)); } function planTitle(planKey){ const p = PLANS[planKey]; if(!p) return "—"; return `${p.type} - ${money(p.price)}`; } /* ORDER PAGE */ (function initOrderPage(){ const form = document.getElementById("orderForm"); if(!form) return; const emailEl = document.getElementById("email"); const planEl = document.getElementById("plan"); const sumPrice = document.getElementById("sumPrice"); const sumValidity = document.getElementById("sumValidity"); const sumType = document.getElementById("sumType"); // preselect plan from query ?plan= const qPlan = getQueryParam("plan"); if(qPlan && PLANS[qPlan]) planEl.value = qPlan; // if storage exists, fill const stored = loadOrderFromStorage(); if(stored?.email) emailEl.value = stored.email; if(stored?.plan && PLANS[stored.plan] && !planEl.value) planEl.value = stored.plan; function refreshSummary(){ const key = planEl.value; const p = PLANS[key]; if(!p){ sumPrice.textContent = "—"; sumValidity.textContent = "—"; sumType.textContent = "—"; return; } sumPrice.textContent = money(p.price); sumValidity.textContent = p.validity; sumType.textContent = p.type; } planEl.addEventListener("change", refreshSummary); refreshSummary(); form.addEventListener("submit", (e)=>{ e.preventDefault(); const email = emailEl.value.trim(); const plan = planEl.value; if(!email || !plan || !PLANS[plan]) return; const order = { email, plan, ...PLANS[plan], createdAt: new Date().toISOString() }; saveOrder(order); window.location.href = "payment.html"; }); })(); /* PAYMENT PAGE */ (function initPaymentPage(){ const payEmail = document.getElementById("payEmail"); if(!payEmail) return; const order = loadOrderFromStorage(); if(!order){ // no order => back to order page window.location.href = "order.html"; return; } document.getElementById("payEmail").textContent = order.email; document.getElementById("payPlan").textContent = planTitle(order.plan); document.getElementById("payValidity").textContent = order.validity; document.getElementById("payTotal").textContent = money(order.price); // Tabs const tabs = document.querySelectorAll(".paymethod__tab"); const panes = { paypal: document.getElementById("pane-paypal"), card: document.getElementById("pane-card"), crypto: document.getElementById("pane-crypto"), }; tabs.forEach(t=>{ t.addEventListener("click", ()=>{ tabs.forEach(x=>x.classList.remove("is-active")); t.classList.add("is-active"); Object.values(panes).forEach(p=>p.classList.remove("is-show")); const tab = t.getAttribute("data-tab"); if(panes[tab]) panes[tab].classList.add("is-show"); }); }); // Fake payment -> success const goSuccess = ()=>{ // mark paid (demo) order.paidAt = new Date().toISOString(); saveOrder(order); window.location.href = "success.html"; }; const b1 = document.getElementById("payNowPaypal"); const b2 = document.getElementById("payNowCard"); const b3 = document.getElementById("payNowCrypto"); if(b1) b1.addEventListener("click", goSuccess); if(b2) b2.addEventListener("click", goSuccess); if(b3) b3.addEventListener("click", goSuccess); })(); /* SUCCESS PAGE */ (function initSuccessPage(){ const okEmail = document.getElementById("okEmail"); if(!okEmail) return; const order = loadOrderFromStorage(); if(!order){ window.location.href = "index.html"; return; } document.getElementById("okEmail").textContent = order.email || "—"; document.getElementById("okPlan").textContent = planTitle(order.plan); document.getElementById("okValidity").textContent = order.validity || "—"; document.getElementById("okTotal").textContent = money(order.price || 0); })();