-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGrade Viewer
More file actions
39 lines (34 loc) · 1.21 KB
/
Grade Viewer
File metadata and controls
39 lines (34 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// ==UserScript==
// @name Grade-Viewer
// @namespace https://my.wgu.edu/*
// @version 1.0
// @description show the percentage for the progress bar
// @author Hrod
// @match https://my.wgu.edu/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
window.addEventListener("load", main, false);
function main(evt) {
let scores = 0;
var timer = setInterval(runsOnJSLoadFinish, 111);
function runsOnJSLoadFinish() {
scores = document.getElementsByClassName("score-bar");
if (scores.length != 0) {
clearInterval(timer);
for (let i = 0; i < scores.length; i++) {
placeScore(scores[i]);
}
}
}
}
function placeScore(parent) {
let right = parent.getElementsByClassName("value")[0].style.right;
let percent = parseInt(right.substring(0, right.length - 1));
// Store the original innerHTML in a variable
let currentHtml = parent.innerHTML;
// Update the innerHTML of the parent element
parent.innerHTML = `<span style='font-size:2rem'>${100 - Number(percent)}%</span>` + currentHtml;
}
})();