dbeck22's picture
The config maker should ask for the website url as well. Also lets make this a members website but we can allow free members to use with ads (using google adsense) and paid members will have less ads and more features
812f3ab verified
// Main application script
document.addEventListener('DOMContentLoaded', function() {
// Inject Google AdSense for free members
const isPaidMember = false; // Would be set based on auth status
if (!isPaidMember) {
const adScript = document.createElement('script');
adScript.src = 'https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-XXXXXXXXXXXXXXXX';
adScript.async = true;
adScript.crossOrigin = 'anonymous';
document.head.appendChild(adScript);
// Show ad placeholder divs
const adDivs = document.querySelectorAll('.ad-unit');
adDivs.forEach(div => div.style.display = 'block');
}
// Initialize file upload display
const configFileInput = document.getElementById('configFile');
if (configFileInput) {
configFileInput.addEventListener('change', function(e) {
const fileNameDisplay = document.getElementById('fileName');
if (this.files.length > 0) {
fileNameDisplay.textContent = this.files[0].name;
} else {
fileNameDisplay.textContent = 'No file chosen';
}
});
}
// Simulate content generation
const generateBtn = document.querySelector('button[data-generate]');
if (generateBtn) {
generateBtn.addEventListener('click', function() {
const resultSection = document.getElementById('resultSection');
if (resultSection) {
resultSection.classList.remove('hidden');
resultSection.classList.add('fade-in');
// Scroll to results
setTimeout(() => {
resultSection.scrollIntoView({ behavior: 'smooth' });
}, 300);
}
});
}
// Tab functionality for config builder
const tabs = document.querySelectorAll('[data-tab]');
if (tabs.length > 0) {
tabs.forEach(tab => {
tab.addEventListener('click', function() {
const tabName = this.getAttribute('data-tab');
const tabContents = document.querySelectorAll('.tab-content');
// Hide all tab contents
tabContents.forEach(content => {
content.classList.add('hidden');
});
// Show selected tab content
const activeContent = document.getElementById(tabName);
if (activeContent) {
activeContent.classList.remove('hidden');
}
// Update active tab styling
tabs.forEach(t => {
t.classList.remove('border-primary', 'text-primary');
t.classList.add('border-transparent', 'text-gray-500');
});
this.classList.remove('border-transparent', 'text-gray-500');
this.classList.add('border-primary', 'text-primary');
});
});
}
});