v3.0.3
diff --git a/README.md b/README.md
index 3ee4e9c..03664c3 100644
--- a/README.md
+++ b/README.md
@@ -7,7 +7,6 @@
<p align="center">
<img src="https://img.shields.io/github/release/jottocraft/dtps.svg" />
<img src="https://img.shields.io/website/https/powerplus.app.svg?label=server%20status" />
- <img src="https://img.shields.io/chrome-web-store/stars/pakgdifknldaiglefmpkkgfjndemfapo.svg" />
</p>
<p align="center">
diff --git a/scripts/assignments.js b/scripts/assignments.js
index b38b03f..75db87b 100644
--- a/scripts/assignments.js
+++ b/scripts/assignments.js
@@ -270,7 +270,7 @@
if (update.type == "announcement") {
updatesHTML += /*html*/`
<div onclick="$(this).toggleClass('open');" style="cursor: pointer; padding: 20px; --classColor: ${dtps.classes[update.class].color};" class="announcement card">
- <div class="className">${dtps.classes[update.class].subject}</div>
+ <div class="className">${update.title}</div>
${update.body}
</div>
`;
@@ -563,7 +563,7 @@
<br />
<div class="row">
- <div class="btn small outline" onclick="window.open('${assignment.url}')"><i class="material-icons">open_in_new</i> Open in ${dtpsLMS.shortName || dtpsLMS.name}</div>
+ ${assignment.url ? `<div class="btn small outline" onclick="window.open('${assignment.url}')"><i class="material-icons">open_in_new</i> Open in ${dtpsLMS.shortName || dtpsLMS.name}</div>` : ``}
</div>
</div>
@@ -821,7 +821,7 @@
<h4 style="font-weight: bold;">${dtps.classes[num].name}</h4>
<p style="color: var(--secText)">${dtps.classes[num].description || ""}</p>
- <div class="assignmentChip"><i class="material-icons">group</i><span>${dtps.classes[num].numStudents} students</span></div>
+ ${dtps.classes[num].numStudents ? `<div class="assignmentChip"><i class="material-icons">group</i><span>${dtps.classes[num].numStudents} students</span></div>` : ``}
${dtps.env == "dev" ? `<div class="assignmentChip"><i class="material-icons">code</i><span>Class ID: ${dtps.classes[num].id}</span></div>` : ``}
<br />
@@ -1047,7 +1047,7 @@
* @property {string} [body] HTML of the assignment's body
* @property {string} id Assignment ID
* @property {Date} [dueAt] Assignment due date
-* @property {string} url Assignment URL
+* @property {string} [url] Assignment URL
* @property {AssignmentFeedback[]} [feedback] Feedback / private comments for this assignment
* @property {User} [grader] Assignment grader
* @property {boolean} [turnedIn] True if the assignment is turned in
@@ -1101,13 +1101,13 @@
* @typedef {Object} RubricItem
* @description Defines rubric item objects in DTPS
* @property {string} title Title of the rubric item
-* @property {string} id Rubric item ID (does NOT have to be unique)
+* @property {string} id Rubric item ID (only needs to be unique to this assignment)
* @property {number} value Total amount of points possible
* @property {string} [outcome] The ID of the outcome this rubric item is assessing. This is only used for grade calculation.
* @property {string} [description] Rubric item description
* @property {number} [score] Rubric assessment score in points
* @property {string} [scoreName] Rubric assessment score name
-* @property {string} [scoreColor] Score color in CSS color format
+* @property {string} [color] Score color in a CSS color format
*/
/**
diff --git a/scripts/core.js b/scripts/core.js
index 4ed44fc..ca3049d 100644
--- a/scripts/core.js
+++ b/scripts/core.js
@@ -1,7 +1,7 @@
/**
* @file DTPS Core functions and module loader
* @author jottocraft
- * @version v3.0.2
+ * @version v3.0.3
*
* @copyright Copyright (c) 2018-2020 jottocraft. All rights reserved.
* @license GPL-2.0-only
@@ -34,8 +34,8 @@
* @property {DashboardItem[]} rightDashboard Items on the right side of the dashboard based on dtps.dashboardItems and user prefrences. Set in dtps.loadDashboardPrefs.
*/
var dtps = {
- ver: 302,
- readableVer: "v3.0.2",
+ ver: 303,
+ readableVer: "v3.0.3",
env: window.jottocraftSatEnv || "prod",
classes: [],
baseURL: String(document.currentScript.src).split('/')[0] + "//" + String(document.currentScript.src).split('/')[2],
@@ -53,7 +53,7 @@
name: "Updates",
id: "dtps.updates",
icon: "calendar_view_day",
- size: 80,
+ size: 170,
defaultSide: "left"
}, {
name: "Due Today",
@@ -193,20 +193,27 @@
${dtpsLMS.gradebook ? `Power+ includes a gradebook designed for ${dtpsLMS.name} to help you understand your grades.` : ``}</p>
</div>
- <div class="welcomeSection">
- <i class="material-icons">security</i>
- <h5>Privacy</h5>
- <p>Power+ does not collect any information. All of the data used in Power+ is fetched directly from ${dtpsLMS.shortName} and is never sent anywhere else.
- User preferences, grade history, and other Power+ data is stored locally on your computer and is not associated with your ${dtpsLMS.shortName} account.</p>
- </div>
-
- <div class="welcomeSection">
- <i class="material-icons">error_outline</i>
- <h5>Power+ is not official</h5>
- <p>Assignment information, grades, and other content displayed in Power+ are not official. Power+ is neither created nor endorsed by ${dtpsLMS.legalName}.
- Power+ may have bugs that could cause it to display inaccurate information. Use Power+ at your own risk.</p>
- </div>
-
+ ${dtpsLMS.isDemoLMS ? /*html*/`
+ <div class="welcomeSection">
+ <i class="material-icons">priority_high</i>
+ <h5>This is a demo</h5>
+ <p>Assignment information, grades, and other content displayed is not real and is for demonstration purposes only. This demo does not retrieve or collect any data.</p>
+ </div>
+ ` : /*html*/`
+ <div class="welcomeSection">
+ <i class="material-icons">security</i>
+ <h5>Privacy</h5>
+ <p>Power+ does not collect any information. All of the data used in Power+ is fetched directly from ${dtpsLMS.shortName} and is never sent anywhere else.
+ User preferences, grade history, and other Power+ data is stored locally on your computer and is not associated with your ${dtpsLMS.shortName} account.</p>
+ </div>
+ <div class="welcomeSection">
+ <i class="material-icons">priority_high</i>
+ <h5>Power+ is not official</h5>
+ <p>Assignment information, grades, and other content displayed in Power+ are not official. Power+ is neither created nor endorsed by ${dtpsLMS.legalName}.
+ Power+ may have bugs that could cause it to display inaccurate information. Use Power+ at your own risk.</p>
+ </div>
+ `}
+
<br />
<div onclick="window.localStorage.setItem('dtpsInstalled', 'true'); fluid.cards.close('.card.changelog');" class="btn">
<i class="material-icons">arrow_forward</i> Continue
@@ -339,6 +346,9 @@
fluidThemes = [["midnight", "tome"], ["rainbow"]];
fluidAutoLoad = false;
+ //Set env discovery
+ window.localStorage.setItem("jottocraftEnv", true);
+
//Default selected content
dtps.selectedContent = "stream";
@@ -490,8 +500,8 @@
return new Date(b.gradedAt || b.postedAt).getTime() - new Date(a.gradedAt || a.postedAt).getTime()
});
- //Keep only the 10 most recent updates
- if (dtps.updates.length > 10) dtps.updates.length = 10;
+ //Keep only the 15 most recent updates
+ if (dtps.updates.length > 15) dtps.updates.length = 15;
//Calculate class grade if supported
if (dtpsLMS.calculateGrade) {
@@ -565,8 +575,8 @@
return new Date(b.gradedAt || b.postedAt).getTime() - new Date(a.gradedAt || a.postedAt).getTime()
});
- //Keep only the 10 most recent updates
- if (dtps.updates.length > 10) dtps.updates.length = 10;
+ //Keep only the 15 most recent updates
+ if (dtps.updates.length > 15) dtps.updates.length = 15;
if (dtps.selectedClass == "dash") {
fluid.screen();
@@ -1446,7 +1456,7 @@
</div>
<div style="margin-top: 5px; display: inline-block; text-align: right; float: right;">
- <a href="/" class="itemButton"><i class="material-icons">exit_to_app</i> Go to ${dtpsLMS.shortName || dtpsLMS.name}</a>
+ <a href="/" class="itemButton"><i class="material-icons">exit_to_app</i> ${dtpsLMS.isDemoLMS ? "Exit demo" : "Go to " + (dtpsLMS.shortName || dtpsLMS.name)}</a>
${dtps.unstable ? `<div onclick="window.open('https://github.com/jottocraft/dtps/issues/new/choose')" class="itemButton"><i class="material-icons">feedback</i> Feedback</div>` : ""}
<div onclick="dtps.settings();" class="itemButton"><i class="material-icons">settings</i> Settings</div>
</div>
diff --git a/scripts/lms/demo.js b/scripts/lms/demo.js
new file mode 100644
index 0000000..6fa5254
--- /dev/null
+++ b/scripts/lms/demo.js
@@ -0,0 +1,297 @@
+/**
+ * @file DTPS Demo LMS
+ * @author jottocraft
+ *
+ * @copyright Copyright (c) 2018-2020 jottocraft. All rights reserved.
+ * @license GPL-2.0-only
+ *
+ * This LMS script is for demonstrating Power+ and doesn't fetch actual data
+ * JSDoc documentation for these LMS functions can be found near the end of core.js
+ */
+
+//DTPS LMS configuration
+var dtpsLMS = {
+ name: "Demo LMS",
+ shortName: "Demo",
+ description: "All content in this LMS is not real and is for demonstration purposes only",
+ url: "https://powerplus.app",
+ logo: "https://powerplus.app/logo.png",
+ source: "https://github.com/jottocraft/dtps/blob/master/scripts/lms/demo.js",
+ genericGradebook: true,
+ isDemoLMS: true
+};
+
+//Return sample user data
+dtpsLMS.fetchUser = function () {
+ return new Promise(function (resolve, reject) {
+ resolve({
+ name: "Demo User",
+ id: "1",
+ photoURL: "https://powerplus.app/logo.png"
+ });
+ })
+}
+
+//Fetch class data from Canvas
+dtpsLMS.fetchClasses = function () {
+ return new Promise(function (resolve, reject) {
+ resolve([{
+ name: "Demo Class",
+ id: "1",
+ subject: "Demo Class",
+ description: `<p>This class is for demonstration purposes only and is not a real class</p>`,
+ homepage: true,
+ numStudents: 1337,
+ modules: true,
+ discussions: true,
+ pages: true,
+ color: "#8800ff",
+ grade: 81,
+ letter: "B-",
+ previousLetter: "A",
+ image: "https://powerplus.app/wallpaper.png",
+ teacher: {
+ name: "Demo Teacher",
+ id: "2",
+ photoURL: "https://powerplus.app/logo.png"
+ }
+ }]);
+ })
+}
+
+//Fetches assignment data from Canvas
+dtpsLMS.fetchAssignments = function (classID) {
+ return new Promise(function (resolve, reject) {
+ if (classID == "1") {
+ resolve([
+ {
+ title: "Demo assignment 1",
+ id: "191",
+ body: "<p>This assignment is for demonstration purposes only</p>",
+ dueAt: new Date().getTime() + 3000000,
+ turnedIn: true,
+ locked: false,
+ category: "Demo assignments",
+ value: 12,
+ publishedAt: new Date().getTime() - 100000000,
+ rubric: [
+ {
+ title: "Demo outcome 1",
+ id: "1",
+ value: 4,
+ description: "This outcome is for demonstration purposes only"
+ },
+ {
+ title: "Demo outcome 2",
+ id: "2",
+ value: 4,
+ description: "This outcome is for demonstration purposes only"
+ },
+ {
+ title: "Demo outcome 3",
+ id: "3",
+ value: 4,
+ description: "This outcome is for demonstration purposes only"
+ }
+ ]
+ },
+ {
+ title: "Demo assignment 2",
+ id: "192",
+ body: "<p>This assignment is for demonstration purposes only</p>",
+ dueAt: new Date().getTime() - 100000000,
+ turnedIn: true,
+ locked: true,
+ gradedAt: new Date(),
+ grade: 8,
+ value: 8,
+ letter: "A",
+ category: "Demo assignments",
+ publishedAt: new Date().getTime() - 1000000000,
+ rubric: [
+ {
+ title: "Demo outcome 1",
+ id: "1",
+ value: 4,
+ description: "This outcome is for demonstration purposes only",
+ score: 4,
+ scoreName: "Beyond Innovation++",
+ color: "#4f9e59"
+ },
+ {
+ title: "Demo outcome 2",
+ id: "2",
+ value: 4,
+ description: "This outcome is for demonstration purposes only",
+ score: 4,
+ scoreName: "Beyond Innovation++",
+ color: "#4f9e59"
+ }
+ ]
+ },
+ {
+ title: "Demo assignment 3",
+ id: "193",
+ body: "<p>This assignment is for demonstration purposes only</p>",
+ dueAt: new Date().getTime() - 100000000,
+ turnedIn: true,
+ late: true,
+ locked: true,
+ grade: 5,
+ gradedAt: new Date(),
+ value: 8,
+ letter: "B",
+ category: "Demo assignments",
+ publishedAt: new Date().getTime() - 1000000000,
+ rubric: [
+ {
+ title: "Demo outcome 1",
+ id: "1",
+ value: 4,
+ description: "This outcome is for demonstration purposes only",
+ score: 2,
+ scoreName: "Developing",
+ color: "#c26d44"
+ },
+ {
+ title: "Demo outcome 2",
+ id: "2",
+ value: 4,
+ description: "This outcome is for demonstration purposes only",
+ score: 3,
+ scoreName: "Proficient",
+ color: "#a1b553"
+ }
+ ]
+ },
+ {
+ title: "Demo assignment 4",
+ id: "194",
+ body: "<p>This assignment is for demonstration purposes only</p>",
+ dueAt: new Date().getTime() + 10000000,
+ value: 4,
+ category: "Demo assignments",
+ publishedAt: new Date().getTime() - 1000000000,
+ rubric: [
+ {
+ title: "Demo outcome 1",
+ id: "1",
+ value: 4,
+ description: "This outcome is for demonstration purposes only"
+ }
+ ]
+ }
+ ])
+ }
+ })
+}
+
+//Fetches modules data from Canvas
+dtpsLMS.fetchModules = function (classID) {
+ return new Promise(function (resolve, reject) {
+ resolve([
+ {
+ title: "Demo module",
+ id: "1",
+ items: [
+ {
+ type: "url",
+ title: "google.com",
+ url: "https://www.google.com"
+ },
+ {
+ type: "assignment",
+ title: "Demo Assignment 1",
+ id: "191"
+ },
+ {
+ type: "assignment",
+ title: "Demo Assignment 2",
+ id: "192"
+ }
+ ]
+ }
+ ]);
+ });
+}
+
+//Fetches announcement data from Canvas
+dtpsLMS.fetchAnnouncements = function (classID) {
+ return new Promise(function (resolve, reject) {
+ resolve([{
+ title: "Demo Announcement",
+ postedAt: new Date().getDate(),
+ body: "<p>This announcement is for demonstration purposes only</p>"
+ }]);
+ });
+}
+
+//Fetches homepage data from Canvas
+dtpsLMS.fetchHomepage = function (classID) {
+ return new Promise(function (resolve, reject) {
+ resolve(`<p>This homepage is for demonstration purposes only</p>`);
+ });
+}
+
+//Fetches discussion thread data from Canvas
+dtpsLMS.fetchDiscussionThreads = function (classID) {
+ return new Promise(function (resolve, reject) {
+ resolve([
+ {
+ title: "Demo Discussion",
+ id: "1",
+ locked: true,
+ requireInitialPost: false
+ }
+ ])
+ })
+}
+
+//Fetches discussion thread posts from Canvas
+dtpsLMS.fetchDiscussionPosts = function (classID, threadID) {
+ return new Promise(function (resolve, reject) {
+ resolve([
+ {
+ id: "1",
+ body: `<p>This discussion is for demonstration purposes only</p>`,
+ postedAt: new Date(),
+ author: {
+ name: "Demo Teacher",
+ id: "2",
+ photoURL: "https://powerplus.app/logo.png"
+ }
+ }
+ ])
+ })
+}
+
+//Fetches pages list data from Canvas
+dtpsLMS.fetchPages = function (classID) {
+ return new Promise(function (resolve, reject) {
+ resolve([
+ {
+ title: "Demo Page",
+ id: "1",
+ updatedAt: new Date(),
+ author: {
+ name: "Demo Teacher",
+ id: "2",
+ photoURL: "https://powerplus.app/logo.png"
+ }
+ }
+ ])
+ })
+}
+
+//Fetches pages list data from Canvas
+dtpsLMS.fetchPageContent = function (classID, pageID) {
+ return new Promise(function (resolve, reject) {
+ resolve(`<p>This page is for demonstration purposes only</p>`);
+ })
+}
+
+//Get baseURL from the URL of this script
+var baseURL = document.currentScript.src.split('/')[0] + '//' + document.currentScript.src.split('/')[2];
+
+//Load Power+
+jQuery.getScript(baseURL + "/scripts/core.js");
\ No newline at end of file