summaryrefslogtreecommitdiff
path: root/lib/gallery.panel.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gallery.panel.js')
-rw-r--r--lib/gallery.panel.js42
1 files changed, 32 insertions, 10 deletions
diff --git a/lib/gallery.panel.js b/lib/gallery.panel.js
index 8d627369..e0605ca3 100644
--- a/lib/gallery.panel.js
+++ b/lib/gallery.panel.js
@@ -31,15 +31,37 @@
if (should_open) {
$(parent).after(ePanel);
$("#g-panel td").html(sHref);
- $.get(sHref, function(data) {
- $("#g-panel td").html(data);
- self._ajaxify_panel();
- if ($(element).attr("open_text")) {
- $(element).attr("orig_text", $(element).children(".g-button-text").text());
- $(element).children(".g-button-text").text($(element).attr("open_text"));
+ $.ajax({
+ url: sHref,
+ type: "GET",
+ beforeSend: function(xhr) {
+ // Until we convert to jquery 1.4, we need to save the
+ // XMLHttpRequest object
+ this.xhrData = xhr;
+ },
+ success: function(data, textStatus, xhr) {
+ // Pre jquery 1.4, get the saved XMLHttpRequest object
+ if (xhr == undefined) {
+ xhr = this.xhrData;
+ }
+ var mimeType = /^(\w+\/\w+)\;?/.exec(xhr.getResponseHeader("Content-Type"));
+ var content = "";
+ if (mimeType[1] == "application/json") {
+ data = JSON.parse(data);
+ content = unescape(data.html);
+ } else {
+ content = data;
+ }
+
+ $("#g-panel td").html(content);
+ self._ajaxify_panel();
+ if ($(element).attr("open_text")) {
+ $(element).attr("orig_text", $(element).children(".g-button-text").text());
+ $(element).children(".g-button-text").text($(element).attr("open_text"));
+ }
+ $("#g-panel").addClass(parentClass).show().slideDown("slow");
}
- $("#g-panel").addClass(parentClass).show().slideDown("slow");
- });
+ });
}
return false;
@@ -57,8 +79,8 @@
return true;
},
success: function(data) {
- if (data.form) {
- $("#g-panel td form").replaceWith(data.form);
+ if (data.html) {
+ $("#g-panel td").html(data.html);
self._ajaxify_panel();
}
if (data.result == "success") {