Mess around with schoolbook.ge
目前為
// ==UserScript==
// @name schoolbook.ge tools
// @namespace https://github.com/Naviamold1
// @match https://eservices.schoolbook.ge/*
// @grant none
// @version 1.1
// @author Naviamold
// @description Mess around with schoolbook.ge
// @license MIT
// ==/UserScript==
(function () {
"use strict";
// fill out these fields
let changeGrade = "None"; // numbers or "None"
let hideComments = false; // true or false
let changeAttandance = "None"; // numbers or "None"
let liveGradeUpdate = true; // true or false
let gradeViewer = false; // true of false
// do not change anything below this line if you dont know what you are doing
function newGrade() {
let grade = document.getElementsByClassName("avg_value");
for (let i = 0; i < grade.length; i++) {
grade[i].innerHTML = changeGrade;
}
let totalGrade = document.querySelector("#saertosashualo span");
totalGrade.innerHTML = changeGrade;
for (let i = 0; i < totalGrade.length; i++) {
totalGrade[i].innerHTML = changeGrade;
}
}
function newAttandance() {
let attendance = document.querySelector(".sec span");
attendance.innerHTML = changeAttandance + " %";
}
function removeComments() {
let comment = document.getElementsByClassName("notificationsList");
for (let i = 0; i < comment.length; i++) {
comment[i].style.display = "none";
}
let comment1 = document.getElementsByClassName("notificationsListalter");
for (let i = 0; i < comment1.length; i++) {
comment1[i].style.display = "none";
}
let messages = document.getElementsByClassName("homeworkContent");
for (let i = 0; i < messages.length; i++) {
messages[i].style.display = "none";
}
}
function liveUpdate() {
let totalGrade = document.querySelector("#saertosashualo span");
totalGrade.click();
setTimeout(() => {
closeGradeDialog();
let numbers = [];
document
.querySelectorAll(
"#cnt > div.div_container_grades > table > tbody > tr > td:nth-child(4)"
)
.forEach((el) => {
let text = el.innerText || el.textContent;
let number = parseInt(text.replace(/\D/g, ""));
if (!isNaN(number)) {
numbers.push(number);
}
});
let sum = numbers.reduce((acc, val) => acc + val, 0);
let avg = 0;
if (numbers.length > 0) {
avg = sum / numbers.length;
}
avg = Math.round(avg * 100) / 100;
totalGrade.innerHTML = avg;
}, 500);
}
function gradeSpier() {
$("body").append(`
<form id="gmSomeID">
<input id="gminput"></input>
<button id="gmview">View</button>
</form>
`);
const getter = () => {
let val = document.querySelector("#gminput").value
gradeclick(val, -1);
};
$("#gmview").click(getter);
}
if (window.location.href == "https://eservices.schoolbook.ge/Parent/Index") {
if (changeGrade != "None") {
newGrade();
}
if (changeAttandance != "None") {
newAttandance();
}
}
if (
window.location.href == "https://eservices.schoolbook.ge/Parent/Messages"
) {
if (hideComments) {
removeComments();
}
}
if (liveGradeUpdate) {
liveUpdate();
}
if (gradeViewer) {
gradeSpier();
}
})();