diff options
author | Nathan Kinkade <nkinkade@nkinka.de> | 2010-08-06 21:36:32 +0000 |
---|---|---|
committer | Nathan Kinkade <nkinkade@nkinka.de> | 2010-08-06 21:36:32 +0000 |
commit | 691ce806dc9aefac596a692ff2ba927a81a65440 (patch) | |
tree | 410f64288ef1d8bbc8455509af74d0e7582dc48e /lib/gallery.panel.js | |
parent | c83650d83ad8b1f4bda30cac2ae8efa6e1c97287 (diff) | |
parent | 8559cdb5b6bfa87864941f726521660023779fa7 (diff) |
Merge branch 'master' of git://github.com/gallery/gallery3
Diffstat (limited to 'lib/gallery.panel.js')
-rw-r--r-- | lib/gallery.panel.js | 42 |
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") { |