Mouse Click Buttons for sploop.io

Adds left and right mouse click buttons to the top left corner of the sploop.io webpage.

  1. // ==UserScript==
  2. // @name Mouse Click Buttons for sploop.io
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.0
  5. // @description Adds left and right mouse click buttons to the top left corner of the sploop.io webpage.
  6. // @author hayden422
  7. // @match https://sploop.io/*
  8. // @grant none
  9. // @license MIT
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. // Create a container div
  16. const container = document.createElement('div');
  17. container.style.position = 'fixed';
  18. container.style.top = '0';
  19. container.style.left = '0';
  20. container.style.padding = '10px';
  21. document.body.appendChild(container);
  22.  
  23. // Create left mouse click button
  24. const leftClickButton = document.createElement('button');
  25. leftClickButton.textContent = 'LMB';
  26. leftClickButton.style.padding = '10px 25px';
  27. leftClickButton.style.backgroundColor = '#007bff';
  28. leftClickButton.style.color = '#fff';
  29. leftClickButton.style.border = 'none';
  30. leftClickButton.style.cursor = 'pointer';
  31. container.appendChild(leftClickButton);
  32.  
  33. // Create right mouse click button
  34. const rightClickButton = document.createElement('button');
  35. rightClickButton.textContent = 'RMB';
  36. rightClickButton.style.padding = '10px 25px';
  37. rightClickButton.style.backgroundColor = '#dc3545';
  38. rightClickButton.style.color = '#fff';
  39. rightClickButton.style.border = 'none';
  40. rightClickButton.style.cursor = 'pointer';
  41. container.appendChild(rightClickButton);
  42.  
  43. // Function to toggle button color
  44. function toggleButtonColor(button) {
  45. const originalColor = button.dataset.originalColor || '';
  46. const currentColor = button.style.backgroundColor || '';
  47.  
  48. if (originalColor && currentColor) {
  49. button.style.backgroundColor = currentColor === originalColor ? '#f0f0f0' : originalColor;
  50. } else {
  51. button.dataset.originalColor = currentColor;
  52. button.style.backgroundColor = '#f0f0f0';
  53. }
  54. }
  55.  
  56. // Add mousedown event listeners to toggle button colors
  57. document.addEventListener('mousedown', (event) => {
  58. if (event.button === 0) { // Left mouse button (LMB)
  59. toggleButtonColor(leftClickButton);
  60. } else if (event.button === 2) { // Right mouse button (RMB)
  61. toggleButtonColor(rightClickButton);
  62. }
  63. });
  64.  
  65. // Add mouseup event listeners to reset button colors
  66. document.addEventListener('mouseup', () => {
  67. leftClickButton.style.backgroundColor = '#007bff';
  68. rightClickButton.style.backgroundColor = '#dc3545';
  69. });
  70. })();