Spaces:
Running
Running
File size: 19,683 Bytes
3efee68 | 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 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 | // Initialize data
let sites = JSON.parse(localStorage.getItem('sites')) || [];
let ads = JSON.parse(localStorage.getItem('ads')) || [];
// Default sites data if empty
if (sites.length === 0) {
sites = [
{
id: 1,
name: "Stable Diffusion",
category: "ai",
url: "https://stability.ai",
replaces: "Midjourney, DALL-E",
description: "Open-source AI image generation model that creates detailed images from text descriptions. Free to use with local installation.",
image: "http://static.photos/ai/640x360/1",
affiliate: ""
},
{
id: 2,
name: "GIMP",
category: "design",
url: "https://www.gimp.org",
replaces: "Adobe Photoshop",
description: "GNU Image Manipulation Program is a free and open-source raster graphics editor used for image retouching and editing.",
image: "http://static.photos/design/640x360/2",
affiliate: ""
},
{
id: 3,
name: "Krita",
category: "design",
url: "https://krita.org",
replaces: "Adobe Illustrator",
description: "Professional free and open source painting program made by artists for artists.",
image: "http://static.photos/art/640x360/3",
affiliate: ""
},
{
id: 4,
name: "DaVinci Resolve",
category: "audio",
url: "https://www.blackmagicdesign.com/products/davinciresolve",
replaces: "Adobe Premiere",
description: "Professional video editing, color correction, visual effects and audio post production software with a free version.",
image: "http://static.photos/technology/640x360/4",
affiliate: ""
},
{
id: 5,
name: "Audacity",
category: "audio",
url: "https://www.audacityteam.org",
replaces: "Adobe Audition",
description: "Free, open source, cross-platform audio software for multi-track recording and editing.",
image: "http://static.photos/audio/640x360/5",
affiliate: ""
},
{
id: 6,
name: "LibreOffice",
category: "productivity",
url: "https://www.libreoffice.org",
replaces: "Microsoft Office",
description: "Free and open-source office suite, a project of The Document Foundation.",
image: "http://static.photos/office/640x360/6",
affiliate: ""
},
{
id: 7,
name: "Notion Free",
category: "productivity",
url: "https://www.notion.so",
replaces: "Evernote Premium",
description: "All-in-one workspace for notes, tasks, wikis, and databases. Generous free tier available.",
image: "http://static.photos/workspace/640x360/7",
affiliate: ""
},
{
id: 8,
name: "OBS Studio",
category: "ai",
url: "https://obsproject.com",
replaces: "Streamlabs paid",
description: "Free and open source software for video recording and live streaming.",
image: "http://static.photos/technology/640x360/8",
affiliate: ""
},
{
id: 9,
name: "League of Legends",
category: "gaming",
url: "https://www.leagueoflegends.com",
replaces: "Paid AAA games",
description: "Free-to-play multiplayer online battle arena game with millions of active players worldwide.",
image: "http://static.photos/gaming/640x360/9",
affiliate: ""
},
{
id: 10,
name: "Blender",
category: "design",
url: "https://www.blender.org",
replaces: "Maya, 3ds Max",
description: "Free and open-source 3D computer graphics software toolset used for creating animated films, visual effects, art, and more.",
image: "http://static.photos/technology/640x360/10",
affiliate: ""
},
{
id: 11,
name: "WooCommerce",
category: "commerce",
url: "https://woocommerce.com",
replaces: "Shopify",
description: "Open-source e-commerce plugin for WordPress. Free to use with hosting costs only.",
image: "http://static.photos/commerce/640x360/11",
affiliate: ""
},
{
id: 12,
name: "Strava Free",
category: "sports",
url: "https://www.strava.com",
replaces: "Premium fitness apps",
description: "Track your running and cycling, analyze your performance, compete with friends all for free.",
image: "http://static.photos/sport/640x360/12",
affiliate: ""
},
{
id: 13,
name: "OpenAI Playground",
category: "ai",
url: "https://platform.openai.com",
replaces: "ChatGPT Plus",
description: "Access GPT models with free credits when you sign up. Great for experimenting with AI.",
image: "http://static.photos/technology/640x360/13",
affiliate: ""
},
{
id: 14,
name: "Udio Free",
category: "audio",
url: "https://www.udio.ai",
replaces: "Suno AI",
description: "AI music generation platform with free tier allowing you to create songs from text prompts.",
image: "http://static.photos/music/640x360/14",
affiliate: ""
},
{
id: 15,
name: "Canva Free",
category: "design",
url: "https://www.canva.com",
replaces: "Adobe Creative Suite",
description: "Graphic design platform with robust free tier for creating social media graphics, presentations, and more.",
image: "http://static.photos/design/640x360/15",
affiliate: ""
}
];
localStorage.setItem('sites', JSON.stringify(sites));
}
// Default ads if empty
if (ads.length === 0) {
ads = [
{
id: 1,
title: "Premium Web Hosting",
advertiser: "HostMaster Pro",
content: "<a href='#' class='flex items-center justify-center space-x-4'><div class='bg-gradient-to-r from-blue-500 to-purple-600 text-white px-6 py-2 rounded-full font-bold'>Get 50% Off Hosting</div><span class='text-gray-700'>Reliable hosting for your free sites!</span></a>",
position: "top",
startDate: "2025-01-01",
endDate: "2025-12-31",
price: 99.99,
active: true
},
{
id: 2,
title: "AI Tools Bundle",
advertiser: "AITools Inc",
content: "<div class='bg-gradient-to-br from-purple-100 to-pink-100 p-4 rounded-lg text-center'><h4 class='font-bold text-purple-800'>Premium AI Tools</h4><p class='text-sm text-gray-600 mt-2'>Upgrade your workflow today!</p><button class='mt-2 bg-purple-600 text-white px-4 py-1 rounded text-sm'>Learn More</button></div>",
position: "sidebar1",
startDate: "2025-01-01",
endDate: "2025-12-31",
price: 149.99,
active: true
},
{
id: 3,
title: "Design Course",
advertiser: "DesignAcademy",
content: "<div class='bg-orange-50 border-l-4 border-orange-500 p-4'><h4 class='font-bold text-orange-800'>Master Design</h4><p class='text-sm mt-1'>Learn from pros</p></div>",
position: "sidebar2",
startDate: "2025-01-01",
endDate: "2025-12-31",
price: 79.99,
active: true
},
{
id: 4,
title: "VPN Service",
advertiser: "SecureNet",
content: "<div class='flex items-center justify-center space-x-4'><div class='text-center'><h4 class='font-bold text-green-600'>Secure Your Connection</h4><p class='text-sm'>30% off Premium VPN</p></div></div>",
position: "bottom",
startDate: "2025-01-01",
endDate: "2025-12-31",
price: 199.99,
active: true
}
];
localStorage.setItem('ads', JSON.stringify(ads));
}
// Render sites
function renderSites(filter = 'all', search = '') {
const grid = document.getElementById('sitesGrid');
let filteredSites = sites;
if (filter !== 'all') {
filteredSites = sites.filter(site => site.category === filter);
}
if (search) {
filteredSites = filteredSites.filter(site =>
site.name.toLowerCase().includes(search.toLowerCase()) ||
site.description.toLowerCase().includes(search.toLowerCase()) ||
site.replaces.toLowerCase().includes(search.toLowerCase())
);
}
if (filteredSites.length === 0) {
grid.innerHTML = '<div class="col-span-full text-center py-12 text-gray-500"><i data-lucide="search-x" class="w-12 h-12 mx-auto mb-4"></i><p>No sites found. Try a different search or category.</p></div>';
lucide.createIcons();
return;
}
grid.innerHTML = filteredSites.map(site => `
<div class="bg-white rounded-xl shadow-md overflow-hidden card-hover border border-gray-100">
<div class="h-48 bg-gray-200 relative overflow-hidden">
<img src="${site.image}" alt="${site.name}" class="w-full h-full object-cover" onerror="this.src='http://static.photos/tech/640x360/1'">
<div class="absolute top-4 right-4 bg-white/90 backdrop-blur px-3 py-1 rounded-full text-xs font-bold text-purple-600 uppercase tracking-wide">
${site.category}
</div>
</div>
<div class="p-6">
<div class="flex items-center mb-2">
<span class="text-xs font-semibold text-red-500 bg-red-50 px-2 py-1 rounded mr-2">Free Alternative to ${site.replaces}</span>
</div>
<h3 class="text-xl font-bold text-gray-900 mb-2">${site.name}</h3>
<p class="text-gray-600 text-sm mb-4 line-clamp-2">${site.description}</p>
<div class="flex space-x-2">
<a href="${site.affiliate || site.url}" target="_blank" class="flex-1 bg-purple-600 text-white text-center py-2 rounded-lg hover:bg-purple-700 transition font-medium text-sm">
Visit Site
</a>
${site.affiliate ? `<a href="${site.url}" target="_blank" class="px-3 py-2 border border-gray-300 rounded-lg hover:bg-gray-50 transition"><i data-lucide="external-link" class="w-4 h-4"></i></a>` : ''}
</div>
</div>
</div>
`).join('');
lucide.createIcons();
}
// Filter functionality
function filterCategory(category) {
// Update active button
document.querySelectorAll('.category-btn').forEach(btn => {
btn.classList.remove('category-active');
btn.classList.remove('text-white');
});
event.target.classList.add('category-active');
const searchValue = document.getElementById('searchInput').value;
renderSites(category, searchValue);
}
// Search functionality
document.getElementById('searchInput').addEventListener('input', function(e) {
const activeCategory = document.querySelector('.category-active').textContent.toLowerCase();
const categoryMap = {
'all': 'all',
'ai tools': 'ai',
'design': 'design',
'audio/music': 'audio',
'gaming': 'gaming',
'e-commerce': 'commerce',
'sports': 'sports',
'productivity': 'productivity'
};
const cat = categoryMap[activeCategory] || 'all';
renderSites(cat, e.target.value);
});
// Ad rotation and display
function displayAds() {
const today = new Date().toISOString().split('T')[0];
const activeAds = ads.filter(ad => ad.startDate <= today && ad.endDate >= today && ad.active);
// Group by position
const topAds = activeAds.filter(ad => ad.position === 'top');
const sidebar1Ads = activeAds.filter(ad => ad.position === 'sidebar1');
const sidebar2Ads = activeAds.filter(ad => ad.position === 'sidebar2');
const bottomAds = activeAds.filter(ad => ad.position === 'bottom');
// Rotate ads randomly
function getRandomAd(adArray) {
if (adArray.length === 0) return null;
return adArray[Math.floor(Math.random() * adArray.length)];
}
// Display ads
const topAd = getRandomAd(topAds);
const sidebar1Ad = getRandomAd(sidebar1Ads);
const sidebar2Ad = getRandomAd(sidebar2Ads);
const bottomAd = getRandomAd(bottomAds);
if (topAd) {
document.getElementById('adTop').innerHTML = `<div class="ad-banner">${topAd.content}</div>`;
} else {
document.getElementById('adTop').style.display = 'none';
}
if (sidebar1Ad) {
document.getElementById('sidebarAd1').innerHTML = `<div class="ad-banner h-full">${sidebar1Ad.content}</div>`;
} else {
document.getElementById('sidebarAd1').style.display = 'none';
}
if (sidebar2Ad) {
document.getElementById('sidebarAd2').innerHTML = `<div class="ad-banner h-full">${sidebar2Ad.content}</div>`;
} else {
document.getElementById('sidebarAd2').style.display = 'none';
}
if (bottomAd) {
document.getElementById('adBottomContent').innerHTML = `<div class="ad-banner">${bottomAd.content}</div>`;
} else {
document.getElementById('adBottom').style.display = 'none';
}
}
// Close bottom ad
function closeBottomAd() {
document.getElementById('adBottom').style.display = 'none';
}
// Toggle pricing fields visibility
function togglePricingFields() {
const type = document.getElementById('inquiryType').value;
const pricingFields = document.getElementById('pricingFields');
const submitBtnText = document.getElementById('submitBtnText');
const paymentNote = document.getElementById('paymentNote');
if (type === 'ad-pricing' || type === 'place-ad') {
pricingFields.classList.remove('hidden');
submitBtnText.textContent = type === 'place-ad' ? 'Submit Ad Request' : 'Request Pricing Info';
if (type === 'place-ad') {
paymentNote.classList.remove('hidden');
} else {
paymentNote.classList.add('hidden');
}
} else {
pricingFields.classList.add('hidden');
submitBtnText.textContent = 'Send Inquiry';
paymentNote.classList.add('hidden');
}
lucide.createIcons();
}
// Inquiry Form Handler
document.getElementById('inquiryForm')?.addEventListener('submit', function(e) {
e.preventDefault();
const name = document.getElementById('inquiryName').value;
const email = document.getElementById('inquiryEmail').value;
const phone = document.getElementById('inquiryPhone').value;
const company = document.getElementById('inquiryCompany').value;
const type = document.getElementById('inquiryType').value;
const message = document.getElementById('inquiryMessage').value;
const subscribe = document.getElementById('subscribeUpdates').checked;
// Get pricing info if applicable
let pricingInfo = '';
let totalAmount = '';
if (type === 'ad-pricing' || type === 'place-ad') {
const selectedDuration = document.querySelector('input[name="adDuration"]:checked');
if (selectedDuration) {
const durationMap = {
'1week': '1 Week - $5.00',
'3weeks': '3 Weeks - $10.00',
'1month': '1 Month - $15.00'
};
pricingInfo = durationMap[selectedDuration.value];
const amountMap = {
'1week': '5',
'3weeks': '10',
'1month': '15'
};
totalAmount = amountMap[selectedDuration.value];
}
const position = document.getElementById('adPosition')?.value || 'Not specified';
pricingInfo += `%0D%0AAd Position: ${position}`;
}
// Create email body with all details
let subject = `Inquiry: ${type.split('-').map(w => w.charAt(0).toUpperCase() + w.slice(1)).join(' ')} - Free Sites 4 You`;
let body = `Name: ${name}%0D%0AEmail: ${email}%0D%0APhone: ${phone || 'Not provided'}%0D%0ACompany: ${company || 'Not provided'}%0D%0AInquiry Type: ${type}%0D%0A`;
if (pricingInfo) {
body += `Selected Package: ${pricingInfo}%0D%0A`;
body += `PayPal Payment: https://www.paypal.com/paypalme/levytmwale/${totalAmount}%0D%0A`;
}
body += `%0D%0AMessage:%0D%0A${message}%0D%0A`;
if (subscribe) {
body += `%0D%0A[User opted in to receive updates]`;
}
// Open email client
window.location.href = `mailto:levtmwale@gmail.com?subject=${subject}&body=${body}`;
// Show success message with different text based on inquiry type
let successMsg = 'Thank you for your inquiry! Your email client should open with a pre-filled message.';
if (type === 'place-ad') {
successMsg += ' Please complete payment at https://www.paypal.com/paypalme/levytmwale/' + totalAmount + ' to finalize your ad placement.';
}
if (!subscribe) {
successMsg += ' Don\'t miss out - consider subscribing to updates!';
}
alert(successMsg);
this.reset();
togglePricingFields();
});
// Email Signup Form Handler
document.getElementById('emailSignupForm')?.addEventListener('submit', function(e) {
e.preventDefault();
const name = document.getElementById('signupName').value;
const email = document.getElementById('signupEmail').value;
const interest = document.getElementById('signupInterest').value;
// Send confirmation email
const interestText = {
'pricing': 'Advertising Pricing Updates',
'new-tools': 'New Free Tools',
'both': 'Both Updates',
'partnerships': 'Partnership Opportunities'
};
const subject = 'New Subscriber - Free Sites 4 You Updates';
const body = `New subscriber request:%0D%0A%0D%0AName: ${name}%0D%0AEmail: ${email}%0D%0AInterest: ${interestText[interest]}%0D%0A%0D%0APlease add to mailing list.`;
window.location.href = `mailto:levtmwale@gmail.com?subject=${subject}&body=${body}`;
// Also save to local storage for admin
const subscribers = JSON.parse(localStorage.getItem('subscribers') || '[]');
subscribers.push({
name,
email,
interest,
date: new Date().toISOString(),
id: Date.now()
});
localStorage.setItem('subscribers', JSON.stringify(subscribers));
alert(`Thank you for subscribing, ${name}! You'll receive updates about ${interestText[interest].toLowerCase()} at ${email}. Check your email to confirm.`);
this.reset();
});
// Donation amount selector
function donateAmount(amount) {
window.open(`https://www.paypal.com/paypalme/levtmwale/${amount}`, '_blank');
}
// Initialize
document.addEventListener('DOMContentLoaded', function() {
renderSites();
displayAds();
// Rotate ads every 30 seconds
setInterval(displayAds, 30000);
// Recreate icons for new elements
if (typeof lucide !== 'undefined') {
lucide.createIcons();
}
}); |