Skip to content

Commit 8cbdbad

Browse files
committed
Format the auto-refresh code
1 parent ef6ac2c commit 8cbdbad

2 files changed

Lines changed: 63 additions & 63 deletions

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
.btn.enabled {
2-
background-color: #5bc0de;
2+
background-color: #5bc0de;
33
}

src/extensions/auto-refresh/bootstrap-table-auto-refresh.js

Lines changed: 62 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -6,79 +6,79 @@
66

77
(function ($) {
88

9-
'use strict';
9+
'use strict';
1010

11-
$.extend($.fn.bootstrapTable.defaults, {
12-
autoRefresh: false,
13-
autoRefreshInterval: 60,
14-
autoRefreshSilent: true,
15-
autoRefreshStatus: true,
16-
autoRefreshFunction: null
17-
});
11+
$.extend($.fn.bootstrapTable.defaults, {
12+
autoRefresh: false,
13+
autoRefreshInterval: 60,
14+
autoRefreshSilent: true,
15+
autoRefreshStatus: true,
16+
autoRefreshFunction: null
17+
});
1818

19-
$.extend($.fn.bootstrapTable.defaults.icons, {
20-
autoRefresh: 'glyphicon-time icon-time'
21-
});
19+
$.extend($.fn.bootstrapTable.defaults.icons, {
20+
autoRefresh: 'glyphicon-time icon-time'
21+
});
2222

23-
$.extend($.fn.bootstrapTable.locales, {
24-
formatAutoRefresh: function() {
25-
return 'Auto Refresh';
26-
}
27-
});
23+
$.extend($.fn.bootstrapTable.locales, {
24+
formatAutoRefresh: function() {
25+
return 'Auto Refresh';
26+
}
27+
});
2828

29-
$.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales);
29+
$.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales);
3030

31-
var BootstrapTable = $.fn.bootstrapTable.Constructor;
32-
var _init = BootstrapTable.prototype.init;
33-
var _initToolbar = BootstrapTable.prototype.initToolbar;
34-
var sprintf = $.fn.bootstrapTable.utils.sprintf;
31+
var BootstrapTable = $.fn.bootstrapTable.Constructor;
32+
var _init = BootstrapTable.prototype.init;
33+
var _initToolbar = BootstrapTable.prototype.initToolbar;
34+
var sprintf = $.fn.bootstrapTable.utils.sprintf;
3535

36-
BootstrapTable.prototype.init = function () {
37-
_init.apply(this, Array.prototype.slice.apply(arguments));
36+
BootstrapTable.prototype.init = function () {
37+
_init.apply(this, Array.prototype.slice.apply(arguments));
3838

39-
if (this.options.autoRefresh && this.options.autoRefreshStatus) {
40-
var that = this;
41-
this.options.autoRefreshFunction = setInterval(function () {
42-
that.refresh({silent: that.options.autoRefreshSilent});
43-
}, this.options.autoRefreshInterval*1000);
44-
}
45-
};
39+
if (this.options.autoRefresh && this.options.autoRefreshStatus) {
40+
var that = this;
41+
this.options.autoRefreshFunction = setInterval(function () {
42+
that.refresh({silent: that.options.autoRefreshSilent});
43+
}, this.options.autoRefreshInterval*1000);
44+
}
45+
};
4646

47-
BootstrapTable.prototype.initToolbar = function() {
48-
_initToolbar.apply(this, Array.prototype.slice.apply(arguments));
47+
BootstrapTable.prototype.initToolbar = function() {
48+
_initToolbar.apply(this, Array.prototype.slice.apply(arguments));
4949

50-
if (this.options.autoRefresh) {
51-
var $btnGroup = this.$toolbar.find('>.btn-group');
52-
var $btnAutoRefresh = $btnGroup.find('.auto-refresh');
50+
if (this.options.autoRefresh) {
51+
var $btnGroup = this.$toolbar.find('>.btn-group');
52+
var $btnAutoRefresh = $btnGroup.find('.auto-refresh');
5353

54-
if (!$btnAutoRefresh.length) {
55-
$btnAutoRefresh = $([
56-
sprintf('<button class="btn btn-default auto-refresh %s" ', this.options.autoRefreshStatus ? 'enabled' : ''),
57-
'type="button" ',
58-
sprintf('title="%s">', this.options.formatAutoRefresh()),
59-
sprintf('<i class="%s %s"></i>', this.options.iconsPrefix, this.options.icons.autoRefresh),
60-
'</button>'
61-
].join('')).appendTo($btnGroup);
54+
if (!$btnAutoRefresh.length) {
55+
$btnAutoRefresh = $([
56+
sprintf('<button class="btn btn-default auto-refresh %s" ', this.options.autoRefreshStatus ? 'enabled' : ''),
57+
'type="button" ',
58+
sprintf('title="%s">', this.options.formatAutoRefresh()),
59+
sprintf('<i class="%s %s"></i>', this.options.iconsPrefix, this.options.icons.autoRefresh),
60+
'</button>'
61+
].join('')).appendTo($btnGroup);
6262

63-
$btnAutoRefresh.on('click', $.proxy(this.toggleAutoRefresh, this));
64-
}
65-
}
66-
};
63+
$btnAutoRefresh.on('click', $.proxy(this.toggleAutoRefresh, this));
64+
}
65+
}
66+
};
6767

68-
BootstrapTable.prototype.toggleAutoRefresh = function() {
69-
if (this.options.autoRefresh) {
70-
if (this.options.autoRefreshStatus) {
71-
clearInterval(this.options.autoRefreshFunction);
72-
this.$toolbar.find('>.btn-group').find('.auto-refresh').removeClass('enabled');
73-
} else {
74-
var that = this;
75-
this.options.autoRefreshFunction = setInterval(function () {
76-
that.refresh({silent: that.options.autoRefreshSilent});
77-
}, this.options.autoRefreshInterval*1000);
78-
this.$toolbar.find('>.btn-group').find('.auto-refresh').addClass('enabled');
79-
}
80-
this.options.autoRefreshStatus = !this.options.autoRefreshStatus;
81-
}
82-
};
68+
BootstrapTable.prototype.toggleAutoRefresh = function() {
69+
if (this.options.autoRefresh) {
70+
if (this.options.autoRefreshStatus) {
71+
clearInterval(this.options.autoRefreshFunction);
72+
this.$toolbar.find('>.btn-group').find('.auto-refresh').removeClass('enabled');
73+
} else {
74+
var that = this;
75+
this.options.autoRefreshFunction = setInterval(function () {
76+
that.refresh({silent: that.options.autoRefreshSilent});
77+
}, this.options.autoRefreshInterval*1000);
78+
this.$toolbar.find('>.btn-group').find('.auto-refresh').addClass('enabled');
79+
}
80+
this.options.autoRefreshStatus = !this.options.autoRefreshStatus;
81+
}
82+
};
8383

8484
})(jQuery);

0 commit comments

Comments
 (0)