[in beta-testing] Gats.io right click for spacebar

Warning! This script is currently under testing, it could not work correctly until it is realesed. This script allows you to use your right click for the abilities you usually use with spacebar. However it wont work for shield yet (working on it). In the future I also plan on reworking it to configure entirely the keybinds to be customizable

19.09.2022 itibariyledir. En son verisyonu görün.

  1. // ==UserScript==
  2. // @name [in beta-testing] Gats.io right click for spacebar
  3. // @version 2.2.5.2
  4. // @description Warning! This script is currently under testing, it could not work correctly until it is realesed. This script allows you to use your right click for the abilities you usually use with spacebar. However it wont work for shield yet (working on it). In the future I also plan on reworking it to configure entirely the keybinds to be customizable
  5. // @author Rayan223
  6. // @match https://gats.io
  7. // @icon none
  8. // @grant none
  9. // @license MIT
  10. // @namespace https://greasyfork.org/users/825882
  11. // ==/UserScript==
  12.  
  13. /**
  14. * Check if an event is supported.
  15. * Ref: http://perfectionkills.com/detecting-event-support-without-browser-sniffing/
  16. */
  17. function isEventSupported(event) {
  18. var testEl = document.createElement('div');
  19. var isSupported;
  20.  
  21. event = 'on' + event;
  22. isSupported = (event in testEl);
  23.  
  24. if (!isSupported) {
  25. testEl.setAttribute(event, 'return;');
  26. isSupported = typeof testEl[event] === 'function';
  27. }
  28. testEl = null;
  29.  
  30. return isSupported;
  31. }
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38. let div_data = '<div id="ingameconsole"><p id="compatibility"></p> <p id="click_which">None</p></div>' + document.body.innerHTML;
  39.  
  40. var play = 0
  41.  
  42. document.body.innerHTML = div_data;
  43. var compatibility = document.getElementById('compatibility');
  44. var click_data = document.getElementById('click_which');
  45.  
  46. if (isEventSupported("pointerdown")) {
  47. document.addEventListener("pointerdown", clickDown(event), false);
  48. document.addEventListener("pointerup", clickUp(event), false);
  49. compatibility.textContent = 'pointerdown compatible'
  50. } else if (isEventSupported("touchstart")) {
  51. document.addEventListener("touchstart", clickDown(event), false);
  52. document.addEventListener("touchend", clickUp(event), false);
  53. compatibility.textContent = 'touchstart compatible'
  54. } else if (isEventSupported("mousedown")) {
  55. document.addEventListener("mousedown", clickDown(event), false);
  56. document.addEventListener("mouseup", clickUp(event), false);
  57. compatibility.textContent = 'mousedown compatible'
  58. } else {
  59. compatibility.textContent = 'nothing compatible'
  60. }
  61.  
  62. function playing() {
  63. var menu = document.getElementById('slct');
  64. if (menu.className == "container"){
  65. return false
  66. }else{
  67. return true
  68. }
  69. }
  70.  
  71. function clickDown(event){
  72. click_data = event
  73. if (playing()){
  74. if(event.which == 2){
  75. RF.list[0].socket.send('k,5,1');
  76. }
  77. }
  78. }
  79.  
  80. function clickUp(event){
  81. if (playing()){
  82. if(event.which == 2){
  83. RF.list[0].socket.send('k,5,0');
  84. }
  85. }
  86. };
  87. //window.oncontextmenu = function ()
  88. //{
  89. // dash();
  90. // setTimeout(afterdash,50);
  91. // return false;
  92. //}
  93.  
  94. //function dash(){
  95. // RF.list[0].socket.send('k,5,1');
  96. //}
  97.  
  98. //function afterdash(){
  99. // RF.list[0].socket.send('k,5,0');
  100. //}