Skip to content

Commit

Permalink
Merge pull request #223 from aopell/develop
Browse files Browse the repository at this point in the history
Version 6.6.4
  • Loading branch information
aopell authored Oct 20, 2020
2 parents f92515f + ac55825 commit 0fcee22
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 22 deletions.
12 changes: 2 additions & 10 deletions css/modern.css
Original file line number Diff line number Diff line change
Expand Up @@ -1923,9 +1923,9 @@ img#loader {
background-color: var(--primary) !important;
}

.dialogs {
/* .dialogs {
background-color: var(--primary) !important;
}
} */

.lrn.lrn-assess .lrn-right-region .right-wrapper .lrn_btn, .lrn.lrn-assess .lrn-right-region .right-wrapper .lrn_widget.lrn_feature>button, .lrn.lrn-assess .lrn-right-region .right-wrapper .lrn_btn.lrn_btn_blue {
background-color: var(--accent) !important;
Expand Down Expand Up @@ -1987,14 +1987,6 @@ img#loader {
box-shadow: inset 1px 1px 2px black;
}

.lrn-assess .timer {
background: var(--text) !important;
}

.lrn-timer-wrapper.pos-right {
background: var(--text) !important;
}

.lrn .modal-content {
background-color: var(--accent) !important;
/* Timeout Alert */
Expand Down
2 changes: 1 addition & 1 deletion js/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ function createLogPrefix(color) {
}

if (getBrowser() !== "Firefox") {

// See https://bugs.chromium.org/p/chromium/issues/detail?id=966223#c3
chrome.webRequest.onHeadersReceived.addListener(details => {
let exists = false;
details.responseHeaders.map(item => {
Expand Down
14 changes: 10 additions & 4 deletions js/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ if (Setting.getValue("broadcasts") !== "disabled") {
(function () {
let upcomingList = document.querySelector(".upcoming-events .upcoming-list");
// Indicate submitted assignments in Upcoming
function indicateSubmitted() {
async function indicateSubmitted() {
Logger.log("Checking to see if upcoming assignments are submitted");
upcomingList = document.querySelector(".upcoming-events .upcoming-list");
switch (Setting.getValue("indicateSubmission")) {
Expand All @@ -127,14 +127,20 @@ if (Setting.getValue("broadcasts") !== "disabled") {
for (let eventElement of upcomingEventElements) {
let assignmentElement = eventElement.querySelector(".infotip a[href]");
let assignmentId = assignmentElement.href.match(/\/\d+/);
fetchApiJson(`/dropbox${assignmentId}/${getUserId()}`).then(j => {
if (j.revision && j.revision.length) {
try {
let revisionData = await fetchApiJson(`dropbox${assignmentId}/${getUserId()}`);
let revisions = revisionData.revision;

if (revisions && revisions.length) {
Logger.log(`Marking submitted assignment ${assignmentId} as complete ✔`);
eventElement.classList.add("splus-assignment-complete");
} else {
Logger.log(`Assignment ${assignmentId} is not submitted`);
}
});
}
catch (err) {
Logger.error(`Failed checking assignment ${assignmentId}: `, err);
}
}
}

Expand Down
4 changes: 4 additions & 0 deletions js/preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ function getModalContents() {
function backgroundPageFetch(url, init, bodyReadType) {
return new Promise((resolve, reject) => {
chrome.runtime.sendMessage({ type: "fetch", url: url, params: init, bodyReadType: bodyReadType }, function (response) {
if (response === undefined || response === null) {
Logger.error("[backgroundPageFetch] Response is undefined or null", response, chrome.runtime.lastError);
reject("Response is undefined or null. Last error: " + chrome.runtime.lastError);
}
if (!response.success) {
reject(response.error);
return;
Expand Down
56 changes: 50 additions & 6 deletions js/version-specific.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,12 @@ function createToastButton(text, id, onClick, transition = "fadeOutRight") {
function saveBroadcasts(broadcasts, callback = undefined) {
chrome.storage.sync.get(["unreadBroadcasts"], values => {
let b = values.unreadBroadcasts || [];
b.push(...broadcasts);
let ids = b.map(x => x.id);
for(let br of broadcasts) {
if (!ids.includes(br.id)) {
b.push(br);
}
}
chrome.storage.sync.set({ unreadBroadcasts: b }, callback);
});
}
Expand All @@ -113,9 +118,16 @@ function createBroadcast(id, title, message, timestamp = Date.now()) {
* @param {...number} ids Broadcasts to delete
*/
function deleteBroadcasts(...ids) {
chrome.storage.sync.get(["unreadBroadcasts"], v => {
chrome.storage.sync.set({ unreadBroadcasts: v.unreadBroadcasts.filter(x => !ids.includes(x.id)) });
});
for (let id of ids) {
let unreadBroadcasts = Setting.getValue("unreadBroadcasts");
unreadBroadcasts.splice(unreadBroadcasts.findIndex(x => x.id == id), 1);
Setting.setValue("unreadBroadcasts", unreadBroadcasts);

let broadcastElement = document.getElementById(`broadcast${id}`);
if (broadcastElement) {
broadcastElement.outerHTML = "";
}
}
}

/*
Expand Down Expand Up @@ -227,21 +239,53 @@ let migrationsTo = {
new Date(2020, 9 /* October */, 19)
)
]);
},
"6.6.4": function (currentVersion, previousVersion) {
if (currentVersion === "6.6.4") {
saveBroadcasts([
createBroadcast(
660,
"Checkmarks for submitted assignments!",
`
<div>
<strong style="background: rgba(0,255,0,50%) !important;">Schoology Plus now shows checkmarks for submitted assingments in the Upcoming box!</strong>
<p>By default, green check marks <span style="color: green !important;">✔</span> are shown on all
assignments you've submitted. There are also options for putting a <span style="text-decoration: line-through;">strikethrough</span>
through the assignment title or hiding the assignments completely. Of course you can also turn this feature off in settings.</p>
<p><a href="#splus-settings#setting-input-indicateSubmission" style="font-weight: bold; font-size: 14px;">Click here to change this setting</a></p>
</div>
<img style="padding-top: 10px;" src="https://i.imgur.com/mrE2Iec.png"/>
`,
new Date(2020, 9 /* October */, 19)
),
createBroadcast(
664,
"Checkmarks work now!",
`There was a major bug causing check marks not to appear in the last release (also sometimes causing Quick Access to disappear).
The bug has been fixed and both features should work again. Sorry about that!`,
new Date(2020, 9 /* October */, 20)
)
]);

deleteBroadcasts(660);
}
}
};

function versionSpecificFirstLaunch(currentVersion, previousVersion) {
Logger.log("[Updater] First launch after update, updating to ", currentVersion, " from ", previousVersion);

if(!previousVersion) {
if (!previousVersion) {
trackEvent("Install", currentVersion, "Versions");
} else {
trackEvent("Update", `${previousVersion} to ${currentVersion}`, "Versions");
}

// TODO add special handling if any migrations return a Promise such that we run in order
for (let migrateTo in migrationsTo) {
if (!previousVersion) {
if (!previousVersion) {
migrationsTo[migrateTo](currentVersion, previousVersion);
} else if (compareVersions(migrateTo, currentVersion) <= 0 && compareVersions(migrateTo, previousVersion) > 0) {
migrationsTo[migrateTo](currentVersion, previousVersion);
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"id": "[email protected]"
}
},
"version": "6.6.2",
"version": "6.6.4",
"icons": {
"128": "imgs/[email protected]",
"64": "imgs/[email protected]",
Expand Down

0 comments on commit 0fcee22

Please sign in to comment.