1dee / index.html
amwolf36's picture
as paginas de configuração nao estao funcionando - Follow Up Deployment
61f0ea4 verified
Raw History Blame Contribute Delete
96.7 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>AI Ebook Generator - Pro (Fixed)</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"> <style> .gradient-bg { background: linear-gradient(135deg, #6b73ff 0%, #000dff 100%); } .ebook-preview { min-height: 500px; background: linear-gradient(to bottom, #f8fafc, #e2e8f0); } .chapter-item:hover { transform: translateX(5px); transition: transform 0.2s ease; } .loading-dots:after { content: '.'; animation: dots 1.5s steps(5, end) infinite; } @keyframes dots { 0%, 20% { content: '.'; } 40% { content: '..'; } 60% { content: '...'; } 80%, 100% { content: ''; } } .tab-content { display: none; } .tab-content.active { display: block; animation: fadeIn 0.3s ease; } @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } } .plan-card { transition: all 0.3s ease; } .plan-card:hover { transform: translateY(-5px); box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1); } .premium-badge { position: absolute; top: -10px; right: -10px; background: linear-gradient(45deg, #ff9500, #ff5e00); color: white; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: bold; box-shadow: 0 2px 5px rgba(0,0,0,0.2); } .api-status { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 5px; } .api-status.connected { background-color: #10B981; animation: pulse 1.5s infinite; } @keyframes pulse { 0% { transform: scale(1); } 50% { transform: scale(1.2); } 100% { transform: scale(1); } } .api-status.disconnected { background-color: #EF4444; } .toggle-checkbox:checked { right: 0; border-color: #3B82F6; } .toggle-checkbox:checked + .toggle-label { background-color: #3B82F6; } .cover-preview { width: 150px; height: 200px; background-size: cover; background-position: center; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); transition: all 0.3s ease; } .cover-preview:hover { transform: scale(1.05); } .color-option { width: 25px; height: 25px; cursor: pointer; border: 2px solid transparent; transition: all 0.2s ease; } .color-option:hover { transform: scale(1.1); } .color-option.selected { border-color: #000; } .format-option { border: 2px solid #e5e7eb; cursor: pointer; transition: all 0.3s; } .format-option:hover { border-color: #3B82F6; } .format-option.active { border-color: #3B82F6; background-color: #eff6ff; } .tab-button { position: relative; padding-bottom: 5px; } .tab-button.active:after { content: ''; position: absolute; bottom: 0; left: 0; width: 100%; height: 3px; background-color: #3B82F6; border-radius: 3px; } </style> </head> <body class="bg-gray-50"> <div class="min-h-screen"> <!-- Header --> <header class="gradient-bg text-white shadow-lg"> <div class="container mx-auto px-4 py-6"> <div class="flex justify-between items-center"> <div class="flex items-center space-x-2"> <i class="fas fa-book-open text-2xl"></i> <h1 class="text-2xl font-bold">AI Ebook Generator Pro</h1> </div> <nav> <ul class="flex space-x-6"> <li> <a href="#" class="tab-button hover:underline active" onclick="showTab('generator')">Generator</a> </li> <li> <a href="#" class="tab-button hover:underline" onclick="showTab('format-settings')">Format & Design</a> </li> <li> <a href="#" class="tab-button hover:underline" onclick="showTab('publish-settings')">Publishing</a> </li> <li> <a href="#" class="tab-button hover:underline" onclick="showTab('api-settings')">API Settings</a> </li> <li> <a href="#" class="tab-button hover:underline" onclick="showTab('my-ebooks')">My Ebooks</a> </li> </ul> </nav> </div> </div> </header> <!-- Main Content --> <main class="container mx-auto px-4 py-8"> <!-- Generator Tab --> <div id="generator-tab" class="tab-content active"> <div class="grid grid-cols-1 lg:grid-cols-3 gap-8"> <!-- Generator Form --> <div class="lg:col-span-1 bg-white rounded-xl shadow-md p-6 h-fit sticky top-8"> <h2 class="text-xl font-semibold mb-4 text-gray-800">Create Your Ebook</h2> <form id="ebookForm" class="space-y-4"> <div> <label for="ebookTitle" class="block text-sm font-medium text-gray-700 mb-1">Ebook Title*</label> <input type="text" id="ebookTitle" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="Enter ebook title" required> </div> <div> <label for="ebookSubtitle" class="block text-sm font-medium text-gray-700 mb-1">Subtitle</label> <input type="text" id="ebookSubtitle" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="Enter subtitle"> </div> <div> <label for="authorName" class="block text-sm font-medium text-gray-700 mb-1">Author Name*</label> <input type="text" id="authorName" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="Your name or pen name" required> </div> <div> <label for="ebookTopic" class="block text-sm font-medium text-gray-700 mb-1">Main Topic*</label> <input type="text" id="ebookTopic" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="e.g. Digital Marketing" required> </div> <div> <label for="ebookKeywords" class="block text-sm font-medium text-gray-700 mb-1">Keywords (comma separated)</label> <textarea id="ebookKeywords" rows="3" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="SEO, content marketing, social media"></textarea> </div> <div> <label for="ebookSummary" class="block text-sm font-medium text-gray-700 mb-1">Brief Summary*</label> <textarea id="ebookSummary" rows="4" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="Describe what your ebook should cover" required></textarea> </div> <div> <label for="chapterCount" class="block text-sm font-medium text-gray-700 mb-1">Number of Chapters</label> <select id="chapterCount" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500"> <option value="5">5 Chapters</option> <option value="7" selected>7 Chapters</option> <option value="10">10 Chapters</option> <option value="12">12 Chapters</option> </select> </div> <div> <label for="writingStyle" class="block text-sm font-medium text-gray-700 mb-1">Writing Style</label> <select id="writingStyle" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500"> <option value="professional">Professional</option> <option value="casual">Casual</option> <option value="academic">Academic</option> <option value="storytelling">Storytelling</option> </select> </div> <div class="pt-2"> <button type="button" id="generateBtn" onclick="validateAndContinue()" class="w-full gradient-bg text-white py-3 px-6 rounded-lg font-medium hover:opacity-90 transition duration-300 flex items-center justify-center"> <i class="fas fa-magic mr-2"></i> Continue to Format Settings </button> </div> </form> </div> <!-- Ebook Preview --> <div class="lg:col-span-2"> <div class="bg-white rounded-xl shadow-md overflow-hidden"> <div class="p-6 border-b border-gray-200"> <h2 class="text-xl font-semibold text-gray-800">Ebook Preview</h2> <p class="text-sm text-gray-500">Configure your ebook settings to see a preview</p> </div> <div id="ebookPreview" class="ebook-preview p-8"> <div id="emptyState" class="flex flex-col items-center justify-center h-full text-center py-20"> <i class="fas fa-book-reader text-6xl text-gray-300 mb-4"></i> <h3 class="text-xl font-medium text-gray-500 mb-2">No Ebook Generated Yet</h3> <p class="text-gray-400 max-w-md">Fill out the form and click "Continue" to configure your ebook settings.</p> </div> <div id="loadingState" class="hidden flex flex-col items-center justify-center h-full text-center py-20"> <div class="animate-spin rounded-full h-16 w-16 border-t-2 border-b-2 border-blue-500 mb-4"></div> <h3 class="text-xl font-medium text-gray-700 mb-2">Generating Your Ebook</h3> <p class="text-gray-500 max-w-md">This may take a few moments...</p> </div> <div id="ebookContent" class="hidden"> <div class="flex justify-between items-start mb-6"> <div> <h1 id="previewTitle" class="text-3xl font-bold text-gray-800">Your Ebook Title</h1> <h2 id="previewSubtitle" class="text-xl text-gray-600 mt-1">Your Ebook Subtitle</h2> <p class="text-gray-500 text-sm mt-2">by <span id="previewAuthor">Author Name</span></p> </div> <p id="generatedTime" class="text-gray-400 text-xs">Generated just now</p> </div> <div class="border-t border-b border-gray-200 py-4 my-4"> <h3 class="font-semibold text-gray-700 mb-2">Table of Contents</h3> <div id="tocList" class="space-y-2"></div> </div> <div id="chaptersContainer"></div> </div> </div> </div> </div> </div> </div> <!-- Format & Design Tab --> <div id="format-settings-tab" class="tab-content"> <div class="grid grid-cols-1 lg:grid-cols-3 gap-8"> <!-- Format Settings Form --> <div class="lg:col-span-1 bg-white rounded-xl shadow-md p-6 h-fit sticky top-8"> <h2 class="text-xl font-semibold mb-4 text-gray-800">Format & Design Settings</h2> <div class="space-y-6"> <!-- Format Selection --> <div> <h3 class="text-md font-medium text-gray-700 mb-3">Ebook Format</h3> <div class="grid grid-cols-3 gap-2 mb-4"> <div class="format-option active p-2 rounded-lg text-center" data-format="6x9" onclick="selectFormat('6x9', this)"> <p class="text-sm font-medium">6" × 9"</p> <p class="text-xs text-gray-500">Standard</p> </div> <div class="format-option p-2 rounded-lg text-center" data-format="5x8" onclick="selectFormat('5x8', this)"> <p class="text-sm font-medium">5" × 8"</p> <p class="text-xs text-gray-500">Novel</p> </div> <div class="format-option p-2 rounded-lg text-center" data-format="a5" onclick="selectFormat('a5', this)"> <p class="text-sm font-medium">A5</p> <p class="text-xs text-gray-500">International</p> </div> </div> <select id="pageSize" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500"> <option value="6x9">6 × 9 inches (Standard)</option> <option value="5x8">5 × 8 inches (Novel)</option> <option value="a5">A5 (148 × 210 mm)</option> <option value="a4">A4 (210 × 297 mm)</option> <option value="custom">Custom Size</option> </select> </div> <!-- File Formats --> <div> <h3 class="text-md font-medium text-gray-700 mb-3">Output Formats</h3> <div class="space-y-2"> <div class="flex items-center"> <input type="checkbox" id="formatPDF" checked class="mr-2 h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded"> <label for="formatPDF" class="text-sm text-gray-700">PDF (Print & Digital)</label> </div> <div class="flex items-center"> <input type="checkbox" id="formatEPUB" checked class="mr-2 h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded"> <label for="formatEPUB" class="text-sm text-gray-700">EPUB (Amazon, Apple)</label> </div> <div class="flex items-center"> <input type="checkbox" id="formatMOBI" class="mr-2 h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded"> <label for="formatMOBI" class="text-sm text-gray-700">MOBI (Legacy Kindle)</label> </div> </div> </div> <!-- Template Selection --> <div> <h3 class="text-md font-medium text-gray-700 mb-3">Design Template</h3> <select id="designTemplate" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500"> <option value="modern">Modern Professional</option> <option value="minimal">Minimalist</option> <option value="creative">Creative Design</option> <option value="academic">Academic</option> </select> </div> <!-- Font Settings --> <div> <h3 class="text-md font-medium text-gray-700 mb-3">Typography</h3> <div class="grid grid-cols-2 gap-4"> <div> <label class="block text-sm text-gray-600 mb-1">Body Font</label> <select id="bodyFont" class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500"> <option value="serif">Serif (Traditional)</option> <option value="sans-serif" selected>Sans-serif (Modern)</option> <option value="monospace">Monospace (Technical)</option> </select> </div> <div> <label class="block text-sm text-gray-600 mb-1">Font Size</label> <select id="fontSize" class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500"> <option value="11">11 pt</option> <option value="12" selected>12 pt</option> <option value="13">13 pt</option> <option value="14">14 pt</option> </select> </div> </div> </div> <!-- Color Scheme --> <div> <h3 class="text-md font-medium text-gray-700 mb-3">Color Scheme</h3> <div class="flex space-x-2 mb-4"> <div class="color-option selected bg-blue-600 rounded-full" data-color="blue" onclick="selectColor('blue', this)"></div> <div class="color-option bg-green-600 rounded-full" data-color="green" onclick="selectColor('green', this)"></div> <div class="color-option bg-red-600 rounded-full" data-color="red" onclick="selectColor('red', this)"></div> <div class="color-option bg-purple-600 rounded-full" data-color="purple" onclick="selectColor('purple', this)"></div> <div class="color-option bg-indigo-600 rounded-full" data-color="indigo" onclick="selectColor('indigo', this)"></div> <div class="color-option bg-yellow-500 rounded-full" data-color="yellow" onclick="selectColor('yellow', this)"></div> </div> </div> <!-- Cover Design --> <div> <h3 class="text-md font-medium text-gray-700 mb-3">Cover Design</h3> <div class="space-y-3"> <div class="flex items-center justify-between"> <label class="block text-sm text-gray-600">Auto-generate Cover</label> <div class="relative inline-block w-10 mr-2 align-middle select-none"> <input type="checkbox" id="autoCover" checked class="toggle-checkbox absolute block w-6 h-6 rounded-full bg-white border-4 appearance-none cursor-pointer"/> <label for="autoCover" class="toggle-label block overflow-hidden h-6 rounded-full bg-gray-300 cursor-pointer"></label> </div> </div> <div id="coverOptions" class="space-y-3"> <div> <label class="block text-sm text-gray-600 mb-1">Cover Style</label> <select id="coverStyle" class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500"> <option value="modern">Modern</option> <option value="minimal">Minimal</option> <option value="professional">Professional</option> <option value="vintage">Vintage</option> </select> </div> <div class="flex space-x-2"> <button onclick="randomizeCover()" class="flex-1 bg-gray-100 hover:bg-gray-200 text-gray-700 py-1 px-3 rounded-lg text-sm transition duration-300"> <i class="fas fa-random mr-1"></i> Randomize </button> <button onclick="uploadCover()" class="flex-1 bg-gray-100 hover:bg-gray-200 text-gray-700 py-1 px-3 rounded-lg text-sm transition duration-300"> <i class="fas fa-upload mr-1"></i> Upload </button> </div> </div> </div> </div> <!-- Buttons --> <div class="pt-4 space-y-3"> <button onclick="previewEbook()" class="w-full bg-blue-100 hover:bg-blue-200 text-blue-800 py-2 px-4 rounded-lg font-medium transition duration-300"> <i class="fas fa-eye mr-2"></i> Preview Changes </button> <button onclick="showTab('publish-settings')" class="w-full gradient-bg text-white py-3 px-6 rounded-lg font-medium hover:opacity-90 transition duration-300"> Continue to Publishing Settings </button> <button onclick="showTab('generator')" class="w-full bg-gray-100 hover:bg-gray-200 text-gray-700 py-2 px-4 rounded-lg transition duration-300"> <i class="fas fa-arrow-left mr-2"></i> Back </button> </div> </div> </div> <!-- Cover Preview --> <div class="lg:col-span-1"> <div class="bg-white rounded-xl shadow-md p-6 h-fit sticky top-8"> <h2 class="text-xl font-semibold mb-4 text-gray-800">Cover Preview</h2> <div class="space-y-4"> <div id="coverPreview" class="cover-preview mx-auto bg-gradient-to-br from-blue-500 to-indigo-600 flex items-center justify-center"> <div class="text-center p-4"> <h3 id="coverTitle" class="text-xl font-bold text-white mb-1">Your Ebook Title</h3> <p id="coverAuthor" class="text-sm text-blue-100">by Author Name</p> </div> </div> <div class="text-center"> <p class="text-sm text-gray-500">This is a preview of your generated cover</p> </div> <div class="mt-4 p-4 bg-gray-50 rounded-lg border border-gray-200"> <h3 class="text-sm font-medium text-gray-700 mb-2">Cover Settings</h3> <p class="text-xs text-gray-500"><span id="coverFormatDisplay">6 × 9 inches</span> • <span id="coverStyleDisplay">Modern</span></p> </div> </div> </div> </div> <!-- Content Preview --> <div class="lg:col-span-1"> <div class="bg-white rounded-xl shadow-md p-6 h-full"> <h2 class="text-xl font-semibold mb-4 text-gray-800">Interior Preview</h2> <div id="interiorPreview" class="border border-gray-200 p-6 rounded-lg" style="min-height: 400px;"> <h3 class="text-lg font-medium text-gray-800 mb-2">Chapter 1</h3> <p class="text-sm text-gray-700 leading-relaxed">This is a preview of how your ebook content will appear with the selected template and formatting options. The actual content will be generated based on your inputs.</p> <p class="text-sm text-gray-700 leading-relaxed mt-3">You can adjust the font, size, colors, and layout to match your preferences. Changes will be reflected in this preview as you make them.</p> </div> </div> </div> </div> </div> <!-- Publishing Settings Tab --> <div id="publish-settings-tab" class="tab-content"> <div class="grid grid-cols-1 lg:grid-cols-3 gap-8"> <!-- Publishing Form --> <div class="lg:col-span-1 bg-white rounded-xl shadow-md p-6 h-fit sticky top-8"> <h2 class="text-xl font-semibold mb-4 text-gray-800">Publishing Settings</h2> <div class="space-y-6"> <!-- ISBN Settings --> <div> <h3 class="text-md font-medium text-gray-700 mb-3">ISBN</h3> <div class="space-y-2 mb-3"> <div class="flex items-center"> <input type="radio" id="isbnAuto" name="isbnOption" checked class="mr-2 h-4 w-4 text-blue-600 focus:ring-blue-500"> <label for="isbnAuto" class="text-sm text-gray-700">Auto-generate free ISBN</label> </div> <div class="flex items-center"> <input type="radio" id="isbnProvide" name="isbnOption" class="mr-2 h-4 w-4 text-blue-600 focus:ring-blue-500"> <label for="isbnProvide" class="text-sm text-gray-700">Provide my own ISBN</label> </div> </div> <input id="isbnInput" type="text" disabled class="w-full px-4 py-2 border border-gray-300 rounded-lg bg-gray-100 focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="Enter ISBN"> </div> <!-- Publishing Categories --> <div> <h3 class="text-md font-medium text-gray-700 mb-3">Categories</h3> <div class="grid grid-cols-2 gap-4"> <div> <label class="block text-sm text-gray-600 mb-1">Primary Category</label> <select id="primaryCategory" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500"> <option value="business">Business & Money</option> <option value="tech">Computers & Technology</option> <option value="health">Health, Fitness & Dieting</option> <option value="self-help">Self-Help</option> <option value="education">Education</option> </select> </div> <div> <label class="block text-sm text-gray-600 mb-1">Secondary Category</label> <select id="secondaryCategory" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500"> <option value="">None</option> <option value="business">Business & Money</option> <option value="tech">Computers & Technology</option> </select> </div> </div> </div> <!-- Keywords --> <div> <h3 class="text-md font-medium text-gray-700 mb-3">Search Keywords</h3> <div class="mb-2"> <p class="text-xs text-gray-500 mb-1">Enter up to 7 keywords (comma separated)</p> <textarea id="searchKeywords" rows="2" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="ebook, digital marketing, seo"></textarea> </div> </div> <!-- Pricing --> <div> <h3 class="text-md font-medium text-gray-700 mb-3">Pricing</h3> <div class="grid grid-cols-2 gap-4"> <div> <label class="block text-sm text-gray-600 mb-1">Print Price ($)</label> <input type="number" id="printPrice" min="0" step="0.01" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="9.99"> </div> <div> <label class="block text-sm text-gray-600 mb-1">Ebook Price ($)</label> <input type="number" id="ebookPrice" min="0" step="0.01" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="4.99"> </div> </div> </div> <!-- Distribution --> <div> <h3 class="text-md font-medium text-gray-700 mb-3">Distribution</h3> <div class="space-y-2"> <div class="flex items-center"> <input type="checkbox" id="distAmazon" checked class="mr-2 h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded"> <label for="distAmazon" class="text-sm text-gray-700">Amazon Kindle Direct Publishing</label> </div> <div class="flex items-center"> <input type="checkbox" id="distApple" checked class="mr-2 h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded"> <label for="distApple" class="text-sm text-gray-700">Apple Books</label> </div> <div class="flex items-center"> <input type="checkbox" id="distGoogle" checked class="mr-2 h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded"> <label for="distGoogle" class="text-sm text-gray-700">Google Play Books</label> </div> <div class="flex items-center"> <input type="checkbox" id="distKobo" checked class="mr-2 h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded"> <label for="distKobo" class="text-sm text-gray-700">Kobo</label> </div> </div> </div> <!-- Royalty Options --> <div> <h3 class="text-md font-medium text-gray-700 mb-3">Amazon KDP Options</h3> <div class="space-y-2"> <div class="flex items-center"> <input type="checkbox" id="kdpSelect" checked class="mr-2 h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded"> <label for="kdpSelect" class="text-sm text-gray-700">Enroll in KDP Select (Exclusive to Amazon)</label> </div> <div class="flex items-center"> <input type="checkbox" id="kdpUnlimited" checked class="mr-2 h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded"> <label for="kdpUnlimited" class="text-sm text-gray-700">Make eBook free for KU subscribers</label> </div> </div> </div> <!-- Buttons --> <div class="pt-4 space-y-3"> <button onclick="showTab('format-settings')" class="w-full bg-gray-100 hover:bg-gray-200 text-gray-700 py-2 px-4 rounded-lg transition duration-300"> <i class="fas fa-arrow-left mr-2"></i> Back </button> <button type="button" onclick="generateEbook()" class="w-full gradient-bg text-white py-3 px-6 rounded-lg font-medium hover:opacity-90 transition duration-300 flex items-center justify-center"> <i class="fas fa-magic mr-2"></i> Generate & Publish Ebook </button> </div> </div> </div> <!-- Requirements Checklist --> <div class="lg:col-span-1"> <div class="bg-white rounded-xl shadow-md p-6 h-fit sticky top-8"> <h2 class="text-xl font-semibold mb-4 text-gray-800">Amazon Requirements</h2> <div class="space-y-4"> <div class="flex items-start"> <div class="flex-shrink-0 mt-1"> <i class="fas fa-check-circle text-green-500"></i> </div> <div class="ml-3"> <p class="text-sm text-gray-700 font-medium">Title (between 2-100 characters)</p> </div> </div> <div class="flex items-start"> <div class="flex-shrink-0 mt-1"> <i class="fas fa-check-circle text-green-500"></i> </div> <div class="ml-3"> <p class="text-sm text-gray-700 font-medium">Author name specified</p> </div> </div> <div class="flex items-start"> <div class="flex-shrink-0 mt-1"> <i class="fas fa-check-circle text-green-500"></i> </div> <div class="ml-3"> <p class="text-sm text-gray-700 font-medium">At least one category selected</p> </div> </div> <div class="flex items-start"> <div class="flex-shrink-0 mt-1"> <i class="fas fa-check-circle text-green-500"></i> </div> <div class="ml-3"> <p class="text-sm text-gray-700 font-medium">Printable book size selected</p> </div> </div> <div class="flex items-start"> <div class="flex-shrink-0 mt-1"> <i class="fas fa-exclamation-circle text-yellow-500"></i> </div> <div class="ml-3"> <p class="text-sm text-gray-700 font-medium">Recommended number of pages: 24-800</p> </div> </div> <div class="border-t border-gray-200 pt-4"> <h3 class="text-sm font-medium text-gray-700 mb-2">Cover Requirements</h3> <ul class="text-xs text-gray-500 space-y-1"> <li class="flex items-start"> <i class="fas fa-check mt-1 mr-2 text-green-500 text-xs"></i> <span>Minimum 1000 pixels on longest side</span> </li> <li class="flex items-start"> <i class="fas fa-check mt-1 mr-2 text-green-500 text-xs"></i> <span>72-300 DPI resolution</span> </li> <li class="flex items-start"> <i class="fas fa-check mt-1 mr-2 text-green-500 text-xs"></i> <span>RGB color mode</span> </li> </ul> </div> </div> </div> </div> <!-- Publishing Platforms --> <div class="lg:col-span-1"> <div class="bg-white rounded-xl shadow-md p-6"> <h2 class="text-xl font-semibold mb-4 text-gray-800">Publishing Platforms</h2> <div class="space-y-4"> <div class="p-4 border border-blue-200 rounded-lg bg-blue-50"> <div class="flex items-center"> <img src="https://upload.wikimedia.org/wikipedia/commons/thumb/a/a9/Amazon_logo.svg/1200px-Amazon_logo.svg.png" class="h-8 mr-3" alt="Amazon"> <div> <h3 class="font-medium text-gray-800">Amazon KDP</h3> <p class="text-xs text-gray-500">Kindle Direct Publishing</p> </div> </div> <div class="mt-3 flex items-center"> <i class="fas fa-check-circle text-green-500 mr-2"></i> <span class="text-sm text-gray-700">Requirements met</span> </div> </div> <div class="p-4 border border-gray-200 rounded-lg"> <div class="flex items-center"> <img src="https://upload.wikimedia.org/wikipedia/commons/thumb/f/fa/Apple_logo_black.svg/505px-Apple_logo_black.svg.png" class="h-8 mr-3" alt="Apple"> <div> <h3 class="font-medium text-gray-800">Apple Books</h3> <p class="text-xs text-gray-500">iBook Author</p> </div> </div> <div class="mt-3 flex items-center"> <i class="fas fa-check-circle text-green-500 mr-2"></i> <span class="text-sm text-gray-700">Requirements met</span> </div> </div> <div class="p-4 border border-gray-200 rounded-lg"> <div class="flex items-center"> <img src="https://upload.wikimedia.org/wikipedia/commons/thumb/2/2f/Google_2015_logo.svg/1200px-Google_2015_logo.svg.png" class="h-8 mr-3" alt="Google"> <div> <h3 class="font-medium text-gray-800">Google Play Books</h3> <p class="text-xs text-gray-500">Google's publishing platform</p> </div> </div> <div class="mt-3 flex items-center"> <i class="fas fa-check-circle text-green-500 mr-2"></i> <span class="text-sm text-gray-700">Requirements met</span> </div> </div> </div> </div> </div> </div> </div> <!-- API Settings Tab --> <div id="api-settings-tab" class="tab-content"> <div class="max-w-4xl mx-auto bg-white rounded-xl shadow-md p-6"> <h2 class="text-xl font-semibold mb-4 text-gray-800">API Configuration</h2> <p class="text-gray-600 mb-6">Choose between premium APIs (requires keys) or free APIs to power the ebook generation.</p> <div class="space-y-8"> <!-- API Selection --> <div class="border border-gray-200 rounded-lg p-4 mb-6 bg-gray-50"> <h3 class="font-medium text-gray-700 mb-3">API Selection Mode</h3> <div class="space-y-3"> <div class="flex items-center"> <input type="radio" id="apiModePremium" name="apiMode" checked class="mr-2 h-4 w-4 text-blue-600 focus:ring-blue-500"> <label for="apiModePremium" class="text-sm text-gray-700">Premium APIs (Requires API Keys)</label> </div> <div class="flex items-center"> <input type="radio" id="apiModeFree" name="apiMode" class="mr-2 h-4 w-4 text-blue-600 focus:ring-blue-500"> <label for="apiModeFree" class="text-sm text-gray-700">Free APIs (Limited but no keys needed)</label> </div> </div> </div> <!-- Free API Options --> <div id="freeApiOptions" class="hidden border border-gray-200 rounded-lg p-4 mb-6 bg-gray-50"> <h3 class="font-medium text-gray-700 mb-3">Free API Options</h3> <div class="space-y-4"> <div> <label class="block text-sm text-gray-600 mb-1">Content Generation</label> <select id="freeContentApi" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500"> <option value="huggingface">HuggingFace Free Inference API</option> <option value="deepinfra">DeepInfra Free Tier</option> <option value="ollama">Local Ollama (if installed)</option> </select> </div> <div> <label class="block text-sm text-gray-600 mb-1">Cover Generation</label> <select id="freeCoverApi" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500"> <option value="stable-diffusion-xl">Stable Diffusion XL (Free Tier)</option> <option value="dall-e-mini">DALL-E Mini</option> <option value="local-sd">Local Stable Diffusion</option> </select> </div> <div class="text-xs text-gray-500"> Note: Free APIs may have rate limits and slower response times. For best results, use premium APIs. </div> </div> </div> <!-- API Connection Status --> <div class="border border-gray-200 rounded-lg p-4 bg-gray-50"> <div class="flex items-center justify-between mb-2"> <h3 class="font-medium text-gray-700">API Connection Status</h3> <div id="apiStatusBadge" class="flex items-center"> <span class="api-status connected"></span> <span class="text-sm text-green-700">Connected</span> </div> </div> <p class="text-xs text-gray-500">All API connections are working properly. You can generate ebooks.</p> </div> <!-- OpenAI API --> <div class="border border-gray-200 rounded-lg p-4"> <div class="flex items-center justify-between mb-2"> <div class="flex items-center"> <img src="https://upload.wikimedia.org/wikipedia/commons/thumb/4/4d/OpenAI_Logo.svg/1200px-OpenAI_Logo.svg.png" class="h-6 mr-2" alt="OpenAI"> <h3 class="font-medium text-gray-700">OpenAI API</h3> </div> <div class="flex items-center"> <span class="api-status connected"></span> <span class="text-sm text-green-700">Connected</span> </div> </div> <p class="text-xs text-gray-500 mb-3">Used for content generation and styling.</p> <div> <label for="openaiKey" class="block text-sm text-gray-600 mb-1">API Key</label> <div class="flex"> <input type="password" id="openaiKey" class="flex-grow px-4 py-2 border border-gray-300 rounded-l-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="sk-..."> <button onclick="toggleApiKeyVisibility('openaiKey')" class="bg-gray-100 hover:bg-gray-200 px-4 rounded-r-lg border border-l-0 border-gray-300"> <i class="fas fa-eye"></i> </button> </div> <p class="text-xs text-gray-400 mt-1">Your API key is stored securely in your browser.</p> </div> <div class="mt-3 grid grid-cols-2 gap-4"> <div> <label class="block text-sm text-gray-600 mb-1">Model</label> <select class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500"> <option value="gpt-4">GPT-4</option> <option value="gpt-3.5" selected>GPT-3.5 Turbo</option> </select> </div> <div> <label class="block text-sm text-gray-600 mb-1">Max Tokens</label> <input type="number" value="2500" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500"> </div> </div> </div> <!-- Stable Diffusion API --> <div class="border border-gray-200 rounded-lg p-4"> <div class="flex items-center justify-between mb-2"> <div class="flex items-center"> <img src="https://stability.ai/site-favicon.ico" class="h-6 mr-2" alt="Stability AI"> <h3 class="font-medium text-gray-700">Stable Diffusion API</h3> </div> <div class="flex items-center"> <span class="api-status connected"></span> <span class="text-sm text-green-700">Connected</span> </div> </div> <p class="text-xs text-gray-500 mb-3">Used for cover image generation.</p> <div> <label for="sdKey" class="block text-sm text-gray-600 mb-1">API Key</label> <div class="flex"> <input type="password" id="sdKey" class="flex-grow px-4 py-2 border border-gray-300 rounded-l-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="sk-..."> <button onclick="toggleApiKeyVisibility('sdKey')" class="bg-gray-100 hover:bg-gray-200 px-4 rounded-r-lg border border-l-0 border-gray-300"> <i class="fas fa-eye"></i> </button> </div> </div> <div class="mt-3 grid grid-cols-2 gap-4"> <div> <label class="block text-sm text-gray-600 mb-1">Model</label> <select class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500"> <option value="sd-xl" selected>SD XL</option> <option value="sd-2.1">SD 2.1</option> </select> </div> <div> <label class="block text-sm text-gray-600 mb-1">Steps</label> <input type="number" value="30" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500"> </div> </div> </div> <!-- AWS API --> <div class="border border-gray-200 rounded-lg p-4"> <div class="flex items-center justify-between mb-2"> <div class="flex items-center"> <img src="https://upload.wikimedia.org/wikipedia/commons/thumb/9/93/Amazon_Web_Services_Logo.svg/1200px-Amazon_Web_Services_Logo.svg.png" class="h-6 mr-2" alt="AWS"> <h3 class="font-medium text-gray-700">Amazon Web Services</h3> </div> <div class="flex items-center"> <span class="api-status connected"></span> <span class="text-sm text-green-700">Connected</span> </div> </div> <p class="text-xs text-gray-500 mb-3">Used for PDF generation and publishing to KDP.</p> <div class="grid grid-cols-2 gap-4"> <div> <label class="block text-sm text-gray-600 mb-1">Access Key ID</label> <input type="password" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="AKIA..."> </div> <div> <label class="block text-sm text-gray-600 mb-1">Secret Access Key</label> <input type="password" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="wJalr..."> </div> </div> <div class="mt-3"> <label class="block text-sm text-gray-600 mb-1">Region</label> <select class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500"> <option value="us-east-1" selected>US East (N. Virginia)</option> <option value="us-west-2">US West (Oregon)</option> <option value="eu-west-1">EU (Ireland)</option> </select> </div> </div> <!-- Test Connection Button --> <div class="pt-4"> <button onclick="testApiConnections()" class="w-full bg-blue-600 hover:bg-blue-700 text-white py-3 px-6 rounded-lg font-medium transition duration-300"> Test API Connections </button> </div> </div> </div> </div> <!-- My Ebooks Tab --> <div id="my-ebooks-tab" class="tab-content"> <div class="max-w-6xl mx-auto"> <div class="flex justify-between items-center mb-6"> <h2 class="text-xl font-semibold text-gray-800">My Generated Ebooks</h2> <div class="flex space-x-2"> <button onclick="showTab('generator')" class="bg-blue-600 hover:bg-blue-700 text-white py-2 px-4 rounded-lg font-medium transition duration-300 flex items-center"> <i class="fas fa-plus mr-2"></i> Create New Ebook </button> </div> </div> <div id="filterBar" class="bg-white p-4 rounded-lg shadow mb-6"> <div class="flex flex-wrap gap-4"> <div> <label class="block text-sm text-gray-600 mb-1">Filter by Status</label> <select class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500"> <option value="all">All Ebooks</option> <option value="draft">Drafts</option> <option value="published">Published</option> <option value="archived">Archived</option> </select> </div> <div> <label class="block text-sm text-gray-600 mb-1">Filter by Date</label> <select class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500"> <option value="all">All Time</option> <option value="today">Today</option> <option value="week">This Week</option> <option value="month">This Month</option> </select> </div> <div> <label class="block text-sm text-gray-600 mb-1">Sort By</label> <select class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500"> <option value="newest">Newest First</option> <option value="oldest">Oldest First</option> <option value="title">Title (A-Z)</option> </select> </div> <div class="flex items-end"> <button class="bg-gray-100 hover:bg-gray-200 text-gray-700 py-2 px-4 rounded-lg transition duration-300"> <i class="fas fa-filter mr-2"></i> Apply </button> </div> </div> </div> <div class="bg-white rounded-xl shadow-md p-6"> <div id="ebooksList" class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6"> <!-- Ebooks will be listed here dynamically --> </div> </div> </div> </div> </main> </div> <script> // Current ebook being worked on let currentEbook = null; // Tab switching functionality function showTab(tabName) { // Update active tab button document.querySelectorAll('.tab-button').forEach(button => { button.classList.remove('active'); }); const activeButton = document.querySelector(`a[onclick="showTab('${tabName}')"]`); if (activeButton) activeButton.classList.add('active'); // Hide all tabs document.querySelectorAll('.tab-content').forEach(tab => { tab.classList.remove('active'); }); // Show selected tab with animation const tabElement = document.getElementById(`${tabName}-tab`); if (tabElement) { tabElement.classList.add('active'); // Initialize tab-specific content if (tabName === 'my-ebooks') { loadMyEbooks(); } else if (tabName === 'generator') { // Reset preview if going back to generator document.getElementById('emptyState').classList.remove('hidden'); document.getElementById('loadingState').classList.add('hidden'); document.getElementById('ebookContent').classList.add('hidden'); } } } // Initialize first tab on load document.addEventListener('DOMContentLoaded', function() { showTab('generator'); }); // Format selection function selectFormat(format, element) { document.querySelectorAll('.format-option').forEach(el => el.classList.remove('active')); element.classList.add('active'); document.getElementById('pageSize').value = format; // Update display if (format === '6x9') { document.getElementById('coverFormatDisplay').textContent = '6 × 9 inches'; } else if (format === '5x8') { document.getElementById('coverFormatDisplay').textContent = '5 × 8 inches'; } else if (format === 'a5') { document.getElementById('coverFormatDisplay').textContent = 'A5 (148 × 210mm)'; } else if (format === 'a4') { document.getElementById('coverFormatDisplay').textContent = 'A4 (210 × 297mm)'; } else { document.getElementById('coverFormatDisplay').textContent = 'Custom'; } // Update preview if ebook exists if (currentEbook) { currentEbook.format = format; updateCoverPreview(); } } // Color selection function selectColor(color, element) { document.querySelectorAll('.color-option').forEach(el => el.classList.remove('selected')); element.classList.add('selected'); // Update preview if ebook exists if (currentEbook) { currentEbook.color = color; updateCoverPreview(); updateInteriorPreview(); } } // Update cover preview function updateCoverPreview() { const color = currentEbook?.color || 'blue'; const title = document.getElementById('ebookTitle').value || 'Your Ebook Title'; const author = document.getElementById('authorName').value || 'Author Name'; const coverStyle = document.getElementById('coverStyle').value || 'modern'; // Update style display document.getElementById('coverStyleDisplay').textContent = coverStyle.charAt(0).toUpperCase() + coverStyle.slice(1); const colorMap = { 'blue': 'from-blue-500 to-indigo-600', 'green': 'from-green-500 to-emerald-600', 'red': 'from-red-500 to-rose-600', 'purple': 'from-purple-500 to-violet-600', 'indigo': 'from-indigo-500 to-blue-600', 'yellow': 'from-yellow-400 to-amber-500' }; const cover = document.getElementById('coverPreview'); cover.className = `cover-preview mx-auto bg-gradient-to-br ${colorMap[color]} flex items-center justify-center`; document.getElementById('coverTitle').textContent = title; document.getElementById('coverAuthor').textContent = `by ${author}`; // Apply style-specific effects if (coverStyle === 'vintage') { cover.classList.add('sepia', 'brightness-90'); } else { cover.classList.remove('sepia', 'brightness-90'); } if (coverStyle === 'minimal') { cover.classList.add('opacity-90'); } else { cover.classList.remove('opacity-90'); } } // Randomize cover function randomizeCover() { const colors = ['blue', 'green', 'red', 'purple', 'indigo', 'yellow']; const randomColor = colors[Math.floor(Math.random() * colors.length)]; const colorElement = document.querySelector(`.color-option[data-color="${randomColor}"]`); selectColor(randomColor, colorElement); const styles = ['modern', 'minimal', 'professional', 'vintage']; const randomStyle = styles[Math.floor(Math.random() * styles.length)]; document.getElementById('coverStyle').value = randomStyle; updateCoverPreview(); } // Upload cover function uploadCover() { const input = document.createElement('input'); input.type = 'file'; input.accept = 'image/*'; input.onchange = (e) => { const file = e.target.files[0]; if (file) { const reader = new FileReader(); reader.onload = function(event) { const cover = document.getElementById('coverPreview'); cover.style.backgroundImage = `url(${event.target.result})`; cover.className = 'cover-preview mx-auto bg-cover bg-center flex items-center justify-center'; document.getElementById('coverTitle').textContent = ''; document.getElementById('coverAuthor').textContent = ''; // Update preview if ebook exists if (currentEbook) { currentEbook.customCover = event.target.result; } Toastify({ text: "Custom cover uploaded successfully!", duration: 3000, gravity: "top", position: "right", backgroundColor: "#10B981" }).showToast(); }; reader.readAsDataURL(file); } }; input.click(); } // Update interior preview function updateInteriorPreview() { const template = document.getElementById('designTemplate').value || 'modern'; const font = document.getElementById('bodyFont').value || 'sans-serif'; const fontSize = document.getElementById('fontSize').value || '12'; const color = currentEbook?.color || 'blue'; const interior = document.getElementById('interiorPreview'); // Reset classes interior.className = 'border border-gray-200 p-6 rounded-lg'; // Add template-specific classes if (template === 'modern') { interior.classList.add('bg-white'); } else if (template === 'minimal') { interior.classList.add('bg-gray-50'); } else if (template === 'creative') { interior.classList.add('bg-white', 'border-2', 'border-dashed', 'border-blue-200'); } else if (template === 'academic') { interior.classList.add('bg-white', 'border-l-4'); } // Add font classes if (font === 'serif') { interior.classList.add('font-serif'); } else if (font === 'sans-serif') { interior.classList.add('font-sans'); } else if (font === 'monospace') { interior.classList.add('font-mono'); } // Add color accents const colorMap = { 'blue': 'border-blue-200', 'green': 'border-green-200', 'red': 'border-red-200', 'purple': 'border-purple-200', 'indigo': 'border-indigo-200', 'yellow': 'border-yellow-200' }; if (template === 'academic') { interior.classList.add(colorMap[color]); } else if (template === 'creative') { interior.classList.replace('border-blue-200', colorMap[color]); } // Update font size interior.style.fontSize = fontSize + 'pt'; // Update preview if ebook exists if (currentEbook) { currentEbook.template = template; currentEbook.font = font; currentEbook.fontSize = fontSize; } } // Preview ebook function previewEbook() { // Update cover preview updateCoverPreview(); // Update interior preview updateInteriorPreview(); // If no ebook exists yet, show a message if (!currentEbook) { Toastify({ text: "Fill out the generator form first", duration: 3000, gravity: "top", position: "right", backgroundColor: "#EF4444" }).showToast(); return; } } // Form validation and continue to next tab function validateAndContinue() { const title = document.getElementById('ebookTitle').value; const author = document.getElementById('authorName').value; const topic = document.getElementById('ebookTopic').value; const summary = document.getElementById('ebookSummary').value; if (!title || !author || !topic || !summary) { Toastify({ text: "Please fill all required fields first", duration: 3000, gravity: "top", position: "right", backgroundColor: "#EF4444" }).showToast(); return; } // Create basic ebook object currentEbook = { title: title, subtitle: document.getElementById('ebookSubtitle').value, author: author, topic: topic, summary: summary, keywords: document.getElementById('ebookKeywords').value, chapterCount: parseInt(document.getElementById('chapterCount').value), writingStyle: document.getElementById('writingStyle').value }; // Show format settings tab showTab('format-settings'); } // Generate ebook function function generateEbook() { // Check which API mode is selected const useFreeApis = document.getElementById('apiModeFree').checked; if (useFreeApis) { const freeContentApi = document.getElementById('freeContentApi').value; const freeCoverApi = document.getElementById('freeCoverApi').value; Toastify({ text: `Using free APIs: ${freeContentApi} for content and ${freeCoverApi} for cover`, duration: 3000, gravity: "top", position: "right", backgroundColor: "#3B82F6" }).showToast(); } // Validate required fields const title = document.getElementById('ebookTitle').value; const author = document.getElementById('authorName').value; const topic = document.getElementById('ebookTopic').value; const summary = document.getElementById('ebookSummary').value; if (!title || !author || !topic || !summary) { Toastify({ text: "Please fill all required fields first", duration: 3000, gravity: "top", position: "right", backgroundColor: "#EF4444" }).showToast(); return; } // Show loading state document.getElementById('emptyState').classList.add('hidden'); document.getElementById('ebookContent').classList.add('hidden'); document.getElementById('loadingState').classList.remove('hidden'); // Get form values const subtitle = document.getElementById('ebookSubtitle').value; const keywords = document.getElementById('ebookKeywords').value; const chapterCount = parseInt(document.getElementById('chapterCount').value); const writingStyle = document.getElementById('writingStyle').value; // Get format settings const format = document.getElementById('pageSize').value; const template = document.getElementById('designTemplate').value; const font = document.getElementById('bodyFont').value; const fontSize = document.getElementById('fontSize').value; const color = document.querySelector('.color-option.selected').dataset.color; const coverStyle = document.getElementById('coverStyle').value; // Get publishing settings const categories = { primary: document.getElementById('primaryCategory').value, secondary: document.getElementById('secondaryCategory').value }; const pricing = { print: document.getElementById('printPrice').value, ebook: document.getElementById('ebookPrice').value }; // Generate output formats const outputFormats = []; if (document.getElementById('formatPDF').checked) outputFormats.push('pdf'); if (document.getElementById('formatEPUB').checked) outputFormats.push('epub'); if (document.getElementById('formatMOBI').checked) outputFormats.push('mobi'); // Simulate API call with timeout setTimeout(() => { // Hide loading state document.getElementById('loadingState').classList.add('hidden'); // Generate ebook content currentEbook = generateMockEbook( title, subtitle, author, topic, keywords, summary, chapterCount, writingStyle, format, template, font, fontSize, color, coverStyle, categories, pricing ); currentEbook.outputFormats = outputFormats; // Display the generated ebook displayEbook(currentEbook); // Add to my ebooks list addToMyEbooks(currentEbook); // Show success message Toastify({ text: "Ebook generated successfully!", duration: 3000, gravity: "top", position: "right", backgroundColor: "#10B981" }).showToast(); // Show content document.getElementById('ebookContent').classList.remove('hidden'); // Activate ebook tab button const activeButton = document.querySelector('a[onclick="showTab(\'generator\')"]'); if (activeButton) activeButton.classList.add('active'); }, 3000); } function generateMockEbook(title, subtitle, author, topic, keywords, summary, chapterCount, style, format, template, font, fontSize, color, coverStyle, categories, pricing) { const styles = { professional: "This comprehensive guide provides professional insights", casual: "This friendly guide walks you through", academic: "This scholarly examination presents", storytelling: "Let me tell you the story of" }; const bookSubtitle = subtitle || `${styles[style]} ${topic.toLowerCase()}.`; // Generate chapters const chapters = []; const toc = []; for (let i = 1; i <= chapterCount; i++) { const chapterTitle = generateChapterTitle(topic, i, chapterCount); const chapterContent = generateChapterContent(topic, keywords, i, chapterCount, style); chapters.push({ title: chapterTitle, content: chapterContent }); toc.push({ title: chapterTitle, id: `chapter-${i}` }); } return { title, subtitle: bookSubtitle, author, toc, chapters, format, template, font, fontSize, color, coverStyle, categories, pricing, generatedAt: new Date().toLocaleString(), id: Date.now().toString() }; } function generateChapterTitle(topic, index, total) { const prefixes = [ "Introduction to", "The Fundamentals of", "Advanced Techniques in", "Practical Applications of", "Case Studies in", "Future Trends in", "Best Practices for", "Common Mistakes in", "Tools and Resources for", "Getting Started with" ]; const suffixes = [ "Explained", "Demystified", "Uncovered", "Revealed", "Made Simple", "for Beginners", "for Professionals", "in Practice", "in the Real World", "and Beyond" ]; // Use more specific prefixes for later chapters const prefix = index === 1 ? prefixes[0] : index === total ? prefixes[5] : prefixes[Math.min(index, prefixes.length - 1)]; const suffix = suffixes[Math.floor(Math.random() * suffixes.length)]; return `${prefix} ${topic} ${suffix}`; } function generateChapterContent(topic, keywords, index, total, style) { const keywordList = keywords.split(',').map(k => k.trim()).filter(k => k.length > 0); const paragraphs = []; const paragraphCount = 3 + Math.floor(Math.random() * 3); // 3-5 paragraphs for (let i = 0; i < paragraphCount; i++) { let paragraph = ""; // First paragraph introduces the chapter if (i === 0) { paragraph = `In this chapter, we ${style === 'academic' ? 'examine' : style === 'professional' ? 'explore' : 'look at'} `; paragraph += `the ${index === 1 ? 'basic concepts' : index === total ? 'future implications' : 'key aspects'} `; paragraph += `of ${topic.toLowerCase()}. `; if (keywordList.length > 0) { paragraph += `Particular focus will be given to ${keywordList.join(', ')}. `; } } // Middle paragraphs provide content else { const concepts = [ "This approach has been shown to produce significant results", "Many experts agree that this method is effective", "Recent studies have demonstrated the value of this technique", "When implemented correctly, this strategy can yield benefits", "Organizations that adopt this practice often see improvements", "The data clearly supports the effectiveness of this solution" ]; const examples = [ "For example, a recent case study showed", "Consider how this applies to a typical scenario", "To illustrate this point, imagine a situation where", "A practical example of this would be", "This can be seen in the way that", "We can observe this in action when" ]; const transitions = [ "Building on this concept,", "Taking this a step further,", "In addition to this,", "Furthermore,", "Another important consideration is", "It's also worth noting that" ]; if (i === 1) { paragraph = concepts[Math.floor(Math.random() * concepts.length)] + ". "; paragraph += examples[Math.floor(Math.random() * examples.length)] + " "; paragraph += "this leads to measurable outcomes. "; } else { paragraph = transitions[Math.floor(Math.random() * transitions.length)] + " "; paragraph += concepts[Math.floor(Math.random() * concepts.length)].toLowerCase() + ". "; if (Math.random() > 0.3) { paragraph += examples[Math.floor(Math.random() * examples.length)] + " "; paragraph += "the results speak for themselves. "; } } } // Add some keywords if available if (keywordList.length > 0 && Math.random() > 0.5) { const keyword = keywordList[Math.floor(Math.random() * keywordList.length)]; paragraph += `The role of ${keyword} in this process cannot be overstated. `; } paragraphs.push(paragraph); } // Add a concluding paragraph let conclusion = ""; if (index === 1) { conclusion = "This chapter has introduced the fundamental concepts that will be explored in more depth throughout this ebook. "; } else if (index === total) { conclusion = "In conclusion, this chapter has summarized the key takeaways and looked ahead to future developments in the field. "; } else { conclusion = "The insights from this chapter provide a solid foundation for understanding the more advanced topics that follow. "; } conclusion += "In the next chapter, we will " + (index === total ? "summarize all the key lessons from this ebook." : `explore ${index === total - 1 ? "the final aspects" : "more advanced concepts"} of ${topic.toLowerCase()}.`); paragraphs.push(conclusion); return paragraphs; } function displayEbook(ebookData) { // Set title and metadata document.getElementById('previewTitle').textContent = ebookData.title; document.getElementById('previewSubtitle').textContent = ebookData.subtitle; document.getElementById('previewAuthor').textContent = ebookData.author; document.getElementById('generatedTime').textContent = `Generated ${ebookData.generatedAt}`; // Generate table of contents const tocList = document.getElementById('tocList'); tocList.innerHTML = ''; ebookData.toc.forEach((item, index) => { const tocItem = document.createElement('div'); tocItem.className = 'chapter-item transition duration-200'; tocItem.innerHTML = ` <a href="#${item.id}" class="flex items-center text-blue-600 hover:text-blue-800"> <span class="w-6 text-gray-500 font-medium">${index + 1}.</span> <span>${item.title}</span> </a> `; tocList.appendChild(tocItem); }); // Generate chapters const chaptersContainer = document.getElementById('chaptersContainer'); chaptersContainer.innerHTML = ''; ebookData.chapters.forEach((chapter, index) => { const chapterElement = document.createElement('div'); chapterElement.id = `chapter-${index + 1}`; chapterElement.className = 'chapter mb-10'; let chapterHTML = ` <div> <div class="flex items-center mb-4"> <span class="bg-${ebookData.color}-100 text-${ebookData.color}-800 font-bold rounded-full w-8 h-8 flex items-center justify-center mr-3">${index + 1}</span> <h2 class="text-2xl font-bold text-gray-800">${chapter.title}</h2> </div> `; chapter.content.forEach(paragraph => { chapterHTML += `<p class="text-gray-700 mb-4 ${ebookData.font === 'serif' ? 'font-serif' : ebookData.font === 'monospace' ? 'font-mono' : ''}" style="font-size: ${ebookData.fontSize}pt;">${paragraph}</p>`; }); // Add image placeholder if enabled if (ebookData.template !== 'minimal' && Math.random() > 0.5) { chapterHTML += ` <div class="my-6 p-4 bg-gray-100 rounded-lg border border-gray-200 text-center"> <i class="fas fa-image text-3xl text-gray-400 mb-2"></i> <p class="text-sm text-gray-500">[${ebookData.coverStyle} image related to chapter content]</p> </div> `; } chapterHTML += `</div>`; chapterElement.innerHTML = chapterHTML; chaptersContainer.appendChild(chapterElement); }); } function addToMyEbooks(ebookData) { const ebooksList = document.getElementById('ebooksList'); // Remove placeholder if it exists if (ebooksList.querySelector('.text-center')) { ebooksList.innerHTML = ''; } // Create ebook card const ebookCard = document.createElement('div'); ebookCard.className = 'bg-white rounded-lg shadow-md overflow-hidden border border-gray-200 hover:shadow-lg transition duration-300'; ebookCard.innerHTML = ` <div class="p-4 border-b border-gray-200 bg-gray-50 flex justify-between items-center"> <div> <h3 class="font-semibold text-lg text-gray-800 truncate">${ebookData.title}</h3> <p class="text-sm text-gray-500">${ebookData.generatedAt}</p> </div> <span class="bg-${ebookData.color}-100 text-${ebookData.color}-800 text-xs px-2 py-1 rounded-full">${ebookData.format.toUpperCase()}</span> </div> <div class="p-4"> <p class="text-sm text-gray-600 mb-2 line-clamp-2">${ebookData.subtitle}</p> <div class="flex flex-wrap gap-1 mb-3"> <span class="text-xs px-2 py-1 bg-gray-100 text-gray-800 rounded-full">${ebookData.categories.primary}</span> ${ebookData.categories.secondary ? `<span class="text-xs px-2 py-1 bg-gray-100 text-gray-800 rounded-full">${ebookData.categories.secondary}</span>` : ''} </div> <div class="flex justify-between items-center"> <span class="text-sm font-medium text-gray-700">$${(ebookData.pricing.ebook || 0).toFixed(2)}</span> <div class="space-x-2"> <button onclick="viewEbook('${ebookData.id}')" class="text-blue-600 hover:text-blue-800 transition duration-300"> <i class="fas fa-eye"></i> </button> <button onclick="publishEbook('${ebookData.id}')" class="text-purple-600 hover:text-purple-800 transition duration-300"> <i class="fas fa-cloud-upload-alt"></i> </button> <button onclick="downloadEbook('${ebookData.id}')" class="text-green-600 hover:text-green-800 transition duration-300"> <i class="fas fa-download"></i> </button> <button onclick="deleteEbook('${ebookData.id}')" class="text-red-600 hover:text-red-800 transition duration-300"> <i class="fas fa-trash"></i> </button> </div> </div> </div> `; // Add to the beginning of the list ebooksList.prepend(ebookCard); // Store in local storage const myEbooks = JSON.parse(localStorage.getItem('myEbooks') || '[]'); myEbooks.unshift(ebookData); localStorage.setItem('myEbooks', JSON.stringify(myEbooks)); } </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=amwolf36/alex" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p><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://deepsite.hf.co/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://deepsite.hf.co" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://deepsite.hf.co?remix=amwolf36/1dee" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body> </html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>AI Ebook Generator - Pro (Fixed)</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">
<style>
.gradient-bg {
background: linear-gradient(135deg, #6b73ff 0%, #000dff 100%);
}
.ebook-preview {
min-height: 500px;
background: linear-gradient(to bottom, #f8fafc, #e2e8f0);
}
.chapter-item:hover {
transform: translateX(5px);
transition: transform 0.2s ease;
}
.loading-dots:after {
content: '.';
animation: dots 1.5s steps(5, end) infinite;
}
@keyframes dots {
0%, 20% { content: '.'; }
40% { content: '..'; }
60% { content: '...'; }
80%, 100% { content: ''; }
}
.tab-content {
display: none;
}
.tab-content.active {
display: block;
animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
}
.plan-card {
transition: all 0.3s ease;
}
.plan-card:hover {
transform: translateY(-5px);
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}
.premium-badge {
position: absolute;
top: -10px;
right: -10px;
background: linear-gradient(45deg, #ff9500, #ff5e00);
color: white;
padding: 3px 10px;
border-radius: 20px;
font-size: 12px;
font-weight: bold;
box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}
.api-status {
width: 10px;
height: 10px;
border-radius: 50%;
display: inline-block;
margin-right: 5px;
}
.api-status.connected {
background-color: #10B981;
animation: pulse 1.5s infinite;
}
@keyframes pulse {
0% { transform: scale(1); }
50% { transform: scale(1.2); }
100% { transform: scale(1); }
}
.api-status.disconnected {
background-color: #EF4444;
}
.toggle-checkbox:checked {
right: 0;
border-color: #3B82F6;
}
.toggle-checkbox:checked + .toggle-label {
background-color: #3B82F6;
}
.cover-preview {
width: 150px;
height: 200px;
background-size: cover;
background-position: center;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
transition: all 0.3s ease;
}
.cover-preview:hover {
transform: scale(1.05);
}
.color-option {
width: 25px;
height: 25px;