diff options
author | Peter Grassberger <petertheone@gmail.com> | 2016-01-01 17:26:34 (GMT) |
---|---|---|
committer | Peter Grassberger <petertheone@gmail.com> | 2016-01-01 17:26:34 (GMT) |
commit | b508322f56292b0d4d9fbf41389a1c0fee5befdf (patch) | |
tree | dff0171f80d7875d87af092c23e8bdc7ee046e1d /www/js/musicgrid.js | |
parent | 91e18a8859806ba096825f9d44401b8e6469676f (diff) |
musicgrid: title hover, set font color dependent on background
Diffstat (limited to 'www/js/musicgrid.js')
-rw-r--r-- | www/js/musicgrid.js | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/www/js/musicgrid.js b/www/js/musicgrid.js index 695bca4..70722d0 100644 --- a/www/js/musicgrid.js +++ b/www/js/musicgrid.js @@ -63,13 +63,18 @@ Musicgrid.prototype.fetch = function() { Musicgrid.prototype.updateTable = function() { var $table = $('#app-musicgrid table'); + $('tr td', $table).html('').css('background-color', '').css('color', '').attr('title', null); $(this.clocks).each(function(index, clock) { var $td = $('tr[data-dow="' + clock.dow + '"] td[data-hour="' + clock.hour +'"]', $table); - var $div = $('<div>' + clock.name + '<br />' + clock.title + '</div>'); - $div.css('background-color', clock.color); + $td.html(clock.name); + $td.attr('title', clock.title); + $td.css('background-color', clock.color); + if($td.isBackgroundDark()) { + $td.css('color', '#ffffff'); + } + // todo: move this css to stylesheet - $div.css('text-align', 'center'); - $td.html($div); + $td.css('text-align', 'center'); }); }; |