Spaces:
Running
Running
Add 3 files
Browse files- README.md +7 -5
- index.html +227 -19
- prompts.txt +2 -0
README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
---
|
| 2 |
+
title: linha-de-tempo
|
| 3 |
+
emoji: ⚛️
|
| 4 |
+
colorFrom: purple
|
| 5 |
+
colorTo: purple
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
+
tags:
|
| 9 |
+
- QwenSite
|
| 10 |
---
|
| 11 |
|
| 12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
index.html
CHANGED
|
@@ -1,19 +1,227 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
| 6 |
+
<title>Linha do Tempo | Gerador de Eventos</title>
|
| 7 |
+
|
| 8 |
+
<!-- Carregar Tailwind CSS via CDN -->
|
| 9 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 10 |
+
|
| 11 |
+
<!-- Carregar vis.js e CSS -->
|
| 12 |
+
<script src="https://unpkg.com/vis-timeline@9.0.3/standalone/umd/vis-timeline-graph2d.min.js"></script>
|
| 13 |
+
<link href="https://unpkg.com/vis-timeline@9.0.3/styles/vis-timeline-graph2d.min.css" rel="stylesheet" type="text/css" />
|
| 14 |
+
|
| 15 |
+
<!-- Biblioteca para exportar como imagem -->
|
| 16 |
+
<script src="https://html2canvas.hertzen.com/dist/html2canvas.min.js"></script>
|
| 17 |
+
|
| 18 |
+
<style>
|
| 19 |
+
body, html {
|
| 20 |
+
margin: 0;
|
| 21 |
+
padding: 0;
|
| 22 |
+
font-family: 'Segoe UI', sans-serif;
|
| 23 |
+
overflow-x: hidden;
|
| 24 |
+
}
|
| 25 |
+
#timeline-container {
|
| 26 |
+
border: 1px solid #ddd;
|
| 27 |
+
border-radius: 8px;
|
| 28 |
+
box-shadow: 0 4px 12px rgba(0,0,0,0.1);
|
| 29 |
+
overflow: hidden;
|
| 30 |
+
}
|
| 31 |
+
.timeline-controls button {
|
| 32 |
+
@apply px-4 py-2 rounded-lg font-medium transition hover:bg-opacity-90;
|
| 33 |
+
}
|
| 34 |
+
#instructions {
|
| 35 |
+
background: linear-gradient(to right, #e0f7fa, #f3e5f5);
|
| 36 |
+
border-left: 4px solid #1a73e8;
|
| 37 |
+
}
|
| 38 |
+
</style>
|
| 39 |
+
</head>
|
| 40 |
+
<body class="bg-gradient-to-br from-blue-50 via-indigo-50 to-purple-50 min-h-screen">
|
| 41 |
+
|
| 42 |
+
<div class="container mx-auto px-4 py-6 max-w-6xl">
|
| 43 |
+
|
| 44 |
+
<!-- Título -->
|
| 45 |
+
<h1 class="text-4xl font-bold text-center text-gray-800 mb-2">📅 Linha do Tempo Interativa</h1>
|
| 46 |
+
<p class="text-center text-gray-600 mb-8">Crie, salve e compartilhe eventos importantes com exportação em SVG e JPG.</p>
|
| 47 |
+
|
| 48 |
+
<!-- Instruções -->
|
| 49 |
+
<div id="instructions" class="p-5 mb-6 rounded shadow bg-white text-gray-700 text-sm leading-relaxed">
|
| 50 |
+
<h3 class="font-bold text-lg mb-2">📚 Instruções de Uso</h3>
|
| 51 |
+
<ol class="list-decimal list-inside space-y-1 ml-2">
|
| 52 |
+
<li><strong>Adicionar evento:</strong> Preencha o formulário abaixo e clique em "Adicionar Evento".</li>
|
| 53 |
+
<li><strong>Editar/Excluir:</strong> Clique em qualquer evento na linha do tempo para editar ou excluir.</li>
|
| 54 |
+
<li><strong>Salvar:</strong> Use "Salvar Linha do Tempo" para manter os dados no navegador.</li>
|
| 55 |
+
<li><strong>Exportar:</strong> Use os botões para exportar como SVG (vetor) ou JPG (imagem).</li>
|
| 56 |
+
<li><strong>Recarregar:</strong> Os dados são carregados automaticamente do armazenamento local ao abrir a página.</li>
|
| 57 |
+
</ol>
|
| 58 |
+
</div>
|
| 59 |
+
|
| 60 |
+
<!-- Formulário de Adição de Evento -->
|
| 61 |
+
<div class="bg-white p-6 rounded-lg shadow mb-6 grid md:grid-cols-3 gap-4">
|
| 62 |
+
<div>
|
| 63 |
+
<label class="block text-sm font-medium text-gray-700 mb-1">Título do Evento</label>
|
| 64 |
+
<input type="text" id="input-content" class="w-full border border-gray-300 rounded-md px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-400" placeholder="Ex: Lançamento do Projeto" />
|
| 65 |
+
</div>
|
| 66 |
+
<div>
|
| 67 |
+
<label class="block text-sm font-medium text-gray-700 mb-1">Data Inicial</label>
|
| 68 |
+
<input type="date" id="input-start" class="w-full border border-gray-300 rounded-md px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-400" />
|
| 69 |
+
</div>
|
| 70 |
+
<div>
|
| 71 |
+
<label class="block text-sm font-medium text-gray-700 mb-1">Data Final (opcional)</label>
|
| 72 |
+
<input type="date" id="input-end" class="w-full border border-gray-300 rounded-md px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-400" />
|
| 73 |
+
</div>
|
| 74 |
+
<div class="md:col-span-3 flex gap-3">
|
| 75 |
+
<button id="btn-add" class="bg-blue-500 text-white">+ Adicionar Evento</button>
|
| 76 |
+
<button id="btn-save" class="bg-green-500 text-white">💾 Salvar Line do Tempo</button>
|
| 77 |
+
<button id="btn-export-svg" class="bg-purple-500 text-white">📤 Exportar SVG</button>
|
| 78 |
+
<button id="btn-export-jpg" class="bg-orange-500 text-white">🖼️ Exportar JPG</button>
|
| 79 |
+
<button id="btn-clear" class="bg-red-500 text-white">🗑️ Limpar Tudo</button>
|
| 80 |
+
</div>
|
| 81 |
+
</div>
|
| 82 |
+
|
| 83 |
+
<!-- Timeline -->
|
| 84 |
+
<div id="timeline-container" class="bg-white p-2 mb-6"></div>
|
| 85 |
+
|
| 86 |
+
<!-- Rodapé -->
|
| 87 |
+
<p class="text-center text-gray-500 text-sm">© 2025 Linha do Tempo App | Dados salvos localmente no seu navegador.</p>
|
| 88 |
+
</div>
|
| 89 |
+
|
| 90 |
+
<script>
|
| 91 |
+
// Elemento do contêiner da timeline
|
| 92 |
+
const container = document.getElementById('timeline-container');
|
| 93 |
+
let items = new vis.DataSet();
|
| 94 |
+
let timeline;
|
| 95 |
+
|
| 96 |
+
// Formulários
|
| 97 |
+
const inputContent = document.getElementById('input-content');
|
| 98 |
+
const inputStart = document.getElementById('input-start');
|
| 99 |
+
const inputEnd = document.getElementById('input-end');
|
| 100 |
+
const btnAdd = document.getElementById('btn-add');
|
| 101 |
+
const btnSave = document.getElementById('btn-save');
|
| 102 |
+
const btnExportSVG = document.getElementById('btn-export-svg');
|
| 103 |
+
const btnExportJPG = document.getElementById('btn-export-jpg');
|
| 104 |
+
const btnClear = document.getElementById('btn-clear');
|
| 105 |
+
|
| 106 |
+
// Carregar dados salvos do LocalStorage
|
| 107 |
+
function loadFromStorage() {
|
| 108 |
+
const saved = localStorage.getItem('timeline-events');
|
| 109 |
+
if (saved) {
|
| 110 |
+
const parsed = JSON.parse(saved);
|
| 111 |
+
parsed.forEach(item => {
|
| 112 |
+
items.add(item);
|
| 113 |
+
});
|
| 114 |
+
}
|
| 115 |
+
}
|
| 116 |
+
|
| 117 |
+
// Salvar no LocalStorage
|
| 118 |
+
function saveToStorage() {
|
| 119 |
+
const data = items.get();
|
| 120 |
+
localStorage.setItem('timeline-events', JSON.stringify(data));
|
| 121 |
+
alert('✅ Linha do tempo salva com sucesso!');
|
| 122 |
+
}
|
| 123 |
+
|
| 124 |
+
// Criar timeline
|
| 125 |
+
function createTimeline() {
|
| 126 |
+
const options = {
|
| 127 |
+
orientation: 'bottom',
|
| 128 |
+
editable: true,
|
| 129 |
+
margin: {
|
| 130 |
+
item: 20
|
| 131 |
+
},
|
| 132 |
+
onAdd: (item, callback) => {
|
| 133 |
+
openModal(null);
|
| 134 |
+
},
|
| 135 |
+
onUpdate: (item, callback) => {
|
| 136 |
+
openModal(item);
|
| 137 |
+
callback(item);
|
| 138 |
+
},
|
| 139 |
+
onMove: (item, callback) => {
|
| 140 |
+
callback(item);
|
| 141 |
+
saveToStorage();
|
| 142 |
+
},
|
| 143 |
+
onRemove: (item, callback) => {
|
| 144 |
+
if (confirm(`Excluir o evento "${item.content}"?`)) {
|
| 145 |
+
callback(item);
|
| 146 |
+
saveToStorage();
|
| 147 |
+
} else {
|
| 148 |
+
callback(null);
|
| 149 |
+
}
|
| 150 |
+
}
|
| 151 |
+
};
|
| 152 |
+
timeline = new vis.Timeline(container, items, options);
|
| 153 |
+
}
|
| 154 |
+
|
| 155 |
+
// Adicionar novo evento
|
| 156 |
+
btnAdd.addEventListener('click', () => {
|
| 157 |
+
const content = inputContent.value.trim();
|
| 158 |
+
const start = inputStart.value;
|
| 159 |
+
const end = inputEnd.value;
|
| 160 |
+
|
| 161 |
+
if (!content || !start) {
|
| 162 |
+
alert('⚠️ Preencha ao menos o título e a data inicial.');
|
| 163 |
+
return;
|
| 164 |
+
}
|
| 165 |
+
|
| 166 |
+
const newItem = {
|
| 167 |
+
id: Date.now(), // ID único baseado no tempo
|
| 168 |
+
content,
|
| 169 |
+
start,
|
| 170 |
+
end: end || null
|
| 171 |
+
};
|
| 172 |
+
|
| 173 |
+
items.add(newItem);
|
| 174 |
+
saveToStorage();
|
| 175 |
+
|
| 176 |
+
inputContent.value = '';
|
| 177 |
+
inputEnd.value = '';
|
| 178 |
+
});
|
| 179 |
+
|
| 180 |
+
// Salvar no armazenamento
|
| 181 |
+
btnSave.addEventListener('click', saveToStorage);
|
| 182 |
+
|
| 183 |
+
// Exportar como SVG
|
| 184 |
+
btnExportSVG.addEventListener('click', () => {
|
| 185 |
+
const svgData = new XMLSerializer().serializeToString(document.querySelector('.vis-timeline'));
|
| 186 |
+
const blob = new Blob([svgData], { type: 'image/svg+xml' });
|
| 187 |
+
const url = URL.createObjectURL(blob);
|
| 188 |
+
const a = document.createElement('a');
|
| 189 |
+
a.href = url;
|
| 190 |
+
a.download = 'linha-do-tempo.svg';
|
| 191 |
+
a.click();
|
| 192 |
+
URL.revokeObjectURL(url);
|
| 193 |
+
});
|
| 194 |
+
|
| 195 |
+
// Exportar como JPG
|
| 196 |
+
btnExportJPG.addEventListener('click', () => {
|
| 197 |
+
html2canvas(document.querySelector('#timeline-container'), {
|
| 198 |
+
backgroundColor: '#ffffff',
|
| 199 |
+
scale: 2
|
| 200 |
+
}).then(canvas => {
|
| 201 |
+
const imgData = canvas.toDataURL('image/jpeg');
|
| 202 |
+
const a = document.createElement('a');
|
| 203 |
+
a.href = imgData;
|
| 204 |
+
a.download = 'linha-do-tempo.jpg';
|
| 205 |
+
a.click();
|
| 206 |
+
});
|
| 207 |
+
});
|
| 208 |
+
|
| 209 |
+
// Limpar todos os eventos
|
| 210 |
+
btnClear.addEventListener('click', () => {
|
| 211 |
+
if (confirm('Tem certeza que deseja limpar todos os eventos?')) {
|
| 212 |
+
items.clear();
|
| 213 |
+
localStorage.removeItem('timeline-events');
|
| 214 |
+
}
|
| 215 |
+
});
|
| 216 |
+
|
| 217 |
+
// Inicialização
|
| 218 |
+
window.onload = () => {
|
| 219 |
+
loadFromStorage();
|
| 220 |
+
createTimeline();
|
| 221 |
+
|
| 222 |
+
// Preencher a data atual por padrão
|
| 223 |
+
inputStart.valueAsDate = new Date();
|
| 224 |
+
};
|
| 225 |
+
</script>
|
| 226 |
+
<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-qwensite.hf.space/logo.svg" alt="qwensite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-qwensite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >QwenSite</a> - 🧬 <a href="https://enzostvs-qwensite.hf.space?remix=alexandremoraisdarosa/linha-de-tempo" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
| 227 |
+
</html>
|
prompts.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Gere um aplicativo de linha de tempo, com armazenamento e exportação em svg e jpg, criados e implementados, com instruções de uso, a partir do código: <!DOCTYPE HTML> <html> <cabeça> <title> Linha do tempo | Demonstração básica </title> <estilo tipo = "texto/css" > corpo , html { família de fontes : sans - serif ; } </estilo> <script src = "../../dist/vis.js" ></script> <link href = "../../dist/vis-timeline-graph2d.min.css" rel = "folha de estilo" type = "texto/css" /> </head> <corpo> <div id = "visualização" ></div> <script tipo = "texto/javascript" > // Elemento DOM onde a Linha do Tempo será anexada var container = document . getElementById ( 'visualização' ); // Cria um DataSet (permite vinculação de dados bidirecional) var itens = novo vis . Conjunto de dados ([ { id : 1 , conteúdo : 'item 1' , início : '2013-04-20' }, { id : 2 , conteúdo : 'item 2' , início : '2013-04-14' }, { id : 3 , conteúdo : 'item 3' , início : '2013-04-18' }, { id : 4 , conteúdo : 'item 4' , início : '2013-04-16' , fim : '2013-04-19' }, { id : 5 , conteúdo : 'item 5' , início : '2013-04-25' }, { id : 6 , conteúdo : 'item 6' , início : '2013-04-27' } ]); // Configuração para a Linha do Tempo var opções = {}; // Criar uma linha do tempo var timeline = new vis . Timeline ( container , itens , opções ); </script> </corpo> </html>
|
| 2 |
+
Não veio nada
|