summaryrefslogtreecommitdiff
path: root/web/static/dartboat.js
diff options
context:
space:
mode:
authorDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2022-04-26 17:23:52 -0700
committerDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2022-04-26 17:23:52 -0700
commit3a3f1d129896fad749cf802b41e72d8fc05f0cb8 (patch)
treeec354f2da529b73128405e5833f5a45f4992b112 /web/static/dartboat.js
parent95da529c1ff1d9df619e28c0de2c39f21fa1dffb (diff)
downloaddartboat-3a3f1d129896fad749cf802b41e72d8fc05f0cb8.tar.gz
dartboat-3a3f1d129896fad749cf802b41e72d8fc05f0cb8.tar.xz
web: support quick rematch, fix checkout points
Diffstat (limited to 'web/static/dartboat.js')
-rw-r--r--web/static/dartboat.js49
1 files changed, 30 insertions, 19 deletions
diff --git a/web/static/dartboat.js b/web/static/dartboat.js
index f0855c2..da59e59 100644
--- a/web/static/dartboat.js
+++ b/web/static/dartboat.js
@@ -38,24 +38,28 @@ function promptClear() {
document.getElementById('prompt-input').textContent = '';
}
-function isUndoActive() {
- return document.getElementById('key_undo').classList.contains('active');
+function setPromptActive() {
+ document.getElementById('prompt').classList.add('active')
}
-function toggleUndo() {
- document.getElementById('key_undo').classList.toggle('active');
+function setPromptInactive() {
+ document.getElementById('prompt').classList.remove('active')
}
-function deactivateUndo() {
- document.getElementById('key_undo').classList.remove('active');
+function setPromptInput(ptr) {
+ document.getElementById('prompt-input').textContent = UTF8ToString(ptr);
}
-function setPromptActive() {
- document.getElementById('prompt').classList.add('active')
+function promptMsgL(p) {
+ document.getElementById('prompt-msg-l').textContent = UTF8ToString(p);
}
-function setPromptInactive() {
- document.getElementById('prompt').classList.remove('active')
+function promptMsgR(p) {
+ document.getElementById('prompt-msg-r').textContent = UTF8ToString(p);
+}
+
+function promptHandle(action, data) {
+ Module.ccall('prompt_handle', null, ['string', 'string'], [action, data]);
}
function setKeypad(keypad) {
@@ -65,20 +69,27 @@ function setKeypad(keypad) {
});
}
-function promptHandle(action, data) {
- Module.ccall('prompt_handle', null, ['string', 'string'], [action, data]);
+function isKeyActive(k) {
+ return document.getElementById(`key-${UTF8ToString(k)}`).classList
+ .contains('active');
}
-function setPromptInput(ptr) {
- document.getElementById('prompt-input').textContent = UTF8ToString(ptr);
+function toggleKey(k) {
+ document.getElementById(`key-${UTF8ToString(k)}`).classList
+ .toggle('active');
}
-function promptMsgL(p) {
- document.getElementById('prompt-msg-l').textContent = UTF8ToString(p);
+function deactivateKey(k) {
+ document.getElementById(`key-${UTF8ToString(k)}`).classList
+ .remove('active');
}
-function promptMsgR(p) {
- document.getElementById('prompt-msg-r').textContent = UTF8ToString(p);
+function setKeyLabelSubmit(ptr) {
+ document.getElementById('key-submit').textContent = UTF8ToString(ptr);
+}
+
+function setKeyLabelRem(ptr) {
+ document.getElementById('key-rem').textContent = UTF8ToString(ptr);
}
function setPlayerActive(n) {
@@ -186,7 +197,7 @@ document.addEventListener('keydown', e => {
else if (e.key == 'c')
promptHandle('clear');
else if (e.key == 'r')
- promptHandle('submit_rem');
+ promptHandle('rem');
else if (e.key == 'u')
promptHandle('undo');
});