|
1 | 1 | /*! |
2 | 2 | * Bootstrap-checkbox v1.4.0 (https://vsn4ik.github.io/bootstrap-checkbox/) |
3 | | - * Copyright 2013-2017 Vasily A. (https://github.com/vsn4ik) |
| 3 | + * Copyright 2013-2018 Vasilii A. (https://github.com/vsn4ik) |
4 | 4 | * Licensed under the MIT license |
5 | 5 | */ |
6 | 6 |
|
|
13 | 13 | 'use strict'; |
14 | 14 |
|
15 | 15 | (function(factory) { |
16 | | - if (typeof define == 'function' && define.amd) { |
| 16 | + if (typeof define === 'function' && define.amd) { |
17 | 17 | // AMD. Register as an anonymous module |
18 | 18 | define(['jquery'], factory); |
19 | | - } |
20 | | - else if (typeof exports == 'object') { |
| 19 | + } else if (typeof exports === 'object') { |
21 | 20 | // Node/CommonJS |
22 | 21 | module.exports = factory(require('jquery')); |
23 | | - } |
24 | | - else { |
| 22 | + } else { |
25 | 23 | // Browser globals |
26 | 24 | factory(jQuery); |
27 | 25 | } |
|
110 | 108 | this.$on.addClass('active'); |
111 | 109 | this.$on.addClass(this.options.onActiveCls); |
112 | 110 | this.$off.addClass(this.options.offCls); |
113 | | - } |
114 | | - else { |
| 111 | + } else { |
115 | 112 | this.$off.addClass('active'); |
116 | 113 | this.$off.addClass(this.options.offActiveCls); |
117 | 114 | this.$on.addClass(this.options.onCls); |
118 | 115 | } |
119 | 116 |
|
120 | 117 | if (this.element.title) { |
121 | 118 | this.$group.attr('title', this.element.title); |
122 | | - } |
123 | | - else { |
| 119 | + } else { |
124 | 120 | // Attribute title (offTitle, onTitle) on this.$buttons not work (native) if this.element.disabled, fine! |
125 | 121 | if (this.options.offTitle) { |
126 | 122 | this.$off.attr('title', this.options.offTitle); |
|
150 | 146 | if (this.options.disabledCursor) { |
151 | 147 | this.$group.css('cursor', this.options.disabledCursor); |
152 | 148 | } |
153 | | - } |
154 | | - else { |
| 149 | + } else { |
155 | 150 | this.$group.attr('tabindex', this.element.tabIndex); |
156 | 151 |
|
157 | 152 | if (this.element.autofocus) { |
|
174 | 169 | if (this.element.disabled) { |
175 | 170 | this.$group.attr('tabindex', this.element.tabIndex); |
176 | 171 | this.$group.css('cursor', ''); |
177 | | - } |
178 | | - else { |
| 172 | + } else { |
179 | 173 | this.$group.removeAttr('tabindex'); |
180 | 174 |
|
181 | 175 | if (this.options.disabledCursor) { |
|
205 | 199 | this.$element.trigger('change'); |
206 | 200 | }, |
207 | 201 | keydown: function(event) { |
208 | | - if ($.inArray(event.keyCode, this.options.toggleKeyCodes) != -1) { |
| 202 | + if ($.inArray(event.keyCode, this.options.toggleKeyCodes) !== -1) { |
209 | 203 | // Off vertical scrolling on Spacebar |
210 | 204 | event.preventDefault(); |
211 | 205 |
|
212 | 206 | this.change(); |
213 | | - } |
214 | | - else if (event.keyCode == 13) { |
| 207 | + } else if (event.keyCode === 13) { |
215 | 208 | $(this.element.form).trigger('submit'); |
216 | 209 | } |
217 | 210 | }, |
|
232 | 225 | set: function(element, value) { |
233 | 226 | var data = $.data(element, 'bs.checkbox'); |
234 | 227 |
|
235 | | - if (data && element.checked != value) { |
| 228 | + if (data && element.checked !== value) { |
236 | 229 | data.change(value); |
237 | 230 | } |
238 | 231 |
|
|
245 | 238 | set: function(element, value) { |
246 | 239 | var data = $.data(element, 'bs.checkbox'); |
247 | 240 |
|
248 | | - if (data && element.disabled != value) { |
| 241 | + if (data && element.disabled !== value) { |
249 | 242 | data.toggleDisabled(); |
250 | 243 | } |
251 | 244 |
|
|
265 | 258 |
|
266 | 259 | if (this instanceof $) { |
267 | 260 | $elements = this; |
268 | | - } |
269 | | - else if (typeof options == 'string') { |
| 261 | + } else if (typeof options === 'string') { |
270 | 262 | $elements = $(options); |
271 | | - } |
272 | | - else { |
| 263 | + } else { |
273 | 264 | $elements = $(elements); |
274 | 265 | } |
275 | 266 |
|
|
285 | 276 | }; |
286 | 277 |
|
287 | 278 | // HTML5 data-*. |
288 | | - // <input data-on-label="43"> --> $('input').data('onLabel') == '43'. |
| 279 | + // <input data-on-label="43"> --> $('input').data('onLabel') === '43'. |
289 | 280 | $.fn.checkboxpicker.defaults = { |
290 | 281 | baseGroupCls: 'btn-group', |
291 | 282 | baseCls: 'btn', |
|
0 commit comments