This script is under developpement. an old version of it works but not for shield here https://greasyfork.org/fr/scripts/433998-in-beta-testing-gats-io-right-click-for-spacebar?version=987557.<br>I'm currently having issues with the mouse event, google chome having changed it to pointer and it is not easy to handle it but i'm trying my best.
当前为
// ==UserScript==
// @name [in beta-testing] Gats.io right click for spacebar
// @version 2.2.5.4
// @description This script is under developpement. an old version of it works but not for shield here https://greasyfork.org/fr/scripts/433998-in-beta-testing-gats-io-right-click-for-spacebar?version=987557.<br>I'm currently having issues with the mouse event, google chome having changed it to pointer and it is not easy to handle it but i'm trying my best.
// @author Rayan223
// @match https://gats.io
// @icon none
// @grant none
// @license MIT
// @namespace https://greasyfork.org/users/825882
// ==/UserScript==
/**
* Check if an event is supported.
* Ref: http://perfectionkills.com/detecting-event-support-without-browser-sniffing/
*/
function isEventSupported(event) {
var testEl = document.createElement('div');
var isSupported;
event = 'on' + event;
isSupported = (event in testEl);
if (!isSupported) {
testEl.setAttribute(event, 'return;');
isSupported = typeof testEl[event] === 'function';
}
testEl = null;
return isSupported;
}
let div_data = '<div id="ingameconsole"><p id="compatibility"></p> <p id="click_which">None</p></div>' + document.body.innerHTML;
var play = 0
document.body.innerHTML = div_data;
var compatibility = document.getElementById('compatibility');
var click_data = document.getElementById('click_which');
if (isEventSupported("mousedown")) {
document.addEventListener("mousedown", clickDown(event), false);
document.addEventListener("mouseup", clickUp(event), false);
compatibility.textContent = 'mousedown compatible'
}else if (isEventSupported("touchstart")) {
document.addEventListener("touchstart", clickDown(event), false);
document.addEventListener("touchend", clickUp(event), false);
compatibility.textContent = 'touchstart compatible'
} else if (isEventSupported("pointerdown")) {
document.addEventListener("pointerdown", clickDown(event), false);
document.addEventListener("pointerup", clickUp(event), false);
compatibility.textContent = 'pointerdown compatible'
} else {
compatibility.textContent = 'nothing compatible'
}
function playing() {
var menu = document.getElementById('slct');
if (menu.className == "container"){
return false
}else{
return true
}
}
function clickDown(event){
click_data = event
if (playing()){
if(event.which == 2){
RF.list[0].socket.send('k,5,1');
}
}
}
function clickUp(event){
if (playing()){
if(event.which == 2){
RF.list[0].socket.send('k,5,0');
}
}
};
//window.oncontextmenu = function ()
//{
// dash();
// setTimeout(afterdash,50);
// return false;
//}
//function dash(){
// RF.list[0].socket.send('k,5,1');
//}
//function afterdash(){
// RF.list[0].socket.send('k,5,0');
//}