1 (function( $, app, i18n ) {
5 ui.RefreshButton = ui.SplitButton.extend({
9 init: function( parent ) {
10 this.config.label = i18n.text("General.RefreshResults");
11 this._super( parent );
12 this.set( this.config.timer );
14 set: function( value ) {
16 window.clearInterval( this._timer );
17 if( this.value > 0 ) {
18 this._timer = window.setInterval( this._refresh_handler, this.value );
21 _click_handler: function() {
22 this._refresh_handler();
24 _select_handler: function( el, event ) {
25 this.set( event.value );
26 this.fire("change", this );
28 _refresh_handler: function() {
29 this.fire("refresh", this );
31 _getItems: function() {
33 { text: i18n.text("General.ManualRefresh"), value: -1 },
34 { text: i18n.text("General.RefreshQuickly"), value: 100 },
35 { text: i18n.text("General.Refresh5seconds"), value: 5000 },
36 { text: i18n.text("General.Refresh1minute"), value: 60000 }
41 })( this.jQuery, this.app, this.i18n );