Fix load and save config

This commit is contained in:
Mister Rajoy
2020-12-22 16:23:08 +01:00
parent addca19af3
commit 50164fe5af

View File

@@ -307,11 +307,15 @@
count ++; count ++;
} }
var options = skin.options;
var savedOptions = config.options; var savedOptions = config.options;
var html = ""; var html = "";
html += '<div data-role="controlgroup">'; html += '<div data-role="controlgroup">';
options.forEach(element=>{ skin.categories.forEach(categorie=>{
html+=getSection(categorie.name);
var options = categorie.options;
options.forEach(element=>{
var savedValue = undefined; var savedValue = undefined;
var count = 0; var count = 0;
savedOptions.forEach(savedOption => { savedOptions.forEach(savedOption => {
@@ -330,10 +334,11 @@
html += getSelector(element,savedValue); html += getSelector(element,savedValue);
}else if(element.type == "slider"){ }else if(element.type == "slider"){
html += getSlider(element,savedValue); html += getSlider(element,savedValue);
}else if(element.type == "section"){
html += getSection(element,savedValue);
} }
}); });
})
html += loadPreviews(skin); html += loadPreviews(skin);
html += '</div>'; html += '</div>';
$('#options').html(html).trigger('create'); $('#options').html(html).trigger('create');
@@ -345,11 +350,13 @@
var options = []; var options = [];
var count = 0; var count = 0;
data[document.getElementById("cssOptions").selectedIndex].options.forEach(option => { data[document.getElementById("cssOptions").selectedIndex].categories.forEach(categorie=>{
options[count] = option.css; categorie.options.forEach(option => {
options[count +1 ] = getValue(option); options[count] = option.css;
count += 2; options[count +1 ] = getValue(option);
}); count += 2;
});
})
config.options = options; config.options = options;
ApiClient.getPluginConfiguration(pluginId).then(function (oldConfig){ ApiClient.getPluginConfiguration(pluginId).then(function (oldConfig){