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

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. I'm currently having issues with the mouse event, google chome has changed it to pointer and it is not easy to handle it but i'm trying my best.

ของเมื่อวันที่ 19-09-2022 ดู เวอร์ชันล่าสุด

// ==UserScript==
// @name         [in beta-testing] Gats.io right click for spacebar
// @version      2.3
// @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. I'm currently having issues with the mouse event, google chome has 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==

document.body.innerHTML = '<div><p id="clic">0</p></div>' + doument.body.innerHTML

var cm = false

document.addEventListener("contextmenu",function(){
    cm = true
    setTimeout(function() {cm=false},50)
})

document.addEventListener("pointerdown",function(){
    if (cm){
        document.getElementById('clic').textContent = '1'
    }
})