Skip to content

Commit

Permalink
Merge pull request #263 from aopell/develop
Browse files Browse the repository at this point in the history
Version 7.3
  • Loading branch information
aopell authored Sep 9, 2021
2 parents f519763 + a1ff7ba commit 4698ec6
Show file tree
Hide file tree
Showing 28 changed files with 389 additions and 189 deletions.
4 changes: 3 additions & 1 deletion css/modern/all.css
Original file line number Diff line number Diff line change
Expand Up @@ -2143,9 +2143,11 @@ variable-intellisense {

[modern=true][dark=true]:root .assessment-delivery-landing-app div._3dHTa::after {
content: "WARNING: A dark theme is enabled and might prevent you from reading certain questions. If you can't read a question, you can temporarily disable dark theme using the Toggle Theme button on the navigation bar.";
display: inline-block;
display: block;
text-align: center;
width: 50%;
margin-left: 25%;
font-size: 16px;
padding: var(--padding);
background-color: var(--highlight);
border: var(--border-size) solid rgba(0, 0, 0, 0.5);
Expand Down
16 changes: 16 additions & 0 deletions css/theme-editor.css
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,22 @@ h2.center {
background-color: var(--primary-color);
}

#create-preset-dropdown {
background-color: #dedede;
}

#create-preset-dropdown > li > * {
color: #2a2a2a;
}

#create-preset-dropdown > li > a {
cursor: pointer;
}

.dropdown-header {
font-weight: bold;
}

#new-icon {
background-color: var(--primary-color);
}
Expand Down
4 changes: 4 additions & 0 deletions css/user.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,8 @@
color: #333;
font-size: 14px;
font-weight: bold;
}

.course-in-common-container {
padding-top: 10px !important;
}
1 change: 1 addition & 0 deletions default-icons.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
</head>

<body>
<script src="/js/loader.js"></script>
<header>
<div class="navbar-fixed">
<nav class="splus-blue">
Expand Down
6 changes: 6 additions & 0 deletions js/all-idle.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
(async function() {
// Wait for loader.js to finish running
while (!window.splusLoaded) {
await new Promise(resolve => setTimeout(resolve, 10));
}
await loadDependencies("all-idle", ["all"]);
})();

Expand Down Expand Up @@ -234,6 +238,8 @@
return;
}

chrome.runtime.sendMessage({ type: "setBadgeText", text: "" });

let coll = notifsMenuContainer.querySelectorAll("div[role=\"menu\"] ._2awxe._3skcp._1tpub a[href^=\"/assignment/\"]");
if (coll.length > 0) {
Logger.log("NotifsDropdown observation has links to process - processing now");
Expand Down
28 changes: 16 additions & 12 deletions js/all.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
(async function() {
// Wait for preload.js to finish running
(async function () {
// Wait for loader.js to finish running
while (!window.splusLoaded) {
await new Promise(resolve => setTimeout(resolve, 10));
}
await loadDependencies("all", ["preload"]);
})();

// Inform user about theme
{
(function () {
// Inform user about theme
if (localStorage["splus-temp-generatedtheme"]) {
localStorage.removeItem("splus-temp-generatedtheme");

Expand All @@ -22,9 +22,9 @@
}
);
}
}
})();

{
(function () {
let betaCode = Setting.getValue("beta");
let betaSection = null;
if (betaCode in beta_tests) {
Expand All @@ -49,7 +49,8 @@
createElement("input", [], { type: "checkbox", checked: checked, onchange: onchange })
]);
}
}
})();


