[BUGFIX] Keep scroll position in Debug Console 79/39579/4
authorAndreas Fernandez <a.fernandez@scripting-base.de>
Sat, 16 May 2015 11:58:24 +0000 (13:58 +0200)
committerMarkus Klein <markus.klein@typo3.org>
Sat, 16 May 2015 13:53:33 +0000 (15:53 +0200)
If autoscroll is either disabled or content is written into
an inactive tab, stay at the scroll position of the affected tab.

Resolves: #66992
Releases: master
Change-Id: I8a3a16fe703a76ea3a66a31195b05e06e83b8987
Reviewed-on: http://review.typo3.org/39579
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
typo3/sysext/backend/Resources/Public/JavaScript/DebugConsole.js

index 898de64..4f8fcac 100644 (file)
@@ -111,7 +111,7 @@ define('TYPO3/CMS/Backend/DebugConsole', ['jquery'], function ($) {
         */
        DebugConsole.attachToViewport = function() {
                var $viewport = $('#typo3-contentContainer');
-               if (!$.contains(DebugConsole.$consoleDom, $viewport)) {
+               if ($viewport.has(DebugConsole.$consoleDom).length === 0) {
                        $viewport.append(DebugConsole.$consoleDom);
                }
        };
@@ -163,16 +163,14 @@ define('TYPO3/CMS/Backend/DebugConsole', ['jquery'], function ($) {
                }
 
                DebugConsole.incrementInactiveTabCounter($tab);
-               DebugConsole.incrementUnreadMessagesIfCollapsed()
+               DebugConsole.incrementUnreadMessagesIfCollapsed();
 
-               var $messageBox = $('#' + tabIdentifier + ' .t3js-messages');
-               $messageBox.append($line);
-
-               if (DebugConsole.settings.autoscroll) {
+               var $messageBox = $('#' + tabIdentifier + ' .t3js-messages'),
+                       isMessageBoxActive = $messageBox.parent().hasClass('active');
 
-                       var activeTabIdentifier = $debugTabs.find('.active').data('identifier'),
-                               $activeMessageBox = $('#' + activeTabIdentifier + ' .t3js-messages');
-                       $activeMessageBox.scrollTop($activeMessageBox[0].scrollHeight);
+               $messageBox.append($line);
+               if (DebugConsole.settings.autoscroll && isMessageBoxActive) {
+                       $messageBox.scrollTop($messageBox.prop('scrollHeight'));
                }
        };
 
@@ -234,7 +232,7 @@ define('TYPO3/CMS/Backend/DebugConsole', ['jquery'], function ($) {
                        $badge = $topbar.find('.badge');
 
                $badge.text('');
-       }
+       };
 
        /**
         * Reset the console to it's virginity