summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2008-12-16 19:12:24 +0000
committerTim Almdal <tnalmdal@shaw.ca>2008-12-16 19:12:24 +0000
commitc32988a097d6199194ae156fafbac444a0b9b56a (patch)
tree6383d4374a8d3529cc908186b11c6964ec623311
parent59bc7dc22c650e731ae3db1f5d6df0d05a389191 (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.
-rw-r--r--modules/watermark/js/watermark.js16
-rw-r--r--modules/watermark/views/watermark_position.html.php16
2 files changed, 17 insertions, 15 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");
+}
diff --git a/modules/watermark/views/watermark_position.html.php b/modules/watermark/views/watermark_position.html.php
index 2cf10a79..6e848bf8 100644
--- a/modules/watermark/views/watermark_position.html.php
+++ b/modules/watermark/views/watermark_position.html.php
@@ -1,19 +1,5 @@
<script>
-$("#gDialog").ready(function() {
- 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");
-});
+$("#gDialog").ready(watermark_dialog_initialize());
</script>
<div id="gWatermarkAdmin">
<div id="gTarget" class="droppable">