Kogama Logout Button

Adds a logout button for Kogama and checks for saved password

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

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

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         Kogama Logout Button
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Adds a logout button for Kogama and checks for saved password
// @author       Your Name
// @match        *://www.kogama.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Create a logout button
    const logoutButton = document.createElement('button');
    logoutButton.innerText = 'Logout';
    logoutButton.style.position = 'fixed';
    logoutButton.style.top = '10px';
    logoutButton.style.right = '10px';
    logoutButton.style.zIndex = '1000';
    logoutButton.style.padding = '10px';
    logoutButton.style.backgroundColor = '#ff0000';
    logoutButton.style.color = '#ffffff';
    logoutButton.style.border = 'none';
    logoutButton.style.borderRadius = '5px';
    logoutButton.style.cursor = 'pointer';

    document.body.appendChild(logoutButton);

    // Check if password is saved
    const isPasswordSaved = () => {
        const passwordField = document.querySelector('input[type="password"]');
        return passwordField && passwordField.value.length > 0;
    };

    // Logout function
    const logout = () => {
        if (isPasswordSaved()) {
            alert('You have a saved password. Logging out...');
        } else {
            alert('No saved password detected. Logging out...');
        }
        // Perform logout action
        window.location.href = 'https://www.kogama.com/logout/'; // Adjust the logout URL as necessary
    };

    // Add event listener to the button
    logoutButton.addEventListener('click', logout);
})();