// Check Schoology domain
setTimeout(function () {
Expand Down Expand Up @@ -280,7 +281,7 @@ let modals = [
}
}
return retVal;
})(["DinosoftLabs", "Eucalyp", "Flat Icons", "Freepik", "Maxim Basinski", "Pixel Buddha", "Smashicons", "Twitter", "Vectors Market", "Vitaly Gorbachev", "srip", "surang", "Pixelmeetup"])
})(["DinosoftLabs", "Eucalyp", "Flat Icons", "Freepik", "Maxim Basinski", "Pixel Buddha", "Smashicons", "Twitter", "Vectors Market", "Vitaly Gorbachev", "srip", "surang", "Pixelmeetup", "photo3idea_studio"])
}),
createElement("span", [], { textContent: " from " }),
createElement("a", [], { href: "https://www.flaticon.com/", textContent: "flaticon.com" })
Expand Down Expand Up @@ -488,7 +489,7 @@ document.querySelector("#header > header > nav > ul:nth-child(2)").prepend(creat
title: "Toggle Theme\n\nUse this button to temporarily disable your Schoology Plus theme if something isn't displaying correctly.",
onclick: e => {
let newVal = document.documentElement.getAttribute("modern") == "false" ? "true" : "false";
if(newVal == "false") {
if (newVal == "false") {
tempTheme = "Schoology Plus";
} else {
tempTheme = undefined;
Expand Down Expand Up @@ -516,9 +517,9 @@ document.querySelector("#header > header > nav > ul:nth-child(2)").prepend(creat
let paintSvg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
paintSvg.setAttribute("viewBox", "-12 -20 500 500");
paintSvg.setAttribute("class", "_3ESp2 dlCBz _1I3mg fjQuT uQOmx");

paintSvg.innerHTML = '<path d="m242 197v90c0 8.284 6.716 15 15 15h180c8.284 0 15-6.716 15-15v-90c0-8.284-6.716-15-15-15h-180c-8.284 0-15 6.716-15 15z"/><path d="m377 422h-60c-8.284 0-15 6.716-15 15v60c0 8.284 6.716 15 15 15h60c8.284 0 15-6.716 15-15v-60c0-8.284-6.716-15-15-15z"/><path d="m307.667 15c0-8.284-6.716-15-15-15h-45v60h60z"/><path d="m217.667 0h-202.667c-8.284 0-15 6.716-15 15v45h217.667z"/><path d="m307.667 347v-15h-50.667c-24.813 0-45-20.186-45-45v-90c0-24.814 20.187-45 45-45h50.667v-62h-307.667v257c0 8.284 6.716 15 15 15h277.667c8.284 0 15-6.716 15-15zm-155.698-46h-91.969c-8.284 0-15-6.716-15-15s6.716-15 15-15h91.969c8.284 0 15 6.716 15 15s-6.716 15-15 15zm0-60h-91.969c-8.284 0-15-6.716-15-15s6.716-15 15-15h91.969c8.284 0 15 6.716 15 15s-6.716 15-15 15zm0-60h-91.969c-8.284 0-15-6.716-15-15s6.716-15 15-15h91.969c8.284 0 15 6.716 15 15s-6.716 15-15 15z"/><path d="m482 229.58v87.42c0 8.272-6.728 15-15 15h-90c-24.814 0-45 20.186-45 45v15h30v-15c0-8.272 6.728-15 15-15h90c24.814 0 45-20.186 45-45v-45c0-19.555-12.541-36.227-30-42.42z"/>';

return paintSvg;
})()
]
Expand Down Expand Up @@ -1083,7 +1084,7 @@ async function createQuickAccess() {
]));

