From 768b3f3affbb059b6423e96d306590fc54f16cfd Mon Sep 17 00:00:00 2001 From: Marius Burkard <m.burkard@pixcept.de> Date: Fri, 17 Jun 2016 12:05:19 -0400 Subject: [PATCH] - interrupt scrolling on user input, fixed #3936 --- interface/web/themes/default/assets/javascripts/ispconfig.js | 42 ++++++++++++++++++++++++++++++++++++------ 1 files changed, 36 insertions(+), 6 deletions(-) diff --git a/interface/web/themes/default/assets/javascripts/ispconfig.js b/interface/web/themes/default/assets/javascripts/ispconfig.js index b9ebee4..a2b9907 100644 --- a/interface/web/themes/default/assets/javascripts/ispconfig.js +++ b/interface/web/themes/default/assets/javascripts/ispconfig.js @@ -364,9 +364,11 @@ }, loadInitContent: function() { + var startpage = $('#pageContent').attr('data-startpage'); + if(!startpage) startpage = 'dashboard/dashboard.php'; var pageContentObject = $.ajax({ type: "GET", - url: "dashboard/dashboard.php", + url: startpage, data: "", dataType: "html", beforeSend: function() { @@ -616,9 +618,12 @@ } }); +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; @@ -628,7 +633,8 @@ $(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; @@ -638,7 +644,8 @@ $(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'); @@ -655,9 +662,9 @@ $("#pageForm .table #Filter").trigger('click'); } //Use $ submit with keypress Enter in forms - if (event.which == '13' && $(".pnl_formsarea button.positive").length > 0 && event.target.localName != 'textarea' && $(event.target).is(':input')) { + if (event.which == '13' && $(".tab-content button.formbutton-success").length > 0 && event.target.localName != 'textarea' && $(event.target).is(':input')) { event.preventDefault(); - $(".pnl_formsarea button.positive:first").not("[disabled='disabled']").trigger('click'); + $(".tab-content button.formbutton-success").not("[disabled='disabled']").trigger('click'); } }); @@ -702,6 +709,29 @@ template2.insertAtCaret(placeholderContentText); }); +$(document).on("click", "[data-check-fields] > input[type='checkbox']", function() { + if($(this).is(':checked')) { + var flds = $(this).parent().attr('data-check-fields'); + var tmp = flds.split(/,/); + for(var i = 0; i < tmp.length; i++) { + var fname = tmp[i]; + $('input[type="checkbox"][name="' + fname + '"]').prop('checked', true); + } + } +}); + +$(document).on("click", "[data-uncheck-fields] > input[type='checkbox']", function() { + if($(this).is(':checked') == false) { + var flds = $(this).parent().attr('data-uncheck-fields'); + var tmp = flds.split(/,/); + for(var i = 0; i < tmp.length; i++) { + var fname = tmp[i]; + $('input[type="checkbox"][name="' + fname + '"]').prop('checked', false); + } + } +}); + + $(document).on('ready', function () { $.fn.extend({ insertAtCaret: function(myValue){ -- Gitblit v1.9.1