X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=TreeOfTexts%2Froot%2Fjs%2Finteraction.js;h=68ccd34b6df2ab33ac8ffe5834c2ad6a3adfc1fe;hb=0a8f09a9a3eb1cb6861db715c2b6ed43e1e11402;hp=2bda2a7140147b9b840a50fda7aa4235d4712324;hpb=6b87033c3ed6c5f27e66eec6e7f5f30324fd4909;p=scpubgit%2Fstemmatology.git diff --git a/TreeOfTexts/root/js/interaction.js b/TreeOfTexts/root/js/interaction.js index 2bda2a7..68ccd34 100644 --- a/TreeOfTexts/root/js/interaction.js +++ b/TreeOfTexts/root/js/interaction.js @@ -1,13 +1,37 @@ +var colors = ['#ffeeaa','#afc6e9','#d5fff6','#ffccaa','#ffaaaa','#e5ff80','#e5d5ff','#ffd5e5']; +var row_triggered = false; $(document).ready(function() { $('.rowid').click( function() { - $('ellipse').attr( {stroke:'black', fill:'#ccc'} ); + row_triggered = true; + $('ellipse').attr( {stroke:'black', fill:'#fff'} ); $(this).parent().nextAll('.clickable').children('span').click(); + $('tr.active_variant_row').find('td').removeClass( 'active_variant_cell' ); + row_triggered = false; }); }) -function color_nodes( arr_node_ids ) { +function color_nodes( column_index, arr_node_ids, arr_greynode_ids ) { + if( !row_triggered ) { + $('ellipse').attr( {stroke:'black', fill:'#fff'} ) + }; + jQuery.each( arr_greynode_ids, function(index,value) { + $('.node').children('title').filter( function(index) { + return $(this).text() == value; + }).siblings('ellipse').each( function( index ) { + $(this).attr( {stroke:'black', fill:'#444'} ); + }); + }); jQuery.each( arr_node_ids, function(index,value) { $('.node').children('title').filter( function(index) { return $(this).text() == value; - }).siblings('ellipse').attr( {stroke:'red', fill:'yellow'} );; + }).siblings('ellipse').each( function( index ) { + $(this).attr( {stroke:'black', fill:colors[column_index-1]} ); + }); }); } + +// 8 columns tied to colors, based on td position I guess +// click on row id: all colors on, remaining (unused) nodes greyed +// click on cell: those colors on, unused nodes greyed +// c + +// \ No newline at end of file