|
@@ -27,7 +27,6 @@
|
|
var BootstrapSwitch;
|
|
var BootstrapSwitch;
|
|
BootstrapSwitch = (function() {
|
|
BootstrapSwitch = (function() {
|
|
function BootstrapSwitch(element, options) {
|
|
function BootstrapSwitch(element, options) {
|
|
- var initInterval;
|
|
|
|
if (options == null) {
|
|
if (options == null) {
|
|
options = {};
|
|
options = {};
|
|
}
|
|
}
|
|
@@ -110,19 +109,7 @@
|
|
if (this.options.indeterminate) {
|
|
if (this.options.indeterminate) {
|
|
this.$element.prop("indeterminate", true);
|
|
this.$element.prop("indeterminate", true);
|
|
}
|
|
}
|
|
- initInterval = window.setInterval((function(_this) {
|
|
|
|
- return function() {
|
|
|
|
- if (_this.$wrapper.is(":visible")) {
|
|
|
|
- _this._width();
|
|
|
|
- _this._containerPosition(null, function() {
|
|
|
|
- if (_this.options.animate) {
|
|
|
|
- return _this.$wrapper.addClass("" + _this.options.baseClass + "-animate");
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- return window.clearInterval(initInterval);
|
|
|
|
- }
|
|
|
|
- };
|
|
|
|
- })(this), 50);
|
|
|
|
|
|
+ this._init();
|
|
this._elementHandlers();
|
|
this._elementHandlers();
|
|
this._handleHandlers();
|
|
this._handleHandlers();
|
|
this._labelHandlers();
|
|
this._labelHandlers();
|
|
@@ -475,6 +462,31 @@
|
|
}, 50);
|
|
}, 50);
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+ BootstrapSwitch.prototype._init = function() {
|
|
|
|
+ var init, initInterval;
|
|
|
|
+ init = (function(_this) {
|
|
|
|
+ return function() {
|
|
|
|
+ _this._width();
|
|
|
|
+ return _this._containerPosition(null, function() {
|
|
|
|
+ if (_this.options.animate) {
|
|
|
|
+ return _this.$wrapper.addClass("" + _this.options.baseClass + "-animate");
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ };
|
|
|
|
+ })(this);
|
|
|
|
+ if (this.$wrapper.is(":visible")) {
|
|
|
|
+ return init();
|
|
|
|
+ }
|
|
|
|
+ return initInterval = window.setInterval((function(_this) {
|
|
|
|
+ return function() {
|
|
|
|
+ if (_this.$wrapper.is(":visible")) {
|
|
|
|
+ init();
|
|
|
|
+ return window.clearInterval(initInterval);
|
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
+ })(this), 50);
|
|
|
|
+ };
|
|
|
|
+
|
|
BootstrapSwitch.prototype._elementHandlers = function() {
|
|
BootstrapSwitch.prototype._elementHandlers = function() {
|
|
return this.$element.on({
|
|
return this.$element.on({
|
|
"change.bootstrapSwitch": (function(_this) {
|
|
"change.bootstrapSwitch": (function(_this) {
|