Skip to content

Instantly share code, notes, and snippets.

@NuarkNoir
Last active May 20, 2020 05:27
Show Gist options
  • Save NuarkNoir/1e82f519e4eb2e5a6dd71cbf9b2cdcd0 to your computer and use it in GitHub Desktop.
Save NuarkNoir/1e82f519e4eb2e5a6dd71cbf9b2cdcd0 to your computer and use it in GitHub Desktop.
GradeCalcCorrector - correctly calcs grade on full report page. Not flexible, may contain errors.
// ==UserScript==
// @name GradeCalcCorrector
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Correctly calcs grade on full report page. Not flexible, may contain errors.
// @author You
// @match https://e.sfu-kras.ru/grade/report/user/index.php?id=*
// @grant none
// ==/UserScript==
(function() {
'use strict';
function calc_right(doc) {
return Array.from(doc.querySelectorAll(".levelodd[headers~=grade]")).map(v=>~~v.textContent).reduce((acc,v)=>acc+v,0);
}
let fgrade = calc_right(document);
document.querySelector("h2").after(`Суммарная оценка: ${fgrade} балл(а)`);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment