mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-15 10:02:47 +03:00
added popdown and autofocus to command palette
This commit is contained in:
parent
78c4d2063d
commit
ea180d7416
@ -26,32 +26,42 @@ function doSub() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var palette = false;
|
||||||
|
|
||||||
window.addEventListener("message", (event) => {
|
window.addEventListener("message", (event) => {
|
||||||
let popup = document.getElementById("popup");
|
let popup = document.getElementById("popup");
|
||||||
let input = document.getElementById("input");
|
let input = document.getElementById("input");
|
||||||
|
|
||||||
popup.style = "position:absolute; left: 0; top: 0; display:block; width: 100%; height: 100%; margin: 0 0; background-color:white;";
|
if (palette) {
|
||||||
input.style = "";
|
palette = false;
|
||||||
input.addEventListener("keyup", (e) => {
|
|
||||||
if (e.keyCode !== 13) { return; }
|
|
||||||
popup.style = "display:hidden;";
|
popup.style = "display:hidden;";
|
||||||
popup.style = "visibility:hidden !important;";
|
input.style = "visibility:hidden !important;";
|
||||||
|
input.value = "";
|
||||||
|
} else {
|
||||||
|
palette = true;
|
||||||
|
|
||||||
window.urb.poke(window.ship, "modulo", "modulo-command",
|
popup.style = "position:absolute; left: 0; top: 0; display:block; width: 100%; height: 100%; margin: 0 0; background-color:white;";
|
||||||
{
|
input.style = "";
|
||||||
go: input.value
|
input.focus();
|
||||||
},
|
input.addEventListener("keyup", (e) => {
|
||||||
(json) => {
|
if (e.keyCode !== 13) { return; }
|
||||||
console.log(json);
|
popup.style = "display:hidden;";
|
||||||
},
|
popup.style = "visibility:hidden !important;";
|
||||||
(err) => {
|
|
||||||
console.log(err);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
|
window.urb.poke(window.ship, "modulo", "modulo-command",
|
||||||
|
{
|
||||||
|
go: input.value
|
||||||
|
},
|
||||||
|
(json) => {
|
||||||
|
console.log(json);
|
||||||
|
},
|
||||||
|
(err) => {
|
||||||
|
console.log(err);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
setFrame();
|
setFrame();
|
||||||
|
Loading…
Reference in New Issue
Block a user