mirror of
https://github.com/Pathduck/gallery3.git
synced 2026-05-21 03:49:21 -04:00
javascript lib (gallery.reload.js) which defines the functions gallery_reload() and gallery_location(new_location). They just do a window.location.reload() and window.location = new_location. This change breaks the assumption that all themes will handle page reloads the same and allows the theme to customize the page refresh.
63 lines
1.9 KiB
JavaScript
63 lines
1.9 KiB
JavaScript
/**
|
|
* Fire togglePanel() and prevent links from opening
|
|
* @see togglePanel()
|
|
*/
|
|
function handlePanelEvent(event) {
|
|
togglePanel(event.currentTarget);
|
|
event.preventDefault();
|
|
}
|
|
|
|
function togglePanel(element, on_success) {
|
|
var parent = $(element).parent().parent();
|
|
var sHref = $(element).attr("href");
|
|
var parentClass = $(parent).attr("class");
|
|
var ePanel = "<tr id=\"gPanel\"><td colspan=\"6\"></td></tr>";
|
|
|
|
if ($("#gPanel").length) {
|
|
$("#gPanel").slideUp("slow");
|
|
$("#gPanel *").remove();
|
|
$("#gPanel").remove();
|
|
if ($(element).attr("orig_text")) {
|
|
$(element).children(".gButtonText").text($(element).attr("orig_text"));
|
|
}
|
|
//togglePanel(element, on_success);
|
|
} else {
|
|
$(parent).after(ePanel);
|
|
//showLoading("#here");
|
|
$("#gPanel td").html(sHref);
|
|
$("#gPanel").addClass(parentClass).show().slideDown("slow");
|
|
$.get(sHref, function(data) {
|
|
$("#gPanel td").html(data);
|
|
ajaxify_panel = function() {
|
|
$("#gPanel td form").ajaxForm({
|
|
dataType: "json",
|
|
success: function(data) {
|
|
if (data.form) {
|
|
$("#gPanel td form").replaceWith(data.form);
|
|
ajaxify_panel();
|
|
}
|
|
if (data.result == "success") {
|
|
if (on_success) {
|
|
on_success();
|
|
} else if (data.location) {
|
|
$.gallery_location(data.location);
|
|
} else {
|
|
$.gallery_reload();
|
|
}
|
|
}
|
|
}
|
|
});
|
|
if ($("#gPanel td").hasClass("gLoadingLarge")) {
|
|
showLoading("#gPanel td");
|
|
}
|
|
};
|
|
ajaxify_panel();
|
|
if ($(element).attr("open_text")) {
|
|
$(element).attr("orig_text", $(element).children(".gButtonText").text());
|
|
$(element).children(".gButtonText").text($(element).attr("open_text"));
|
|
}
|
|
});
|
|
}
|
|
return false;
|
|
}
|