Spaces:
Running
Running
File size: 15,158 Bytes
d2be290 | 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 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>QRify - URL to QR Code Converter</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<script src="https://cdn.jsdelivr.net/npm/qrcode-generator@1.4.4/qrcode.min.js"></script>
<style>
.gradient-bg {
background: linear-gradient(135deg, #6e8efb, #a777e3);
}
.qr-code-container {
transition: all 0.3s ease;
}
.qr-code-container:hover {
transform: translateY(-5px);
box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}
.input-field:focus {
box-shadow: 0 0 0 3px rgba(167, 119, 227, 0.5);
}
.download-btn {
transition: all 0.2s ease;
}
.download-btn:hover {
transform: scale(1.05);
}
@keyframes pulse {
0%, 100% {
opacity: 1;
}
50% {
opacity: 0.5;
}
}
.animate-pulse {
animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
</style>
</head>
<body class="min-h-screen gradient-bg text-gray-100">
<div class="container mx-auto px-4 py-12">
<!-- Header -->
<header class="text-center mb-12">
<h1 class="text-4xl md:text-5xl font-bold mb-4">
<i class="fas fa-qrcode mr-3"></i>QRify
</h1>
<p class="text-xl md:text-2xl opacity-90">Convert any URL into a shareable QR code</p>
</header>
<!-- Main Content -->
<main class="max-w-3xl mx-auto">
<!-- Input Section -->
<div class="bg-white bg-opacity-10 backdrop-filter backdrop-blur-lg rounded-xl p-6 mb-8 shadow-xl">
<div class="flex flex-col md:flex-row gap-4">
<input
type="url"
id="urlInput"
placeholder="Enter your URL (e.g., https://example.com)"
class="input-field flex-grow px-4 py-3 rounded-lg bg-white bg-opacity-20 border border-white border-opacity-30 focus:outline-none focus:border-purple-300 placeholder-white placeholder-opacity-70"
>
<button
id="generateBtn"
class="px-6 py-3 bg-purple-600 hover:bg-purple-700 rounded-lg font-semibold transition-colors flex items-center justify-center"
>
<i class="fas fa-bolt mr-2"></i> Generate
</button>
<button
id="resetBtn"
class="px-6 py-3 bg-white bg-opacity-20 hover:bg-opacity-30 rounded-lg font-semibold transition-colors flex items-center justify-center"
>
<i class="fas fa-undo mr-2"></i> Reset
</button>
</div>
<div id="errorMessage" class="mt-2 text-red-300 text-sm hidden"></div>
</div>
<!-- QR Code Display Section -->
<div id="qrSection" class="hidden">
<div class="bg-white bg-opacity-10 backdrop-filter backdrop-blur-lg rounded-xl p-8 shadow-xl">
<h2 class="text-2xl font-semibold mb-6 text-center">Your QR Code is Ready!</h2>
<div class="flex flex-col lg:flex-row items-center gap-8">
<!-- QR Code Container -->
<div class="qr-code-container bg-white p-4 rounded-lg flex-1 max-w-xs mx-auto">
<div id="qrCode" class="w-full h-full"></div>
</div>
<!-- Details and Actions -->
<div class="flex-1">
<div class="mb-6">
<h3 class="text-lg font-medium mb-2">Destination URL:</h3>
<p id="destinationUrl" class="break-all bg-white bg-opacity-10 px-3 py-2 rounded"></p>
</div>
<div class="flex flex-wrap gap-3">
<button id="downloadBtn" class="download-btn px-5 py-2 bg-white text-purple-700 rounded-lg font-medium flex items-center">
<i class="fas fa-download mr-2"></i> Download
</button>
<button id="shareBtn" class="download-btn px-5 py-2 bg-purple-600 hover:bg-purple-700 rounded-lg font-medium flex items-center">
<i class="fas fa-share-alt mr-2"></i> Share
</button>
<button id="copyBtn" class="download-btn px-5 py-2 bg-white bg-opacity-20 hover:bg-opacity-30 rounded-lg font-medium flex items-center">
<i class="fas fa-copy mr-2"></i> Copy Link
</button>
</div>
</div>
</div>
</div>
</div>
<!-- Loading State -->
<div id="loadingSection" class="hidden text-center py-12">
<div class="animate-pulse flex flex-col items-center">
<div class="w-16 h-16 bg-white bg-opacity-20 rounded-full mb-4"></div>
<div class="h-4 bg-white bg-opacity-20 rounded w-1/3 mb-2"></div>
<div class="h-4 bg-white bg-opacity-20 rounded w-1/2"></div>
</div>
</div>
</main>
<!-- Features Section -->
<section class="max-w-6xl mx-auto mt-16">
<h2 class="text-2xl md:text-3xl font-bold text-center mb-8">Why Use QRify?</h2>
<div class="grid grid-cols-1 md:grid-cols-3 gap-6">
<div class="bg-white bg-opacity-10 backdrop-filter backdrop-blur-lg rounded-xl p-6">
<div class="text-purple-300 mb-4 text-3xl">
<i class="fas fa-bolt"></i>
</div>
<h3 class="text-xl font-semibold mb-2">Instant Generation</h3>
<p class="opacity-90">Create QR codes in seconds with our lightning-fast generator.</p>
</div>
<div class="bg-white bg-opacity-10 backdrop-filter backdrop-blur-lg rounded-xl p-6">
<div class="text-purple-300 mb-4 text-3xl">
<i class="fas fa-share-alt"></i>
</div>
<h3 class="text-xl font-semibold mb-2">Easy Sharing</h3>
<p class="opacity-90">Share your QR codes effortlessly with friends, colleagues, or customers.</p>
</div>
<div class="bg-white bg-opacity-10 backdrop-filter backdrop-blur-lg rounded-xl p-6">
<div class="text-purple-300 mb-4 text-3xl">
<i class="fas fa-mobile-alt"></i>
</div>
<h3 class="text-xl font-semibold mb-2">Mobile Friendly</h3>
<p class="opacity-90">Works perfectly on all devices, from smartphones to desktops.</p>
</div>
</div>
</section>
<!-- Footer -->
<footer class="mt-16 text-center text-white text-opacity-70 text-sm">
<p>Made with <i class="fas fa-heart text-red-400"></i> by QRify Team</p>
<p class="mt-1">© 2023 QRify - All rights reserved</p>
</footer>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
const urlInput = document.getElementById('urlInput');
const generateBtn = document.getElementById('generateBtn');
const resetBtn = document.getElementById('resetBtn');
const qrSection = document.getElementById('qrSection');
const loadingSection = document.getElementById('loadingSection');
const errorMessage = document.getElementById('errorMessage');
const destinationUrl = document.getElementById('destinationUrl');
const downloadBtn = document.getElementById('downloadBtn');
const shareBtn = document.getElementById('shareBtn');
const copyBtn = document.getElementById('copyBtn');
const qrCodeContainer = document.getElementById('qrCode');
let currentQRCode = null;
let currentUrl = '';
// Generate QR Code
generateBtn.addEventListener('click', generateQRCode);
urlInput.addEventListener('keypress', function(e) {
if (e.key === 'Enter') {
generateQRCode();
}
});
function generateQRCode() {
const url = urlInput.value.trim();
// Validate URL
if (!url) {
showError('Please enter a URL');
return;
}
try {
// Add https:// if not present
let formattedUrl = url;
if (!url.startsWith('http://') && !url.startsWith('https://')) {
formattedUrl = 'https://' + url;
}
new URL(formattedUrl); // This will throw if invalid
// Show loading
loadingSection.classList.remove('hidden');
qrSection.classList.add('hidden');
errorMessage.classList.add('hidden');
// Simulate loading (for demo purposes)
setTimeout(() => {
createQRCode(formattedUrl);
loadingSection.classList.add('hidden');
qrSection.classList.remove('hidden');
}, 800);
} catch (e) {
showError('Please enter a valid URL');
}
}
function createQRCode(url) {
currentUrl = url;
destinationUrl.textContent = url;
// Clear previous QR code
qrCodeContainer.innerHTML = '';
// Generate new QR code
const qr = qrcode(0, 'L');
qr.addData(url);
qr.make();
// Create QR code image
const qrImg = qr.createImgTag(4, 0);
qrCodeContainer.innerHTML = qrImg;
currentQRCode = qr;
}
function showError(message) {
errorMessage.textContent = message;
errorMessage.classList.remove('hidden');
}
// Download QR Code
downloadBtn.addEventListener('click', function() {
if (!currentQRCode) return;
const canvas = document.createElement('canvas');
const ctx = canvas.getContext('2d');
const size = currentQRCode.getModuleCount() * 4;
canvas.width = size;
canvas.height = size;
// Create QR code pixels
for (let row = 0; row < currentQRCode.getModuleCount(); row++) {
for (let col = 0; col < currentQRCode.getModuleCount(); col++) {
ctx.fillStyle = currentQRCode.isDark(row, col) ? '#000000' : '#ffffff';
ctx.fillRect(col * 4, row * 4, 4, 4);
}
}
// Convert to image and download
canvas.toBlob(function(blob) {
const link = document.createElement('a');
link.download = `qrify-${new Date().getTime()}.png`;
link.href = URL.createObjectURL(blob);
link.click();
}, 'image/png');
});
// Share QR Code
shareBtn.addEventListener('click', function() {
if (!currentQRCode || !navigator.share) {
// Fallback for browsers that don't support Web Share API
alert('Web Share API not supported in your browser. Please download the QR code instead.');
return;
}
navigator.share({
title: 'Check out this QR code',
text: `Scan this QR code to visit ${currentUrl}`,
url: currentUrl
}).catch(err => {
console.log('Error sharing:', err);
});
});
// Copy URL to clipboard
copyBtn.addEventListener('click', function() {
if (!currentUrl) return;
navigator.clipboard.writeText(currentUrl).then(() => {
// Show copied feedback
const originalText = copyBtn.innerHTML;
copyBtn.innerHTML = '<i class="fas fa-check mr-2"></i> Copied!';
setTimeout(() => {
copyBtn.innerHTML = originalText;
}, 2000);
}).catch(err => {
console.error('Could not copy text: ', err);
});
});
// Reset functionality
resetBtn.addEventListener('click', function() {
urlInput.value = '';
qrSection.classList.add('hidden');
errorMessage.classList.add('hidden');
urlInput.focus();
});
// Focus input on page load
urlInput.focus();
});
</script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=FaxMe/qr-code-generator" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html> |