moreiraj93 commited on
Commit
ad10c7d
·
verified ·
1 Parent(s): 61a9286

// ========== GLOBAL CONFIG ==========

Browse files

const app = {
version: "1.0.0",
darkMode: false,
user: null,
tiers: ["Prompts", "Standard Images", "High-Quality Images", "Videos"]
};

// ========== THEME HANDLER ==========
const themeToggle = document.querySelector("#theme-toggle");
themeToggle?.addEventListener("click", () => {
document.body.classList.toggle("dark");
app.darkMode = !app.darkMode;
localStorage.setItem("darkMode", app.darkMode);
});

// Load saved theme
window.addEventListener("DOMContentLoaded", () => {
const savedMode = localStorage.getItem("darkMode");
if (savedMode === "true") document.body.classList.add("dark");
loadGallery();
loadTestimonials();
});

// ========== AUTHENTICATION ==========
async function loginUser(email, password) {
// Example: integrate Firebase or Supabase here
console.log(`Logging in ${email}`);
// Placeholder logic
app.user = { email, tier: "Standard Images" };
updateUIForUser();
}

async function signupUser(email, password, tier) {
console.log(`Signing up ${email} for ${tier}`);
app.user = { email, tier };
updateUIForUser();
}

function logoutUser() {
app.user = null;
updateUIForUser();
}

function updateUIForUser() {
const userDisplay = document.querySelector("#user-display");
if (app.user) {
userDisplay.textContent = `Welcome, ${app.user.email} (${app.user.tier})`;
} else {
userDisplay.textContent = "Guest Mode";
}
}

// ========== GALLERY HANDLER ==========
async function loadGallery() {
const gallery = document.querySelector(".gallery");
if (!gallery) return;
gallery.innerHTML = "<p>Loading your AI masterpieces...</p>";

// Example fetch (you’ll hook to your backend or Firestore)
const images = [
{ src: "ai1.jpg", title: "Urban Jungle", quality: "HD" },
{ src: "ai2.jpg", title: "Neon Dreams", quality: "4K" }
];

gallery.innerHTML = images
.map(
(img) => `
<div class="gallery-item">
<img src="${img.src}" alt="${img.title}" />
<div class="overlay">
<h3>${img.title}</h3>
<span>${img.quality}</span>
</div>
</div>`
)
.join("");
}

// ========== TESTIMONIALS ==========
async function loadTestimonials() {
const container = document.querySelector(".testimonials");
if (!container) return;
const testimonials = [
{ name: "Maya", text: "This AI changed my brand visuals overnight!" },
{ name: "Rico", text: "The realism and motion are beyond perfect." },
{ name: "Ava", text: "I tested others — nothing compares to this quality!" }
];
container.innerHTML = testimonials
.map(
(t) => `
<div class="testimonial-card">
<p>"${t.text}"</p>
<h4>- ${t.name}</h4>
</div>`
)
.join("");
}

// ========== BEFORE/AFTER FEATURE ==========
function initBeforeAfter() {
const slider = document.querySelector(".before-after-slider");
if (!slider) return;

const before = slider.querySelector(".before");
const after = slider.querySelector(".after");
const handle = slider.querySelector(".handle");

let isDragging = false;

handle.addEventListener("mousedown", () => (isDragging = true));
window.addEventListener("mouseup", () => (isDragging = false));
window.addEventListener("mousemove", (e) => {
if (!isDragging) return;
const rect = slider.getBoundingClientRect();
const offsetX = e.clientX - rect.left;
const percent = Math.min(Math.max(offsetX / rect.width, 0), 1);
before.style.width = `${percent * 100}%`;
handle.style.left = `${percent * 100}%`;
});
}

// ========== PROMPT GENERATOR ==========
function generatePromptPack(count = 100) {
const basePrompts = [
"Cinematic portrait, ultra-detailed lighting",
"Abstract fusion of neon and shadow",
"Real-world wildlife with surreal landscapes"
];
const prompts = Array.from({ length: count }, () =>
basePrompts[Math.floor(Math.random() * basePrompts.length)]
);
return prompts;
}

