- marketing: index.html من 2274 إلى 775 سطراً، والباقي إلى styles/ (tokens·base·components·sections·responsive) و js/ (app·i18n·calculator·analytics) و i18n/ بخمس لغات (ar·en·fr·es·tr) عبر سمة data-i18n. - docs/05 + docs/33 + لوحة السوبر-أدمن: الباقات صارت ثلاثاً (إطلاق · نمو · سيادة) بدل الأربع، وتحديث docs/31 بما يطابقها. - docs/36: توثيق سيرو إكسبرس للتوصيل. - تنظيف استيرادات غير مستعملة في apps/rider و apps/driver. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
81 lines
3.4 KiB
JavaScript
81 lines
3.4 KiB
JavaScript
/* ============ TABS ============ */
|
|
$$(".tab-btn").forEach(b=>b.addEventListener("click",()=>{
|
|
$$(".tab-btn").forEach(x=>x.classList.remove("active"));
|
|
$$(".tab-panel").forEach(x=>x.classList.remove("active"));
|
|
b.classList.add("active");
|
|
$(`.tab-panel[data-panel="${b.dataset.tab}"]`).classList.add("active");
|
|
}));
|
|
|
|
/* ============ PRICING TOGGLE ============ */
|
|
$("#billToggle").addEventListener("click",function(){
|
|
const yr=this.classList.toggle("year");
|
|
$("#lblM").classList.toggle("active",!yr);$("#lblY").classList.toggle("active",yr);
|
|
$$(".plan .price[data-m]").forEach(p=>{
|
|
const v=yr?p.dataset.y:p.dataset.m;
|
|
p.innerHTML=`$${v}<small>/mo</small>`;
|
|
});
|
|
});
|
|
|
|
/* ============ THEME ============ */
|
|
$("#themeBtn").addEventListener("click",()=>{
|
|
const cur=document.documentElement.getAttribute("data-theme");
|
|
const nxt=cur==="dark"?"light":"dark";
|
|
document.documentElement.setAttribute("data-theme",nxt);
|
|
try{localStorage.setItem("tripz_theme",nxt);}catch(e){}
|
|
});
|
|
|
|
/* ============ LANG MENU ============ */
|
|
$("#langBtn").addEventListener("click",e=>{e.stopPropagation();$("#langWrap").classList.toggle("open");});
|
|
document.addEventListener("click",()=>$("#langWrap").classList.remove("open"));
|
|
$$(".lang-menu button").forEach(b=>b.addEventListener("click",()=>{applyLang(b.dataset.lang);$("#langWrap").classList.remove("open");}));
|
|
|
|
/* ============ NAV SCROLL ============ */
|
|
addEventListener("scroll",()=>{$("#hdr").classList.toggle("scrolled",scrollY>80);});
|
|
|
|
/* ============ MOBILE MENU ============ */
|
|
(function(){
|
|
const toggle=$("#menuToggle"),drawer=$("#mobileDrawer"),overlay=$("#mobileOverlay");
|
|
if(!toggle||!drawer)return;
|
|
function close(){drawer.classList.remove("open");overlay.classList.remove("show");toggle.setAttribute("aria-expanded","false");}
|
|
function open(){drawer.classList.add("open");overlay.classList.add("show");toggle.setAttribute("aria-expanded","true");}
|
|
toggle.addEventListener("click",()=>{drawer.classList.contains("open")?close():open();});
|
|
overlay.addEventListener("click",close);
|
|
drawer.querySelectorAll("a").forEach(a=>a.addEventListener("click",close));
|
|
})();
|
|
|
|
/* ============ REVEAL + COUNTERS + TIMELINE ============ */
|
|
const io=new IntersectionObserver((es)=>{
|
|
es.forEach(en=>{
|
|
if(en.isIntersecting){
|
|
en.target.classList.add("in");
|
|
$$(".count",en.target).forEach(runCount);
|
|
if(en.target.id==="timeline")animateTimeline();
|
|
io.unobserve(en.target);
|
|
}
|
|
});
|
|
},{threshold:.2});
|
|
$$(".reveal").forEach(el=>io.observe(el));
|
|
const tlObs=$("#timeline");if(tlObs)io.observe(tlObs);
|
|
|
|
function runCount(el){
|
|
if(el.dataset.plain){return;} // years shown plainly
|
|
const to=+el.dataset.to, dec=+el.dataset.dec||0, dur=900; let t0=null;
|
|
function step(ts){if(!t0)t0=ts;const p=Math.min((ts-t0)/dur,1);const e=1-Math.pow(1-p,3);
|
|
el.textContent=(to*e).toFixed(dec);if(p<1)requestAnimationFrame(step);else el.textContent=to.toFixed(dec);}
|
|
requestAnimationFrame(step);
|
|
}
|
|
function animateTimeline(){
|
|
const steps=$$(".zig-row");const fill=$("#tlFill");
|
|
fill.style.height=($("#timeline").offsetHeight-12)+"px";
|
|
steps.forEach((s,i)=>setTimeout(()=>s.classList.add("on"),i*220));
|
|
}
|
|
|
|
/* ============ INIT ============ */
|
|
(function init(){
|
|
try{
|
|
const t=localStorage.getItem("tripz_theme");if(t)document.documentElement.setAttribute("data-theme",t);
|
|
const l=localStorage.getItem("tripz_lang")||"ar";
|
|
loadLang(l);
|
|
}catch(e){loadLang("ar");}
|
|
})();
|