incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tvansteenbu...@apache.org
Subject [2/2] git commit: [#5769] ticket:528 Made code browser handle double/triple clicks properly
Date Wed, 12 Feb 2014 20:41:25 GMT
[#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/master
Commit: 390043a1539cabfa9d4f4fe5e1cee74ae12b9fe8
Parents: 7406ab9
Author: Ferens Dmitriy <ferensdima@gmail.com>
Authored: Tue Feb 4 15:22:56 2014 +0200
Committer: Tim Van Steenburgh <tvansteenburgh@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);
     });
   });
 }());


Mime
View raw message