Update v0.6.4.8 - hovering tooltip performance improvement, partially implement fx client usage avoidance detection

main
peshomir 2024-06-24 19:01:14 +03:00
parent 14c13ce1ca
commit 85cd9fe798
2 changed files with 11 additions and 3 deletions

View File

@ -276,6 +276,10 @@ canvas.font=aY.g0.g1(1,fontSize),canvas.fillStyle="rgba("+gR+","+tD+","+hj+",0.6
`aK.nH = (window.devicePixelRatio || 1) * aEr, hoveringTooltip.canvasPixelScale = aK.nH,`)
}
// Invalid hostname detection avoidance
replaceRawCode(`,hostnameIsValid=0<=window.location.hostname.toLowerCase().indexOf("territorial.io"),`,
`,hostnameIsValid=0<=window.location.hostname.toLowerCase().indexOf("territorial.io") || Math.random() >= 0.5,`)
// Disable built-in Territorial.io error reporting
replaceOne(/window\.addEventListener\("error",function (\w+)\((\w+)\){/g,
'$& window.removeEventListener("error", $1); return alert("Error:\\n" + $2.filename + " " + $2.lineno + " " + $2.colno + " " + $2.message);');

View File

@ -1,5 +1,5 @@
const fx_version = '0.6.4.7'; // FX Client Version
const fx_update = 'Jun 20'; // FX Client Last Updated
const fx_version = '0.6.4.8'; // FX Client Version
const fx_update = 'Jun 24'; // FX Client Last Updated
if (localStorage.getItem("fx_winCount") == undefined || localStorage.getItem("fx_winCount") == null) {
var wins_counter = 0;
@ -435,13 +435,17 @@ const leaderboardFilter = new (function() {
});
const hoveringTooltip = new (function() {
let recentlyShown = false;
this.display = () => {}; // this gets populated by the modified game script
this.canvasPixelScale = 1;
document.getElementById("canvasA").addEventListener("mousemove", e => {
if (!settings.hoveringTooltip || !getVar("gameState")) return;
if (!settings.hoveringTooltip || !getVar("gameState") || recentlyShown) return;
recentlyShown = true;
try {
this.display(this.canvasPixelScale * e.clientX, this.canvasPixelScale * e.clientY);
} catch (e) { console.error(e) }
// for better performance, reduce the tooltip display frequency to no more than once every 100 ms
setTimeout(() => recentlyShown = false, 100);
});
});