autotype
This commit is contained in:
parent
38ce523e7c
commit
824c884ed3
2 changed files with 14 additions and 0 deletions
1
dist/index.html
vendored
1
dist/index.html
vendored
|
@ -87,6 +87,7 @@
|
|||
<button class="btn btn-secondary" id="voteResetButton"><i class="fa-solid fa-rotate-left"></i> Vote for Reset</button>
|
||||
<button class="btn btn-secondary" id="screenshotButton"><i class="fa-solid fa-camera"></i> Screenshot</button>
|
||||
<button class="btn btn-secondary" id="ctrlAltDelBtn"><i class="fa-solid fa-gear"></i> Ctrl+Alt+Del</button>
|
||||
<button class="btn btn-secondary" id="autotypebtn">Autotype</button>
|
||||
<div id="staffbtns">
|
||||
<button class="btn btn-secondary" id="restoreBtn"><i class="fa-solid fa-rotate-left"></i> Restore</button>
|
||||
<button class="btn btn-secondary" id="rebootBtn"><i class="fa-solid fa-power-off"></i> Reboot</button>
|
||||
|
|
13
src/index.js
13
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());
|
||||
|
|
Loading…
Reference in a new issue