Skip to content

Commit

Permalink
Merge pull request #265 from aopell/develop
Browse files Browse the repository at this point in the history
Version 7.3.1
  • Loading branch information
aopell authored Sep 13, 2021
2 parents 4698ec6 + 78dbf77 commit e32b4d5
Show file tree
Hide file tree
Showing 12 changed files with 172 additions and 74 deletions.
18 changes: 15 additions & 3 deletions css/modern/all.css
Original file line number Diff line number Diff line change
Expand Up @@ -1931,6 +1931,10 @@ variable-intellisense {
color: var(--text) !important;
}

[modern=true]:root .porcelain_pattern {
background: var(--accent) !important;
}

[modern=true]:root .fc-state-highlight {
background: var(--active) !important;
}
Expand Down Expand Up @@ -2141,9 +2145,8 @@ variable-intellisense {
color: var(--text) !important;
}

[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: block;
[modern=true][dark=true]:root #assessment-darktheme-warning-message[data-popup=true] {
display: block !important;
text-align: center;
width: 50%;
margin-left: 25%;
Expand All @@ -2154,6 +2157,15 @@ variable-intellisense {
border-radius: var(--border-radius);
}

[modern=true][dark=true]:root #assessment-darktheme-warning-message .click-to-hide {
padding-top: 10px !important;
}

[modern=true][dark=true]:root #assessment-darktheme-warning-message .click-to-hide span {
text-decoration: underline;
cursor: pointer;
}

[modern=true]:root .mathquill-formula {
filter: Invert(var(--theme-is-dark)) !important;
}
Expand Down
4 changes: 4 additions & 0 deletions css/modern/theme-editor.css
Original file line number Diff line number Diff line change
Expand Up @@ -200,3 +200,7 @@ variable-intellisense {
transition: .3s ease-out !important;
color: var(--modern-contrast-text) !important;
}

