From afd947f28bf8884ffc63c55bae11505ad641b57b Mon Sep 17 00:00:00 2001 From: "Mr.doob" Date: Wed, 19 Feb 2014 13:37:46 -0500 Subject: [PATCH] Simplified UI.MenubarHelper. --- editor/js/libs/ui.js | 41 ++++++++++++++++++----------------------- 1 file changed, 18 insertions(+), 23 deletions(-) diff --git a/editor/js/libs/ui.js b/editor/js/libs/ui.js index a463615540..a9f3728a82 100644 --- a/editor/js/libs/ui.js +++ b/editor/js/libs/ui.js @@ -947,14 +947,12 @@ UI.Button.prototype.setLabel = function ( value ) { }; -UI.MenubarHelper = (function() { +UI.MenubarHelper = { - function createMenuContainer( name, optionsPanel ) { - var container, - title; + createMenuContainer: function ( name, optionsPanel ) { - container = new UI.Panel(); - title = new UI.Panel(); + var container = new UI.Panel(); + var title = new UI.Panel(); title.setTextContent( name ); title.setMargin( '0px' ); @@ -965,23 +963,23 @@ UI.MenubarHelper = (function() { container.add( optionsPanel ); return container; - } + + }, - function createOption(name, callbackHandler) { - var option; + createOption: function ( name, callbackHandler ) { - option = new UI.Panel(); + var option = new UI.Panel(); option.setClass( 'option' ); option.setTextContent( name ); option.onClick( callbackHandler ); return option; - } - function createOptionsPanel(menuConfig) { - var options; + }, + + createOptionsPanel: function ( menuConfig ) { - options = new UI.Panel(); + var options = new UI.Panel(); options.setClass( 'options' ); menuConfig.forEach(function(option) { @@ -989,16 +987,13 @@ UI.MenubarHelper = (function() { }); return options; - } - function createDivider() { + }, + + createDivider: function () { + return new UI.HorizontalRule(); + } - return { - createMenuContainer:createMenuContainer, - createOption:createOption, - createOptionsPanel:createOptionsPanel, - createDivider:createDivider - }; -})(); +}; \ No newline at end of file -- GitLab