Changeset 16453 for util

Show
Ignore:
Timestamp:
05/19/07 03:45:55 (18 months ago)
Author:
Aankhen
Message:

util/smartlinks.pl:
* removed spurious display: block CSS.
* made JS logic a bit more intelligent about replacing the trailing :.
* tweaked the display of line numbers and test results in the snippet labels.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • util/smartlinks.pl

    r16369 r16453  
    137137  var id = 'smartlink_' + num; 
    138138  var div = document.getElementById(id); 
    139   div.style.display = (div.style.display == 'none') ? 'block' : 'none'; 
     139  div.style.display = (div.style.display == 'none') ? '' : 'none'; 
    140140   
    141141  var text = this.firstChild; 
     
    190190      } 
    191191       
    192       link.replaceChild(document.createTextNode(' -'), link.lastChild); // replace ending ":" with " -" 
     192      var end = link.lastChild; 
     193      if ((end.nodeType == 3) && (end.nodeValue.search(/:$/) > -1)) { 
     194        end.nodeValue = end.nodeValue.replace(/:$/, ' -'); 
     195      } 
    193196       
    194197      link.href = '#'; 
     
    485488    border: 1px solid; 
    486489    padding: 0.2em; 
    487     display: block; 
    488490} 
    489491</style> 
     
    564566    if ($test_result) { 
    565567        if ($ok_count == 0 && $failed_count == 0) { 
    566             $stat = " &nbsp;&mdash; &nbsp;<code>N/A</code>"; 
     568            $stat = " (no results)"; 
    567569        } else { 
    568             $stat = " &nbsp;&mdash; &nbsp;<code>$ok_count √, $failed_count ×</code>"; 
     570            $stat = " (<code>$ok_count √, $failed_count ×</code>)"; 
    569571        } 
    570572    } else { 
    571         $stat = '<code></code>'; 
     573        $stat = ''; 
    572574    } 
    573575 
     
    575577 
    576578    my $html = <<"_EOC_"; 
    577 <p>From $file lines $from ~ $to$stat:<span id="smartlink_skip_${snippet_id}"> <a href="#smartlink_skipto_${snippet_id}">(skip)</a></span></p> 
     579<p>From $file lines $from&ndash;$to$stat:<span id="smartlink_skip_${snippet_id}"> <a href="#smartlink_skipto_${snippet_id}">(skip)</a></span></p> 
    578580<div id="smartlink_${snippet_id}" class="smartlink_snippet"> 
    579581$snippet