From 80aa1737af97b39aefb0250d8fa3291f5406531a Mon Sep 17 00:00:00 2001 From: BlueAndi Date: Thu, 15 Aug 2024 16:12:50 +0200 Subject: [PATCH] Use similar style for the plugin slots too. --- data/display.html | 100 +++++++++++++++++++++++++++++++++++++------ data/style/style.css | 4 +- 2 files changed, 90 insertions(+), 14 deletions(-) diff --git a/data/display.html b/data/display.html index ceafce9a..4df85793 100644 --- a/data/display.html +++ b/data/display.html @@ -415,10 +415,19 @@

Display

var $divSlots = $("#divSlots"); var $divSlot = null; var $header = null; + var $spanAlias = null; var $inputAlias = null; + var $inputGroupAlias = null; + var $divDuration = null; var $inputDuration = null; + var $divDuration = null; + var $durationUnit = null; var $dragableSlot = null; + var dragableSlotId = ""; + var pluginName = ""; + var pluginUid = ""; var pluginAlias = ""; + var inputAliasDisabled = false; $divSlots.empty(); for(index = 0; index < rsp.slots.length; ++index) { @@ -449,15 +458,24 @@

Display

$header.append("Slot " + index + "
"); $inputDuration = $("") + .attr("class", "form-control") .attr("id", "duration" + index) .attr("type", "number") .attr("value", rsp.slots[index].duration / 1000) .attr("min", "1") .attr("max", "3600") .attr("onchange", "setDuration(" + index + ")"); + + $durationUnit = $("") + .attr("class", "input-group-text") + .append("[s]"); - $header.append($inputDuration); - $header.append("[s]"); + $divDuration = $("
") + .attr("class", "input-group") + .append($inputDuration) + .append($durationUnit); + + $header.append($divDuration); $divSlot.append($header); @@ -472,32 +490,84 @@

Display

} if (0 == rsp.slots[index].name.length) { - $dragableSlot.attr("id", "A" + index); - $dragableSlot.append("-
UID -
Alias -"); + dragableSlotId = "A" + index; + inputAliasId = "aliasA" + index; + pluginName = "-"; + pluginUid = "-"; + pluginAlias = "-"; + } else { - $dragableSlot.attr("id", rsp.slots[index].uid); - $dragableSlot.append(rsp.slots[index].name + "
UID " + rsp.slots[index].uid); + dragableSlotId = rsp.slots[index].uid; + inputAliasId = "alias" + rsp.slots[index].uid; + pluginName = rsp.slots[index].name; + pluginUid = rsp.slots[index].uid; + pluginAlias = "-"; if (0 === rsp.slots[index].alias.length) { pluginAlias = ""; } else { pluginAlias = rsp.slots[index].alias; } + } + + $dragableSlot.attr("id", dragableSlotId); + + $spanAlias = $("") + .attr("class", "input-group-text") + .append("Alias:"); + + if (0 == rsp.slots[index].name.length) { + $inputAlias = $("") + .attr("class", "input-group-text") + .attr("style", "width: 8em;") + .append(pluginAlias) + } else { $inputAlias = $("") - .attr("id", "alias" + rsp.slots[index].uid) + .attr("class", "form-control") + .attr("id", inputAliasId) .attr("type", "text") .attr("value", pluginAlias) .attr("size", "8") .attr("minlength", "0") .attr("maxlength", "8") - .attr("onchange", "setAlias(" + rsp.slots[index].uid + ")"); - - $dragableSlot.append("
Alias "); - $dragableSlot.append($inputAlias); + .attr("onchange", "setAlias(" + pluginUid + ")"); } - $divSlot.append($dragableSlot); + $inputGroupAlias = $("
") + .attr("class", "input-group") + .append($spanAlias) + .append($inputAlias); + + var $divCol11 = $("
") + .attr("class", "col") + .append(pluginName); + var $divCol21 = $("
") + .attr("class", "col") + .append("UID: " + pluginUid); + var $divCol31 = $("
") + .attr("class", "col") + .append($inputGroupAlias); + + var $divRow1 = $("
") + .attr("class", "row") + .append($divCol11); + var $divRow2 = $("
") + .attr("class", "row") + .append($divCol21); + var $divRow3 = $("
") + .attr("class", "row") + .append($divCol31); + + var $divContainer = $("
") + .attr("class", "container text-center") + .append($divRow1) + .append($divRow2) + .append($divRow3); + + $dragableSlot.append($divContainer); + + $divSlot.append($dragableSlot); $divSlots.append($divSlot); } @@ -512,6 +582,12 @@

Display

$divSlot.append($header); + var $divUninstall = $("

") + .attr("class", "dragableSlot") + .text("Drop the plugin here to uninstall it."); + + $divSlot.append($divUninstall); + $divSlots.append($divSlot); }); } diff --git a/data/style/style.css b/data/style/style.css index 1f841693..282eba06 100644 --- a/data/style/style.css +++ b/data/style/style.css @@ -45,8 +45,8 @@ code { } div.divSlot { - height: 12em; - width: 12em; + height: fit-content; + width: fit-content; border: 2px solid #666666; background-color: #ccc; margin-right: 5px;