support opening the popper with the g key

This commit is contained in:
Holly Stubbs 2024-04-26 17:34:34 +01:00
parent d9a827aba1
commit f35b8679de
Signed by: tgpholly
GPG key ID: B8583C4B7D18119E

View file

@ -1,10 +1,11 @@
// ==UserScript== // ==UserScript==
// @name Terminal 00 Multiuser // @name MultiProbe
// @namespace https://*.angusnicneven.com/* // @namespace https://*.angusnicneven.com/*
// @version 20240426.2 // @version 20240426.3
// @description Probe with friends! // @description Probe with friends!
// @author tgpholly // @author tgpholly
// @match https://*.angusnicneven.com/* // @match https://*.angusnicneven.com/*
// @match https://*.heavenonline.xyz/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=angusnicneven.com // @icon https://www.google.com/s2/favicons?sz=64&domain=angusnicneven.com
// @grant none // @grant none
// ==/UserScript== // ==/UserScript==
@ -36,7 +37,7 @@ if (!window.TE_ACTIVE) {
'use strict'; 'use strict';
// Make sure to change the userscript version too!!!!!!!!!! // Make sure to change the userscript version too!!!!!!!!!!
const USERSCRIPT_VERSION_RAW = "20240426.2"; const USERSCRIPT_VERSION_RAW = "20240426.3";
const USERSCRIPT_VERSION = parseInt(USERSCRIPT_VERSION_RAW.replace(".", "")); const USERSCRIPT_VERSION = parseInt(USERSCRIPT_VERSION_RAW.replace(".", ""));
if (!continueRunningScript) { if (!continueRunningScript) {
@ -262,6 +263,7 @@ kbd {
} }
}, 1000); }, 1000);
let needsToUpdate = false;
const versionFetchAddress = window.location.href.replace("127.0.0.1", "localhost").includes("//localhost:") ? "http://localhost:38194/api/version" : "https://multiprobe.eusv.net/api/version"; const versionFetchAddress = window.location.href.replace("127.0.0.1", "localhost").includes("//localhost:") ? "http://localhost:38194/api/version" : "https://multiprobe.eusv.net/api/version";
fetch(versionFetchAddress, { method: "post" }).then(response => { fetch(versionFetchAddress, { method: "post" }).then(response => {
console.log("hi"); console.log("hi");
@ -269,6 +271,7 @@ kbd {
const versionNumber = parseInt(versionNumberRaw); const versionNumber = parseInt(versionNumberRaw);
if (versionNumber > USERSCRIPT_VERSION) { if (versionNumber > USERSCRIPT_VERSION) {
// We're out of date >:( // We're out of date >:(
needsToUpdate = true;
createUpdateDialog(`${versionNumberRaw.slice(0, versionNumberRaw.length - 1)}.${versionNumberRaw.slice(-1)}`); createUpdateDialog(`${versionNumberRaw.slice(0, versionNumberRaw.length - 1)}.${versionNumberRaw.slice(-1)}`);
} }
}); });
@ -402,6 +405,10 @@ kbd {
if (ws && ready && selfCursor) { if (ws && ready && selfCursor) {
localStorage["t00mp_cursorStyle"] = selfCursor.element.style.visibility = selfCursor.element.style.visibility === "hidden" ? "" : "hidden"; localStorage["t00mp_cursorStyle"] = selfCursor.element.style.visibility = selfCursor.element.style.visibility === "hidden" ? "" : "hidden";
} }
} else if (e.key === "g") {
if (ws && ready && selfCursor) {
groupPopper.click();
}
} }
} }
@ -484,6 +491,9 @@ kbd {
windowContainer.remove(); windowContainer.remove();
windowContainer = null; windowContainer = null;
} }
if (!needsToUpdate) {
createFirstTimeDialog();
}
break; break;
} }
case MessageType.ClientJoined: case MessageType.ClientJoined:
@ -669,6 +679,10 @@ kbd {
nameLI.innerHTML = "You can show/hide your own name for screenshots by pressing <kbd>N</kbd>"; nameLI.innerHTML = "You can show/hide your own name for screenshots by pressing <kbd>N</kbd>";
actionList.appendChild(nameLI); actionList.appendChild(nameLI);
const groupLI = document.createElement("li");
groupLI.innerHTML = "You can show/hide the party sidebar if you are in one by pressing <kbd>G</kbd>";
actionList.appendChild(groupLI);
const buttons = document.createElement("div"); const buttons = document.createElement("div");
buttons.style.marginTop = "1rem"; buttons.style.marginTop = "1rem";