add unused presets

This commit is contained in:
j 2018-12-05 12:50:08 +01:00
parent 5ddc19a267
commit 8033e98f20
2 changed files with 8 additions and 2 deletions

View File

@ -96,7 +96,7 @@
<h2>Edit:</h2> <h2>Edit:</h2>
<li><button class="delete">delete row</button></li> <li><button class="delete">delete row</button></li>
<li><button class="insert">insert row</button></li> <li><button class="insert">insert row</button></li>
<li><button class="all_presets">load all presets</button></li> <li><button class="all_presets">add unused presets</button></li>
<li>Global Speed: <input type="text" style="width:30px" value="20" class="default_speed"><button class="set_speed">set</button></li> <li>Global Speed: <input type="text" style="width:30px" value="20" class="default_speed"><button class="set_speed">set</button></li>
<h2>Export:</h2> <h2>Export:</h2>
<li><a><button class="export_sequence">export sequence</button></a></li> <li><a><button class="export_sequence">export sequence</button></a></li>

View File

@ -483,12 +483,18 @@ $('button.export_presets').on({click: function() {
$('button.all_presets').on({click: function() { $('button.all_presets').on({click: function() {
api('getPresets', {}, function(response) { api('getPresets', {}, function(response) {
presets = response.result.presets presets = response.result.presets
loadData(presets.map(function(preset) { var seq = [].concat(data, presets.filter(function(preset) {
return data.filter(function(row) {
return row.preset == preset.id
}).length == 0
}).map(function(preset) {
return { return {
preset: preset.id, preset: preset.id,
speed: parseInt($('input.default_speed').val(), 10) speed: parseInt($('input.default_speed').val(), 10)
} }
})) }))
loadData(seq)
}) })
}}) }})