summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRomain LE DISEZ <romain.git@ledisez.net>2009-07-16 17:31:20 +0200
committerRomain LE DISEZ <romain.git@ledisez.net>2009-07-16 17:31:20 +0200
commit7f5030ac208c30a7dc576a57cd9e665022ccbde5 (patch)
tree6b23e78aa8cc2dd363def46e083217e3c9b52f1b /lib
parent923732ca4dca6db218f6252a7133cd72f98fa086 (diff)
parent85b0f580291e375a2c5ec21b8210e59023ee24c2 (diff)
Merge commit 'upstream/master'
Diffstat (limited to 'lib')
-rw-r--r--lib/gallery.dialog.js18
-rw-r--r--lib/gallery.show_full_size.js8
2 files changed, 12 insertions, 14 deletions
diff --git a/lib/gallery.dialog.js b/lib/gallery.dialog.js
index 72c7cdf8..74c2f20e 100644
--- a/lib/gallery.dialog.js
+++ b/lib/gallery.dialog.js
@@ -11,23 +11,20 @@ function handleDialogEvent(event) {
event.preventDefault();
}
-function ajaxify_dialog(on_success) {
+function ajaxify_dialog() {
$("#gDialog form").ajaxForm({
dataType: "json",
success: function(data) {
if (data.form) {
$("#gDialog form").replaceWith(data.form);
- ajaxify_dialog(on_success);
+ ajaxify_dialog();
on_form_loaded();
if (typeof data.reset == 'function') {
eval(data.reset + '()');
}
}
if (data.result == "success") {
- $("#gDialog").dialog("close");
- if (on_success) {
- on_success();
- } else if (data.location) {
+ if (data.location) {
window.location = data.location;
} else {
window.location.reload();
@@ -46,11 +43,10 @@ function ajaxify_dialog(on_success) {
* @see handleDialogEvent()
* @see showLoading()
*/
-function openDialog(element, on_success) {
+function openDialog(element) {
var sHref = $(element).attr("href");
var sTitle = $(element).attr("title");
var eDialog = '<div id="gDialog"></div>';
- // @todo Fix i18n for Cancel link
var dialogWidth;
$("body").append(eDialog);
@@ -93,13 +89,15 @@ function openDialog(element, on_success) {
$("#gDialog").dialog('option', 'title', $("#gDialog fieldset legend:eq(0)").html());
}
- ajaxify_dialog(on_success);
+ ajaxify_dialog();
});
return false;
}
function on_form_loaded() {
- var eCancel = '<a href="javascript: closeDialog()" class="gCancel">Cancel</a>';
+ // Should be defined (and localized) in the theme
+ MSG_CANCEL = MSG_CANCEL || 'Cancel';
+ var eCancel = '<a href="javascript: closeDialog()" class="gCancel">' + MSG_CANCEL + '</a>';
if ($("#gDialog .submit").length) {
$("#gDialog .submit").addClass("ui-state-default ui-corner-all");
$("#gDialog .submit").parent().append(eCancel);
diff --git a/lib/gallery.show_full_size.js b/lib/gallery.show_full_size.js
index b2895c23..8b271db9 100644
--- a/lib/gallery.show_full_size.js
+++ b/lib/gallery.show_full_size.js
@@ -26,10 +26,10 @@ var show_full_size = function(image_url, image_width, image_height) {
// handle the case where the calculation is almost zero (2.14e-14)
return {
- top: ((windowHeight - imageHeight) / 2).toFixed(2),
- left: ((windowWidth - imageWidth) / 2).toFixed(2),
- width: imageWidth.toFixed(2),
- height: imageHeight.toFixed(2)
+ top: Number((windowHeight - imageHeight) / 2),
+ left: Number((windowWidth - imageWidth) / 2),
+ width: Number(imageWidth),
+ height: Number(imageHeight)
};
}