From 768b3f3affbb059b6423e96d306590fc54f16cfd Mon Sep 17 00:00:00 2001
From: Marius Burkard <m.burkard@pixcept.de>
Date: Fri, 17 Jun 2016 18:05:19 +0200
Subject: [PATCH] - interrupt scrolling on user input, fixed #3936

---
 .../themes/default/assets/javascripts/ispconfig.js    | 11 ++++++++---
 interface/web/themes/default/templates/main.tpl.htm   |  2 +-
 .../web/themes/default/templates/main_login.tpl.htm   |  2 +-
 3 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/interface/web/themes/default/assets/javascripts/ispconfig.js b/interface/web/themes/default/assets/javascripts/ispconfig.js
index 21c8c1bb14..a2b9907aef 100644
--- a/interface/web/themes/default/assets/javascripts/ispconfig.js
+++ b/interface/web/themes/default/assets/javascripts/ispconfig.js
@@ -618,9 +618,12 @@ $(document).on("change", function(event) {
 	}
 });
 
+var $page = $('html, body');
+
 $(document).on('click', 'a[data-load-content],button[data-load-content]', function(e) {
 	e.preventDefault();
-	$('html, body').animate({scrollTop: 0}, 1000);
+	$page.on('scroll mousedown wheel DOMMouseScroll mousewheel keyup touchmove', function() { $page.stop(); });
+	$page.animate({scrollTop: 0}, 1000, function() { $page.off('scroll mousedown wheel DOMMouseScroll mousewheel keyup touchmove', function() { $page.stop(); }); });
 	
 	var content_to_load = $(this).attr('data-load-content');
 	if(!content_to_load) return this;
@@ -630,7 +633,8 @@ $(document).on('click', 'a[data-load-content],button[data-load-content]', functi
 
 $(document).on('click', 'a[data-capp],button[data-capp]', function(e) {
 	e.preventDefault();
-	$('html, body').animate({scrollTop: 0}, 1000);
+	$page.on('scroll mousedown wheel DOMMouseScroll mousewheel keyup touchmove', function() { $page.stop(); });
+	$page.animate({scrollTop: 0}, 1000, function() { $page.off('scroll mousedown wheel DOMMouseScroll mousewheel keyup touchmove', function() { $page.stop(); }); });
 	
 	var content_to_load = $(this).attr('data-capp');
 	if(!content_to_load) return this;
@@ -640,7 +644,8 @@ $(document).on('click', 'a[data-capp],button[data-capp]', function(e) {
 
 $(document).on('click', 'a[data-submit-form],button[data-submit-form]', function(e) {
 	e.preventDefault();
-	$('html, body').animate({scrollTop: 0}, 1000);
+	$page.on('scroll mousedown wheel DOMMouseScroll mousewheel keyup touchmove', function() { $page.stop(); });
+	$page.animate({scrollTop: 0}, 1000, function() { $page.off('scroll mousedown wheel DOMMouseScroll mousewheel keyup touchmove', function() { $page.stop(); }); });
 	
 	var $el = $(this);
 	var act = $el.attr('data-form-action');
diff --git a/interface/web/themes/default/templates/main.tpl.htm b/interface/web/themes/default/templates/main.tpl.htm
index 058eec33ab..24a84c5065 100644
--- a/interface/web/themes/default/templates/main.tpl.htm
+++ b/interface/web/themes/default/templates/main.tpl.htm
@@ -84,7 +84,7 @@
   <script type="text/javascript" src="js/jquery.min.js"></script>
   <script src='themes/<tmpl_var name='current_theme'>/assets/javascripts/bootstrap.min.js'></script>
   <script src='themes/<tmpl_var name='current_theme'>/assets/javascripts/bootstrap-datetimepicker.min.js'></script>
-  <script src='themes/<tmpl_var name='current_theme'>/assets/javascripts/ispconfig.min.js'></script>
+  <script src='themes/<tmpl_var name='current_theme'>/assets/javascripts/ispconfig.js'></script>
   <script src='themes/<tmpl_var name='current_theme'>/assets/javascripts/modernizr.custom.min.js'></script>
   <script src='themes/<tmpl_var name='current_theme'>/assets/javascripts/pushy.min.js'></script>
   <script src='themes/<tmpl_var name='current_theme'>/assets/javascripts/responsive.min.js'></script>
diff --git a/interface/web/themes/default/templates/main_login.tpl.htm b/interface/web/themes/default/templates/main_login.tpl.htm
index afcf4cf317..dd31363f3c 100644
--- a/interface/web/themes/default/templates/main_login.tpl.htm
+++ b/interface/web/themes/default/templates/main_login.tpl.htm
@@ -41,7 +41,7 @@
   <script type="text/javascript" src="../js/jquery.min.js"></script>
   <script src='../themes/<tmpl_var name='current_theme'>/assets/javascripts/bootstrap.min.js'></script>
   <script src='../themes/<tmpl_var name='current_theme'>/assets/javascripts/bootstrap-datetimepicker.min.js'></script>
-  <script src='../themes/<tmpl_var name='current_theme'>/assets/javascripts/ispconfig.min.js'></script>
+  <script src='../themes/<tmpl_var name='current_theme'>/assets/javascripts/ispconfig.js'></script>
   <script src='../themes/<tmpl_var name='current_theme'>/assets/javascripts/modernizr.custom.min.js'></script>
   <script src='../themes/<tmpl_var name='current_theme'>/assets/javascripts/pushy.min.js'></script>
   <script src='../themes/<tmpl_var name='current_theme'>/assets/javascripts/responsive.min.js'></script>
-- 
GitLab