editableScore ui update
diff --git a/dtps.css b/dtps.css
index 1ae745d..fbcecdf 100644
--- a/dtps.css
+++ b/dtps.css
@@ -228,14 +228,19 @@
font-size: 16px;
}
-.dropped {
- filter: opacity(0.4);
+
+.assessmentWrapper.dropped span.assessmentTitle, .assessmentWrapper.dropped .editableScore:not(.focused) {
+ opacity: 0.4;
}
-.dropped span.assessmentTitle {
+.assessmentWrapper.dropped span.assessmentTitle {
text-decoration: line-through;
}
+.assessmentWrapper span.assessmentTitle {
+ transition: opacity 0.2s;
+}
+
/* POWERPOINTS THEME */
body.darkPowerpoints, body.showThemeWindows .themeWindow.darkPowerpoints {
--flex-light: #b39a46; --flex-bg: #a78e3a; --flex-text: #ffffff; --flex-sectext: #e4d8ae; --flex-layer1: #867027; --flex-layer2: #726021; --flex-layer3: #5f4f1c; --theme-color: #6d6d6d; --theme-text-color: #b39a46; --links: #686868; --acrylic: black; }
@@ -1481,4 +1486,23 @@
#classGradeMore.whatIf .table tr.active, #classGradeMore.whatIf .table tr.active * {
color: var(--classColor);
+}
+
+.editableScore {
+ outline: none;
+ font-size: 20px;
+ vertical-align: middle;
+ display: inline-block;
+ padding: 2px 5px;
+ border-radius: 5px;
+ margin-right: 5px;
+ transition: background-color 0.2s, border-color 0.2s, opacity 0.2s;
+ border: 2px solid transparent;
+ width: 45px;
+ text-align: center;
+}
+
+.editableScore.modified, .editableScore.focused {
+ background-color: var(--inputColor);
+ border-color: var(--elements);
}
\ No newline at end of file
diff --git a/scripts/lms/dtech.js b/scripts/lms/dtech.js
index 0e04b45..111a83f 100644
--- a/scripts/lms/dtech.js
+++ b/scripts/lms/dtech.js
@@ -529,11 +529,10 @@
` :
outcome.scores.map((assessment, aIndex) => {
return /*html*/`
- <p id="outcome${assessment.outcome}assessment${aIndex}" class="${aIndex == outcome.droppedScore ? "dropped" : ""}" style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 6px 0px;">
- <span aIndex="${aIndex}" outcomeID="${outcomeID}"
- style="outline: none;margin-right: 5px; font-size: 20px; vertical-align: middle; color: ${assessment.color}" class="editableScore" ${dtps.remoteConfig.allowWhatIfGrades ? `contenteditable` : ""}>${assessment.score}</span>
+ <div class="assessmentWrapper ${aIndex == outcome.droppedScore ? "dropped" : ""}" id="outcome${assessment.outcome}assessment${aIndex}" style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 6px 0px;">
+ <div style="color: ${assessment.color};" aIndex="${aIndex}" outcomeID="${outcomeID}" class="editableScore" ${dtps.remoteConfig.allowWhatIfGrades ? `contenteditable` : ""}>${assessment.score}</div>
<span class="assessmentTitle" style="cursor: pointer;" onclick="dtps.assignment('${assessment.assignmentID}', ${course.num});">${assessment.assignmentTitle}</span>
- </p>
+ </div>
`;
}).join("")
}
@@ -609,7 +608,15 @@
//Check if score is valid
if ($(ele).text() && ($(ele).text().length < 4) && !isNaN(typedScore) && (typedScore >= 0) && (typedScore <= 4)) {
//Valid outcome score, update color to match
- $(ele).css("color", dtechRubricColor(typedScore))
+ $(ele).css("color", dtechRubricColor(typedScore));
+
+ //Check if score is modified
+ var isWhatIf = course.gradeCalculation.dtech.whatIfOutcomes[Number($(ele).attr("outcomeID"))].scores[Number($(ele).attr("aIndex"))].whatIfGrade;
+ if (isWhatIf || (typedScore !== course.gradeCalculation.dtech.outcomes[Number($(ele).attr("outcomeID"))].scores[Number($(ele).attr("aIndex"))].score)) {
+ $(ele).addClass("modified");
+ } else {
+ $(ele).removeClass("modified");
+ }
//Update score in the what-if outcomes
course.gradeCalculation.dtech.whatIfOutcomes[Number($(ele).attr("outcomeID"))].scores[Number($(ele).attr("aIndex"))].score = typedScore;
@@ -619,6 +626,7 @@
} else {
//Invalid outcome score, gray out and calculate without this score
$(ele).css("color", "var(--secText)");
+ $(ele).addClass("modified");
//Update score in the what-if outcomes
course.gradeCalculation.dtech.whatIfOutcomes[Number($(ele).attr("outcomeID"))].scores[Number($(ele).attr("aIndex"))].score = null;
@@ -628,6 +636,19 @@
}
}, false);
+
+ ele.addEventListener("focus", function () {
+ $(ele).addClass("focused");
+ }, false);
+
+ ele.addEventListener("blur", function () {
+ if ($(ele).hasClass("whatIf") && ($(ele).text() == "")) {
+ $(ele).parent().remove();
+ course.gradeCalculation.dtech.whatIfOutcomes[Number($(ele).attr("outcomeID"))].scores[Number($(ele).attr("aIndex"))].score = null;
+ } else {
+ $(ele).removeClass("focused");
+ }
+ }, false);
}
//Copies outcomes for modification, shows what-if UI
@@ -710,11 +731,10 @@
//Add a new What-If assessment to the UI
$(".card.outcomeResults.outcome-" + outcomeID + " .assessments").append(/*html*/`
- <p id="outcome${outcomeID}assessment${aIndex}" style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 6px 0px;">
- <span aIndex="${aIndex}" outcomeID="${outcomeID}"
- style="outline: none;margin-right: 5px; font-size: 20px; vertical-align: middle; color: var(--secText);" class="editableScore" contenteditable>-</span>
+ <div class="assessmentWrapper" id="outcome${outcomeID}assessment${aIndex}" style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 6px 0px;">
+ <div style="color: var(--secText);" aIndex="${aIndex}" outcomeID="${outcomeID}" class="editableScore modified whatIf" contenteditable></div>
<span class="assessmentTitle">What-If Grade</span>
- </p>
+ </div>
`);
//Add an event listener for the new score