X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=TreeOfTexts%2Froot%2Fjs%2Finteraction.js;h=15f64e0e84dce5166e9e1ca13c6474e0052970c4;hb=94a077d641e8c906d7131a059b009f335781337a;hp=17a19066023f6ba4179d4e976849b39429ec64c0;hpb=ce14597feff81761c2f1698c76cc0d3de9a7d4aa;p=scpubgit%2Fstemmatology.git diff --git a/TreeOfTexts/root/js/interaction.js b/TreeOfTexts/root/js/interaction.js index 17a1906..15f64e0 100644 --- a/TreeOfTexts/root/js/interaction.js +++ b/TreeOfTexts/root/js/interaction.js @@ -1,13 +1,39 @@ +var colors = ['#ffeeaa','#afc6e9','#d5fff6','#ffccaa','#ffaaaa','#e5ff80','#e5d5ff','#ffd5e5']; +var row_triggered = false; $(document).ready(function() { $('.rowid').click( function() { + row_triggered = true; + $('ellipse').attr( {stroke:'black', fill:'#fff'} ); + $('.node').children('polygon').attr( {stroke:'#fff', fill:'#fff'} ); + $('.node').children('text').attr( {stroke:'none', fill:'#000'} ); + $('tr.active_variant_row').children('td').removeClass('cellb0 cellb1 cellb2 cellb3 cellb4 cellb5 cellb6 cellb7'); $(this).parent().nextAll('.clickable').children('span').click(); + $('td.active_variant_cell').removeClass('active_variant_cell'); + row_triggered = false; }); }) -function color_nodes( arr_node_ids ) { - $('ellipse').attr( {stroke:'black', fill:'#999'} ); +function color_nodes( column_index, arr_node_ids, arr_greynode_ids ) { + if( !row_triggered ) { + $('tr.active_variant_row').children('td').removeClass('cellb0 cellb1 cellb2 cellb3 cellb4 cellb5 cellb6 cellb7'); + $('td.active_variant_cell').removeClass('active_variant_cell'); + $('ellipse').attr( {stroke:'black', fill:'#fff'} ); + $('.node').children('polygon').attr( {stroke:'#fff', fill:'#fff'} ); + $('.node').children('text').attr( {stroke:'none', fill:'#000'} ); + }; + $('tr.active_variant_row').removeClass('active_variant_row') + jQuery.each( arr_greynode_ids, function(index,value) { + nodes = $('.node').children('title').filter( function(index) { + return $(this).text() == value; + }) + nodes.siblings('ellipse, polygon, text').each( function( index ) { + $(this).attr( {stroke:'#ddd', fill:'#f8f8f8'} ); + }); + }); 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]} ); + }); }); }