// ========== SUBSCRIPTION HANDLER ==========
function showSubscriptionTiers() {
const section = document.querySelector(".pricing");
if (!section) return;
const tiers = [
{ name: "Prompts", price: "$10.99", perks: ["100 AI Prompts"] },
{
name: "Standard Images",
price: "$300",
perks: ["10 HD AI Images", "Access to Prompt Tools"]
},
{
name: "High-Quality Images",
price: "$1200",
perks: ["20 4K Images", "Custom Style Blends"]
},
{
name: "Video + Ads",
price: "$6300",
perks: ["AI Video Creation", "Ad Creative Assistance"]
}
];

section.innerHTML = tiers
.map(
(tier) => `
<div class="tier-card">
<h2>${tier.name}</h2>
<p class="price">${tier.price}</p>
<ul>${tier.perks.map((p) => `<li>${p}</li>`).join("")}</ul>
<button onclick="purchaseTier('${tier.name}')">Subscribe</button>
</div>`
)
.join("");
}

function purchaseTier(tierName) {
alert(`Subscribed to ${tierName} successfully!`);
app.user = { ...app.user, tier: tierName };
updateUIForUser();
}

// Initialize
window.addEventListener("load", () => {
initBeforeAfter();
showSubscriptionTiers();
});

Files changed (1) hide show
  1. script.js +493 -136
script.js CHANGED
@@ -1,159 +1,516 @@
1
- // AI Showcase Website Script
2
- document.addEventListener('DOMContentLoaded', function() {
3
- // Initialize cart count
4
- updateCartCount();
5
-
6
- // Initialize processor tabs
7
- initProcessorTabs();
8
-
9
- // Initialize gallery
10
- initGallery();
 
 
 
 
11
  });
12
 
13
- // Cart functionality
14
- let cart = JSON.parse(localStorage.getItem('aiShowcaseCart')) || [];
 
 
 
 
 
15
 
16
- function updateCartCount() {
17
- const cartCounts = document.querySelectorAll('.cart-count');
18
- const totalItems = cart.reduce((sum, item) => sum + item.quantity, 0);
19
- cartCounts.forEach(count => {
20
- count.textContent = totalItems;
21
- });
 
22
  }
23
 
