From c101c0c765afe3b38d43c347bcda6848e3eb0cc5 Mon Sep 17 00:00:00 2001 From: Jan <rsge@web.de> Date: Fri, 8 Dec 2023 13:05:39 +0100 Subject: [PATCH] Added new site & changed script name --- Uni Hamburg Moodle Auto Login.user.js | 46 +++++++++++++++++++-------- 1 file changed, 33 insertions(+), 13 deletions(-) diff --git a/Uni Hamburg Moodle Auto Login.user.js b/Uni Hamburg Moodle Auto Login.user.js index e8b4c3b..b37c1d9 100644 --- a/Uni Hamburg Moodle Auto Login.user.js +++ b/Uni Hamburg Moodle Auto Login.user.js @@ -1,14 +1,14 @@ // ==UserScript== -// @name Uni Hamburg Moodle Auto Login -// @name:de Uni-Hamburg-Moodle Auto-Login +// @name Uni Hamburg Auto Logins +// @name:de Uni Hamburg Auto-Logins -// @description Automatically logs you in to the Uni Hamburg Moodle, given automated password filling. -// @description:de Loggt Dich automatisch in das Moodle der Uni Hamburg ein, gegeben, dass die Login-Daten automatisch ausgefüllt werden. +// @description Automatically logs you in to a few different Uni Hamburg sites, given automated password filling. +// @description:de Loggt Dich automatisch in verschiedene Seiten der Uni Hamburg ein, gegeben, dass die Login-Daten automatisch ausgefüllt werden. -// @version 1.0.6 +// @version 2.0.0 // @copyright 2023+, Jan G. (Rsge) // @license Mozilla Public License 2.0 -// @icon https://lernen.min.uni-hamburg.de/theme/image.php/uhh/theme/1698645195/favicon +// @icon https://www.uni-hamburg.de/favicon.ico // @namespace https://github.com/Rsge // @homepageURL https://github.com/Rsge/Uni-Hamburg-Moodle-Auto-Login @@ -17,6 +17,7 @@ // @updateURL https://update.greasyfork.org/scripts/479165/Uni%20Hamburg%20Moodle%20Auto%20Login.user.js // @match https://lernen.min.uni-hamburg.de/login/* +// @match https://www.openolat.uni-hamburg.de/dmz/* // @match https://login.uni-hamburg.de/idp/* // @run-at document-end @@ -27,19 +28,38 @@ 'use strict'; window.addEventListener('load', function() { - let firstLoginButtonElements = document.getElementsByClassName("btn login-identityprovider-btn btn-primary btn-lg btn-block"); - if (firstLoginButtonElements.length > 0) { - firstLoginButtonElements[0].click(); + // lernen.min.uni-hamburg.de + let lernenMINLoginButtons = document.getElementsByClassName("btn login-identityprovider-btn btn-primary btn-lg btn-block"); + if (lernenMINLoginButtons.length > 0) { + lernenMINLoginButtons[0].click(); return; } - let secondLoginButtonElements = document.getElementsByClassName("form-element form-button"); - if (secondLoginButtonElements.length > 0) { + // openolat.uni-hamburg.de + let openOlatLoginButtonDivs = document.getElementsByClassName("o_block"); + if (openOlatLoginButtonDivs.length > 0) { + let openOlatLoginButton = openOlatLoginButtonDivs[0].firstElementChild; + openOlatLoginButton.click(); + return; + } + /* + let openOlatLoginVariantButton = document.getElementById("o_col_ShibGeneric"); + if (openOlatLoginVariantButton) { + openOlatLoginVariantButton.click(); + setTimeout(function() { + XXX + } + }, 800); + return; + }*/ + // login.uni-hamburg.de + let loginLoginButtons = document.getElementsByClassName("form-element form-button"); + if (loginLoginButtons.length > 0) { let passwordInput = document.getElementById("password"); if (passwordInput?.value.length > 0) { - secondLoginButtonElements[0].click(); + loginLoginButtons[0].click(); } else { passwordInput.addEventListener("input", function() { - secondLoginButtonElements[0].click(); + loginLoginButtons[0].click(); }); } } -- GitLab