diff --git a/html/popup.html b/html/popup.html index 490e926..41cb077 100644 --- a/html/popup.html +++ b/html/popup.html @@ -319,6 +319,10 @@ +
+ + +
diff --git a/js/content.js b/js/content.js index 765eb2e..78c20e4 100644 --- a/js/content.js +++ b/js/content.js @@ -928,6 +928,7 @@ function applyOptionsChanges(changes) { case "todo_timeframe": // case "todo_overdues": case "todo_hide_feedback": + case "todo_hide_read": case "todo_full_height": case "todo_ignore_card_colors": case "todo_remove_icons": @@ -3285,7 +3286,18 @@ async function createTodoSections(location) { return cid === String(betterTodoProgressFilter); }); - announcements = displayData.filter(item => item.plannable_type == "announcement"); + // Announcements: dismissed (marked-complete) ones are always + // hidden, and already-read ones are hidden unless the user turned + // "Hide read announcements" off. This mirrors how native Canvas + // clears announcements from the to-do once seen; without it the list + // accumulated every announcement in the lookback window (reporters + // saw 200+ "Seen" entries from a single year). + announcements = displayData.filter(item => { + if (item.plannable_type != "announcement") return false; + if (item.planner_override?.marked_complete === true) return false; + if (options.todo_hide_read !== false && item.plannable.read_state == "read") return false; + return true; + }); // Pinned items (locally forced incomplete, e.g. a submitted assignment // the user sent back to Tasks) always count as due; everything else is // due only when neither submitted nor marked complete. @@ -3824,15 +3836,30 @@ function populateAnnouncements() { `}
-
+
${item.context_name} ${item.plannable.title} ${convertToDueDate(item.plannable_date)}
+ + + + + +
`; + // "Mark as seen": sets the same planner override the task checkmark + // uses, which also hides the announcement from the list (see the + // announcements filter in createTodoSections). Two-way, so with "Hide + // read announcements" off a dismissed one can be un-seen again. + announcement.querySelector(".better-todo-announcement-checkmark").addEventListener("click", (e) => { + e.preventDefault(); + e.stopPropagation(); + markAs(item, announcement.firstElementChild, !(item.planner_override?.marked_complete === true)); + }); attachTodoHoverPreview(announcement, item); }); } diff --git a/js/popup.js b/js/popup.js index 5e60da1..00585d1 100644 --- a/js/popup.js +++ b/js/popup.js @@ -2,6 +2,7 @@ const syncedSwitches = ['remind', 'tab_icons', 'dark_mode', 'remlogo', 'full_wid const syncedSubOptions = [ "grade_analytics_zones", "todo_hide_feedback", + "todo_hide_read", "todo_full_height", "todo_confetti", "todo_progress_rings", @@ -58,7 +59,7 @@ const exportCardColorToggles = ["gradient_cards", "disable_color_overlay"]; const exportCardStyles = ["customCardStyles", "imageSize", "cardRoundness", "imageRoundness", "cardSpacing", "cardWidth", "cardHeight", "cardPadding"]; const exportLayout = ["full_width", "center_cards", "condensed_cards", "equal_height_cards", "remlogo", "hide_new_canvas", "tab_icons"]; const exportSidebar = ["better_sidebar", "sidebar_scale"]; -const exportTodo = ["better_todo", "todo_hide_feedback", "todo_full_height", "todo_confetti", "todo_progress_rings", "todo_timeframe", "todo_hr24", "todo_separate_scrollbar", "todo_alternate_colors", "todo_ignore_card_colors", "todo_remove_icons", "hover_preview"]; +const exportTodo = ["better_todo", "todo_hide_feedback", "todo_hide_read", "todo_full_height", "todo_confetti", "todo_progress_rings", "todo_timeframe", "todo_hr24", "todo_separate_scrollbar", "todo_alternate_colors", "todo_ignore_card_colors", "todo_remove_icons", "hover_preview"]; const exportGpa = ["gpa_calc", "gpa_calc_prepend", "gpa_calc_cumulative", "gpa_calc_weighted"]; const exportBackground = ["customBackgroundLink", "customBackgroundScale", "customBackgroundDaily", "customBackgroundNasaDaily", "fitImageToScreen", "card_transparency", "bg_opacity", "sidebar_opacity", "bg_blur", "sidebar_blur", "card_opacity", "card_blur"]; // Master "On/off toggles" = every visual toggle (no GPA, no dark-mode schedule, @@ -120,6 +121,7 @@ const defaultOptions = { "todo_alternate_colors": false, "todo_ignore_card_colors": false, "todo_remove_icons": false, + "todo_hide_read": true, "condensed_cards": false, "center_cards": false, "custom_cards": {}, @@ -945,6 +947,7 @@ function setup() { "gpa_calc_cumulative", // /*'card_method_date',*/ "show_updates", "todo_hide_feedback", + "todo_hide_read", "todo_confetti", "todo_full_height", "device_dark", @@ -1853,6 +1856,7 @@ function saveCurrentTheme() { "custom_font": current["custom_font"], "better_todo": current["better_todo"], "todo_hide_feedback": current["todo_hide_feedback"], + "todo_hide_read": current["todo_hide_read"] !== false, "todo_full_height": current["todo_full_height"], "todo_confetti": current["todo_confetti"], "todo_progress_rings": current["todo_progress_rings"],