aa83fbc56e72c529484a3a0adfddd31495706638
[scpubgit/stemmatology.git] / stemmaweb / root / js / stexaminer.js
1 var colors = ['#ffeeaa','#afc6e9','#d5fff6','#ffccaa','#ffaaaa','#e5ff80','#e5d5ff','#ffd5e5'];
2 var row_triggered = false;
3
4 function color_row( row ) {
5     row_triggered = true;
6     $('ellipse').attr( {stroke:'white', fill:'#fff'} );
7     $('.node').children('polygon').attr( {stroke:'#fff', fill:'#fff'} );
8     $('.node').children('text').attr( {stroke:'none', fill:'#000'} );
9     $('tr.active_variant_row').children('td').removeClass('cellb0 cellb1 cellb2 cellb3 cellb4 cellb5 cellb6 cellb7'); 
10     row.parent().nextAll('.clickable').children('span').click();
11     $('td.active_variant_cell').removeClass('active_variant_cell');
12     row_triggered = false;
13 }
14
15 function color_nodes( column_index, arr_node_ids, arr_greynode_ids ) {
16   if( !row_triggered ) {
17     $('tr.active_variant_row').children('td').removeClass('cellb0 cellb1 cellb2 cellb3 cellb4 cellb5 cellb6 cellb7'); 
18     $('td.active_variant_cell').removeClass('active_variant_cell');
19     $('ellipse').attr( {stroke:'white', fill:'#fff'} );
20     $('.node').children('polygon').attr( {stroke:'#fff', fill:'#fff'} );
21     $('.node').children('text').attr( {stroke:'none', fill:'#000'} );
22   }; 
23   $('tr.active_variant_row').removeClass('active_variant_row') 
24   jQuery.each( arr_greynode_ids, function(index,value) {
25     nodes = $('.node').children('title').filter( function(index) {
26       return $(this).text() == value;
27     })
28     nodes.siblings('ellipse, polygon, text').each( function( index ) {
29         $(this).attr( {stroke:'#ddd', fill:'#f8f8f8'} );
30       });
31   });
32   jQuery.each( arr_node_ids, function(index,value) {
33     $('.node').children('title').filter( function(index) {
34       return $(this).text() == value;
35     }).siblings('ellipse').each( function( index ) {
36         $(this).attr( {stroke:'black', fill:colors[column_index-1]} );
37       });
38   });
39 }