]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Minor optimization to only bind an hover event to the notice at hand.
authorSarven Capadisli <csarven@status.net>
Tue, 16 Feb 2010 16:36:45 +0000 (17:36 +0100)
committerSarven Capadisli <csarven@status.net>
Tue, 16 Feb 2010 16:36:45 +0000 (17:36 +0100)
js/util.js

index 3021872d42fc3ba5e2793f6169b854f489579915..3623337b9f65725acbcf16f6ce33e420350de5b5 100644 (file)
@@ -432,30 +432,32 @@ var SN = { // StatusNet
                 return false;
             });
 
-            var t;
-            $("body:not(#shownotice) .notice a.thumbnail").hover(
-                function() {
-                    var anchor = $(this);
-                    $("a.thumbnail").children('img').hide();
-                    anchor.closest(".entry-title").addClass('ov');
-
-                    if (anchor.children('img').length === 0) {
-                        t = setTimeout(function() {
-                            $.get($('address .url')[0].href+'attachment/' + (anchor.attr('id').substring('attachment'.length + 1)) + '/thumbnail', null, function(data) {
-                                anchor.append(data);
-                            });
-                        }, 500);
-                    }
-                    else {
-                        anchor.children('img').show();
+            if ($('#shownotice').length == 0) {
+                var t;
+                notice.find('a.thumbnail').hover(
+                    function() {
+                        var anchor = $(this);
+                        $('a.thumbnail').children('img').hide();
+                        anchor.closest(".entry-title").addClass('ov');
+
+                        if (anchor.children('img').length === 0) {
+                            t = setTimeout(function() {
+                                $.get($('address .url')[0].href+'attachment/' + (anchor.attr('id').substring('attachment'.length + 1)) + '/thumbnail', null, function(data) {
+                                    anchor.append(data);
+                                });
+                            }, 500);
+                        }
+                        else {
+                            anchor.children('img').show();
+                        }
+                    },
+                    function() {
+                        clearTimeout(t);
+                        $('a.thumbnail').children('img').hide();
+                        $(this).closest('.entry-title').removeClass('ov');
                     }
-                },
-                function() {
-                    clearTimeout(t);
-                    $("a.thumbnail").children('img').hide();
-                    $(this).closest(".entry-title").removeClass('ov');
-                }
-            );
+                );
+            }
         },
 
         NoticeDataAttach: function() {