// ==UserScript==
// @name JUST EVO
// @description Patches & tools for JUST Website
// @namespace https://greasyfork.org/users/197529
// @version 0.1.0
// @author kkocdko
// @license Unlicense
// @match *://*.just.edu.cn/*
// @noframes
// @downloadURL none
// ==/UserScript==
"use strict";
const { addFloatButton } = {
addFloatButton(text, onClick) /* 20200707-123713 */ {
if (!document.addFloatButton) {
const container = document.body
.appendChild(document.createElement("div"))
.attachShadow({ mode: "open" });
container.innerHTML =
"";
document.addFloatButton = (text, onClick) => {
const button = document.createElement("button");
button.textContent = text;
button.addEventListener("click", onClick);
return container.appendChild(button);
};
}
return document.addFloatButton(text, onClick);
},
};
// Auto login
requestIdleCallback(() => document.querySelector(".login_btn")?.click());
// Fix JUST P.E.
setTimeout(() => {
if (document.title === "江苏科大体育综合管理系统") {
document
.querySelector("#leftFrame")
.contentDocument.querySelectorAll("[onclick]")
.forEach((el) => {
el.setAttribute(
"onclick",
el.getAttribute("onclick").replace("href(", "href=(")
);
});
}
}, 1500);