mirror of
https://github.com/git/git
synced 2024-08-27 19:49:21 +00:00
gitweb: Allow line number toggling with Javascript
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
parent
bc9860d3d3
commit
1f992affa7
|
@ -4267,6 +4267,25 @@ sub git_print_page_path {
|
|||
print $cgi->a({-href => href(action=>"blob_plain", file_name=>$file_name,
|
||||
hash_base=>$hb),
|
||||
-title => $name}, esc_path($basename));
|
||||
print '
|
||||
<a id="lineNoToggle" href="#" onclick="toggleLineNumbers();"></a>
|
||||
<script>
|
||||
function toggleLineNumbers() {
|
||||
e = document.getElementById("lineNoStyle");
|
||||
e2 = document.getElementById("lineNoToggle");
|
||||
if (e2.innerHTML == "[Hide line numbers]") {
|
||||
e.innerHTML = ".linenr { display:none; }";
|
||||
e2.innerHTML = "[Show line numbers]";
|
||||
}
|
||||
else {
|
||||
e.innerHTML = "";
|
||||
e2.innerHTML = "[Hide line numbers]";
|
||||
}
|
||||
}
|
||||
document.getElementsByTagName("head")[0].innerHTML += "<style id=\'lineNoStyle\'></style>";
|
||||
toggleLineNumbers();
|
||||
</script>
|
||||
';
|
||||
} elsif (defined $type && $type eq 'tree') {
|
||||
print $cgi->a({-href => href(action=>"tree", file_name=>$file_name,
|
||||
hash_base=>$hb),
|
||||
|
|
Loading…
Reference in a new issue