diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gallery.ajax.js | 15 | ||||
-rw-r--r-- | lib/gallery.common.js | 8 |
2 files changed, 21 insertions, 2 deletions
diff --git a/lib/gallery.ajax.js b/lib/gallery.ajax.js new file mode 100644 index 00000000..4f26745d --- /dev/null +++ b/lib/gallery.ajax.js @@ -0,0 +1,15 @@ +(function($) { + $.widget("ui.gallery_ajax", { + _init: function() { + this.element.click(function(event) { + eval("var ajax_handler = " + $(event.currentTarget).attr("ajax_handler")); + $.get($(event.currentTarget).attr("href"), function(data) { + eval("var data = " + data); + ajax_handler(data); + }); + event.preventDefault(); + return false; + }); + } + }); +})(jQuery); diff --git a/lib/gallery.common.js b/lib/gallery.common.js index eea0fada..317a73e7 100644 --- a/lib/gallery.common.js +++ b/lib/gallery.common.js @@ -80,7 +80,7 @@ return this.id.match(/gPhotoId-\d+/); }); return photo; - } + }; /** * Get the sum of an element's height, margin-top, and margin-bottom @@ -104,7 +104,11 @@ $(this).removeClass("ui-state-hover"); } ); - } + }; + // 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}); + }; })(jQuery); |