diff options
author | Bharat Mediratta <bharat@menalto.com> | 2010-09-09 21:04:18 -0700 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2010-09-09 21:04:18 -0700 |
commit | 32878ebfdce943271824891639ab0384053bbadd (patch) | |
tree | 5c2df67fa6aa8abbaf3f7facd6de3404ae9a4ea4 | |
parent | 36f3a0387ddc484ebe867cf284aaf05f6ce6e5e1 (diff) |
Replace the hook function hack I introduced in
cbba45fffc7368280e9529f55e108d0080175b6a with a namespaced jQuery
custom event. This is way more portable.
-rw-r--r-- | lib/gallery.common.js | 8 | ||||
-rw-r--r-- | themes/wind/views/photo.html.php | 4 |
2 files changed, 5 insertions, 7 deletions
diff --git a/lib/gallery.common.js b/lib/gallery.common.js index 69452f39..9fccc602 100644 --- a/lib/gallery.common.js +++ b/lib/gallery.common.js @@ -119,11 +119,9 @@ }; // Ajax handler for replacing an image, used in Ajax thumbnail rotation - $.gallery_replace_image = function(data, thumb) { - $(thumb).attr({src: data.src, width: data.width, height: data.height}); - if (typeof gallery_image_replaced_hook == 'function') { - gallery_image_replaced_hook(data, thumb); - } + $.gallery_replace_image = function(data, img_selector) { + $(img_selector).attr({src: data.src, width: data.width, height: data.height}); + $(img_selector).trigger("gallery.change"); }; // Initialize context menus diff --git a/themes/wind/views/photo.html.php b/themes/wind/views/photo.html.php index cb830e23..b42ab987 100644 --- a/themes/wind/views/photo.html.php +++ b/themes/wind/views/photo.html.php @@ -12,7 +12,7 @@ // After the image is rotated or replaced we have to reload the image dimensions // so that the full size view isn't distorted. - gallery_image_replaced_hook = function(data, thumb) { + $("#g-photo").bind("gallery.change", function() { $.ajax({ url: "<?= url::site("items/dimensions/" . $theme->item()->id) ?>", dataType: "json", @@ -20,7 +20,7 @@ full_dims = data.full; } }); - } + }); }); </script> <? endif ?> |