24
- function addToCart(product) {
25
- const existingItem = cart.find(item => item.id === product.id);
26
-
27
- if (existingItem) {
28
- existingItem.quantity += 1;
29
- } else {
30
- cart.push({
31
- ...product,
32
- quantity: 1
33
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  }
35
-
36
- localStorage.setItem('aiShowcaseCart', JSON.stringify(cart));
37
- updateCartCount();
38
-
39
- // Show success notification
40
- showNotification('Added to cart successfully!', 'success');
 
 
 
 
 
 
 
41
  }
42
 
43
- // Processor Tabs
44
- function initProcessorTabs() {
45
- const tabs = document.querySelectorAll('[data-processor-tab]');
46
-
47
- tabs.forEach(tab => {
48
- tab.addEventListener('click', function() {
49
- const tabId = this.getAttribute('data-processor-tab');
50
-
51
- // Update active tab
52
- tabs.forEach(t => t.classList.remove('bg-accent-red', 'bg-accent-green', 'bg-accent-blue');
53
- this.classList.add(this.getAttribute('data-tab-color'));
54
-
55
- // Show corresponding processor section
56
- document.querySelectorAll('.processor-section').forEach(section => {
57
- section.classList.remove('active');
58
- });
59
-
60
- const targetSection = document.getElementById(`${tabId}-processor`);
61
- if (targetSection) {
62
- targetSection.classList.add('active');
63
- }
64
- });
65
- });
66
  }
67
 
68
- // Gallery functionality
69
- function initGallery() {
70
- // This would typically load gallery items from an API
71
- const galleryGrid = document.querySelector('.grid.gap-6');
72
-
73
- if (galleryGrid) {
74
- // Simulate loading gallery items
75
- setTimeout(() => {
76
- // Add some sample gallery items
77
- for (let i = 1; i <= 12; i++) {
78
- const category = i % 3 === 0 ? 'red' : i % 3 === 1 ? 'green' : 'blue';
79
- galleryGrid.innerHTML += `
80
- <div class="card-tilt bg-card-bg rounded-2xl p-4 shadow-2xl gallery-item" style="animation-delay: ${i * 0.1}s">
81
- <img src="http://static.photos/${category}/640x360/${i}" alt="AI Generated Art" class="w-full h-48 object-cover rounded-xl mb-4">
82
- <h3 class="text-xl font-semibold mb-2">AI Artwork ${i}</h3>
83
- <p class="text-accent-red text-2xl font-bold mb-2">$${300 + (i * 100)}</p>
84
- <div class="flex gap-2 mb-4">
85
- <span class="bg-accent-${category} text-white px-2 py-1 rounded-full text-sm">${category}</span>
86
- <span class="bg-accent-green text-white px-2 py-1 rounded-full text-sm">4K</span>
87
- </div>
88
- <button class="w-full bg-accent-red hover:bg-red-600 text-white py-2 rounded-xl transition-colors" onclick="addToCart({id: ${i}, name: 'AI Artwork ${i}', price: ${300 + (i * 100)})">
89
- Add to Cart
90
- </button>
91
- </div>
92
- `;
93
- }
94
- }, 1000);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
95
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
96
  }
97
 
98
- // Notification system
99
- function showNotification(message, type = 'info') {
100
- const notification = document.createElement('div');
101
- notification.className = `fixed top-4 right-4 z-50 px-6 py-3 rounded-xl font-semibold ${
102
- type === 'success' ? 'bg-accent-green' :
103
- type === 'error' ? 'bg-accent-red' : 'bg-accent-blue'
104
- } text-white transform transition-all duration-300 translate-x-full';
105
-
106
- notification.textContent = message;
107
- document.body.appendChild(notification);
108
-
109
- // Animate in
110
- setTimeout(() => {
111
- notification.classList.remove('translate-x-full');
112
- }, 100);
113
-
114
- // Auto remove after 3 seconds
115
- setTimeout(() => {
116
- notification.classList.add('translate-x-full');
117
- setTimeout(() => {
118
- document.body.removeChild(notification);
119
- }, 300);
120
- }, 3000);
121
- }
122
-
123
- // Image upload handler
124
- function handleImageUpload(event) {
125
- const file = event.target.files[0];
126
- if (file) {
127
- // In a real implementation, this would upload to your server
128
- showNotification('Image uploaded successfully!', 'success');
 
 
 
129
  }
 
130
  }
131
 
132
- // Initialize tooltips and other UI enhancements
133
- function initUI() {
134
- // Add hover effects to cards
135
- const cards = document.querySelectorAll('.card-tilt');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
136
 
137
- cards.forEach(card => {
138
- card.addEventListener('mousemove', function(e) {
139
- const rect = this.getBoundingClientRect();
140
- const x = e.clientX - rect.left;
141
- const y = e.clientY - rect.top;
142
-
143
- const centerX = rect.width / 2;
144
- const centerY = rect.height / 2;
145
-
146
- const rotateX = (y - centerY) / 10;
147
- const rotateY = (centerX - x) / 10;
148
-
149
- this.style.transform = `perspective(1000px) rotateX(${rotateX}deg) rotateY(${rotateY}deg)';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
150
  });
151
 
152
- card.addEventListener('mouseleave', function() {
153
- this.style.transform = 'perspective(1000px) rotateX(0) rotateY(0)';
154
  });
155
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
156
  }
157
 
158
- // Call initialization
159
- initUI();
 
 
1
+ === GLOBAL CONFIG ==========
2
+ const app = {
3
+ version: "1.0.0",
4
+ darkMode: false,
5
+ user: null,
6
+ tiers: ["Prompts", "Standard Images", "High-Quality Images", "Videos"]
7
+ };
8
+
9
+ // ========== THEME HANDLER ==========
10
+ const themeToggle = document.querySelector("#theme-toggle");
11
+ themeToggle?.addEventListener("click", () => {
12
+ document.body.classList.toggle("dark");
13
+ app.darkMode = !app.darkMode;
14
+ localStorage.setItem("darkMode", app.darkMode);
15
  });
16
 
17
+ // Load saved theme
18
+ window.addEventListener("DOMContentLoaded", () => {
19
+ const savedMode = localStorage.getItem("darkMode");
20
+ if (savedMode === "true") document.body.classList.add("dark");
21
+ loadGallery();
22
+ loadTestimonials();
23
+ });
24
 
25
+ // ========== AUTHENTICATION ==========
26
+ async function loginUser(email, password) {
27
+ // Example: integrate Firebase or Supabase here
28
+ console.log(`Logging in ${email}`);
29
+ // Placeholder logic
30
+ app.user = { email, tier: "Standard Images" };
31
+ updateUIForUser();
32
  }
33
 
34
+ async function signupUser(email, password, tier) {
35
+ console.log(`Signing up ${email} for ${tier}`);
36
+ app.user = { email, tier };
37
+ updateUIForUser();
38
+ }
39
+
40
+ function logoutUser() {
41
+ app.user = null;
42
+ updateUIForUser();
43
+ }
44
+
45
+ function updateUIForUser() {
46
+ const userDisplay = document.querySelector("#user-display");
47
+ if (app.user) {
48
+ userDisplay.textContent = `Welcome, ${app.user.email} (${app.user.tier})`;
49
+ } else {
50
+ userDisplay.textContent = "Guest Mode";
51
+ }
52
+ }
53
+
54
+ // ========== GALLERY HANDLER ==========
55
+ async function loadGallery() {
56
+ const gallery = document.querySelector(".gallery");
57
+ if (!gallery) return;
58
+ gallery.innerHTML = "<p>Loading your AI masterpieces...</p>";
59
+
60
+ // Example fetch (you'll hook to your backend or Firestore)
61
+ const images = [
62
+ { src: "ai1.jpg", title: "Urban Jungle", quality: "HD" },
63
+ { src: "ai2.jpg", title: "Neon Dreams", quality: "4K" }
64
+ ];
65
+
66
+ gallery.innerHTML = images
67
+ .map(
68
+ (img) => `
69
+ <div class="gallery-item">
70
+ <img src="${img.src}" alt="${img.title}" />
71
+ <div class="overlay">
72
+ <h3>${img.title}</h3>
73
+ <span>${img.quality}</span>
74
+ </div>
75
+ </div>`
76
+ )
77
+ .join("");
78
+ }
79
+
80
+ // ========== TESTIMONIALS ==========
81
+ async function loadTestimonials() {
82
+ const container = document.querySelector(".testimonials");
83
+ if (!container) return;
84
+ const testimonials = [
85
+ { name: "Maya", text: "This AI changed my brand visuals overnight!" },
86
+ { name: "Rico", text: "The realism and motion are beyond perfect." },
87
+ { name: "Ava", text: "I tested others — nothing compares to this quality!" }
88
+ ];
89
+ container.innerHTML = testimonials
90
+ .map(
91
+ (t) => `
92
+ <div class="testimonial-card">
93
+ <p>"${t.text}"</p>
94
+ <h4>- ${t.name}</h4>
95
+ </div>`
96
+ )
97
+ .join("");
98
+ }
99
+
100
+ // ========== BEFORE/AFTER FEATURE ==========
101
+ function initBeforeAfter() {
102
+ const slider = document.querySelector(".before-after-slider");
103
+ if (!slider) return;
104
+
105
+ const before = slider.querySelector(".before");
106
+ const after = slider.querySelector(".after");
107
+ const handle = slider.querySelector(".handle");
108
+
109
+ let isDragging = false;
110
+
111
+ handle.addEventListener("mousedown", () => (isDragging = true));
112
+ window.addEventListener("mouseup", () => (isDragging = false));
113
+ window.addEventListener("mousemove", (e) => {
114
+ if (!isDragging) return;
115
+ const rect = slider.getBoundingClientRect();
116
+ const offsetX = e.clientX - rect.left;
117
+ const percent = Math.min(Math.max(offsetX / rect.width, 0), 1);
118
+ before.style.width = `${percent * 100}%`;
119
+ handle.style.left = `${percent * 100}%`;
120
+ });
121
+ }
122
+
123
+ // ========== PROMPT GENERATOR ==========
124
+ function generatePromptPack(count = 100) {
125
+ const basePrompts = [
126
+ "Cinematic portrait, ultra-detailed lighting",
127
+ "Abstract fusion of neon and shadow",
128
+ "Real-world wildlife with surreal landscapes"
129
+ ];
130
+ const prompts = Array.from({ length: count }, () =>
131
+ basePrompts[Math.floor(Math.random() * basePrompts.length)]
132
+ );
133
+ return prompts;
134
+ }
135
+
136
+ // ========== SUBSCRIPTION HANDLER ==========
137
+ function showSubscriptionTiers() {
138
+ const section = document.querySelector(".pricing");
139
+ if (!section) return;
140
+ const tiers = [
141
+ { name: "Prompts", price: "$10.99", perks: ["100 AI Prompts"] },
142
+ {
143
+ name: "Standard Images",
144
+ price: "$300",
145
+ perks: ["10 HD AI Images", "Access to Prompt Tools"]
146
+ },
147
+ {
148
+ name: "High-Quality Images",
149
+ price: "$1200",
150
+ perks: ["20 4K Images", "Custom Style Blends"]
151
+ },
152
+ {
153
+ name: "Video + Ads",
154
+ price: "$6300",
155
+ perks: ["AI Video Creation", "Ad Creative Assistance"]
156
  }
157
+ ];
158
+
159
+ section.innerHTML = tiers
160
+ .map(
161
+ (tier) => `
162
+ <div class="tier-card">
163
+ <h2>${tier.name}</h2>
164
+ <p class="price">${tier.price}</p>
165
+ <ul>${tier.perks.map((p) => `<li>${p}</li>`).join("")}</ul>
166
+ <button onclick="purchaseTier('${tier.name}')">Subscribe</button>
167
+ </div>`
168
+ )
169
+ .join("");
170
  }
171
 
172
+ function purchaseTier(tierName) {
173
+ alert(`Subscribed to ${tierName} successfully!`);
174
+ app.user = { ...app.user, tier: tierName };
175
+ updateUIForUser();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
176
  }
177
 
178
+ // Initialize
179
+ window.addEventListener("load", () => {
180
+ initBeforeAfter();
181
+ showSubscriptionTiers();
182
+ });
183
+ =======
184
+ // ========== GLOBAL CONFIG ==========
185
+ const app = {
186
+ version: "1.0.0",
187
+ darkMode: false,
188
+ user: null,
189
+ tiers: ["Prompts", "Standard Images", "High-Quality Images", "Videos"]
190
+ };
191
+
192
+ // ========== THEME HANDLER ==========
193
+ const themeToggle = document.querySelector("#theme-toggle");
194
+ themeToggle?.addEventListener("click", () => {
195
+ document.body.classList.toggle("dark");
196
+ app.darkMode = !app.darkMode;
197
+ localStorage.setItem("darkMode", app.darkMode);
198
+ });
199
+
200
+ // Load saved theme
201
+ window.addEventListener("DOMContentLoaded", () => {
202
+ const savedMode = localStorage.getItem("darkMode");
203
+ if (savedMode === "true") document.body.classList.add("dark");
204
+ loadGallery();
205
+ loadTestimonials();
206
+ });
207
+
208
+ // ========== AUTHENTICATION ==========
209
+ async function loginUser(email, password) {
210
+ // Example: integrate Firebase or Supabase here
211
+ console.log(`Logging in ${email}`);
212
+ // Placeholder logic
213
+ app.user = { email, tier: "Standard Images" };
214
+ updateUIForUser();
215
+ }
216
+
217
+ async function signupUser(email, password, tier) {
218
+ console.log(`Signing up ${email} for ${tier}`);
219
+ app.user = { email, tier };
220
+ updateUIForUser();
221
+ }
222
+
223
+ function logoutUser() {
224
+ app.user = null;
225
+ updateUIForUser();
226
+ }
227
+
228
+ function updateUIForUser() {
229
+ const userDisplay = document.querySelector("#user-display");
230
+ if (app.user) {
231
+ userDisplay.textContent = `Welcome, ${app.user.email} (${app.user.tier})`;
232
+ } else {
233
+ userDisplay.textContent = "Guest Mode";
234
+ }
235
+ }
236
+
237
+ // ========== GALLERY HANDLER ==========
238
+ async function loadGallery() {
239
+ const gallery = document.querySelector(".gallery");
240
+ if (!gallery) return;
241
+ gallery.innerHTML = "<p>Loading your AI masterpieces...</p>";
242
+
243
+ // Example fetch (you'll hook to your backend or Firestore)
244
+ const images = [
245
+ { src: "http://static.photos/technology/320x240/1", title: "Urban Jungle", quality: "HD" },
246
+ { src: "http://static.photos/abstract/320x240/2", title: "Neon Dreams", quality: "4K" },
247
+ { src: "http://static.photos/minimal/320x240/3", title: "Digital Art", quality: "HD" },
248
+ { src: "http://static.photos/gradient/320x240/4", title: "Color Fusion", quality: "4K" }
249
+ ];
250
+
251
+ gallery.innerHTML = images
252
+ .map(
253
+ (img) => `
254
+ <div class="gallery-item">
255
+ <img src="${img.src}" alt="${img.title}" />
256
+ <div class="overlay">
257
+ <h3>${img.title}</h3>
258
+ <span>${img.quality}</span>
259
+ </div>
260
+ </div>`
261
+ )
262
+ .join("");
263
+ }
264
+
265
+ // ========== TESTIMONIALS ==========
266
+ async function loadTestimonials() {
267
+ const container = document.querySelector(".testimonials");
268
+ if (!container) return;
269
+ const testimonials = [
270
+ { name: "Maya", text: "This AI changed my brand visuals overnight!" },
271
+ { name: "Rico", text: "The realism and motion are beyond perfect." },
272
+ { name: "Ava", text: "I tested others — nothing compares to this quality!" }
273
+ ];
274
+ container.innerHTML = testimonials
275
+ .map(
276
+ (t) => `
277
+ <div class="testimonial-card">
278
+ <p>"${t.text}"</p>
279
+ <h4>- ${t.name}</h4>
280
+ </div>`
281
+ )
282
+ .join("");
283
+ }
284
+
285
+ // ========== BEFORE/AFTER FEATURE ==========
286
+ function initBeforeAfter() {
287
+ const slider = document.querySelector(".before-after-slider");
288
+ if (!slider) return;
289
+
290
+ const before = slider.querySelector(".before");
291
+ const after = slider.querySelector(".after");
292
+ const handle = slider.querySelector(".handle");
293
+
294
+ let isDragging = false;
295
+
296
+ handle.addEventListener("mousedown", () => (isDragging = true));
297
+ window.addEventListener("mouseup", () => (isDragging = false));
298
+ window.addEventListener("mousemove", (e) => {
299
+ if (!isDragging) return;
300
+ const rect = slider.getBoundingClientRect();
301
+ const offsetX = e.clientX - rect.left;
302
+ const percent = Math.min(Math.max(offsetX / rect.width, 0), 1);
303
+ before.style.width = `${percent * 100}%`;
304
+ handle.style.left = `${percent * 100}%`;
305
+ });
306
+ }
307
+
308
+ // ========== PROMPT GENERATOR ==========
309
+ function generatePromptPack(count = 100) {
310
+ const basePrompts = [
311
+ "Cinematic portrait, ultra-detailed lighting",
312
+ "Abstract fusion of neon and shadow",
313
+ "Real-world wildlife with surreal landscapes"
314
+ ];
315
+ const prompts = Array.from({ length: count }, () =>
316
+ basePrompts[Math.floor(Math.random() * basePrompts.length)]
317
+ );
318
+ return prompts;
319
+ }
320
+
321
+ // ========== SUBSCRIPTION HANDLER ==========
322
+ function showSubscriptionTiers() {
323
+ const section = document.querySelector(".pricing");
324
+ if (!section) return;
325
+ const tiers = [
326
+ { name: "Prompts", price: "$10.99", perks: ["100 AI Prompts"] },
327
+ {
328
+ name: "Standard Images",
329
+ price: "$300",
330
+ perks: ["10 HD AI Images", "Access to Prompt Tools"]
331
+ },
332
+ {
333
+ name: "High-Quality Images",
334
+ price: "$1200",
335
+ perks: ["20 4K Images", "Custom Style Blends"]
336
+ },
337
+ {
338
+ name: "Video + Ads",
339
+ price: "$6300",
340
+ perks: ["AI Video Creation", "Ad Creative Assistance"]
341
  }
342
+ ];
343
+
344
+ section.innerHTML = tiers
345
+ .map(
346
+ (tier) => `
347
+ <div class="tier-card">
348
+ <h2>${tier.name}</h2>
349
+ <p class="price">${tier.price}</p>
350
+ <ul>${tier.perks.map((p) => `<li>${p}</li>`).join("")}</ul>
351
+ <button onclick="purchaseTier('${tier.name}')">Subscribe</button>
352
+ </div>`
353
+ )
354
+ .join("");
355
  }
356
 
357
+ function purchaseTier(tierName) {
358
+ alert(`Subscribed to ${tierName} successfully!`);
359
+ app.user = { ...app.user, tier: tierName };
360
+ updateUIForUser();
361
+ }
362
+
363
+ // ========== SHOPPING CART FUNCTIONALITY ==========
364
+ class ShoppingCart {
365
+ constructor() {
366
+ this.items = JSON.parse(localStorage.getItem('cart')) || [];
367
+ }
368
+
369
+ addItem(item) {
370
+ this.items.push(item);
371
+ this.saveToLocalStorage();
372
+ this.updateCartCount();
373
+ }
374
+
375
+ removeItem(index) {
376
+ this.items.splice(index, 1);
377
+ this.saveToLocalStorage();
378
+ this.updateCartCount();
379
+ }
380
+
381
+ saveToLocalStorage() {
382
+ localStorage.setItem('cart', JSON.stringify(this.items));
383
+ }
384
+
385
+ updateCartCount() {
386
+ const count = this.items.length;
387
+ const cartCountElement = document.getElementById('cart-count');
388
+ if (cartCountElement) {
389
+ cartCountElement.textContent = count;
390
+ count > 0 ? cartCountElement.classList.remove('hidden') : cartCountElement.classList.add('hidden');
391
  }
392
+ }
393
  }
394
 
395
+ // Initialize cart on page load
396
+ window.cart = new ShoppingCart();
397
+ window.cart.updateCartCount();
398
+
399
+ // Initialize tooltips
400
+ document.addEventListener('DOMContentLoaded', function() {
401
+ // Lazy loading for images
402
+ const lazyImages = document.querySelectorAll('img[data-src]');
403
+
404
+ const lazyLoad = (target) => {
405
+ const io = new IntersectionObserver((entries, observer) => {
406
+ entries.forEach(entry => {
407
+ if (entry.isIntersecting) {
408
+ const img = entry.target;
409
+ img.src = img.dataset.src;
410
+ observer.unobserve(img);
411
+ }
412
+ });
413
+ });
414
+ io.observe(target);
415
+ };
416
+
417
+ lazyImages.forEach(lazyLoad);
418
+
419
+ // Add subtle tilt effect to cards on mousemove
420
+ document.querySelectorAll('.card-tilt').forEach(card => {
421
+ card.addEventListener('mousemove', (e) => {
422
+ const x = e.clientX - card.getBoundingClientRect().left;
423
+ const y = e.clientY - card.getBoundingClientRect().top;
424
+ const midX = card.clientWidth / 2;
425
+ const midY = card.clientHeight / 2;
426
+ const angleX = (midY - y) / 15;
427
+ const angleY = (x - midX) / 15;
428
 
429
+ card.style.transform = `perspective(1000px) rotateX(${angleX}deg) rotateY(${angleY}deg)`;
430
+ });
431
+
432
+ card.addEventListener('mouseleave', () => {
433
+ card.style.transform = 'perspective(1000px) rotateX(0deg) rotateY(0deg)`;
434
+ });
435
+ });
436
+ });
437
+
438
+ // Initialize
439
+ window.addEventListener("load", () => {
440
+ initBeforeAfter();
441
+ showSubscriptionTiers();
442
+ });
443
+ Initialize tooltips
444
+ document.addEventListener('DOMContentLoaded', function() {
445
+ // Lazy loading for images
446
+ const lazyImages = document.querySelectorAll('img[data-src]');
447
+
448
+ const lazyLoad = (target) => {
449
+ const io = new IntersectionObserver((entries, observer) => {
450
+ entries.forEach(entry => {
451
+ if (entry.isIntersecting) {
452
+ const img = entry.target;
453
+ img.src = img.dataset.src;
454
+ observer.unobserve(img);
455
+ }
456
+ });
457
+ });
458
+ io.observe(target);
459
+ };
460
+
461
+ lazyImages.forEach(lazyLoad);
462
+
463
+ // Add subtle tilt effect to cards on mousemove
464
+ document.querySelectorAll('.card-tilt').forEach(card => {
465
+ card.addEventListener('mousemove', (e) => {
466
+ const x = e.clientX - card.getBoundingClientRect().left;
467
+ const y = e.clientY - card.getBoundingClientRect().top;
468
+ const midX = card.clientWidth / 2;
469
+ const midY = card.clientHeight / 2;
470
+ const angleX = (midY - y) / 15;
471
+ const angleY = (x - midX) / 15;
472
+
473
+ card.style.transform = `perspective(1000px) rotateX(${angleX}deg) rotateY(${angleY}deg)`;
474
  });
475
 
476
+ card.addEventListener('mouseleave', () => {
477
+ card.style.transform = 'perspective(1000px) rotateX(0deg) rotateY(0deg)';
478
  });
479
  });
480
+ });
481
+
482
+ // Shopping cart functionality
483
+ class ShoppingCart {
484
+ constructor() {
485
+ this.items = JSON.parse(localStorage.getItem('cart')) || [];
486
+ }
487
+
488
+ addItem(item) {
489
+ this.items.push(item);
490
+ this.saveToLocalStorage();
491
+ this.updateCartCount();
492
+ }
493
+
494
+ removeItem(index) {
495
+ this.items.splice(index, 1);
496
+ this.saveToLocalStorage();
497
+ this.updateCartCount();
498
+ }
499
+
500
+ saveToLocalStorage() {
501
+ localStorage.setItem('cart', JSON.stringify(this.items));
502
+ }
503
+
504
+ updateCartCount() {
505
+ const count = this.items.length;
506
+ const cartCountElement = document.getElementById('cart-count');
507
+ if (cartCountElement) {
508
+ cartCountElement.textContent = count;
509
+ count > 0 ? cartCountElement.classList.remove('hidden') : cartCountElement.classList.add('hidden');
510
+ }
511
+ }
512
  }
513
 
514
+ // Initialize cart on page load
515
+ window.cart = new ShoppingCart();
516
+ window.cart.updateCartCount();