summaryrefslogtreecommitdiff
path: root/lib/gallery.dialog.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gallery.dialog.js')
-rw-r--r--lib/gallery.dialog.js10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/gallery.dialog.js b/lib/gallery.dialog.js
index fef44b38..d6511fd9 100644
--- a/lib/gallery.dialog.js
+++ b/lib/gallery.dialog.js
@@ -21,6 +21,7 @@ function handleDialogEvent(event) {
*/
function openDialog(element, on_success) {
var sHref = $(element).attr("href");
+ var sTitle = $(element).attr("title");
var eDialog = '<div id="gDialog"></div>';
$("body").append(eDialog);
@@ -48,11 +49,12 @@ function openDialog(element, on_success) {
var parent = $("#gDialog").parent().parent();
parent.css("opacity", "0.0");
$("#gDialog").dialog("open");
- var title = $("#gDialog h1:eq(0)").html();
- if (!title) {
- title = $("#gDialog fieldset legend:eq(0)").html();
+ if ($("#gDialog h1").length) {
+ sTitle = $("#gDialog h1:eq(0)").html();
+ } else if ($("#gDialog fieldset legend").length) {
+ sTitle = $("#gDialog fieldset legend:eq(0)").html();
}
- $("#ui-dialog-title-gDialog").html(title);
+ $("#ui-dialog-title-gDialog").html(sTitle);
if (parent.width() < 400) {
parent.css("width", 400);
}