start a real index page for traditions
[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 $(document).ready(function() {
4   $('.rowid').click( function() {
5     row_triggered = true;
6     $('ellipse').attr( {stroke:'black', 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     $(this).parent().nextAll('.clickable').children('span').click();
11     $('td.active_variant_cell').removeClass('active_variant_cell');
12     row_triggered = false;
13   });
14   $('svg').width('485px');
15 })
16 function color_nodes( column_index, arr_node_ids, arr_greynode_ids ) {
17   if( !row_triggered ) {
18     $('tr.active_variant_row').children('td').removeClass('cellb0 cellb1 cellb2 cellb3 cellb4 cellb5 cellb6 cellb7'); 
19     $('td.active_variant_cell').removeClass('active_variant_cell');
20     $('ellipse').attr( {stroke:'black', fill:'#fff'} );
21     $('.node').children('polygon').attr( {stroke:'#fff', fill:'#fff'} );
22     $('.node').children('text').attr( {stroke:'none', fill:'#000'} );
23   }; 
24   $('tr.active_variant_row').removeClass('active_variant_row') 
25   jQuery.each( arr_greynode_ids, function(index,value) {
26     nodes = $('.node').children('title').filter( function(index) {
27       return $(this).text() == value;
28     })
29     nodes.siblings('ellipse, polygon, text').each( function( index ) {
30         $(this).attr( {stroke:'#ddd', fill:'#f8f8f8'} );
31       });
32   });
33   jQuery.each( arr_node_ids, function(index,value) {
34     $('.node').children('title').filter( function(index) {
35       return $(this).text() == value;
36     }).siblings('ellipse').each( function( index ) {
37         $(this).attr( {stroke:'black', fill:colors[column_index-1]} );
38       });
39   });
40 }