Skip to content

Commit

Permalink
Merge pull request #256 from aopell/develop
Browse files Browse the repository at this point in the history
Version 7.2.1
  • Loading branch information
aopell authored Mar 14, 2021
2 parents cceac1c + c8f1bd0 commit 25fe2f3
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 21 deletions.
4 changes: 4 additions & 0 deletions css/modern/all.css
Original file line number Diff line number Diff line change
Expand Up @@ -874,6 +874,10 @@ variable-intellisense {
color: var(--grades) !important;
}

[modern=true]:root .gradebook-course.hierarchical-grading-report .item-row .title-column .title {
color: var(--text) !important;
}

[modern=true]:root .grade-active-color,
[modern=true]:root .awarded-grade span {
color: var(--grades) !important;
Expand Down
7 changes: 5 additions & 2 deletions js/all.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
while (!window.splusPreload) { }
while (!window.splusLoaded && !window.splusLoaded.has("preload")) { }

// Inform user about theme
{
Expand Down Expand Up @@ -1256,4 +1256,7 @@ function indicateSubmittedAssignments() {
}

setTimeout(indicateSubmitted, 1000);
}
}

window.splusLoaded.add("all");
Logger.debug("Finished loading all.js");
2 changes: 2 additions & 0 deletions js/course.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
while (!window.splusLoaded && !window.splusLoaded.has("all")) { }

let courseIdNumber;
let courseSettingsCourseName;
(function () {
Expand Down
2 changes: 2 additions & 0 deletions js/courses.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
while (!window.splusLoaded && !window.splusLoaded.has("all")) { }

for (let course of document.querySelectorAll("li.course-item.list-item")) {
let parent = course.parentNode;
let wrapper = document.createElement("div");
Expand Down
32 changes: 16 additions & 16 deletions js/grades.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
while (!window.splusPreload) { }
while (!window.splusLoaded && !window.splusLoaded.has("preload")) { }

const timeout = ms => new Promise(res => setTimeout(res, ms));
const BUG_REPORT_FORM_LINK = "https://docs.google.com/forms/d/e/1FAIpQLScF1_MZofOWT9pkWp3EfKSvzCPpyevYtqbAucp1K5WKGlckiA/viewform?entry.118199430=";
Expand Down Expand Up @@ -669,7 +669,7 @@ var fetchQueue = [];
let total = 0;
let totalPercentWeight = 0;
let catWeight = 0; // 0 to 1
for (let category of perRow.parentElement.getElementsByClassName("category-row")) {
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;
Expand Down Expand Up @@ -1086,7 +1086,7 @@ var fetchQueue = [];
throw { listSearchErr: err, firstTryError: firstTryError };
}
};
fetchQueue.push(f);
fetchQueue.push([f, 0]);
}

// td-content-wrapper
Expand Down Expand Up @@ -1234,7 +1234,7 @@ var fetchQueue = [];
} else {
let total = 0;
let totalPercentWeight = 0;
for (let category of perRow.parentElement.getElementsByClassName("category-row")) {
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;
Expand Down Expand Up @@ -1560,26 +1560,26 @@ function createAddAssignmentElement(category) {
return addAssignmentThing;
}

function processNonenteredAssignments(sleep, attempts = 0) {
if (attempts > 3) {
// Remove the first element
fetchQueue.shift();
attempts = 0;
Logger.warn("Maximum attempts reached; aborting");
}
function processNonenteredAssignments() {
if (fetchQueue.length > 0) {
let [func, attempts] = fetchQueue.shift()
sleep = attempts > 0
setTimeout(() => {
fetchQueue[0]().then(x => {
fetchQueue.splice(0, 1);
func().then(x => {
processNonenteredAssignments();
}).catch(err => {
Logger.warn("Caught error: ", err);
Logger.log("Waiting 3 seconds to avoid rate limit");
if ("status" in err && err.status === 403) {
if (err && err.firstTryError && err.firstTryError.status === 403) {
attempts = 100;
}
processNonenteredAssignments(true, attempts + 1);
if (attempts > 3) {
Logger.warn("Maximum attempts reached; aborting");
} else {
fetchQueue.push([func, attempts + 1])
}
processNonenteredAssignments();
});
}, sleep ? 3000 : 0);
}
}
}
2 changes: 2 additions & 0 deletions js/home.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
while (!window.splusLoaded && !window.splusLoaded.has("all")) { }

/** @typedef {{id:number,title:string,message:string,timestamp?:Date,icon?:string}} Broadcast */

let homeFeedContainer = document.getElementById("home-feed-container");
Expand Down
3 changes: 2 additions & 1 deletion js/preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -1151,4 +1151,5 @@ new Setting(
element => element.value
);

window.splusPreload = true;
window.splusLoaded = new Set(["preload"]);
Logger.debug("Finished loading preload.js");
7 changes: 7 additions & 0 deletions js/version-specific.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,13 @@ let migrationsTo = {
new Date(2021, 0 /* January */, 16)
)
]);

var modalExistsInterval = setInterval(function () {
if (document.readyState === "complete" && openModal && document.getElementById("choose-theme-modal") && !document.querySelector(".splus-modal-open")) {
clearInterval(modalExistsInterval);
openModal("choose-theme-modal");
}
}, 50);
},
"7.2": function (currentVersion, previousVersion) {
saveBroadcasts([
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 @@
"id": "[email protected]"
}
},
"version": "7.2",
"version": "7.2.1",
"icons": {
"128": "imgs/[email protected]",
"64": "imgs/[email protected]",
Expand Down
5 changes: 4 additions & 1 deletion scss/modern/all.scss
Original file line number Diff line number Diff line change
Expand Up @@ -926,12 +926,15 @@ variable-intellisense {
// Grades Page

.gradebook-course.hierarchical-grading-report {

.period-row .grade-column,
.category-row .grade-column,
.item-row .grade-column {
color: var(--grades) !important;
}

.item-row .title-column .title {
color: var(--text) !important;
}
}

.grade-active-color,
Expand Down

0 comments on commit 25fe2f3

Please sign in to comment.