From 824c884ed3f2ff85b78cea05a47cb69197691635 Mon Sep 17 00:00:00 2001 From: elijahr2411 Date: Sun, 5 Feb 2023 12:02:24 -0500 Subject: [PATCH] autotype --- dist/index.html | 1 + src/index.js | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/dist/index.html b/dist/index.html index bef2901..71cf533 100644 --- a/dist/index.html +++ b/dist/index.html @@ -87,6 +87,7 @@ +
diff --git a/src/index.js b/src/index.js index 3db946e..7f229a8 100644 --- a/src/index.js +++ b/src/index.js @@ -17,6 +17,7 @@ const buttons = { changeUsername: window.document.getElementById("changeUsernameBtn"), voteReset: window.document.getElementById("voteResetButton"), screenshot: window.document.getElementById("screenshotButton"), + autotype: window.document.getElementById("autotypebtn"), // Staff restore: window.document.getElementById("restoreBtn"), reboot: window.document.getElementById("rebootBtn"), @@ -487,6 +488,13 @@ class CollabVMClient { voteReset(reset) { this.socket.send(guacutils.encode(["vote", reset ? "1" : "0"])); } + autotype(str) { + for (var i = 0; i < str.length; i++) { + var key = GetKeysym(null, null, str[i], null); + this.key(key, true); + this.key(key, false); + } + } admin = { login: (password) => { return new Promise((res, rej) => { @@ -742,6 +750,11 @@ buttons.ctrlAltDel.addEventListener('click', () => { }); voteyesbtn.addEventListener('click', () => vm.voteReset(true)); votenobtn.addEventListener('click', () => vm.voteReset(false)); +buttons.autotype.addEventListener('click', () => { + var h = window.prompt("Enter string to type"); + if (!h) return; + vm.autotype(h); +}) // Staff buttons buttons.restore.addEventListener('click', () => vm.admin.restore()); buttons.reboot.addEventListener('click', () => vm.admin.reboot());