updates
diff --git a/chrome/communicator.js b/chrome/communicator.js
index 4d6ed43..b66e84e 100644
--- a/chrome/communicator.js
+++ b/chrome/communicator.js
@@ -17,6 +17,7 @@
subtree: true
})
} else if (window.location.pathname == "/power+") {
+ const useClassicDTPS = window.location.search && window.location.search.includes("classicEdition=true");
const observer = new MutationObserver(mutations => {
mutations.forEach(({ addedNodes }) => {
addedNodes.forEach(node => {
@@ -24,7 +25,7 @@
if (node.nodeType === 1 && node.tagName === 'BODY') {
node.innerHTML = /*html*/`
<div dtps="true" id="dtpsNativeOverlay" style="background-color: #151515; position: fixed; top: 0px; left: 0px; width: 100%; height: 100vh; z-index: 99;text-align: center;z-index: 999;transition: opacity 0.2s;">
- <img dtps="true" style="height: 100px; margin-top: 132px;" src="https://i.imgur.com/7dDUVh2.png" />
+ <img dtps="true" style="height: 100px; margin-top: 132px;" src="${useClassicDTPS ? "https://i.imgur.com/fqqPF9i.png" : "https://i.imgur.com/7dDUVh2.png"}" />
<br dtps="true" />
<div dtps="true" class="progress"><div id="dtpsLoadingScreenBar" dtps="true" class="indeterminate"></div></div>
<p id="dtpsLoadingScreenStatus" dtps="true">
@@ -42,6 +43,8 @@
<meta dtps="true" name="description" content="A better UI for Canvas LMS">
<meta dtps="true" name="author" content="jottocraft">
`;
+ } else if (node.nodeType === 1 && node.tagName === 'SCRIPT' && (node.textContent && node.textContent.includes('"current_user"'))) {
+ //Do nothing for node containing enviornment data for faster load times
} else if (node.nodeType === 1 && node.getAttribute("dtps") != "true") {
//Node is not added by dtps
node.remove();
@@ -58,7 +61,9 @@
//Get Power+ base URL
var baseURL = "https://powerplus.app";
- if (window.localStorage.debuggingConfig && (window.localStorage.dtpsLoaderPref == "debugging")) {
+ if (useClassicDTPS) {
+ baseURL = "https://classic.dtps.jottocraft.com";
+ } else if (window.localStorage.debuggingConfig && (window.localStorage.dtpsLoaderPref == "debugging")) {
if (window.localStorage.debuggingConfig == "true") {
baseURL = "http://localhost:2750";
} else if (window.localStorage.debuggingConfig) {
@@ -105,7 +110,7 @@
//Add script to DOM
var s = document.createElement("script");
- s.src = baseURL + "/scripts/lms/" + lmsScript + ".js";
+ s.src = useClassicDTPS ? "https://classic.dtps.jottocraft.com/init.js" : baseURL + "/scripts/lms/" + lmsScript + ".js";
s.async = false;
s.setAttribute("dtps", "true");
document.documentElement.appendChild(s);
diff --git a/chrome/manifest.json b/chrome/manifest.json
index 63de246..95a64f8 100644
--- a/chrome/manifest.json
+++ b/chrome/manifest.json
@@ -3,7 +3,7 @@
"name": "Power+",
"description": "A better UI for Canvas LMS",
- "version": "3.0.2",
+ "version": "3.0.3",
"background": {
"scripts": ["background.js"]
},
diff --git a/dtps.css b/dtps.css
index 97fb6cd..cfd2ca4 100644
--- a/dtps.css
+++ b/dtps.css
@@ -613,7 +613,8 @@
}
.hidegrades .sidebar .item .grade {
- display: none !important;
+ visibility: hidden !important;
+ width: 0px;
}
.class .icon {
diff --git a/scripts/assignments.js b/scripts/assignments.js
index 8cb81ef..15badda 100644
--- a/scripts/assignments.js
+++ b/scripts/assignments.js
@@ -128,14 +128,14 @@
//Render HTML with loading placeholder
if (dtps.selectedClass == "dash") {
jQuery(".classContent").html(/*html*/`
- <div style="--size: 500px;" class="samesize grid">
- <div class="dash item">
+ <div style="letter-spacing: 0px;">
+ <div style="float: left; width: 45%; display: inline-block;" class="dash">
${dtps.leftDashboard.map(dashboardItem => {
return dashboardContainerHTML(dashboardItem);
}).join("")}
</div>
- <div class="dash item">
+ <div style="float: left; width: 55%; display: inline-block;" class="dash">
${!doneLoading ? `<div style="margin: 75px 25px 10px 75px;"><div class="spinner"></div></div>` : ""}
${dtps.rightDashboard.map(dashboardItem => {
return dashboardContainerHTML(dashboardItem);
@@ -385,7 +385,19 @@
if (!assignments) {
//Assignments are still loading
if ((dtps.selectedClass == classNum) && (dtps.selectedContent == "stream")) {
- jQuery(".classContent").html(`<div class="spinner"></div>`);
+ jQuery(".classContent").html(/*html*/`
+ <div class="card assignment graded">
+ <h4>
+ <span style="width: 450px;" class="shimmer">Assignment Title</span>
+ <div class="points shimmer">0/0</div>
+ </h4>
+
+ <h5 style="white-space: nowrap; overflow: hidden;">
+ <div style="width: 200px;" class="infoChip shimmer"></div>
+ <i class="material-icons statusIcon shimmer">more_horiz</i>
+ </h5>
+ </div>
+ `);
}
} else if (assignments.length == 0) {
if (searchText) {
diff --git a/scripts/core.js b/scripts/core.js
index 812d79f..3172913 100644
--- a/scripts/core.js
+++ b/scripts/core.js
@@ -593,7 +593,7 @@
if (dtps.remoteConfig.showGradesInSettings) dtps.renderGradesInSettings();
//Re-render screen if the dashboard or stream is selected
- if ((dtps.selectedClass == "dash") || (dtps.selectedContent == "stream")) {
+ if ((dtps.selectedClass == "dash") || ((dtps.selectedContent == "stream") && (dtps.selectedClass == course.num))) {
fluid.screen();
}
});
@@ -742,7 +742,7 @@
var letterGradeHTML = "";
if (dtps.classes[i].letter) letterGradeHTML = dtps.classes[i].letter;
if (dtps.classes[i].letter == null) letterGradeHTML = "--";
- if (dtps.classes[i].letter == "...") letterGradeHTML = `<div class="spinner" style="background-color: var(--norm); margin: -8px -10px;"></div>`; //Show loading indicator for ...
+ if (dtps.classes[i].letter == "...") letterGradeHTML = `<div class="shimmer" style="width: 100%;height: 22px;border-radius: 8px;"></div>`; //Show loading indicator for ...
//Add class HTML to array
dtps.classlist.push(/*html*/`
@@ -773,15 +773,7 @@
<div class="divider"></div>
- <div id="2020s1" class="group">
- <div class="name item">
- <i class="material-icons"></i> <span class="label">Semester 1</span>
- </div>
-
- <div class="items">
- ${dtps.classlist.join("")}
- </div>
- </div>
+ ${dtps.classlist.join("")}
</div>
<div class="collapse">
@@ -1237,6 +1229,24 @@
}
/**
+ * Redirects to DTPS classic edition
+ */
+dtps.classicEntry = function () {
+ var classicName = ["P", "r", "o", "j", "e", "c", "t", " ", "D", "T", "P", "S"];
+ var overwrittenHTML = ["P", "o", "w", "e", "r", "+"];
+ if (dtps.classicStep == undefined) dtps.classicStep = -10;
+ dtps.classicStep++;
+
+ if (dtps.classicStep == 12) window.location.href = "/power+?classicEdition=true";
+
+ for (var i = 0; i < dtps.classicStep; i++) {
+ overwrittenHTML[i] = classicName[i];
+ }
+
+ $("#dtpsAboutName").html(overwrittenHTML.join(""));
+}
+
+/**
* Loads dashboard prefrences
*/
dtps.loadDashboardPrefs = function () {
@@ -1672,7 +1682,7 @@
<img src="${dtps.baseURL + "/icon.svg"}" style="height: 50px; margin-right: 10px; vertical-align: middle; margin-top: 20px;" />
<div style="display: inline-block; vertical-align: middle;">
- <h4 style="font-weight: bold; font-size: 32px; margin-bottom: 0px;">Power+</h4>
+ <h4 id="dtpsAboutName" onclick="dtps.classicEntry()" style="font-weight: bold; font-size: 32px; margin-bottom: 0px; user-select: none;">Power+</h4>
<div style="font-size: 16px; margin-top: 5px;">
${dtps.readableVer}
<div style="display: inline-block;margin: 0px 5px;font-size: 12px;">${baseHost !== "powerplus.app" ? `(from ${baseHost})` : ""}</div>
diff --git a/scripts/lms/canvas.js b/scripts/lms/canvas.js
index 1ab60ed..af90703 100644
--- a/scripts/lms/canvas.js
+++ b/scripts/lms/canvas.js
@@ -31,38 +31,28 @@
dtpsLMS.fetchUser = function () {
return new Promise(function (resolve, reject) {
jQuery.ajax({
- url: "/api/v1/users/self",
+ url: "/api/v1/users/self/observees?include[]=avatar_url",
type: "GET",
headers: dtpsLMS.commonHeaders,
- success: function (userData) {
- jQuery.ajax({
- url: "/api/v1/users/self/observees?include[]=avatar_url",
- type: "GET",
- headers: dtpsLMS.commonHeaders,
- success: function (childrenData) {
- var user = {
- name: userData.name,
- id: userData.id,
- photoURL: userData.avatar_url
- };
+ success: function (childrenData) {
+ var user = {
+ name: window.ENV.current_user.display_name,
+ id: window.ENV.current_user.id,
+ photoURL: ENV.current_user.avatar_image_url
+ };
- if (childrenData && childrenData.length) {
- //Parent account
- user.children = childrenData.map(child => {
- return {
- name: child.name,
- id: child.id,
- photoURL: child.avatar_url
- }
- });
+ if (childrenData && childrenData.length) {
+ //Parent account
+ user.children = childrenData.map(child => {
+ return {
+ name: child.name,
+ id: child.id,
+ photoURL: child.avatar_url
}
+ });
+ }
- resolve(user);
- },
- error: function (err) {
- reject(err);
- }
- });
+ resolve(user);
},
error: function (err) {
reject(err);