gh-pages
peshomir 2024-08-04 06:52:09 +00:00
parent 1ba3320018
commit b9231a52a4
2 changed files with 18 additions and 6 deletions

View File

@ -501,15 +501,27 @@ const hoveringTooltip = new (function() {
this.canvasPixelScale = 1; this.canvasPixelScale = 1;
function handler(e) { function handler(e) {
if (!settings.hoveringTooltip || !getVar("gameState") || recentlyShown) return; if (!settings.hoveringTooltip || !getVar("gameState") || recentlyShown) return;
let x, y;
// https://stackoverflow.com/a/61732450
if (e.type.includes(`touch`)) {
const { touches, changedTouches } = e.originalEvent ?? e;
const touch = touches[0] ?? changedTouches[0];
x = touch.pageX;
y = touch.pageY;
} else if (e.type.includes(`mouse`)) {
x = e.clientX;
y = e.clientY;
}
recentlyShown = true; recentlyShown = true;
try { try {
this.display(this.canvasPixelScale * e.clientX, this.canvasPixelScale * e.clientY); this.display(this.canvasPixelScale * x, this.canvasPixelScale * y);
} catch (e) { console.error(e) } } catch (e) { console.error(e) }
// for better performance, reduce the tooltip display frequency to no more than once every 100 ms // for better performance, reduce the tooltip display frequency to no more than once every 100 ms
setTimeout(() => recentlyShown = false, 100); setTimeout(() => recentlyShown = false, 100);
} }
document.getElementById("canvasA").addEventListener("mousemove", handler.bind(this)); document.getElementById("canvasA").addEventListener("mousemove", handler.bind(this));
document.getElementById("canvasA").addEventListener("touchmove", handler.bind(this)); document.getElementById("canvasA").addEventListener("touchstart", handler.bind(this));
}); });
var donationsTracker = new (function(){ var donationsTracker = new (function(){

View File

@ -35,7 +35,7 @@
<meta itemprop="image" content="https://fxclient.github.io/FXclient/assets/logo.png"> <meta itemprop="image" content="https://fxclient.github.io/FXclient/assets/logo.png">
<!-- FX Client CSS --> <!-- FX Client CSS -->
<link rel="stylesheet" href="main.css?1722753635645"> <link rel="stylesheet" href="main.css?1722754327812">
<!-- Game CSS --> <!-- Game CSS -->
<style> <style>
html, html,
@ -79,8 +79,8 @@
<p id="donationhistory_note">Note: donations from bots are not shown here</p> <p id="donationhistory_note">Note: donations from bots are not shown here</p>
<table><tbody id="donationhistory_content"></tbody></table> <table><tbody id="donationhistory_content"></tbody></table>
</div></span> </div></span>
<script src="variables.js?1722753635645"></script> <script src="variables.js?1722754327812"></script>
<script src="fx_core.js?1722753635645"></script> <script src="fx_core.js?1722754327812"></script>
<script src="game.js?1722753635645"></script> <script src="game.js?1722754327812"></script>
</body> </body>
</html> </html>