Created
September 16, 2021 01:03
-
-
Save eiiot/7ef406b22f68e4dfbd57c8596f895507 to your computer and use it in GitHub Desktop.
Tampermonkey - Infinite Campus Grade Percents
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 Infinute Campus Grade Percent Calculator | |
| // @namespace http://tampermonkey.net/ | |
| // @version 0.1 | |
| // @description Add percentages to infinute campus | |
| // @author eiiot | |
| // @match https://*.infinitecampus.org/* | |
| // @icon https://infinitecampus.org/favicon.ico | |
| // @grant none | |
| // @run-at document-idle | |
| // ==/UserScript== | |
| (function() { | |
| 'use strict'; | |
| console.log('script init'); | |
| function evil(fn) { | |
| return new Function('return ' + fn)(); | |
| }; | |
| var fireOnHashChangesToo = true; | |
| var pageURLCheckTimer = setInterval ( | |
| function () { | |
| if (this.lastPathStr !== location.pathname | |
| || this.lastQueryStr !== location.search | |
| || (fireOnHashChangesToo && this.lastHashStr !== location.hash) | |
| ) { | |
| this.lastPathStr = location.pathname; | |
| this.lastQueryStr = location.search; | |
| this.lastHashStr = location.hash; | |
| gmMain (); | |
| } | |
| } | |
| , 111 | |
| ); | |
| function gmMain () { | |
| clearInterval(checkExist); | |
| var checkExist = setInterval(function() { | |
| try { | |
| if (typeof document.getElementById('main-workspace').contentDocument.getElementsByClassName('totals__row--task')[0].children[0].innerHTML !== 'undefined') { | |
| clearInterval(checkExist); | |
| var grade = document.getElementById('main-workspace').contentDocument.getElementsByClassName('totals__row--task')[0].children[0]; | |
| var gradeValue = grade.innerHTML.replace(/ /g, ""); | |
| grade.innerHTML = ` ${gradeValue} (${(evil(gradeValue)*100).toFixed(2)}%) ` | |
| } | |
| } catch (e) { | |
| return; | |
| }; | |
| }, 100); | |
| }; | |
| })(); |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Installation Instructions
Rawbutton on the top of this gist!Created by Eliot