From 475e055b1858e5eed746b1c4ebd0fa7d75909ece Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Fri, 15 Jul 2011 10:36:59 +0200 Subject: [PATCH] MINOR Avoid triggering $('.cms-menu') item selection when already selected. Add new 'select' event for easier customization --- admin/javascript/LeftAndMain.Menu.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/admin/javascript/LeftAndMain.Menu.js b/admin/javascript/LeftAndMain.Menu.js index 06e76cb75..15a62ba16 100644 --- a/admin/javascript/LeftAndMain.Menu.js +++ b/admin/javascript/LeftAndMain.Menu.js @@ -34,7 +34,10 @@ $('.cms-container').bind('afterstatechange', function(e, data) { var controller = data.xhr.getResponseHeader('X-Controller'); - if(controller) self.find('li#Menu-' + controller).select(); + if(controller) { + var item = self.find('li#Menu-' + controller); + if(!item.hasClass('current')) item.select(); + } }); // Sync collapsed state with parent panel @@ -72,6 +75,8 @@ this.siblings().removeClass('current').close(); this.siblings().find('li').removeClass('current'); if(parent) parent.addClass('current').siblings().removeClass('current'); + + this.trigger('select'); } });