@@ -39,15 +39,25 @@ for (var i = 0; i < rows.length; i++) {
3939 path = path . replace ( / [ < > \" ] / g, "" ) ; //g inmportant - global so replaces all instances
4040 var link = rootURL . concat ( path ) ;
4141
42+ // get color of original text by getting class name of <span> or <td> tag that houses it,
43+ // then ask style sheet for color attribute for that class
44+ var header_class = "" ;
45+ for ( var k = 0 ; k < cell . childNodes . length ; k ++ ) {
46+ if ( cell . childNodes [ k ] . textContent . indexOf ( path ) != - 1 ) {
47+ header_class = cell . childNodes [ k ] . className ;
48+ }
49+ }
50+ if ( ! header_class ) {
51+ header_class = cell . className . split ( " " ) [ 0 ] ;
52+ }
53+
54+ var color = window . getComputedStyle ( document . querySelector ( "." + header_class ) ) . getPropertyValue ( "color" ) ;
55+
4256 // let's replace the text with a link
43- // TODO keep same styling as before
44- cell . innerHTML = cell . innerHTML . replace ( path , "<a href=\"" + link + "\">" + path + "</a>" ) ;
45- // for (var k = 0; k < cell.childNodes.length; k++) {
46- // if (cell.childNodes[k].textContent.indexOf(path) != -1) {
47- // var cell_html = cell.childNodes[k].innerHTML;
48- // }
49- // }
57+ // keep same colour as before, but underline it to make it noticeable for user
58+ cell . innerHTML = cell . innerHTML . replace ( path , "<a href=\"" + link + "\" style=\"text-decoration:underline;color:" + color + "\">" + path + "</a>" ) ; // <font color=\"#df5000\">
5059 }
60+
5161 // tests for python imports/fragments
5262 var config = "" ;
5363 if ( py_pattern1 . test ( line ) ) {
@@ -72,10 +82,23 @@ for (var i = 0; i < rows.length; i++) {
7282 path = path . replace ( parts [ parts . length - 1 ] , "python/" + parts [ parts . length - 1 ] + ".py" )
7383 var link = rootURL . concat ( path )
7484
85+ // get color of original text by getting class name of <span> or <td> tag that houses it,
86+ // then ask style sheet for color attribute for that class
87+ // should probably put this as a function since we do the same for py and c++
88+ var header_class = "" ;
89+ for ( var k = 0 ; k < cell . childNodes . length ; k ++ ) {
90+ if ( cell . childNodes [ k ] . textContent . indexOf ( config ) != - 1 ) {
91+ header_class = cell . childNodes [ k ] . className ;
92+ }
93+ }
94+ if ( ! header_class ) {
95+ header_class = cell . className . split ( " " ) [ 0 ] ;
96+ }
97+ var color = window . getComputedStyle ( document . querySelector ( "." + header_class ) ) . getPropertyValue ( "color" ) ;
98+
7599 // let's replace the text with a link
76- // TODO keep same styling as before
77- var cell_html = cell . innerHTML ;
78- cell . innerHTML = cell_html . replace ( config , "<a href=\"" + link + "\">" + config + "</a>" ) ;
100+ // keep same colour as before, but underline it to make it noticeable for user
101+ cell . innerHTML = cell . innerHTML . replace ( config , "<a href=\"" + link + "\" style=\"text-decoration:underline;color:" + color + "\">" + config + "</a>" ) ;
79102 }
80103 }
81104 }
0 commit comments