Fix navbar click while in a search
This commit is contained in:
parent
58557fafae
commit
acd5e8cd4e
1 changed files with 9 additions and 0 deletions
|
@ -122,6 +122,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function highlightSourceLines(ev) {
|
function highlightSourceLines(ev) {
|
||||||
|
var search = document.getElementById("search");
|
||||||
var i, from, to, match = window.location.hash.match(/^#?(\d+)(?:-(\d+))?$/);
|
var i, from, to, match = window.location.hash.match(/^#?(\d+)(?:-(\d+))?$/);
|
||||||
if (match) {
|
if (match) {
|
||||||
from = parseInt(match[1], 10);
|
from = parseInt(match[1], 10);
|
||||||
|
@ -145,6 +146,14 @@
|
||||||
for (i = from; i <= to; ++i) {
|
for (i = from; i <= to; ++i) {
|
||||||
addClass(document.getElementById(i), 'line-highlighted');
|
addClass(document.getElementById(i), 'line-highlighted');
|
||||||
}
|
}
|
||||||
|
} else if (ev !== null && search && !hasClass(search, "hidden") && ev.newURL) {
|
||||||
|
addClass(search, "hidden");
|
||||||
|
removeClass(document.getElementById("main"), "hidden");
|
||||||
|
var hash = ev.newURL.slice(ev.newURL.indexOf('#') + 1);
|
||||||
|
var elem = document.getElementById(hash);
|
||||||
|
if (elem) {
|
||||||
|
elem.scrollIntoView();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
highlightSourceLines(null);
|
highlightSourceLines(null);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue