diff options
author | Tim Almdal <tnalmdal@shaw.ca> | 2008-12-16 19:12:24 +0000 |
---|---|---|
committer | Tim Almdal <tnalmdal@shaw.ca> | 2008-12-16 19:12:24 +0000 |
commit | c32988a097d6199194ae156fafbac444a0b9b56a (patch) | |
tree | 6383d4374a8d3529cc908186b11c6964ec623311 /modules/watermark/js/watermark.js | |
parent | 59bc7dc22c650e731ae3db1f5d6df0d05a389191 (diff) |
Separate the handling of the dialog resizing into the watermark.js, so we don't have to download the watermark dialog initialization with each request.
Diffstat (limited to 'modules/watermark/js/watermark.js')
-rw-r--r-- | modules/watermark/js/watermark.js | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/modules/watermark/js/watermark.js b/modules/watermark/js/watermark.js index 1770abd9..3c7ca252 100644 --- a/modules/watermark/js/watermark.js +++ b/modules/watermark/js/watermark.js @@ -10,3 +10,19 @@ function ajaxify_watermark_add_form() { } }); } + +function watermark_dialog_initialize() { + var container = $("#gDialog").parent().parent(); + var container_height = $(container).attr("offsetHeight"); + var container_width = $(container).attr("offsetWidth"); + + var new_height = $("#gDialog").attr("offsetHeight") + + container.find("div.ui-dialog-titlebar").attr("offsetHeight") + + container.find("div.ui-dialog-buttonpane").attr("offsetHeight"); + var height = Math.max(new_height, container_height); + var width = Math.max($("#gDialog").attr("offsetWidth"), container_width); + container.css("height", height + "px"); + container.css("width", width + "px"); + container.css("top", ((document.height - height) / 2) + "px"); + container.css("left", ((document.width - width) / 2) + "px"); +} |