Feuerwerk Datenbank

Automatisch einloggen

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Feuerwerk Datenbank
// @namespace    https://greasyfork.org/users/156194
// @version      1.0
// @description  Automatisch einloggen
// @author       rabe85
// @match        https://www.feuerwerk-datenbank.de/
// @match        https://www.feuerwerk-datenbank.de/*
// @grant        GM_setValue
// @grant        GM_getValue
// @grant        GM_deleteValue
// ==/UserScript==

(function() {
    'use strict';

    function feuerwerk_datenbank() {

        var logout_clicked = GM_getValue('logout_clicked', 0);

        // Login-Klick merken
        var auth_connect = document.querySelector("a[href='/auth/connect']");
        if(auth_connect) {
            function save_login() { GM_setValue('logout_clicked', 0); }
            auth_connect.addEventListener("click", save_login, false);
        }

        // Logout-Klick merken
        var auth_logout = document.querySelector("a[href='/auth/logout']");
        if(auth_logout) {
            function save_logout() { GM_setValue('logout_clicked', 1); }
            auth_logout.addEventListener("click", save_logout, false);
        }

        // Automatisch einloggen, wenn vorher nicht "Logout" angeklickt wurde
        if(logout_clicked == 0) {
            if(auth_connect) {
                GM_setValue('logout_clicked', 0);
                window.location.href = "https://www.feuerwerk-datenbank.de/auth/connect";
            }
        }

    }


    // DOM vollständig aufgebaut?
    if (/complete|interactive|loaded/.test(document.readyState)) {
        feuerwerk_datenbank();
    } else {
        document.addEventListener("DOMContentLoaded", feuerwerk_datenbank, false);
    }

})();