Louris Clinet

keystrokes

  1. // ==UserScript==
  2. // @name Louris Clinet
  3. // @namespace your-namespace
  4. // @version 1.0
  5. // @description keystrokes
  6. // @author Your Name
  7. // @match https://bloxd.io/*
  8. // @grant GM_addStyle
  9. // ==/UserScript==
  10. (function() {
  11. //
  12. var container = document.createElement('div');
  13. container.style.position = 'fixed';
  14. container.style.bottom = '10px';
  15. container.style.left = '10px';
  16. container.style.backgroundColor = 'black';
  17. container.style.color = 'white';
  18. container.style.padding = '5px';
  19. container.style.fontFamily = 'Arial';
  20. container.style.fontSize = '14px';
  21. container.style.zIndex = '9999';
  22.  
  23. var row1 = document.createElement('div');
  24. row1.style.display = 'flex';
  25. row1.style.justifyContent = 'center';
  26.  
  27. var upKey = document.createElement('div');
  28. upKey.textContent = 'W';
  29.  
  30. var row2 = document.createElement('div');
  31. row2.style.display = 'flex';
  32. row2.style.justifyContent = 'center';
  33.  
  34. var leftKey = document.createElement('div');
  35. leftKey.textContent = 'A';
  36. leftKey.style.marginRight = '10px';
  37.  
  38. var sprintKey = document.createElement('div');
  39. sprintKey.textContent = 'S';
  40.  
  41. var rightKey = document.createElement('div');
  42. rightKey.textContent = 'D';
  43. rightKey.style.marginLeft = '10px';
  44.  
  45. var row3 = document.createElement('div');
  46. row3.style.display = 'flex';
  47. row3.style.justifyContent = 'center';
  48.  
  49. var shiftKey = document.createElement('div');
  50. shiftKey.textContent = 'Shift';
  51. shiftKey.style.marginRight = '10px';
  52.  
  53. var spaceKey = document.createElement('div');
  54. spaceKey.textContent = '________';
  55. spaceKey.style.marginLeft = '10px';
  56.  
  57. //
  58. row1.appendChild(upKey);
  59. row2.appendChild(leftKey);
  60. row2.appendChild(sprintKey);
  61. row2.appendChild(rightKey);
  62. row3.appendChild(shiftKey);
  63. row3.appendChild(spaceKey);
  64. container.appendChild(row1);
  65. container.appendChild(row2);
  66. container.appendChild(row3);
  67.  
  68. //
  69. document.body.appendChild(container);
  70.  
  71. //
  72. document.addEventListener('keydown', function(event) {
  73. switch(event.key) {
  74. case 'w':
  75. upKey.style.backgroundColor = 'green';
  76. break;
  77. case 'a':
  78. leftKey.style.backgroundColor = 'green';
  79. break;
  80. case 's':
  81. sprintKey.style.backgroundColor = 'green';
  82. break;
  83. case 'd':
  84. rightKey.style.backgroundColor = 'green';
  85. break;
  86. case 'Shift':
  87. shiftKey.style.backgroundColor = 'green';
  88. break;
  89. case ' ':
  90. spaceKey.style.backgroundColor = 'green';
  91. break;
  92. }
  93. });
  94.  
  95. //
  96. document.addEventListener('keyup', function(event) {
  97. switch(event.key) {
  98. case 'w':
  99. upKey.style.backgroundColor = 'black';
  100. break;
  101. case 'a':
  102. leftKey.style.backgroundColor = 'black';
  103. break;
  104. case 's':
  105. sprintKey.style.backgroundColor = 'black';
  106. break;
  107. case 'd':
  108. rightKey.style.backgroundColor = 'black';
  109. break;
  110. case 'Shift':
  111. shiftKey.style.backgroundColor = 'black';
  112. break;
  113. case ' ':
  114. spaceKey.style.backgroundColor = 'black';
  115. break;
  116. }
  117. });
  118. })();