commit eed7ec41fc66a408e46995e91d9bcc312798d95c
parent 14d766e075cae9e91aace82c131c5c7b3d27fffb
Author: tongong <tongong@gmx.net>
Date: Sat, 15 Jan 2022 19:47:53 +0100
added blind toggle
Diffstat:
3 files changed, 25 insertions(+), 2 deletions(-)
diff --git a/src/components/page-input.js b/src/components/page-input.js
@@ -1,15 +1,27 @@
const m = require("mithril");
+const input = require("../modules/input.js");
const keyBoxes = require("./key-boxes.js");
module.exports = () => {
let written = "> ";
+ let blind = false;
let oninput = (c) => {
written += c;
- }
+ // clear input on "-" -> new bullet point / new thought
+ if (c == "-") written = "> ";
+ };
+ let blindhandler = (e) => {
+ if (e.key == input.blindkey) blind = !blind;
+ m.redraw();
+ };
return {
view: () => m("div",
m("div.inputTop", written),
- m("div.inputBottom", m(keyBoxes, {inputCallback: oninput}))
+ m("div.inputBottom", m(keyBoxes, {
+ inputCallback: oninput,
+ keyCallback: blindhandler
+ })),
+ m(".blindOverlay", {class: blind? "" : "invisible"})
)
}
};
diff --git a/src/modules/input.js b/src/modules/input.js
@@ -1,6 +1,7 @@
// maybe add a configuration option for this later
const keys = ["j", "k", "l"];
const hintkey = "h";
+const blindkey = "b";
/* pressed is an array of pressed indizes from one gesture */
function pressed2gesture(pressed) {
@@ -46,6 +47,7 @@ function gestures2char(gestures) {
module.exports = {
keys,
hintkey,
+ blindkey,
pressed2gesture,
gestures2char
}
diff --git a/src/styles.css b/src/styles.css
@@ -99,6 +99,15 @@ h1 {
width: 100%;
height: 60%;
}
+.blindOverlay {
+ position: fixed;
+ top: 0;
+ left: 0;
+ width: 100vw;
+ height: 100vh;
+ background-color: #222;
+ z-index: 50000;
+}
/* trainer page */
.trainerTop {