Loading Clickbait Generator...
${bodyContent}
`;
// 3. Execute the Logic
const scriptEl = document.createElement('script');
scriptEl.text = scriptContent;
document.body.appendChild(scriptEl);
// 4. OVERRIDE THE POPUP LOGIC TO SHOW IN-PAGE
// Highjacking the tool's original openPopup function
window.openPopup = function() {
const emptyState = document.getElementById('empty-state');
const outputSection = document.getElementById('output-area') || document.getElementById('output');
const listContainer = document.getElementById('clickbait-results-list');
if(emptyState) emptyState.style.display = 'none';
if(outputSection) outputSection.style.display = 'block';
listContainer.innerHTML = '';
// Use the tool's internal array (usually allTitles or allPOVs)
const items = (typeof allTitles !== 'undefined') ? allTitles : (typeof allPOVs !== 'undefined' ? allPOVs : []);
items.forEach((t, i) => {
const card = document.createElement('div');
card.className = 'tc'; // Use the tool's native title card class
card.innerHTML = `
TITLE #${i+1}
${t.type || 'Viral'}
${t.open} ${t.topic} ${t.sass} ${t.twist}. ${t.close}