From 7e26df2eb4298e150c6d100c13562989db42a06a Mon Sep 17 00:00:00 2001
From: HouTeng Chan <ht-chen21@mails.tsinghua.edu.cn>
Date: Tue, 1 Oct 2024 04:52:27 +0000
Subject: [PATCH] Update file attributions.html

---
 wiki/pages/attributions.html | 24 ++++++++++++++++++++----
 1 file changed, 20 insertions(+), 4 deletions(-)

diff --git a/wiki/pages/attributions.html b/wiki/pages/attributions.html
index 44a04182..71bc09fa 100644
--- a/wiki/pages/attributions.html
+++ b/wiki/pages/attributions.html
@@ -56,8 +56,8 @@
     }
     #igem-attribution-form {
       width: 100%;
-      height: 80vh; /* Adjust the height as needed */
       border: none;
+      min-height: 500px; /* Set a minimum height */
     }
   </style>
 </head>
@@ -77,9 +77,6 @@
     
     <div class="row mt-4">
       <div class="col-lg-12">
-        <script type="text/javascript">
-          // iframe height listener script
-        </script>
         <iframe
           id="igem-attribution-form"
           src="https://teams.igem.org/wiki/Tsinghua/attributions"
@@ -88,6 +85,25 @@
       </div>
     </div>
   </div>
+
+  <script type="text/javascript">
+    function adjustIframeHeight() {
+      var iframe = document.getElementById('igem-attribution-form');
+      iframe.onload = function() {
+        iframe.style.height = iframe.contentWindow.document.body.scrollHeight + 'px';
+      };
+
+      // Listen for changes in iframe content
+      window.addEventListener('message', function(event) {
+        if (event.data.type === 'resize') {
+          iframe.style.height = event.data.height + 'px';
+        }
+      }, false);
+    }
+
+    // Execute when the page is fully loaded
+    window.onload = adjustIframeHeight;
+  </script>
 </body>
 </html>
 {% endblock %}
\ No newline at end of file
-- 
GitLab