/*! ======================================================================== * Bootstrap Toggle: bootstrap-toggle.js v2.2.0 * http://www.bootstraptoggle.com * ======================================================================== * Copyright 2014 Min Hur, The New York Times Company * Licensed under MIT * ======================================================================== */ +function ($) { 'use strict'; // TOGGLE PUBLIC CLASS DEFINITION // ============================== var Toggle = function (element, options) { this.$element = $(element) this.options = $.extend({}, this.defaults(), options) this.render() } Toggle.VERSION = '2.2.0' Toggle.DEFAULTS = { on: 'On', off: 'Off', onstyle: 'primary', offstyle: 'default', size: 'normal', style: '', width: null, height: null } Toggle.prototype.defaults = function() { return { on: this.$element.attr('data-on') || Toggle.DEFAULTS.on, off: this.$element.attr('data-off') || Toggle.DEFAULTS.off, onstyle: this.$element.attr('data-onstyle') || Toggle.DEFAULTS.onstyle, offstyle: this.$element.attr('data-offstyle') || Toggle.DEFAULTS.offstyle, size: this.$element.attr('data-size') || Toggle.DEFAULTS.size, style: this.$element.attr('data-style') || Toggle.DEFAULTS.style, width: this.$element.attr('data-width') || Toggle.DEFAULTS.width, height: this.$element.attr('data-height') || Toggle.DEFAULTS.height } } Toggle.prototype.render = function () { this._onstyle = 'btn-' + this.options.onstyle this._offstyle = 'btn-' + this.options.offstyle var size = this.options.size === 'large' ? 'btn-lg' : this.options.size === 'small' ? 'btn-sm' : this.options.size === 'mini' ? 'btn-xs' : '' var $toggleOn = $('