levitee's picture
Initial DeepSite commit
3efee68 verified
Raw History Blame Contribute Delete
19.7 kB
// 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();
}
});