From 46ca3ab51de2974c084cdb7ed8368aa72643eb88 Mon Sep 17 00:00:00 2001
From: str4d <str4d@mail.i2p>
Date: Thu, 12 Jul 2012 13:34:19 +0000
Subject: [PATCH] Used JS changes to fix iframed i2ptunnel scrollbar issue in
 CSS

Also added comments to the JS to point out that the issue is that
offsetHeight doesn't include the very top or bottom margins.
---
 apps/routerconsole/jsp/i2ptunnelmgr.jsp             | 4 ++++
 apps/routerconsole/jsp/torrents.jsp                 | 4 ++++
 installer/resources/themes/console/dark/console.css | 4 ++++
 installer/resources/themes/console/dark/default.css | 4 ++++
 4 files changed, 16 insertions(+)

diff --git a/apps/routerconsole/jsp/i2ptunnelmgr.jsp b/apps/routerconsole/jsp/i2ptunnelmgr.jsp
index 5db19465ff..75607b663a 100644
--- a/apps/routerconsole/jsp/i2ptunnelmgr.jsp
+++ b/apps/routerconsole/jsp/i2ptunnelmgr.jsp
@@ -28,6 +28,10 @@
       doc.getElementsByClassName('panel')[0].className += ' iframed';
   }
   function resizeFrame(f) {
+      // offsetHeight returns the height of the visible area for an object, in pixels.
+      // The value contains the height with the padding, scrollBar, and the border,
+      // but does not include the margin. Therefore, any content within the iframe
+      // should have no margins at the very top or very bottom to avoid a scrollbar.
       var doc = 'contentDocument' in f? f.contentDocument : f.contentWindow.document;
       f.style.height = doc.body.offsetHeight + "px";
   }
diff --git a/apps/routerconsole/jsp/torrents.jsp b/apps/routerconsole/jsp/torrents.jsp
index ed052ace0c..e029a48cd6 100644
--- a/apps/routerconsole/jsp/torrents.jsp
+++ b/apps/routerconsole/jsp/torrents.jsp
@@ -27,6 +27,10 @@
       doc.body.className += ' iframed';
   }
   function resizeFrame(f) {
+      // offsetHeight returns the height of the visible area for an object, in pixels.
+      // The value contains the height with the padding, scrollBar, and the border,
+      // but does not include the margin. Therefore, any content within the iframe
+      // should have no margins at the very top or very bottom to avoid a scrollbar.
       var doc = 'contentDocument' in f? f.contentDocument : f.contentWindow.document;
       f.style.height = doc.body.offsetHeight + "px";
   }
diff --git a/installer/resources/themes/console/dark/console.css b/installer/resources/themes/console/dark/console.css
index 4b63b0a989..8dbb10cd28 100644
--- a/installer/resources/themes/console/dark/console.css
+++ b/installer/resources/themes/console/dark/console.css
@@ -1321,3 +1321,7 @@ div.applabel {
 }
 
 /* end home page */
+
+iframe.iframed {
+     margin: 15px 0 0;
+}
diff --git a/installer/resources/themes/console/dark/default.css b/installer/resources/themes/console/dark/default.css
index 53a53cf588..49461071fd 100644
--- a/installer/resources/themes/console/dark/default.css
+++ b/installer/resources/themes/console/dark/default.css
@@ -225,6 +225,10 @@ hr {
      margin: 16px auto -8px auto !important;
 }
 
+.iframed .panel.iframed {
+     margin: 0 auto -8px auto !important;
+}
+
 .panel td:first-child {
      font-weight: bold;	
 }
-- 
GitLab