bootstrap-switch.js 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671
  1. /* ========================================================================
  2. * bootstrap-switch - v3.1.0
  3. * http://www.bootstrap-switch.org
  4. * ========================================================================
  5. * Copyright 2012-2013 Mattia Larentis
  6. *
  7. * ========================================================================
  8. * Licensed under the Apache License, Version 2.0 (the "License");
  9. * you may not use this file except in compliance with the License.
  10. * You may obtain a copy of the License at
  11. *
  12. * http://www.apache.org/licenses/LICENSE-2.0
  13. *
  14. * Unless required by applicable law or agreed to in writing, software
  15. * distributed under the License is distributed on an "AS IS" BASIS,
  16. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  17. * See the License for the specific language governing permissions and
  18. * limitations under the License.
  19. * ========================================================================
  20. */
  21. (function() {
  22. var __slice = [].slice;
  23. (function($, window) {
  24. "use strict";
  25. var BootstrapSwitch;
  26. BootstrapSwitch = (function() {
  27. function BootstrapSwitch(element, options) {
  28. if (options == null) {
  29. options = {};
  30. }
  31. this.$element = $(element);
  32. this.options = $.extend({}, $.fn.bootstrapSwitch.defaults, {
  33. state: this.$element.is(":checked"),
  34. size: this.$element.data("size"),
  35. animate: this.$element.data("animate"),
  36. disabled: this.$element.is(":disabled"),
  37. readonly: this.$element.is("[readonly]"),
  38. indeterminate: this.$element.data("indeterminate"),
  39. inverse: this.$element.data("inverse"),
  40. radioAllOff: this.$element.data("radio-all-off"),
  41. onColor: this.$element.data("on-color"),
  42. offColor: this.$element.data("off-color"),
  43. onText: this.$element.data("on-text"),
  44. offText: this.$element.data("off-text"),
  45. labelText: this.$element.data("label-text"),
  46. handleWidth: this.$element.data("handle-width"),
  47. labelWidth: this.$element.data("label-width"),
  48. baseClass: this.$element.data("base-class"),
  49. wrapperClass: this.$element.data("wrapper-class")
  50. }, options);
  51. this.$wrapper = $("<div>", {
  52. "class": (function(_this) {
  53. return function() {
  54. var classes;
  55. classes = ["" + _this.options.baseClass].concat(_this._getClasses(_this.options.wrapperClass));
  56. classes.push(_this.options.state ? "" + _this.options.baseClass + "-on" : "" + _this.options.baseClass + "-off");
  57. if (_this.options.size != null) {
  58. classes.push("" + _this.options.baseClass + "-" + _this.options.size);
  59. }
  60. if (_this.options.disabled) {
  61. classes.push("" + _this.options.baseClass + "-disabled");
  62. }
  63. if (_this.options.readonly) {
  64. classes.push("" + _this.options.baseClass + "-readonly");
  65. }
  66. if (_this.options.indeterminate) {
  67. classes.push("" + _this.options.baseClass + "-indeterminate");
  68. }
  69. if (_this.options.inverse) {
  70. classes.push("" + _this.options.baseClass + "-inverse");
  71. }
  72. if (_this.$element.attr("id")) {
  73. classes.push("" + _this.options.baseClass + "-id-" + (_this.$element.attr("id")));
  74. }
  75. return classes.join(" ");
  76. };
  77. })(this)()
  78. });
  79. this.$container = $("<div>", {
  80. "class": "" + this.options.baseClass + "-container"
  81. });
  82. this.$on = $("<span>", {
  83. html: this.options.onText,
  84. "class": "" + this.options.baseClass + "-handle-on " + this.options.baseClass + "-" + this.options.onColor
  85. });
  86. this.$off = $("<span>", {
  87. html: this.options.offText,
  88. "class": "" + this.options.baseClass + "-handle-off " + this.options.baseClass + "-" + this.options.offColor
  89. });
  90. this.$label = $("<label>", {
  91. html: this.options.labelText,
  92. "class": "" + this.options.baseClass + "-label"
  93. });
  94. this.$element.on("init.bootstrapSwitch", (function(_this) {
  95. return function() {
  96. return _this.options.onInit.apply(element, arguments);
  97. };
  98. })(this));
  99. this.$element.on("switchChange.bootstrapSwitch", (function(_this) {
  100. return function() {
  101. return _this.options.onSwitchChange.apply(element, arguments);
  102. };
  103. })(this));
  104. this.$container = this.$element.wrap(this.$container).parent();
  105. this.$wrapper = this.$container.wrap(this.$wrapper).parent();
  106. this.$element.before(this.options.inverse ? this.$off : this.$on).before(this.$label).before(this.options.inverse ? this.$on : this.$off);
  107. if (this.options.indeterminate) {
  108. this.$element.prop("indeterminate", true);
  109. }
  110. this._width();
  111. this._containerPosition(this.options.state, (function(_this) {
  112. return function() {
  113. if (_this.options.animate) {
  114. return _this.$wrapper.addClass("" + _this.options.baseClass + "-animate");
  115. }
  116. };
  117. })(this));
  118. this._elementHandlers();
  119. this._handleHandlers();
  120. this._labelHandlers();
  121. this._formHandler();
  122. this.$element.trigger("init.bootstrapSwitch");
  123. }
  124. BootstrapSwitch.prototype._constructor = BootstrapSwitch;
  125. BootstrapSwitch.prototype.state = function(value, skip) {
  126. if (typeof value === "undefined") {
  127. return this.options.state;
  128. }
  129. if (this.options.disabled || this.options.readonly) {
  130. return this.$element;
  131. }
  132. if (this.options.state && !this.options.radioAllOff && this.$element.is(':radio')) {
  133. return this.$element;
  134. }
  135. if (this.options.indeterminate) {
  136. this.indeterminate(false);
  137. value = true;
  138. } else {
  139. value = !!value;
  140. }
  141. this.$element.prop("checked", value).trigger("change.bootstrapSwitch", skip);
  142. return this.$element;
  143. };
  144. BootstrapSwitch.prototype.toggleState = function(skip) {
  145. if (this.options.disabled || this.options.readonly) {
  146. return this.$element;
  147. }
  148. if (this.options.indeterminate) {
  149. this.indeterminate(false);
  150. return this.state(true);
  151. } else {
  152. return this.$element.prop("checked", !this.options.state).trigger("change.bootstrapSwitch", skip);
  153. }
  154. };
  155. BootstrapSwitch.prototype.size = function(value) {
  156. if (typeof value === "undefined") {
  157. return this.options.size;
  158. }
  159. if (this.options.size != null) {
  160. this.$wrapper.removeClass("" + this.options.baseClass + "-" + this.options.size);
  161. }
  162. if (value) {
  163. this.$wrapper.addClass("" + this.options.baseClass + "-" + value);
  164. }
  165. this._width();
  166. this.options.size = value;
  167. return this.$element;
  168. };
  169. BootstrapSwitch.prototype.animate = function(value) {
  170. if (typeof value === "undefined") {
  171. return this.options.animate;
  172. }
  173. value = !!value;
  174. this.options.animate = value;
  175. this.$wrapper[value ? "addClass" : "removeClass"]("" + this.options.baseClass + "-animate");
  176. return this.$element;
  177. };
  178. BootstrapSwitch.prototype.toggleAnimate = function() {
  179. this.options.animate = !this.options.animate;
  180. this.$wrapper.toggleClass("" + this.options.baseClass + "-animate");
  181. return this.$element;
  182. };
  183. BootstrapSwitch.prototype.disabled = function(value) {
  184. if (typeof value === "undefined") {
  185. return this.options.disabled;
  186. }
  187. value = !!value;
  188. this.options.disabled = value;
  189. this.$element.prop("disabled", value);
  190. this.$wrapper[value ? "addClass" : "removeClass"]("" + this.options.baseClass + "-disabled");
  191. return this.$element;
  192. };
  193. BootstrapSwitch.prototype.toggleDisabled = function() {
  194. this.options.disabled = !this.options.disabled;
  195. this.$element.prop("disabled", this.options.disabled);
  196. this.$wrapper.toggleClass("" + this.options.baseClass + "-disabled");
  197. return this.$element;
  198. };
  199. BootstrapSwitch.prototype.readonly = function(value) {
  200. if (typeof value === "undefined") {
  201. return this.options.readonly;
  202. }
  203. value = !!value;
  204. this.options.readonly = value;
  205. this.$element.prop("readonly", value);
  206. this.$wrapper[value ? "addClass" : "removeClass"]("" + this.options.baseClass + "-readonly");
  207. return this.$element;
  208. };
  209. BootstrapSwitch.prototype.toggleReadonly = function() {
  210. this.options.readonly = !this.options.readonly;
  211. this.$element.prop("readonly", this.options.readonly);
  212. this.$wrapper.toggleClass("" + this.options.baseClass + "-readonly");
  213. return this.$element;
  214. };
  215. BootstrapSwitch.prototype.indeterminate = function(value) {
  216. if (typeof value === "undefined") {
  217. return this.options.indeterminate;
  218. }
  219. value = !!value;
  220. this.options.indeterminate = value;
  221. this.$element.prop("indeterminate", value);
  222. this.$wrapper[value ? "addClass" : "removeClass"]("" + this.options.baseClass + "-indeterminate");
  223. this._containerPosition();
  224. return this.$element;
  225. };
  226. BootstrapSwitch.prototype.toggleIndeterminate = function() {
  227. this.options.indeterminate = !this.options.indeterminate;
  228. this.$element.prop("indeterminate", !this.options.indeterminate);
  229. this.$wrapper.toggleClass("" + this.options.baseClass + "-indeterminate");
  230. this._containerPosition();
  231. return this.$element;
  232. };
  233. BootstrapSwitch.prototype.inverse = function(value) {
  234. var $off, $on;
  235. if (typeof value === "undefined") {
  236. return this.options.inverse;
  237. }
  238. value = !!value;
  239. this.$wrapper[value ? "addClass" : "removeClass"]("" + this.options.baseClass + "-inverse");
  240. $on = this.$on.clone(true);
  241. $off = this.$off.clone(true);
  242. this.$on.replaceWith($off);
  243. this.$off.replaceWith($on);
  244. this.$on = $off;
  245. this.$off = $on;
  246. this.options.inverse = value;
  247. return this.$element;
  248. };
  249. BootstrapSwitch.prototype.toggleInverse = function() {
  250. var $off, $on;
  251. this.$wrapper.toggleClass("" + this.options.baseClass + "-inverse");
  252. $on = this.$on.clone(true);
  253. $off = this.$off.clone(true);
  254. this.$on.replaceWith($off);
  255. this.$off.replaceWith($on);
  256. this.$on = $off;
  257. this.$off = $on;
  258. this.options.inverse = !this.options.inverse;
  259. return this.$element;
  260. };
  261. BootstrapSwitch.prototype.onColor = function(value) {
  262. var color;
  263. color = this.options.onColor;
  264. if (typeof value === "undefined") {
  265. return color;
  266. }
  267. if (color != null) {
  268. this.$on.removeClass("" + this.options.baseClass + "-" + color);
  269. }
  270. this.$on.addClass("" + this.options.baseClass + "-" + value);
  271. this.options.onColor = value;
  272. return this.$element;
  273. };
  274. BootstrapSwitch.prototype.offColor = function(value) {
  275. var color;
  276. color = this.options.offColor;
  277. if (typeof value === "undefined") {
  278. return color;
  279. }
  280. if (color != null) {
  281. this.$off.removeClass("" + this.options.baseClass + "-" + color);
  282. }
  283. this.$off.addClass("" + this.options.baseClass + "-" + value);
  284. this.options.offColor = value;
  285. return this.$element;
  286. };
  287. BootstrapSwitch.prototype.onText = function(value) {
  288. if (typeof value === "undefined") {
  289. return this.options.onText;
  290. }
  291. this.$on.html(value);
  292. this._width();
  293. this._containerPosition();
  294. this.options.onText = value;
  295. return this.$element;
  296. };
  297. BootstrapSwitch.prototype.offText = function(value) {
  298. if (typeof value === "undefined") {
  299. return this.options.offText;
  300. }
  301. this.$off.html(value);
  302. this._width();
  303. this._containerPosition();
  304. this.options.offText = value;
  305. return this.$element;
  306. };
  307. BootstrapSwitch.prototype.labelText = function(value) {
  308. if (typeof value === "undefined") {
  309. return this.options.labelText;
  310. }
  311. this.$label.html(value);
  312. this._width();
  313. this.options.labelText = value;
  314. return this.$element;
  315. };
  316. BootstrapSwitch.prototype.handleWidth = function(value) {
  317. if (typeof value === "undefined") {
  318. return this.options.handleWidth;
  319. }
  320. this.options.handleWidth = value;
  321. this._width();
  322. return this.$element;
  323. };
  324. BootstrapSwitch.prototype.labelWidth = function(value) {
  325. if (typeof value === "undefined") {
  326. return this.options.labelWidth;
  327. }
  328. this.options.labelWidth = value;
  329. this._width();
  330. return this.$element;
  331. };
  332. BootstrapSwitch.prototype.baseClass = function(value) {
  333. return this.options.baseClass;
  334. };
  335. BootstrapSwitch.prototype.wrapperClass = function(value) {
  336. if (typeof value === "undefined") {
  337. return this.options.wrapperClass;
  338. }
  339. if (!value) {
  340. value = $.fn.bootstrapSwitch.defaults.wrapperClass;
  341. }
  342. this.$wrapper.removeClass(this._getClasses(this.options.wrapperClass).join(" "));
  343. this.$wrapper.addClass(this._getClasses(value).join(" "));
  344. this.options.wrapperClass = value;
  345. return this.$element;
  346. };
  347. BootstrapSwitch.prototype.radioAllOff = function(value) {
  348. if (typeof value === "undefined") {
  349. return this.options.radioAllOff;
  350. }
  351. this.options.radioAllOff = value;
  352. return this.$element;
  353. };
  354. BootstrapSwitch.prototype.onInit = function(value) {
  355. if (typeof value === "undefined") {
  356. return this.options.onInit;
  357. }
  358. if (!value) {
  359. value = $.fn.bootstrapSwitch.defaults.onInit;
  360. }
  361. this.options.onInit = value;
  362. return this.$element;
  363. };
  364. BootstrapSwitch.prototype.onSwitchChange = function(value) {
  365. if (typeof value === "undefined") {
  366. return this.options.onSwitchChange;
  367. }
  368. if (!value) {
  369. value = $.fn.bootstrapSwitch.defaults.onSwitchChange;
  370. }
  371. this.options.onSwitchChange = value;
  372. return this.$element;
  373. };
  374. BootstrapSwitch.prototype.destroy = function() {
  375. var $form;
  376. $form = this.$element.closest("form");
  377. if ($form.length) {
  378. $form.off("reset.bootstrapSwitch").removeData("bootstrap-switch");
  379. }
  380. this.$container.children().not(this.$element).remove();
  381. this.$element.unwrap().unwrap().off(".bootstrapSwitch").removeData("bootstrap-switch");
  382. return this.$element;
  383. };
  384. BootstrapSwitch.prototype._width = function() {
  385. var $handles, handleWidth;
  386. $handles = this.$on.add(this.$off);
  387. $handles.add(this.$label).css("width", "");
  388. handleWidth = this.options.handleWidth === "auto" ? Math.max(this.$on.width(), this.$off.width()) : this.options.handleWidth;
  389. $handles.width(handleWidth);
  390. this.$label.width((function(_this) {
  391. return function(index, width) {
  392. if (_this.options.labelWidth !== "auto") {
  393. return _this.options.labelWidth;
  394. }
  395. if (width < handleWidth) {
  396. return handleWidth;
  397. } else {
  398. return width;
  399. }
  400. };
  401. })(this));
  402. this._handleWidth = this.$on.outerWidth();
  403. this._labelWidth = this.$label.outerWidth();
  404. this.$container.width((this._handleWidth * 2) + this._labelWidth);
  405. return this.$wrapper.width(this._handleWidth + this._labelWidth);
  406. };
  407. BootstrapSwitch.prototype._containerPosition = function(state, callback) {
  408. if (state == null) {
  409. state = this.options.state;
  410. }
  411. this.$container.css("margin-left", (function(_this) {
  412. return function() {
  413. var values;
  414. values = [0, "-" + _this._handleWidth + "px"];
  415. if (_this.options.indeterminate) {
  416. return "-" + (_this._handleWidth / 2) + "px";
  417. }
  418. if (state) {
  419. if (_this.options.inverse) {
  420. return values[1];
  421. } else {
  422. return values[0];
  423. }
  424. } else {
  425. if (_this.options.inverse) {
  426. return values[0];
  427. } else {
  428. return values[1];
  429. }
  430. }
  431. };
  432. })(this));
  433. if (!callback) {
  434. return;
  435. }
  436. return this.$container.one($.support.transition.end, callback).emulateTransitionEnd(500);
  437. };
  438. BootstrapSwitch.prototype._elementHandlers = function() {
  439. return this.$element.on({
  440. "change.bootstrapSwitch": (function(_this) {
  441. return function(e, skip) {
  442. var state;
  443. e.preventDefault();
  444. e.stopImmediatePropagation();
  445. state = _this.$element.is(":checked");
  446. _this._containerPosition(state);
  447. if (state === _this.options.state) {
  448. return;
  449. }
  450. _this.options.state = state;
  451. _this.$wrapper.toggleClass("" + _this.options.baseClass + "-off").toggleClass("" + _this.options.baseClass + "-on");
  452. if (!skip) {
  453. if (_this.$element.is(":radio")) {
  454. $("[name='" + (_this.$element.attr('name')) + "']").not(_this.$element).prop("checked", false).trigger("change.bootstrapSwitch", true);
  455. }
  456. return _this.$element.trigger("switchChange.bootstrapSwitch", [state]);
  457. }
  458. };
  459. })(this),
  460. "focus.bootstrapSwitch": (function(_this) {
  461. return function(e) {
  462. e.preventDefault();
  463. return _this.$wrapper.addClass("" + _this.options.baseClass + "-focused");
  464. };
  465. })(this),
  466. "blur.bootstrapSwitch": (function(_this) {
  467. return function(e) {
  468. e.preventDefault();
  469. return _this.$wrapper.removeClass("" + _this.options.baseClass + "-focused");
  470. };
  471. })(this),
  472. "keydown.bootstrapSwitch": (function(_this) {
  473. return function(e) {
  474. if (!e.which || _this.options.disabled || _this.options.readonly) {
  475. return;
  476. }
  477. switch (e.which) {
  478. case 37:
  479. e.preventDefault();
  480. e.stopImmediatePropagation();
  481. return _this.state(false);
  482. case 39:
  483. e.preventDefault();
  484. e.stopImmediatePropagation();
  485. return _this.state(true);
  486. }
  487. };
  488. })(this)
  489. });
  490. };
  491. BootstrapSwitch.prototype._handleHandlers = function() {
  492. this.$on.on("click.bootstrapSwitch", (function(_this) {
  493. return function(e) {
  494. _this.state(false);
  495. return _this.$element.trigger("focus.bootstrapSwitch");
  496. };
  497. })(this));
  498. return this.$off.on("click.bootstrapSwitch", (function(_this) {
  499. return function(e) {
  500. _this.state(true);
  501. return _this.$element.trigger("focus.bootstrapSwitch");
  502. };
  503. })(this));
  504. };
  505. BootstrapSwitch.prototype._labelHandlers = function() {
  506. return this.$label.on({
  507. "mousedown.bootstrapSwitch touchstart.bootstrapSwitch": (function(_this) {
  508. return function(e) {
  509. if (_this._dragStart || _this.options.disabled || _this.options.readonly) {
  510. return;
  511. }
  512. e.preventDefault();
  513. _this._dragStart = (e.pageX || e.originalEvent.touches[0].pageX) - parseInt(_this.$container.css("margin-left"), 10);
  514. if (_this.options.animate) {
  515. _this.$wrapper.removeClass("" + _this.options.baseClass + "-animate");
  516. }
  517. return _this.$element.trigger("focus.bootstrapSwitch");
  518. };
  519. })(this),
  520. "mousemove.bootstrapSwitch touchmove.bootstrapSwitch": (function(_this) {
  521. return function(e) {
  522. var difference;
  523. if (_this._dragStart == null) {
  524. return;
  525. }
  526. e.preventDefault();
  527. difference = (e.pageX || e.originalEvent.touches[0].pageX) - _this._dragStart;
  528. if (difference < -_this._handleWidth || difference > 0) {
  529. return;
  530. }
  531. _this._dragEnd = difference;
  532. return _this.$container.css("margin-left", "" + _this._dragEnd + "px");
  533. };
  534. })(this),
  535. "mouseup.bootstrapSwitch touchend.bootstrapSwitch": (function(_this) {
  536. return function(e) {
  537. var state;
  538. if (!_this._dragStart) {
  539. return;
  540. }
  541. e.preventDefault();
  542. if (_this.options.animate) {
  543. _this.$wrapper.addClass("" + _this.options.baseClass + "-animate");
  544. }
  545. if (_this._dragEnd) {
  546. state = _this._dragEnd > -(_this._handleWidth / 2);
  547. _this._dragEnd = false;
  548. _this.state(_this.options.inverse ? !state : state);
  549. } else {
  550. _this.state(!_this.options.state);
  551. }
  552. return _this._dragStart = false;
  553. };
  554. })(this),
  555. "mouseleave.bootstrapSwitch": (function(_this) {
  556. return function(e) {
  557. return _this.$label.trigger("mouseup.bootstrapSwitch");
  558. };
  559. })(this)
  560. });
  561. };
  562. BootstrapSwitch.prototype._formHandler = function() {
  563. var $form;
  564. $form = this.$element.closest("form");
  565. if ($form.data("bootstrap-switch")) {
  566. return;
  567. }
  568. return $form.on("reset.bootstrapSwitch", function() {
  569. return window.setTimeout(function() {
  570. return $form.find("input").filter(function() {
  571. return $(this).data("bootstrap-switch");
  572. }).each(function() {
  573. return $(this).bootstrapSwitch("state", this.checked);
  574. });
  575. }, 1);
  576. }).data("bootstrap-switch", true);
  577. };
  578. BootstrapSwitch.prototype._getClasses = function(classes) {
  579. var c, cls, _i, _len;
  580. if (!$.isArray(classes)) {
  581. return ["" + this.options.baseClass + "-" + classes];
  582. }
  583. cls = [];
  584. for (_i = 0, _len = classes.length; _i < _len; _i++) {
  585. c = classes[_i];
  586. cls.push("" + this.options.baseClass + "-" + c);
  587. }
  588. return cls;
  589. };
  590. return BootstrapSwitch;
  591. })();
  592. $.fn.bootstrapSwitch = function() {
  593. var args, option, ret;
  594. option = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
  595. ret = this;
  596. this.each(function() {
  597. var $this, data;
  598. $this = $(this);
  599. data = $this.data("bootstrap-switch");
  600. if (!data) {
  601. $this.data("bootstrap-switch", data = new BootstrapSwitch(this, option));
  602. }
  603. if (typeof option === "string") {
  604. return ret = data[option].apply(data, args);
  605. }
  606. });
  607. return ret;
  608. };
  609. $.fn.bootstrapSwitch.Constructor = BootstrapSwitch;
  610. return $.fn.bootstrapSwitch.defaults = {
  611. state: true,
  612. size: null,
  613. animate: true,
  614. disabled: false,
  615. readonly: false,
  616. indeterminate: false,
  617. inverse: false,
  618. radioAllOff: false,
  619. onColor: "primary",
  620. offColor: "default",
  621. onText: "ON",
  622. offText: "OFF",
  623. labelText: "&nbsp;",
  624. handleWidth: "auto",
  625. labelWidth: "auto",
  626. baseClass: "bootstrap-switch",
  627. wrapperClass: "wrapper",
  628. onInit: function() {},
  629. onSwitchChange: function() {}
  630. };
  631. })(window.jQuery, window);
  632. }).call(this);