Greasy Fork is available in English.
当你未登录时,帮你自动进入统一认证登陆页面,免去点击各种登陆按钮。
当前为
// ==UserScript==
// @name 华南师大快速登陆
// @version 1.1
// @description 当你未登录时,帮你自动进入统一认证登陆页面,免去点击各种登陆按钮。
// @author LittleboyHarry
// @match *://moodle.scnu.edu.cn/*
// @match https://ssp.scnu.edu.cn/*
// @grant none
// @namespace http://greasyfork.icu/users/457866
// ==/UserScript==
(function() {
'use strict';
// Your code here...
/** @type {?HTMLAnchorElement} */
const { hostname } = location
switch (hostname) {
case 'moodle.scnu.edu.cn':
{
const loginButton = document.querySelector(
'.profileblock a[href$="login/index.php"]'
);
if (loginButton) {
showWaiting();
loginButton.click();
}
else if (location.pathname === "/login/index.php") {
showWaiting();
const frameHook = () => {
const ssoButton = document.getElementById("ssobtn");
if (ssoButton) ssoButton.click();
else requestAnimationFrame(frameHook);
};
frameHook();
}
}
break;
case 'ssp.scnu.edu.cn':
{
const loginSpanElement = document.getElementById('gologin')
if (loginSpanElement) {
showWaiting();
loginSpanElement.children[1].click();
}
}
break;
case 'www.scholat.com':
{
const loginButton = document.getElementById('loginHref')
if (loginButton) {
showWaiting();
loginButton.click();
}
}
break;
}
function showWaiting() {
const tipsElement = document.createElement("div");
tipsElement.style = `
background: #00000055;
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
z-index: 32;
display: flex;
justify-content: center;
align-items: center;
font-size: 32px;
color: white;
text-shadow: 0 0 8px black;
`;
tipsElement.innerText = "… 自动跳转 …";
document.body.appendChild(tipsElement);
}
})();