| 1 | define( [ |
| 2 | "jquery", |
| 3 | "lib/helper" |
| 4 | ], function( $, helper ) { |
| 5 | |
| 6 | var lastItem, |
| 7 | log = []; |
| 8 | |
| 9 | return $.extend( helper, { |
| 10 | log: function( message, clear ) { |
| 11 | if ( clear ) { |
| 12 | log.length = 0; |
| 13 | } |
| 14 | if ( message === undefined ) { |
| 15 | message = lastItem; |
| 16 | } |
| 17 | log.push( String.prototype.trim.call( message ) ); |
| 18 | }, |
| 19 | |
| 20 | logOutput: function() { |
| 21 | return log.join( "," ); |
| 22 | }, |
| 23 | |
| 24 | clearLog: function() { |
| 25 | log.length = 0; |
| 26 | }, |
| 27 | |
| 28 | click: function( menu, item ) { |
| 29 | lastItem = item; |
| 30 | menu.children() |
| 31 | .eq( item ) |
| 32 | .children( ".ui-menu-item-wrapper" ) |
| 33 | .trigger( "click" ); |
| 34 | } |
| 35 | } ); |
| 36 | |
| 37 | } ); |