From 44e1eb0e8d709dd93fcac1ee4b9e25d0e8008c69 Mon Sep 17 00:00:00 2001 From: Maxim Kadushkin Date: Tue, 5 Sep 2017 14:53:44 +0300 Subject: [PATCH] [Common] refactoring --- apps/common/main/lib/controller/Plugins.js | 39 +++++++++++++--------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/apps/common/main/lib/controller/Plugins.js b/apps/common/main/lib/controller/Plugins.js index b4a32a9b8..399666501 100644 --- a/apps/common/main/lib/controller/Plugins.js +++ b/apps/common/main/lib/controller/Plugins.js @@ -242,12 +242,15 @@ define([ menu.render(menuContainer); menu.cmpEl.attr({tabindex: "-1"}); - menu.on('show:after', function(cmp) { - if (cmp && cmp.menuAlignEl) - cmp.menuAlignEl.toggleClass('over', true); - }).on('hide:after', function(cmp) { - if (cmp && cmp.menuAlignEl) - cmp.menuAlignEl.toggleClass('over', false); + menu.on({ + 'show:after': function(cmp) { + if (cmp && cmp.menuAlignEl) + cmp.menuAlignEl.toggleClass('over', true); + }, + 'hide:after': function(cmp) { + if (cmp && cmp.menuAlignEl) + cmp.menuAlignEl.toggleClass('over', false); + } }); } @@ -298,16 +301,22 @@ define([ buttons: isCustomWindow ? undefined : newBtns, toolcallback: _.bind(this.onToolClose, this) }); - me.pluginDlg.on('render:after', function(obj){ - obj.getChild('.footer .dlg-btn').on('click', _.bind(me.onDlgBtnClick, me)); - me.pluginContainer = me.pluginDlg.$window.find('#id-plugin-container'); - }).on('close', function(obj){ - me.pluginDlg = undefined; - }).on('drag', function(args){ - me.api.asc_pluginEnableMouseEvents(args[1]=='start'); - }).on('resize', function(args){ - me.api.asc_pluginEnableMouseEvents(args[1]=='start'); + me.pluginDlg.on({ + 'render:after': function(obj){ + obj.getChild('.footer .dlg-btn').on('click', _.bind(me.onDlgBtnClick, me)); + me.pluginContainer = me.pluginDlg.$window.find('#id-plugin-container'); + }, + 'close': function(obj){ + me.pluginDlg = undefined; + }, + 'drag': function(args){ + me.api.asc_pluginEnableMouseEvents(args[1]=='start'); + }, + 'resize': function(args){ + me.api.asc_pluginEnableMouseEvents(args[1]=='start'); + } }); + me.pluginDlg.show(); } }