diff --git a/Compass QoL Enhancer.user.js b/Compass QoL Enhancer.user.js index d9d49ab..b2b297c 100644 --- a/Compass QoL Enhancer.user.js +++ b/Compass QoL Enhancer.user.js @@ -2,7 +2,7 @@ // @name Compass QoL Enhancer // @namespace blankie-scripts // @match http*://*.compass.education/* -// @version 1.24.5 +// @version 1.25.0 // @author blankie // @description A userscript that adds small but useful features for Compass, such as the ability to close windows by clicking on the background // @inject-into page @@ -156,15 +156,15 @@ if (NewsfeedAlertItemWidget) { }; } -// Automatically open learning tasks specified in the URL let LearningTasksDetailsWidgetNew = getExtClass("Compass.widgets.LearningTasksDetailsWidgetNew"); if (LearningTasksDetailsWidgetNew) { - let original = LearningTasksDetailsWidgetNew.prototype.forceOpenLearningTaskOnLoad; + // Automatically open learning tasks specified in the URL + let originalFOLTOL = LearningTasksDetailsWidgetNew.prototype.forceOpenLearningTaskOnLoad; LearningTasksDetailsWidgetNew.prototype.forceOpenLearningTaskOnLoad = function() { // stole this from the function above let toOpen = this.initialLoadComplete && !this.firstLoad; let exit = !toOpen || this.openLearningTaskId || qolLearningTaskOpened; - original.apply(this, arguments); + originalFOLTOL.apply(this, arguments); if (exit) { return; } @@ -183,6 +183,26 @@ if (LearningTasksDetailsWidgetNew) { } this.launchLearningTasksSubmissionWidget(learningTaskRecord.data.gridRecordId, false); }; + + // Show "Grades" and "Task" visibility for learning tasks + let originalCreateBasicTaskGrid = LearningTasksDetailsWidgetNew.prototype.createBasicTaskGrid; + LearningTasksDetailsWidgetNew.prototype.createBasicTaskGrid = function() { + let widget = this; + let taskGrid = originalCreateBasicTaskGrid.apply(this, arguments); + + let originalRenderer = taskGrid.columns[0].renderer; + taskGrid.columns[0].renderer = function() { + let isStudentView = widget.isStudentView; + let isStudentOrParent = widget.isStudentOrParent; + widget.isStudentView = widget.isStudentOrParent = false; + let ret = originalRenderer.apply(this, arguments); + widget.isStudentView = isStudentView; + widget.isStudentOrParent = isStudentOrParent; + return ret; + }; + + return taskGrid; + } } // Automatically add (and remove) the currently open learning task to the URL diff --git a/README.md b/README.md index 7065d2e..9caee0c 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,7 @@ A userscript that adds small but useful features for Compass. Features are: everything else - Learning tasks now being links (you can ctrl-click them) - Opening a learning task will automatically add its ID to the URL +- Learning tasks' grades and general visibility are now shown - The previous/next buttons and sessions dropdown are now links (you can now use [Link Hints] and ctrl-click to open them) - Class and news feed items can now be opened by simply clicking on their