Skip to content

Commit

Permalink
Merge pull request #253 from aopell/develop
Browse files Browse the repository at this point in the history
Version 7.2
  • Loading branch information
aopell authored Mar 3, 2021
2 parents 6656ca5 + bbb5c28 commit 5d70301
Show file tree
Hide file tree
Showing 11 changed files with 528 additions and 375 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
- Modern Light Theme which revitalizes the late 2000s interface to look modern and new
- Many other theme options as well, or make your own!
- Replaces your school's logo with the Schoology logo
- [Click here to learn how to enable dark theme](https://schoologypl.us/docs/themes/dark)

### Custom Themes

Expand Down
15 changes: 11 additions & 4 deletions css/all.css
Original file line number Diff line number Diff line change
Expand Up @@ -382,10 +382,9 @@ section.sgy-card .sgy-card-lens img.injected-course-icon {
color: var(--contrast-text-color) !important;
}

.submit-span-wrapper {
.submit-span-wrapper, .submit-span-wrapper[style] {
border: 2px solid var(--border-color) !important;
background-color: var(--primary-color) !important;
background-image: none !important;
background: var(--primary-color) !important;
}

.submit-span-wrapper:hover {
Expand Down Expand Up @@ -528,7 +527,7 @@ the selector matches inside notifications in the new notifs dropdown
}

.quick-course-link {
max-width: 250px;
max-width: 225px;
display: inline-block;
}

Expand Down Expand Up @@ -581,6 +580,10 @@ the selector matches inside notifications in the new notifs dropdown
background-position: 5px -475px;
}

.quick-access-course .icon.icon-quicklink {
background-position: 5px -1225px;
}

.quick-access-course .icon.icon-grades:hover {
background-position: 5px -100px;
}
Expand All @@ -593,6 +596,10 @@ the selector matches inside notifications in the new notifs dropdown
background-position: 5px -450px;
}

.quick-access-course .icon.icon-quicklink:hover {
background-position: 5px -1200px;
}

.quick-access-no-courses {
padding-top: 5px;
}
Expand Down
32 changes: 26 additions & 6 deletions css/modern/all.css
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ variable-intellisense {
}

