Skip to content
Snippets Groups Projects
Commit a8987883 authored by Austin Anderson's avatar Austin Anderson
Browse files

Try and fix scrolling to IDs

parent 136a2549
Branches
No related tags found
No related merge requests found
...@@ -100,10 +100,15 @@ $(function () { ...@@ -100,10 +100,15 @@ $(function () {
// When the page loads, if there is a commit ID in the location hash, show // When the page loads, if there is a commit ID in the location hash, show
// the matching modal -- that is, if you load dashboard#commit, show the modal // the matching modal -- that is, if you load dashboard#commit, show the modal
// for that commit. Also, show the matching modal if a CL is provided instead. // for that commit. Also, show the matching modal if a CL is provided instead.
if (window.location.hash.length <= 1) { unescaped = decodeURIComponent(window.location.hash).replace("#", "").replace("+", "")
// Nothing to do if no hash in the URL // Nothing to do if no hash in the URL
} else if ($("span[id='" + window.location.hash + "']".length)) { if (window.location.hash.length <= 1) {
// Nothing to do if we're able to find a span, which is a section header // Empty!
// If the hash matches a span on the page, then scroll to it (a header)
} else if ($("span[id='" + unescaped + "']".length)) {
document.getElementById(unescaped).scrollIntoView({
behavior: 'smooth'
});
// If the hash is exactly 41 chars (hash sign # plus a 40-char sha hash), // If the hash is exactly 41 chars (hash sign # plus a 40-char sha hash),
// just show that modal. // just show that modal.
} else if (window.location.hash.length == 41) { } else if (window.location.hash.length == 41) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment