diff --git a/html/popup.html b/html/popup.html
index 016850cc..349f04e6 100644
--- a/html/popup.html
+++ b/html/popup.html
@@ -271,6 +271,14 @@
Better Canvas
Color coded tab icons
+
diff --git a/js/background.js b/js/background.js
index 7ab79062..68244042 100644
--- a/js/background.js
+++ b/js/background.js
@@ -89,6 +89,7 @@ chrome.runtime.onInstalled.addListener(function () {
"new_browser": null,
"gpa_calc_cumulative": false,
"gpa_calc_weighted": true,
+ "quiz_strikethrough": false,
}
};
diff --git a/js/content.js b/js/content.js
index c2301d3e..5dfb12e9 100644
--- a/js/content.js
+++ b/js/content.js
@@ -224,6 +224,7 @@ function startExtension() {
loadCustomFont();
applyAestheticChanges();
changeFavicon();
+ initQuizStrikethrough();
updateReminders();
//getClassAverages();
setTimeout(() => runDarkModeFixer(false), 800);
@@ -266,6 +267,8 @@ function applyOptionsChanges(changes) {
case ("dashboard_notes"):
loadDashboardNotes();
break;
+ case ("quiz_strikethrough"):
+ initQuizStrikethrough()
case ("dashboard_grades"):
case ("grade_hover"):
if (!grades) getGrades();
@@ -1845,6 +1848,79 @@ function setupGPACalc() {
}
}
+/*
+Quiz Strikethrough
+*/
+
+const strikeStyle =
+ "background-color: transparent; right: 10px; font-size: 30px; position: absolute; text-decoration: none !important; color: red; border: none; z-index: 2";
+
+function initQuizStrikethrough() {
+
+ if (options.quiz_strikethrough !== true || !current_page.includes("quizzes")) return;
+ // Listen for any answer choices being added after runtime
+ const bodyElement = document.body;
+ const config = { childList: true, subtree: true };
+
+ const callback = (mutationList, observer) => {
+ for (const mutation of mutationList) {
+ if (mutation.type === "childList") {
+ mutation.addedNodes.forEach((node) => {
+ if (node.nodeName === "DIV") {
+ if (isValid(node)) {
+ initChoice(node);
+ }
+ }
+ });
+ }
+ }
+ };
+
+ const observer = new MutationObserver(callback);
+ observer.observe(bodyElement, config);
+
+ const answerDivs = document.querySelectorAll(".answer");
+ answerDivs.forEach((element) => {
+ if (isValid(element)) initChoice(element);
+ });
+}
+
+
+function initChoice(element) {
+ const button = document.createElement("button");
+ button.setAttribute("type", "button"); // Prevents button from submitting since