Spaces:
Running
Running
Here is an API key for the powerup: 0dcffed17a1fda792e3d36d72dde7fe8 - Initial Deployment
7d364dd verified Download index.html from RaggedStaff/csv-import-powerup: direct link, hf CLI and curl.
- Browser
- Download file 30 kB
-
https://huggingface.co/spaces/RaggedStaff/csv-import-powerup/resolve/main/index.html
- Command line
-
hf download hf://spaces/RaggedStaff/csv-import-powerup/index.html
-
curl -L -o index.html https://huggingface.co/spaces/RaggedStaff/csv-import-powerup/resolve/main/index.html
30 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>CSV Import Powerup</title> | |
| <script src="https://cdn.tailwindcss.com"></script> | |
| <script src="https://cdn.jsdelivr.net/npm/papaparse@5.3.0/papaparse.min.js"></script> | |
| <script src="https://unpkg.com/trello-powerup@1.17.0/dist/trello-powerup.min.js"></script> | |
| <style> | |
| .dropzone { | |
| border: 2px dashed #ccc; | |
| border-radius: 6px; | |
| padding: 20px; | |
| text-align: center; | |
| transition: all 0.3s; | |
| } | |
| .dropzone.active { | |
| border-color: #4CAF50; | |
| background-color: rgba(76, 175, 80, 0.1); | |
| } | |
| .preview-card { | |
| border-left: 4px solid #4CAF50; | |
| } | |
| .date-preview { | |
| font-size: 0.8rem; | |
| color: #666; | |
| } | |
| .column-mapping select { | |
| background-color: #f8f9fa; | |
| border: 1px solid #ced4da; | |
| border-radius: 4px; | |
| padding: 5px 10px; | |
| } | |
| </style> | |
| </head> | |
| <body class="bg-gray-50"> | |
| <div class="container mx-auto p-4 max-w-4xl"> | |
| <div class="bg-white rounded-lg shadow-md p-6"> | |
| <div class="flex items-center mb-6"> | |
| <svg xmlns="http://www.w3.org/2000/svg" class="h-10 w-10 text-blue-500 mr-3" fill="none" viewBox="0 0 24 24" stroke="currentColor"> | |
| <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 17v-2m3 2v-4m3 4v-6m2 10H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" /> | |
| </svg> | |
| <h1 class="text-2xl font-bold text-gray-800">CSV Import Powerup</h1> | |
| </div> | |
| <div class="mb-8"> | |
| <h2 class="text-lg font-semibold text-gray-700 mb-3">1. Select Destination</h2> | |
| <div class="grid grid-cols-1 md:grid-cols-2 gap-4"> | |
| <div> | |
| <label class="block text-sm font-medium text-gray-700 mb-1">Board</label> | |
| <select id="board-select" class="w-full p-2 border border-gray-300 rounded-md focus:ring-blue-500 focus:border-blue-500"> | |
| <option value="">Loading boards...</option> | |
| </select> | |
| </div> | |
| <div> | |
| <label class="block text-sm font-medium text-gray-700 mb-1">List</label> | |
| <select id="list-select" class="w-full p-2 border border-gray-300 rounded-md focus:ring-blue-500 focus:border-blue-500" disabled> | |
| <option value="">Select a board first</option> | |
| </select> | |
| </div> | |
| </div> | |
| </div> | |
| <div class="mb-8"> | |
| <h2 class="text-lg font-semibold text-gray-700 mb-3">2. Upload CSV File</h2> | |
| <div id="dropzone" class="dropzone"> | |
| <div class="flex flex-col items-center justify-center py-8"> | |
| <svg xmlns="http://www.w3.org/2000/svg" class="h-12 w-12 text-gray-400 mb-3" fill="none" viewBox="0 0 24 24" stroke="currentColor"> | |
| <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12" /> | |
| </svg> | |
| <p class="text-gray-600 mb-1">Drag & drop your CSV file here</p> | |
| <p class="text-gray-500 text-sm mb-4">or</p> | |
| <label for="file-upload" class="cursor-pointer bg-blue-500 hover:bg-blue-600 text-white px-4 py-2 rounded-md transition duration-200"> | |
| Browse Files | |
| </label> | |
| <input id="file-upload" type="file" accept=".csv" class="hidden"> | |
| </div> | |
| </div> | |
| <div id="file-info" class="hidden mt-3 p-3 bg-blue-50 rounded-md flex items-center"> | |
| <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 text-blue-500 mr-2" fill="none" viewBox="0 0 24 24" stroke="currentColor"> | |
| <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" /> | |
| </svg> | |
| <span id="file-name" class="text-blue-700"></span> | |
| <button id="clear-file" class="ml-auto text-gray-500 hover:text-gray-700"> | |
| <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor"> | |
| <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" /> | |
| </svg> | |
| </button> | |
| </div> | |
| </div> | |
| <div id="mapping-section" class="hidden mb-8"> | |
| <h2 class="text-lg font-semibold text-gray-700 mb-3">3. Map CSV Columns</h2> | |
| <div class="bg-gray-50 p-4 rounded-md mb-4"> | |
| <div class="grid grid-cols-1 md:grid-cols-4 gap-4 column-mapping"> | |
| <div> | |
| <label class="block text-sm font-medium text-gray-700 mb-1">Name</label> | |
| <select id="name-column" class="w-full"> | |
| <option value="">Select column</option> | |
| </select> | |
| </div> | |
| <div> | |
| <label class="block text-sm font-medium text-gray-700 mb-1">Description</label> | |
| <select id="desc-column" class="w-full"> | |
| <option value="">Select column</option> | |
| </select> | |
| </div> | |
| <div> | |
| <label class="block text-sm font-medium text-gray-700 mb-1">Start Date</label> | |
| <select id="start-date-column" class="w-full"> | |
| <option value="">Select column</option> | |
| </select> | |
| </div> | |
| <div> | |
| <label class="block text-sm font-medium text-gray-700 mb-1">Due Date</label> | |
| <select id="due-date-column" class="w-full"> | |
| <option value="">Select column</option> | |
| </select> | |
| </div> | |
| </div> | |
| </div> | |
| <div class="mb-4"> | |
| <label class="flex items-center"> | |
| <input type="checkbox" id="first-row-header" class="rounded text-blue-500" checked> | |
| <span class="ml-2 text-sm text-gray-700">First row contains headers</span> | |
| </label> | |
| </div> | |
| <div class="mb-4"> | |
| <label class="block text-sm font-medium text-gray-700 mb-1">Date Format</label> | |
| <select id="date-format" class="w-full p-2 border border-gray-300 rounded-md focus:ring-blue-500 focus:border-blue-500"> | |
| <option value="mm/dd/yyyy">MM/DD/YYYY</option> | |
| <option value="dd/mm/yyyy">DD/MM/YYYY</option> | |
| <option value="yyyy-mm-dd">YYYY-MM-DD</option> | |
| <option value="iso">ISO (Autodetect)</option> | |
| </select> | |
| </div> | |
| </div> | |
| <div id="preview-section" class="hidden mb-8"> | |
| <h2 class="text-lg font-semibold text-gray-700 mb-3">4. Preview Cards</h2> | |
| <div class="overflow-y-auto max-h-64 mb-4 border rounded-md"> | |
| <table id="preview-table" class="min-w-full divide-y divide-gray-200"> | |
| <thead class="bg-gray-50"> | |
| <tr> | |
| <th class="px-4 py-2 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Name</th> | |
| <th class="px-4 py-2 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Description</th> | |
| <th class="px-4 py-2 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Start Date</th> | |
| <th class="px-4 py-2 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Due Date</th> | |
| </tr> | |
| </thead> | |
| <tbody id="preview-body" class="bg-white divide-y divide-gray-200"> | |
| <!-- Preview rows will be inserted here --> | |
| </tbody> | |
| </table> | |
| </div> | |
| <div class="flex justify-between items-center"> | |
| <span id="preview-count" class="text-sm text-gray-500">Showing 0 cards</span> | |
| <button id="import-btn" class="bg-green-500 hover:bg-green-600 text-white px-4 py-2 rounded-md transition duration-200 flex items-center"> | |
| <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 mr-2" fill="none" viewBox="0 0 24 24" stroke="currentColor"> | |
| <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12" /> | |
| </svg> | |
| Import Cards | |
| </button> | |
| </div> | |
| </div> | |
| <div id="progress-section" class="hidden mb-8"> | |
| <h2 class="text-lg font-semibold text-gray-700 mb-3">Import Progress</h2> | |
| <div class="bg-gray-100 rounded-full h-4 mb-2"> | |
| <div id="progress-bar" class="bg-green-500 h-4 rounded-full" style="width: 0%"></div> | |
| </div> | |
| <div class="flex justify-between text-sm text-gray-600"> | |
| <span id="progress-text">0%</span> | |
| <span id="progress-count">0/0 cards imported</span> | |
| </div> | |
| </div> | |
| <div id="success-section" class="hidden mb-8 p-4 bg-green-50 rounded-md"> | |
| <div class="flex items-center"> | |
| <svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 text-green-500 mr-3" fill="none" viewBox="0 0 24 24" stroke="currentColor"> | |
| <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7" /> | |
| </svg> | |
| <div> | |
| <h3 class="font-medium text-green-800">Import Completed Successfully!</h3> | |
| <p id="success-message" class="text-sm text-green-600">0 cards were imported to your board.</p> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <script> | |
| // Initialize Trello Power-Up with API key | |
| const t = TrelloPowerUp.iframe({ | |
| 'app-key': '0dcffed17a1fda792e3d36d72dde7fe8', | |
| 'app-name': 'CSV Import Powerup' | |
| }); | |
| // DOM elements | |
| const boardSelect = document.getElementById('board-select'); | |
| const listSelect = document.getElementById('list-select'); | |
| const dropzone = document.getElementById('dropzone'); | |
| const fileUpload = document.getElementById('file-upload'); | |
| const fileInfo = document.getElementById('file-info'); | |
| const fileName = document.getElementById('file-name'); | |
| const clearFile = document.getElementById('clear-file'); | |
| const mappingSection = document.getElementById('mapping-section'); | |
| const previewSection = document.getElementById('preview-section'); | |
| const previewBody = document.getElementById('preview-body'); | |
| const previewCount = document.getElementById('preview-count'); | |
| const importBtn = document.getElementById('import-btn'); | |
| const progressSection = document.getElementById('progress-section'); | |
| const progressBar = document.getElementById('progress-bar'); | |
| const progressText = document.getElementById('progress-text'); | |
| const progressCount = document.getElementById('progress-count'); | |
| const successSection = document.getElementById('success-section'); | |
| const successMessage = document.getElementById('success-message'); | |
| // Data variables | |
| let boards = []; | |
| let lists = []; | |
| let csvData = []; | |
| let csvHeaders = []; | |
| let selectedBoardId = ''; | |
| let selectedListId = ''; | |
| // Load boards when the page loads | |
| window.onload = async function() { | |
| try { | |
| boards = await t.boards('all'); | |
| populateBoardSelect(); | |
| } catch (error) { | |
| console.error('Error loading boards:', error); | |
| boardSelect.innerHTML = '<option value="">Error loading boards</option>'; | |
| } | |
| }; | |
| // Populate board dropdown | |
| function populateBoardSelect() { | |
| boardSelect.innerHTML = '<option value="">Select a board</option>'; | |
| boards.forEach(board => { | |
| const option = document.createElement('option'); | |
| option.value = board.id; | |
| option.textContent = board.name; | |
| boardSelect.appendChild(option); | |
| }); | |
| } | |
| // When board is selected, load its lists | |
| boardSelect.addEventListener('change', async function() { | |
| selectedBoardId = this.value; | |
| listSelect.disabled = true; | |
| listSelect.innerHTML = '<option value="">Loading lists...</option>'; | |
| if (!selectedBoardId) { | |
| listSelect.innerHTML = '<option value="">Select a board first</option>'; | |
| return; | |
| } | |
| try { | |
| lists = await t.lists('all', { boardId: selectedBoardId }); | |
| populateListSelect(); | |
| } catch (error) { | |
| console.error('Error loading lists:', error); | |
| listSelect.innerHTML = '<option value="">Error loading lists</option>'; | |
| } | |
| }); | |
| // Populate list dropdown | |
| function populateListSelect() { | |
| listSelect.innerHTML = '<option value="">Select a list</option>'; | |
| lists.forEach(list => { | |
| const option = document.createElement('option'); | |
| option.value = list.id; | |
| option.textContent = list.name; | |
| listSelect.appendChild(option); | |
| }); | |
| listSelect.disabled = false; | |
| } | |
| // When list is selected | |
| listSelect.addEventListener('change', function() { | |
| selectedListId = this.value; | |
| }); | |
| // Drag and drop functionality | |
| ['dragenter', 'dragover', 'dragleave', 'drop'].forEach(eventName => { | |
| dropzone.addEventListener(eventName, preventDefaults, false); | |
| }); | |
| function preventDefaults(e) { | |
| e.preventDefault(); | |
| e.stopPropagation(); | |
| } | |
| ['dragenter', 'dragover'].forEach(eventName => { | |
| dropzone.addEventListener(eventName, highlight, false); | |
| }); | |
| ['dragleave', 'drop'].forEach(eventName => { | |
| dropzone.addEventListener(eventName, unhighlight, false); | |
| }); | |
| function highlight() { | |
| dropzone.classList.add('active'); | |
| } | |
| function unhighlight() { | |
| dropzone.classList.remove('active'); | |
| } | |
| dropzone.addEventListener('drop', handleDrop, false); | |
| fileUpload.addEventListener('change', handleFileSelect, false); | |
| function handleDrop(e) { | |
| const dt = e.dataTransfer; | |
| const files = dt.files; | |
| if (files.length) { | |
| handleFile(files[0]); | |
| } | |
| } | |
| function handleFileSelect(e) { | |
| const files = e.target.files; | |
| if (files.length) { | |
| handleFile(files[0]); | |
| } | |
| } | |
| function handleFile(file) { | |
| if (!file.name.endsWith('.csv')) { | |
| alert('Please upload a CSV file.'); | |
| return; | |
| } | |
| fileName.textContent = file.name; | |
| fileInfo.classList.remove('hidden'); | |
| Papa.parse(file, { | |
| header: document.getElementById('first-row-header').checked, | |
| skipEmptyLines: true, | |
| complete: function(results) { | |
| csvData = results.data; | |
| csvHeaders = results.meta.fields || []; | |
| if (csvData.length === 0) { | |
| alert('No data found in the CSV file.'); | |
| return; | |
| } | |
| // Show mapping section | |
| mappingSection.classList.remove('hidden'); | |
| // Populate column selectors | |
| populateColumnSelectors(); | |
| }, | |
| error: function(error) { | |
| console.error('Error parsing CSV:', error); | |
| alert('Error parsing CSV file. Please check the file format.'); | |
| } | |
| }); | |
| } | |
| function populateColumnSelectors() { | |
| const selectors = [ | |
| 'name-column', | |
| 'desc-column', | |
| 'start-date-column', | |
| 'due-date-column' | |
| ]; | |
| selectors.forEach(selector => { | |
| const select = document.getElementById(selector); | |
| select.innerHTML = '<option value="">Select column</option>'; | |
| // Add detected headers | |
| csvHeaders.forEach(header => { | |
| const option = document.createElement('option'); | |
| option.value = header; | |
| option.textContent = header; | |
| select.appendChild(option); | |
| }); | |
| // Add "None" option for optional fields | |
| if (selector !== 'name-column') { | |
| const noneOption = document.createElement('option'); | |
| noneOption.value = ''; | |
| noneOption.textContent = 'None'; | |
| select.appendChild(noneOption); | |
| } | |
| // Add change listener to update preview | |
| select.addEventListener('change', updatePreview); | |
| }); | |
| } | |
| function updatePreview() { | |
| // Check if required fields are mapped | |
| const nameColumn = document.getElementById('name-column').value; | |
| if (!nameColumn) { | |
| previewSection.classList.add('hidden'); | |
| return; | |
| } | |
| // Get all mappings | |
| const descColumn = document.getElementById('desc-column').value; | |
| const startDateColumn = document.getElementById('start-date-column').value; | |
| const dueDateColumn = document.getElementById('due-date-column').value; | |
| // Clear previous preview | |
| previewBody.innerHTML = ''; | |
| // Show up to 5 preview rows | |
| const previewRows = Math.min(csvData.length, 5); | |
| for (let i = 0; i < previewRows; i++) { | |
| const row = csvData[i]; | |
| const tr = document.createElement('tr'); | |
| tr.className = i % 2 === 0 ? 'bg-gray-50' : 'bg-white'; | |
| // Name | |
| const nameTd = document.createElement('td'); | |
| nameTd.className = 'px-4 py-2 whitespace-nowrap text-sm font-medium text-gray-900'; | |
| nameTd.textContent = row[nameColumn] || ''; | |
| tr.appendChild(nameTd); | |
| // Description | |
| const descTd = document.createElement('td'); | |
| descTd.className = 'px-4 py-2 text-sm text-gray-500'; | |
| descTd.textContent = descColumn ? (row[descColumn] || '') : ''; | |
| tr.appendChild(descTd); | |
| // Start Date | |
| const startDateTd = document.createElement('td'); | |
| startDateTd.className = 'px-4 py-2 text-sm text-gray-500'; | |
| if (startDateColumn && row[startDateColumn]) { | |
| const formattedDate = formatDate(row[startDateColumn]); | |
| startDateTd.textContent = formattedDate || row[startDateColumn]; | |
| } | |
| tr.appendChild(startDateTd); | |
| // Due Date | |
| const dueDateTd = document.createElement('td'); | |
| dueDateTd.className = 'px-4 py-2 text-sm text-gray-500'; | |
| if (dueDateColumn && row[dueDateColumn]) { | |
| const formattedDate = formatDate(row[dueDateColumn]); | |
| dueDateTd.textContent = formattedDate || row[dueDateColumn]; | |
| } | |
| tr.appendChild(dueDateTd); | |
| previewBody.appendChild(tr); | |
| } | |
| // Update count | |
| previewCount.textContent = `Showing ${previewRows} of ${csvData.length} cards`; | |
| // Show preview section | |
| previewSection.classList.remove('hidden'); | |
| } | |
| function formatDate(dateString) { | |
| const dateFormat = document.getElementById('date-format').value; | |
| if (dateFormat === 'iso') { | |
| // Try to auto-detect ISO format | |
| const date = new Date(dateString); | |
| if (!isNaN(date.getTime())) { | |
| return date.toLocaleDateString(); | |
| } | |
| return dateString; | |
| } | |
| // Parse based on selected format | |
| let parts = []; | |
| if (dateFormat === 'mm/dd/yyyy') { | |
| parts = dateString.split('/'); | |
| if (parts.length === 3) { | |
| return new Date(parts[2], parts[0] - 1, parts[1]).toLocaleDateString(); | |
| } | |
| } else if (dateFormat === 'dd/mm/yyyy') { | |
| parts = dateString.split('/'); | |
| if (parts.length === 3) { | |
| return new Date(parts[2], parts[1] - 1, parts[0]).toLocaleDateString(); | |
| } | |
| } else if (dateFormat === 'yyyy-mm-dd') { | |
| parts = dateString.split('-'); | |
| if (parts.length === 3) { | |
| return new Date(parts[0], parts[1] - 1, parts[2]).toLocaleDateString(); | |
| } | |
| } | |
| return dateString; | |
| } | |
| // Clear file selection | |
| clearFile.addEventListener('click', function() { | |
| fileUpload.value = ''; | |
| fileInfo.classList.add('hidden'); | |
| mappingSection.classList.add('hidden'); | |
| previewSection.classList.add('hidden'); | |
| csvData = []; | |
| csvHeaders = []; | |
| }); | |
| // Date format change | |
| document.getElementById('date-format').addEventListener('change', updatePreview); | |
| document.getElementById('first-row-header').addEventListener('change', function() { | |
| if (csvData.length > 0) { | |
| alert('Changing this setting will require re-uploading the CSV file.'); | |
| } | |
| }); | |
| // Import button click | |
| importBtn.addEventListener('click', async function() { | |
| if (!selectedBoardId || !selectedListId) { | |
| alert('Please select a board and list first.'); | |
| return; | |
| } | |
| if (csvData.length === 0) { | |
| alert('No data to import. Please upload a CSV file first.'); | |
| return; | |
| } | |
| // Get all mappings | |
| const nameColumn = document.getElementById('name-column').value; | |
| const descColumn = document.getElementById('desc-column').value; | |
| const startDateColumn = document.getElementById('start-date-column').value; | |
| const dueDateColumn = document.getElementById('due-date-column').value; | |
| if (!nameColumn) { | |
| alert('Please map at least the Name column.'); | |
| return; | |
| } | |
| // Show progress section | |
| previewSection.classList.add('hidden'); | |
| progressSection.classList.remove('hidden'); | |
| progressBar.style.width = '0%'; | |
| progressText.textContent = '0%'; | |
| progressCount.textContent = `0/${csvData.length} cards imported`; | |
| // Disable import button | |
| importBtn.disabled = true; | |
| importBtn.classList.remove('bg-green-500', 'hover:bg-green-600'); | |
| importBtn.classList.add('bg-gray-400', 'cursor-not-allowed'); | |
| // Import cards one by one | |
| let successCount = 0; | |
| let errorCount = 0; | |
| for (let i = 0; i < csvData.length; i++) { | |
| const row = csvData[i]; | |
| const name = row[nameColumn] || 'Untitled Card'; | |
| const desc = descColumn ? (row[descColumn] || '') : ''; | |
| let startDate = null; | |
| if (startDateColumn && row[startDateColumn]) { | |
| startDate = formatDateForTrello(row[startDateColumn]); | |
| } | |
| let dueDate = null; | |
| if (dueDateColumn && row[dueDateColumn]) { | |
| dueDate = formatDateForTrello(row[dueDateColumn]); | |
| } | |
| try { | |
| // Create the card | |
| const card = await t.createCard({ | |
| name: name, | |
| desc: desc, | |
| idList: selectedListId, | |
| due: dueDate, | |
| start: startDate | |
| }); | |
| successCount++; | |
| } catch (error) { | |
| console.error('Error creating card:', error); | |
| errorCount++; | |
| } | |
| // Update progress | |
| const progress = Math.floor(((i + 1) / csvData.length) * 100); | |
| progressBar.style.width = `${progress}%`; | |
| progressText.textContent = `${progress}%`; | |
| progressCount.textContent = `${i + 1}/${csvData.length} cards imported`; | |
| } | |
| // Show success message | |
| progressSection.classList.add('hidden'); | |
| successSection.classList.remove('hidden'); | |
| successMessage.textContent = `${successCount} cards were successfully imported to your board. ${errorCount > 0 ? `${errorCount} cards failed to import.` : ''}`; | |
| // Reset import button | |
| importBtn.disabled = false; | |
| importBtn.classList.remove('bg-gray-400', 'cursor-not-allowed'); | |
| importBtn.classList.add('bg-green-500', 'hover:bg-green-600'); | |
| }); | |
| function formatDateForTrello(dateString) { | |
| const dateFormat = document.getElementById('date-format').value; | |
| if (dateFormat === 'iso') { | |
| // Try to auto-detect ISO format | |
| const date = new Date(dateString); | |
| if (!isNaN(date.getTime())) { | |
| return date.toISOString(); | |
| } | |
| return null; | |
| } | |
| // Parse based on selected format | |
| let parts = []; | |
| if (dateFormat === 'mm/dd/yyyy') { | |
| parts = dateString.split('/'); | |
| if (parts.length === 3) { | |
| return new Date(parts[2], parts[0] - 1, parts[1]).toISOString(); | |
| } | |
| } else if (dateFormat === 'dd/mm/yyyy') { | |
| parts = dateString.split('/'); | |
| if (parts.length === 3) { | |
| return new Date(parts[2], parts[1] - 1, parts[0]).toISOString(); | |
| } | |
| } else if (dateFormat === 'yyyy-mm-dd') { | |
| parts = dateString.split('-'); | |
| if (parts.length === 3) { | |
| return new Date(parts[0], parts[1] - 1, parts[2]).toISOString(); | |
| } | |
| } | |
| return null; | |
| } | |
| </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=RaggedStaff/csv-import-powerup" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body> | |
| </html> |