mirror of
https://github.com/GuySandler/CanvasRefined.git
synced 2026-11-25 07:07:14 +01:00
better sidebar 0
started making it by erasing the old and making a new container
This commit is contained in:
1 parent
e85c6c3d00
commit
0602af48c4
7 files changed
+91
-3
No files matched your search
@@ -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": {},
|
||||
|
||||
+44
-2
@@ -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 = `
|
||||
<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" style="width:50px;height:50px;transition:all .3s ease;cursor:pointer;">
|
||||
<g id="SVGRepo_bgCarrier" stroke-width="0"></g>
|
||||
<g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g>
|
||||
<g id="SVGRepo_iconCarrier">
|
||||
<path d="M20 4V20M4 12H16M16 12L12 8M16 12L12 16" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path>
|
||||
</g>
|
||||
</svg>
|
||||
`
|
||||
|
||||
} 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
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -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,
|
||||
|
||||
Reference in new issue
Block a user