diff options
| author | Yuval Adam <yuv.adm@gmail.com> | 2014-05-30 15:27:34 +0300 |
|---|---|---|
| committer | Yuval Adam <yuv.adm@gmail.com> | 2014-05-30 15:27:34 +0300 |
| commit | 7d920311e8d6e5146035562a4f7a8679572184b3 (patch) | |
| tree | 0713fa89363aa850d8900cbc6fa050a11adf1ec8 /templates | |
| parent | 8b808b8592b19532602821368b64acdcf534b223 (diff) | |
Preloading works
Diffstat (limited to 'templates')
| -rw-r--r-- | templates/home.html | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/templates/home.html b/templates/home.html index 0255309..639d677 100644 --- a/templates/home.html +++ b/templates/home.html @@ -13,11 +13,25 @@ <script> function load_data() { $.get('/data', function(res) { - console.log(res); + console.log('Loading: ', res); $('#speed-slider').slider({ tooltip: 'always', value: res.tempo }); + + _.each(res.trees, function(tree, i) { + var $tree = $('div[data-light-tree=' + i + ']'); + _.each(tree, function(channel, j) { + var $channel = $tree.find('div[data-light-channel=' + j + ']'); + _.each(channel, function(cell, k) { + var $cell = $channel.find('button[data-light-cell=' + k + ']'); + if (cell) { + $cell.addClass('active'); + console.log(i, j, k); + } + }); + }); + }); }); }; @@ -108,7 +122,7 @@ <div class="light-tree" data-light-tree="<%= i %>"> <h3>Tree <%= i %></h3> <% _.each(_.range(channels), function(j) { %> - <div class="light-row" data-light-row="<%= j %>"> + <div class="light-row" data-light-channel="<%= j %>"> <span>Channel <%= j %></span> <% _.each(_.range(cells), function(k) { %> <button type="button" class="btn btn-success light-cell-btn" data-toggle="button" data-light-cell="<%= k %>"> </button> |
