compressgod / index.html
ayan-84's picture
Create a modern and responsive file compressor web application with a beautiful UI, animations, and SEO optimization.
177edcf verified
Raw History Blame Contribute Delete
23.6 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CompressGod v1.7.3 - Modern File Compression Tool</title>
<meta name="description" content="CompressGod is a powerful online file compression tool supporting ZIP, RAR, PDF, images and more. Reduce file sizes with maximum efficiency.">
<meta name="keywords" content="file compressor, zip, rar, pdf compression, image compression, online tools">
<meta name="author" content="Ayan Ali">
<link rel="icon" type="image/x-icon" href="/static/favicon.ico">
<!-- Schema.org markup for Google -->
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "SoftwareApplication",
"name": "CompressGod",
"version": "1.7.3",
"applicationCategory": "UtilityApplication",
"operatingSystem": "Web",
"offers": {
"@type": "Offer",
"price": "0",
"priceCurrency": "USD"
},
"author": {
"@type": "Person",
"name": "Ayan Ali"
}
}
</script>
<!-- CSS & JS Libraries -->
<script src="https://cdn.tailwindcss.com"></script>
<link href="https://unpkg.com/aos@2.3.1/dist/aos.css" rel="stylesheet">
<script src="https://unpkg.com/aos@2.3.1/dist/aos.js"></script>
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
<script src="https://unpkg.com/feather-icons"></script>
<!-- Custom CSS -->
<style>
:root {
--primary: #6366f1;
--primary-dark: #4f46e5;
--dark: #1e293b;
--light: #f8fafc;
}
.dark {
--dark: #f8fafc;
--light: #1e293b;
}
body {
background-color: var(--light);
color: var(--dark);
transition: all 0.3s ease;
}
.glass-card {
background: rgba(255, 255, 255, 0.1);
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
border: 1px solid rgba(255, 255, 255, 0.2);
box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1);
}
.dark .glass-card {
background: rgba(15, 23, 42, 0.7);
border: 1px solid rgba(255, 255, 255, 0.1);
}
.dropzone {
border: 2px dashed var(--primary);
transition: all 0.3s ease;
}
.dropzone.active {
border-color: var(--primary-dark);
background-color: rgba(99, 102, 241, 0.1);
}
.logo-animation {
animation: logoReveal 1.5s ease forwards;
opacity: 0;
}
@keyframes logoReveal {
0% {
opacity: 0;
transform: translateY(-20px);
}
100% {
opacity: 1;
transform: translateY(0);
}
}
.progress-bar {
transition: width 0.5s ease;
}
.file-item {
transition: all 0.3s ease;
}
.file-item:hover {
transform: translateY(-2px);
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}
.theme-toggle {
transition: all 0.3s ease;
}
.theme-toggle:hover {
transform: rotate(30deg);
}
</style>
</head>
<body class="min-h-screen flex flex-col">
<!-- Header -->
<header class="py-6 px-4 sm:px-6 lg:px-8">
<div class="container mx-auto flex justify-between items-center">
<div class="flex items-center space-x-2 logo-animation">
<img src="http://static.photos/technology/200x200/42" alt="CompressGod Logo" class="w-10 h-10 rounded-lg">
<h1 class="text-2xl font-bold bg-gradient-to-r from-indigo-500 to-purple-600 bg-clip-text text-transparent">CompressGod</h1>
<span class="text-xs bg-indigo-100 text-indigo-800 px-2 py-1 rounded-full">v1.7.3</span>
</div>
<button id="themeToggle" class="theme-toggle p-2 rounded-full bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-200">
<i data-feather="moon" class="dark:hidden"></i>
<i data-feather="sun" class="hidden dark:block"></i>
</button>
</div>
</header>
<!-- Main Content -->
<main class="flex-grow container mx-auto px-4 sm:px-6 lg:px-8 py-12">
<div class="max-w-4xl mx-auto">
<div class="text-center mb-12" data-aos="fade-up">
<h2 class="text-3xl sm:text-4xl font-bold mb-4">Compress Files Like a <span class="text-indigo-600">God</span></h2>
<p class="text-lg text-gray-600 dark:text-gray-300 max-w-2xl mx-auto">
Reduce file sizes with maximum efficiency. Supports ZIP, RAR, PDF, images and more.
</p>
</div>
<!-- File Dropzone -->
<div class="glass-card rounded-2xl p-6 mb-8" data-aos="fade-up" data-aos-delay="100">
<div id="dropzone" class="dropzone rounded-xl p-8 text-center cursor-pointer">
<div class="flex flex-col items-center justify-center space-y-4">
<div class="p-4 bg-indigo-100 dark:bg-indigo-900 rounded-full">
<i data-feather="upload" class="w-8 h-8 text-indigo-600 dark:text-indigo-300"></i>
</div>
<h3 class="text-xl font-semibold">Drag & Drop Files Here</h3>
<p class="text-gray-500 dark:text-gray-400">or click to browse files</p>
<input type="file" id="fileInput" class="hidden" multiple>
<button id="browseBtn" class="px-6 py-2 bg-indigo-600 hover:bg-indigo-700 text-white rounded-lg transition">
Select Files
</button>
</div>
</div>
</div>
<!-- File List -->
<div id="fileList" class="glass-card rounded-2xl p-6 mb-8 hidden" data-aos="fade-up" data-aos-delay="200">
<h3 class="text-xl font-semibold mb-4">Files to Compress</h3>
<div id="filesContainer" class="space-y-3">
<!-- Files will be added here dynamically -->
</div>
</div>
<!-- Compression Options -->
<div id="compressionOptions" class="glass-card rounded-2xl p-6 mb-8 hidden" data-aos="fade-up" data-aos-delay="300">
<h3 class="text-xl font-semibold mb-4">Compression Settings</h3>
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
<div>
<label class="block text-sm font-medium mb-2">Compression Type</label>
<select class="w-full px-4 py-2 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 focus:ring-2 focus:ring-indigo-500">
<option value="zip">ZIP</option>
<option value="rar">RAR</option>
<option value="7z">7-Zip</option>
</select>
</div>
<div>
<label class="block text-sm font-medium mb-2">Compression Level</label>
<select class="w-full px-4 py-2 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 focus:ring-2 focus:ring-indigo-500">
<option value="fast">Fast (Less compression)</option>
<option value="normal" selected>Normal</option>
<option value="maximum">Maximum (Slowest)</option>
</select>
</div>
</div>
</div>
<!-- Progress Section -->
<div id="progressSection" class="glass-card rounded-2xl p-6 hidden" data-aos="fade-up" data-aos-delay="400">
<h3 class="text-xl font-semibold mb-4">Compression Progress</h3>
<div class="space-y-4">
<div>
<div class="flex justify-between mb-1">
<span class="text-sm font-medium">Overall Progress</span>
<span id="progressPercent" class="text-sm font-medium">0%</span>
</div>
<div class="w-full bg-gray-200 dark:bg-gray-700 rounded-full h-2.5">
<div id="progressBar" class="progress-bar bg-indigo-600 h-2.5 rounded-full" style="width: 0%"></div>
</div>
</div>
<div id="fileProgressContainer">
<!-- Individual file progress will be added here -->
</div>
</div>
<button id="compressBtn" class="mt-6 w-full px-6 py-3 bg-indigo-600 hover:bg-indigo-700 text-white rounded-lg font-medium transition">
Start Compression
</button>
</div>
<!-- Results Section -->
<div id="resultsSection" class="glass-card rounded-2xl p-6 hidden" data-aos="fade-up" data-aos-delay="500">
<div class="flex flex-col items-center text-center py-8">
<div class="p-4 bg-green-100 dark:bg-green-900 rounded-full mb-4">
<i data-feather="check-circle" class="w-8 h-8 text-green-600 dark:text-green-300"></i>
</div>
<h3 class="text-xl font-semibold mb-2">Compression Complete!</h3>
<p id="compressionStats" class="text-gray-500 dark:text-gray-400 mb-6"></p>
<div class="flex flex-col sm:flex-row gap-4">
<button id="downloadBtn" class="px-6 py-2 bg-indigo-600 hover:bg-indigo-700 text-white rounded-lg transition">
<i data-feather="download" class="inline mr-2"></i> Download All
</button>
<button id="newCompressionBtn" class="px-6 py-2 border border-indigo-600 text-indigo-600 hover:bg-indigo-50 dark:hover:bg-indigo-900/30 rounded-lg transition">
<i data-feather="plus" class="inline mr-2"></i> New Compression
</button>
</div>
</div>
</div>
</div>
</main>
<!-- Footer -->
<footer class="py-8 px-4 sm:px-6 lg:px-8 bg-gray-100 dark:bg-gray-900/50">
<div class="container mx-auto">
<div class="flex flex-col md:flex-row justify-between items-center">
<div class="mb-4 md:mb-0">
<div class="flex items-center space-x-2">
<img src="http://static.photos/technology/200x200/42" alt="CompressGod Logo" class="w-8 h-8 rounded-lg">
<span class="font-bold">CompressGod v1.7.3</span>
</div>
</div>
<div class="text-center md:text-right">
<p class="text-sm text-gray-600 dark:text-gray-400">Created by <span class="font-medium">Ayan Ali</span></p>
<p class="text-sm text-gray-600 dark:text-gray-400">Contact: ayanalirana84@gmail.com</p>
</div>
</div>
</div>
</footer>
<!-- Scripts -->
<script>
// Initialize AOS animations
AOS.init({
duration: 800,
once: true
});
// Initialize feather icons
feather.replace();
// Theme toggle functionality
const themeToggle = document.getElementById('themeToggle');
const prefersDarkScheme = window.matchMedia('(prefers-color-scheme: dark)');
// Check for saved theme preference or use system preference
const currentTheme = localStorage.getItem('theme') ||
(prefersDarkScheme.matches ? 'dark' : 'light');
document.body.classList.toggle('dark', currentTheme === 'dark');
themeToggle.addEventListener('click', () => {
const isDark = document.body.classList.toggle('dark');
localStorage.setItem('theme', isDark ? 'dark' : 'light');
feather.replace();
});
// File handling functionality
const dropzone = document.getElementById('dropzone');
const fileInput = document.getElementById('fileInput');
const browseBtn = document.getElementById('browseBtn');
const fileList = document.getElementById('fileList');
const compressionOptions = document.getElementById('compressionOptions');
const progressSection = document.getElementById('progressSection');
const resultsSection = document.getElementById('resultsSection');
const filesContainer = document.getElementById('filesContainer');
const fileProgressContainer = document.getElementById('fileProgressContainer');
const progressBar = document.getElementById('progressBar');
const progressPercent = document.getElementById('progressPercent');
const compressionStats = document.getElementById('compressionStats');
const compressBtn = document.getElementById('compressBtn');
const downloadBtn = document.getElementById('downloadBtn');
const newCompressionBtn = document.getElementById('newCompressionBtn');
let files = [];
// Handle drag and drop
['dragenter', 'dragover', 'dragleave', 'drop'].forEach(eventName => {
dropzone.addEventListener(eventName, preventDefaults, false);
});
function preventDefaults(e) {
e.preventDefault();
e.stopPropagation();
}
['dragenter', 'dragover'].forEach(eventName => {
dropzone.addEventListener(eventName, highlight, false);
});
['dragleave', 'drop'].forEach(eventName => {
dropzone.addEventListener(eventName, unhighlight, false);
});
function highlight() {
dropzone.classList.add('active');
}
function unhighlight() {
dropzone.classList.remove('active');
}
dropzone.addEventListener('drop', handleDrop, false);
function handleDrop(e) {
const dt = e.dataTransfer;
const newFiles = dt.files;
handleFiles(newFiles);
}
// Handle file input
browseBtn.addEventListener('click', () => {
fileInput.click();
});
fileInput.addEventListener('change', () => {
handleFiles(fileInput.files);
});
function handleFiles(newFiles) {
files = [...files, ...newFiles];
updateFileList();
if (files.length > 0) {
fileList.classList.remove('hidden');
compressionOptions.classList.remove('hidden');
progressSection.classList.remove('hidden');
resultsSection.classList.add('hidden');
}
}
function updateFileList() {
filesContainer.innerHTML = '';
files.forEach((file, index) => {
const fileItem = document.createElement('div');
fileItem.className = 'file-item flex items-center justify-between p-3 bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700';
const fileInfo = document.createElement('div');
fileInfo.className = 'flex items-center space-x-3';
const icon = document.createElement('div');
icon.className = 'p-2 bg-gray-100 dark:bg-gray-700 rounded-lg';
icon.innerHTML = '<i data-feather="file" class="w-5 h-5 text-gray-500 dark:text-gray-400"></i>';
const fileName = document.createElement('div');
fileName.className = 'truncate max-w-xs';
fileName.textContent = file.name;
const fileSize = document.createElement('div');
fileSize.className = 'text-sm text-gray-500 dark:text-gray-400';
fileSize.textContent = formatFileSize(file.size);
fileInfo.appendChild(icon);
fileInfo.appendChild(fileName);
fileInfo.appendChild(fileSize);
const removeBtn = document.createElement('button');
removeBtn.className = 'p-1 text-gray-400 hover:text-red-500 transition';
removeBtn.innerHTML = '<i data-feather="x" class="w-5 h-5"></i>';
removeBtn.addEventListener('click', () => removeFile(index));
fileItem.appendChild(fileInfo);
fileItem.appendChild(removeBtn);
filesContainer.appendChild(fileItem);
});
feather.replace();
}
function removeFile(index) {
files.splice(index, 1);
updateFileList();
if (files.length === 0) {
fileList.classList.add('hidden');
compressionOptions.classList.add('hidden');
progressSection.classList.add('hidden');
}
}
function formatFileSize(bytes) {
if (bytes === 0) return '0 Bytes';
const k = 1024;
const sizes = ['Bytes', 'KB', 'MB', 'GB'];
const i = Math.floor(Math.log(bytes) / Math.log(k));
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
}
// Compression simulation
compressBtn.addEventListener('click', () => {
simulateCompression();
});
function simulateCompression() {
progressSection.classList.remove('hidden');
compressBtn.disabled = true;
compressBtn.innerHTML = '<i data-feather="loader" class="animate-spin inline mr-2"></i> Compressing...';
feather.replace();
fileProgressContainer.innerHTML = '';
// Create progress bars for each file
files.forEach((file, index) => {
const fileProgress = document.createElement('div');
fileProgress.className = 'mb-4';
const fileName = document.createElement('div');
fileName.className = 'flex justify-between mb-1';
const nameSpan = document.createElement('span');
nameSpan.className = 'text-sm font-medium truncate max-w-xs';
nameSpan.textContent = file.name;
const percentSpan = document.createElement('span');
percentSpan.className = 'text-sm font-medium';
percentSpan.id = `filePercent-${index}`;
percentSpan.textContent = '0%';
fileName.appendChild(nameSpan);
fileName.appendChild(percentSpan);
const progressBar = document.createElement('div');
progressBar.className = 'w-full bg-gray-200 dark:bg-gray-700 rounded-full h-2.5';
const progressBarInner = document.createElement('div');
progressBarInner.className = 'progress-bar bg-indigo-600 h-2.5 rounded-full';
progressBarInner.id = `fileProgress-${index}`;
progressBarInner.style.width = '0%';
progressBar.appendChild(progressBarInner);
fileProgress.appendChild(fileName);
fileProgress.appendChild(progressBar);
fileProgressContainer.appendChild(fileProgress);
});
// Simulate compression progress
let overallProgress = 0;
const totalFiles = files.length;
const progressPerFile = 100 / totalFiles;
files.forEach((file, index) => {
let fileProgress = 0;
const fileInterval = setInterval(() => {
fileProgress += Math.random() * 5;
if (fileProgress >= 100) {
fileProgress = 100;
clearInterval(fileInterval);
// Update overall progress
overallProgress += progressPerFile;
const overallPercent = Math.min(100, Math.round(overallProgress));
progressBar.style.width = `${overallPercent}%`;
progressPercent.textContent = `${overallPercent}%`;
// Check if all files are done
if (overallPercent >= 100) {
compressionComplete();
}
}
document.getElementById(`fileProgress-${index}`).style.width = `${fileProgress}%`;
document.getElementById(`filePercent-${index}`).textContent = `${Math.round(fileProgress)}%`;
}, 100);
});
}
function compressionComplete() {
setTimeout(() => {
progressSection.classList.add('hidden');
resultsSection.classList.remove('hidden');
// Calculate compression stats
const totalSize = files.reduce((sum, file) => sum + file.size, 0);
const compressedSize = Math.round(totalSize * (0.3 + Math.random() * 0.4)); // Random compression between 30-70%
const compressionRatio = ((totalSize - compressedSize) / totalSize * 100).toFixed(2);
compressionStats.textContent = `Compressed ${files.length} files from ${formatFileSize(totalSize)} to ${formatFileSize(compressedSize)} (${compressionRatio}% reduction)`;
compressBtn.disabled = false;
compressBtn.innerHTML = 'Start Compression';
}, 500);
}
// Download button
downloadBtn.addEventListener('click', () => {
alert('Download functionality would be implemented in a real application');
});
// New compression button
newCompressionBtn.addEventListener('click', () => {
files = [];
fileInput.value = '';
updateFileList();
fileList.classList.add('hidden');
compressionOptions.classList.add('hidden');
progressSection.classList.add('hidden');
resultsSection.classList.add('hidden');
progressBar.style.width = '0%';
progressPercent.textContent = '0%';
});
</script>
</body>
</html>