Skip to content

Commit

Permalink
Merge pull request #149 from aopell/patch-past-courses-restored
Browse files Browse the repository at this point in the history
Version 5.2.1: Restore Past Courses to Schoology Plus
  • Loading branch information
glen3b authored Mar 20, 2019
2 parents caa92bc + 525f5c3 commit 0249f11
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 1 deletion.
20 changes: 20 additions & 0 deletions js/all.js
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,26 @@ let siteNavigationTileHelpers = {

Logger.log("Processing courses dropdown mutation");

if (Setting.getValue("archivedCoursesButton") === "show") {
// aims to select the original "My Courses" link in the dropdown
let candidateLink = coursesDropdownContainer.querySelector(".CjR09._8a6xl._1tpub > a[href=\"/courses\"]._3ghFm");
if (candidateLink) {
// the obfuscated class name is the one Schoology uses to float these links right
let newContainer = createElement("div", ["courses-mycourses-droppeddown-link-container", "splus-addedtodynamicdropdown", "_3ghFm"], {}, [
createElement("a", ["floating-contained-link", "splus-addedtodynamicdropdown"], {
href: "/courses",
textContent: "My Courses"
}),
createElement("a", ["floating-contained-link", "splus-addedtodynamicdropdown"], {
href: "/courses/mycourses/past",
textContent: "Past Courses"
})
]);

candidateLink.replaceWith(newContainer);
}
}

// rearrange spacing in the courses dropdown
// Schoology has 4 tiles per row by default, we want 6
const targetRowWidth = 6;
Expand Down
22 changes: 22 additions & 0 deletions js/preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,28 @@ function updateSettings(callback) {
undefined,
element => element.value
).control,
new Setting(
"archivedCoursesButton",
"Archived Courses Button",
'Adds a link to see past/archived courses in the courses dropdown',
"show",
"select",
{
options: [
{
text: "Show",
value: "show"
},
{
text: "Hide",
value: "hide"
}
]
},
value => value,
undefined,
element => element.value
).control,
new Setting(
"sessionCookiePersist",
"Stay Logged In",
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"update_url": "https://aopell.me/SchoologyPlus/update.json"
}
},
"version": "5.2",
"version": "5.2.1",
"icons": {
"128": "imgs/[email protected]",
"64": "imgs/[email protected]",
Expand Down

0 comments on commit 0249f11

Please sign in to comment.