if done then strike out text
- User
if done then strike out text
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
if done then strike out text
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Here's the updated renderTables function that adds a strikethrough effect to task text when the "Done" checkbox is checked:
function renderTables() {
tablesContainer.innerHTML = '';
tables.forEach(table => {
const tableContainer = document.createElement('div');
tableContainer.className = 'table-container';
// Table header with title and copy button
const tableHeader = document.createElement('div');
tableHeader.className = 'table-header';
const tableTitle = document.createElement('h2');
tableTitle.textContent = table.title;
const copyBtn = document.createElement('button');
copyBtn.className = 'copy-btn';
copyBtn.textContent = 'Copy as Markdown';
copyBtn.addEventListener('click', () => copyTableAsMarkdown(table));
tableHeader.appendChild(tableTitle);
tableHeader.appendChild(copyBtn);
tableContainer.appendChild(tableHeader);
// Create table element
const tableElement = document.createElement('table');
// Create table header
const thead = document.createElement('thead');
const headerRow = document.createElement('tr');
table.headers.forEach((header, index) => {
const th = document.createElement('th');
th.textContent = header;
// Make the "Done" column header narrower
if (header.toLowerCase() === 'done') {
th.style.width = '60px'; // Fixed width for checkbox column
}
headerRow.appendChild(th);
});
thead.appendChild(headerRow);
tableElement.appendChild(thead);
// Create table body
const tbody = document.createElement('tbody');
table.rows.forEach(row => {
const tr = document.createElement('tr');
// Check if this row is marked as done
const isDone = row[1] === '[x]';
row.forEach((cell, index) => {
const td = document.createElement('td');
// Style for multiline text in task column
if (index === 0) { // Assuming first column is task
td.style.whiteSpace = 'pre-wrap'; // Allow text wrapping
td.style.wordBreak = 'break-word'; // Break long words
td.style.maxWidth = '400px'; // Limit width for better readability
// Apply strikethrough if task is done
if (isDone) {
const textSpan = document.createElement('span');
textSpan.textContent = cell;
textSpan.style.textDecoration = 'line-through';
textSpan.style.color = '#94a3b8'; // Lighter color for completed tasks
td.appendChild(textSpan);
} else {
td.textContent = cell;
}
} else if (index === 1 && (cell === '[x]' || cell === '[ ]')) {
// Compact checkbox for "Done" column
const checkbox = document.createElement('input');
checkbox.type = 'checkbox';
checkbox.className = 'checkbox';
checkbox.style.margin = '0 auto'; // Center the checkbox
checkbox.style.display = 'block'; // Make it block for centering
checkbox.checked = cell === '[x]';
checkbox.addEventListener('change', (e) => {
row[index] = e.target.checked ? '[x]' : '[ ]';
updateTables();
});
td.appendChild(checkbox);
td.style.padding = '8px'; // Reduce padding for checkbox column
td.style.textAlign = 'center'; // Center checkbox
} else {
td.textContent = cell;
// Apply lighter color to all cells in completed rows
if (isDone) {
td.style.color = '#94a3b8';
}
}
tr.appendChild(td);
});
tbody.appendChild(tr);
});
tableElement.appendChild(tbody);
tableContainer.appendChild(tableElement);
// Add row form - improved layout
const addRowForm = document.createElement('div');
addRowForm.className = 'add-row';
const taskInput = document.createElement('input');
taskInput.type = 'text';
taskInput.placeholder = 'New task name...';
taskInput.style.flex = '1';
taskInput.style.minWidth = '0'; // Allow input to shrink
const addBtn = document.createElement('button');
addBtn.textContent = 'Add Task';
addBtn.style.marginLeft = '8px';
addBtn.style.flexShrink = '0'; // Prevent button from shrinking
addBtn.addEventListener('click', () => {
if (taskInput.value.trim()) {
addRow(table.title, taskInput.value.trim());
taskInput.value = '';
}
});
// Add keyboard event listener for Enter key
taskInput.addEventListener('keypress', (e) => {
if (e.key === 'Enter' && taskInput.value.trim()) {
addRow(table.title, taskInput.value.trim());
taskInput.value = '';
}
});
addRowForm.appendChild(taskInput);
addRowForm.appendChild(addBtn);
tableContainer.appendChild(addRowForm);
tablesContainer.appendChild(tableContainer);
});
}
Key improvements:
Strikethrough for Completed Tasks:
Visual Consistency for Completed Rows:
Added Enter Key Support:
Maintained All Previous Improvements:
You might also want to add these additional CSS rules to complement the JavaScript changes:
/* Add to your existing CSS */
tr:has(input.checkbox:checked) {
background-color: #f8fafc; /* Very light background for completed rows */
}
tr:has(input.checkbox:checked) td {
color: #94a3b8; /* Lighter text for completed rows */
}
tr:has(input.checkbox:checked) td:first-child {
text-decoration: line-through;
}
/* Smooth transition for status changes */
tr, td {
transition: color 0.2s ease, background-color 0.2s ease;
}
These changes create a clear visual distinction between completed and pending tasks, making it easier to scan the table and identify what's done and what still needs attention.