commander update

This commit is contained in:
2024-08-12 19:53:15 +02:00
parent 8619022374
commit 8b0735fca2
2 changed files with 44 additions and 38 deletions

View File

@@ -26,9 +26,9 @@
height: 200px;
}
.btn {
padding: 10px 20px;
background-color: #808080;
padding: 5px 10px;
cursor: pointer;
display: inline-block;
}
</style>
</head>
@@ -46,6 +46,7 @@
</div>
<table>
<thead>
<caption>bootjes</caption>
<tr>
<th>id</th>
<th>naam</th>
@@ -56,6 +57,7 @@
</table>
<table>
<thead>
<caption>clients</caption>
<tr>
<th>id</th>
<th>boat</th>
@@ -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']);
}
}
</script>
</body>