ItsLearningLogin

A scipt for auto login in, designed for use with lastpass.

Du musst eine Erweiterung wie Tampermonkey, Greasemonkey oder Violentmonkey installieren, um dieses Skript zu installieren.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

Sie müssten eine Skript Manager Erweiterung installieren damit sie dieses Skript installieren können

(Ich habe schon ein Skript Manager, Lass mich es installieren!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         ItsLearningLogin
// @namespace    http://tampermonkey.net/
// @version      1.2
// @description  A scipt for auto login in, designed for use with lastpass.
// @author       Laxybaxy
// @match        https://idp.feide.no/*
// @match        https://*.itslearning.com/*
// @match        https://itslearning.com/*
// ==/UserScript==

var credentialsInterval, loginInterval;

function pressCredentials(){
    try{
        var loginbtn = document.querySelector("button[type='submit']");
        //for(var userbtn of loginbtns)
        if(loginbtn.innerText == "Logg inn" && document.readyState == "complete" && document.getElementById("username").value != "")
        {
            clearInterval(credentialsInterval);
            loginbtn.click();
        }
    }catch(e){
        console.log(e);
    }
}

function pressLogin()
{
    try{
        var a = document.querySelectorAll("a.itsl-native-login-button")
        for(var i = 0; i < a.length; i++){
            let e = a[i];
            if(e.innerHTML.includes("Feide") && document.readyState == "complete"){
                clearInterval(loginInterval);
                e.click();
            }
        }
    }catch(e){
        console.log(e);
    }
    try{
        if(document.querySelector(".l-menu-icons"))
        {
            clearInterval(loginInterval);
            console.log("stopped");
        }
    }catch(e){
        console.log(e);

    }
}

window.onload = function(){
    if(String(window.location).includes("idp.feide.no")){
        credentialsInterval = setInterval(pressCredentials,100);
    }else if(String(window.location).includes("itslearning.com")){
        loginInterval = setInterval(pressLogin,100);
    }
}