Merge pull request #4 from danieladov/master

Fieldsets and new JSON structure support
This commit is contained in:
Prayag
2020-12-21 19:49:17 +05:30
committed by GitHub

View File

@@ -57,10 +57,12 @@
} }
function loadOptions(skin){ function loadOptions(skin){
var options = skin.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);
categorie.options.forEach(element=>{
if(element.type == "checkBox"){ if(element.type == "checkBox"){
html += getCheckBox(element); html += getCheckBox(element);
}else if(element.type == "colorPicker"){ }else if(element.type == "colorPicker"){
@@ -71,10 +73,12 @@
html += getSelector(element); html += getSelector(element);
}else if(element.type == "slider"){ }else if(element.type == "slider"){
html += getSlider(element); html += getSlider(element);
}else if(element.type == "section"){
html += getSection(element);
} }
}); });
})
html += loadPreviews(skin); html += loadPreviews(skin);
html += '</div>'; html += '</div>';
$('#options').html(html).trigger('create'); $('#options').html(html).trigger('create');
@@ -159,8 +163,9 @@
var css = option.css; var css = option.css;
selections.forEach(element=>{ selections.forEach(element=>{
var name = element.name; var name = element.name;
var value = element.value;
var selected = saved==name?'selected="selected"' : ""; var selected = saved==name?'selected="selected"' : "";
html+= '<option data-css= "'+css + '"value='+name+'" '+ selected+'>'+ name +'</option>' html+= '<option data-css= "'+css + '"value='+value+'" '+ selected+'>'+ name +'</option>'
}) })
return html; return html;
} }
@@ -190,9 +195,8 @@
return html; return html;
} }
function getSection(option){ function getSection(name){
var html = ""; var html = "";
var name = option.name;
html += '</fieldset>'; html += '</fieldset>';
html += '<fieldset class="verticalSection verticalSection-extrabottompadding">'; html += '<fieldset class="verticalSection verticalSection-extrabottompadding">';
html += '<legend>'+ name +'</legend>'; html += '<legend>'+ name +'</legend>';