]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Prevents regular hovers over attachment anchors from making a GET
authorSarven Capadisli <csarven@controlyourself.ca>
Thu, 28 May 2009 23:16:25 +0000 (23:16 +0000)
committerSarven Capadisli <csarven@controlyourself.ca>
Thu, 28 May 2009 23:16:25 +0000 (23:16 +0000)
request for the thumbnail. There is 500 ms delay while on mouseover
state before going ahead with the request. Fun.

js/util.js

index 6cfad3a8e7a3aae14d4d6fc46a17556d12ff603d..d5697e880da3b4ff768cccf342e6b85a3c1bad64 100644 (file)
@@ -276,6 +276,8 @@ function NoticeAttachments() {
         $().jOverlay({url: $('address .url')[0].href+'/attachment/' + ($(this).attr('id').substring('attachment'.length + 1)) + '/ajax'});
         return false;
     });
+    
+    var t;
     $("body:not(#shownotice) a.thumbnail").hover(
         function() {
             var anchor = $(this);
@@ -283,7 +285,7 @@ function NoticeAttachments() {
             anchor.closest(".entry-title").addClass('ov');
 
             if (anchor.children('img').length == 0) {
-                setTimeout(function() {
+                t = setTimeout(function() {
                     $.get($('address .url')[0].href+'/attachment/' + (anchor.attr('id').substring('attachment'.length + 1)) + '/thumbnail', null, function(data) {
                         anchor.append(data);
                     });
@@ -294,6 +296,7 @@ function NoticeAttachments() {
             }
         },
         function() {
+            clearTimeout(t);
             $("a.thumbnail").children('img').hide();
             $(this).closest(".entry-title").removeClass('ov');
         }