From fdaa2754b80fa61801b22bf7980dbe29a56fa2e8 Mon Sep 17 00:00:00 2001 From: Guy Sandler Date: Sat, 15 Aug 2026 17:51:55 -0700 Subject: [PATCH] fixing bugs, centering, links, theme comparability --- README.md | 2 + _locales/de/messages.json | 12 +++ _locales/en/messages.json | 12 +++ _locales/es/messages.json | 12 +++ _locales/fr/messages.json | 12 +++ _locales/it/messages.json | 12 +++ _locales/ja/messages.json | 12 +++ _locales/pt_PT/messages.json | 12 +++ _locales/ru/messages.json | 12 +++ _locales/sv/messages.json | 12 +++ _locales/zh_CN/messages.json | 12 +++ _locales/zh_TW/messages.json | 12 +++ css/popup.css | 14 +++- html/popup.html | 51 ++++++++++++- js/background.js | 3 +- js/content.js | 31 ++++++++ js/popup.js | 138 ++++++++++++++++++++++++++++------- manifest.json | 2 +- 18 files changed, 342 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index ea7922b..a691750 100644 --- a/README.md +++ b/README.md @@ -68,6 +68,8 @@ Canvas Refined adds more with more to come! - Markdown in dashboard notes - Smaller additions: - Equal height cards for card assignments + - Center cards + - Hide new dashbaord button ## Planned Features (by priority) - auto rotate theme + theme history + fix theme submissions diff --git a/_locales/de/messages.json b/_locales/de/messages.json index 25a7283..6ecce09 100644 --- a/_locales/de/messages.json +++ b/_locales/de/messages.json @@ -238,5 +238,17 @@ }, "fix_dm_text": { "message": "Der Fixer wird automatisch auf diesen Seiten ausgeführt:" + }, + "hide_links": { + "message": "Links ausblenden" + }, + "show_links": { + "message": "Links einblenden" + }, + "center_cards": { + "message": "Karten zentrieren" + }, + "hide_new_canvas": { + "message": "Neues Canvas ausblenden" } } \ No newline at end of file diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 4e8859a..6e74676 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -250,5 +250,17 @@ }, "fix_dm_text": { "message": "The Fixer Is Automatically Running On These Pages:" + }, + "hide_links": { + "message": "Hide links" + }, + "show_links": { + "message": "Show links" + }, + "center_cards": { + "message": "Center Cards" + }, + "hide_new_canvas": { + "message": "Hide New Canvas" } } \ No newline at end of file diff --git a/_locales/es/messages.json b/_locales/es/messages.json index 791af9e..2d289ec 100644 --- a/_locales/es/messages.json +++ b/_locales/es/messages.json @@ -238,5 +238,17 @@ }, "fix_dm_text": { "message": "El reparador se ejecuta automáticamente en estas páginas:" + }, + "hide_links": { + "message": "Ocultar enlaces" + }, + "show_links": { + "message": "Mostrar enlaces" + }, + "center_cards": { + "message": "Centrar tarjetas" + }, + "hide_new_canvas": { + "message": "Ocultar nuevo Canvas" } } \ No newline at end of file diff --git a/_locales/fr/messages.json b/_locales/fr/messages.json index 3b9f03c..8b0cd44 100644 --- a/_locales/fr/messages.json +++ b/_locales/fr/messages.json @@ -238,5 +238,17 @@ }, "fix_dm_text": { "message": "Le fixateur s'exécute automatiquement sur ces pages :" + }, + "hide_links": { + "message": "Masquer les liens" + }, + "show_links": { + "message": "Afficher les liens" + }, + "center_cards": { + "message": "Centrer les cartes" + }, + "hide_new_canvas": { + "message": "Masquer le nouveau Canvas" } } \ No newline at end of file diff --git a/_locales/it/messages.json b/_locales/it/messages.json index 3b84286..39e7871 100644 --- a/_locales/it/messages.json +++ b/_locales/it/messages.json @@ -238,5 +238,17 @@ }, "fix_dm_text": { "message": "Il fissatore viene eseguito automaticamente su queste pagine:" + }, + "hide_links": { + "message": "Nascondi link" + }, + "show_links": { + "message": "Mostra link" + }, + "center_cards": { + "message": "Centra schede" + }, + "hide_new_canvas": { + "message": "Nascondi nuovo Canvas" } } \ No newline at end of file diff --git a/_locales/ja/messages.json b/_locales/ja/messages.json index 7844d83..84096b7 100644 --- a/_locales/ja/messages.json +++ b/_locales/ja/messages.json @@ -238,5 +238,17 @@ }, "fix_dm_text": { "message": "Fixer はこれらのページで自動的に実行されます:" + }, + "hide_links": { + "message": "リンクを非表示" + }, + "show_links": { + "message": "リンクを表示" + }, + "center_cards": { + "message": "カードを中央配置" + }, + "hide_new_canvas": { + "message": "新しい Canvas を非表示" } } \ No newline at end of file diff --git a/_locales/pt_PT/messages.json b/_locales/pt_PT/messages.json index 615f8f5..907d6b2 100644 --- a/_locales/pt_PT/messages.json +++ b/_locales/pt_PT/messages.json @@ -238,5 +238,17 @@ }, "fix_dm_text": { "message": "O Fixer está sendo executado automaticamente nestas páginas:" + }, + "hide_links": { + "message": "Ocultar ligações" + }, + "show_links": { + "message": "Mostrar ligações" + }, + "center_cards": { + "message": "Centrar cartões" + }, + "hide_new_canvas": { + "message": "Ocultar novo Canvas" } } \ No newline at end of file diff --git a/_locales/ru/messages.json b/_locales/ru/messages.json index a16213a..5ac7051 100644 --- a/_locales/ru/messages.json +++ b/_locales/ru/messages.json @@ -238,5 +238,17 @@ }, "fix_dm_text": { "message": "Fixer автоматически запускается на этих страницах:" + }, + "hide_links": { + "message": "Скрыть ссылки" + }, + "show_links": { + "message": "Показать ссылки" + }, + "center_cards": { + "message": "Центрировать карточки" + }, + "hide_new_canvas": { + "message": "Скрыть новый Canvas" } } \ No newline at end of file diff --git a/_locales/sv/messages.json b/_locales/sv/messages.json index 0e59384..b4caba0 100644 --- a/_locales/sv/messages.json +++ b/_locales/sv/messages.json @@ -238,5 +238,17 @@ }, "fix_dm_text": { "message": "Fixern körs automatiskt på dessa sidor:" + }, + "hide_links": { + "message": "Dölj länkar" + }, + "show_links": { + "message": "Visa länkar" + }, + "center_cards": { + "message": "Centrera kort" + }, + "hide_new_canvas": { + "message": "Dölj ny Canvas" } } \ No newline at end of file diff --git a/_locales/zh_CN/messages.json b/_locales/zh_CN/messages.json index 72a9006..41deb67 100644 --- a/_locales/zh_CN/messages.json +++ b/_locales/zh_CN/messages.json @@ -238,5 +238,17 @@ }, "fix_dm_text": { "message": "修复程序会自动在这些页面上运行:" + }, + "hide_links": { + "message": "隐藏链接" + }, + "show_links": { + "message": "显示链接" + }, + "center_cards": { + "message": "居中卡片" + }, + "hide_new_canvas": { + "message": "隐藏新版 Canvas" } } \ No newline at end of file diff --git a/_locales/zh_TW/messages.json b/_locales/zh_TW/messages.json index 72a9006..41846b6 100644 --- a/_locales/zh_TW/messages.json +++ b/_locales/zh_TW/messages.json @@ -238,5 +238,17 @@ }, "fix_dm_text": { "message": "修复程序会自动在这些页面上运行:" + }, + "hide_links": { + "message": "隱藏連結" + }, + "show_links": { + "message": "顯示連結" + }, + "center_cards": { + "message": "置中卡片" + }, + "hide_new_canvas": { + "message": "隱藏新版 Canvas" } } \ No newline at end of file diff --git a/css/popup.css b/css/popup.css index 77b550f..b2d44a1 100644 --- a/css/popup.css +++ b/css/popup.css @@ -68,6 +68,18 @@ h2 {margin-top: 20px;font-weight:600} #advanced-settings, #gpa-bounds-btn, #custom-font-btn, #customize-dark-btn, #card-colors-btn {width: 100%;} .back-btn {width: 120px;height:100%;margin-top:0} .big-button {border: none;border-radius: 7px;background: var(--containerbg);color: #fff;font-family: inherit;padding: 12px 10px;font-weight:600} +.social-buttons {display: flex;gap: 8px;margin-top: 8px;} +.social-buttons a {flex: 1;box-sizing: border-box;} +.discord-button {display: flex;align-items: center;justify-content: center;gap: 8px;padding: 12px 10px;border: none;border-radius: 7px;background: #5865F2;color: #fff;font-family: inherit;font-size: 14px;font-weight: 600;text-decoration: none;transition: .15s background} +.discord-button:hover {background: #4752c4;cursor: pointer} +.discord-button:active {filter: brightness(85%)} +.github-button {display: flex;align-items: center;justify-content: center;gap: 8px;padding: 12px 10px;border: none;border-radius: 7px;background: #30363d;color: #fff;font-family: inherit;font-size: 14px;font-weight: 600;text-decoration: none;transition: .15s background} +.github-button:hover {background: #21262d;cursor: pointer} +.github-button:active {filter: brightness(85%)} +.discord-button svg, .github-button svg {flex-shrink: 0} +.social-toggle {text-align: center;font-size: 12px;color: #9a9a9a;margin-top: 6px;cursor: pointer;user-select: none;transition: .15s color;text-decoration: none} +.social-toggle:hover {color: #e2e2e2} +.social-buttons.hidden {display: none} #setSingleColor, #setGradientColor {padding: 8px 20px;margin-top:5px;} .gpa-bounds-input {font-size: 14px;background: var(--inputbg); border: none;padding:6px;color: #e2e2e2;margin-top: 6px;border-radius: 6px; font-family: inherit; width: 55px; box-sizing: border-box;text-align: right} .gpa-bounds span {font-size: 16px; width: 25px;display: inline-block} @@ -141,7 +153,7 @@ textarea {resize: vertical} .sidebar-changer {display: flex;gap: 10px;} .custom-key { margin-right: 5px; } .options-presets .customization-button {padding:9px 14px} -#export-output {margin: 0; height: 100%;} +#export-output {margin: 0; height: calc(100% - 46px);} input[type="checkbox"] { appearance: none; background: var(--inputbg); margin: 0; width: 16px; height: 16px; border: 1px solid #1a1a1a;;border-radius: 4px; display: grid; place-content: center;} input[type="checkbox"]::before { content: ""; width: 10px; height: 10px; transform: scale(0); box-shadow: inset 1em 1em #323232; transform-origin: center; clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);} input[type="checkbox"]:checked::before {transform: scale(1);} diff --git a/html/popup.html b/html/popup.html index e053997..7eefdf9 100644 --- a/html/popup.html +++ b/html/popup.html @@ -190,6 +190,17 @@ Todo Reminders +
+ + + Discord + + + + GitHub + +
+
@@ -267,6 +278,15 @@
+
+ + +
+
+
+
+ Center Cards +
@@ -325,6 +345,14 @@
Color coded tab icons
+
+ + +
+
+
+
Hide New Canvas +
@@ -479,6 +507,10 @@ Dark mode
+
+ + Dark mode schedule +
Card images @@ -487,6 +519,10 @@ Card colors
+
+ + Card styles +
Custom font @@ -495,13 +531,25 @@ On/off toggles
+
+ + Layout +
+
+ + Sidebar +
+
+ + Todo list +
GPA settings
- Custom card styles + Custom CSS
@@ -510,6 +558,7 @@
+
diff --git a/js/background.js b/js/background.js index 40ef5c1..5ccf916 100644 --- a/js/background.js +++ b/js/background.js @@ -38,7 +38,7 @@ chrome.runtime.onInstalled.addListener(function () { "dashboard_notes": false, "dashboard_notes_text": "", "dashboard_notes_mode": "edit", - "better_todo": false, + "better_todo": true, "todo_hr24": false, "todo_separate_scrollbar": false, "better_sidebar": false, @@ -75,6 +75,7 @@ chrome.runtime.onInstalled.addListener(function () { "relative_dues": false, "equal_height_cards": false, "hide_feedback": false, + "hide_new_canvas": true, "dark_mode_fix": [], "assignment_states": {}, "tab_icons": false, diff --git a/js/content.js b/js/content.js index 7dd93a3..a6554e3 100644 --- a/js/content.js +++ b/js/content.js @@ -46,6 +46,7 @@ function getSubmissionAssignmentLink() { let submissionPageButtonObserver = null; let profileLogoutButtonObserver = null; +let newCanvasButtonObserver = null; function addSubmissionPageButton() { const assignmentLink = getSubmissionAssignmentLink(); @@ -158,6 +159,30 @@ function watchSubmissionPageButton() { }, 10000); } +function removeNewCanvasButton() { + document.querySelectorAll('[data-testid="switch-to-new-dashboard-button"]').forEach(btn => btn.remove()); +} + +function watchNewCanvasButton() { + if (newCanvasButtonObserver) { + newCanvasButtonObserver.disconnect(); + newCanvasButtonObserver = null; + } + if (options.hide_new_canvas !== true) return; + removeNewCanvasButton(); + newCanvasButtonObserver = new MutationObserver(() => { + if (options.hide_new_canvas !== true) { + if (newCanvasButtonObserver) { + newCanvasButtonObserver.disconnect(); + newCanvasButtonObserver = null; + } + return; + } + removeNewCanvasButton(); + }); + newCanvasButtonObserver.observe(document.documentElement, { childList: true, subtree: true }); +} + async function getActiveCustomBackground() { const syncOpts = await chrome.storage.sync.get([ "customBackgroundDaily", @@ -510,6 +535,7 @@ function startExtension() { checkDashboardReady(); loadCustomFont(); applyAestheticChanges(); + watchNewCanvasButton(); changeFavicon(); updateReminders(); applyCustomBackground(); @@ -625,9 +651,13 @@ function applyOptionsChanges(changes) { case "condensed_cards": case "hide_feedback": case "full_width": + case "center_cards": case "custom_styles": applyAestheticChanges(); break; + case "hide_new_canvas": + watchNewCanvasButton(); + break; case "customBackgroundScale": applyCustomBackground(); break; @@ -4043,6 +4073,7 @@ function applyAestheticChanges() { if (options.disable_color_overlay === true) style.textContent += ".ic-DashboardCard__header_hero{opacity: 0!important} .ic-DashboardCard__header-button-bg{opacity: 1!important}"; if (options.hide_feedback === true) style.textContent += ".recent_feedback {display: none}"; if (options.full_width === true) style.textContent += "#wrapper,.ic-Layout-wrapper{max-width:100%!important}"; + if (options.center_cards === true) style.textContent += ".ic-DashboardCard__box__container{display:flex!important;flex-wrap:wrap!important;justify-content:center!important;align-items:flex-start!important}"; if (options.customCardStyles === true) { if (options.imageSize !== undefined && options.imageSize !== 100) style.textContent += `.ic-DashboardCard__header_image {transform: scale(${options.imageSize / 100})!important; }`; diff --git a/js/popup.js b/js/popup.js index 023f452..31c300a 100644 --- a/js/popup.js +++ b/js/popup.js @@ -1,14 +1,17 @@ -const syncedSwitches = ['remind', 'tab_icons', 'hide_feedback', 'dark_mode', 'remlogo', 'full_width', 'auto_dark', 'assignments_due', 'gpa_calc', 'gradient_cards', 'disable_color_overlay', 'dashboard_grades', 'dashboard_notes', 'better_todo', 'better_sidebar', 'condensed_cards']; +const syncedSwitches = ['remind', 'tab_icons', 'hide_feedback', 'dark_mode', 'remlogo', 'full_width', 'auto_dark', 'assignments_due', 'gpa_calc', 'gradient_cards', 'disable_color_overlay', 'dashboard_grades', 'dashboard_notes', 'better_todo', 'better_sidebar', 'condensed_cards', 'hide_new_canvas', 'center_cards']; const syncedSubOptions = [ "todo_hide_feedback", "todo_full_height", "todo_confetti", + "todo_progress_rings", "device_dark", "relative_dues", "card_overdues", "equal_height_cards", // "todo_overdues", "gpa_calc_prepend", + "gpa_calc_cumulative", + "gpa_calc_weighted", "auto_dark", "auto_dark_start", "auto_dark_end", @@ -34,6 +37,22 @@ const syncedSubOptions = [ "sidebar_scale", ]; const localSwitches = []; + +// Theme export categories. Only visual/appearance settings belong in a +// shared theme; personal productivity features (reminders, dashboard notes, +// the card-assignments list and its display prefs, card grades, item counts) +// are intentionally excluded so exported themes never carry personal stuff. +const exportDarkSchedule = ["auto_dark", "auto_dark_start", "auto_dark_end", "device_dark"]; +const exportCardColorToggles = ["gradient_cards", "disable_color_overlay"]; +const exportCardStyles = ["customCardStyles", "imageSize", "cardRoundness", "cardSpacing", "cardWidth", "cardHeight"]; +const exportLayout = ["full_width", "center_cards", "condensed_cards", "equal_height_cards", "remlogo", "hide_new_canvas", "hide_feedback", "tab_icons"]; +const exportSidebar = ["better_sidebar", "sidebar_scale"]; +const exportTodo = ["better_todo", "todo_hide_feedback", "todo_full_height", "todo_confetti", "todo_progress_rings", "todo_hr24", "todo_separate_scrollbar"]; +const exportGpa = ["gpa_calc", "gpa_calc_prepend", "gpa_calc_cumulative", "gpa_calc_weighted"]; +const exportBackground = ["customBackgroundLink", "customBackgroundScale", "customBackgroundDaily", "customBackgroundNasaDaily", "fitImageToScreen"]; +// Master "On/off toggles" = every visual toggle (no GPA, no dark-mode schedule, +// no personal productivity features). +const exportToggles = ["dark_mode"].concat(exportCardColorToggles, exportLayout, exportSidebar, exportTodo); const fontsDropdownStateKey = "fonts_dropdown_open"; const apiurl = "none"; @@ -74,12 +93,13 @@ const defaultOptions = { "dashboard_notes": false, "dashboard_notes_text": "", "dashboard_notes_mode": "edit", - "better_todo": false, + "better_todo": true, "better_sidebar": false, "sidebar_scale": 100, "todo_hr24": false, "todo_separate_scrollbar": false, "condensed_cards": false, + "center_cards": false, "custom_cards": {}, "custom_cards_2": {}, "custom_cards_3": {}, @@ -112,6 +132,7 @@ const defaultOptions = { "relative_dues": false, "equal_height_cards": false, "hide_feedback": false, + "hide_new_canvas": true, "dark_mode_fix": [], "assignment_states": {}, "tab_icons": false, @@ -184,6 +205,28 @@ function displayDarkModeFixUrls() { document.addEventListener("DOMContentLoaded", setup); +// toggle visibility of the Discord/GitHub social links (persists locally) +document.addEventListener("DOMContentLoaded", () => { + const toggle = document.getElementById("social-toggle"); + const buttons = document.querySelector(".social-buttons"); + if (!toggle || !buttons) return; + const KEY = "hide_socials"; + const render = (hidden) => { + buttons.classList.toggle("hidden", hidden); + toggle.textContent = chrome.i18n.getMessage(hidden ? "show_links" : "hide_links"); + }; + chrome.storage.local.get(KEY, (res) => render(!!res[KEY])); + const flip = () => chrome.storage.local.get(KEY, (res) => { + const next = !res[KEY]; + chrome.storage.local.set({ [KEY]: next }); + render(next); + }); + toggle.addEventListener("click", flip); + toggle.addEventListener("keydown", (e) => { + if (e.key === "Enter" || e.key === " ") { e.preventDefault(); flip(); } + }); +}); + function setupAssignmentsSlider(initial) { let el = document.querySelector('#numAssignmentsSlider'); el.value = initial; @@ -929,7 +972,9 @@ function setup() { // give everything the appropirate i18n text document.querySelectorAll('[data-i18n]').forEach(text => { - text.innerText = chrome.i18n.getMessage(text.dataset.i18n); + const msg = chrome.i18n.getMessage(text.dataset.i18n); + // keep the in-HTML fallback text when a key is missing instead of blanking it + if (msg) text.innerText = msg; }); document.querySelectorAll('[data-i18n-placeholder]').forEach(el => { const msg = chrome.i18n.getMessage(el.dataset.i18nPlaceholder); @@ -1006,38 +1051,70 @@ function setup() { importTheme(obj); }); + // copy export output to clipboard + document.querySelector("#export-copy").addEventListener("click", async () => { + const output = document.querySelector("#export-output"); + const btn = document.querySelector("#export-copy"); + const text = output.value; + if (!text) { displayAlert(true, "Nothing to copy — select what to export first."); return; } + const flash = () => { const old = btn.textContent; btn.textContent = "Copied!"; setTimeout(() => { btn.textContent = old; }, 1200); }; + try { + await navigator.clipboard.writeText(text); + flash(); + } catch (e) { + output.select(); + document.execCommand("copy"); + flash(); + } + }); + // activate export checkbox document.querySelectorAll(".export-details input").forEach(input => { input.addEventListener("change", () => { - chrome.storage.sync.get(syncedSwitches.concat(syncedSubOptions).concat(["dark_preset", "custom_cards", "custom_font", "gpa_calc_bounds"]), async storage => { + chrome.storage.sync.get(syncedSwitches.concat(syncedSubOptions).concat(["dark_preset", "custom_cards", "custom_font", "gpa_calc_bounds", "custom_styles"]), async storage => { let final = {}; for await (item of document.querySelectorAll(".export-details input")) { if (item.checked) { switch (item.id) { case "export-toggles": - final = { ...final, ...(await getExport(storage, syncedSwitches.concat(syncedSubOptions))) }; + final = { ...final, ...(await getExport(storage, exportToggles)) }; break; case "export-dark": - final = { ...final, ...(await getExport(storage, ["dark_preset"])) }; + final = { ...final, ...(await getExport(storage, ["dark_preset", "dark_mode"])) }; + break; + case "export-dark-schedule": + final = { ...final, ...(await getExport(storage, exportDarkSchedule)) }; break; case "export-cards": final = { ...final, ...(await getExport(storage, ["custom_cards"])) }; break; + case "export-colors": + final = { ...final, ...(await getExport(storage, ["card_colors", ...exportCardColorToggles])) }; + break; + case "export-card-styles": + final = { ...final, ...(await getExport(storage, exportCardStyles)) }; + break; + case "export-customStyles": + final = { ...final, ...(await getExport(storage, ["custom_styles"])) }; + break; case "export-font": final = { ...final, ...(await getExport(storage, ["custom_font"])) }; break; - case "export-colors": - final = { ...final, ...(await getExport(storage, ["card_colors"])) } + case "export-background": + final = { ...final, ...(await getExport(storage, exportBackground)) }; + break; + case "export-layout": + final = { ...final, ...(await getExport(storage, exportLayout)) }; + break; + case "export-sidebar": + final = { ...final, ...(await getExport(storage, exportSidebar)) }; + break; + case "export-todo": + final = { ...final, ...(await getExport(storage, exportTodo)) }; break; case "export-gpa": - final = { ...final, ...(await getExport(storage, ["gpa_calc_bounds"])) } + final = { ...final, ...(await getExport(storage, [...exportGpa, "gpa_calc_bounds"])) }; break; - case "export-customStyles": - final = { ...final, ...(await getExport(storage, ["custom_styles"])) }; - break; - case "export-background": - final = { ...final, ...(await getExport(storage, ["customBackgroundLink", "customBackgroundScale", "customBackgroundDaily", "fitImageToScreen"])) }; - break; } } } @@ -1348,12 +1425,7 @@ async function getExport(storage, options) { } break; case "custom_styles": - final["customCardStyles"] = storage["customCardStyles"]; - final["imageSize"] = storage["imageSize"]; - final["cardRoundness"] = storage["cardRoundness"]; - final["cardSpacing"] = storage["cardSpacing"]; - final["cardWidth"] = storage["cardWidth"]; - final["cardHeight"] = storage["cardHeight"]; + final["custom_styles"] = storage["custom_styles"]; break; default: final[option] = storage[option]; @@ -1458,7 +1530,7 @@ let fallback = false; function saveCurrentTheme() { - const allOptions = syncedSwitches.concat(syncedSubOptions).concat(["dark_preset", "custom_cards", "custom_font", "gpa_calc_bounds", "card_colors"]); + const allOptions = syncedSwitches.concat(syncedSubOptions).concat(["dark_preset", "custom_cards", "custom_font", "gpa_calc_bounds", "card_colors", "custom_styles"]); chrome.storage.local.get("saved_themes", local => { chrome.storage.sync.get(allOptions, async sync => { let current = await getExport(sync, allOptions); @@ -1473,10 +1545,10 @@ function saveCurrentTheme() { "better_todo": current["better_todo"], "todo_hide_feedback": current["todo_hide_feedback"], "todo_full_height": current["todo_full_height"], + "todo_confetti": current["todo_confetti"], + "todo_progress_rings": current["todo_progress_rings"], "todo_hr24": current["todo_hr24"], "todo_separate_scrollbar": current["todo_separate_scrollbar"], - "num_todo_items": current["num_todo_items"], - "hover_preview": current["hover_preview"], "better_sidebar": current["better_sidebar"], "sidebar_scale": current["sidebar_scale"], "imageSize": current["imageSize"], @@ -1484,9 +1556,13 @@ function saveCurrentTheme() { "cardSpacing": current["cardSpacing"], "cardWidth": current["cardWidth"], "cardHeight": current["cardHeight"], + "custom_styles": current["custom_styles"], + "customCardStyles": current["customCardStyles"], "customBackgroundLink": current["customBackgroundLink"], "customBackgroundScale": current["customBackgroundScale"], "customBackgroundDaily": current["customBackgroundDaily"], + "customBackgroundNasaDaily": current["customBackgroundNasaDaily"], + "fitImageToScreen": current["fitImageToScreen"], } const now = new Date(); local["saved_themes"][now.getTime()] = trimmed; @@ -1498,7 +1574,15 @@ function saveCurrentTheme() { } -async function displayThemeList(direction = 0) { +function displayThemeList(direction = 0) { + // render the full sorted theme list (filtered by any active search). + // Previously this was an empty stub, so the browser showed nothing + // until the search box fired displayThemeSearchList directly. + let themesToShow = allThemes; + if (searchFor) { + themesToShow = allThemes.filter(theme => theme.title.toLowerCase().includes(searchFor.toLowerCase())); + } + displayThemeSearchList(themesToShow, direction); } @@ -1507,7 +1591,7 @@ function displayThemeSearchList(themesToShow, pageDir = 0) { const perPage = 24; const maxPage = Math.ceil(themesToShow.length / perPage); if (pageDir == -1 && current_page_num > 1) current_page_num--; - if (pageDir == 1 && curren_page_num < maxPage) current_page_num++; + if (pageDir == 1 && current_page_num < maxPage) current_page_num++; let container = document.getElementById("premade-themes"); container.textContent = ""; let start = (current_page_num - 1) * perPage, end = start + perPage; @@ -1520,7 +1604,7 @@ function displayThemeSearchList(themesToShow, pageDir = 0) { makeElement("p", themeBtn, {"className": "theme-button-title", "textContent": split[0] }); makeElement("p", themeBtn, {"className": "theme-button-creator", "textContent": split[1] }); themeBtn.addEventListener("click", () => { - const allOptions = syncedSwitches.concat(syncedSubOptions).concat(["dark_preset", "custom_cards", "custom_font", "gpa_calc_bounds", "card_colors"]); + const allOptions = syncedSwitches.concat(syncedSubOptions).concat(["dark_preset", "custom_cards", "custom_font", "gpa_calc_bounds", "card_colors", "custom_styles"]); chrome.storage.sync.get(allOptions, sync => { chrome.storage.local.get(["previous_theme"], async local => { if (local["previous_theme"] === null) { diff --git a/manifest.json b/manifest.json index 2c8d571..7346455 100644 --- a/manifest.json +++ b/manifest.json @@ -1,6 +1,6 @@ { "manifest_version": 3, - "name": "CanvasRefined", + "name": "Canvas Refined", "description": "Even More Feature packed extension for Canvas.", "version": "6.2.61", "icons": {