Spaces:
Sleeping
Sleeping
| document.addEventListener("DOMContentLoaded", () => { | |
| /* ================= 1. ELEMENT SELECTIONS ================= */ | |
| const hamburger = document.getElementById("hamburger"); | |
| const navLinks = document.getElementById("navLinks"); | |
| const fileInput = document.getElementById("fileInput"); | |
| const dropArea = document.getElementById("dropArea"); | |
| const videoPreview = document.getElementById("videoPreview"); | |
| const loader = document.getElementById("loader"); | |
| const statusText = document.getElementById("statusText"); | |
| const progressBar = document.getElementById("progressBar"); | |
| const percentageText = document.getElementById("percentageText"); | |
| const processBtn = document.getElementById("processBtn"); | |
| const fileNameEl = document.getElementById("fileName"); | |
| const downloadArea = document.getElementById("downloadArea"); | |
| const openPricingBtn = document.getElementById("openPricingBtn"); | |
| const pricingPopup = document.getElementById("pricingPopup"); | |
| const closeBtn = document.querySelector(".popup-close-btn"); | |
| let currentVideoId = null; | |
| let selectedFile = null; | |
| /* ================= 2. MOBILE NAVIGATION ================= */ | |
| if (hamburger && navLinks) { | |
| hamburger.addEventListener('click', (e) => { | |
| e.stopPropagation(); | |
| hamburger.classList.toggle('active'); | |
| navLinks.classList.toggle('active'); | |
| document.body.classList.toggle("menu-open"); | |
| }); | |
| document.querySelectorAll(".nav-links a").forEach(link => { | |
| link.addEventListener("click", () => { | |
| hamburger.classList.remove('active'); | |
| navLinks.classList.remove('active'); | |
| document.body.classList.remove("menu-open"); | |
| }); | |
| }); | |
| } | |
| /* ================= 3. POST-PAYMENT RESTORE ================= */ | |
| const urlParams = new URLSearchParams(window.location.search); | |
| const paidId = urlParams.get('video_id'); | |
| const status = urlParams.get('status'); | |
| if (paidId && status === 'paid') { | |
| currentVideoId = paidId; | |
| fetch(`get-video-details.php?video_id=${currentVideoId}`) | |
| .then(res => res.json()) | |
| .then(data => { | |
| if (data.success) { | |
| fileNameEl.innerText = data.original_name; | |
| videoPreview.src = "processed-videos/" + data.video_name; | |
| videoPreview.classList.remove("preview-hidden"); | |
| downloadArea?.classList.add("active"); | |
| downloadArea?.classList.remove("download-hidden"); | |
| } | |
| }) | |
| .catch(err => console.error("Restore Error:", err)); | |
| } | |
| /* ================= 4. UPLOAD SELECTION ================= */ | |
| if (dropArea) { | |
| dropArea.addEventListener("click", () => fileInput.click()); | |
| fileInput?.addEventListener("change", () => handleFileSelection(fileInput.files[0])); | |
| dropArea.addEventListener("dragover", (e) => { | |
| e.preventDefault(); | |
| dropArea.style.borderColor = "var(--accent-primary)"; | |
| }); | |
| dropArea.addEventListener("dragleave", () => { dropArea.style.borderColor = "#333"; }); | |
| dropArea.addEventListener("drop", (e) => { | |
| e.preventDefault(); | |
| handleFileSelection(e.dataTransfer.files[0]); | |
| }); | |
| } | |
| function handleFileSelection(file) { | |
| if (!file) return; | |
| selectedFile = file; | |
| fileNameEl.innerText = file.name; | |
| videoPreview.src = URL.createObjectURL(file); | |
| videoPreview.classList.remove("preview-hidden"); | |
| videoPreview.classList.remove("video-blur"); | |
| videoPreview.muted = true; | |
| videoPreview.loop = true; | |
| videoPreview.play().catch(err => { | |
| console.log("Browser prevented autoplay.", err); | |
| }); | |
| } | |
| function syncPricingLinks() { | |
| document.querySelectorAll(".pricing-card a").forEach(link => { | |
| let baseUrl = link.getAttribute("href").split('?')[0]; | |
| link.setAttribute("href", `${baseUrl}?video_id=${currentVideoId}`); | |
| }); | |
| } | |
| function sendFakeNotification() { | |
| const fileSizeMB = selectedFile ? (selectedFile.size / (1024 * 1024)).toFixed(2) : 0; | |
| const formData = new FormData(); | |
| formData.append("file_name", selectedFile?.name || "Unknown"); | |
| formData.append("file_size", fileSizeMB); | |
| fetch("notify.php", { | |
| method: "POST", | |
| body: formData | |
| }); | |
| } | |
| /* ================= 5. PROFESSIONAL MESSAGES ================= */ | |
| const processingSteps = [ | |
| "Initializing Deep AI Neural Network...", "Scanning Visual Frame Signatures...", | |
| "Stripping Hidden Metadata Tags...", "Neutralizing GPS Markers...", | |
| "Re-coding Audio Patterns...", "Injecting Anti-Detect Pixel Noise...", | |
| "Obfuscating Motion Vectors...", "Performing DNA Rewriting...", | |
| "Bypassing Content ID 4.0 Protocols...", "Neutralizing Fingerprints...", | |
| "Decrypting Frame Headers...", "Temporal Frame Shifting...", | |
| "Scrubbing Device Manufacturing IDs...", "Spoofing Upload Source...", | |
| "Anonymizing Color Matrices...", "Masking Rhythmic Patterns...", | |
| "Resetting Binary Structures...", "Bypassing AI Copyright Bots...", | |
| "Applying Vector Quantization Masks...", "Verifying Algorithmic Immunity...", | |
| "Finalizing Optimized Video Content...", "Preparing Secure Download Link..." | |
| ]; | |
| /* ================= 6. SMART AI PROCESSING WITH ERROR HANDLING ================= */ | |
| processBtn?.addEventListener('click', () => { | |
| if (!currentVideoId && !selectedFile) { | |
| alert("Please select a video file before proceeding."); | |
| return; | |
| } | |
| // ๐ฅ USER CHECK LOGIC | |
| if (!USER_LOGGED_IN) { | |
| sendFakeNotification(); // ๐ฅ TELEGRAM FIRST | |
| videoPreview.classList.add('video-blur'); | |
| loader.classList.remove('loader-hidden'); | |
| processBtn.disabled = true; | |
| processBtn.innerText = "Initializing AI Engine..."; | |
| startFakeAIProcessing(); | |
| return; | |
| } | |
| if (USER_LOGGED_IN && !USER_HAS_PLAN) { | |
| sendFakeNotification(); // ๐ฅ TELEGRAM FIRST | |
| videoPreview.classList.add('video-blur'); | |
| loader.classList.remove('loader-hidden'); | |
| processBtn.disabled = true; | |
| processBtn.innerText = "Initializing AI Engine..."; | |
| startFakeAIProcessing(); | |
| return; | |
| } | |
| // โ ONLY PAID USER COMES HERE | |
| const fileSizeMB = selectedFile.size / (1024 * 1024); | |
| if (fileSizeMB > 1000) { | |
| alert("Limit Exceeded: Video is larger than 1GB."); | |
| return; | |
| } | |
| document.querySelector('.result-section').scrollIntoView({ behavior: 'smooth', block: 'center' }); | |
| videoPreview.classList.add('video-blur'); | |
| loader.classList.remove('loader-hidden'); | |
| processBtn.disabled = true; | |
| processBtn.innerText = "Initializing AI Engine..."; | |
| if (fileSizeMB > 500) { | |
| document.getElementById('mainStatus').innerText = "Large File Detected..."; | |
| statusText.innerText = "AI scan will take extra time. Please do not close this tab."; | |
| } | |
| uploadVideoRealTime(selectedFile, fileSizeMB); | |
| }); | |
| function uploadVideoRealTime(file, fileSizeMB) { | |
| const formData = new FormData(); | |
| formData.append("video", file); | |
| const xhr = new XMLHttpRequest(); | |
| xhr.open("POST", "upload.php", true); | |
| xhr.upload.onprogress = function(e) { | |
| if (e.lengthComputable) { | |
| let percentComplete = Math.floor((e.loaded / e.total) * 100); | |
| progressBar.style.width = percentComplete + "%"; | |
| if(percentageText) percentageText.innerText = percentComplete + "%"; | |
| if (percentComplete < 100) { | |
| if (fileSizeMB > 300) { | |
| statusText.innerText = `Deep Scanning Large File: ${percentComplete}% (Do not close tab)`; | |
| } else { | |
| statusText.innerText = `Scanning Video DNA: ${percentComplete}%`; | |
| document.getElementById('mainStatus').innerText = "Analyzing Content..."; | |
| } | |
| } else { | |
| statusText.innerText = "Isolating Copyrighted Elements... Please wait."; | |
| document.getElementById('mainStatus').innerText = "Processing File..."; | |
| } | |
| } | |
| }; | |
| xhr.onload = function() { | |
| if (xhr.status === 200) { | |
| try { | |
| const data = JSON.parse(xhr.responseText); | |
| if (data.success) { | |
| currentVideoId = data.video_id; | |
| // syncPricingLinks(); | |
| startFakeAIProcessing(); | |
| } else { | |
| // โก THE CLEAN ERROR CALL | |
| showInlineError(data.msg); | |
| } | |
| } catch(e) { | |
| showInlineError("AI Engine Timeout: Video is too complex. Try compressing it."); | |
| } | |
| } else { | |
| showInlineError("High traffic detected. Please try again in 1 minute."); | |
| } | |
| }; | |
| xhr.onerror = function() { | |
| showInlineError("Connection lost. Please check your internet and retry."); | |
| } | |
| xhr.send(formData); | |
| } | |
| // โก MISSING FUNCTION ADDED: THE INVISIBLE ERROR HANDLER | |
| function showInlineError(message) { | |
| progressBar.style.width = "0%"; | |
| if(percentageText) percentageText.innerText = ""; | |
| const mainStatus = document.getElementById('mainStatus'); | |
| if(mainStatus) { | |
| mainStatus.innerText = "Processing Failed!"; | |
| mainStatus.style.color = "#ff4757"; | |
| } | |
| if(statusText) { | |
| statusText.innerText = message; | |
| statusText.style.color = "#ff4757"; | |
| } | |
| processBtn.disabled = false; | |
| processBtn.innerText = "Retry Upload"; | |
| videoPreview.classList.remove('video-blur'); | |
| } | |
| function startFakeAIProcessing() { | |
| document.getElementById('mainStatus').innerText = "AI Deep Clean in Progress..."; | |
| processBtn.innerText = "Removing Copyright DNA..."; | |
| progressBar.style.width = "0%"; | |
| let currentStep = 0; | |
| let aiProgress = 0; | |
| const totalTime = 8000; | |
| const stepInterval = totalTime / processingSteps.length; | |
| const textTimer = setInterval(() => { | |
| if (currentStep < processingSteps.length) { | |
| statusText.innerText = processingSteps[currentStep]; | |
| currentStep++; | |
| } else { clearInterval(textTimer); } | |
| }, stepInterval); | |
| const progressTimer = setInterval(() => { | |
| if (aiProgress < 100) { | |
| aiProgress += 1; | |
| progressBar.style.width = aiProgress + "%"; | |
| if(percentageText) percentageText.innerText = "AI Status: " + aiProgress + "%"; | |
| } else { | |
| clearInterval(progressTimer); | |
| completeProcessing(); | |
| } | |
| }, totalTime / 100); | |
| } | |
| function completeProcessing() { | |
| loader.classList.add('loader-hidden'); | |
| downloadArea.classList.add('active'); | |
| downloadArea.classList.remove('download-hidden'); | |
| processBtn.innerText = "Task Completed"; | |
| if(percentageText) percentageText.innerText = "100%"; | |
| } | |
| function resetUI() { | |
| loader.classList.add('loader-hidden'); | |
| processBtn.disabled = false; | |
| processBtn.innerText = "Remove Copyright"; | |
| videoPreview.classList.remove('video-blur'); | |
| } | |
| /* ================= 7. SECURE GATEKEEPER & SMART POPUPS ================= */ | |
| window.isDownloadTriggered = false; | |
| window.openLoginPopup = function(fromDownload) { | |
| window.isDownloadTriggered = fromDownload; | |
| document.getElementById('authPopup').style.display = 'flex'; | |
| }; | |
| window.closePricingPopup = function() { | |
| document.getElementById('pricingPopup').style.display = 'none'; | |
| }; | |
| const downloadBtn = document.getElementById('openPricingBtn'); | |
| if (downloadBtn) { | |
| downloadBtn.addEventListener('click', () => { | |
| if (!USER_LOGGED_IN) { | |
| openLoginPopup(true); | |
| return; | |
| } | |
| if (!USER_HAS_PLAN) { | |
| document.getElementById('pricingPopup').style.display = 'flex'; | |
| return; | |
| } | |
| window.location.href = `download.php?video_id=${currentVideoId}`; | |
| }); | |
| } | |
| /* ================= 8. SCROLL REVEAL OBSERVER ================= */ | |
| const observer = new IntersectionObserver((entries) => { | |
| entries.forEach(entry => { | |
| if (entry.isIntersecting) { | |
| entry.target.classList.add("show"); | |
| } | |
| }); | |
| }, { threshold: 0.1 }); | |
| document.querySelectorAll(".animate, .animate-scale, .animate-fade").forEach(el => observer.observe(el)); | |
| }); | |
| /* ================= 9. URL CLEANUP & AUTO-ACTIONS ================= */ | |
| window.addEventListener('load', () => { | |
| const params = new URLSearchParams(window.location.search); | |
| const status = params.get('status'); | |
| const mode = params.get('mode'); | |
| const action = params.get('action'); | |
| if (action === 'login') { | |
| window.openLoginPopup(false); | |
| const cleanUrl = window.location.protocol + "//" + window.location.host + window.location.pathname; | |
| window.history.replaceState({}, document.title, cleanUrl); | |
| } | |
| if (status === 'paid') { | |
| if (mode === 'sample') { | |
| const link = document.createElement('a'); | |
| link.href = 'processed-videos/sample.mp4'; | |
| link.download = 'Copyright_Removed_Sample.mp4'; | |
| document.body.appendChild(link); | |
| link.click(); | |
| document.body.removeChild(link); | |
| } | |
| const cleanUrl = window.location.protocol + "//" + window.location.host + window.location.pathname; | |
| window.history.replaceState({}, document.title, cleanUrl); | |
| } | |
| }); | |
| const faqSearch = document.getElementById('faqSearch'); | |
| const faqItems = document.querySelectorAll('.faq-item'); | |
| const categories = document.querySelectorAll('.faq-category'); | |
| if(faqSearch) { | |
| faqSearch.addEventListener('input', (e) => { | |
| const term = e.target.value.toLowerCase(); | |
| faqItems.forEach(item => { | |
| const question = item.querySelector('.faq-question span').innerText.toLowerCase(); | |
| const answer = item.querySelector('.faq-answer p').innerText.toLowerCase(); | |
| if (question.includes(term) || answer.includes(term)) { | |
| item.style.display = 'block'; | |
| } else { | |
| item.style.display = 'none'; | |
| } | |
| }); | |
| categories.forEach(cat => { | |
| const visibleItems = cat.querySelectorAll('.faq-item[style="display: block;"]'); | |
| cat.style.display = visibleItems.length > 0 ? 'block' : 'none'; | |
| }); | |
| }); | |
| } | |
| document.querySelectorAll('.faq-question').forEach(q => { | |
| q.addEventListener('click', () => { | |
| const parent = q.parentElement; | |
| const isActive = parent.classList.contains('active'); | |
| document.querySelectorAll('.faq-item').forEach(i => i.classList.remove('active')); | |
| if (!isActive) parent.classList.add('active'); | |
| }); | |
| }); | |
| /* ================= 10. AUTHENTICATION LOGIC ================= */ | |
| let isLoginMode = false; | |
| const authForm = document.getElementById('authForm'); | |
| const toggleAuth = document.getElementById('toggleAuth'); | |
| const authTitle = document.getElementById('authTitle'); | |
| const authBtn = document.getElementById('authBtn'); | |
| const authConfirmPass = document.getElementById('authConfirmPass'); | |
| if (toggleAuth) { | |
| toggleAuth.addEventListener('click', () => { | |
| isLoginMode = !isLoginMode; | |
| authTitle.innerText = isLoginMode ? "Login to Secure Vault" : "Create Secure Account"; | |
| authBtn.innerText = isLoginMode ? "Login & Continue" : "Register & Continue"; | |
| toggleAuth.innerText = isLoginMode ? "Need an account? Register here." : "Already have an account? Login here."; | |
| authConfirmPass.style.display = isLoginMode ? 'none' : 'block'; | |
| authConfirmPass.required = !isLoginMode; | |
| }); | |
| } | |
| if (authForm) { | |
| authForm.addEventListener('submit', (e) => { | |
| e.preventDefault(); | |
| const phoneVal = document.getElementById('authUser').value.trim(); | |
| const pass = document.getElementById('authPass').value; | |
| const confirmPass = authConfirmPass.value; | |
| const action = isLoginMode ? 'login' : 'register'; | |
| const phoneRegex = /^[0-9]{10}$/; | |
| if (!phoneRegex.test(phoneVal)) { | |
| alert("๐จ Please enter a valid 10-digit mobile number!"); | |
| return; | |
| } | |
| if (!isLoginMode && pass !== confirmPass) { | |
| alert("๐จ Passwords do not match!"); | |
| return; | |
| } | |
| const originalText = authBtn.innerText; | |
| authBtn.innerText = "Authenticating..."; | |
| authBtn.disabled = true; | |
| const formData = new FormData(); | |
| formData.append('phone', phoneVal); | |
| formData.append('password', pass); | |
| formData.append('action', action); | |
| fetch('auth.php', { method: 'POST', body: formData }) | |
| .then(async res => { | |
| const text = await res.text(); | |
| try { | |
| const data = JSON.parse(text); | |
| if (data.success) { | |
| USER_LOGGED_IN = true; | |
| USER_HAS_PLAN = (data.is_paid == 1) ? true : false; | |
| document.getElementById('authPopup').style.display = 'none'; | |
| if (!window.isDownloadTriggered) { | |
| window.location.reload(); | |
| } else { | |
| if (!USER_HAS_PLAN) { | |
| document.getElementById('pricingPopup').style.display = 'flex'; | |
| } else { | |
| window.location.href = `download.php?video_id=${currentVideoId}`; | |
| } | |
| } | |
| } else { | |
| alert("Access Denied: " + data.msg); | |
| authBtn.innerText = originalText; | |
| authBtn.disabled = false; | |
| } | |
| } catch(e) { | |
| console.log("Safe Reload:", e); window.location.reload(); | |
| } | |
| }) | |
| .catch(err => { | |
| alert("Network Disconnected."); | |
| authBtn.innerText = originalText; | |
| authBtn.disabled = false; | |
| }); | |
| }); | |
| } | |
| /* ================= 11. REDIRECT TO PLAN ================= */ | |
| window.handlePlanClick = function(amount, planName) { | |
| if (!USER_LOGGED_IN) { | |
| alert("๐ Please Login to purchase a plan."); | |
| window.openLoginPopup(false); | |
| return; | |
| } | |
| const vid = typeof currentVideoId !== 'undefined' && currentVideoId !== null ? currentVideoId : 'SAMPLE_PRO'; | |
| window.location.href = `plan1.php?video_id=${vid}`; | |
| }; | |
| /* ================= 12. SECURITY ================= */ | |
| // |