From ed1dda1347eccf98868f6bb4122c975ce6adf8a4 Mon Sep 17 00:00:00 2001 From: Aaron Opell Date: Sun, 19 Sep 2021 11:52:34 -0700 Subject: [PATCH 1/5] fixed issue with material tooltips --- js/materials.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/materials.js b/js/materials.js index 2ad3a823..a5f8e46a 100644 --- a/js/materials.js +++ b/js/materials.js @@ -352,7 +352,7 @@ // improves performance because it's one NETWORK API call PER ASSIGNMENT, and it blocks all tooltips until all assignments are done loading // especially visible in large classes let gradeInfo = loadedGradeContainer.grades[assignment.id]; - if (+assignment.allow_dropbox && (gradeInfo.grade === null || gradeInfo.exception)) { + if (+assignment.allow_dropbox && (!gradeInfo || gradeInfo.grade === null || gradeInfo.exception)) { // "dropboxes," or places to submit documents via Schoology // another API call loadedGradeContainer.dropboxes[assignment.id] = (await fetchApiJson(`/sections/${classId}/submissions/${assignment.id}/${userId}`)).revision; From e79ff44d16f2ad15bdf4b3f11a9a695332640e65 Mon Sep 17 00:00:00 2001 From: Aaron Opell Date: Sat, 25 Sep 2021 12:50:53 -0700 Subject: [PATCH 2/5] fixed issue with dropdown menus --- css/all.css | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/css/all.css b/css/all.css index 2601c0cd..1c9a2b51 100644 --- a/css/all.css +++ b/css/all.css @@ -889,4 +889,8 @@ a._3_bfp { border-radius: 5px; color: white; background: var(--primary-color); -} \ No newline at end of file +} + +.StandardHeader-header-drop-menu-YShpU a { + background-color: inherit !important; +} From 528bfe30196d0f941686409e865ad2c891f64c30 Mon Sep 17 00:00:00 2001 From: Aaron Opell Date: Sat, 25 Sep 2021 13:41:03 -0700 Subject: [PATCH 3/5] fixed some other color bugs --- css/all.css | 18 +++++++----------- css/modern/all.css | 14 +++++++++----- scss/modern/all.scss | 14 +++++++++----- 3 files changed, 25 insertions(+), 21 deletions(-) diff --git a/css/all.css b/css/all.css index 1c9a2b51..47a918d7 100644 --- a/css/all.css +++ b/css/all.css @@ -37,13 +37,13 @@ /* Drop down menus (grades, applications, and user menu) */ -.Header-header-drop-menu-3SaYV, -.Header-header-drop-menu-3SaYV { +.StandardHeader-header-drop-menu-YShpU, +.StandardHeader-header-drop-menu-YShpU { background-color: var(--hover-color) !important; } -a.Header-header-drop-menu-3SaYV:hover, -.Header-header-drop-menu-3SaYV li a:hover { +a.StandardHeader-header-drop-menu-YShpU:hover, +.StandardHeader-header-drop-menu-YShpU li a:hover { background-color: var(--background-color) !important; } @@ -51,8 +51,8 @@ a.Header-header-drop-menu-3SaYV:hover, background-color: var(--background-color) !important; } -[class*="Header-header-drop-menu-item-"], -[class*="Header-header-drop-menu-"] li a * { +[class*="StandardHeader-header-drop-menu-item-"], +[class*="StandardHeader-header-drop-menu-"] li a * { color: var(--contrast-text-color) !important; } @@ -889,8 +889,4 @@ a._3_bfp { border-radius: 5px; color: white; background: var(--primary-color); -} - -.StandardHeader-header-drop-menu-YShpU a { - background-color: inherit !important; -} +} \ No newline at end of file diff --git a/css/modern/all.css b/css/modern/all.css index 4dfc81d9..8601fc3b 100644 --- a/css/modern/all.css +++ b/css/modern/all.css @@ -267,18 +267,22 @@ variable-intellisense { color: var(--contrast-text) !important; } -[modern=true]:root .Header-header-button-1EE8Y, -[modern=true]:root [class*="Header-header-drop-menu-item-"], -[modern=true]:root [class*="Header-header-drop-menu-"] li a *, -[modern=true]:root .Header-header-button-active-GnvKh, +[modern=true]:root .StandardHeader-header-button-1562K, +[modern=true]:root [class*="StandardHeader-header-drop-menu-item-"], +[modern=true]:root [class*="StandardHeader-header-drop-menu-"] li a *, +[modern=true]:root .StandardHeader-header-button-active-mEoTJ, [modern=true]:root .LGaPf svg { color: var(--contrast-text) !important; } -[modern=true]:root .Header-header-drop-menu-3SaYV._1Z0RM { +[modern=true]:root .StandardHeader-header-drop-menu-YShpU._1Z0RM { background-color: var(--hover-color) !important; } +[modern=true]:root div[role="menu"] ._2awxe._3skcp._1tpub a { + color: var(--link-color) !important; +} + [modern=true]:root .close { color: var(--contrast-text) !important; opacity: 0.8 !important; diff --git a/scss/modern/all.scss b/scss/modern/all.scss index d4592b47..b0235fbe 100644 --- a/scss/modern/all.scss +++ b/scss/modern/all.scss @@ -292,18 +292,22 @@ variable-intellisense { } } - .Header-header-button-1EE8Y, - [class*="Header-header-drop-menu-item-"], - [class*="Header-header-drop-menu-"] li a *, - .Header-header-button-active-GnvKh, + .StandardHeader-header-button-1562K, + [class*="StandardHeader-header-drop-menu-item-"], + [class*="StandardHeader-header-drop-menu-"] li a *, + .StandardHeader-header-button-active-mEoTJ, .LGaPf svg { color: var(--contrast-text) !important; } - .Header-header-drop-menu-3SaYV._1Z0RM { + .StandardHeader-header-drop-menu-YShpU._1Z0RM { background-color: var(--hover-color) !important; } + div[role="menu"] ._2awxe._3skcp._1tpub a { + color: var(--link-color) !important; + } + .close { color: var(--contrast-text) !important; opacity: 0.8 !important; From 1a03e43cb52e701d04ef30c7a1cab74007094102 Mon Sep 17 00:00:00 2001 From: Aaron Opell Date: Sun, 26 Sep 2021 12:48:25 -0700 Subject: [PATCH 4/5] Add image redirects --- js/background.js | 32 +++++++ js/preload.js | 226 ++++++++++++++++++++++----------------------- js/theme-editor.js | 57 ++++++++++++ manifest.json | 4 +- theme-editor.html | 34 +++++-- 5 files changed, 229 insertions(+), 124 deletions(-) diff --git a/js/background.js b/js/background.js index 81ea2604..eb5d7802 100644 --- a/js/background.js +++ b/js/background.js @@ -36,6 +36,7 @@ var Logger = { var assignmentNotificationUrl = "https://app.schoology.com/home/notifications?filter=all"; var defaultDomain = "app.schoology.com"; +var storage = {}; chrome.storage.sync.get({ defaultDomain: "app.schoology.com" }, s => { defaultDomain = s.defaultDomain; @@ -219,6 +220,7 @@ function sendNotification(notification, name, count) { function onAlarm(alarm) { chrome.storage.sync.get(null, function (storageContent) { + storage = storageContent; if (alarm && alarm.name === "notification") { try { Logger.log(`[${new Date()}] Checking for new notifications`); @@ -322,6 +324,36 @@ function createLogPrefix(color) { addDomainPermissionToggle(); +IMAGE_REDIRECTS = { + "attendance_comment.png": "https://imgur.com/a5JETn6.png", + "icons_sprite_feed.png": "https://imgur.com/5XYV6rt.png", + "icons_sprite_library.png": "https://asset-cdn.schoology.com/sites/all/themes/schoology_theme/images/icons_sprite_library.png", + "resources-menu-icon.png": "https://asset-cdn.schoology.com/sites/all/themes/schoology_theme/images/resources-menu-icon.png", + "icons_sprite_realm.png": "https://asset-cdn.schoology.com/sites/all/themes/schoology_theme/images/icons_sprite_realm.png", + "btn-sprite.png": "https://asset-cdn.schoology.com/sites/all/themes/schoology_theme/images/btn-sprite.png", + "icons_sprite_new.png": "https://asset-cdn.schoology.com/sites/all/themes/schoology_theme/images/icons_sprite_new.png", + "icons_sprite_calendar.png": "https://asset-cdn.schoology.com/sites/all/themes/schoology_theme/images/icons_sprite_calendar.png", + "icons_sprite_med.png": "https://asset-cdn.schoology.com/sites/all/themes/schoology_theme/images/icons_sprite_med.png", + "icons_sprite_large.png": "https://asset-cdn.schoology.com/sites/all/themes/schoology_theme/images/icons_sprite_large.png" +} + +chrome.webRequest.onBeforeRequest.addListener( + details => { + if (storage.modernizedInterfaceIcons !== "disabled") { + let pathParts = new URL(details.url).pathname.split('/'); + if (pathParts.length > 0 && IMAGE_REDIRECTS[pathParts[pathParts.length - 1]]) { + let redirectUrl = IMAGE_REDIRECTS[pathParts[pathParts.length - 1]]; + Logger.debug(`Redirecting from ${details.url} to ${redirectUrl}`) + return { + redirectUrl: redirectUrl + } + } + } + }, + { urls: ["*://*/sites/all/themes/schoology_theme/images/*"]}, + ['blocking'] +); + // if (getBrowser() !== "Firefox") { // // See https://bugs.chromium.org/p/chromium/issues/detail?id=966223#c3 // chrome.webRequest.onHeadersReceived.addListener(details => { diff --git a/js/preload.js b/js/preload.js index 78f489f3..6aa7d7bc 100644 --- a/js/preload.js +++ b/js/preload.js @@ -477,19 +477,27 @@ function updateSettings(callback) { element => element.value ).control, new Setting( - "broadcasts", - "Announcement Notifications", - "Displays news feed posts for announcements sent to all Schoology Plus users", - "enabled", + "indicateSubmission", + "Submitted Assignments Checklist", + '[Reload required] Shows a checkmark, shows a strikethrough, or hides items in "Upcoming Assignments" that have been submitted. If "Show Check Mark" is selected, a checklist function will be enabled allowing you to manually mark assignments as complete.', + "check", "select", { options: [ { - text: "Enable Announcements", - value: "enabled" + text: "Show Check Mark ✔ (Enables manual checklist)", + value: "check" }, { - text: "Disable Announcements", + text: "Show Strikethrough (Doesn't allow manual checklist)", + value: "strikethrough" + }, + { + text: "Hide Assignment (Not recommended)", + value: "hide" + }, + { + text: "Do Nothing", value: "disabled" } ] @@ -499,47 +507,82 @@ function updateSettings(callback) { element => element.value ).control, new Setting( - "customScales", - "Custom Grading Scales", - "[Refresh required] Uses custom grading scales (set per-course in course settings) when courses don't have one defined", + "quickAccessVisibility", + "Quick Access", + "[Reload Required to Reposition] Changes the visibility of the Quick Access panel on the homepage", "enabled", "select", { options: [ { - text: "Enabled", + text: "Top of Right Sidebar", value: "enabled" }, + { + text: "Between Overdue and Upcoming", + value: "belowOverdue" + }, + { + text: "Bottom of Right Sidebar", + value: "bottom" + }, { text: "Disabled", value: "disabled" } ] }, - value => value, - undefined, + value => { + setCSSVariable("quick-access-display", value === "disabled" ? "none" : "block"); + return value; + }, + function (event) { this.onload(event.target.value) }, element => element.value ).control, new Setting( - "orderClasses", - "Order Classes", - "[Refresh required] Changes the order of your classes on the grades and mastery pages (only works if your course names contain PER N or PERIOD N)", - "period", + "upcomingOverdueVisibility", + "Hide Upcoming and Overdue Assignments", + 'Hides the "Upcoming" and "Overdue" sidebars on the homepage', + "showAll", "select", { options: [ { - text: "By Period", - value: "period" + text: "Show Both", + value: "showAll" }, { - text: "Alphabetically", - value: "alpha" + text: "Hide Upcoming Only", + value: "hideUpcoming" + }, + { + text: "Hide Overdue Only", + value: "hideOverdue" + }, + { + text: "Hide Both", + value: "hideAll" } ] }, - value => value, - undefined, + value => { + setCSSVariable("overdue-assignments-display", "block"); + setCSSVariable("upcoming-assignments-display", "block"); + switch (value) { + case "hideUpcoming": + setCSSVariable("upcoming-assignments-display", "none"); + break; + case "hideOverdue": + setCSSVariable("overdue-assignments-display", "none"); + break; + case "hideAll": + setCSSVariable("upcoming-assignments-display", "none"); + setCSSVariable("overdue-assignments-display", "none"); + break; + } + return value; + }, + function (event) { this.onload(event.target.value) }, element => element.value ).control, new Setting( @@ -591,45 +634,42 @@ function updateSettings(callback) { element => element.value ).control, new Setting( - "overrideUserStyles", - "Override Styled Text", - "Override styled text in homefeed posts and discussion responses when using modern themes. WARNING: This guarantees text is readable on dark theme, but removes colors and other styling that may be important. You can always use the Toggle Theme button on the navigation bar to temporarily disble your theme.", - "true", + "customScales", + "Custom Grading Scales", + "[Refresh required] Uses custom grading scales (set per-course in course settings) when courses don't have one defined", + "enabled", "select", { options: [ { text: "Enabled", - value: "true" + value: "enabled" }, { text: "Disabled", - value: "false" + value: "disabled" } ] }, - value => { - document.documentElement.setAttribute("style-override", value); - return value; - }, - function (event) { this.onload(event.target.value) }, + value => value, + undefined, element => element.value ).control, new Setting( - "archivedCoursesButton", - "Archived Courses Button", - 'Adds a link to see past/archived courses in the courses dropdown', - "show", + "orderClasses", + "Order Classes", + "[Refresh required] Changes the order of your classes on the grades and mastery pages (only works if your course names contain PER N or PERIOD N)", + "period", "select", { options: [ { - text: "Show", - value: "show" + text: "By Period", + value: "period" }, { - text: "Hide", - value: "hide" + text: "Alphabetically", + value: "alpha" } ] }, @@ -638,61 +678,45 @@ function updateSettings(callback) { element => element.value ).control, new Setting( - "quickAccessVisibility", - "Quick Access", - "[Reload Required to Reposition] Changes the visibility of the Quick Access panel on the homepage", - "enabled", + "overrideUserStyles", + "Override Styled Text", + "Override styled text in homefeed posts and discussion responses when using modern themes. WARNING: This guarantees text is readable on dark theme, but removes colors and other styling that may be important. You can always use the Toggle Theme button on the navigation bar to temporarily disble your theme.", + "true", "select", { options: [ { - text: "Top of Right Sidebar", - value: "enabled" - }, - { - text: "Between Overdue and Upcoming", - value: "belowOverdue" - }, - { - text: "Bottom of Right Sidebar", - value: "bottom" + text: "Enabled", + value: "true" }, { text: "Disabled", - value: "disabled" + value: "false" } ] }, value => { - setCSSVariable("quick-access-display", value === "disabled" ? "none" : "block"); + document.documentElement.setAttribute("style-override", value); return value; }, function (event) { this.onload(event.target.value) }, element => element.value ).control, new Setting( - "indicateSubmission", - "Submitted Assignments Checklist", - '[Reload required] Shows a checkmark, shows a strikethrough, or hides items in "Upcoming Assignments" that have been submitted. If "Show Check Mark" is selected, a checklist function will be enabled allowing you to manually mark assignments as complete.', - "check", + "archivedCoursesButton", + "Archived Courses Button", + 'Adds a link to see past/archived courses in the courses dropdown', + "show", "select", { options: [ { - text: "Show Check Mark ✔ (Enables manual checklist)", - value: "check" - }, - { - text: "Show Strikethrough (Doesn't allow manual checklist)", - value: "strikethrough" + text: "Show", + value: "show" }, { - text: "Hide Assignment (Not recommended)", + text: "Hide", value: "hide" - }, - { - text: "Do Nothing", - value: "disabled" } ] }, @@ -701,74 +725,50 @@ function updateSettings(callback) { element => element.value ).control, new Setting( - "upcomingOverdueVisibility", - "Hide Upcoming and Overdue Assignments", - 'Hides the "Upcoming" and "Overdue" sidebars on the homepage', - "showAll", + "weightedGradebookIndicator", + "Weighted Gradebook Indicator", + "Adds an indicator next to gradebooks which are weighted", + "enabled", "select", { options: [ { - text: "Show Both", - value: "showAll" - }, - { - text: "Hide Upcoming Only", - value: "hideUpcoming" - }, - { - text: "Hide Overdue Only", - value: "hideOverdue" + text: "Show", + value: "enabled" }, { - text: "Hide Both", - value: "hideAll" + text: "Hide", + value: "disabled" } ] }, value => { - setCSSVariable("overdue-assignments-display", "block"); - setCSSVariable("upcoming-assignments-display", "block"); - switch (value) { - case "hideUpcoming": - setCSSVariable("upcoming-assignments-display", "none"); - break; - case "hideOverdue": - setCSSVariable("overdue-assignments-display", "none"); - break; - case "hideAll": - setCSSVariable("upcoming-assignments-display", "none"); - setCSSVariable("overdue-assignments-display", "none"); - break; - } + setCSSVariable("weighted-gradebook-indicator-display", value == "enabled" ? "inline" : "none") return value; }, function (event) { this.onload(event.target.value) }, element => element.value ).control, new Setting( - "weightedGradebookIndicator", - "Weighted Gradebook Indicator", - "Adds an indicator next to gradebooks which are weighted", + "broadcasts", + "Announcement Notifications", + "Displays news feed posts for announcements sent to all Schoology Plus users", "enabled", "select", { options: [ { - text: "Show", + text: "Enable Announcements", value: "enabled" }, { - text: "Hide", + text: "Disable Announcements", value: "disabled" } ] }, - value => { - setCSSVariable("weighted-gradebook-indicator-display", value == "enabled" ? "inline" : "none") - return value; - }, - function (event) { this.onload(event.target.value) }, + value => value, + undefined, element => element.value ).control, new Setting( diff --git a/js/theme-editor.js b/js/theme-editor.js index 452439ae..db87145b 100644 --- a/js/theme-editor.js +++ b/js/theme-editor.js @@ -99,6 +99,8 @@ var discardButton = document.getElementById("discard-button"); discardButton.addEventListener("click", e => ConfirmModal.open("Discard Changes?", "Are you sure you want to discard changes? All unsaved edits will be permanently lost.", ["Discard", "Cancel"], b => b === "Discard" && location.reload())); var closeButton = document.getElementById("close-button"); closeButton.addEventListener("click", e => (!inEditMode() && (location.href = `https://${defaultDomain}`) || ConfirmModal.open("Discard Changes?", "Are you sure you want to close without saving? All unsaved edits will be permanently lost.", ["Discard", "Cancel"], b => b === "Discard" && (location.href = `https://${defaultDomain}`)))); +// var settingsButton = document.getElementById("settings-button"); +// settingsButton.addEventListener("click", e => SettingsModal.open()); var importButton = document.getElementById("import-button"); importButton.addEventListener("click", e => importTheme()); var createPresetDarkTheme = document.getElementById("create-preset-dark-theme"); @@ -220,6 +222,61 @@ class ConfirmModal extends Modal { } } +class SettingsModal extends Modal { + /** + * Opens the settings modal + * @param {string} title The title of the modal + * @param {string} placeholder Text displayed as a placeholder in the textbox + * @param {string[]} buttons Buttons to display in the modal footer + * @param {(button:string,text:string)=>void} callback Called on close with the selected button (or `null` if none selected) and the text in the textbox + */ + static open() { + let content = htmlToElement(` +
+

