summaryrefslogtreecommitdiff
path: root/js/util.js
diff options
context:
space:
mode:
authorSarven Capadisli <csarven@controlyourself.ca>2009-05-28 22:59:22 +0000
committerSarven Capadisli <csarven@controlyourself.ca>2009-05-28 22:59:22 +0000
commitf0dc97e4da16181b0d6a74361734678d0f37fd5e (patch)
tree29283fa82b7c1a10fd3f8450b64cc7842dc9b8b8 /js/util.js
parent3d13a44b66e254f88a7c2aa36190fa8e9df8fec3 (diff)
Smarter call for hover events. It now makes a new GET for attachment
thumbnails on mouseover only if it hasn't been requested before on that notice attachment.
Diffstat (limited to 'js/util.js')
-rw-r--r--js/util.js26
1 files changed, 13 insertions, 13 deletions
diff --git a/js/util.js b/js/util.js
index 08cc1d370..6cfad3a8e 100644
--- a/js/util.js
+++ b/js/util.js
@@ -261,7 +261,7 @@ function NoticeAttachments() {
url : '',
color : '#000',
opacity : '0.6',
- zIndex : 9999,
+ zIndex : '9999',
center : true,
imgLoading : $('address .url')[0].href+'theme/base/images/illustrations/illu_progress_loading-01.gif',
bgClickToClose : true,
@@ -279,22 +279,22 @@ function NoticeAttachments() {
$("body:not(#shownotice) a.thumbnail").hover(
function() {
var anchor = $(this);
- $("a.thumbnail").children('img').remove();
+ $("a.thumbnail").children('img').hide();
anchor.closest(".entry-title").addClass('ov');
- setTimeout(function() {
- $.get($('address .url')[0].href+'/attachment/' + (anchor.attr('id').substring('attachment'.length + 1)) + '/thumbnail', null, function(data) {
- anchor.append(data);
- });
- }, 500);
-
- setTimeout(function() {
- anchor.children('img').remove();
- anchor.closest(".entry-title").removeClass('ov');
- }, 3000);
+ if (anchor.children('img').length == 0) {
+ 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() {
- $("a.thumbnail").children('img').remove();
+ $("a.thumbnail").children('img').hide();
$(this).closest(".entry-title").removeClass('ov');
}
);