diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..418e351 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*.zip +.vscode \ No newline at end of file diff --git a/ActuallyBetterCanvasV0.2.zip b/ActuallyBetterCanvasV0.2.zip deleted file mode 100644 index ee5b3bb..0000000 Binary files a/ActuallyBetterCanvasV0.2.zip and /dev/null differ diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 3ecbc09..3633aff 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -50,6 +50,9 @@ "better_todo": { "message": "Better todo list" }, + "better_sidebar": { + "message": "Better Sidebar" + }, "max_items": { "message": "Max Items: " }, diff --git a/html/popup.html b/html/popup.html index fa356be..cea165f 100644 --- a/html/popup.html +++ b/html/popup.html @@ -235,6 +235,45 @@ +
+
+ + +
+
+
+
+ Better Sidebar +
+
+ +
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ Max items to show: + +
+
+
diff --git a/js/background.js b/js/background.js index 88b73f3..163dd79 100644 --- a/js/background.js +++ b/js/background.js @@ -40,6 +40,7 @@ chrome.runtime.onInstalled.addListener(function () { "better_todo": false, "todo_hr24": false, "todo_separate_scrollbar": false, + "better_sidebar": true, "condensed_cards": false, "custom_cards": {}, "custom_cards_2": {}, diff --git a/js/content.js b/js/content.js index 427e74e..b9d3650 100644 --- a/js/content.js +++ b/js/content.js @@ -459,6 +459,7 @@ function checkDashboardReady() { } else if (mutation.target == document.querySelector('#right-side')) { if (!mutation.target.querySelector(".bettercanvas-todosidebar")) { setupBetterTodo(); + setupBetterSidebar(); // loadBetterTodo(); } } @@ -1287,6 +1288,43 @@ function setupBetterTodo() { } } +function setupBetterSidebar() { + if (!options.better_sidebar) return; + if (document.querySelector('#better-sidebar-container')) return; + let wrapper = document.querySelector("#wrapper"); + if (!wrapper) return; + try { + document.querySelector("#header")?.remove(); + document.querySelector(".ic-Layout-wrapper")?.style.setProperty("margin-left", "0"); + // rebuild sidebar + const mainWrapper = document.querySelector(".ic-Layout-contentWrapper"); + mainWrapper.style.display = "flex"; + + let sidebarList = makeElement("div", mainWrapper, { id: "better-sidebar-container", + style: "display:flex;flex-direction:column;width:250px;justify-content:center;gap:20px;padding:20px;box-sizing:border-box;position:relative;background-color:red;" + }, true); + sidebarList.innerHTML = ` + + `; + let expander = makeElement("div", sidebarList, { + style: "display:flex;flex-direction:column;gap:10px;position:absolute:bottom:10px;" + }); + expander.innerHTML = ` + + + + + + + + ` + + } catch (e) { + logError(e); + } + +} + let delay; let moreAssignmentCount = 0; let moreAnnouncementCount = 0; @@ -2639,12 +2677,16 @@ function getApiData() { } -function makeElement(element, location, options) { +function makeElement(element, location, options, prepend = false) { let creation = document.createElement(element); Object.keys(options).forEach(key => { creation[key] = options[key]; }); - location.appendChild(creation); + if (prepend) { + location.insertBefore(creation, location.firstChild); + } else { + location.appendChild(creation); + } return creation } diff --git a/js/popup.js b/js/popup.js index 6924680..c12a31e 100644 --- a/js/popup.js +++ b/js/popup.js @@ -1,4 +1,4 @@ -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', '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']; const syncedSubOptions = [ "todo_hide_feedback", "todo_full_height", @@ -69,6 +69,7 @@ const defaultOptions = { "dashboard_notes": false, "dashboard_notes_text": "", "better_todo": false, + "better_sidebar": true, "todo_hr24": false, "todo_separate_scrollbar": false, "condensed_cards": false,