diff --git a/commander.html b/commander.html
index ce92f74..6860812 100644
--- a/commander.html
+++ b/commander.html
@@ -26,9 +26,9 @@
height: 200px;
}
.btn {
- padding: 10px 20px;
- background-color: #808080;
+ padding: 5px 10px;
cursor: pointer;
+ display: inline-block;
}
@@ -46,6 +46,7 @@
+ bootjes
| id |
naam |
@@ -56,6 +57,7 @@
+ clients
| id |
boat |
@@ -191,7 +193,7 @@
if (boatRow.dataset['state'] == "locked")
{
lockBtn.innerHTML = openIcon;
- lockBtn.addEventListener('click', unlockBoat);
+ lockBtn.addEventListener('click', freeBoat);
}
else
{
@@ -224,36 +226,6 @@
}
}
- function getDataFomEl(el)
- {
- while (el.tagName != "BODY" && el.dataset['id'] == null)
- {
- el = el.parentElement;
- }
- return el.dataset;
- }
-
- function kickClient(e)
- {
- let client = getDataFomEl(e.target);
- console.log("kickClient", client);
- conn.send(passEl.value + ";kick;" + client['id']);
- }
-
- function unlockBoat(e)
- {
- let boat = getDataFomEl(e.target);
- console.log("unlockBoat", boat);
- conn.send(passEl.value + ";unlock;" + boat['id']);
- }
-
- function lockBoat(e)
- {
- let boat = getDataFomEl(e.target);
- console.log("lockBoat", boat);
- conn.send(passEl.value + ";lock;" + boat['id']);
- }
-
function addClient(client)
{
client = client.split(';')
@@ -288,6 +260,36 @@
{
console.warn("addClient(): incorect number of args (" + client.length.toString() + "; " + client.toString() + ")");
}
+
+ function getDataFomEl(el)
+ {
+ while (el.tagName != "BODY" && el.dataset['id'] == null)
+ {
+ el = el.parentElement;
+ }
+ return el.dataset;
+ }
+
+ function kickClient(e)
+ {
+ let client = getDataFomEl(e.target);
+ console.log("kickClient", client);
+ conn.send(passEl.value + ";kick;" + client['id']);
+ }
+
+ function freeBoat(e)
+ {
+ let boat = getDataFomEl(e.target);
+ console.log("unlockBoat", boat);
+ conn.send(passEl.value + ";free;" + boat['id']);
+ }
+
+ function lockBoat(e)
+ {
+ let boat = getDataFomEl(e.target);
+ console.log("lockBoat", boat);
+ conn.send(passEl.value + ";lock;" + boat['id']);
+ }
}