-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
125 lines (115 loc) · 4.27 KB
/
Copy pathscript.js
File metadata and controls
125 lines (115 loc) · 4.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
// ═══════════════════════════════════════
// MADAKOP – SCRIPT.JS
// ═══════════════════════════════════════
// ── AGE GATE ──
function enterSite() {
const gate = document.getElementById('ageGate');
if (gate) gate.classList.add('hidden');
sessionStorage.setItem('mk_age_verified', 'true');
sessionStorage.setItem('mk', '1');
}
window.addEventListener('DOMContentLoaded', () => {
if (sessionStorage.getItem('mk_age_verified') === 'true' || sessionStorage.getItem('mk') === '1') {
const gate = document.getElementById('ageGate');
if (gate) gate.classList.add('hidden');
}
});
// ── SMOKE PUFFS ──
window.addEventListener('DOMContentLoaded', () => {
const wrap = document.getElementById('smokeWrap');
if (!wrap) return;
for (let i = 0; i < 12; i++) {
const p = document.createElement('div');
p.className = 'puff';
const s = 80 + Math.random() * 200;
p.style.cssText = `width:${s}px;height:${s}px;left:${Math.random()*100}%;animation-duration:${14+Math.random()*18}s;animation-delay:${-Math.random()*25}s;`;
wrap.appendChild(p);
}
});
// ── NAV SCROLL ──
window.addEventListener('scroll', () => {
const nav = document.getElementById('nav');
if (nav) nav.classList.toggle('scrolled', window.scrollY > 40);
});
// ── MOBILE MENU ──
function toggleMenu() {
const menu = document.getElementById('mobileMenu');
if (menu) menu.classList.toggle('open');
}
// ── PRODUCT CATEGORY FILTER ──
window.addEventListener('DOMContentLoaded', () => {
document.querySelectorAll('.cat-tab').forEach(btn => {
btn.addEventListener('click', () => {
document.querySelectorAll('.cat-tab').forEach(b => b.classList.remove('active'));
btn.classList.add('active');
const cat = btn.dataset.cat;
document.querySelectorAll('.prod-card').forEach(card => {
card.classList.toggle('hidden', cat !== 'all' && card.dataset.cat !== cat);
});
});
});
});
// ── ADD TO BAG ──
function addToBag(btn) {
const original = btn.textContent;
btn.textContent = '✓ Added!';
btn.classList.add('added');
const toast = document.getElementById('bagToast');
if (toast) {
toast.classList.add('show');
setTimeout(() => toast.classList.remove('show'), 2500);
}
setTimeout(() => {
btn.textContent = original;
btn.classList.remove('added');
}, 2000);
}
window.addEventListener('DOMContentLoaded', () => {
document.querySelectorAll('.btn-add').forEach(btn => {
btn.addEventListener('click', ev => {
ev.preventDefault();
addToBag(btn);
const href = btn.getAttribute('href');
if (href && href.startsWith('http')) {
window.open(href, '_blank');
}
});
});
});
// ── TUTORIAL STEP SWITCHER ──
function showStep(n) {
document.querySelectorAll('.step-content').forEach(s => s.classList.remove('active'));
document.querySelectorAll('.step-btn').forEach(b => b.classList.remove('active'));
const el = document.getElementById('step-' + n);
const btn = document.querySelectorAll('.step-btn')[n - 1];
if (el) el.classList.add('active');
if (btn) btn.classList.add('active');
}
// ── TUTORIAL SKILL FILTER ──
window.addEventListener('DOMContentLoaded', () => {
document.querySelectorAll('.skill-tab').forEach(btn => {
btn.addEventListener('click', () => {
document.querySelectorAll('.skill-tab').forEach(b => b.classList.remove('active'));
btn.classList.add('active');
const lvl = btn.dataset.lvl;
document.querySelectorAll('.tut-card').forEach(card => {
card.classList.toggle('hidden', lvl !== 'all' && card.dataset.lvl !== lvl);
});
});
});
});
// ── SCROLL REVEAL (simple) ──
window.addEventListener('DOMContentLoaded', () => {
const observer = new IntersectionObserver((entries) => {
entries.forEach(e => {
if (e.isIntersecting) {
e.target.style.animation = 'fadeUp .5s ease both';
observer.unobserve(e.target);
}
});
}, { threshold: 0.1 });
document.querySelectorAll('.prod-card, .about-card, .member-benefit, .rule-card, .tut-card').forEach(el => {
el.style.opacity = '0';
observer.observe(el);
});
});