Repository navigation
Expand file tree
/
Copy pathpatch_selected4.js
More file actions
72 lines (63 loc) · 3.01 KB
/
Copy pathpatch_selected4.js
File metadata and controls
72 lines (63 loc) · 3.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
const fs = require('fs');
const ejsPath = 'E:/Antigravity/TaskWhite/views/pages/dashboard.ejs';
let content = fs.readFileSync(ejsPath, 'utf8');
// 1. Remove archive logic from triggerCompleteEffects
const archiveSearch = ` if (globalArchiveRule === '0') {
setTimeout(() => {
tasksToAnimate.forEach(t => {
t.row.classList.remove('task-complete-anim');
t.row.classList.add('task-complete-anim-fadeout');
setTimeout(() => {
t.row.style.display = 'none';
fetch(\`/tasks/\${t.taskId}/archive-immediate\`, { method: 'POST' });
}, 500);
});
setTimeout(() => {
showToast(taskIds.length > 1 ? \`\${taskIds.length} tasks moved to archives\` : 'Task moved to archives', 'success');
refreshDashboardTable();
}, 500);
}, 3000);
} else {`;
const archiveReplace = ` if (false) {`;
content = content.replace(archiveSearch, archiveReplace);
// 2. Add search filter re-apply logic to refreshDashboardTable
const htmlSearch = `if (newTbody && oldTbody) oldTbody.innerHTML = newTbody.innerHTML;
if (typeof syncCheckboxStyles === 'function') syncCheckboxStyles();`;
const htmlReplace = `if (newTbody && oldTbody) oldTbody.innerHTML = newTbody.innerHTML;
if (typeof syncCheckboxStyles === 'function') syncCheckboxStyles();
const searchInput = document.getElementById('dashboardSearch');
if (searchInput && searchInput.value.trim() !== '') {
searchInput.dispatchEvent(new Event('input', { bubbles: true }));
}`;
content = content.replace(htmlSearch, htmlReplace);
// 3. Add Enter to save for inputs inside modal (except tagInputField)
const enterSearch = ` document.addEventListener('keydown', function(e) {
// Ignore shortcuts if the user is typing in an input, textarea, or select
if (['INPUT', 'TEXTAREA', 'SELECT'].includes(e.target.tagName) || e.target.isContentEditable) {
if (e.key === 'Escape') {
e.target.blur(); // Escape removes focus from inputs
}
return;
}`;
const enterReplace = ` document.addEventListener('keydown', function(e) {
// Ignore shortcuts if the user is typing in an input, textarea, or select
if (['INPUT', 'TEXTAREA', 'SELECT'].includes(e.target.tagName) || e.target.isContentEditable) {
if (e.key === 'Escape') {
e.target.blur(); // Escape removes focus from inputs
}
if (e.key === 'Enter' && e.target.id !== 'tagInputField') {
const activeModal = e.target.closest('.modal.show');
if (activeModal) {
e.preventDefault();
const form = activeModal.querySelector('form');
if (form) {
const submitBtn = form.querySelector('button[type="submit"]');
if (submitBtn) submitBtn.click();
}
}
}
return;
}`;
content = content.replace(enterSearch, enterReplace);
fs.writeFileSync(ejsPath, content);
console.log("Patched correctly!");