diff options
| -rw-r--r-- | templates/home.html | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/templates/home.html b/templates/home.html index 2caf751..af51211 100644 --- a/templates/home.html +++ b/templates/home.html @@ -19,15 +19,26 @@ function save_data(data) { - $('.light-channel').each(function(_, channel) { - channel = $(channel); - channel.find('.light-row').each(function(_, row) { - var vals = $(row).find('.light-cell-btn').map(function(x) { return $(x).hasClass('active') ? 1 : 0; }); - console.log(_.values(vals)); + var data = { + tempo: 500, + trees: [] + }; + + $('.light-tree').each(function(_idx, tree) { + tree = $(tree); + var tree_data = [] + tree.find('.light-row').each(function(_idx, row) { + var vals = $(row).find('.light-cell-btn').toArray().map(function(x) { + return x.className.contains('active') ? 1 : 0; + }); + tree_data.push(vals); }); - console.log(channel.attr('data-light-channel')); + data.trees.push(tree_data); + // console.log(tree.attr('data-light-tree')); }); + console.log(data); + $.ajax({ type: 'POST', contentType: 'application/json', |
