From 3e47c3f82bc9d70c9a52da9daf3c2f20338597b2 Mon Sep 17 00:00:00 2001 From: Atul Pratap Singh Date: Sat, 17 Aug 2013 02:24:07 +0530 Subject: [PATCH 01/10] Auto-expand the selected database, feature 1435 --- js/common.js | 16 +++ js/navigation.js | 121 ++++++++++-------- libraries/navigation/NavigationTree.class.php | 3 +- 3 files changed, 83 insertions(+), 57 deletions(-) diff --git a/js/common.js b/js/common.js index c4f4bab7ef..00521c2473 100644 --- a/js/common.js +++ b/js/common.js @@ -41,6 +41,22 @@ var PMA_commonParams = (function () { if (params[i] !== undefined && params[i] !== obj[i]) { reload = true; } + // To expand the database in use and collapse the previous one + if(i == 'db' && obj[i] !== '') { + var $expandElem, $icon; + if(params['db'] !== '' && params['db'] !== obj[i]) { + $expandElem = $('#pma_navigation_tree a.dbLink:contains("' + params['db'] + '")') + .parent().find('a.expander').eq(0); + $icon = $expandElem.find('img'); + if ($icon.is('.ic_b_minus')) + PMA_expandNavigationTree($expandElem); + } + $expandElem = $('#pma_navigation_tree a.dbLink:contains("' + obj[i] + '")') + .parent().find('a.expander').eq(0); + $icon = $expandElem.find('img'); + if ($icon.is('.ic_b_plus')) + PMA_expandNavigationTree($expandElem); + } params[i] = obj[i]; } if (reload) { diff --git a/js/navigation.js b/js/navigation.js index 9198300a87..be02ff2df8 100644 --- a/js/navigation.js +++ b/js/navigation.js @@ -29,63 +29,9 @@ $(function() { $('#pma_navigation_tree a.expander').live('click', function(event) { event.preventDefault(); event.stopImmediatePropagation(); - var $this = $(this); - var $children = $this.closest('li').children('div.list_container'); - var $icon = $this.find('img'); - if ($this.hasClass('loaded')) { - if ($icon.is('.ic_b_plus')) { - $icon.removeClass('ic_b_plus').addClass('ic_b_minus'); - $children.show('fast'); - } else { - $icon.removeClass('ic_b_minus').addClass('ic_b_plus'); - $children.hide('fast'); - } - } else { - var $destination = $this.closest('li'); - var $throbber = $('#pma_navigation .throbber') - .first() - .clone() - .css('visibility', 'visible'); - $icon.hide(); - $throbber.insertBefore($icon); - - var searchClause = PMA_fastFilter.getSearchClause(); - var searchClause2 = PMA_fastFilter.getSearchClause2($(this)); - - var params = { - aPath: $(this).find('span.aPath').text(), - vPath: $(this).find('span.vPath').text(), - pos: $(this).find('span.pos').text(), - pos2_name: $(this).find('span.pos2_name').text(), - pos2_value: $(this).find('span.pos2_value').text(), - searchClause: searchClause, - searchClause2: searchClause2 - }; - var url = $('#pma_navigation').find('a.navigation_url').attr('href'); - $.get(url, params, function (data) { - if (data.success === true) { - $this.addClass('loaded'); - $destination.find('div.list_container').remove(); // FIXME: Hack, there shouldn't be a list container there - $destination.append(data.message); - $icon.removeClass('ic_b_plus').addClass('ic_b_minus'); - $destination - .children('div.list_container') - .show('fast'); - if ($destination.find('ul > li').length == 1) { - $destination.find('ul > li') - .find('a.expander.container') - .click(); - } - } else { - PMA_ajaxShowMessage(data.error, false); - } - $icon.show(); - $throbber.remove(); - }); - } - $(this).blur(); + PMA_expandNavigationTree($(this)); }); - + /** * Register event handler for click on the reload * navigation icon at the top of the panel @@ -212,6 +158,69 @@ $(function() { }); }); +/** + * Expands/collapses the navigation tree + * + * @param object $expandElem the element that initiated the expanding + * @return void + */ +function PMA_expandNavigationTree($expandElem) { + var $children = $expandElem.closest('li').children('div.list_container'); + var $icon = $expandElem.find('img'); + if ($expandElem.hasClass('loaded')) { + if ($icon.is('.ic_b_plus')) { + $icon.removeClass('ic_b_plus').addClass('ic_b_minus'); + $children.show('fast'); + } else { + $icon.removeClass('ic_b_minus').addClass('ic_b_plus'); + $children.hide('fast'); + } + } else { + var $destination = $expandElem.closest('li'); + var $throbber = $('#pma_navigation .throbber') + .first() + .clone() + .css('visibility', 'visible'); + $icon.hide(); + $throbber.insertBefore($icon); + + var searchClause = PMA_fastFilter.getSearchClause(); + var searchClause2 = PMA_fastFilter.getSearchClause2($expandElem); + + var params = { + aPath: $expandElem.find('span.aPath').text(), + vPath: $expandElem.find('span.vPath').text(), + pos: $expandElem.find('span.pos').text(), + pos2_name: $expandElem.find('span.pos2_name').text(), + pos2_value: $expandElem.find('span.pos2_value').text(), + searchClause: searchClause, + searchClause2: searchClause2 + }; + var url = $('#pma_navigation').find('a.navigation_url').attr('href'); + $.get(url, params, function (data) { + if (data.success === true) { + $expandElem.addClass('loaded'); + $destination.find('div.list_container').remove(); // FIXME: Hack, there shouldn't be a list container there + $destination.append(data.message); + $icon.removeClass('ic_b_plus').addClass('ic_b_minus'); + $destination + .children('div.list_container') + .show('fast'); + if ($destination.find('ul > li').length == 1) { + $destination.find('ul > li') + .find('a.expander.container') + .click(); + } + } else { + PMA_ajaxShowMessage(data.error, false); + } + $icon.show(); + $throbber.remove(); + }); + } + $expandElem.blur(); +} + /** * Reloads the whole navigation tree while preserving its state * diff --git a/libraries/navigation/NavigationTree.class.php b/libraries/navigation/NavigationTree.class.php index 40900cb09b..388e85405a 100644 --- a/libraries/navigation/NavigationTree.class.php +++ b/libraries/navigation/NavigationTree.class.php @@ -881,6 +881,7 @@ class PMA_NavigationTree $retval .= ""; } + $dblinkclass = ' class="dbLink"'; $linkClass = ''; $haveAjax = array( 'functions', @@ -942,7 +943,7 @@ class PMA_NavigationTree } else { $title = ''; } - $retval .= ""; + $retval .= ""; $retval .= htmlspecialchars($node->real_name); $retval .= ""; } From 42a8ad5abbeccc98109a25d93d13e2033339bfa8 Mon Sep 17 00:00:00 2001 From: Atul Pratap Singh Date: Sat, 17 Aug 2013 02:28:48 +0530 Subject: [PATCH 02/10] Set to view the expanded database/table --- js/navigation.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/js/navigation.js b/js/navigation.js index be02ff2df8..c3996f4f66 100644 --- a/js/navigation.js +++ b/js/navigation.js @@ -159,7 +159,7 @@ $(function() { }); /** - * Expands/collapses the navigation tree + * Expands/collapses the navigation tree and sets to view the expanded * * @param object $expandElem the element that initiated the expanding * @return void @@ -171,6 +171,9 @@ function PMA_expandNavigationTree($expandElem) { if ($icon.is('.ic_b_plus')) { $icon.removeClass('ic_b_plus').addClass('ic_b_minus'); $children.show('fast'); + $('#pma_navigation').animate({ + scrollTop: $children.offset().top + }); } else { $icon.removeClass('ic_b_minus').addClass('ic_b_plus'); $children.hide('fast'); @@ -211,6 +214,9 @@ function PMA_expandNavigationTree($expandElem) { .find('a.expander.container') .click(); } + $('#pma_navigation').animate({ + scrollTop: $destination.children('div.list_container').offset().top + }); } else { PMA_ajaxShowMessage(data.error, false); } From 15d03b227305a46c6ab9b6c1b9ad8c38c35f558f Mon Sep 17 00:00:00 2001 From: Atul Pratap Singh Date: Sat, 17 Aug 2013 03:02:38 +0530 Subject: [PATCH 03/10] Move autoexpand to a function --- js/common.js | 20 +++++++------------- js/navigation.js | 23 +++++++++++++++++++++++ 2 files changed, 30 insertions(+), 13 deletions(-) diff --git a/js/common.js b/js/common.js index 00521c2473..0fe08b6328 100644 --- a/js/common.js +++ b/js/common.js @@ -43,19 +43,7 @@ var PMA_commonParams = (function () { } // To expand the database in use and collapse the previous one if(i == 'db' && obj[i] !== '') { - var $expandElem, $icon; - if(params['db'] !== '' && params['db'] !== obj[i]) { - $expandElem = $('#pma_navigation_tree a.dbLink:contains("' + params['db'] + '")') - .parent().find('a.expander').eq(0); - $icon = $expandElem.find('img'); - if ($icon.is('.ic_b_minus')) - PMA_expandNavigationTree($expandElem); - } - $expandElem = $('#pma_navigation_tree a.dbLink:contains("' + obj[i] + '")') - .parent().find('a.expander').eq(0); - $icon = $expandElem.find('img'); - if ($icon.is('.ic_b_plus')) - PMA_expandNavigationTree($expandElem); + PMA_autoExpandDatabaseInUse(params['db'], obj[i]); } params[i] = obj[i]; } @@ -87,6 +75,9 @@ var PMA_commonParams = (function () { PMA_querywindow.refresh(); PMA_reloadNavigation(); } + if(name == 'db' && value !== '') { + PMA_autoExpandDatabaseInUse(params['db'], value); + } params[name] = value; return this; }, @@ -124,6 +115,9 @@ var PMA_commonActions = { */ setDb: function (new_db) { if (new_db != PMA_commonParams.get('db')) { + if(new_db !== '') { + PMA_autoExpandDatabaseInUse(PMA_commonParams.get('db'), new_db); + } PMA_commonParams.set('db', new_db); PMA_querywindow.refresh(); } diff --git a/js/navigation.js b/js/navigation.js index c3996f4f66..a17c8213ff 100644 --- a/js/navigation.js +++ b/js/navigation.js @@ -227,6 +227,29 @@ function PMA_expandNavigationTree($expandElem) { $expandElem.blur(); } +/* + * Auto-expands the newly chosen database + * + * @param string $oldDb + * @param string $newDb + * + */ +function PMA_autoExpandDatabaseInUse($oldDb, $newDb) { + var $expandElem, $icon; + if($oldDb !== '' && $oldDb !== $newDb) { + $expandElem = $('#pma_navigation_tree a.dbLink:contains("' + $oldDb + '")') + .parent().find('a.expander').eq(0); + $icon = $expandElem.find('img'); + if ($icon.is('.ic_b_minus')) + PMA_expandNavigationTree($expandElem); + } + $expandElem = $('#pma_navigation_tree a.dbLink:contains("' + $newDb + '")') + .parent().find('a.expander').eq(0); + $icon = $expandElem.find('img'); + if ($icon.is('.ic_b_plus')) + PMA_expandNavigationTree($expandElem); +} + /** * Reloads the whole navigation tree while preserving its state * From 8146d74c088e9c329ba9895c9baedb49331d99d0 Mon Sep 17 00:00:00 2001 From: Atul Pratap Singh Date: Sun, 25 Aug 2013 18:36:32 +0530 Subject: [PATCH 04/10] set to view should not hide the database name --- js/navigation.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/navigation.js b/js/navigation.js index a17c8213ff..21ccb0ccfd 100644 --- a/js/navigation.js +++ b/js/navigation.js @@ -172,7 +172,7 @@ function PMA_expandNavigationTree($expandElem) { $icon.removeClass('ic_b_plus').addClass('ic_b_minus'); $children.show('fast'); $('#pma_navigation').animate({ - scrollTop: $children.offset().top + scrollTop: $expandElem.closest('li').offset().top }); } else { $icon.removeClass('ic_b_minus').addClass('ic_b_plus'); @@ -215,7 +215,7 @@ function PMA_expandNavigationTree($expandElem) { .click(); } $('#pma_navigation').animate({ - scrollTop: $destination.children('div.list_container').offset().top + scrollTop: $expandElem.closest('li').offset().top }); } else { PMA_ajaxShowMessage(data.error, false); From f0b063400cc100d9f3ed16a949e6950bf46ba81e Mon Sep 17 00:00:00 2001 From: Atul Pratap Singh Date: Sun, 25 Aug 2013 18:45:11 +0530 Subject: [PATCH 05/10] fix autoexpand on use query --- js/sql.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/sql.js b/js/sql.js index 4866e6f98b..90942aa7f5 100644 --- a/js/sql.js +++ b/js/sql.js @@ -296,6 +296,7 @@ AJAX.registerOnload('sql.js', function() { } else if (typeof data.reload != 'undefined') { // this happens if a USE or DROP command was typed PMA_commonActions.setDb(data.db); + PMA_reloadNavigation(); PMA_commonActions.refreshMain(false, function () { if ($('#result_query').length) { $('#result_query').remove(); @@ -306,7 +307,6 @@ AJAX.registerOnload('sql.js', function() { .prependTo('#page_content'); } }); - PMA_reloadNavigation(); } $sqlqueryresults.show().trigger('makegrid'); From 73c3cd906e484c75f19039bd4086daa3fd62b8fa Mon Sep 17 00:00:00 2001 From: Atul Pratap Singh Date: Sun, 25 Aug 2013 22:55:43 +0530 Subject: [PATCH 06/10] Fast-filter box, recent-tables and page-selector should be visible while scrolling navigation, (it eliminates the need to scroll up to find datatbase/recent-table) --- js/navigation.js | 4 ++-- libraries/navigation/NavigationTree.class.php | 2 +- themes/original/css/navigation.css.php | 11 ++++++++++- themes/pmahomme/css/navigation.css.php | 11 ++++++++++- 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/js/navigation.js b/js/navigation.js index 21ccb0ccfd..c56d2a2465 100644 --- a/js/navigation.js +++ b/js/navigation.js @@ -171,7 +171,7 @@ function PMA_expandNavigationTree($expandElem) { if ($icon.is('.ic_b_plus')) { $icon.removeClass('ic_b_plus').addClass('ic_b_minus'); $children.show('fast'); - $('#pma_navigation').animate({ + $('#pma_navigation_tree_content').animate({ scrollTop: $expandElem.closest('li').offset().top }); } else { @@ -214,7 +214,7 @@ function PMA_expandNavigationTree($expandElem) { .find('a.expander.container') .click(); } - $('#pma_navigation').animate({ + $('#pma_navigation_tree_content').animate({ scrollTop: $expandElem.closest('li').offset().top }); } else { diff --git a/libraries/navigation/NavigationTree.class.php b/libraries/navigation/NavigationTree.class.php index 388e85405a..98cdcb8370 100644 --- a/libraries/navigation/NavigationTree.class.php +++ b/libraries/navigation/NavigationTree.class.php @@ -639,7 +639,7 @@ class PMA_NavigationTree $retval = $this->_fastFilterHtml($this->_tree); $retval .= $this->_getPageSelector($this->_tree); $this->groupTree(); - $retval .= "
    "; + $retval .= "
      "; $children = $this->_tree->children; usort($children, array('PMA_NavigationTree', 'sortNode')); $this->_setVisibility(); diff --git a/themes/original/css/navigation.css.php b/themes/original/css/navigation.css.php index 7db6fb8f19..1d8645b261 100644 --- a/themes/original/css/navigation.css.php +++ b/themes/original/css/navigation.css.php @@ -21,7 +21,6 @@ if (! defined('PMA_MINIMUM_COMMON') && ! defined('TESTSUITE')) { color: ; width: px; overflow: hidden; - overflow-y: auto; position: fixed; top: 0; : 0; @@ -32,6 +31,7 @@ if (! defined('PMA_MINIMUM_COMMON') && ! defined('TESTSUITE')) { #pma_navigation_content { width: 100%; + height: 100%; position: absolute; top: 0; : 0; @@ -108,6 +108,15 @@ if (! defined('PMA_MINIMUM_COMMON') && ! defined('TESTSUITE')) { margin: 0.5em 0 0; margin-: 1em; color: #444; + height: 74%; + position: relative; +} +#pma_navigation_tree_content { + width: 100%; + overflow: hidden; + overflow-y: auto; + position: absolute; + height: 100%; } #pma_navigation_tree a { color: ; diff --git a/themes/pmahomme/css/navigation.css.php b/themes/pmahomme/css/navigation.css.php index a853c47924..790941f067 100644 --- a/themes/pmahomme/css/navigation.css.php +++ b/themes/pmahomme/css/navigation.css.php @@ -19,7 +19,6 @@ if (! defined('PMA_MINIMUM_COMMON') && ! defined('TESTSUITE')) { #pma_navigation { width: px; overflow: hidden; - overflow-y: auto; position: fixed; top: 0; : 0; @@ -31,6 +30,7 @@ if (! defined('PMA_MINIMUM_COMMON') && ! defined('TESTSUITE')) { #pma_navigation_content { width: 100%; + height: 100%; position: absolute; top: 0; : 0; @@ -93,6 +93,15 @@ if (! defined('PMA_MINIMUM_COMMON') && ! defined('TESTSUITE')) { margin: 5px 0 0; margin-: 10px; color: #444; + height: 74%; /*it needs to be dynamically set*/ + position: relative; +} +#pma_navigation_tree_content { + width: 100%; + overflow: hidden; + overflow-y: auto; + position: absolute; + height: 100%; } #pma_navigation_tree a { color: ; From 28041ddb80b996ec8b7a66564269cb7ee578f21c Mon Sep 17 00:00:00 2001 From: Atul Pratap Singh Date: Sun, 25 Aug 2013 22:56:37 +0530 Subject: [PATCH 07/10] Hide throbber when not in use to free some area --- js/navigation.js | 10 ++++++++-- themes/pmahomme/css/navigation.css.php | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/js/navigation.js b/js/navigation.js index c56d2a2465..880929d1c6 100644 --- a/js/navigation.js +++ b/js/navigation.js @@ -259,7 +259,10 @@ function PMA_autoExpandDatabaseInUse($oldDb, $newDb) { function PMA_reloadNavigation(callback) { var $throbber = $('#pma_navigation .throbber') .first() - .css('visibility', 'visible'); + .css({ + 'visibility' : 'visible', + 'display' : 'block' + }); var params = { reload: true, pos: $('#pma_navigation_tree').find('a.expander:first > span.pos').text() @@ -302,7 +305,10 @@ function PMA_reloadNavigation(callback) { }); var url = $('#pma_navigation').find('a.navigation_url').attr('href'); $.post(url, params, function (data) { - $throbber.css('visibility', 'hidden'); + $throbber.css('visibility', 'hidden').css({ + 'visibility' : 'hidden', + 'display' : 'none' + }); if (data.success) { $('#pma_navigation_tree').html(data.message).children('div').show(); // Fire the callback, if any diff --git a/themes/pmahomme/css/navigation.css.php b/themes/pmahomme/css/navigation.css.php index 790941f067..48d8ee6228 100644 --- a/themes/pmahomme/css/navigation.css.php +++ b/themes/pmahomme/css/navigation.css.php @@ -84,7 +84,7 @@ if (! defined('PMA_MINIMUM_COMMON') && ! defined('TESTSUITE')) { } #pma_navigation_content > img.throbber { - display: block; + display: none; margin: .3em auto 0; } From a865344279f3977c3ae5d46775f39953bea48f16 Mon Sep 17 00:00:00 2001 From: Atul Pratap Singh Date: Mon, 26 Aug 2013 08:51:52 +0530 Subject: [PATCH 08/10] fix autoscroll, to set to view the currently selected database --- js/navigation.js | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/js/navigation.js b/js/navigation.js index 880929d1c6..f8f8aff2b7 100644 --- a/js/navigation.js +++ b/js/navigation.js @@ -171,9 +171,6 @@ function PMA_expandNavigationTree($expandElem) { if ($icon.is('.ic_b_plus')) { $icon.removeClass('ic_b_plus').addClass('ic_b_minus'); $children.show('fast'); - $('#pma_navigation_tree_content').animate({ - scrollTop: $expandElem.closest('li').offset().top - }); } else { $icon.removeClass('ic_b_minus').addClass('ic_b_plus'); $children.hide('fast'); @@ -214,9 +211,6 @@ function PMA_expandNavigationTree($expandElem) { .find('a.expander.container') .click(); } - $('#pma_navigation_tree_content').animate({ - scrollTop: $expandElem.closest('li').offset().top - }); } else { PMA_ajaxShowMessage(data.error, false); } @@ -227,6 +221,13 @@ function PMA_expandNavigationTree($expandElem) { $expandElem.blur(); } +function scrollToView($element, $container) { + var pushToOffset = $element.offset().top - $container.offset().top + $container.scrollTop(); + $('#pma_navigation_tree_content').stop().animate({ + scrollTop: pushToOffset + }); +} + /* * Auto-expands the newly chosen database * @@ -246,8 +247,12 @@ function PMA_autoExpandDatabaseInUse($oldDb, $newDb) { $expandElem = $('#pma_navigation_tree a.dbLink:contains("' + $newDb + '")') .parent().find('a.expander').eq(0); $icon = $expandElem.find('img'); - if ($icon.is('.ic_b_plus')) + if ($icon.is('.ic_b_plus')) { PMA_expandNavigationTree($expandElem); + setTimeout(function() { + scrollToView($expandElem.closest('li'), $('#pma_navigation_tree_content')); + }, 120); + } } /** From 790d8fd764c8f81056bc94c9cf280755495fa5fe Mon Sep 17 00:00:00 2001 From: Atul Pratap Singh Date: Mon, 26 Aug 2013 17:12:57 +0530 Subject: [PATCH 09/10] fix some logic related to auto-expand/scroll --- js/navigation.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/js/navigation.js b/js/navigation.js index f8f8aff2b7..ea463bd0c2 100644 --- a/js/navigation.js +++ b/js/navigation.js @@ -249,9 +249,11 @@ function PMA_autoExpandDatabaseInUse($oldDb, $newDb) { $icon = $expandElem.find('img'); if ($icon.is('.ic_b_plus')) { PMA_expandNavigationTree($expandElem); + } + if ($oldDb !== $newDb) { setTimeout(function() { scrollToView($expandElem.closest('li'), $('#pma_navigation_tree_content')); - }, 120); + }, 150); } } From e1740a08337cad4795da0c07dd90d851b77cfd4c Mon Sep 17 00:00:00 2001 From: Atul Pratap Singh Date: Mon, 26 Aug 2013 17:23:40 +0530 Subject: [PATCH 10/10] missing docs --- js/navigation.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/js/navigation.js b/js/navigation.js index ea463bd0c2..e0336ef042 100644 --- a/js/navigation.js +++ b/js/navigation.js @@ -221,6 +221,13 @@ function PMA_expandNavigationTree($expandElem) { $expandElem.blur(); } +/* + * Auto-scrolls the newly chosen database + * + * @param object $element The element to set to view + * @param object $container The container srollable element + * + */ function scrollToView($element, $container) { var pushToOffset = $element.offset().top - $container.offset().top + $container.scrollTop(); $('#pma_navigation_tree_content').stop().animate({ @@ -231,12 +238,13 @@ function scrollToView($element, $container) { /* * Auto-expands the newly chosen database * - * @param string $oldDb - * @param string $newDb + * @param string $oldDb The previous database + * @param string $newDb The newly chosen database * */ function PMA_autoExpandDatabaseInUse($oldDb, $newDb) { var $expandElem, $icon; + //Collapse the previous database if($oldDb !== '' && $oldDb !== $newDb) { $expandElem = $('#pma_navigation_tree a.dbLink:contains("' + $oldDb + '")') .parent().find('a.expander').eq(0); @@ -244,12 +252,14 @@ function PMA_autoExpandDatabaseInUse($oldDb, $newDb) { if ($icon.is('.ic_b_minus')) PMA_expandNavigationTree($expandElem); } + //expand the newly chosen database $expandElem = $('#pma_navigation_tree a.dbLink:contains("' + $newDb + '")') .parent().find('a.expander').eq(0); $icon = $expandElem.find('img'); if ($icon.is('.ic_b_plus')) { PMA_expandNavigationTree($expandElem); } + //scroll to new database if ($oldDb !== $newDb) { setTimeout(function() { scrollToView($expandElem.closest('li'), $('#pma_navigation_tree_content'));