Greasy Fork is available in English.
Calculates the Letter Grade for Canvas
< Commentaires sur Canvas Grade Calculator
Revised and Simplified Code
Added another Canvas URL to match
Works on all grade pages
Changed the method of firing the script
// ==UserScript== // @name Canvas Grade Calculator // @namespace 0612 // @version 1.6 // @description Calculates the Letter Grade for Canvas // @author SaturnKai // @match http*://*.instructure.com/* // @match http*://*.canvas.*.edu/* // @run-at document-end // @grant none // ==/UserScript== function getLetterGrade(percent) { let grade = percent.match(/\d+\.?\d+/)?.[0]; if (!grade || percent.includes("(")) { return ""; } if (grade >= 90) { return " (A)"; } else if (grade >= 80) { return " (B)"; } else if (grade >= 70) { return " (C)"; } else if (grade >= 60) { return " (D)"; } else if (grade < 60) { return " (F)"; } else { return ""; } } function addLetterGrade(element) { element.innerText += getLetterGrade(element.innerText); } function main() { document.querySelectorAll("td.percent").forEach(addLetterGrade); document.querySelectorAll(".final_grade .grade").forEach(addLetterGrade); } if (document.readyState === "complete" || document.readyState === "interactive") { main(); } else { window.addEventListener("DOMContentLoaded", () => { main(); }); }
Connectez-vous pour poster une réponse.
Revised and Simplified Code
Added another Canvas URL to match
Works on all grade pages
Changed the method of firing the script