[modern=true]:root #create-preset-dropdown > li:hover {
background-color: var(--modern-active);
}
35 changes: 34 additions & 1 deletion js/all-idle.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(async function() {
(async function () {
// Wait for loader.js to finish running
while (!window.splusLoaded) {
await new Promise(resolve => setTimeout(resolve, 10));
Expand Down Expand Up @@ -356,6 +356,39 @@
}).observe(document.getElementById("body"), { attributes: true, attributeFilter: ["aria-hidden"] });
})();

(function () {
setTimeout(() => {
let assessmentStartContainer = document.querySelector(`.assessment-delivery-landing-app div._3dHTa`);

if (assessmentStartContainer) {
assessmentStartContainer.appendChild(
createElement(
"div",
[],
{
id: "assessment-darktheme-warning-message",
textContent: "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.",
dataset: { popup: Setting.getNestedValue("popup", "assessmentDarkThemeWarning", true) },
style: { display: "none" }
},
[
createElement("p", ["click-to-hide"], {}, [
createElement("span", [], { textContent: "Hide this once", onclick: () => document.getElementById("assessment-darktheme-warning-message").remove() }),
createElement("b", [], { textContent: " • " }),
createElement("span", [], {
textContent: "Never show again", onclick: () => {
Setting.setNestedValue("popup", "assessmentDarkThemeWarning", false);
document.getElementById("assessment-darktheme-warning-message").dataset.popup = "false";
}
}),
])
]
)
)
}
}, 1000);
})();

function parseSettingsHash() {
let hashes = location.hash.split('#');
if (hashes.length > 1 && hashes[1] === "splus-settings") {
Expand Down
120 changes: 75 additions & 45 deletions js/all.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ let modals = [
"contributors-modal",
"Schoology Plus Contributors",
createElement("div", ["splus-modal-contents"], undefined, [
createElement("h2", ["setting-entry"], { textContent: "Contributors" }),
createElement("h2", ["setting-entry"], { textContent: "Lead Developers" }),
createElement("div", ["setting-entry"], {}, [
createElement("h3", ["setting-title"], {}, [
createElement("a", [], { href: "https://github.com/aopell", textContent: "Aaron Opell (@aopell)" })
Expand All @@ -252,65 +252,92 @@ let modals = [
]),
createElement("p", ["setting-description"], { textContent: "Lead developer" })
]),
createElement("h2", ["setting-entry"], { textContent: "Code Contributions" }),
createElement("div", ["setting-entry"], {}, [
createElement("h3", ["setting-title"], {}, [
createElement("a", [], { href: "https://github.com/xd-arsenic", textContent: "Alexander (@xd-arsenic)" }),
createElement("span", [], { textContent: ", " }),
createElement("a", [], { href: "https://github.com/Roguim", textContent: "@Roguim" }),
createElement("span", [], { textContent: ", " }),
createElement("a", [], { href: "https://github.com/reteps", textContent: "Peter Stenger (@reteps)" }),
createElement("span", [], { textContent: ", " }),
createElement("a", [], { href: "https://github.com/EricPedley", textContent: "Eric Pedley (@EricPedley)" }),
createElement("span", [], { textContent: ", and " }),
createElement("a", [], { href: "https://github.com/KTibow", textContent: "@KTibow" }),
]),
createElement("p", ["setting-description"], { textContent: "Various code contributions" })
createElement("ul", ["contributor-list"], {
style: { listStyle: "inside" },
innerHTML: (function (contribs) {
let retVal = "";
for (let i = 0; i < contribs.length; i++) {
if (contribs[i].url) {
retVal += `<li><a href="${contribs[i].url}" title="${contribs[i].name}">${contribs[i].name}</a></li>`;
} else {
retVal += `<li><span>${contribs[i].name}</span></li>`
}
}
return retVal;
})([
{ name: "Alexander (@xd-arsenic)", url: "https://github.com/xd-arsenic" },
{ name: "@Roguim", url: "https://github.com/Roguim" },
{ name: "Peter Stenger (@reteps)", url: "https://github.com/reteps" },
{ name: "Eric Pedley (@EricPedley)", url: "https://github.com/EricPedley" },
{ name: "@KTibow", url: "https://github.com/KTibow" },
])
}),
]),
createElement("h2", ["setting-entry"], { textContent: "Testing, Bug Reporting, and/or Discord Moderation" }),
createElement("div", ["setting-entry"], {}, [
createElement("h3", ["setting-title"], {}, [
// contributors list
createElement("span", [], {
innerHTML: (function (contribs) {
let retVal = "";
for (let i = 0; i < contribs.length; i++) {
retVal += `<a href="https://www.flaticon.com/authors/${contribs[i].replace(" ", "-").toLowerCase()}" title="${contribs[i]}">${contribs[i]}</a>`;
if (i == contribs.length - 2) {
retVal += ", and ";
} else if (i != contribs.length - 1) {
retVal += ", ";
}
createElement("ul", ["contributor-list"], {
style: { listStyle: "inside" },
innerHTML: (function (contribs) {
let retVal = "";
for (let i = 0; i < contribs.length; i++) {
if (contribs[i].url) {
retVal += `<li><a href="${contribs[i].url}" title="${contribs[i].name}">${contribs[i].name}</a></li>`;
} else {
retVal += `<li><span>${contribs[i].name}</span></li>`
}
return retVal;
})(["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" })
]),
}
return retVal;
})([
{ name: "atomicproton#4444" },
{ name: "penguinee232#7792" },
{ name: "Cody Lomeli" },
{ name: "Airbus A330-200#0001" },
{ name: "Ark#9999" },
{ name: "ASAMU#1919" },
{ name: "Baconnated Churro#4954" },
{ name: "Blumiere#7442" },
{ name: "Krishy Fishy#3333" },
{ name: "meepypotato07#7816" },
{ name: "phool#0200" },
{ name: "RVxBot#7862" },
{ name: "TechFun#9234" },
])
}),
]),
createElement("h2", ["setting-entry"], { textContent: "Icons and Images" }),
createElement("div", ["setting-entry"], {}, [

createElement("ul", ["contributor-list"], {
style: { listStyle: "inside" },
innerHTML: (function (contribs) {
let retVal = "";
for (let i = 0; i < contribs.length; i++) {
retVal += `<li><a href="https://www.flaticon.com/authors/${contribs[i].replace(/[ _]/, "-").toLowerCase()}" title="${contribs[i]}">${contribs[i]}</a></li>`;
}
return retVal;
})(["DinosoftLabs", "Eucalyp", "Flat Icons", "Freepik", "Maxim Basinski", "Pixel Buddha", "Smashicons", "Twitter", "Vectors Market", "Vitaly Gorbachev", "srip", "surang", "Pixelmeetup", "photo3idea_studio"])
}),
]),
createElement("div", ["setting-entry"], {}, [
createElement("p", ["setting-description"], {}, [
createElement("span", [], { textContent: "Many custom course icons (under " }),
createElement("a", [], { href: "http://creativecommons.org/licenses/by/3.0/", title: "Creative Commons BY 3.0", target: "_blank", textContent: "CC BY 3.0" }),
createElement("span", [], { textContent: ")" }),
createElement("a", [], { href: "https://creativecommons.org/licenses/by/3.0/", title: "Creative Commons BY 3.0", target: "_blank", textContent: "CC BY 3.0" }),
createElement("span", [], { textContent: ") from " }),
createElement("a", [], { href: "https://www.flaticon.com/", title: "flaticon", target: "_blank", textContent: "flaticon.com" }),
createElement("p", [], { textContent: "Bundled:" }),
createElement("div", ["splus-indent-1"], {
innerHTML:
'<ul><li>Exclamation mark (grades page modified indicator): By <a href="https://www.flaticon.com/authors/pixel-buddha" title="Pixel Buddha">Pixel Buddha</a> from <a href="https://www.flaticon.com/" title="Flaticon">flaticon.com</a> under <a href="http://creativecommons.org/licenses/by/3.0/" title="Creative Commons BY 3.0" target="_blank">CC BY 3.0</a></li>'
'<ul style="list-style: inside;"><li>Exclamation mark (grades page modified indicator): By <a href="https://www.flaticon.com/authors/pixel-buddha" title="Pixel Buddha">Pixel Buddha</a> from <a href="https://www.flaticon.com/" title="Flaticon">flaticon.com</a> under <a href="http://creativecommons.org/licenses/by/3.0/" title="Creative Commons BY 3.0" target="_blank">CC BY 3.0</a></li>'
+ '<li>Bookshelf (default course icon): <i>Modified</i>. Original by <a href="https://www.flaticon.com/authors/freepik" title="Freepik">Freepik</a> from <a href="https://www.flaticon.com/" title="Flaticon">flaticon.com</a> under <a href="http://creativecommons.org/licenses/by/3.0/" title="Creative Commons BY 3.0" target="_blank">CC BY 3.0</a></li>'
+ '<li>Pencil (grade edit icon): From <a href="http://www.iconninja.com/edit-draw-pencile-write-icon-899685" title="IconNinja">iconninja.com</a></li>'
+ "</ul>"
})
]),

createElement("ul", ["setting-description"], {}, [
createElement("li", [], { textContent: "" })
])
]),
createElement("div", ["setting-entry"], {}, [
createElement("h3", ["setting-title"], {}, [
createElement("a", [], { href: "http://www.iconninja.com/edit-draw-pencile-write-icon-899685", textContent: "Pencil Icon from IconNinja" })
]),
createElement("p", ["setting-description"], { textContent: "Bundled as edit grade icon" }, [])
]),
createElement("div", ["setting-entry"], {}, [
createElement("h3", ["setting-title"], { textContent: "...and more" }),
createElement("h2", ["setting-title"], { textContent: "...and countless other people" }),
createElement("p", ["setting-description"], { textContent: "For various ideas and suggestions" })
]),
createElement("div", ["setting-entry"], {}, [
Expand Down Expand Up @@ -1193,6 +1220,9 @@ function indicateSubmittedAssignments() {
} else if (assignmentElement.href.includes("/event/")) {
// Calendar events
assignmentId = assignmentElement.href.match(/event\/(\d+)/)[1];
} else if (assignmentElement.href.includes("/external_tool/")) {
// External tools
assignmentId = assignmentElement.href.match(/external_tool\/(\d+)/)[1];
}

// add a CSS class for both states, so we can distinguish 'loading' from known-(in)complete
Expand Down
8 changes: 5 additions & 3 deletions js/analytics.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ var trackEvent = function (target, action, label = undefined, value = undefined)
}
}

chrome.storage.sync.get({ analytics: getBrowser() === "Firefox" ? "disabled" : "enabled", theme: "<unset>" }, s => {
chrome.storage.sync.get({ analytics: getBrowser() === "Firefox" ? "disabled" : "enabled", theme: "<unset>", beta: "<unset>", newVersion: "<unset>" }, s => {
if (s.analytics === "enabled") {
enableAnalytics(s.theme);
enableAnalytics(s.theme, s.beta, s.newVersion);
}
});

function enableAnalytics(selectedTheme) {
function enableAnalytics(selectedTheme, beta, newVersion) {
// isogram
let r = 'ga';
window['GoogleAnalyticsObject'] = r;
Expand All @@ -54,6 +54,8 @@ var trackEvent = function (target, action, label = undefined, value = undefined)
ga('set', 'dimension2', location.host);
ga('set', 'dimension3', selectedTheme);
ga('set', 'dimension4', document.documentElement.getAttribute("modern"));
ga('set', 'dimension5', beta);
ga('set', 'dimension6', newVersion);
ga('send', 'pageview', location.pathname.replace(/\/\d{3,}\b/g, "/*") + location.search);

trackEvent = function (target, action, label = undefined, value = undefined) {
Expand Down
2 changes: 1 addition & 1 deletion js/background-permissions.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ function updateItem({ tabId }) {
};
if (!chrome.runtime.lastError && origin) {
// Manifest permissions can't be removed; this disables the toggle on those domains
const isDefault = origin.endsWith("schoology.com");
const isDefault = origin.endsWith("schoology.com") || origin.endsWith("lms.lausd.net");
settings.enabled = !isDefault;

// We might have temporary permission as part of `activeTab`, so it needs to be properly checked
Expand Down
2 changes: 1 addition & 1 deletion js/grades.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ var fetchQueue = [];

// if there's no PERIOD \d string in the course name, match will return null; in that case, use the array [null, i++]
// OR is lazy, so the ++ won't trigger unnecessarily; upperPeriodSortBound is our array key, and we use it to give a unique index (after all course) to periodless courses
coursesByPeriod[Number.parseInt((title.textContent.match(/[Pp][Ee][Rr][Ii]?[Oo]?[Dd]?\s*(\d+)/) || [null, upperPeriodSortBound++])[1])] = course;
coursesByPeriod[Number.parseInt((title.textContent.match(/\b[Pp][Ee]?[Rr]?[Ii]?[Oo]?[Dd]?\s*(\d+)/) || [null, upperPeriodSortBound++])[1])] = course;

// Fix width of assignment columns
table.appendChild(createElement("colgroup", [], {}, [
Expand Down
6 changes: 3 additions & 3 deletions js/preload.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(async function() {
(async function () {
// Wait for loader.js to finish running
while (!window.splusLoaded) {
await new Promise(resolve => setTimeout(resolve, 10));
Expand All @@ -23,10 +23,10 @@ var defaultCourseIconUrlRegex = /\/sites\/[a-zA-Z0-9_-]+\/themes\/[%a-zA-Z0-9_-]
// Functions

/** @type {HTMLDivElement} */
var modalContents;
var modalContents = undefined;

function getModalContents() {
return modalContents;
return modalContents || createElement("p", [], { textContent: "Error loading settings" });
}

function backgroundPageFetch(url, init, bodyReadType) {
Expand Down
8 changes: 7 additions & 1 deletion js/theme-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -945,6 +945,12 @@ function saveTheme(apply = false) {
let themes = s.themes.filter(x => x.name != (origThemeName || t.name));
themes.push(t);
chrome.storage.sync.set({ themes: themes }, () => {
if (chrome.runtime.lastError) {
if (chrome.runtime.lastError.message.includes("QUOTA_BYTES_PER_ITEM")) {
alert("No space remaining to save theme. Please delete another theme or make this theme smaller in order to save.");
throw new Error("No space remaining to save theme. Please delete another theme or make this theme smaller in order to save.");
}
}
ConfirmModal.open("Theme saved successfully", "", ["OK"], () => {
origThemeName = t.name;
if (apply) chrome.storage.sync.set({ theme: t.name }, () => location.href = `https://${defaultDomain}`);
Expand Down Expand Up @@ -1082,7 +1088,7 @@ function editTheme(name, replaceName = undefined) {
previewSection.classList.add("show-editor-controls");
output.removeAttribute("readonly");
Array.from(iconList.querySelectorAll(".class-name, .icon-url")).map(x => x.setAttribute("contenteditable", "true"));
origThemeName = name;
origThemeName = replaceName || name;
document.querySelector("#json-output + label").textContent = "JSON (Paste to import a theme)";
}

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.3",
"version": "7.3.1",
"icons": {
"128": "imgs/[email protected]",
"64": "imgs/[email protected]",
Expand Down
Loading

0 comments on commit e32b4d5

Please sign in to comment.