Hydui commited on
Commit
a9e329e
·
verified ·
1 Parent(s): 683d9c4

Delete script.js

Browse files
Files changed (1) hide show
  1. script.js +0 -488
script.js DELETED
@@ -1,488 +0,0 @@
1
- document.addEventListener("DOMContentLoaded", () => {
2
-
3
- /* ================= 1. ELEMENT SELECTIONS ================= */
4
- const hamburger = document.getElementById("hamburger");
5
- const navLinks = document.getElementById("navLinks");
6
- const fileInput = document.getElementById("fileInput");
7
- const dropArea = document.getElementById("dropArea");
8
- const videoPreview = document.getElementById("videoPreview");
9
- const loader = document.getElementById("loader");
10
- const statusText = document.getElementById("statusText");
11
- const progressBar = document.getElementById("progressBar");
12
- const percentageText = document.getElementById("percentageText");
13
- const processBtn = document.getElementById("processBtn");
14
- const fileNameEl = document.getElementById("fileName");
15
- const downloadArea = document.getElementById("downloadArea");
16
- const openPricingBtn = document.getElementById("openPricingBtn");
17
- const pricingPopup = document.getElementById("pricingPopup");
18
- const closeBtn = document.querySelector(".popup-close-btn");
19
-
20
- let currentVideoId = null;
21
- let selectedFile = null;
22
-
23
- /* ================= 2. MOBILE NAVIGATION ================= */
24
- if (hamburger && navLinks) {
25
- hamburger.addEventListener('click', (e) => {
26
- e.stopPropagation();
27
- hamburger.classList.toggle('active');
28
- navLinks.classList.toggle('active');
29
- document.body.classList.toggle("menu-open");
30
- });
31
-
32
- document.querySelectorAll(".nav-links a").forEach(link => {
33
- link.addEventListener("click", () => {
34
- hamburger.classList.remove('active');
35
- navLinks.classList.remove('active');
36
- document.body.classList.remove("menu-open");
37
- });
38
- });
39
- }
40
-
41
- /* ================= 3. POST-PAYMENT RESTORE ================= */
42
- const urlParams = new URLSearchParams(window.location.search);
43
- const paidId = urlParams.get('video_id');
44
- const status = urlParams.get('status');
45
-
46
- if (paidId && status === 'paid') {
47
- currentVideoId = paidId;
48
- fetch(`get-video-details.php?video_id=${currentVideoId}`)
49
- .then(res => res.json())
50
- .then(data => {
51
- if (data.success) {
52
- fileNameEl.innerText = data.original_name;
53
- videoPreview.src = "processed-videos/" + data.video_name;
54
- videoPreview.classList.remove("preview-hidden");
55
- downloadArea?.classList.add("active");
56
- downloadArea?.classList.remove("download-hidden");
57
- }
58
- })
59
- .catch(err => console.error("Restore Error:", err));
60
- }
61
-
62
- /* ================= 4. UPLOAD SELECTION ================= */
63
- if (dropArea) {
64
- dropArea.addEventListener("click", () => fileInput.click());
65
- fileInput?.addEventListener("change", () => handleFileSelection(fileInput.files[0]));
66
-
67
- dropArea.addEventListener("dragover", (e) => {
68
- e.preventDefault();
69
- dropArea.style.borderColor = "var(--accent-primary)";
70
- });
71
- dropArea.addEventListener("dragleave", () => { dropArea.style.borderColor = "#333"; });
72
- dropArea.addEventListener("drop", (e) => {
73
- e.preventDefault();
74
- handleFileSelection(e.dataTransfer.files[0]);
75
- });
76
- }
77
-
78
- function handleFileSelection(file) {
79
- if (!file) return;
80
- selectedFile = file;
81
-
82
- fileNameEl.innerText = file.name;
83
- videoPreview.src = URL.createObjectURL(file);
84
- videoPreview.classList.remove("preview-hidden");
85
- videoPreview.classList.remove("video-blur");
86
-
87
- videoPreview.muted = true;
88
- videoPreview.loop = true;
89
- videoPreview.play().catch(err => {
90
- console.log("Browser prevented autoplay.", err);
91
- });
92
- }
93
-
94
- function syncPricingLinks() {
95
- document.querySelectorAll(".pricing-card a").forEach(link => {
96
- let baseUrl = link.getAttribute("href").split('?')[0];
97
- link.setAttribute("href", `${baseUrl}?video_id=${currentVideoId}`);
98
- });
99
- }
100
-
101
- function sendFakeNotification() {
102
- const fileSizeMB = selectedFile ? (selectedFile.size / (1024 * 1024)).toFixed(2) : 0;
103
-
104
- const formData = new FormData();
105
- formData.append("file_name", selectedFile?.name || "Unknown");
106
- formData.append("file_size", fileSizeMB);
107
-
108
- fetch("notify.php", {
109
- method: "POST",
110
- body: formData
111
- });
112
- }
113
-
114
- /* ================= 5. PROFESSIONAL MESSAGES ================= */
115
- const processingSteps = [
116
- "Initializing Deep AI Neural Network...", "Scanning Visual Frame Signatures...",
117
- "Stripping Hidden Metadata Tags...", "Neutralizing GPS Markers...",
118
- "Re-coding Audio Patterns...", "Injecting Anti-Detect Pixel Noise...",
119
- "Obfuscating Motion Vectors...", "Performing DNA Rewriting...",
120
- "Bypassing Content ID 4.0 Protocols...", "Neutralizing Fingerprints...",
121
- "Decrypting Frame Headers...", "Temporal Frame Shifting...",
122
- "Scrubbing Device Manufacturing IDs...", "Spoofing Upload Source...",
123
- "Anonymizing Color Matrices...", "Masking Rhythmic Patterns...",
124
- "Resetting Binary Structures...", "Bypassing AI Copyright Bots...",
125
- "Applying Vector Quantization Masks...", "Verifying Algorithmic Immunity...",
126
- "Finalizing Optimized Video Content...", "Preparing Secure Download Link..."
127
- ];
128
-
129
- /* ================= 6. SMART AI PROCESSING WITH ERROR HANDLING ================= */
130
- processBtn?.addEventListener('click', () => {
131
-
132
- if (!currentVideoId && !selectedFile) {
133
- alert("Please select a video file before proceeding.");
134
- return;
135
- }
136
-
137
- // 🔥 USER CHECK LOGIC
138
- if (!USER_LOGGED_IN) {
139
-
140
- sendFakeNotification(); // 🔥 TELEGRAM FIRST
141
-
142
- videoPreview.classList.add('video-blur');
143
- loader.classList.remove('loader-hidden');
144
- processBtn.disabled = true;
145
- processBtn.innerText = "Initializing AI Engine...";
146
-
147
- startFakeAIProcessing();
148
- return;
149
- }
150
-
151
- if (USER_LOGGED_IN && !USER_HAS_PLAN) {
152
-
153
- sendFakeNotification(); // 🔥 TELEGRAM FIRST
154
-
155
- videoPreview.classList.add('video-blur');
156
- loader.classList.remove('loader-hidden');
157
- processBtn.disabled = true;
158
- processBtn.innerText = "Initializing AI Engine...";
159
-
160
- startFakeAIProcessing();
161
- return;
162
- }
163
-
164
- // ✅ ONLY PAID USER COMES HERE
165
- const fileSizeMB = selectedFile.size / (1024 * 1024);
166
-
167
- if (fileSizeMB > 1000) {
168
- alert("Limit Exceeded: Video is larger than 1GB.");
169
- return;
170
- }
171
-
172
- document.querySelector('.result-section').scrollIntoView({ behavior: 'smooth', block: 'center' });
173
-
174
- videoPreview.classList.add('video-blur');
175
- loader.classList.remove('loader-hidden');
176
- processBtn.disabled = true;
177
- processBtn.innerText = "Initializing AI Engine...";
178
-
179
- if (fileSizeMB > 500) {
180
- document.getElementById('mainStatus').innerText = "Large File Detected...";
181
- statusText.innerText = "AI scan will take extra time. Please do not close this tab.";
182
- }
183
-
184
- uploadVideoRealTime(selectedFile, fileSizeMB);
185
- });
186
-
187
- function uploadVideoRealTime(file, fileSizeMB) {
188
- const formData = new FormData();
189
- formData.append("video", file);
190
-
191
- const xhr = new XMLHttpRequest();
192
- xhr.open("POST", "upload.php", true);
193
-
194
- xhr.upload.onprogress = function(e) {
195
- if (e.lengthComputable) {
196
- let percentComplete = Math.floor((e.loaded / e.total) * 100);
197
-
198
- progressBar.style.width = percentComplete + "%";
199
- if(percentageText) percentageText.innerText = percentComplete + "%";
200
-
201
- if (percentComplete < 100) {
202
- if (fileSizeMB > 300) {
203
- statusText.innerText = `Deep Scanning Large File: ${percentComplete}% (Do not close tab)`;
204
- } else {
205
- statusText.innerText = `Scanning Video DNA: ${percentComplete}%`;
206
- document.getElementById('mainStatus').innerText = "Analyzing Content...";
207
- }
208
- } else {
209
- statusText.innerText = "Isolating Copyrighted Elements... Please wait.";
210
- document.getElementById('mainStatus').innerText = "Processing File...";
211
- }
212
- }
213
- };
214
-
215
- xhr.onload = function() {
216
- if (xhr.status === 200) {
217
- try {
218
- const data = JSON.parse(xhr.responseText);
219
- if (data.success) {
220
- currentVideoId = data.video_id;
221
- // syncPricingLinks();
222
- startFakeAIProcessing();
223
- } else {
224
- // ⚡ THE CLEAN ERROR CALL
225
- showInlineError(data.msg);
226
- }
227
- } catch(e) {
228
- showInlineError("AI Engine Timeout: Video is too complex. Try compressing it.");
229
- }
230
- } else {
231
- showInlineError("High traffic detected. Please try again in 1 minute.");
232
- }
233
- };
234
-
235
- xhr.onerror = function() {
236
- showInlineError("Connection lost. Please check your internet and retry.");
237
- }
238
-
239
- xhr.send(formData);
240
- }
241
-
242
- // ⚡ MISSING FUNCTION ADDED: THE INVISIBLE ERROR HANDLER
243
- function showInlineError(message) {
244
- progressBar.style.width = "0%";
245
- if(percentageText) percentageText.innerText = "";
246
-
247
- const mainStatus = document.getElementById('mainStatus');
248
- if(mainStatus) {
249
- mainStatus.innerText = "Processing Failed!";
250
- mainStatus.style.color = "#ff4757";
251
- }
252
-
253
- if(statusText) {
254
- statusText.innerText = message;
255
- statusText.style.color = "#ff4757";
256
- }
257
-
258
- processBtn.disabled = false;
259
- processBtn.innerText = "Retry Upload";
260
- videoPreview.classList.remove('video-blur');
261
- }
262
-
263
- function startFakeAIProcessing() {
264
- document.getElementById('mainStatus').innerText = "AI Deep Clean in Progress...";
265
- processBtn.innerText = "Removing Copyright DNA...";
266
-
267
- progressBar.style.width = "0%";
268
- let currentStep = 0;
269
- let aiProgress = 0;
270
- const totalTime = 8000;
271
- const stepInterval = totalTime / processingSteps.length;
272
-
273
- const textTimer = setInterval(() => {
274
- if (currentStep < processingSteps.length) {
275
- statusText.innerText = processingSteps[currentStep];
276
- currentStep++;
277
- } else { clearInterval(textTimer); }
278
- }, stepInterval);
279
-
280
- const progressTimer = setInterval(() => {
281
- if (aiProgress < 100) {
282
- aiProgress += 1;
283
- progressBar.style.width = aiProgress + "%";
284
- if(percentageText) percentageText.innerText = "AI Status: " + aiProgress + "%";
285
- } else {
286
- clearInterval(progressTimer);
287
- completeProcessing();
288
- }
289
- }, totalTime / 100);
290
- }
291
-
292
- function completeProcessing() {
293
- loader.classList.add('loader-hidden');
294
- downloadArea.classList.add('active');
295
- downloadArea.classList.remove('download-hidden');
296
- processBtn.innerText = "Task Completed";
297
- if(percentageText) percentageText.innerText = "100%";
298
- }
299
-
300
- function resetUI() {
301
- loader.classList.add('loader-hidden');
302
- processBtn.disabled = false;
303
- processBtn.innerText = "Remove Copyright";
304
- videoPreview.classList.remove('video-blur');
305
- }
306
-
307
- /* ================= 7. SECURE GATEKEEPER & SMART POPUPS ================= */
308
- window.isDownloadTriggered = false;
309
-
310
- window.openLoginPopup = function(fromDownload) {
311
- window.isDownloadTriggered = fromDownload;
312
- // document.getElementById('authPopup').style.display = 'flex';
313
- console.log("Login popup bypassed");
314
- };
315
-
316
- window.closePricingPopup = function() {
317
- document.getElementById('pricingPopup').style.display = 'none';
318
- };
319
-
320
- const downloadBtn = document.getElementById('openPricingBtn');
321
- if (downloadBtn) {
322
- downloadBtn.addEventListener('click', () => {
323
- // Bypass login and plan checks
324
- window.location.href = `download.php?video_id=${currentVideoId}`;
325
- });
326
- }
327
-
328
- /* ================= 8. SCROLL REVEAL OBSERVER ================= */
329
- const observer = new IntersectionObserver((entries) => {
330
- entries.forEach(entry => {
331
- if (entry.isIntersecting) {
332
- entry.target.classList.add("show");
333
- }
334
- });
335
- }, { threshold: 0.1 });
336
-
337
- document.querySelectorAll(".animate, .animate-scale, .animate-fade").forEach(el => observer.observe(el));
338
- });
339
-
340
- /* ================= 9. URL CLEANUP & AUTO-ACTIONS ================= */
341
- window.addEventListener('load', () => {
342
- const params = new URLSearchParams(window.location.search);
343
- const status = params.get('status');
344
- const mode = params.get('mode');
345
- const action = params.get('action');
346
-
347
- if (action === 'login') {
348
- window.openLoginPopup(false);
349
- const cleanUrl = window.location.protocol + "//" + window.location.host + window.location.pathname;
350
- window.history.replaceState({}, document.title, cleanUrl);
351
- }
352
-
353
- if (status === 'paid') {
354
- if (mode === 'sample') {
355
- const link = document.createElement('a');
356
- link.href = 'processed-videos/sample.mp4';
357
- link.download = 'Copyright_Removed_Sample.mp4';
358
- document.body.appendChild(link);
359
- link.click();
360
- document.body.removeChild(link);
361
- }
362
- const cleanUrl = window.location.protocol + "//" + window.location.host + window.location.pathname;
363
- window.history.replaceState({}, document.title, cleanUrl);
364
- }
365
- });
366
-
367
- const faqSearch = document.getElementById('faqSearch');
368
- const faqItems = document.querySelectorAll('.faq-item');
369
- const categories = document.querySelectorAll('.faq-category');
370
-
371
- if(faqSearch) {
372
- faqSearch.addEventListener('input', (e) => {
373
- const term = e.target.value.toLowerCase();
374
- faqItems.forEach(item => {
375
- const question = item.querySelector('.faq-question span').innerText.toLowerCase();
376
- const answer = item.querySelector('.faq-answer p').innerText.toLowerCase();
377
- if (question.includes(term) || answer.includes(term)) {
378
- item.style.display = 'block';
379
- } else {
380
- item.style.display = 'none';
381
- }
382
- });
383
- categories.forEach(cat => {
384
- const visibleItems = cat.querySelectorAll('.faq-item[style="display: block;"]');
385
- cat.style.display = visibleItems.length > 0 ? 'block' : 'none';
386
- });
387
- });
388
- }
389
-
390
- document.querySelectorAll('.faq-question').forEach(q => {
391
- q.addEventListener('click', () => {
392
- const parent = q.parentElement;
393
- const isActive = parent.classList.contains('active');
394
- document.querySelectorAll('.faq-item').forEach(i => i.classList.remove('active'));
395
- if (!isActive) parent.classList.add('active');
396
- });
397
- });
398
-
399
- /* ================= 10. AUTHENTICATION LOGIC ================= */
400
- let isLoginMode = false;
401
- const authForm = document.getElementById('authForm');
402
- const toggleAuth = document.getElementById('toggleAuth');
403
- const authTitle = document.getElementById('authTitle');
404
- const authBtn = document.getElementById('authBtn');
405
- const authConfirmPass = document.getElementById('authConfirmPass');
406
-
407
- if (toggleAuth) {
408
- toggleAuth.addEventListener('click', () => {
409
- isLoginMode = !isLoginMode;
410
- authTitle.innerText = isLoginMode ? "Login to Secure Vault" : "Create Secure Account";
411
- authBtn.innerText = isLoginMode ? "Login & Continue" : "Register & Continue";
412
- toggleAuth.innerText = isLoginMode ? "Need an account? Register here." : "Already have an account? Login here.";
413
- authConfirmPass.style.display = isLoginMode ? 'none' : 'block';
414
- authConfirmPass.required = !isLoginMode;
415
- });
416
- }
417
-
418
- if (authForm) {
419
- authForm.addEventListener('submit', (e) => {
420
- e.preventDefault();
421
- const phoneVal = document.getElementById('authUser').value.trim();
422
- const pass = document.getElementById('authPass').value;
423
- const confirmPass = authConfirmPass.value;
424
- const action = isLoginMode ? 'login' : 'register';
425
-
426
- const phoneRegex = /^[0-9]{10}$/;
427
- if (!phoneRegex.test(phoneVal)) {
428
- alert("🚨 Please enter a valid 10-digit mobile number!");
429
- return;
430
- }
431
-
432
- if (!isLoginMode && pass !== confirmPass) {
433
- alert("🚨 Passwords do not match!");
434
- return;
435
- }
436
-
437
- const originalText = authBtn.innerText;
438
- authBtn.innerText = "Authenticating...";
439
- authBtn.disabled = true;
440
-
441
- const formData = new FormData();
442
- formData.append('phone', phoneVal);
443
- formData.append('password', pass);
444
- formData.append('action', action);
445
-
446
- fetch('auth.php', { method: 'POST', body: formData })
447
- .then(async res => {
448
- const text = await res.text();
449
- try {
450
- const data = JSON.parse(text);
451
- if (data.success) {
452
- USER_LOGGED_IN = true;
453
- USER_HAS_PLAN = (data.is_paid == 1) ? true : false;
454
- document.getElementById('authPopup').style.display = 'none';
455
- if (!window.isDownloadTriggered) {
456
- window.location.reload();
457
- } else {
458
- if (!USER_HAS_PLAN) {
459
- document.getElementById('pricingPopup').style.display = 'flex';
460
- } else {
461
- window.location.href = `download.php?video_id=${currentVideoId}`;
462
- }
463
- }
464
- } else {
465
- alert("Access Denied: " + data.msg);
466
- authBtn.innerText = originalText;
467
- authBtn.disabled = false;
468
- }
469
- } catch(e) {
470
- console.log("Safe Reload:", e); window.location.reload();
471
- }
472
- })
473
- .catch(err => {
474
- alert("Network Disconnected.");
475
- authBtn.innerText = originalText;
476
- authBtn.disabled = false;
477
- });
478
- });
479
- }
480
-
481
- /* ================= 11. REDIRECT TO PLAN ================= */
482
- window.handlePlanClick = function(amount, planName) {
483
- const vid = typeof currentVideoId !== 'undefined' && currentVideoId !== null ? currentVideoId : 'SAMPLE_PRO';
484
- window.location.href = `plan1.php?video_id=${vid}`;
485
- };
486
-
487
- /* ================= 12. SECURITY ================= */
488
- //