Skip to content

feat: add todolist feature#194

Open
3277523224 wants to merge 1 commit into
prem-k-r:mainfrom
3277523224:feature/my-change
Open

feat: add todolist feature#194
3277523224 wants to merge 1 commit into
prem-k-r:mainfrom
3277523224:feature/my-change

Conversation

@3277523224

@3277523224 3277523224 commented Apr 27, 2026

Copy link
Copy Markdown

📌 Description

This PR significantly enhances the To-Do List feature by adding comprehensive task management capabilities including categories, priority levels, due dates, filtering, sorting, and import/export functionality. The original To-Do List only supported basic task creation with pinned/completed status - this update transforms it into a full-featured task management system.

🎨 Visual Changes (Screenshots / Videos)

Testing
Visual Testing

Browser Compatibility
Chrome: Tested

Add task with category and priority
image
image
image
image

Filter by All/Pending/Completed/Overdue/Today
image

Sort by Created/Priority/Due
image

Pin/unpin and complete/delete tasks
image

Export and import JSON files
image

Multilingual dropdowns
image
image

🔗 Related Issues

Changes Made
scripts/todo-list.js
Added 5 task categories: Uncategorized, Work, Life, Study, Other
Added 3 priority levels: High, Medium, Low with visual badges
Added due date picker with calendar and overdue/today highlighting
Added filtering by: All, Pending, Completed, Overdue, Today
Added sorting by: Created, Priority, Due
Added import/export functionality (JSON format)
Added daily auto-reset (pinned tasks persist, unpinned completed tasks cleared)
Added browser notifications for overdue/due tasks
locales/*.js (18 language files)
Added 20 translation keys for dropdown options, buttons, and messages
Files Modified
scripts/
└── todo-list.js
locales/

✅ Checklist

  • I have read and followed the Contributing Guidelines.
  • My code follows the project's coding style and conventions.
  • I have tested my changes thoroughly to ensure expected behavior.
  • I have verified compatibility across Chrome and Firefox (additional browsers if applicable).
  • I have attached relevant visual evidence (screenshots/videos) if applicable.
  • I have updated the CHANGELOG.md under the appropriate categories with all my changes in this PR.

🤖 AI Assistance (Coding)

  • None
  • Ideas / planning
  • Debugging / review help
  • Small code snippets
  • Partial implementation
  • Major implementation help
  • Mostly AI-generated
  • Full vibe coded

Summary

This PR significantly expands the To-Do List feature from basic task creation to a comprehensive task management system. The implementation adds categories (Uncategorized, Work, Life, Study, Other), three priority levels (High, Medium, Low), due date selection with calendar picker, filtering capabilities (All, Pending, Completed, Overdue, Today), sorting options (Created, Priority, Due), JSON import/export functionality, and browser notifications for due/overdue tasks.

Changes

Core Feature Implementation

  • scripts/todo-list.js: Major expansion to support new data model with category, priority, createdAt, and dueDate fields. Added filtering and sorting logic driven by UI controls. Implemented JSON import/export functions and next-day reset with notification system. Storage backend upgraded to use chrome.storage.local with localStorage fallback and legacy data migration.
  • scripts/background.js: New background service worker handling context menu integration ("Add to To Do List") for selected text, managing todo action badge display, and scheduling hourly checks for due/overdue task notifications.
  • manifest.json and manifest(firefox).json: Version bumped to 3.3.6. Added permissions for contextMenus, storage, and notifications. Added background service worker configuration.
  • index.html: Expanded TodoList UI with new task-controls section (category, priority, due date selectors), separate import/export actions, and filter/sort controls using i18n keys.
  • style.css: Comprehensive CSS updates for new todo UI elements including badge styling for priority levels and due-date states, refined dark-mode filtering, and restructured layout for todo container and task items.

Internationalization

  • Updated 18 locale files (ar_SA, az, bn, cs, de, el, en, es, fa, fr, hi, idn, it, ja, ko, pt, ru, sl, ta, th, tr, uk, ur, uz, vi, zh, zh_TW) with 25 new translation keys covering todo categories, priorities, filters, sorting options, import/export labels, due-status messages, notification titles, and context-menu actions.
  • Removed newTabTitle translation key from multiple locale files (bn, cs, en, fr, hi, uk).

Language Management

  • Removed Swedish (sv) language support: eliminated from locales/sv.js script loading, locale switching, date formatting patterns, and weather width calculations.
  • Removed Marathi (mr) from language registration.
  • scripts/languages.js: Added updateTodoOptions() helper to dynamically update translated select option text and import/export button labels when language is applied. Stopped updating document title during language application.

Infrastructure Updates

  • scripts/search.js: Updated language-specific hint text lookup to use direct indexing with English fallback.
  • scripts/theme.js: Enhanced dark theme application to explicitly set .accentColor SVG fill styling to #212121.
  • scripts/shortcuts.js: Corrected CSS class name from shortcutDarkColor to shorcutDarkColor in preset SVG markup for YouTube, Gmail, Telegram, WhatsApp, Twitter, and Discord.
  • scripts/bookmarks.js: Removed keyboard focus forcing on bookmark sidebar open.
  • scripts/clock.js and scripts/weather.js: Removed Swedish language-specific formatting patterns.

Documentation and Examples

  • README.md: Updated language count from 32 to 31 languages, removed Swedish entry, and adjusted contributor lists.
  • CHANGELOG.md: Removed unreleased entries for dark-mode improvements, language support updates, and widget dragging fixes.
  • todo-import.json: Added example import file with sample todo entry.
  • tools/languagesAnalysis.html: Removed Swedish from language analysis tool.

Testing Notes

Per the PR description, Chrome testing was performed with visual screenshots demonstrating the feature across multiple languages (English, Chinese, Spanish, Korean) and showing category/priority dropdowns, calendar picker, task filtering, and JSON export functionality. Firefox compatibility verification is pending.

@prem-k-r prem-k-r added the enhancement New feature or request label Apr 27, 2026
@coderabbitai

coderabbitai Bot commented Apr 27, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

This PR significantly expands the to-do list feature across the extension with new UI controls (category, priority, due date selectors), import/export functionality, and notification support via a new background service worker. It simultaneously removes Swedish language support and the "newTabTitle" localization key from multiple languages, while adding comprehensive to-do-related translations across 30+ locales.

Changes

Cohort / File(s) Summary
Documentation & Release Notes
CHANGELOG.md, README.md
Removes Swedish language entry and contributor references; removes Swedish/Marathi/Ukrainian/Hungarian locale lines from changelog; updates language count from 32 to 31.
Manifest & Version Control
manifest.json, manifest(firefox).json
Decrements version from 3.3.7 to 3.3.6; adds Chrome permissions for contextMenus, storage, notifications; registers new background service worker script.
HTML UI Layout
index.html, tools/languagesAnalysis.html
Replaces searchControls wrapper with new task-controls, todo-actions, todo-filters sections with i18n keys; removes Swedish locale script and dropdown entry; removes draggable="false" from weather icons; updates SVG path definitions.
Localization Files
locales/{ar_SA,az,bn,cs,de,el,en,es,fa,fr,hi,hu,idn,it,ja,ko,mr,np,pl,pt,ru,sl,ta,th,tr,uk,ur,uz,vi,zh,zh_TW}.js
Adds comprehensive to-do UI translations (categories, priorities, filters, sorting, import/export, due-date labels, notification titles, context-menu actions) across all supported languages; removes newTabTitle key from 10+ locales; updates wording for clock/weather/wallpaper strings in select locales (bn, hi, mr, fr).
Background Service Worker
scripts/background.js
New file: implements Chrome context menu for "Add to To Do List", manages pending-task badge count, and schedules hourly due-task checks with localized notifications.
To-Do List Core Logic
scripts/todo-list.js
Expands data model with category, priority, createdAt, dueDate fields; refactors rendering into renderTodoList() with translation-key-based filtering/sorting; implements JSON import/export; adds notification system for due/overdue tasks; migrates legacy Chinese metadata to internal keys; generalizes storage to use chrome.storage.local with fallback to localStorage.
Language & UI Management
scripts/languages.js
Removes Swedish (sv) and Marathi (mr) language registrations; removes setDocumentTitle from applyLanguage; adds updateTodoOptions() helper to dynamically update to-do UI select elements with translated strings on language change; removes Swedish from decimal-separator list.
Script Utilities & Styling
scripts/clock.js, scripts/weather.js, scripts/search.js, scripts/bookmarks.js
Removes Swedish-specific date formatting pattern from clock; removes Swedish from weather humidity width mapping; updates search engine hint fallback logic; removes focus behavior from bookmark sidebar toggle.
Theme & Icon Styling
scripts/theme.js, scripts/shortcuts.js
theme.js: enhances dark-mode reset to clear inline styles and SVG fills; explicitly sets .accentColor fill in dark mode. shortcuts.js: corrects typo shortcutDarkColorshorcutDarkColor across preset SVG strings (YouTube, Gmail, Telegram, WhatsApp, Twitter, Discord).
CSS Styling
style.css
Narrows dark-mode grayscale/invert filters to only #darkTheme scope; refactors to-do panel grid from fixed 330px to auto columns with stretch alignment; adds classes for to-do actions, filters, badges, and metadata display; updates todolistitem to column flex layout; removes adaptive icon filter overrides; makes icon fill declarations !important in black theme.
Test/Sample Data
todo-import.json
New file: sample to-do item with Chinese metadata (category "学习", priority "中", due date 2026-04-29) for import testing.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Background as Background Worker
    participant Storage as Chrome Storage
    participant Notification as Notifications API

    User->>Background: Right-click text → "Add to To Do List"
    Background->>Storage: Read chrome.storage.local.todoList
    Storage-->>Background: Existing todos array (or empty)
    Background->>Background: Create new todo entry<br/>(status: "pending", defaults)
    Background->>Storage: Write updated todoList
    Background->>Background: Update action badge<br/>with pending count
    Storage-->>Background: Change event fired
    Background->>Background: Check pending todos<br/>with dueDate
    alt Overdue or Due Today
        Background->>Notification: Create notification<br/>(localized title/message)
        Notification-->>User: Display reminder
    end
Loading
sequenceDiagram
    participant User
    participant ToDoUI as To-Do List UI
    participant Storage as Chrome Storage
    participant Export as Export Handler

    User->>ToDoUI: Click "Export" button
    ToDoUI->>Storage: Read todoList from<br/>chrome.storage.local or localStorage
    Storage-->>ToDoUI: Return todos array
    ToDoUI->>Export: Format as JSON
    Export-->>User: Trigger download<br/>todo-list.json
    
    rect rgba(0, 200, 0, 0.5)
        Note over User,Export: Import Flow (Reverse)
        User->>ToDoUI: Click "Import" + select file
        ToDoUI->>ToDoUI: Parse JSON
        ToDoUI->>ToDoUI: Validate structure
        alt Valid JSON
            ToDoUI->>Storage: Merge/replace todoList
            Storage-->>ToDoUI: Confirm write
            ToDoUI->>User: Show success message
        else Invalid JSON
            ToDoUI->>User: Show error message
        end
    end
Loading
sequenceDiagram
    participant User
    participant Page as Page Load
    participant Background as Background Worker
    participant Storage as Chrome Storage
    participant Notification as Notifications API

    Page->>Background: Start (on extension load)
    Background->>Storage: Read todoList
    Storage-->>Background: todos array
    Background->>Background: Filter pending todos<br/>with dueDate
    Background->>Background: Determine overdue/today status
    alt Tasks found
        Background->>Notification: Create localized notifications
        Notification-->>User: Display alerts
    end
    
    Background->>Background: Schedule hourly check
    loop Every 1 hour
        Background->>Storage: Read todoList
        Background->>Background: Recheck due status
        alt Status changed
            Background->>Notification: Update notifications
        end
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested labels

ui/ux, i18n/l10n

Suggested reviewers

  • prem-k-r
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat: add todolist feature' clearly and concisely describes the main change - adding a comprehensive to-do list feature with task management capabilities. It accurately represents the primary objective of the changeset.
Description check ✅ Passed The pull request description comprehensively covers the feature addition with detailed explanations, multiple supporting screenshots across different languages and use cases, properly filled checklist items, and clear documentation of changes made to core files and locale files.
Docstring Coverage ✅ Passed Docstring coverage is 85.71% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 18

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (4)
locales/th.js (1)

145-145: ⚠️ Potential issue | 🟡 Minor

Fix stray quote character in evening greeting.

The Thai evening greeting has a stray single quote character (') before the Thai text: "สวัสดีตอนเย็น!". This would display incorrectly in the UI.

"สวัสดีตอนเย็น!"

should be:

"สวัสดีตอนเย็น!"
🔧 Proposed fix
-    "evening": "'สวัสดีตอนเย็น!"
+    "evening": "สวัสดีตอนเย็น!"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@locales/th.js` at line 145, The "evening" translation string contains a stray
leading single-quote character; locate the "evening" key in locales/th.js and
remove the extra apostrophe so the value is a proper quoted string (i.e.,
evening: "สวัสดีตอนเย็น!"), ensuring the surrounding quotes are balanced and no
stray characters remain.
scripts/languages.js (1)

90-96: ⚠️ Potential issue | 🟡 Minor

Remove Korean from the comma-decimal locale list.

Including "ko" here rewrites values like 23.5 to 23,5, so Korean weather/temperature text will be formatted incorrectly.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/languages.js` around lines 90 - 96, The list specialDecimalLanguages
currently contains "ko", which causes code in the block that checks if
(specialDecimalLanguages.includes(language)) and then does text =
text.replace(".", ",") to incorrectly change Korean numeric decimals; remove
"ko" from the specialDecimalLanguages array so that language === "ko" no longer
triggers that replacement (ensure the array literal used to define
specialDecimalLanguages is updated accordingly).
locales/mr.js (1)

1-186: ⚠️ Potential issue | 🟠 Major

This change regresses Marathi coverage across the existing UI.

scripts/languages.js and index.html still request keys like personalizationSectionTitle, clockSectionTitle, hideClockBox, hideClockBoxInfo, defaultEngine, PrivacyPolicy, useGPSInfo, bookmarkSortBy, and the theme labels, but they are no longer present here. The result is a mixed Marathi/English interface after switching locales.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@locales/mr.js` around lines 1 - 186, The Marathi locale file is missing
several keys referenced elsewhere, causing mixed-language UI; add the missing
translation keys to the mr object (e.g., personalizationSectionTitle,
clockSectionTitle, hideClockBox, hideClockBoxInfo, PrivacyPolicy, useGPSInfo,
bookmarkSortBy and the theme labels such as lightTheme/darkTheme/autoTheme or
whatever theme keys other locales use) with Marathi strings matching the style
of existing keys so scripts/languages.js and index.html can find them; ensure
the keys exactly match the identifiers used in the codebase (e.g.,
"personalizationSectionTitle", "clockSectionTitle", "hideClockBox",
"hideClockBoxInfo", "defaultEngine" if overridden, "PrivacyPolicy",
"useGPSInfo", "bookmarkSortBy", and theme label keys) and run a quick locale
check against another complete locale to confirm none are missing.
scripts/todo-list.js (1)

233-240: ⚠️ Potential issue | 🟠 Major

Handle clicks from nested task content.

After adding .task-content / .task-meta, most clicks land on child nodes, but this branch only runs when event.target.tagName === "LI". That makes complete/pending toggling work only on empty padding, not on the task text or badges. Use closest('li[data-todoitem]') and exclude the edit/pin/remove controls instead.

Suggested fix
-todoulList.addEventListener("click", (event) => {
-    if (event.target.tagName === "LI") {
-        if (suppressNextClick) return;  // Prevent misclick on LI
-        event.target.classList.toggle("checked"); // Check the clicked LI tag
-        let id = event.target.dataset.todoitem;
+todoulList.addEventListener("click", (event) => {
+    const li = event.target.closest('li[data-todoitem]');
+    if (li && !event.target.closest(".todoremovebtn, .todopinbtn, .todoeditbtn")) {
+        if (suppressNextClick) return;
+        li.classList.toggle("checked");
+        let id = li.dataset.todoitem;
         todoList[id].status = ((todoList[id].status === "completed") ? "pending" : "completed"); // Update status
         SaveToDoData(); // Save Changes
     }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/todo-list.js` around lines 233 - 240, The click handler currently
checks only event.target.tagName === "LI", so clicks on child elements like
.task-content or .task-meta are ignored; change the handler to find the nearest
ancestor li with a data-todoitem (use event.target.closest('li[data-todoitem]'))
and return if none, maintain the existing suppressNextClick check, and also skip
toggling when the click originated on control buttons (e.g., selectors for
edit/pin/remove or elements with a specific control class). Then toggle the
found li's "checked" class, read its dataset.todoitem into id, update
todoList[id].status between "completed" and "pending", and call SaveToDoData();
keep references to the existing symbols todoulList (event listener),
suppressNextClick, todoList, and SaveToDoData.
🧹 Nitpick comments (1)
todo-import.json (1)

1-11: Test file for JSON import - consider cleanup before merge.

This file appears to contain test data for the todo import functionality. If this is intended to remain in the repository, consider:

  1. Using semantic category keys (e.g., "category": "study") instead of localized text to ensure compatibility with the category system
  2. Updating dates to be future dates or using relative date examples

If this is only for testing during development, consider removing it before merging or adding it to .gitignore.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@todo-import.json` around lines 1 - 11, The test JSON file with key
"t1234567890" contains development data that should not be merged as-is; either
remove the file from the PR (or add it to .gitignore) if it’s only for testing,
or normalize its fields for production: change "category" from localized text to
a semantic key (e.g., "category": "study"), update "createdAt" and "dueDate" to
valid future or relative-example dates, and ensure "status", "priority", and
"pinned" follow the canonical enum/format used by the import system before
keeping it in the repo.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@index.html`:
- Around line 101-135: The new task controls lack accessible labels; update the
elements with IDs todoCategory, todoPriority, todoDueDate, todoFilter, and
todoSort (and any action buttons like todoAdd/todoImport/todoExport if
unlabeled) to provide screen-reader friendly names by either adding <label
for="..."> elements associated with each ID or adding descriptive aria-label
attributes (e.g., aria-label="Category", aria-label="Priority", aria-label="Due
date", aria-label="Filter todos", aria-label="Sort todos"); ensure labels are
visible or use visually-hidden CSS for sighted users, and confirm the
todoDueDate input has an appropriate label describing the expected date format.

In `@locales/az.js`:
- Around line 27-30: Add the missing Azeri translation for the main todo title
by restoring the "todoListText" key in this locale object; update locales/az.js
to include "todoListText": "Tapşırıqlar siyahısı" (or the correct Azeri phrase)
alongside the existing keys ("todoListInfo", "todoListHover", "todoPlaceholder")
so `#todoListHeading` and the settings toggle no longer fall back to English.

In `@locales/fr.js`:
- Line 111: Update the French localization entry for the key "userAPI" in
locales/fr.js to a French string; replace the English value "Your weatherAPI
key" with the provided French translation "Votre clé WeatherAPI" so the
"userAPI" property matches the rest of the French locale.

In `@locales/hu.js`:
- Around line 3-162: The Hungarian locale is missing many UI keys so users see
English fallbacks; restore the missing translation keys by adding Hungarian
strings for the listed identifiers (e.g. personalizationSectionTitle,
hideClockBox, hideClockBoxInfo, defaultEngine, gImagesEngine, redditEngine,
wikipediaEngine, quoraEngine, PrivacyPolicy, useGPS, useGPSInfo and all theme
label keys) into locales/hu.js (matching the same key names used in other
locales) so the UI renders fully translated; ensure you add them alongside the
existing entries and follow the same object/key formatting as other locale
entries.

In `@locales/np.js`:
- Line 43: The value for the localization key "todoFilterOverdue" contains mixed
Chinese characters and must be replaced with a correct Nepali string; update the
entry for todoFilterOverdue (in the locales/np object) to a pure Devanagari
translation such as "ढिलो भएको" (or another validated Nepali phrase for
"overdue") and ensure the file is saved with UTF-8 encoding so the Devanagari
characters render correctly.
- Line 50: The Nepali translation value for the key "todoDueOverdue" contains
corrupted/mixed characters; find every occurrence of the "todoDueOverdue" entry
in locales/np.js and replace the corrupted string ("अल标记हेको" and the duplicate
instance) with a correct Devanagari translation such as "म्याद नाघेको" (or
another approved Nepali term for "overdue") so both entries use consistent,
proper Nepali text.

In `@locales/ur.js`:
- Line 89: Replace the incorrect placeholder value for the todoFilterOverdue
key: locate the "todoFilterOverdue" entry and change its value from " mosques"
to a correct Urdu translation for "overdue" such as "تاخیر سے" or "وقت پر نہیں",
ensuring the string uses proper quotes and spacing consistent with other entries
in locales/ur.js.
- Line 96: Replace the incorrect English word "mosques" for the "todoDueOverdue"
key with a proper Urdu label (for example use "مقررہ وقت گزر چکا") and also fix
the other overdue-related translation in this file (the other overdue label
present near the same block) to an appropriate Urdu short form (for example
"تاخیر"); update the values for the keys "todoDueOverdue" and the other overdue
key so both labels are correct Urdu translations.

In `@manifest.json`:
- Line 4: The manifest's "version" field was decremented from 3.3.7 to 3.3.6;
restore/increment it to a monotonically higher semantic version (e.g., "3.3.8"
or the intended new release) in the manifest's "version" key and ensure the same
version is updated in any build/package metadata (release notes/changelog, build
scripts) so Chrome Web Store submission and installed clients remain consistent.

In `@scripts/background.js`:
- Around line 4-17: bgTranslations currently hardcodes only en/zh and uses keys
addTodo/notificationTitle while new locale files use
todoContextMenuAdd/todoNotificationTitle; replace the hardcoded bgTranslations
usage by fetching strings from the extension i18n API (chrome.i18n.getMessage or
browser.i18n.getMessage) at runtime for the two labels instead of relying on
bgTranslations, mapping addTodo -> getMessage('todoContextMenuAdd') and
notificationTitle -> getMessage('todoNotificationTitle'); update any code
referencing bgTranslations.addTodo or bgTranslations.notificationTitle to call
the i18n lookup so all locales are covered and fallbacks are handled by the
platform.
- Around line 100-132: The background check currently re-sends notifications for
every pending task on startup and hourly (checkDueTasks + setInterval) causing
duplicates because the page already emits reminders; change checkDueTasks so it
only notifies a task once per day by persisting a per-task last-notified date
(e.g., add or update a todo.lastNotified or a separate storage map keyed by task
id) and only call chrome.notifications.create when that stored date is different
from today (and update the stored date to today after notifying); alternatively
remove the initial call on service worker start (remove the lone checkDueTasks()
call) if you prefer the page to own startup reminders, and ensure completed
tasks clear their last-notified entry when status changes.
- Around line 128-132: Replace the transient setInterval usage with
chrome.alarms: remove the setInterval(checkDueTasks, 3600000) and instead create
a persistent alarm via chrome.alarms.create(...) to fire hourly, register a
chrome.alarms.onAlarm.addListener that calls checkDueTasks, and keep the initial
one-time checkDueTasks() call on service worker start; update any references to
setInterval and ensure the alarm name matches what the onAlarm handler checks so
checkDueTasks is invoked reliably across service worker restarts.
- Around line 19-27: getBackgroundLanguage currently uses window.localStorage
which is not available in an MV3 service worker; change getBackgroundLanguage()
to an async function that reads chrome.storage.local (e.g., await
chrome.storage.local.get("selectedLanguage")) and returns the stored value or
"en", update getBgTranslation(key) to be async (or accept a resolved language
param) so it awaits getBackgroundLanguage() before indexing bgTranslations, and
update any callers of getBgTranslation/getBackgroundLanguage to await the
promise (e.g., context menu and notification initialization) so no synchronous
localStorage access remains.

In `@scripts/todo-list.js`:
- Around line 128-133: The code is converting a date-only input into an ISO UTC
timestamp (using new Date(dueDateInput.value) and date.setUTCHours(...); dueDate
= date.toISOString()), which causes day shifts across time zones; instead
persist the raw calendar date string from dueDateInput.value (YYYY-MM-DD) or use
a local-date helper so filters/notifications compare dates as calendar days.
Update the logic around dueDateInput/dueDate to assign dueDate =
dueDateInput.value (or pass through a local-date parser) and apply the same
change to the other occurrence around the block handling lines 338-343 to ensure
consistency.
- Around line 333-350: The code is storing escaped HTML into the model by using
sanitizeInput(newTitle) for todo.title and then rendering with innerHTML, which
double-escapes entities; instead assign the raw trimmed text to todo.title (use
previousTitle when empty) and remove sanitizeInput from the model assignment
(references: sanitizeInput, todo.title, previousTitle), then ensure rendering
uses safe text assignment rather than innerHTML (replace
newTaskContent.innerHTML usage with a text-safe render such as setting
textContent or otherwise escaping at render time) so the model keeps raw text
and escaping only happens during render.
- Around line 145-149: The code mutates the DOM directly (creating li via
createTodoItemDOM and appending to todoulList) which breaks active filter/sort
state; instead, after updating the todoList data and calling SaveToDoData(),
stop doing the incremental append/clearing and call renderTodoList() to rebuild
the view from todoList so filters/sorts are applied; update the places that
create DOM nodes (uses of createTodoItemDOM/todoulList.appendChild and
SaveToDoData in the add/edit/complete handlers) to remove direct appendChild and
invoke renderTodoList() after saving.

In `@style.css`:
- Around line 1220-1233: The CSS uses an undefined variable --accent-color-blue
in the .todo-actions button and its :hover rule, so the buttons fall back to
initial colors; fix by either adding a definition for --accent-color-blue (e.g.,
in :root where other blue variables like --darkColor-blue and
--accentLightTint-blue are defined) or update the rules to use an existing
variable name (for example --darkColor-blue or --accentLightTint-blue) and
adjust the hover color to use color-mix with that same defined variable; update
the .todo-actions button and .todo-actions button:hover references accordingly.
- Around line 1518-1528: The CSS selectors for priority badges use localized
class names (.priority-高, .priority-中, .priority-低) but the JS now emits
.priority-high, .priority-medium, and .priority-low; update the selectors in
style.css to target .priority-high, .priority-medium, and .priority-low (keeping
the existing background-color/color-mix values) so the badges receive the
intended colors; also search for any other occurrences of the old localized
class names and replace them with the new English names to keep styles
consistent with scripts/todo-list.js.

---

Outside diff comments:
In `@locales/mr.js`:
- Around line 1-186: The Marathi locale file is missing several keys referenced
elsewhere, causing mixed-language UI; add the missing translation keys to the mr
object (e.g., personalizationSectionTitle, clockSectionTitle, hideClockBox,
hideClockBoxInfo, PrivacyPolicy, useGPSInfo, bookmarkSortBy and the theme labels
such as lightTheme/darkTheme/autoTheme or whatever theme keys other locales use)
with Marathi strings matching the style of existing keys so scripts/languages.js
and index.html can find them; ensure the keys exactly match the identifiers used
in the codebase (e.g., "personalizationSectionTitle", "clockSectionTitle",
"hideClockBox", "hideClockBoxInfo", "defaultEngine" if overridden,
"PrivacyPolicy", "useGPSInfo", "bookmarkSortBy", and theme label keys) and run a
quick locale check against another complete locale to confirm none are missing.

In `@locales/th.js`:
- Line 145: The "evening" translation string contains a stray leading
single-quote character; locate the "evening" key in locales/th.js and remove the
extra apostrophe so the value is a proper quoted string (i.e., evening:
"สวัสดีตอนเย็น!"), ensuring the surrounding quotes are balanced and no stray
characters remain.

In `@scripts/languages.js`:
- Around line 90-96: The list specialDecimalLanguages currently contains "ko",
which causes code in the block that checks if
(specialDecimalLanguages.includes(language)) and then does text =
text.replace(".", ",") to incorrectly change Korean numeric decimals; remove
"ko" from the specialDecimalLanguages array so that language === "ko" no longer
triggers that replacement (ensure the array literal used to define
specialDecimalLanguages is updated accordingly).

In `@scripts/todo-list.js`:
- Around line 233-240: The click handler currently checks only
event.target.tagName === "LI", so clicks on child elements like .task-content or
.task-meta are ignored; change the handler to find the nearest ancestor li with
a data-todoitem (use event.target.closest('li[data-todoitem]')) and return if
none, maintain the existing suppressNextClick check, and also skip toggling when
the click originated on control buttons (e.g., selectors for edit/pin/remove or
elements with a specific control class). Then toggle the found li's "checked"
class, read its dataset.todoitem into id, update todoList[id].status between
"completed" and "pending", and call SaveToDoData(); keep references to the
existing symbols todoulList (event listener), suppressNextClick, todoList, and
SaveToDoData.

---

Nitpick comments:
In `@todo-import.json`:
- Around line 1-11: The test JSON file with key "t1234567890" contains
development data that should not be merged as-is; either remove the file from
the PR (or add it to .gitignore) if it’s only for testing, or normalize its
fields for production: change "category" from localized text to a semantic key
(e.g., "category": "study"), update "createdAt" and "dueDate" to valid future or
relative-example dates, and ensure "status", "priority", and "pinned" follow the
canonical enum/format used by the import system before keeping it in the repo.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ce1addfd-b2fc-4715-b231-3d0fb0b2da39

📥 Commits

Reviewing files that changed from the base of the PR and between e24ed73 and 2a17e44.

📒 Files selected for processing (48)
  • CHANGELOG.md
  • README.md
  • index.html
  • locales/ar_SA.js
  • locales/az.js
  • locales/bn.js
  • locales/cs.js
  • locales/de.js
  • locales/el.js
  • locales/en.js
  • locales/es.js
  • locales/fa.js
  • locales/fr.js
  • locales/hi.js
  • locales/hu.js
  • locales/idn.js
  • locales/it.js
  • locales/ja.js
  • locales/ko.js
  • locales/mr.js
  • locales/np.js
  • locales/pl.js
  • locales/pt.js
  • locales/ru.js
  • locales/sl.js
  • locales/ta.js
  • locales/th.js
  • locales/tr.js
  • locales/uk.js
  • locales/ur.js
  • locales/uz.js
  • locales/vi.js
  • locales/zh.js
  • locales/zh_TW.js
  • manifest(firefox).json
  • manifest.json
  • scripts/background.js
  • scripts/bookmarks.js
  • scripts/clock.js
  • scripts/languages.js
  • scripts/search.js
  • scripts/shortcuts.js
  • scripts/theme.js
  • scripts/todo-list.js
  • scripts/weather.js
  • style.css
  • todo-import.json
  • tools/languagesAnalysis.html
💤 Files with no reviewable changes (4)
  • scripts/weather.js
  • scripts/bookmarks.js
  • scripts/clock.js
  • CHANGELOG.md

Comment thread index.html
Comment on lines +101 to +135
<div class="task-controls">
<select id="todoCategory">
<option value="uncategorized" data-i18n="todoCategoryUncategorized">Uncategorized</option>
<option value="work" data-i18n="todoCategoryWork">Work</option>
<option value="life" data-i18n="todoCategoryLife">Life</option>
<option value="study" data-i18n="todoCategoryStudy">Study</option>
<option value="other" data-i18n="todoCategoryOther">Other</option>
</select>
<select id="todoPriority">
<option value="medium" data-i18n="todoPriorityMedium">Medium</option>
<option value="high" data-i18n="todoPriorityHigh">High</option>
<option value="low" data-i18n="todoPriorityLow">Low</option>
</select>
<input type="date" id="todoDueDate" placeholder="截止日期">
<button id="todoAdd">+</button>
</div>
</div>
<div class="todo-actions">
<button id="todoImport" data-i18n="importText">Import</button>
<button id="todoExport" data-i18n="exportText">Export</button>
</div>
<div class="todo-filters">
<select id="todoFilter">
<option value="all" data-i18n="todoFilterAll">All</option>
<option value="pending" data-i18n="todoFilterPending">Pending</option>
<option value="completed" data-i18n="todoFilterCompleted">Completed</option>
<option value="overdue" data-i18n="todoFilterOverdue">Overdue</option>
<option value="today" data-i18n="todoFilterToday">Today</option>
</select>
<select id="todoSort">
<option value="created" data-i18n="todoSortCreated">Created</option>
<option value="priority" data-i18n="todoSortPriority">Priority</option>
<option value="due" data-i18n="todoSortDue">Due Date</option>
</select>
</div>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Add accessible labels to the new task controls.

The new category, priority, due-date, filter, and sort controls are unlabeled. Without a <label> or aria-label, screen-reader users only hear the raw control state, not what each control does.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@index.html` around lines 101 - 135, The new task controls lack accessible
labels; update the elements with IDs todoCategory, todoPriority, todoDueDate,
todoFilter, and todoSort (and any action buttons like
todoAdd/todoImport/todoExport if unlabeled) to provide screen-reader friendly
names by either adding <label for="..."> elements associated with each ID or
adding descriptive aria-label attributes (e.g., aria-label="Category",
aria-label="Priority", aria-label="Due date", aria-label="Filter todos",
aria-label="Sort todos"); ensure labels are visible or use visually-hidden CSS
for sighted users, and confirm the todoDueDate input has an appropriate label
describing the expected date format.

Comment thread locales/az.js
Comment on lines 27 to +30
// "todoListText": "To Do List",
// "todoListInfo": "Show a daily To Do list",
// "todoListHover": "ToDo List", // Keep this short
// "todoPlaceholder": "Add task...",
"todoListInfo": "Gündəlik tapşırıqlar siyahısını göstər",
"todoListHover": "To-Do Siyahısı",
"todoPlaceholder": "Tapşırıq əlavə et...",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Add the missing todoListText translation.

This locale translates the new todo controls, but the main title key is still missing, so #todoListHeading and the settings toggle fall back to English instead of Azerbaijani.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@locales/az.js` around lines 27 - 30, Add the missing Azeri translation for
the main todo title by restoring the "todoListText" key in this locale object;
update locales/az.js to include "todoListText": "Tapşırıqlar siyahısı" (or the
correct Azeri phrase) alongside the existing keys ("todoListInfo",
"todoListHover", "todoPlaceholder") so `#todoListHeading` and the settings toggle
no longer fall back to English.

Comment thread locales/fr.js
"WeatherApiText": "Entrez votre clé WeatherAPI",
"WeatherApiSubtext": "Si la fonctionnalité météo ne fonctionne pas",
"userAPI": "Votre clé WeatherAPI",
"userAPI": "Your weatherAPI key",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Translate userAPI to French.

This string is in English ("Your weatherAPI key") while the rest of the French locale file uses French translations. It should be translated for consistency with other user-facing strings in this locale.

"Votre clé WeatherAPI"
🔧 Proposed fix
-    "userAPI": "Your weatherAPI key",
+    "userAPI": "Votre clé WeatherAPI",
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@locales/fr.js` at line 111, Update the French localization entry for the key
"userAPI" in locales/fr.js to a French string; replace the English value "Your
weatherAPI key" with the provided French translation "Votre clé WeatherAPI" so
the "userAPI" property matches the rest of the French locale.

Comment thread locales/hu.js
Comment on lines +3 to +162
// Menu Items
"feedback": "Visszajelzés",
"resetsettings": "Beállítások visszaállítása",
"menuCloseText": "Bezárás",

// Shortcuts
"shortcutsText": "Parancsikonok",
"enableShortcutsText": "Parancsikonok megjelenítése",
"editShortcutsText": "Parancsikonok szerkesztése",
"shortcutsInfoText": "Válassza ki a parancsikonokat, amelyeket meg szeretné jeleníteni a kezdőképernyőn",
"editShortcutsList": "Elmentett parancsikonok",
"editShortcutsListInfo": "Új parancsikonokat adhatsz hozzá a \"+\" ikonra kattintva, vagy szerkesztheted a meglévőket a parancsikon nevére vagy URL címére kattintva.",
"adaptiveIconText": "Alkalmazkodó ikonformák",
"adaptiveIconInfoText": "Parancsikonok kisebbnek fognak tűnni",
"bookmarksText": "Könyvjelzők",
"bookmarksInfo": "Könyvjelzők oldalsáv megjelenítése",
"ai_tools_button": "MI-Eszközök",
"enable_ai_tools": "Parancsikon az MI-eszközökhöz",
"googleAppsMenuText": "Google Alkalmazások",
"googleAppsMenuInfo": "Parancsikonok a Google alkalmazásaihoz",
"googleAppsHover": "Google Appok",

// To-do List
"todoListText": "Teendő lista",
"todoListInfo": "Napi teendők lista megjelenítése",
"todoListHover": "Teendő lista",
"todoPlaceholder": "Feladat hozzáadása...",
"todoCategoryAll": "Mind",
"todoCategoryUncategorized": "Kategorizálatlan",
"todoCategoryWork": "Munka",
"todoCategoryLife": "Élet",
"todoCategoryStudy": "Tanulás",
"todoCategoryOther": "Egyéb",
"todoPriorityHigh": "Magas",
"todoPriorityMedium": "Közepes",
"todoPriorityLow": "Alacsony",
"todoFilterAll": "Mind",
"todoFilterPending": "Függőben",
"todoFilterCompleted": "Kész",
"todoFilterOverdue": "Lejárt",
"todoFilterToday": "Ma",
"todoSortCreated": "Létrehozva",
"todoSortPriority": "Prioritás",
"todoSortDue": "Határidő",
"todoImportSuccess": "Import sikeres!",
"todoImportFailed": "Import sikertelen: érvénytelen JSON fájl",
"todoDueOverdue": "Lejárt",
"todoDueToday": "Ma esedékes",
"todoNotificationTitle": "Feladat emlékeztető",
"todoContextMenuAdd": "Hozzáadás a listához",
"importText": "Import",
"exportText": "Export",

// Digital Clock
"digitalclocktitle": "Digitális óra",
"digitalclockinfo": "Váltás a digitális órára",
"timeformattitle": "12 órás formátum",
"timeformatinfo": "12 órás időformátum használata",
"greetingtitle": "Üdvözlés",
"greetinginfo": "Üdvözlet megjelenítése az egyéni szöveg alatt",

// Misc
"userTextTitle": "Testreszabható szöveg",
"userTextInfo": "Egyéni szöveg megjelenítése az óra alatt",
"fahrenheitCelsiusCheckbox": "Fahrenheit használata",
"fahrenheitCelsiusText": "Frissítsd az oldalt a módosítások alkalmazásához",
"micIconTitle": "Mikrofon ikon elrejtése",
"micIconInfo": "Ha a hangalapú gépelés nem működik",
"hideSearchWith": "Keresőmotorok elrejtése",
"hideSearchWithInfo": "Váltás a keresőmotorok között az ikonra kattintva",
"search_suggestions_button": "Keresési javaslatok",
"search_suggestions_text": "Keresési javaslatok bekapcsolása",

// Proxy
"useproxytitletext": "Proxy megkerülése",
"useproxyText": "Ha a keresési javaslatok nem működnek",
"ProxyText": "CORS megkerülő proxy",
"ProxySubtext": "Saját CORS megkerülő proxy hozzáadása",
"HostproxyButton": "Saját proxy üzemeltetése",

// Location
"UserLocText": "Add meg a tartózkodási helyed",
"UserLocSubtext": "Ha az időjárás helye nem megfelelő",
"userLoc": "A városod vagy koordinátáid (földrajzi szélesség, hosszúság)",

// Weather
"WeatherApiText": "Add meg a WeatherAPI kulcsodat",
"WeatherApiSubtext": "Ha az időjárási funkciók nem működnek",
"userAPI": "A weatherAPI kulcsod",
"LearnMoreButton": "További információk",
"saveAPI": "Mentés",

// Body Items
// Calendar
"days": ['Vasárnap', 'Hétfő', 'Kedd', 'Szerda', 'Csütörtök', 'Péntek', 'Szombat'],
"months": ['Január', 'Február', 'Március', 'Április', 'Május', 'Június', 'Július', 'Augusztus', 'Szeptember', 'Október', 'November', 'December'],

// Weather
"humidityLevel": "Páratartalom",
"feelsLike": "Érzés",
"location": "Föld",

// Bookmarks
"bookmarksHeading": "Könyvjelzők",
"bookmarkViewAs": "Megjelenítés mint",
"bookmarkViewGrid": "Rács",
"bookmarkViewList": "Lista",
"bookmarkSearch": "Könyvjező keresése",

// New Tab Item
"conditionText": "Szia! Hogy vagy ma?",
"enterBtn": "Keresés",
"searchPlaceholder": "Írj ide...",
"listenPlaceholder": "Hallgatlak...",
"searchWithHint": "Keresés a következővel",
"userText": "Kattints ide a szerkesztéshez",

// Greeting
greeting: {
"morning": "Jó reggelt!",
"afternoon": "Jó napot!",
"evening": "Jó estét!"
},

// Search Engines and rest
"googleEngine": "Google",
"duckEngine": "Duck",
"bingEngine": "Bing",
"braveEngine": "Brave",
"youtubeEngine": "YouTube",

// AI Tools
"ai_tools": "MI Eszközök",
"chatGPT": "ChatGPT",
"gemini": "Gemini",
"copilot": "Copilot",
"claude": "Claude",
"perplexity": "Perplexity",
"metaAI": "Meta AI",
"github": "GitHub",

// Wallpaper and misc
"uploadWallpaperText": "Háttérkép feltöltése",
"backupText": "Mentés",
"restoreText": "Visszaállítás",
"rangColor": "Szín kiválasztása",

// Dialog boxes (alerts)
"confirmWallpaper": "Szeretnél egy újabb képet beállítani a napi háttérképednek?",
"confirmRestore": "Biztos, hogy vissza akarja állítani a beállításokat? Ezt a műveletet nem lehet visszacsinálni.",
"Nobackgroundset": "Jelenleg nincs beállítva háttérkép.",
"clearbackgroundimage": "Biztos, hogy törölni szeretnéd a háttérképet?",
"ProxyDisclaimer": "Alapértelmezés szerint minden proxy funkció ki van kapcsolva.\n\nHa engedélyezed a keresési javaslatokat és a CORS megkerülő proxy-t, erősen ajánlott saját proxy-t üzemeltetni a fokozott adatvédelem érdekében.\n\n\nA proxy alapértelmezés szerint a https://mynt-proxy.rhythmcorehq.com beállítással működik, ami azt jelenti, hogy minden adat ezen a szolgáltatáson keresztül fog menni, ami adatvédelmi aggályokat vethet fel.",
"failedbackup": "Sikertelen mentés: ",
"restorecompleted": "A visszaállítás sikeresen befejeződött!",
"restorefailed": "Sikertelen visszaállítás: ",
"invalidBackup": "Érvénytelen mentési fájl",
"deleteBookmark": "Biztos, hogy törölni szeretnéd a könyvjelzőt \"{title}\"?",
"UnsupportedBrowser": "A könyvjelzők nem támogatottak a böngészőben",
}; No newline at end of file

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

This locale now falls back to English for many existing screens.

The file no longer provides several keys that the page still renders, e.g. personalizationSectionTitle, hideClockBox, hideClockBoxInfo, defaultEngine, gImagesEngine, redditEngine, wikipediaEngine, quoraEngine, PrivacyPolicy, useGPS, useGPSInfo, and the theme labels. Hungarian users will get a partially untranslated UI after this change.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@locales/hu.js` around lines 3 - 162, The Hungarian locale is missing many UI
keys so users see English fallbacks; restore the missing translation keys by
adding Hungarian strings for the listed identifiers (e.g.
personalizationSectionTitle, hideClockBox, hideClockBoxInfo, defaultEngine,
gImagesEngine, redditEngine, wikipediaEngine, quoraEngine, PrivacyPolicy,
useGPS, useGPSInfo and all theme label keys) into locales/hu.js (matching the
same key names used in other locales) so the UI renders fully translated; ensure
you add them alongside the existing entries and follow the same object/key
formatting as other locale entries.

Comment thread locales/np.js
"todoFilterAll": "सबै",
"todoFilterPending": "पर्खिरहेको",
"todoFilterCompleted": "पूर्ण",
"todoFilterOverdue": "अल标记हेको",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Fix corrupted Nepali translation for "overdue".

The translation "todoFilterOverdue": "अल标记हेको" contains Chinese characters "标记" mixed with Devanagari script. This is corrupted text that will display incorrectly to users. The correct Nepali translation for "overdue" should be pure Devanagari text, such as "ढिलो भएको" or similar.

Do you need help finding the correct Nepali translation for this term?

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@locales/np.js` at line 43, The value for the localization key
"todoFilterOverdue" contains mixed Chinese characters and must be replaced with
a correct Nepali string; update the entry for todoFilterOverdue (in the
locales/np object) to a pure Devanagari translation such as "ढिलो भएको" (or
another validated Nepali phrase for "overdue") and ensure the file is saved with
UTF-8 encoding so the Devanagari characters render correctly.

Comment thread scripts/todo-list.js
Comment on lines +128 to +133
if (dueDateInput && dueDateInput.value) {
// 处理时区问题,确保日期正确
const date = new Date(dueDateInput.value);
// 设置为UTC时间的当天开始,避免时区偏移
date.setUTCHours(0, 0, 0, 0);
dueDate = date.toISOString();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Store due dates as calendar days, not UTC timestamps.

<input type="date"> gives a date-only value, but this converts it to an ISO UTC instant. In non-UTC time zones, the same task can shift a day early/late when today/overdue filters and notifications read it back. Persist the raw YYYY-MM-DD string (or parse with a consistent local-date helper) instead of toISOString().

Also applies to: 338-343

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/todo-list.js` around lines 128 - 133, The code is converting a
date-only input into an ISO UTC timestamp (using new Date(dueDateInput.value)
and date.setUTCHours(...); dueDate = date.toISOString()), which causes day
shifts across time zones; instead persist the raw calendar date string from
dueDateInput.value (YYYY-MM-DD) or use a local-date helper so
filters/notifications compare dates as calendar days. Update the logic around
dueDateInput/dueDate to assign dueDate = dueDateInput.value (or pass through a
local-date parser) and apply the same change to the other occurrence around the
block handling lines 338-343 to ensure consistency.

Comment thread scripts/todo-list.js
Comment on lines +145 to 149
const li = createTodoItemDOM(t, rawText, "pending", false, category, priority, dueDate); // Create List item
todoulList.appendChild(li); // Append the new item to the DOM immediately
todoInput.value = ""; // Clear Input
if (dueDateInput) dueDateInput.value = ""; // Clear due date input
SaveToDoData(); // Save changes

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Re-render after mutations so filter/sort stays correct.

These paths patch the DOM in place and only persist todoList. With any active filter/sort other than the default view, the UI becomes stale immediately: newly added items appear in the wrong filtered view, completed items remain visible in Pending, and priority/due edits do not re-order the list. After mutating todoList, rebuild the list from renderTodoList() instead of incrementally editing the current DOM.

Also applies to: 233-251, 389-394

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/todo-list.js` around lines 145 - 149, The code mutates the DOM
directly (creating li via createTodoItemDOM and appending to todoulList) which
breaks active filter/sort state; instead, after updating the todoList data and
calling SaveToDoData(), stop doing the incremental append/clearing and call
renderTodoList() to rebuild the view from todoList so filters/sorts are applied;
update the places that create DOM nodes (uses of
createTodoItemDOM/todoulList.appendChild and SaveToDoData in the
add/edit/complete handlers) to remove direct appendChild and invoke
renderTodoList() after saving.

Comment thread scripts/todo-list.js
Comment on lines 333 to +350
const newTitle = input.value.trim();
todo.title = (newTitle !== "") ? sanitizeInput(newTitle) : previousTitle; //Check for empty title
const textNode = document.createTextNode(todo.title);
li.insertBefore(textNode, input);
todo.title = (newTitle !== "") ? sanitizeInput(newTitle) : previousTitle;
todo.category = categorySelect.value;
todo.priority = prioritySelect.value;
let dueDate = null;
if (dueDateInput.value) {
// 处理时区问题,确保日期正确
const date = new Date(dueDateInput.value);
// 设置为UTC时间的当天开始,避免时区偏移
date.setUTCHours(0, 0, 0, 0);
dueDate = date.toISOString();
}
todo.dueDate = dueDate;

// Recreate the task content and metadata
const newTaskContent = document.createElement("div");
newTaskContent.className = "task-content";
newTaskContent.innerHTML = sanitizeInput(todo.title);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Don't persist escaped HTML into todo.title.

sanitizeInput(newTitle) stores entities in the model, and the render path escapes again. Titles containing &, <, or > will be corrupted after edit and can show up as entity text later. Store raw text in todo.title and only escape at render time, preferably via textContent.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/todo-list.js` around lines 333 - 350, The code is storing escaped
HTML into the model by using sanitizeInput(newTitle) for todo.title and then
rendering with innerHTML, which double-escapes entities; instead assign the raw
trimmed text to todo.title (use previousTitle when empty) and remove
sanitizeInput from the model assignment (references: sanitizeInput, todo.title,
previousTitle), then ensure rendering uses safe text assignment rather than
innerHTML (replace newTaskContent.innerHTML usage with a text-safe render such
as setting textContent or otherwise escaping at render time) so the model keeps
raw text and escaping only happens during render.

Comment thread style.css
Comment on lines +1220 to +1233
.todo-actions button {
padding: 5px 10px;
background-color: var(--accent-color-blue);
color: var(--whitishColor-blue);
border: none;
border-radius: 5px;
cursor: pointer;
font-size: 0.8rem;
transition: background-color 0.2s ease;
}

.todo-actions button:hover {
background-color: color-mix(in srgb, var(--accent-color-blue) 80%, white);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

--accent-color-blue is not defined.

This file defines --darkColor-blue / --accentLightTint-blue, but not --accent-color-blue. These button backgrounds will therefore fall back to the initial value, so the import/export buttons won't get the intended theme color.

Suggested fix
 .todo-actions button {
 	padding: 5px 10px;
-	background-color: var(--accent-color-blue);
+	background-color: var(--darkColor-blue);
 	color: var(--whitishColor-blue);
 	border: none;
 	border-radius: 5px;
 	cursor: pointer;
 	font-size: 0.8rem;
 	transition: background-color 0.2s ease;
 }
 
 .todo-actions button:hover {
-	background-color: color-mix(in srgb, var(--accent-color-blue) 80%, white);
+	background-color: color-mix(in srgb, var(--darkColor-blue) 80%, white);
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@style.css` around lines 1220 - 1233, The CSS uses an undefined variable
--accent-color-blue in the .todo-actions button and its :hover rule, so the
buttons fall back to initial colors; fix by either adding a definition for
--accent-color-blue (e.g., in :root where other blue variables like
--darkColor-blue and --accentLightTint-blue are defined) or update the rules to
use an existing variable name (for example --darkColor-blue or
--accentLightTint-blue) and adjust the hover color to use color-mix with that
same defined variable; update the .todo-actions button and .todo-actions
button:hover references accordingly.

Comment thread style.css
Comment on lines +1518 to +1528
.priority-高 {
background-color: color-mix(in srgb, #ff4757 30%, transparent);
}

.priority-中 {
background-color: color-mix(in srgb, #ffa502 30%, transparent);
}

.priority-低 {
background-color: color-mix(in srgb, #2ed573 30%, transparent);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Priority badge selectors no longer match the generated class names.

scripts/todo-list.js now emits priority-high, priority-medium, and priority-low, but these rules still target the old localized class names. As a result, all priority badges render without their severity colors.

Suggested fix
-.priority-高 {
+.priority-high {
 	background-color: color-mix(in srgb, `#ff4757` 30%, transparent);
 }
 
-.priority-中 {
+.priority-medium {
 	background-color: color-mix(in srgb, `#ffa502` 30%, transparent);
 }
 
-.priority-低 {
+.priority-low {
 	background-color: color-mix(in srgb, `#2ed573` 30%, transparent);
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
.priority- {
background-color: color-mix(in srgb, #ff4757 30%, transparent);
}
.priority- {
background-color: color-mix(in srgb, #ffa502 30%, transparent);
}
.priority- {
background-color: color-mix(in srgb, #2ed573 30%, transparent);
}
.priority-high {
background-color: color-mix(in srgb, `#ff4757` 30%, transparent);
}
.priority-medium {
background-color: color-mix(in srgb, `#ffa502` 30%, transparent);
}
.priority-low {
background-color: color-mix(in srgb, `#2ed573` 30%, transparent);
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@style.css` around lines 1518 - 1528, The CSS selectors for priority badges
use localized class names (.priority-高, .priority-中, .priority-低) but the JS now
emits .priority-high, .priority-medium, and .priority-low; update the selectors
in style.css to target .priority-high, .priority-medium, and .priority-low
(keeping the existing background-color/color-mix values) so the badges receive
the intended colors; also search for any other occurrences of the old localized
class names and replace them with the new English names to keep styles
consistent with scripts/todo-list.js.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants