#PROGRAMAR DIRETO TUDO HTML JS
#ABRIR SITE PRINCIPAL server power#http://localhost:8080
#ABRIR IDE poesia na hora programar DO SITE#http://localhost:8080/editor.html
#CRIADA BASE DADOS STORANGE###bestial projeto original
# Caminho de trabalho
$folderPath = "$env:TEMP\PoesiaNaHora"
$htmlPath = "$folderPath\index.html"
$editorPath = "$folderPath\editor.html"
# Cria a pasta se não existir
New-Item -Path $folderPath -ItemType Directory -Force | Out-Null
# HTML de redirecionamento
$htmlContent = @"
<!DOCTYPE html>
<html lang='pt-BR'>
<head>
<meta charset='UTF-8'>
<meta http-equiv='refresh' content='0; url=https://sites.google.com/view/poesianahora/home'>
<title>Poesia na Hora</title>
<style>
body {
background-color: #fff;
font-family: 'Segoe UI', sans-serif;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
color: #333;
}
h1 {
font-size: 2rem;
}
</style>
</head>
<body>
<h1>Redirecionando para o site 'Poesia na Hora'...</h1>
</body>
</html>
"@
# Salvar HTML principal
$htmlContent | Set-Content -Path $htmlPath -Encoding UTF8
Write-Host "✅ HTML criado em: $htmlPath"
# Sempre sobrescreve o editor HTML para garantir versão atualizada
Remove-Item -Path $editorPath -Force -ErrorAction SilentlyContinue
# HTML do editor
$editorHtml = @"
<!DOCTYPE html>
<html lang="pt-BR">
<head>
<meta charset="UTF-8">
<title>Poesia na Hora - Editor Offline</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 20px;
background: #f4f4f4;
}
textarea {
width: 100%;
height: 200px;
font-family: monospace;
font-size: 14px;
}
iframe {
width: 100%;
height: 300px;
border: 1px solid #ccc;
margin-top: 10px;
background: white;
}
button {
margin-top: 5px;
padding: 8px 16px;
margin-right: 10px;
font-weight: bold;
cursor: pointer;
}
</style>
</head>
<body>
<h1>🧠 Poesia na Hora – Editor de Código</h1>
<textarea id="editor" placeholder="Escreva HTML + JS aqui..."></textarea>
<br>
<button onclick="executar()">▶ Executar</button>
<button onclick="salvar()">💾 Guardar</button>
<button onclick="limpar()">🗑️ Limpar</button>
<button onclick="exportar()">📦 Exportar</button>
<iframe id="preview"></iframe>
<script>
const editor = document.getElementById("editor");
const preview = document.getElementById("preview");
window.onload = function () {
const saved = localStorage.getItem("poesiaCode");
if (saved) {
editor.value = saved;
executar();
}
}
function executar() {
const content = editor.value;
preview.srcdoc = content;
}
function salvar() {
localStorage.setItem("poesiaCode", editor.value);
alert("✅ Código guardado!");
}
function limpar() {
if (confirm("Tem certeza que deseja apagar o código?")) {
localStorage.removeItem("poesiaCode");
editor.value = "";
preview.srcdoc = "";
}
}
function exportar() {
const blob = new Blob([editor.value], { type: 'text/html' });
const a = document.createElement('a');
a.href = URL.createObjectURL(blob);
a.download = 'meu-codigo.html';
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
}
</script>
</body>
</html>
"@
# Salvar editor HTML
$editorHtml | Set-Content -Path $editorPath -Encoding UTF8
Write-Host "🎨 Editor de código criado: $editorPath"
# Iniciar servidor Python local
Write-Host "🚀 Iniciando servidor local..."
Start-Process "python" -ArgumentList "-m", "http.server", "8080" -WorkingDirectory $folderPath
Start-Sleep -Seconds 2
# Abrir editor diretamente no navegador
Start-Process "msedge.exe" "http://localhost:8080/editor.html"