This commit has been accessed 606 times via Git panel.
commit 8ebeba5da71d955cda8009a6b5159adc2a68c55c
tree 1601cbd30290306755391a576d1c6b97b288b50f
parent 9ed0d56480fb30af88d877039c4ae2ed9e809eb5
author Engels Antonio <engels@majcms.org> 1332875729 +0800
committer Engels Antonio <engels@majcms.org> 1332875729 +0800
Improve auto-resize of filedrop list
diff --git a/filedrop.php b/filedrop.php
index 8014959..8a0c001 100644
--- a/filedrop.php
+++ b/filedrop.php
@@ -98,12 +98,16 @@ if (file_exists("attach/i/$fileUsr/$filedrop_box")) {
}
echo "</table>";
+
+ echo "<script>parent.top.document.getElementById('filedrop').style.height = document.body.parentNode.clientHeight + 'px';</script>";
+ }
+ else {
+ echo "<script>parent.top.document.getElementById('filedrop').style.height = 0;</script>";
}
+}
$_SESSION['clean_up_i'] = $filedrop_box;
-}
-
?>
<script>
diff --git a/post.php b/post.php
index 91d634b..0fc1ffc 100644
--- a/post.php
+++ b/post.php
@@ -86,21 +86,4 @@ if (isset($_POST['new']) and !empty($_POST['new']) and is_numeric($_POST['new'])
</div>
-<script>
-<!--
-function calcHeight(iframe_id)
-{
- var iframe_height=document.getElementById(iframe_id).contentWindow.document.body.scrollHeight;
-
- if (iframe_height<9)
- {
- document.getElementById(iframe_id).height=0;
- }
- else {
- document.getElementById(iframe_id).height=iframe_height;
- }
-}
-//-->
-</script>
-
-<iframe id="filedrop" onLoad="calcHeight('filedrop');" name="filedrop" src="filedrop.php" frameborder="0" scrolling="0" width="100%" height="0"></iframe>
+<iframe id="filedrop" name="filedrop" src="filedrop.php" frameborder="0" scrolling="0" width="100%" height="0"></iframe>
diff --git a/send.php b/send.php
index 2b0ff82..aa53b23 100644
--- a/send.php
+++ b/send.php
@@ -268,21 +268,4 @@ else {
</div>
-<script>
-<!--
-function calcHeight(iframe_id)
-{
- var iframe_height=document.getElementById(iframe_id).contentWindow.document.body.scrollHeight;
-
- if (iframe_height<9)
- {
- document.getElementById(iframe_id).height=0;
- }
- else {
- document.getElementById(iframe_id).height=iframe_height;
- }
-}
-//-->
-</script>
-
-<iframe id="filedrop" onLoad="calcHeight('filedrop');" name="filedrop" src="filedrop.php" frameborder="0" scrolling="0" width="100%" height="0"></iframe>
+<iframe id="filedrop" name="filedrop" src="filedrop.php" frameborder="0" scrolling="0" width="100%" height="0"></iframe>
tree 1601cbd30290306755391a576d1c6b97b288b50f
parent 9ed0d56480fb30af88d877039c4ae2ed9e809eb5
author Engels Antonio <engels@majcms.org> 1332875729 +0800
committer Engels Antonio <engels@majcms.org> 1332875729 +0800
Improve auto-resize of filedrop list
diff --git a/filedrop.php b/filedrop.php
index 8014959..8a0c001 100644
--- a/filedrop.php
+++ b/filedrop.php
@@ -98,12 +98,16 @@ if (file_exists("attach/i/$fileUsr/$filedrop_box")) {
}
echo "</table>";
+
+ echo "<script>parent.top.document.getElementById('filedrop').style.height = document.body.parentNode.clientHeight + 'px';</script>";
+ }
+ else {
+ echo "<script>parent.top.document.getElementById('filedrop').style.height = 0;</script>";
}
+}
$_SESSION['clean_up_i'] = $filedrop_box;
-}
-
?>
<script>
diff --git a/post.php b/post.php
index 91d634b..0fc1ffc 100644
--- a/post.php
+++ b/post.php
@@ -86,21 +86,4 @@ if (isset($_POST['new']) and !empty($_POST['new']) and is_numeric($_POST['new'])
</div>
-<script>
-<!--
-function calcHeight(iframe_id)
-{
- var iframe_height=document.getElementById(iframe_id).contentWindow.document.body.scrollHeight;
-
- if (iframe_height<9)
- {
- document.getElementById(iframe_id).height=0;
- }
- else {
- document.getElementById(iframe_id).height=iframe_height;
- }
-}
-//-->
-</script>
-
-<iframe id="filedrop" onLoad="calcHeight('filedrop');" name="filedrop" src="filedrop.php" frameborder="0" scrolling="0" width="100%" height="0"></iframe>
+<iframe id="filedrop" name="filedrop" src="filedrop.php" frameborder="0" scrolling="0" width="100%" height="0"></iframe>
diff --git a/send.php b/send.php
index 2b0ff82..aa53b23 100644
--- a/send.php
+++ b/send.php
@@ -268,21 +268,4 @@ else {
</div>
-<script>
-<!--
-function calcHeight(iframe_id)
-{
- var iframe_height=document.getElementById(iframe_id).contentWindow.document.body.scrollHeight;
-
- if (iframe_height<9)
- {
- document.getElementById(iframe_id).height=0;
- }
- else {
- document.getElementById(iframe_id).height=iframe_height;
- }
-}
-//-->
-</script>
-
-<iframe id="filedrop" onLoad="calcHeight('filedrop');" name="filedrop" src="filedrop.php" frameborder="0" scrolling="0" width="100%" height="0"></iframe>
+<iframe id="filedrop" name="filedrop" src="filedrop.php" frameborder="0" scrolling="0" width="100%" height="0"></iframe>