Skip to content

Commit

Permalink
Replace the hook function hack I introduced in
Browse files Browse the repository at this point in the history
cbba45f with a namespaced jQuery
custom event.  This is way more portable.
  • Loading branch information
bharat committed Sep 10, 2010
1 parent 36f3a03 commit 32878eb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
8 changes: 3 additions & 5 deletions lib/gallery.common.js
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions themes/wind/views/photo.html.php
Expand Up @@ -12,15 +12,15 @@

// 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",
success: function(data, textStatus) {
full_dims = data.full;
}
});
}
});
});
</script>
<? endif ?>
Expand Down

0 comments on commit 32878eb

Please sign in to comment.