let quickLink = Setting.getNestedValue("courseQuickLinks", section.id);
if(quickLink && quickLink !== "") {
if (quickLink && quickLink !== "") {
courseIconsContainer.prepend(createElement("a", ["icon", "icon-quicklink", "splus-track-clicks"], { href: quickLink, title: `Quick Link \n(${quickLink})`, dataset: { splusTrackingTarget: "quick-access-quicklink-link", splusTrackingLabel: "Quick Access" } }))
}

Expand Down Expand Up @@ -1189,6 +1190,9 @@ function indicateSubmittedAssignments() {
} else if (assignmentElement.href.includes("/course/")) {
// Discussion boards, maybe other assignments as well
assignmentId = assignmentElement.href.match(/course\/\d+\/.*\/(\d+)/)[1];
} else if (assignmentElement.href.includes("/event/")) {
// Calendar events
assignmentId = assignmentElement.href.match(/event\/(\d+)/)[1];
}

// add a CSS class for both states, so we can distinguish 'loading' from known-(in)complete
Expand Down
8 changes: 8 additions & 0 deletions js/analytics.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
(async function() {
// Wait for loader.js to finish running
while (!window.splusLoaded) {
await new Promise(resolve => setTimeout(resolve, 10));
}
await loadDependencies("analytics", []);
})();

/**
* Tracks an event using Google Analytics if the user did not opt out
* NOTE: The Firefox version of the extension has no support for Google Analytics
Expand Down
4 changes: 4 additions & 0 deletions js/assessment.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
(async function() {
// Wait for loader.js to finish running
while (!window.splusLoaded) {
await new Promise(resolve => setTimeout(resolve, 10));
}
await loadDependencies("assessment", ["all"]);
})();

Expand Down
2 changes: 2 additions & 0 deletions js/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ chrome.runtime.onMessage.addListener(
} else if (request.type == "updateDefaultDomain" && request.domain !== undefined) {
defaultDomain = request.domain;
assignmentNotificationUrl = `https://${defaultDomain}/home/notifications?filter=all`;
} else if (request.type == "setBadgeText" && request.text !== undefined) {
chrome.browserAction.setBadgeText({ text: request.text });
}
}
);
Expand Down
96 changes: 51 additions & 45 deletions js/course.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
(async function() {
(async function () {
// Wait for loader.js to finish running
while (!window.splusLoaded) {
await new Promise(resolve => setTimeout(resolve, 10));
}
await loadDependencies("course", ["all"]);
})();

Expand All @@ -19,53 +23,55 @@ let courseSettingsCourseName;
}
})();

modals.push(new Modal("course-settings-modal", "Course Options", createElement("div", [], {}, [
createElement("div", ["splus-modal-contents"], {}, [
createElement("div", ["setting-entry"], {}, [
createElement("h1", ["setting-title", "splus-coursealiasing-exempt"], { id: "course-options-course-name" })
]),
createElement("div", ["setting-entry"], {}, [
createElement("h2", ["setting-title"], {}, [
createElement("label", ["centered-label"], { textContent: "Nickname: ", htmlFor: "setting-input-course-alias" }),
createElement("input", [], { type: "text", id: "setting-input-course-alias" }, [])
(function () {
modals.push(new Modal("course-settings-modal", "Course Options", createElement("div", [], {}, [
createElement("div", ["splus-modal-contents"], {}, [
createElement("div", ["setting-entry"], {}, [
createElement("h1", ["setting-title", "splus-coursealiasing-exempt"], { id: "course-options-course-name" })
]),
createElement("p", ["setting-description"], { textContent: "A friendlier name for a course that shows anywhere the full name for the course would normally" })
]),
createElement("div", ["setting-entry"], {}, [
createElement("h2", ["setting-title"], {}, [
createElement("label", ["centered-label"], { textContent: "Quick Link: ", htmlFor: "setting-input-course-quicklink" }),
createElement("input", [], { type: "text", id: "setting-input-course-quicklink" }, [])
createElement("div", ["setting-entry"], {}, [
createElement("h2", ["setting-title"], {}, [
createElement("label", ["centered-label"], { textContent: "Nickname: ", htmlFor: "setting-input-course-alias" }),
createElement("input", [], { type: "text", id: "setting-input-course-alias" }, [])
]),
createElement("p", ["setting-description"], { textContent: "A friendlier name for a course that shows anywhere the full name for the course would normally" })
]),
createElement("p", ["setting-description"], { textContent: "A link associated with this class that will show up as a ⭐ button in Quick Access. Good uses of this setting might include Zoom links or class websites." })
]),
createElement("div", ["setting-entry"], {}, [
createElement("h2", [], { textContent: "Grading Scale" }),
createElement("p", ["setting-description"], { textContent: "This grading scale is used to show letter grades when teachers don't set them, and for calculating the minimum score needed on an assignment for a grade" }),
createElement("table", [], { id: "grading-scale-wrapper" }, [
createElement("tr", [], {}, [
createElement("th", [], { textContent: "Minimum Percentage" }),
createElement("th", [], { textContent: "Grade Symbol" })
createElement("div", ["setting-entry"], {}, [
createElement("h2", ["setting-title"], {}, [
createElement("label", ["centered-label"], { textContent: "Quick Link: ", htmlFor: "setting-input-course-quicklink" }),
createElement("input", [], { type: "text", id: "setting-input-course-quicklink" }, [])
]),
createElement("p", ["setting-description"], { textContent: "A link associated with this class that will show up as a ⭐ button in Quick Access. Good uses of this setting might include Zoom links or class websites." })
]),
createElement("div", ["setting-entry"], {}, [
createElement("h2", [], { textContent: "Grading Scale" }),
createElement("p", ["setting-description"], { textContent: "This grading scale is used to show letter grades when teachers don't set them, and for calculating the minimum score needed on an assignment for a grade" }),
createElement("table", [], { id: "grading-scale-wrapper" }, [
createElement("tr", [], {}, [
createElement("th", [], { textContent: "Minimum Percentage" }),
createElement("th", [], { textContent: "Grade Symbol" })
])
]),
createElement("p", ["add-grade-symbol"], {}, [
createElement("a", [], { textContent: "Add Grading Symbol", href: "#", onclick: (event) => createRow() })
])
]),
createElement("p", ["add-grade-symbol"], {}, [
createElement("a", [], { textContent: "Add Grading Symbol", href: "#", onclick: (event) => createRow() })
createElement("div", ["setting-entry"], {}, [
createElement("h2", ["setting-title"], { textContent: "Force Default Icon: " }, [
createElement("select", [], { id: "force-default-icon-splus-courseopt-select" }, [
createElement("option", [], { textContent: "Enabled", value: "enabled" }),
createElement("option", [], { textContent: "Disabled", value: "disabled", selected: true })
])
]),
createElement("p", ["setting-description"], { textContent: "Use Schoology's icon for this course instead of the Schoology Plus themed icon regardless of the global Schoology Plus setting" })
])
]),
createElement("div", ["setting-entry"], {}, [
createElement("h2", ["setting-title"], { textContent: "Force Default Icon: " }, [
createElement("select", [], { id: "force-default-icon-splus-courseopt-select" }, [
createElement("option", [], { textContent: "Enabled", value: "enabled" }),
createElement("option", [], { textContent: "Disabled", value: "disabled", selected: true })
])
]),
createElement("p", ["setting-description"], { textContent: "Use Schoology's icon for this course instead of the Schoology Plus themed icon regardless of the global Schoology Plus setting" })
createElement("div", ["settings-buttons-wrapper"], undefined, [
createButton("save-course-settings", "Save Settings", saveCourseSettings),
createElement("a", ["restore-defaults"], { textContent: "Restore Defaults", onclick: restoreCourseDefaults, href: "#" })
])
]),
createElement("div", ["settings-buttons-wrapper"], undefined, [
createButton("save-course-settings", "Save Settings", saveCourseSettings),
createElement("a", ["restore-defaults"], { textContent: "Restore Defaults", onclick: restoreCourseDefaults, href: "#" })
])
]), modalFooterText, setCourseOptionsContent));
]), modalFooterText, setCourseOptionsContent));
})();

document.querySelector("#course-settings-modal .close").onclick = modalClose;

Expand All @@ -81,7 +87,7 @@ function setCourseOptionsContent(modal, options) {
e.parentElement.removeChild(e);
}
gradingScale = Setting.getNestedValue("gradingScales", courseIdNumber, gradingScale);

for (let p of Object.keys(gradingScale).sort((a, b) => a - b).reverse()) {
createRow(p, gradingScale[p]);
}
Expand Down Expand Up @@ -152,14 +158,14 @@ function saveCourseSettings() {
return;
}
}
if(scale != currentValue[courseIdNumber]) {
if (scale != currentValue[courseIdNumber]) {
trackEvent("gradingScales", "set value", "Course Settings");
}
currentValue[courseIdNumber] = scale;

let currentAliasesValue = Setting.getValue("courseAliases", {});
let newAliasValue = document.getElementById("setting-input-course-alias").value;
if(newAliasValue !== currentAliasesValue[courseIdNumber]) {
if (newAliasValue !== currentAliasesValue[courseIdNumber]) {
trackEvent("courseAliases", "set value", "Course Settings");
}
currentAliasesValue[courseIdNumber] = newAliasValue;
Expand All @@ -174,7 +180,7 @@ function saveCourseSettings() {
let courseIconOverride = Setting.getValue("forceDefaultCourseIcons", {});
let iconOverrideSelect = document.getElementById("force-default-icon-splus-courseopt-select");
let overrideValue = iconOverrideSelect.options[iconOverrideSelect.selectedIndex].value;
if(overrideValue !== courseIconOverride[courseIdNumber]) {
if (overrideValue !== courseIconOverride[courseIdNumber]) {
trackEvent("forceDefaultCourseIcons", `set value: ${overrideValue}`, "Course Settings");
}
courseIconOverride[courseIdNumber] = overrideValue
Expand Down
8 changes: 6 additions & 2 deletions js/courses.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
(async function() {
(async function () {
// Wait for loader.js to finish running
while (!window.splusLoaded) {
await new Promise(resolve => setTimeout(resolve, 10));
}
await loadDependencies("courses", ["all"]);
})();

Expand All @@ -8,7 +12,7 @@ for (let course of document.querySelectorAll("li.course-item.list-item")) {
parent.replaceChild(wrapper, course);
wrapper.appendChild(course);
course.prepend(createElement("img", ["course-list-icon"], { src: Theme.getIcon(course.querySelector(".course-title").textContent) || chrome.runtime.getURL("imgs/fallback-course-icon.svg") }));

let kabobMenuButton = createElement("span", ["courses-kabob-menu"], {
textContent: "⠇",
onclick: function (event) {
Expand Down
8 changes: 8 additions & 0 deletions js/default-themes.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
(async function () {
// Wait for loader.js to finish running
while (!window.splusLoaded) {
await new Promise(resolve => setTimeout(resolve, 10));
}
await loadDependencies("default-themes", []);
})();

let __defaultThemes = [
{
"name": "Schoology Plus Modern Light",
Expand Down
Loading

0 comments on commit 4698ec6

Please sign in to comment.