v3.0.5
diff --git a/scripts/assignments.js b/scripts/assignments.js
index 1c390a9..a8a1141 100644
--- a/scripts/assignments.js
+++ b/scripts/assignments.js
@@ -658,18 +658,10 @@
                 var action = "";
                 if (item.type == "assignment") action = "dtps.assignment('" + item.id + "', " + classNum + ")";
                 if (item.type == "page") {
-                    if (dtps.classes[classNum].pages) {
-                        action = "fluid.screen('pages', '" + classID + "|" + item.id + "')";
-                    } else {
-                        action = "window.open('" + item.url + "')";
-                    }                 
+                    action = "fluid.screen('pages', '" + classID + "|" + item.id + "|true')";                 
                 }  
                 if (item.type == "discussion") {
-                    if (dtps.classes[classNum].discussions) {
-                        action = "fluid.screen('discussions', '" + classID + "|" + item.id + "')";
-                    } else {
-                        action = "window.open('" + item.url + "')";
-                    }
+                    action = "fluid.screen('discussions', '" + classID + "|" + item.id + "|true')";
                 }
                 if (item.type == "url") action = "window.open('" + item.url + "')";
                 if (item.type == "header") action = "";
@@ -681,7 +673,7 @@
                 } else {
                     moduleItemHTML += `
                         <div class="moduleItem" onclick="${action}" style="margin-left: ${item.indent * 15}px;">
-                            <i class="material-icons">${icon}</i>
+                            <i ${item.completed ? `style="color: #27ba3c"` : ""} class="material-icons">${item.completed ? "check" : icon}</i>
                             ${item.title}
                         </div>
                     `;
@@ -1083,6 +1075,7 @@
  * @property {string} [id] Required for assignment, page, and discussion items.
  * @property {string} [url] Required for URL and embed items. Required for discussion and page items if the class does not support the pages or discussions feature.
  * @property {number} [indent] Indent level
+ * @property {boolean} [completed] True if the module item has been completed
  */
 
 /**
diff --git a/scripts/core.js b/scripts/core.js
index f6f573a..782c654 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.4
+ * @version v3.0.5
  * 
  * @copyright Copyright (c) 2018-2020 jottocraft. All rights reserved.
  * @license GPL-2.0-only
@@ -35,8 +35,8 @@
  * @property {object} remoteConfig Configuration variables that can be remotely changed
  */
 var dtps = {
-    ver: 304,
-    readableVer: "v3.0.4",
+    ver: 305,
+    readableVer: "v3.0.5",
     env: window.localStorage.dtpsLoaderPref == "debugging" ? "dev" : window.jottocraftSatEnv || "prod",
     classes: [],
     baseURL: document.currentScript.src ? document.currentScript.src.split("/scripts/core.js")[0] : "https://powerplus.app",
@@ -75,7 +75,8 @@
         gradeCalculationEnabled: true,
         showDonateButton: true,
         allowWhatIfGrades: true,
-        showVideoMeetingButton: true
+        showVideoMeetingButton: true,
+        showGradesInSettings: true
     }
 };
 
@@ -1071,10 +1072,12 @@
 
 /**
  * Opens the settings page
+ * 
+ * @param {boolean} [forceRerenderDashboard] If this is true, the dashboard settings will be re-rendered
  */
