From 93c49f7cfec1d776104b4cb5ce7dc8f159ddca9c Mon Sep 17 00:00:00 2001
From: Tim Repke <timmothey@gmx.de>
Date: Fri, 21 Aug 2015 17:33:44 +0200
Subject: [PATCH] added a small hack to prevent the page from scrolling whilst
 scrolling in the logs

---
 registration-system/view/default_index.php    | 24 +++++++++----------
 .../view/signups/game1/index.php              | 17 +++++++++++++
 2 files changed, 29 insertions(+), 12 deletions(-)

diff --git a/registration-system/view/default_index.php b/registration-system/view/default_index.php
index 1533ff7..f581fe2 100644
--- a/registration-system/view/default_index.php
+++ b/registration-system/view/default_index.php
@@ -35,21 +35,21 @@
 </head>
 <body>
 <div class="shadowbox">
-<div id="headerbox">
-    <div class="headerboxshade"><h1>Fachschaftsfahrt</h1></div>
-	<div class="headerboxshade"><h2>Informatik</h2></div>
-    <p></p>
-</div>
-<div id="menubox">
+    <div id="headerbox">
+        <div class="headerboxshade"><h1>Fachschaftsfahrt</h1></div>
+        <div class="headerboxshade"><h2>Informatik</h2></div>
+        <p></p>
+    </div>
+    <div id="menubox">
 
-    <?php
-        show_content();
-    ?>
+        <?php
+            show_content();
+        ?>
 
 
-</div>
-<div id="footerbox">&copy;<?php echo date("Y"); ?> Fachschaftsinitiative Informatik der Humboldt Universität zu Berlin.</div>
-<img src="view/graphics/studityp_5.gif" style="position: fixed;bottom: 5px;left:0px" />
+    </div>
+    <div id="footerbox">&copy;<?php echo date("Y"); ?> Fachschaftsinitiative Informatik der Humboldt Universität zu Berlin.</div>
+    <img src="view/graphics/studityp_5.gif" style="position: fixed;bottom: 5px;left:0px" />
 
 </div>
 </body>
diff --git a/registration-system/view/signups/game1/index.php b/registration-system/view/signups/game1/index.php
index 73fe954..2429610 100644
--- a/registration-system/view/signups/game1/index.php
+++ b/registration-system/view/signups/game1/index.php
@@ -82,6 +82,23 @@ class Game1SignupMethod extends SignupMethod {
                 });
                 game.run();
 
+                // this following stuff is to prevent the page from scrolling, when the user
+                // actually just wants to scroll inside the logs.
+                // it removes the main scrollbar and adds a padding of its size to replace the space
+                window.onload = function() {
+                    var scrollbarWidth = window.innerWidth - document.documentElement.clientWidth;
+                    var x = document.getElementsByClassName("sidebar-log");
+                    for (var i = 0; i < x.length; i++) {
+                        x[i].addEventListener("mouseout", function(){
+                            document.body.style.overflow=\'auto\';
+                            document.body.style.paddingRight = "0px";
+                        }, false);
+                        x[i].addEventListener("mouseover", function(){
+                            document.body.style.overflow=\'hidden\';
+                            document.body.style.paddingRight = scrollbarWidth+"px";
+                        }, false);
+                    }
+                };
             </script>';
     }
 
-- 
GitLab