Kogama Logout Button

Adds a logout button for Kogama and checks for saved password

  1. // ==UserScript==
  2. // @name Kogama Logout Button
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description Adds a logout button for Kogama and checks for saved password
  6. // @author Your Name
  7. // @match *://www.kogama.com/*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. 'use strict';
  13.  
  14. // Create a logout button
  15. const logoutButton = document.createElement('button');
  16. logoutButton.innerText = 'Logout';
  17. logoutButton.style.position = 'fixed';
  18. logoutButton.style.top = '10px';
  19. logoutButton.style.right = '10px';
  20. logoutButton.style.zIndex = '1000';
  21. logoutButton.style.padding = '10px';
  22. logoutButton.style.backgroundColor = '#ff0000';
  23. logoutButton.style.color = '#ffffff';
  24. logoutButton.style.border = 'none';
  25. logoutButton.style.borderRadius = '5px';
  26. logoutButton.style.cursor = 'pointer';
  27.  
  28. document.body.appendChild(logoutButton);
  29.  
  30. // Check if password is saved
  31. const isPasswordSaved = () => {
  32. const passwordField = document.querySelector('input[type="password"]');
  33. return passwordField && passwordField.value.length > 0;
  34. };
  35.  
  36. // Logout function
  37. const logout = () => {
  38. if (isPasswordSaved()) {
  39. alert('You have a saved password. Logging out...');
  40. } else {
  41. alert('No saved password detected. Logging out...');
  42. }
  43. // Perform logout action
  44. window.location.href = 'https://www.kogama.com/logout/'; // Adjust the logout URL as necessary
  45. };
  46.  
  47. // Add event listener to the button
  48. logoutButton.addEventListener('click', logout);
  49. })();