-dtps.settings = function () {
+dtps.settings = function (forceRerenderDashboard) {
     //Render dashboard HTML if not already loaded
-    if ($("#leftDashboardColumn").attr("loaded") !== "true") {
+    if (forceRerenderDashboard || ($("#leftDashboardColumn").attr("loaded") !== "true")) {
         //Returns dashboard item HTML from a dashboard item array
         function dashboardHTML(dashboardArray) {
             return dashboardArray.map(dashboardItem => {
@@ -1105,6 +1108,54 @@
         $("#leftDashboardColumn").attr("loaded", "true");
     }
 
+    //Render class grade bars
+    $("#classGradeBars").html(dtps.classes.map(course => {
+        //Percentages below are for visualization purposes only
+        var percentage = 0;
+        if (course.letter == "A") percentage = 100;
+        if (course.letter == "A-") percentage = 91;
+        if (course.letter == "B+") percentage = 88;
+        if (course.letter == "B") percentage = 85;
+        if (course.letter == "B-") percentage = 81;
+        if (course.letter == "C+") percentage = 78;
+        if (course.letter == "C") percentage = 75;
+
+        return (
+            course.letter ? `<div style="cursor: auto; background-color: var(--elements);" class="progressBar big">
+        <div style="color: white;" class="progressLabel">${course.subject} (${course.letter})</div>
+        <div class="progress" style="background-color: ${course.color}; width: calc(${percentage}% - 300px);"></div></div>` : ""
+        )
+    }));
+
+    //Calculate GPA
+    var sum = 0;
+    var values = 0;
+
+    dtps.classes.forEach(course => {
+        if (course.letter == "...") {
+            sum = null;
+        } else if (course.letter && (sum !== null)) {
+            var points = 0;
+            if (course.letter == "A") points = 4;
+            if (course.letter == "A-") points = 3.7;
+            if (course.letter == "B+") points = 3.3;
+            if (course.letter == "B") points = 3;
+            if (course.letter == "B-") points = 2.7;
+            if (course.letter == "C+") points = 2.3;
+            if (course.letter == "C") points = 2.0;
+            if (course.letter == "I") points = 0;
+
+            sum += points;
+            values++;
+        }
+    })
+
+    if (sum == null) {
+        $("#dtpsGpaText").text("...");
+    } else {
+        $("#dtpsGpaText").text((sum / values).toFixed(1));
+    }
+
     fluid.modal('.settingsCard');
 }
 
@@ -1134,6 +1185,20 @@
 }
 
 /**
+ * Resets dashboard prefrences
+ */
+dtps.resetDashboardPrefs = function () {
+    //Remove dashboard pref from localStorage
+    window.localStorage.removeItem("dtpsDashboardItems");
+
+    //Reload dashboard items
+    dtps.loadDashboardPrefs();
+
+    //Re-render dashboard
+    dtps.settings(true);
+}
+
+/**
  * Loads dashboard prefrences
  */
 dtps.loadDashboardPrefs = function () {
@@ -1303,6 +1368,11 @@
             <div onclick="$('.abtpage').hide();$('.abtpage.settings').show();" class="item active">
                 <i class="material-icons">settings</i> Settings
             </div>
+            ${dtps.remoteConfig.showGradesInSettings ? /*html*/`
+                <div onclick="$('.abtpage').hide();$('.abtpage.grades').show();" class="item">
+                    <i class="material-icons">assessment</i> Grades
+                </div>
+            ` : ``}
             <div onclick="$('.abtpage').hide();$('.abtpage.dashboard').show();" class="item">
                 <i class="material-icons">dashboard</i> Dashboard
             </div>
@@ -1382,16 +1452,32 @@
 
             </div>
 
+            <div style="display: none;" class="abtpage grades">
+                <h5><b>Grades</b></h5>
+                
+                <br />
+
+                <div>
+                <h6>Estimated GPA: <b id="dtpsGpaText">...</b></h6>
+                <p style="color: var(--secText);"><i>This GPA calculation is unofficial and does not account for honors credit</i></p>
+                </div>
+                
+                <br />
+
+                <div id="classGradeBars"></div>
+            </div>
+
             <div style="display: none;" class="abtpage dashboard">
                 <h5><b>Dashboard</b></h5>
                 <p>You can rearrange the items shown on the dashboard by dragging them below. You might have to reload Power+ for changes to take effect.</p>
 
+                <button onclick="dtps.resetDashboardPrefs();" class="btn small"><i class="material-icons">refresh</i> Reset dashboard layout</button>
+
                 <br />
                 
                 <div id="leftDashboardColumn" class="dashboardColumn"></div>
 
                 <div id="rightDashboardColumn" class="dashboardColumn"></div>
-
             </div>
 
             ${dtps.env == "dev" ? /*html*/`
@@ -1644,7 +1730,7 @@
 * @description [OPTIONAL] Fetches discussion threads for a course from the LMS
 * @kind function
 * @param {string} classID The class ID to fetch discussion threads for
-* @return {Promise<DiscussionThread[]>} A promise which resolves to an array of Discussion Thread objects
+* @return {Promise<PartialDiscussionThread[]>} A promise which resolves to an array of partial Discussion Thread objects
 */
 
 /**
@@ -1653,7 +1739,7 @@
 * @kind function
 * @param {string} classID The class ID to fetch discussion posts for
 * @param {string} threadID The discussion thread ID to fetch discussion posts for
-* @return {Promise<DiscussionPost[]>} A promise which resolves to an array of Discussion Post objects
+* @return {Promise<DiscussionThread>} A promise which resolves to a full discussion thread object
 */
 
 /**
@@ -1661,7 +1747,7 @@
 * @description [OPTIONAL] Fetches pages for a course from the LMS
 * @kind function
 * @param {string} classID The class ID to fetch pages for
-* @return {Promise<Page[]>} A promise which resolves to an array of Page objects
+* @return {Promise<PartialPage[]>} A promise which resolves to an array of partial page objects
 */
 
 /**
@@ -1670,7 +1756,7 @@
 * @kind function
 * @param {string} classID The class ID to fetch page content for
 * @param {string} pageID The page ID to fetch page content for
-* @return {Promise<string>} A promise which resolves to the page's content as HTML
+* @return {Promise<Page>} A promise which resolves to a full DTPS page object
 */
 
 /**
diff --git a/scripts/lms/canvas.js b/scripts/lms/canvas.js
index 59183a8..624e5f1 100644
--- a/scripts/lms/canvas.js
+++ b/scripts/lms/canvas.js
@@ -311,7 +311,8 @@
                                         type: "assignment",
                                         title: item.title,
                                         id: item.content_id,
-                                        indent: item.indent
+                                        indent: item.indent,
+                                        completed: item.completion_requirement && item.completion_requirement.completed
                                     })
                                 } else if (item.type.toUpperCase() == "PAGE") {
                                     moduleItems.push({
@@ -319,7 +320,8 @@
                                         title: item.title,
                                         id: item.page_url,
                                         indent: item.indent,
-                                        url: item.html_url
+                                        url: item.html_url,
+                                        completed: item.completion_requirement && item.completion_requirement.completed
                                     })
                                 } else if (item.type.toUpperCase() == "DISCUSSION") {
                                     moduleItems.push({
@@ -327,27 +329,31 @@
                                         title: item.title,
                                         id: item.content_id,
                                         indent: item.indent,
-                                        url: item.html_url
+                                        url: item.html_url,
+                                        completed: item.completion_requirement && item.completion_requirement.completed
                                     })
                                 } else if (item.type.toUpperCase() == "EXTERNALURL") {
                                     moduleItems.push({
                                         type: "url",
                                         title: item.title,
                                         url: item.external_url,
-                                        indent: item.indent
+                                        indent: item.indent,
+                                        completed: item.completion_requirement && item.completion_requirement.completed
                                     })
                                 } else if (item.type.toUpperCase() == "EXTERNALTOOL") {
                                     moduleItems.push({
                                         type: "embed",
                                         title: item.title,
                                         url: item.html_url,
-                                        indent: item.indent
+                                        indent: item.indent,
+                                        completed: item.completion_requirement && item.completion_requirement.completed
                                     });
                                 } else if (item.type.toUpperCase() == "SUBHEADER") {
                                     moduleItems.push({
                                         type: "header",
                                         title: item.title,
-                                        indent: item.indent
+                                        indent: item.indent,
+                                        completed: item.completion_requirement && item.completion_requirement.completed
                                     })
                                 }
                             })
@@ -451,8 +457,7 @@
                     return {
                         title: thread.title,
                         id: thread.id,
-                        locked: thread.locked_for_user,
-                        requireInitialPost: thread.require_initial_post
+                        locked: thread.locked_for_user
                     }
                 });
 
@@ -646,7 +651,12 @@
                         });
                     }
 
-                    resolve(dtpsDiscussionPosts);
+                    resolve({
+                        title: threadData.title,
+                        id: threadData.id,
+                        locked: threadData.locked_for_user,
+                        posts: dtpsDiscussionPosts
+                    });
                 }
             },
             error: function (err) {
@@ -667,19 +677,9 @@
                 var dtpsPages = data.map(function (page) {
                     var dtpsPage = {
                         title: page.title,
-                        id: page.url,
-                        updatedAt: page.updated_at
+                        id: page.url
                     };
 
-                    //Check for page author
-                    if (page.last_edited_by) {
-                        dtpsPage.author = {
-                            name: page.last_edited_by.display_name,
-                            id: page.last_edited_by.id,
-                            photoURL: page.last_edited_by.avatar_image_url
-                        }
-                    }
-
                     return dtpsPage;
                 });
 
@@ -700,8 +700,24 @@
             type: "GET",
             headers: dtpsLMS.commonHeaders,
             success: function (data) {
-                //Resolve with page content
-                resolve(data.body);
+                //Resolve with full page object
+                var dtpsPage = {
+                    title: data.title,
+                    id: data.url,
+                    updatedAt: data.updated_at,
+                    content: data.body
+                };
+
+                //Check for page author
+                if (data.last_edited_by) {
+                    dtpsPage.author = {
+                        name: data.last_edited_by.display_name,
+                        id: data.last_edited_by.id,
+                        photoURL: data.last_edited_by.avatar_image_url
+                    }
+                }
+
+                resolve(dtpsPage);
             },
             error: function (err) {
                 reject(err);
diff --git a/scripts/pages-discussions.js b/scripts/pages-discussions.js
index 658977c..0b85576 100644
--- a/scripts/pages-discussions.js
+++ b/scripts/pages-discussions.js
@@ -12,16 +12,20 @@
  * 
  * @param {string} courseID The course ID to render discussion threads for
  * @param {string} [defaultThread] The thread to load by default
+ * @param {boolean} fromModules True if this page is being loaded from the moduleStream
  */
-dtps.loadThreadsList = function (courseID, defaultThread) {
+dtps.loadThreadsList = function (courseID, defaultThread, fromModules) {
     //Get class index and set as selected class
     var classNum = dtps.classes.map(course => course.id).indexOf(courseID);
     dtps.selectedClass = classNum;
 
     //Set discussions as the selected content
-    dtps.selectedContent = "discuss";
-    $("#dtpsTabBar .btn").removeClass("active");
-    $("#dtpsTabBar .btn.discuss").addClass("active");
+    if (!fromModules) {
+        dtps.selectedContent = "discuss";
+        $("#dtpsTabBar .btn").removeClass("active");
+        $("#dtpsTabBar .btn.discuss").addClass("active");
+        jQuery("body").removeClass("collapsedSidebar");
+    }
 
     if (classNum == -1) {
         //Class does not exist
@@ -30,7 +34,12 @@
 
     //Load class color and things
     dtps.presentClass(classNum);
-    jQuery("body").removeClass("collapsedSidebar");
+
+    //Load module thread
+    if (fromModules) {
+        dtps.loadThreadPosts(classNum, defaultThread, fromModules);
+        return;
+    }
 
     if ((dtps.selectedClass == classNum) && (dtps.selectedContent == "discuss")) {
         //Render sidebar
@@ -136,31 +145,16 @@
  * 
  * @param {number} classNum The class number to render
  * @param {string} threadID The discussion thread to render
+ * @param {boolean} fromModules True if this page is being loaded from the moduleStream
  */
-dtps.loadThreadPosts = function (classNum, threadID) {
+dtps.loadThreadPosts = function (classNum, threadID, fromModules) {
     //Show loading indicator
-    if ((dtps.selectedClass == classNum) && (dtps.selectedContent == "discuss")) {
+    if ((dtps.selectedClass == classNum) && ((dtps.selectedContent == "discuss") || fromModules)) {
         jQuery(".classContent").html(`<div class="spinner"></div>`);
     }
 
-    //Get discussion data
-    var thread = null;
-    dtps.classes[classNum].discussions.forEach(discussionThread => {
-        if (discussionThread.id == threadID) {
-            thread = discussionThread;
-        }
-    });
-
-    if (!thread) {
-        dtps.error("Thread does not exist", "thread is null @ dtps.loadThreadPosts");
-        throw null;
-    }
-
     //Fetch discussion posts from the LMS
-    dtpsLMS.fetchDiscussionPosts(dtps.classes[classNum].id, threadID).then(function (postData) {
-        //Store posts in the discussion thread
-        thread.posts = postData;
-
+    dtpsLMS.fetchDiscussionPosts(dtps.classes[classNum].id, threadID).then(function (thread) {
         //Post HTML array
         var postHTML = [];
 
@@ -238,7 +232,9 @@
                             ` : ''}
                         </div>
          
-                        ${post.body}
+                        ${index == 0 ? /*html*/`
+                            <iframe id="classThreadIframe" onload="dtps.iframeLoad('classThreadIframe')" style="margin: 10px 0px; width: 100%; border: none; outline: none;" src="${discussionPostContentURL}" />
+                        ` : post.body}
 
                         ${replyHTML.join("")}
 
@@ -257,8 +253,12 @@
         });
 
         //Render HTML
-        if ((dtps.selectedClass == classNum) && (dtps.selectedContent == "discuss")) {
-            jQuery(".classContent").html(postHTML.join(""));
+        if ((dtps.selectedClass == classNum) && ((dtps.selectedContent == "discuss") || fromModules)) {
+            jQuery(".classContent").html((fromModules ? /*html*/`
+                <div class="acrylicMaterial" onclick="fluid.screen('moduleStream', '${dtps.classes[classNum].id}')" style="line-height: 40px;display:  inline-block;border-radius: 20px;margin: 82px 0px 0px 82px; cursor: pointer;">
+                    <div style="font-size: 16px;display: inline-block;vertical-align: middle;margin: 0px 20px;"><i style="vertical-align: middle;" class="material-icons">keyboard_arrow_left</i> Back</div>
+                </div>
+            ` : "") + postHTML.join(""));
         }
     }).catch(function (err) {
         dtps.error("Could not fetch discussion posts", "Caught promise rejection @ dtps.loadThreadPosts", err);
@@ -270,16 +270,20 @@
  * 
  * @param {string} courseID The course ID to render pages for
  * @param {string} [defaultPage] If provided, load the pageID by default
+ * @param {boolean} fromModules True if this page is being loaded from the moduleStream
  */
-dtps.loadPagesList = function (courseID, defaultPage) {
+dtps.loadPagesList = function (courseID, defaultPage, fromModules) {
     //Get class index and set as selected class
     var classNum = dtps.classes.map(course => course.id).indexOf(courseID);
     dtps.selectedClass = classNum;
 
     //Set pages as the selected content
-    dtps.selectedContent = "pages";
-    $("#dtpsTabBar .btn").removeClass("active");
-    $("#dtpsTabBar .btn.pages").addClass("active");
+    if (!fromModules) {
+        dtps.selectedContent = "pages";
+        $("#dtpsTabBar .btn").removeClass("active");
+        $("#dtpsTabBar .btn.pages").addClass("active");
+        jQuery("body").removeClass("collapsedSidebar");
+    }
 
     if (classNum == -1) {
         //Class does not exist
@@ -288,7 +292,12 @@
 
     //Load class color and things
     dtps.presentClass(classNum);
-    jQuery("body").removeClass("collapsedSidebar");
+
+    //Load module page
+    if (fromModules) {
+        dtps.loadPage(classNum, defaultPage, fromModules);
+        return;
+    }
 
     if ((dtps.selectedClass == classNum) && (dtps.selectedContent == "pages")) {
         //Render sidebar
@@ -381,32 +390,17 @@
  * 
  * @param {string} classNum The class number of the page to render
  * @param {string} pageID The page ID to render
+ * @param {boolean} fromModules True if this page is being loaded from the moduleStream
  */
-dtps.loadPage = function (classNum, pageID) {
+dtps.loadPage = function (classNum, pageID, fromModules) {
     //Show loading indicator
-    if ((dtps.selectedClass == classNum) && (dtps.selectedContent == "pages")) {
+    if ((dtps.selectedClass == classNum) && ((dtps.selectedContent == "pages") || fromModules)) {
         jQuery(".classContent").html(`<div class="spinner"></div>`);
     }
 
-    //Get page data
-    var page = null;
-    dtps.classes[classNum].pages.forEach(pageCheck => {
-        if (pageCheck.id == pageID) {
-            page = pageCheck;
-        }
-    });
-
-    if (!page) {
-        dtps.error("Page does not exist", "page is null @ dtps.loadPage");
-        throw null;
-    }
-
     //Fetch page content
-    dtpsLMS.fetchPageContent(dtps.classes[classNum].id, page.id).then(function (pageContentData) {
-        //Store page content in the page object
-        page.content = pageContentData;
-
-        if ((dtps.selectedClass == classNum) && (dtps.selectedContent == "pages")) {
+    dtpsLMS.fetchPageContent(dtps.classes[classNum].id, pageID).then(function (page) {
+        if ((dtps.selectedClass == classNum) && ((dtps.selectedContent == "pages") || fromModules)) {
             //Get computed background and text color to style the iFrame with
             var computedBackgroundColor = getComputedStyle($(".card.details")[0]).getPropertyValue("--cards");
             var computedTextColor = getComputedStyle($(".card.details")[0]).getPropertyValue("--text");
@@ -424,6 +418,11 @@
 
             //Render page card in the class content
             jQuery(".classContent").html(/*html*/`
+                ${fromModules ? /*html*/`
+                    <div class="acrylicMaterial" onclick="fluid.screen('moduleStream', '${dtps.classes[classNum].id}')" style="line-height: 40px;display:  inline-block;border-radius: 20px;margin: 82px 0px 0px 82px; cursor: pointer;">
+                        <div style="font-size: 16px;display: inline-block;vertical-align: middle;margin: 0px 20px;"><i style="vertical-align: middle;" class="material-icons">keyboard_arrow_left</i> Back</div>
+                    </div>
+                ` : ""}
                 <div class="card">
                     <!-- Page title -->
                     <h4 style="font-weight: bold;">${page.title}</h4>
@@ -455,26 +454,36 @@
     //Split parameter string into variables
     var courseID = param.split("|")[0];
     var threadID = param.split("|")[1];
+    var fromModules = param.split("|")[2] == "true";
 
-    dtps.loadThreadsList(courseID, threadID);
+    dtps.loadThreadsList(courseID, threadID, fromModules);
 }
 
 fluid.externalScreens.pages = (param) => {
     //Split parameter string into variables
     var courseID = param.split("|")[0];
     var pageID = param.split("|")[1];
+    var fromModules = param.split("|")[2] == "true";
 
-    dtps.loadPagesList(courseID, pageID);
+    dtps.loadPagesList(courseID, pageID, fromModules);
 }
 
 //Type definitions
 
 /**
+* @typedef {Object} PartialDiscussionThread
+* @description Defines partial discussion thread objects in DTPS (for threads list)
+* @property {string} title Title of the discussion thread
+* @property {string} id Discussion thread ID
+* @property {boolean} [locked] True if posting to the discussion thread is locked
+*/
+
+/**
 * @typedef {Object} DiscussionThread
 * @description Defines discussion thread objects in DTPS
 * @property {string} title Title of the discussion thread
 * @property {string} id Discussion thread ID
-* @property {DiscussionPost[]} posts Posts in this thread, with the initial one first. Assume that the topic has not been selected and loaded if this is undefined, and that there are no posts if this is an empty array.
+* @property {DiscussionPost[]} posts Posts in this thread, with the initial one first.
 * @property {boolean} [locked] True if posting to the discussion thread is locked
 * @property {boolean} [requireInitialPost] True if the user must post before viewing others' posts
 */
@@ -492,11 +501,18 @@
 */
 
 /**
+* @typedef {Object} PartialPage
+* @description Defines a partial page object in DTPS (for pages list)
+* @property {string} title Page title
+* @property {string} id Page ID
+*/
+
+/**
 * @typedef {Object} Page
 * @description Defines Page objects in DTPS
 * @property {string} title Page title
 * @property {string} id Page ID
-* @property {string} content Page content. Assume the page hasn't been selected/loaded if this is undefined.
+* @property {string} content Page content HTML
 * @property {Date} [updatedAt] When the page was last updated
 * @property {User} [author] Page author
 */
\ No newline at end of file