Kogama Logout Button

Adds a logout button for Kogama and checks for saved password

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

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.

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

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

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         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);
})();