You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by tv...@apache.org on 2014/02/12 21:41:24 UTC

[1/2] git commit: [#5769] ticket:528 Made code browser ignore double and triple clicks

Updated Branches:
  refs/heads/master 7406ab966 -> 36ba2d62d


[#5769] ticket:528 Made code browser ignore double and triple clicks


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

Branch: refs/heads/master
Commit: 36ba2d62d9bcf79e5581f3b1af39114e0546863c
Parents: 390043a
Author: Ferens Dmitriy <fe...@gmail.com>
Authored: Fri Feb 7 16:57:25 2014 +0200
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Wed Feb 12 20:16:21 2014 +0000

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


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/36ba2d62/Allura/allura/templates/repo/file.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/repo/file.html b/Allura/allura/templates/repo/file.html
index 8fe2819..7221557 100644
--- a/Allura/allura/templates/repo/file.html
+++ b/Allura/allura/templates/repo/file.html
@@ -51,17 +51,24 @@
     }
   }).trigger('hashchange');
 
+  var clicks = 0;
   $('.code_block').each(function(index, element) {
     $(element).bind('click', function() {
-      // 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);
+      // Trick to ignore double and triple clicks
+      clicks++;
+      if (clicks == 1) {
+        setTimeout(function() {
+          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');
+          };
+          clicks = 0;
+        }, 500);
+      };
     });
   });
 }());


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

Posted by tv...@apache.org.
[#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 <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);
     });
   });
 }());