diff --git a/README.md b/README.md index 91cb6cd..7fa50ec 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,7 @@ - [Course Options](#course-options) - [Course Nicknames](#course-nicknames) - [Custom Grading Scales](#custom-grading-scales) +- [Custom Domain Support](#custom-domain-support) - [Feedback and Support Discord](#feedback-and-support-discord) - [Contributing](#contributing) - [Contributors](#contributors) @@ -247,6 +248,13 @@ Schoology Plus is equipped with a fully-featured theme editor, allowing you to c - You can create custom grading scales for courses where the teacher does not have a grading scale set for the class. - This will be used to calculate letter grades for assignment categories and courses on the grades page +# Custom Domain Support +Schoology Plus can be configured to work with your school's custom Schoology instance. Simply navigate to the homepage of your school's Schoology implementation, then right click the extension and select "Enable Schoolgy Plus on this domain". This is necessary only if your school's Schoology site is running on a domain that does not end in `schoology.com`. See [this page](https://schoologypl.us/docs/faq/domain) for more information. + +![Custom Domains](https://i.imgur.com/WYgCVES.png) + +*Image: The option to enable Schoology Plus for your school's domain can be found by right-clicking the extension.* + # Feedback and Support Discord Schoology Plus has a Discord server where you can offer feature suggestions, report bugs, get support, or just talk with other Schoology Plus users. [Click here to join!](https://discord.schoologypl.us) diff --git a/css/all.css b/css/all.css index bade8dc..622852b 100644 --- a/css/all.css +++ b/css/all.css @@ -972,6 +972,13 @@ a._3_bfp { width: 400px; } +.splus-permissions-link { + text-align: center; + font-size: 14px; + color: white !important; + text-decoration: underline; +} + .splus-permissions-description strong { font-size: 16px; text-decoration: underline; @@ -996,3 +1003,11 @@ a._3_bfp { list-style: disc !important; list-style-position: inside !important; } + +.splus-permissions-close { + position: absolute; + left: 69%; + top: 5%; + font-size: xx-large; + cursor: pointer; +} diff --git a/js/all.js b/js/all.js index 466209f..f6b4bc7 100644 --- a/js/all.js +++ b/js/all.js @@ -272,6 +272,10 @@ let modals = [ { name: "Peter Stenger (@reteps)", url: "https://github.com/reteps" }, { name: "Eric Pedley (@EricPedley)", url: "https://github.com/EricPedley" }, { name: "@KTibow", url: "https://github.com/KTibow" }, + { name: "@FenyLabs", url: "https://github.com/FenyLabs" }, + { name: "@jetline0", url: "https://github.com/jetline0" }, + { name: "@dsnsgithub", url: "https://github.com/dsnsgithub" }, + { name: "@senoj26", url: "https://github.com/senoj26" }, ]) }), ]), @@ -779,9 +783,9 @@ let siteNavigationTileHelpers = { let courseAlias; if (cardData.parentElement.href) { - let courseLinkMatch = cardData.parentElement.href.match(/\/course\/(\d+)\/?$/); + let courseLinkMatch = cardData.parentElement.href.split("/"); if (courseLinkMatch) { - courseLinkMatch = courseLinkMatch[1]; + courseLinkMatch = courseLinkMatch.at(-2); } if (courseLinkMatch && Setting.getValue("courseAliases")) { courseAlias = Setting.getValue("courseAliases")[courseLinkMatch]; @@ -808,7 +812,7 @@ let siteNavigationTileHelpers = { // stylistically equivalent to the other card data, in terms of our class list for the container element // FIXME: there's a stylistic incongruity between a nicknamed course in the dropdown and a non-nicknamed one let newCardDataChild = createElement("div", ["_36sHx", "_3M0N7", "fjQuT", "_1EyV_", "splus-coursesdropdown-nicknamed-dataset", "splus-addedtodynamicdropdown"], {}, [ - createElement("div", ["_1wP6w", "_23_WZ", "_2qcpH", "_3ghFm", "_17Z60", "_1Aph-", "gs0RB"], { textContent: courseAlias }), // stylized like section title + createElement("div", ["_3U8Br", "_1wP6w", "_23_WZ", "_2qcpH", "_3ghFm", "_17Z60", "_1Aph-", "gs0RB"], { textContent: courseAlias }), // stylized like section title createElement("div", ["_2wOCj", "xjR5v", "_2qcpH", "_17Z60", "_1Aph-", "gs0RB", "splus-coursealiasing-exempt"], { textContent: origCourseTitle.textContent + ": " + origSectionTitle.textContent }), // original full title, stylized like school name createElement("div", ["_2wOCj", "xjR5v", "_2qcpH", "_17Z60", "_1Aph-", "gs0RB"], { textContent: origSchoolTitle.textContent }) // school title, original styling and text ]); @@ -1310,4 +1314,4 @@ function indicateSubmittedAssignments() { setTimeout(indicateSubmitted, 1000); } -Logger.debug("Finished loading all.js"); \ No newline at end of file +Logger.debug("Finished loading all.js"); diff --git a/js/api-key.js b/js/api-key.js index 58517fd..7295c0a 100644 --- a/js/api-key.js +++ b/js/api-key.js @@ -71,15 +71,44 @@ ]), ]), ]), + createElement("div", ["splus-permissions-close"], {}, [ + createElement("span", [], { textContent: "×", title: "Hide this message and show the original API key page (for developers)", onclick: function() { + document.getElementsByClassName('splus-permissions-wrapper')[0].style.display = "none"; + currentKey.parentElement.style.display = "block"; + currentSecret.parentElement.style.display = "block"; + document.getElementsByClassName('splus-api-key-page')[0].classList.remove('splus-api-key-page'); + document.getElementsByClassName('splus-api-key-page')[0].classList.remove('splus-api-key-page'); + document.getElementsByClassName('splus-api-key-footer')[0].style.display = "none"; + let submitButton = document.getElementById("edit-reveal") || document.getElementById("edit-request"); + submitButton.value = "Reveal Existing Secret"; + submitButton.parentElement.classList.remove('splus-allow-access'); + } } ), + ]), ]) ])); - let submitButton = document.getElementById("edit-reveal") || document.getElementById("edit-request"); - submitButton.parentElement.classList.add("splus-allow-access"); - submitButton.value = "Allow Access"; + let submitButton = null; //document.getElementById("edit-reveal") || document.getElementById("edit-request"); + if(submitButton === null) { + let permElement = document.getElementsByClassName("splus-permissions-description")[0]; + permElement.append(createElement("br", [], {})); + permElement.append(createElement("br", [], {})); + permElement.append( + createElement("div", ["splus-permissions-section"], { style: "background-color: var(--error, #F44336); color: var(--contrast-text, white); padding: var(--padding, 5px); border-radius: var(--border-radius, 0px);" }, [ + createElement("span", [], { textContent: "It looks like your school or district has disabled API Key generation. Unfortunately, this means the above features will not work. The rest of Schoology Plus' features will still work, though!" }), + + createElement("div", ["splus-permissions-section"], {}, [ + createElement("a", ["splus-permissions-link"], { href: "https://schoologypl.us/docs/faq/api", textContent: "Click Here to Read More" }) + ]) + ]) + ); + } else { + submitButton.parentElement.classList.add("splus-allow-access"); + submitButton.value = "Allow Access"; + } submitButton.parentElement.insertAdjacentElement("afterend", createElement("div", ["splus-api-key-footer"], { style: { textAlign: "center" } }, [ createElement("a", [], { + href: "#", textContent: "Deny Access", onclick: () => { alert("API key access was denied. Please keep in mind many Schoology Plus features will not work correctly with this disabled. You can change this at any time from the Schoology Plus settings menu."); trackEvent("Change Access", "denied", "API Key"); @@ -91,4 +120,4 @@ } }), ])); -})(); \ No newline at end of file +})(); diff --git a/js/grades.js b/js/grades.js index f2154b7..cd395dc 100644 --- a/js/grades.js +++ b/js/grades.js @@ -690,7 +690,7 @@ var fetchQueue = []; let total = 0; let totalPercentWeight = 0; let catWeight = 0; // 0 to 1 - for (let category of perRow.parentElement.querySelectorAll(`.category-row[data-parent-id="${perRow.dataset.id}]"`)) { + for (let category of perRow.parentElement.querySelectorAll(`.category-row[data-parent-id="${perRow.dataset.id}"]`)) { let weightPercentElement = category.getElementsByClassName("percentage-contrib")[0]; if (!weightPercentElement) { continue; diff --git a/manifest.json b/manifest.json index 4d8dae7..97042ba 100644 --- a/manifest.json +++ b/manifest.json @@ -10,7 +10,7 @@ "update_url": "https://schoologypl.us/firefox_updates.json" } }, - "version": "7.5", + "version": "7.6", "icons": { "128": "imgs/icon@128.png", "64": "imgs/icon@64.png",