Settings

+

+

+ Modernized Interface Icons + +
+ Replace various icons around the Schoology user interface with modernized versions. +
+

+
+ `); + + Modal.open(content, ["Cancel", "Save"], button => { + switch (button) { + case "Save": + break; + case "Cancel": + default: + break; + } + }); + + document.getElementById("modernized-icons-lever").addEventListener("change", event => { + if (event.target.checked) { + chrome.permissions.request({permissions: ["webRequest", "webRequestBlocking"]}, granted => { + if (granted) { + event.target.checked = true; + // Setting.setValue("overrideInterfaceIcons", "enabled"); + Logger.debug("webRequest permissions granted"); + } else { + event.target.checked = false; + // Setting.setValue("overrideInterfaceIcons", "disabled"); + Logger.debug("webRequest permissions refused"); + alert("You must grant permission to intercept requests for this feature."); + } + }); + } + }); + } +} + var origThemeName; let warnings = []; let errors = []; diff --git a/manifest.json b/manifest.json index 80888943..cb487aa2 100644 --- a/manifest.json +++ b/manifest.json @@ -35,7 +35,9 @@ "notifications", "cookies", "contextMenus", - "activeTab" + "activeTab", + "webRequest", + "webRequestBlocking" ], "optional_permissions": [ "" diff --git a/theme-editor.html b/theme-editor.html index dc851f71..411695f6 100644 --- a/theme-editor.html +++ b/theme-editor.html @@ -29,11 +29,11 @@ @@ -69,10 +75,18 @@
From 260b778d6ad7de2807452efccb8ce5e0be949101 Mon Sep 17 00:00:00 2001 From: Aaron Opell Date: Tue, 28 Sep 2021 10:18:12 -0700 Subject: [PATCH 5/5] minor tweaks, bumped version --- default-icons.html | 12 +++++----- js/all.js | 2 +- js/background.js | 58 +++++++++++++++++++++++----------------------- js/theme-editor.js | 35 +++------------------------- manifest.json | 2 +- theme-editor.html | 16 ++++++------- 6 files changed, 48 insertions(+), 77 deletions(-) diff --git a/default-icons.html b/default-icons.html index 2c74324d..6e02ac13 100644 --- a/default-icons.html +++ b/default-icons.html @@ -70,9 +70,9 @@ diff --git a/js/all.js b/js/all.js index c0aa6005..c4e268a9 100644 --- a/js/all.js +++ b/js/all.js @@ -293,10 +293,10 @@ let modals = [ { name: "atomicproton#4444" }, { name: "penguinee232#7792" }, { name: "Cody Lomeli" }, + { name: "Lucienne Reyes" }, { name: "Airbus A330-200#0001" }, { name: "Ark#9999" }, { name: "ASAMU#1919" }, - { name: "Baconnated Churro#4954" }, { name: "Blumiere#7442" }, { name: "Krishy Fishy#3333" }, { name: "meepypotato07#7816" }, diff --git a/js/background.js b/js/background.js index eb5d7802..3362ab62 100644 --- a/js/background.js +++ b/js/background.js @@ -324,35 +324,35 @@ function createLogPrefix(color) { addDomainPermissionToggle(); -IMAGE_REDIRECTS = { - "attendance_comment.png": "https://imgur.com/a5JETn6.png", - "icons_sprite_feed.png": "https://imgur.com/5XYV6rt.png", - "icons_sprite_library.png": "https://asset-cdn.schoology.com/sites/all/themes/schoology_theme/images/icons_sprite_library.png", - "resources-menu-icon.png": "https://asset-cdn.schoology.com/sites/all/themes/schoology_theme/images/resources-menu-icon.png", - "icons_sprite_realm.png": "https://asset-cdn.schoology.com/sites/all/themes/schoology_theme/images/icons_sprite_realm.png", - "btn-sprite.png": "https://asset-cdn.schoology.com/sites/all/themes/schoology_theme/images/btn-sprite.png", - "icons_sprite_new.png": "https://asset-cdn.schoology.com/sites/all/themes/schoology_theme/images/icons_sprite_new.png", - "icons_sprite_calendar.png": "https://asset-cdn.schoology.com/sites/all/themes/schoology_theme/images/icons_sprite_calendar.png", - "icons_sprite_med.png": "https://asset-cdn.schoology.com/sites/all/themes/schoology_theme/images/icons_sprite_med.png", - "icons_sprite_large.png": "https://asset-cdn.schoology.com/sites/all/themes/schoology_theme/images/icons_sprite_large.png" -} - -chrome.webRequest.onBeforeRequest.addListener( - details => { - if (storage.modernizedInterfaceIcons !== "disabled") { - let pathParts = new URL(details.url).pathname.split('/'); - if (pathParts.length > 0 && IMAGE_REDIRECTS[pathParts[pathParts.length - 1]]) { - let redirectUrl = IMAGE_REDIRECTS[pathParts[pathParts.length - 1]]; - Logger.debug(`Redirecting from ${details.url} to ${redirectUrl}`) - return { - redirectUrl: redirectUrl - } - } - } - }, - { urls: ["*://*/sites/all/themes/schoology_theme/images/*"]}, - ['blocking'] -); +// IMAGE_REDIRECTS = { +// "attendance_comment.png": "https://imgur.com/a5JETn6.png", +// "icons_sprite_feed.png": "https://imgur.com/5XYV6rt.png", +// "icons_sprite_library.png": "https://asset-cdn.schoology.com/sites/all/themes/schoology_theme/images/icons_sprite_library.png", +// "resources-menu-icon.png": "https://asset-cdn.schoology.com/sites/all/themes/schoology_theme/images/resources-menu-icon.png", +// "icons_sprite_realm.png": "https://asset-cdn.schoology.com/sites/all/themes/schoology_theme/images/icons_sprite_realm.png", +// "btn-sprite.png": "https://asset-cdn.schoology.com/sites/all/themes/schoology_theme/images/btn-sprite.png", +// "icons_sprite_new.png": "https://asset-cdn.schoology.com/sites/all/themes/schoology_theme/images/icons_sprite_new.png", +// "icons_sprite_calendar.png": "https://asset-cdn.schoology.com/sites/all/themes/schoology_theme/images/icons_sprite_calendar.png", +// "icons_sprite_med.png": "https://asset-cdn.schoology.com/sites/all/themes/schoology_theme/images/icons_sprite_med.png", +// "icons_sprite_large.png": "https://asset-cdn.schoology.com/sites/all/themes/schoology_theme/images/icons_sprite_large.png" +// } + +// chrome.webRequest.onBeforeRequest.addListener( +// details => { +// if (storage.modernizedInterfaceIcons !== "disabled") { +// let pathParts = new URL(details.url).pathname.split('/'); +// if (pathParts.length > 0 && IMAGE_REDIRECTS[pathParts[pathParts.length - 1]]) { +// let redirectUrl = IMAGE_REDIRECTS[pathParts[pathParts.length - 1]]; +// Logger.debug(`Redirecting from ${details.url} to ${redirectUrl}`) +// return { +// redirectUrl: redirectUrl +// } +// } +// } +// }, +// { urls: ["*://*/sites/all/themes/schoology_theme/images/*"]}, +// ['blocking'] +// ); // if (getBrowser() !== "Firefox") { // // See https://bugs.chromium.org/p/chromium/issues/detail?id=966223#c3 diff --git a/js/theme-editor.js b/js/theme-editor.js index db87145b..a0f22826 100644 --- a/js/theme-editor.js +++ b/js/theme-editor.js @@ -99,8 +99,8 @@ var discardButton = document.getElementById("discard-button"); discardButton.addEventListener("click", e => ConfirmModal.open("Discard Changes?", "Are you sure you want to discard changes? All unsaved edits will be permanently lost.", ["Discard", "Cancel"], b => b === "Discard" && location.reload())); var closeButton = document.getElementById("close-button"); closeButton.addEventListener("click", e => (!inEditMode() && (location.href = `https://${defaultDomain}`) || ConfirmModal.open("Discard Changes?", "Are you sure you want to close without saving? All unsaved edits will be permanently lost.", ["Discard", "Cancel"], b => b === "Discard" && (location.href = `https://${defaultDomain}`)))); -// var settingsButton = document.getElementById("settings-button"); -// settingsButton.addEventListener("click", e => SettingsModal.open()); +var settingsButton = document.getElementById("settings-button"); +settingsButton.addEventListener("click", e => SettingsModal.open()); var importButton = document.getElementById("import-button"); importButton.addEventListener("click", e => importTheme()); var createPresetDarkTheme = document.getElementById("create-preset-dark-theme"); @@ -225,25 +225,13 @@ class ConfirmModal extends Modal { class SettingsModal extends Modal { /** * Opens the settings modal - * @param {string} title The title of the modal - * @param {string} placeholder Text displayed as a placeholder in the textbox - * @param {string[]} buttons Buttons to display in the modal footer - * @param {(button:string,text:string)=>void} callback Called on close with the selected button (or `null` if none selected) and the text in the textbox */ static open() { let content = htmlToElement(`

