summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorSarven Capadisli <csarven@status.net>2010-02-16 17:36:45 +0100
committerSarven Capadisli <csarven@status.net>2010-02-16 17:36:45 +0100
commit2e258454f396af9f95092b9564eee08179ff6be1 (patch)
treecdbfba29c68c3dff49e4b272480d3a8fe305764a /js
parent385fb947236fcbf429a147be90569db9c7edc152 (diff)
Minor optimization to only bind an hover event to the notice at hand.
Diffstat (limited to 'js')
-rw-r--r--js/util.js48
1 files changed, 25 insertions, 23 deletions
diff --git a/js/util.js b/js/util.js
index 3021872d4..3623337b9 100644
--- a/js/util.js
+++ b/js/util.js
@@ -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() {