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