Settings

-

- Modernized Interface Icons - -
- Replace various icons around the Schoology user interface with modernized versions. -
+ Nothing to see here yet! Theme editor settings coming soon™.

`); @@ -257,23 +245,6 @@ class SettingsModal extends Modal { break; } }); - - document.getElementById("modernized-icons-lever").addEventListener("change", event => { - if (event.target.checked) { - chrome.permissions.request({permissions: ["webRequest", "webRequestBlocking"]}, granted => { - if (granted) { - event.target.checked = true; - // Setting.setValue("overrideInterfaceIcons", "enabled"); - Logger.debug("webRequest permissions granted"); - } else { - event.target.checked = false; - // Setting.setValue("overrideInterfaceIcons", "disabled"); - Logger.debug("webRequest permissions refused"); - alert("You must grant permission to intercept requests for this feature."); - } - }); - } - }); } } diff --git a/manifest.json b/manifest.json index cb487aa2..5f02aca5 100644 --- a/manifest.json +++ b/manifest.json @@ -9,7 +9,7 @@ "id": "schoology.plus@aopell.me" } }, - "version": "7.3.1", + "version": "7.3.2", "icons": { "128": "imgs/icon@128.png", "64": "imgs/icon@64.png", diff --git a/theme-editor.html b/theme-editor.html index 411695f6..bf453da6 100644 --- a/theme-editor.html +++ b/theme-editor.html @@ -29,11 +29,9 @@