[modern=true]:root #youtube-disclaimer {
display: inline-block !important;
color: var(--text) !important;
background-color: var(--secondary) !important;
padding: var(--padding) !important;
Expand Down Expand Up @@ -97,7 +96,9 @@ variable-intellisense {
[modern=true][style-override=true]:root .comment-comment .comment-body-wrapper *[style],
[modern=true][style-override=true]:root .instructions-content *[style],
[modern=true][style-override=true]:root .lrn_stimulus .lrn_stimulus_content *[style],
[modern=true][style-override=true]:root .lrn-possible-answer *[style] {
[modern=true][style-override=true]:root .lrn-possible-answer *[style],
[modern=true][style-override=true]:root .folder-description *[style],
[modern=true][style-override=true]:root .item-info *[style] {
color: var(--text) !important;
background: none !important;
}
Expand Down Expand Up @@ -844,7 +845,9 @@ variable-intellisense {
border-radius: var(--border-radius) !important;
}

[modern=true]:root .userlist_input input, [modern=true]:root .userlist_input_shadow, [modern=true]:root .userlist_input input[type=text] {
[modern=true]:root .userlist_input input,
[modern=true]:root .userlist_input_shadow,
[modern=true]:root .userlist_input input[type=text] {
background-color: var(--input) !important;
border-radius: var(--border-radius) !important;
}
Expand Down Expand Up @@ -1032,8 +1035,8 @@ variable-intellisense {
background-color: var(--primary) !important;
}

[modern=true]:root body > div._1f1I3._35u4I.IaH_B.RuZ14.VSOiH._3brnw.S42JQ > div > div button {
filter: Grayscale(var(--theme-is-dark)) Invert(var(--theme-is-dark));
[modern=true]:root body > div._1f1I3._35u4I.IaH_B.RuZ14.VSOiH._3brnw.S42JQ > div > div button span._24avl._17Z60 {
color: var(--text) !important;
}

[modern=true]:root body > div._1f1I3._35u4I.IaH_B.RuZ14.VSOiH._3brnw.S42JQ > div > div .Card-card-2rORL {
Expand Down Expand Up @@ -1404,9 +1407,20 @@ variable-intellisense {
filter: Invert(var(--theme-is-dark)) !important;
}

[modern=true]:root .messages .messages-close-btn {
color: var(--text) !important;
}

[modern=true]:root .messages.warning {
background: var(--highlight) !important;
color: var(--text) !important;
border: none !important;
}

[modern=true]:root .messages.status {
background: var(--active) !important;
color: var(--text) !important;
border: none !important;
}

[modern=true]:root span#updates-count {
Expand All @@ -1424,7 +1438,8 @@ variable-intellisense {
color: var(--text);
}

[modern=true]:root .shuffleParent div.sshuffleContainer, [modern=true]:root .shuffleParent .mediaThumbContainer {
[modern=true]:root .shuffleParent div.sshuffleContainer,
[modern=true]:root .shuffleParent .mediaThumbContainer {
background: var(--secondary) !important;
border: var(--modern-border) !important;
border-radius: var(--border-radius) !important;
Expand Down Expand Up @@ -1552,6 +1567,11 @@ variable-intellisense {
background-color: var(--active) !important;
}

[modern=true]:root .discussion-view .discussion-content .comment #comment-reply-form-wrapper #s-comment-reply-form,
[modern=true]:root .discussion-view .s-comments-post-form-new .comment #comment-reply-form-wrapper #s-comment-reply-form {
background: var(--accent) !important;
}

[modern=true]:root .grade-title {
color: var(--text) !important;
}
Expand Down
47 changes: 28 additions & 19 deletions js/all.js
Original file line number Diff line number Diff line change
Expand Up @@ -472,21 +472,6 @@ document.body.onkeydown = (data) => {
};

document.querySelector("#header > header > nav > ul:nth-child(2)").prepend(createElement("li", ["_24avl", "_3Rh90", "_349XD"], {}, [
createElement(
"button",
["_1SIMq", "_2kpZl", "_3OAXJ", "_13cCs", "_3_bfp", "_2M5aC", "_24avl", "_3v0y7", "_2s0LQ", "_3ghFm", "_3LeCL", "_31GLY", "_9GDcm", "_1D8fw", "util-height-six-3PHnk", "util-line-height-six-3lFgd", "util-text-decoration-none-1n0lI", "Header-header-button-active-state-3AvBm", "Header-header-button-1EE8Y", "sExtlink-processed"],
{
id: "splus-settings-navbar-button",
title: "Schoology Plus Settings\n\nChange settings relating to Schoology Plus.",
onclick: () => {
openModal("settings-modal");
trackEvent("splus-settings", "open", "Navbar Button");
}
},
[
createSvgLogo("_3ESp2", "dlCBz", "_1I3mg", "fjQuT", "uQOmx")
]
),
createElement(
"button",
["_1SIMq", "_2kpZl", "_3OAXJ", "_13cCs", "_3_bfp", "_2M5aC", "_24avl", "_3v0y7", "_2s0LQ", "_3ghFm", "_3LeCL", "_31GLY", "_9GDcm", "_1D8fw", "util-height-six-3PHnk", "util-line-height-six-3lFgd", "util-text-decoration-none-1n0lI", "Header-header-button-active-state-3AvBm", "Header-header-button-1EE8Y", "sExtlink-processed", "splus-track-clicks"],
Expand Down Expand Up @@ -523,15 +508,33 @@ 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;
})()
]
)
]));

document.querySelector("#header > header > nav > ul:nth-child(2)").prepend(createElement("li", ["_24avl", "_3Rh90", "_349XD"], {}, [
createElement(
"button",
["_1SIMq", "_2kpZl", "_3OAXJ", "_13cCs", "_3_bfp", "_2M5aC", "_24avl", "_3v0y7", "_2s0LQ", "_3ghFm", "_3LeCL", "_31GLY", "_9GDcm", "_1D8fw", "util-height-six-3PHnk", "util-line-height-six-3lFgd", "util-text-decoration-none-1n0lI", "Header-header-button-active-state-3AvBm", "Header-header-button-1EE8Y", "sExtlink-processed"],
{
id: "splus-settings-navbar-button",
title: "Schoology Plus Settings\n\nChange settings relating to Schoology Plus.",
onclick: () => {
openModal("settings-modal");
trackEvent("splus-settings", "open", "Navbar Button");
}
},
[
createSvgLogo("_3ESp2", "dlCBz", "_1I3mg", "fjQuT", "uQOmx")
]
)
]));

for (let e of document.querySelectorAll(".close")) {
e.onclick = modalClose;
}
Expand Down Expand Up @@ -1059,17 +1062,23 @@ async function createQuickAccess() {
} else {
let courseOptionsButton;
let iconImage;
let courseIconsContainer;
for (let section of sectionsList) {
wrapper.appendChild(createElement("div", ["quick-access-course"], {}, [
(iconImage = createElement("div", ["splus-course-icon"], { dataset: { courseTitle: `${section.course_title}: ${section.section_title}` } })),
createElement("a", ["splus-track-clicks", "quick-course-link"], { textContent: `${section.course_title}: ${section.section_title}`, href: `/course/${section.id}`, dataset: { splusTrackingTarget: "quick-access-course-link", splusTrackingLabel: "Quick Access" } }),
createElement("div", ["icons-container"], {}, [
(courseIconsContainer = createElement("div", ["icons-container"], {}, [
createElement("a", ["icon", "icon-grades", "splus-track-clicks"], { href: `/course/${section.id}/student_grades`, title: "Grades", dataset: { splusTrackingTarget: "quick-access-grades-link", splusTrackingLabel: "Quick Access" } }),
createElement("a", ["icon", "icon-mastery", "splus-track-clicks"], { href: `/course/${section.id}/student_mastery`, title: "Mastery", dataset: { splusTrackingTarget: "quick-access-mastery-link", splusTrackingLabel: "Quick Access" } }),
(courseOptionsButton = createElement("a", ["icon", "icon-settings", "splus-track-clicks"], { href: "#", dataset: { splusTrackingTarget: "quick-access-settings-link", splusTrackingLabel: "Quick Access" } }))
])
]))
]));

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

iconImage.style.backgroundImage = `url(${chrome.runtime.getURL("imgs/fallback-course-icon.svg")})`;

courseOptionsButton.addEventListener("click", () => openModal("course-settings-modal", {
Expand Down
15 changes: 7 additions & 8 deletions js/analytics.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,12 @@ var trackEvent = function (target, action, label = undefined, value = undefined)

let trackedElements = new Set();
let observer = new MutationObserver((mutations, mutationObserver) => {
for (let m of mutations) {
for (let n of m.addedNodes) {
if (n.classList && n.classList.contains("splus-track-clicks") && !trackedElements.has(n)) {
Logger.debug("Added node", n);
n.addEventListener("click", trackClick);
n.addEventListener("auxclick", trackClick);
trackedElements.add(n);
}
for (let elem of document.querySelectorAll(".splus-track-clicks:not(.splus-tracked)")) {
if (!trackedElements.has(elem)) {
elem.addEventListener("click", trackClick);
elem.addEventListener("auxclick", trackClick);
elem.classList.add("splus-tracked");
trackedElements.add(elem);
}
}
});
Expand All @@ -90,6 +88,7 @@ var trackEvent = function (target, action, label = undefined, value = undefined)
if (!trackedElements.has(elem)) {
elem.addEventListener("click", trackClick);
elem.addEventListener("auxclick", trackClick);
elem.classList.add("splus-tracked");
trackedElements.add(elem);
}
}
Expand Down
17 changes: 17 additions & 0 deletions js/course.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ modals.push(new Modal("course-settings-modal", "Course Options", createElement("
]),
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("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" }),
Expand Down Expand Up @@ -83,6 +90,9 @@ function setCourseOptionsContent(modal, options) {
aliasInput.value = "";
}

let quickLinkInput = document.getElementById("setting-input-course-quicklink");
quickLinkInput.value = Setting.getNestedValue("courseQuickLinks", courseIdNumber, "");

let courseIconOverride = Setting.getValue("forceDefaultCourseIcons");
if (courseIconOverride) {
courseIconOverride = courseIconOverride[courseIdNumber];
Expand Down Expand Up @@ -150,6 +160,13 @@ function saveCourseSettings() {
}
currentAliasesValue[courseIdNumber] = newAliasValue;

let currentQuickLinkValue = Setting.getNestedValue("courseQuickLinks", courseIdNumber);
let newQuickLinkValue = document.getElementById("setting-input-course-quicklink").value;
if (newQuickLinkValue !== currentQuickLinkValue) {
trackEvent("courseQuickLinks", "set value", "Course Settings");
}
Setting.setNestedValue("courseQuickLinks", courseIdNumber, newQuickLinkValue);

let courseIconOverride = Setting.getValue("forceDefaultCourseIcons", {});
let iconOverrideSelect = document.getElementById("force-default-icon-splus-courseopt-select");
let overrideValue = iconOverrideSelect.options[iconOverrideSelect.selectedIndex].value;
Expand Down
Loading

0 comments on commit 5d70301

Please sign in to comment.