some more look and feel tweaks
[scpubgit/stemmatology.git] / TreeOfTexts / root / js / interaction.js
1 var colors = ['#ffeeaa','#afc6e9','#d5fff6','#ffccaa','#ffaaaa','#e5ff80','#e5d5ff','#ffd5e5'];
2 var row_triggered = false;
3 $(document).ready(function() {
4   $('.rowid').click( function() {
5     row_triggered = true;
6     $('ellipse').attr( {stroke:'black', fill:'#fff'} );
7     $(this).parent().nextAll('.clickable').children('span').click();
8     $('tr.active_variant_row').find('td').removeClass( 'active_variant_cell' );
9     row_triggered = false;
10   });
11 })
12 function color_nodes( column_index, arr_node_ids, arr_greynode_ids ) {
13   if( !row_triggered ) { 
14     $('ellipse').attr( {stroke:'black', fill:'#fff'} ) 
15   }; 
16   jQuery.each( arr_greynode_ids, function(index,value) {
17     $('.node').children('title').filter( function(index) {
18       return $(this).text() == value;
19     }).siblings('ellipse').each( function( index ) {
20         $(this).attr( {stroke:'black', fill:'#444'} );
21       });
22   });
23   jQuery.each( arr_node_ids, function(index,value) {
24     $('.node').children('title').filter( function(index) {
25       return $(this).text() == value;
26     }).siblings('ellipse').each( function( index ) {
27         $(this).attr( {stroke:'black', fill:colors[column_index-1]} );
28       });
29   });
30 }
31
32 // 8 columns tied to colors, based on td position I guess
33 // click on row id: all colors on, remaining (unused) nodes greyed
34 // click on cell: those colors on, unused nodes greyed
35 // c
36
37 //