From c895312f7a55aa982f3bb4af976855fc60639c20 Mon Sep 17 00:00:00 2001 From: Holly Date: Sat, 20 Apr 2024 17:34:32 +0100 Subject: [PATCH] allow hiding the self cursor --- client/Terminal-00-Multiuser.user.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/client/Terminal-00-Multiuser.user.js b/client/Terminal-00-Multiuser.user.js index 957c6ac..413026e 100644 --- a/client/Terminal-00-Multiuser.user.js +++ b/client/Terminal-00-Multiuser.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name Terminal 00 Multiuser // @namespace https://*.angusnicneven.com/* -// @version 20240420.1 +// @version 20240420.2 // @description Probe with friends! // @author tgpholly // @match https://*.angusnicneven.com/* @@ -153,6 +153,7 @@ if (!window.TE_ACTIVE) { rawSetPos(x, y) { if (!this.hasBeenMoved) { this.element.visibility = ""; + this.hasBeenMoved = true; } this.targetX = Math.round(x * clientWidth); @@ -162,6 +163,7 @@ if (!window.TE_ACTIVE) { rawSetPosInit(x, y) { if (!this.hasBeenMoved) { this.element.visibility = ""; + this.hasBeenMoved = true; } this.actualX = this.targetX = Math.round(x * clientWidth); @@ -231,6 +233,10 @@ if (!window.TE_ACTIVE) { ws.send(createWriter(Endian.LE, 9).writeByte(MessageType.Ping).writeFloat((rawMouseX + document.body.scrollLeft - 32) / clientWidth).writeInt(rawMouseY + document.body.scrollTop - 32).toBuffer()); } } + } else if (e.key === "n") { + if (ws && ready && selfCursor) { + localStorage["t00mp_cursorStyle"] = selfCursor.element.style.visibility = selfCursor.element.style.visibility === "hidden" ? "" : "hidden"; + } } } @@ -279,6 +285,8 @@ if (!window.TE_ACTIVE) { ws.onopen = () => { selfCursor = new RemoteClient(username); selfCursor.probeImage.style.visibility = "hidden"; + selfCursor.element.style.visibility = localStorage["t00mp_cursorStyle"] ?? "hidden"; + selfCursor.hasBeenMoved = true; const currentPage = window.location.href.split("/").slice(3).join("/"); ws.send(createWriter(Endian.LE, 4 + username.length + currentPage.length).writeByte(MessageType.ClientDetails).writeShortString(username).writeString(currentPage).toBuffer()); keepAliveInterval = setInterval(() => {