diff --git a/web/js/confighandler.js b/web/js/confighandler.js index 5372dd8..533b524 100644 --- a/web/js/confighandler.js +++ b/web/js/confighandler.js @@ -45,9 +45,25 @@ function populateFields(data, prefix = "") { let id = `${prefix}${prefix ? "-" : ""}${key}`; const $element = $(`#${id}`); + if (key === "plugins" && $element.is('select[multiple]')) { + if (Array.isArray(value)) { + $element.find('option').each(function() { + const $option = $(this); + const dataName = $option.data('name'); + if (value.includes(dataName)) { + $option.prop('selected', true); + } else { + $option.prop('selected', false); + } + }); + + $element.trigger('change'); + } + return; + } + if (typeof value === "object" && value !== null) { if (Array.isArray(value)) { - // Handle arrays correctly value.forEach((item, index) => { const arrayId = `${id}-${index + 1}`; const $arrayElement = $(`#${arrayId}`); @@ -60,7 +76,6 @@ function populateFields(data, prefix = "") { }); return; } else { - // Handle nested objects populateFields(value, id); return; } @@ -107,7 +122,7 @@ function updateConfigData(data, prefix = "") { data[key] = []; const $selectedOptions = $element.find('option:selected'); $selectedOptions.each(function() { - const dataName = $(this).data('name'); + const dataName = $(this).attr('data-name'); if (dataName) { data[key].push(dataName); } diff --git a/web/setup.ejs b/web/setup.ejs index 28c5194..5c1a3d9 100644 --- a/web/setup.ejs +++ b/web/setup.ejs @@ -33,8 +33,8 @@
  • Identification & Map
  • -
  • - Plugins +
  • + Plugins
  • User management @@ -297,28 +297,6 @@ -
    -

    Plugins

    -
    -

    Plugin list

    -

    Any compatible .js plugin, which is in the "plugins" folder, will be listed here.
    - Click on the individual plugins to enable/disable them.

    -

    - Download new plugins here! -
    - -
    -

    Plugin settings

    -
    No plugin settings are available.
    -
    -
    -

    Tuner settings

    @@ -408,13 +386,13 @@
    -
    +

    Plugins

    Plugin list

    Any compatible .js plugin, which is in the "plugins" folder, will be listed here.
    Click on the individual plugins to enable/disable them.

    - <% plugins.forEach(function(plugin) { %>