From 15d03b227305a46c6ab9b6c1b9ad8c38c35f558f Mon Sep 17 00:00:00 2001 From: Atul Pratap Singh Date: Sat, 17 Aug 2013 03:02:38 +0530 Subject: Move autoexpand to a function --- js/common.js | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'js/common.js') 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(); } -- cgit v1.2.3