Spaces:
Running
Running
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Smart Article Generator ๐</title> | |
<style> | |
:root { | |
--primary: #2563eb; | |
--secondary: #475569; | |
--background: #f8fafc; | |
--surface: #ffffff; | |
} | |
* { | |
margin: 0; | |
padding: 0; | |
box-sizing: border-box; | |
font-family: 'Inter', system-ui, sans-serif; | |
} | |
body { | |
background-color: var(--background); | |
min-height: 100vh; | |
padding: 2rem; | |
line-height: 1.6; | |
} | |
.container { | |
max-width: 900px; | |
margin: 0 auto; | |
background: var(--surface); | |
padding: 2.5rem; | |
border-radius: 1rem; | |
box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1); | |
} | |
.header { | |
text-align: center; | |
margin-bottom: 3rem; | |
} | |
.header h1 { | |
color: var(--primary); | |
font-size: 2.5rem; | |
margin-bottom: 1rem; | |
} | |
.header p { | |
color: var(--secondary); | |
font-size: 1.1rem; | |
} | |
.step { | |
margin-bottom: 2rem; | |
} | |
.step-number { | |
background: var(--primary); | |
color: white; | |
width: 30px; | |
height: 30px; | |
display: inline-flex; | |
align-items: center; | |
justify-content: center; | |
border-radius: 50%; | |
margin-right: 0.5rem; | |
} | |
.step h2 { | |
color: var(--secondary); | |
margin-bottom: 1rem; | |
display: flex; | |
align-items: center; | |
} | |
input[type="text"] { | |
width: 100%; | |
padding: 1rem; | |
border: 2px solid #e2e8f0; | |
border-radius: 0.5rem; | |
font-size: 1rem; | |
transition: all 0.3s; | |
} | |
input[type="text"]:focus { | |
outline: none; | |
border-color: var(--primary); | |
box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1); | |
} | |
.source-options { | |
display: grid; | |
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); | |
gap: 1rem; | |
margin-top: 1rem; | |
} | |
.source-option { | |
padding: 1.5rem; | |
border: 2px solid #e2e8f0; | |
border-radius: 0.5rem; | |
cursor: pointer; | |
transition: all 0.3s; | |
text-align: center; | |
} | |
.source-option:hover { | |
border-color: var(--primary); | |
background: rgba(37, 99, 235, 0.05); | |
} | |
.source-option.selected { | |
border-color: var(--primary); | |
background: rgba(37, 99, 235, 0.1); | |
} | |
.source-option h3 { | |
font-size: 1.2rem; | |
margin-bottom: 0.5rem; | |
} | |
.generate-btn { | |
width: 100%; | |
padding: 1rem; | |
background: var(--primary); | |
color: white; | |
border: none; | |
border-radius: 0.5rem; | |
font-size: 1.1rem; | |
cursor: pointer; | |
transition: all 0.3s; | |
margin: 2rem 0; | |
} | |
.generate-btn:hover { | |
background: #1d4ed8; | |
} | |
.loader { | |
display: none; | |
text-align: center; | |
margin: 2rem 0; | |
} | |
.loader-spinner { | |
width: 40px; | |
height: 40px; | |
border: 4px solid #f3f3f3; | |
border-top: 4px solid var(--primary); | |
border-radius: 50%; | |
animation: spin 1s linear infinite; | |
margin: 0 auto 1rem; | |
} | |
@keyframes spin { | |
0% { transform: rotate(0deg); } | |
100% { transform: rotate(360deg); } | |
} | |
.result { | |
display: none; | |
margin-top: 2rem; | |
} | |
.article-content { | |
padding: 1.5rem; | |
border: 2px solid #e2e8f0; | |
border-radius: 0.5rem; | |
margin-bottom: 1rem; | |
white-space: pre-wrap; | |
} | |
.copy-btn { | |
padding: 0.75rem 1.5rem; | |
background: #10b981; | |
color: white; | |
border: none; | |
border-radius: 0.5rem; | |
cursor: pointer; | |
transition: all 0.3s; | |
} | |
.copy-btn:hover { | |
background: #059669; | |
} | |
</style> | |
</head> | |
<body> | |
<div class="container"> | |
<div class="header"> | |
<h1>โจ Smart Article Generator โจ</h1> | |
<p>Create professional articles in seconds! ๐</p> | |
</div> | |
<div class="step"> | |
<h2><span class="step-number">1</span> Enter Your Topic ๐</h2> | |
<input type="text" id="topic" placeholder="Example: The Impact of Artificial Intelligence on Modern Society"> | |
</div> | |
<div class="step"> | |
<h2><span class="step-number">2</span> Choose Your Source ๐ฏ</h2> | |
<div class="source-options"> | |
<div class="source-option" data-source="trusted"> | |
<h3>Trusted Sources ๐ฐ</h3> | |
<p>Curated from reputable publications</p> | |
</div> | |
<div class="source-option" data-source="ai"> | |
<h3>AI Generated ๐ค</h3> | |
<p>Created by advanced AI</p> | |
</div> | |
</div> | |
</div> | |
<button class="generate-btn" id="generateBtn">Generate Article โจ</button> | |
<div class="loader"> | |
<div class="loader-spinner"></div> | |
<p>Creating your professional article... ๐จ</p> | |
</div> | |
<div class="result"> | |
<div class="article-content" id="articleContent"></div> | |
<button class="copy-btn" id="copyBtn">Copy Article ๐</button> | |
</div> | |
</div> | |
<script> | |
const sourceOptions = document.querySelectorAll('.source-option'); | |
const generateBtn = document.getElementById('generateBtn'); | |
const loader = document.querySelector('.loader'); | |
const result = document.querySelector('.result'); | |
const articleContent = document.getElementById('articleContent'); | |
const copyBtn = document.getElementById('copyBtn'); | |
let selectedSource = null; | |
sourceOptions.forEach(option => { | |
option.addEventListener('click', () => { | |
sourceOptions.forEach(opt => opt.classList.remove('selected')); | |
option.classList.add('selected'); | |
selectedSource = option.dataset.source; | |
}); | |
}); | |
function generateArticle(topic, source) { | |
const trustedSources = ["The New York Times ๐ฐ", "BBC News ๐", "Reuters ๐ฑ", "Associated Press ๐ข"]; | |
const source_credit = source === 'trusted' ? | |
`Source: ${trustedSources[Math.floor(Math.random() * trustedSources.length)]}` : | |
"Generated by AI ๐ค"; | |
const paragraphs = [ | |
`๐ ${topic} has become one of the most discussed topics in recent times. As we delve deeper into this fascinating subject, we discover its profound impact on various aspects of our lives and society as a whole.`, | |
`๐ Recent studies and analyses have shown that ${topic} plays a crucial role in shaping our future. Experts from leading institutions have conducted extensive research, revealing remarkable insights about this phenomenon.`, | |
`๐ก The evolution of ${topic} has been nothing short of revolutionary. From its humble beginnings to its current state, we've witnessed tremendous growth and development in this field. Industry leaders and innovators continue to push boundaries, exploring new possibilities and applications.`, | |
`๐ According to recent statistics and data analysis, the impact of ${topic} has grown exponentially over the past decade. Organizations implementing related strategies have reported significant improvements in efficiency and effectiveness.`, | |
`๐ Looking ahead, the future of ${topic} appears incredibly promising. Experts predict continued growth and innovation in this space, with new developments emerging regularly. This dynamic landscape presents both challenges and opportunities for individuals and organizations alike.`, | |
`๐ The practical implications of ${topic} are far-reaching. From everyday applications to complex industrial solutions, its influence can be observed across various sectors. This widespread adoption has led to remarkable transformations in how we approach traditional problems.`, | |
`๐ฏ To fully leverage the potential of ${topic}, experts recommend following these key principles: understanding fundamental concepts, staying updated with latest developments, and implementing best practices. These guidelines ensure optimal results and sustainable progress.`, | |
`๐ฎ As we look to the future, it's clear that ${topic} will continue to evolve and shape our world in unprecedented ways. The possibilities are endless, and the potential for positive change is immense.`, | |
`\n${source_credit}\nArticle generated on: ${new Date().toLocaleDateString()} ๐ ` | |
].join('\n\n'); | |
return paragraphs; | |
} | |
generateBtn.addEventListener('click', () => { | |
const topic = document.getElementById('topic').value; | |
if (!topic) { | |
alert('Please enter a topic first! ๐ฏ'); | |
return; | |
} | |
if (!selectedSource) { | |
alert('Please select a source! ๐'); | |
return; | |
} | |
loader.style.display = 'block'; | |
result.style.display = 'none'; | |
setTimeout(() => { | |
const article = generateArticle(topic, selectedSource); | |
articleContent.textContent = article; | |
loader.style.display = 'none'; | |
result.style.display = 'block'; | |
}, 3000); | |
}); | |
copyBtn.addEventListener('click', () => { | |
navigator.clipboard.writeText(articleContent.textContent) | |
.then(() => { | |
copyBtn.textContent = 'Copied! โ '; | |
setTimeout(() => { | |
copyBtn.textContent = 'Copy Article ๐'; | |
}, 2000); | |
}) | |
.catch(err => { | |
alert('Failed to copy text! โ'); | |
console.error('Failed to copy text: ', err); | |
}); | |
}); | |
</script> | |
</body> | |
</html> |