summaryrefslogtreecommitdiff
path: root/web/static
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
parent95da529c1ff1d9df619e28c0de2c39f21fa1dffb (diff)
downloaddartboat-3a3f1d129896fad749cf802b41e72d8fc05f0cb8.tar.gz
dartboat-3a3f1d129896fad749cf802b41e72d8fc05f0cb8.tar.xz
web: support quick rematch, fix checkout points
Diffstat (limited to 'web/static')
-rw-r--r--web/static/dartboat.js49
-rw-r--r--web/static/index.html6
-rw-r--r--web/static/style.css4
3 files changed, 34 insertions, 25 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');
});
diff --git a/web/static/index.html b/web/static/index.html
index f986ee9..7fda38c 100644
--- a/web/static/index.html
+++ b/web/static/index.html
@@ -43,9 +43,9 @@
<div onclick="promptHandle('append', '9')" class="key num">9</div>
<div onclick="promptHandle('clear')" class="key">CLEAR</div>
<div onclick="promptHandle('append', '0')" class="key num">0</div>
- <div onclick="promptHandle('submit')" class="key ok">OK</div>
- <div onclick="promptHandle('undo')" class="key" id="key_undo">UNDO</div>
- <div onclick="promptHandle('submit_rem')" class="key">REMAINING</div>
+ <div onclick="promptHandle('submit')" class="key" id="key-submit">OK</div>
+ <div onclick="promptHandle('undo')" class="key" id="key-undo">UNDO</div>
+ <div onclick="promptHandle('rem')" class="key" id="key-rem">REMAINING</div>
</div>
<div id="keypad-select_mode" class="keypad">
<div onclick="promptHandle('append', '1'); promptHandle('submit')" class="key"><span class="keyboard-val">[1]</span> Play against bot</div>
diff --git a/web/static/style.css b/web/static/style.css
index 475f726..e22c4ce 100644
--- a/web/static/style.css
+++ b/web/static/style.css
@@ -222,10 +222,8 @@ div.key.num {
font-weight: 700;
}
-div.key.ok {
+div.key#key-submit {
grid-row-end: span 2;
-
- font-size: 2.5em;
}
div#settings-bar {