Last active
May 20, 2020 05:27
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==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