From 8d9db09b41df8df81a0824f360de5237d4c2c2c6 Mon Sep 17 00:00:00 2001 From: Marcin Lulek Date: Wed, 14 Sep 2016 15:23:09 +0200 Subject: [PATCH] js: offsetScroll to elements that are found --- rhodecode/templates/changeset/changeset.html | 4 +++- rhodecode/templates/files/files.html | 4 +++- rhodecode/templates/pullrequests/pullrequest_show.html | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/rhodecode/templates/changeset/changeset.html b/rhodecode/templates/changeset/changeset.html index 5523e1be..35a68d04 100644 --- a/rhodecode/templates/changeset/changeset.html +++ b/rhodecode/templates/changeset/changeset.html @@ -375,7 +375,9 @@ if (location.hash) { var result = splitDelimitedHash(location.hash); var line = $('html').find(result.loc); - offsetScroll(line, 70); + if (line.length > 0){ + offsetScroll(line, 70); + } } // browse tree @ revision diff --git a/rhodecode/templates/files/files.html b/rhodecode/templates/files/files.html index 2f99da2c..fe69c655 100644 --- a/rhodecode/templates/files/files.html +++ b/rhodecode/templates/files/files.html @@ -177,7 +177,9 @@ var _first_line = $('#L' + h_lines[0]).get(0); if (_first_line) { var line = $('#L' + h_lines[0]); - offsetScroll(line, 70); + if (line.length > 0){ + offsetScroll(line, 70); + } } } } diff --git a/rhodecode/templates/pullrequests/pullrequest_show.html b/rhodecode/templates/pullrequests/pullrequest_show.html index 931c0c7c..63453527 100644 --- a/rhodecode/templates/pullrequests/pullrequest_show.html +++ b/rhodecode/templates/pullrequests/pullrequest_show.html @@ -415,7 +415,9 @@ if (location.hash) { var result = splitDelimitedHash(location.hash); var line = $('html').find(result.loc); - offsetScroll(line, 70); + if (line.length > 0){ + offsetScroll(line, 70); + } } $(function(){ ReviewerAutoComplete('user');