You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2019/11/26 19:14:11 UTC

[allura] branch db/repo_line_target_nojump created (now c907de8)

This is an automated email from the ASF dual-hosted git repository.

brondsem pushed a change to branch db/repo_line_target_nojump
in repository https://gitbox.apache.org/repos/asf/allura.git.


      at c907de8  Don't move the page around when selecting a specific line in a repo page

This branch includes the following new commits:

     new c907de8  Don't move the page around when selecting a specific line in a repo page

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[allura] 01/01: Don't move the page around when selecting a specific line in a repo page

Posted by br...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

brondsem pushed a commit to branch db/repo_line_target_nojump
in repository https://gitbox.apache.org/repos/asf/allura.git

commit c907de87a7a563589d262d6d3b42cd2ff4278c41
Author: Dave Brondsema <da...@brondsema.net>
AuthorDate: Tue Nov 26 14:13:40 2019 -0500

    Don't move the page around when selecting a specific line in a repo page
---
 Allura/allura/templates/repo/file.html | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/Allura/allura/templates/repo/file.html b/Allura/allura/templates/repo/file.html
index 1f8be04..5c54990 100644
--- a/Allura/allura/templates/repo/file.html
+++ b/Allura/allura/templates/repo/file.html
@@ -54,19 +54,19 @@
     $(element).bind('click', function() {
       // Trick to ignore double and triple clicks
       clicks++;
-      if (clicks == 1) {
+      if (clicks === 1) {
         setTimeout(function() {
-          if (clicks == 1) {
+          if (clicks === 1) {
             var hash = window.location.hash.substring(1);
             if (hash !== '' && hash.substring(0, 1) === 'l' && !isNaN(hash.substring(1))) {
               $('#' + hash).css('background-color', 'transparent');
             }
             $(element).css('background-color', '#ffff99');
-            window.location.href = '#' + $(element).attr('id');
-          };
+            window.history.pushState({}, document.title, window.location.pathname + window.location.search + '#' + $(element).attr('id'));
+          }
           clicks = 0;
         }, 500);
-      };
+      }
     });
   });
 }());