eubottura commited on
Commit
8549f24
·
verified ·
1 Parent(s): aa98a2f

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. index.html +67 -1
index.html CHANGED
@@ -785,4 +785,70 @@
785
  <div class="card-content">${prompt.content}</div>
786
  <div class="card-actions">
787
  <button class="btn-copy" onclick="copyToClipboard(this)">
788
- <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
785
  <div class="card-content">${prompt.content}</div>
786
  <div class="card-actions">
787
  <button class="btn-copy" onclick="copyToClipboard(this)">
788
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2-2"></path></svg>
789
+ Copiar
790
+ </button>
791
+ </div>
792
+ `;
793
+ grid.appendChild(card);
794
+ });
795
+ }
796
+
797
+ // Copy functionality
798
+ window.copyToClipboard = function(button) {
799
+ const card = button.closest('.card');
800
+ const content = card.querySelector('.card-content').innerText;
801
+
802
+ navigator.clipboard.writeText(content).then(() => {
803
+ showToast();
804
+ const originalHTML = button.innerHTML;
805
+ button.innerHTML = `
806
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"></polyline></svg>
807
+ Copiado!
808
+ `;
809
+ button.classList.add('copied');
810
+
811
+ setTimeout(() => {
812
+ button.innerHTML = originalHTML;
813
+ button.classList.remove('copied');
814
+ }, 2000);
815
+ }).catch(err => {
816
+ console.error('Erro ao copiar: ', err);
817
+ alert('Não foi possível copiar o texto automaticamente.');
818
+ });
819
+ };
820
+
821
+ function showToast() {
822
+ const toast = document.getElementById('toast');
823
+ toast.classList.add('show');
824
+ setTimeout(() => {
825
+ toast.classList.remove('show');
826
+ }, 3000);
827
+ }
828
+
829
+ // --- Initialization ---
830
+ document.addEventListener('DOMContentLoaded', () => {
831
+ const generateBtn = document.getElementById('generateBtn');
832
+
833
+ generateBtn.addEventListener('click', () => {
834
+ const productNameInput = document.getElementById('productName').value;
835
+ const colorsInput = document.getElementById('colorList').value;
836
+
837
+ if (!productNameInput.trim()) {
838
+ alert('Por favor, insira pelo menos o nome do produto.');
839
+ return;
840
+ }
841
+
842
+ // Execute Logic
843
+ const extractedData = extractData(productNameInput, colorsInput);
844
+ const finalPrompts = generateFinalPrompts(extractedData);
845
+
846
+ // Update UI
847
+ renderResults(finalPrompts);
848
+ });
849
+ });
850
+
851
+ </script>
852
+ </body>
853
+
854
+ </html