You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by jo...@apache.org on 2014/02/13 16:05:48 UTC

[14/17] git commit: [#5769] ticket:528 Made code browser handle double/triple clicks properly

[#5769] ticket:528 Made code browser handle double/triple clicks properly


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/390043a1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/390043a1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/390043a1

Branch: refs/heads/cj/7097
Commit: 390043a1539cabfa9d4f4fe5e1cee74ae12b9fe8
Parents: 7406ab9
Author: Ferens Dmitriy <fe...@gmail.com>
Authored: Tue Feb 4 15:22:56 2014 +0200
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Wed Feb 12 20:16:21 2014 +0000

----------------------------------------------------------------------
 Allura/allura/templates/repo/file.html | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/390043a1/Allura/allura/templates/repo/file.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/repo/file.html b/Allura/allura/templates/repo/file.html
index b84c47c..8fe2819 100644
--- a/Allura/allura/templates/repo/file.html
+++ b/Allura/allura/templates/repo/file.html
@@ -53,12 +53,15 @@
 
   $('.code_block').each(function(index, element) {
     $(element).bind('click', function() {
-      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');
+      // Let double/triple clicks select code first
+      setTimeout(function() {
+        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');
+      }, 500);
     });
   });
 }());