Minor optimization to only bind an hover event to the notice at hand.

This commit is contained in:
Sarven Capadisli 2010-02-16 17:36:45 +01:00
parent 385fb94723
commit 2e258454f3

View File

@ -432,11 +432,12 @@ var SN = { // StatusNet
return false; return false;
}); });
if ($('#shownotice').length == 0) {
var t; var t;
$("body:not(#shownotice) .notice a.thumbnail").hover( notice.find('a.thumbnail').hover(
function() { function() {
var anchor = $(this); var anchor = $(this);
$("a.thumbnail").children('img').hide(); $('a.thumbnail').children('img').hide();
anchor.closest(".entry-title").addClass('ov'); anchor.closest(".entry-title").addClass('ov');
if (anchor.children('img').length === 0) { if (anchor.children('img').length === 0) {
@ -452,10 +453,11 @@ var SN = { // StatusNet
}, },
function() { function() {
clearTimeout(t); clearTimeout(t);
$("a.thumbnail").children('img').hide(); $('a.thumbnail').children('img').hide();
$(this).closest(".entry-title").removeClass('ov'); $(this).closest('.entry-title').removeClass('ov');
} }
); );
}
}, },
NoticeDataAttach: function() { NoticeDataAttach: function() {