22//= require_directory ./plugins/
33//= require_self
44
5- $ ( document ) . ready ( function ( ) {
5+ $ ( document ) . ready ( function ( ) {
6+ branchCoverageActivated = $ ( "body" ) . data ( "branch-coverage" ) == true ;
7+
68 // Configuration for fancy sortable tables for source file groups
9+ // For what these columns are, cecl out file_list.erb - null basically
10+ // does normal/number style sorting which fine for hit/missed lines only
11+ // percentages like "covered percent" need special sorting arguments.
12+ lineColumns = [ null , { "sType" : "percent" } , null , null , null , null , null ] ;
13+ branchColumns = [ { "sType" : "percent" } , null , null , null ] ;
14+
15+ dataColumns = branchCoverageActivated ? lineColumns . concat ( branchColumns ) : lineColumns ;
16+
717 $ ( '.file_list' ) . dataTable ( {
8- "aaSorting" : [ [ 1 , "asc" ] ] ,
18+ "aaSorting" : [ [ 1 , "asc" ] ] ,
919 "bPaginate" : false ,
10- "bJQueryUI" : true
20+ "bJQueryUI" : true ,
21+ "aoColumns" : dataColumns
1122 } ) ;
1223
1324 // Syntax highlight all files up front - deactivated
1425 // $('.source_table pre code').each(function(i, e) {hljs.highlightBlock(e, ' ')});
1526
1627 // Syntax highlight source files on first toggle of the file view popup
17- $ ( "a.src_link" ) . click ( function ( ) {
28+ $ ( "a.src_link" ) . click ( function ( ) {
1829 // Get the source file element that corresponds to the clicked element
1930 var source_table = $ ( $ ( this ) . attr ( 'href' ) ) ;
2031
2132 // If not highlighted yet, do it!
2233 if ( ! source_table . hasClass ( 'highlighted' ) ) {
23- source_table . find ( 'pre code' ) . each ( function ( i , e ) { hljs . highlightBlock ( e , ' ' ) } ) ;
34+ source_table . find ( 'pre code' ) . each ( function ( i , e ) { hljs . highlightBlock ( e , ' ' ) } ) ;
2435 source_table . addClass ( 'highlighted' ) ;
2536 } ;
2637 } ) ;
@@ -35,14 +46,14 @@ $(document).ready(function() {
3546 opacity : 1 ,
3647 width : "95%" ,
3748 height : "95%" ,
38- onLoad : function ( ) {
49+ onLoad : function ( ) {
3950 prev_anchor = curr_anchor ? curr_anchor : jQuery . url . attr ( 'anchor' ) ;
4051 curr_anchor = this . href . split ( '#' ) [ 1 ] ;
4152 window . location . hash = curr_anchor ;
4253 } ,
43- onCleanup : function ( ) {
54+ onCleanup : function ( ) {
4455 if ( prev_anchor && prev_anchor != curr_anchor ) {
45- $ ( 'a[href="#' + prev_anchor + '"]' ) . click ( ) ;
56+ $ ( 'a[href="#' + prev_anchor + '"]' ) . click ( ) ;
4657 curr_anchor = prev_anchor ;
4758 } else {
4859 $ ( '.group_tabs a:first' ) . click ( ) ;
@@ -53,13 +64,13 @@ $(document).ready(function() {
5364 }
5465 } ) ;
5566
56- window . onpopstate = function ( event ) {
57- if ( location . hash . substring ( 0 , 2 ) == "#_" ) {
67+ window . onpopstate = function ( event ) {
68+ if ( location . hash . substring ( 0 , 2 ) == "#_" ) {
5869 $ . colorbox . close ( ) ;
5970 curr_anchor = jQuery . url . attr ( 'anchor' ) ;
6071 } else {
6172 if ( $ ( '#colorbox' ) . is ( ':hidden' ) ) {
62- $ ( 'a.src_link[href="' + location . hash + '"]' ) . colorbox ( { open : true } ) ;
73+ $ ( 'a.src_link[href="' + location . hash + '"]' ) . colorbox ( { open : true } ) ;
6374 }
6475 }
6576 } ;
@@ -69,23 +80,23 @@ $(document).ready(function() {
6980 $ ( '.file_list_container' ) . hide ( ) ;
7081
7182 // Add tabs based upon existing file_list_containers
72- $ ( '.file_list_container h2' ) . each ( function ( ) {
83+ $ ( '.file_list_container h2' ) . each ( function ( ) {
7384 var container_id = $ ( this ) . parent ( ) . attr ( 'id' ) ;
7485 var group_name = $ ( this ) . find ( '.group_name' ) . first ( ) . html ( ) ;
7586 var covered_percent = $ ( this ) . find ( '.covered_percent' ) . first ( ) . html ( ) ;
7687
77- $ ( '.group_tabs' ) . append ( '<li><a href="#' + container_id + '">' + group_name + ' (' + covered_percent + ')</a></li>' ) ;
88+ $ ( '.group_tabs' ) . append ( '<li><a href="#' + container_id + '">' + group_name + ' (' + covered_percent + ')</a></li>' ) ;
7889 } ) ;
7990
80- $ ( '.group_tabs a' ) . each ( function ( ) {
91+ $ ( '.group_tabs a' ) . each ( function ( ) {
8192 $ ( this ) . addClass ( $ ( this ) . attr ( 'href' ) . replace ( '#' , '' ) ) ;
8293 } ) ;
8394
8495 // Make sure tabs don't get ugly focus borders when active
85- $ ( '.group_tabs a' ) . live ( 'focus' , function ( ) { $ ( this ) . blur ( ) ; } ) ;
96+ $ ( '.group_tabs a' ) . live ( 'focus' , function ( ) { $ ( this ) . blur ( ) ; } ) ;
8697
8798 var favicon_path = $ ( 'link[rel="shortcut icon"]' ) . attr ( 'href' ) ;
88- $ ( '.group_tabs a' ) . live ( 'click' , function ( ) {
99+ $ ( '.group_tabs a' ) . live ( 'click' , function ( ) {
89100 if ( ! $ ( this ) . parent ( ) . hasClass ( 'active' ) ) {
90101 $ ( '.group_tabs a' ) . parent ( ) . removeClass ( 'active' ) ;
91102 $ ( this ) . parent ( ) . addClass ( 'active' ) ;
@@ -96,7 +107,7 @@ $(document).ready(function() {
96107 // Force favicon reload - otherwise the location change containing anchor would drop the favicon...
97108 // Works only on firefox, but still... - Anyone know a better solution to force favicon on local file?
98109 $ ( 'link[rel="shortcut icon"]' ) . remove ( ) ;
99- $ ( 'head' ) . append ( '<link rel="shortcut icon" type="image/png" href="' + favicon_path + '" />' ) ;
110+ $ ( 'head' ) . append ( '<link rel="shortcut icon" type="image/png" href="' + favicon_path + '" />' ) ;
100111 } ;
101112 return false ;
102113 } ) ;
@@ -106,7 +117,7 @@ $(document).ready(function() {
106117 if ( anchor . length == 40 ) {
107118 $ ( 'a.src_link[href=#' + anchor + ']' ) . click ( ) ;
108119 } else {
109- $ ( '.group_tabs a.' + anchor . replace ( '_' , '' ) ) . click ( ) ;
120+ $ ( '.group_tabs a.' + anchor . replace ( '_' , '' ) ) . click ( ) ;
110121 }
111122 } else {
112123 $ ( '.group_tabs a:first' ) . click ( ) ;
0 commit comments