diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 1a1262a..5f5b6bc 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -1082,6 +1082,15 @@ "next_timeframe": { "message": "Look ahead to the next timeframe" }, + "notes_suppressor": { + "message": "Canvas Notes Suppressor" + }, + "notes_suppressor_desc": { + "message": "Hides Canvas' \"Mark unclear / Mark important\" popup that appears when you select text." + }, + "notes_suppressor_info_label": { + "message": "Canvas Notes Suppressor info" + }, "no_auto_detect": { "message": "Don't auto detect canvases" }, diff --git a/html/popup.html b/html/popup.html index 5010ec1..6c037ee 100644 --- a/html/popup.html +++ b/html/popup.html @@ -195,6 +195,14 @@
Global Canvas Search +
+ + +
+
+
+
Color coded tab icons +
@@ -459,14 +467,6 @@
Full Width Fix -
- - -
-
-
-
Color coded tab icons -
@@ -483,6 +483,18 @@
Hide Next/Previous Buttons +
+ + +
+
+
+
Canvas Notes Suppressor + + + Hides Canvas' "Mark unclear / Mark important" popup that appears when you select text. + +
diff --git a/js/content.js b/js/content.js index 2edca3a..fd16787 100644 --- a/js/content.js +++ b/js/content.js @@ -76,6 +76,7 @@ function setupNavigationListener() { watchSequenceFooter(); applyHideSidebar(); applyHideAssignmentSidebar(); + applyNotesSuppressor(); watchSubmissionPageButton(); watchProfileLogoutPageButton(); watchGradeAnalytics(); @@ -1084,6 +1085,7 @@ function startExtension() { checkDashboardReady(); loadCustomFont(); applyAestheticChanges(); + applyNotesSuppressor(); watchNewCanvasButton(); changeFavicon(); updateReminders(); @@ -1529,6 +1531,9 @@ function applyOptionsChanges(changes) { // Feature gating changes on quiz pages; reload to apply cleanly. if (isQuizPage()) window.location.reload(); break; + case "notes_suppressor": + applyNotesSuppressor(); + break; case "sidebar_scale": { const existingSidebar = document.getElementById("better-sidebar-container"); if (existingSidebar) { @@ -1961,6 +1966,28 @@ async function applyCustomBackground() { document.documentElement.appendChild(style); } +/* +Canvas Notes Suppressor + +Canvas' built-in notes feature pops a "Mark unclear / Mark important" toolbar +(#notebook-inline-reaction-menu) over selected text. On by default (notes_suppressor); +a plain stylesheet toggle hides it, and quiz safe mode yields to default Canvas. +*/ +function applyNotesSuppressor() { + const on = options.notes_suppressor !== false && !quizSafeModeActive(); + let style = document.getElementById("canvasrefined-notes-suppressor"); + if (!on) { + if (style) style.remove(); + return; + } + if (!style) { + style = document.createElement("style"); + style.id = "canvasrefined-notes-suppressor"; + document.documentElement.appendChild(style); + } + style.textContent = "#notebook-inline-reaction-menu{display:none !important;visibility:hidden !important;}"; +} + function applyBetterSidebarLayoutFix() { let style = document.querySelector("#canvasrefined-sidebar-layout-fix") || document.createElement("style"); style.id = "canvasrefined-sidebar-layout-fix"; diff --git a/js/popup.js b/js/popup.js index 79db0ae..340fbda 100644 --- a/js/popup.js +++ b/js/popup.js @@ -1,4 +1,4 @@ -const syncedSwitches = ['remind', 'tab_icons', 'dark_mode', 'remlogo', 'full_width', 'auto_dark', 'assignments_due', 'gpa_calc', 'gradient_cards', 'disable_color_overlay', 'dashboard_grades', 'dashboard_notes', 'focus_timer', 'breathing', 'daily_quotes', 'quick_links', 'heatmap', 'better_todo', 'todo_celebrations_enabled', 'better_sidebar', 'condensed_cards', 'hide_new_canvas', 'hide_sequence_footer', 'center_cards', 'quiz_safe_mode', 'global_search', 'grade_analytics', 'hide_personal_details', 'hide_sidebar']; +const syncedSwitches = ['remind', 'tab_icons', 'dark_mode', 'remlogo', 'full_width', 'auto_dark', 'assignments_due', 'gpa_calc', 'gradient_cards', 'disable_color_overlay', 'dashboard_grades', 'dashboard_notes', 'focus_timer', 'breathing', 'daily_quotes', 'quick_links', 'heatmap', 'better_todo', 'todo_celebrations_enabled', 'better_sidebar', 'condensed_cards', 'hide_new_canvas', 'hide_sequence_footer', 'center_cards', 'quiz_safe_mode', 'global_search', 'notes_suppressor', 'grade_analytics', 'hide_personal_details', 'hide_sidebar']; const syncedSubOptions = [ "grade_analytics_zones", "hide_course_images", @@ -242,7 +242,7 @@ const exportWidgets = [ ]; const exportBackground = ["customBackgroundLink", "customBackgroundScale", "customBackgroundDaily", "customBackgroundNasaDaily", "customBackgroundColor", "customBackgroundColorTransparent", "fitImageToScreen", "card_transparency", "bg_opacity", "sidebar_opacity", "bg_blur", "sidebar_blur", "card_opacity", "card_blur"]; // Master "On/off toggles": every visual toggle, minus GPA/schedule/productivity. -const exportToggles = ["dark_mode", "quiz_safe_mode", "grade_analytics", "grade_analytics_zones"].concat(exportCardColorToggles, exportLayout, exportSidebar, exportTodo); +const exportToggles = ["dark_mode", "quiz_safe_mode", "notes_suppressor", "grade_analytics", "grade_analytics_zones"].concat(exportCardColorToggles, exportLayout, exportSidebar, exportTodo); const fontsDropdownStateKey = "fonts_dropdown_open"; const apiurl = "none"; @@ -390,6 +390,7 @@ const defaultOptions = { "hide_sidebar": false, "grade_analytics_zones": false, "quiz_safe_mode": false, + "notes_suppressor": true, "dark_mode_fix": [], "assignment_states": {}, "tab_icons": false,