1(function (global, factory) { 2 if (typeof define === "function" && define.amd) { 3 define(['jquery'], factory); 4 } else if (typeof exports !== "undefined") { 5 factory(require('jquery')); 6 } else { 7 var mod = { 8 exports: {} 9 }; 10 factory(global.jquery); 11 global.bootstrapSwitch = mod.exports; 12 } 13})(this, function (_jquery) { 14 'use strict'; 15 16 var _jquery2 = _interopRequireDefault(_jquery); 17 18 function _interopRequireDefault(obj) { 19 return obj && obj.__esModule ? obj : { 20 default: obj 21 }; 22 } 23 24 var _extends = Object.assign || function (target) { 25 for (var i = 1; i < arguments.length; i++) { 26 var source = arguments[i]; 27 28 for (var key in source) { 29 if (Object.prototype.hasOwnProperty.call(source, key)) { 30 target[key] = source[key]; 31 } 32 } 33 } 34 35 return target; 36 }; 37 38 function _classCallCheck(instance, Constructor) { 39 if (!(instance instanceof Constructor)) { 40 throw new TypeError("Cannot call a class as a function"); 41 } 42 } 43 44 var _createClass = function () { 45 function defineProperties(target, props) { 46 for (var i = 0; i < props.length; i++) { 47 var descriptor = props[i]; 48 descriptor.enumerable = descriptor.enumerable || false; 49 descriptor.configurable = true; 50 if ("value" in descriptor) descriptor.writable = true; 51 Object.defineProperty(target, descriptor.key, descriptor); 52 } 53 } 54 55 return function (Constructor, protoProps, staticProps) { 56 if (protoProps) defineProperties(Constructor.prototype, protoProps); 57 if (staticProps) defineProperties(Constructor, staticProps); 58 return Constructor; 59 }; 60 }(); 61 62 var $ = _jquery2.default || window.jQuery || window.$; 63 64 var BootstrapSwitch = function () { 65 function BootstrapSwitch(element) { 66 var _this = this; 67 68 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 69 70 _classCallCheck(this, BootstrapSwitch); 71 72 this.$element = $(element); 73 this.options = $.extend({}, $.fn.bootstrapSwitch.defaults, this._getElementOptions(), options); 74 this.prevOptions = {}; 75 this.$wrapper = $('<div>', { 76 class: function _class() { 77 var classes = []; 78 classes.push(_this.options.state ? 'on' : 'off'); 79 if (_this.options.size) { 80 classes.push(_this.options.size); 81 } 82 if (_this.options.disabled) { 83 classes.push('disabled'); 84 } 85 if (_this.options.readonly) { 86 classes.push('readonly'); 87 } 88 if (_this.options.indeterminate) { 89 classes.push('indeterminate'); 90 } 91 if (_this.options.inverse) { 92 classes.push('inverse'); 93 } 94 if (_this.$element.attr('id')) { 95 classes.push('id-' + _this.$element.attr('id')); 96 } 97 return classes.map(_this._getClass.bind(_this)).concat([_this.options.baseClass], _this._getClasses(_this.options.wrapperClass)).join(' '); 98 } 99 });
100 this.$container = $('<div>', { class: this._getClass('container') }); 101 this.$on = $('<span>', { 102 html: this.options.onText, 103 class: this._getClass('handle-on') + ' ' + this._getClass(this.options.onColor) 104 }); 105 this.$off = $('<span>', { 106 html: this.options.offText, 107 class: this._getClass('handle-off') + ' ' + this._getClass(this.options.offColor) 108 }); 109 this.$label = $('<span>', { 110 html: this.options.labelText, 111 class: this._getClass('label') 112 }); 113 114 this.$element.on('init.bootstrapSwitch', this.options.onInit.bind(this, element)); 115 this.$element.on('switchChange.bootstrapSwitch', function () { 116 for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { 117 args[_key] = arguments[_key]; 118 } 119 120 if (_this.options.onSwitchChange.apply(element, args) === false) { 121 if (_this.$element.is(':radio')) { 122 $('[name="' + _this.$element.attr('name') + '"]').trigger('previousState.bootstrapSwitch', true); 123 } else { 124 _this.$element.trigger('previousState.bootstrapSwitch', true); 125 } 126 } 127 }); 128 129 this.$container = this.$element.wrap(this.$container).parent(); 130 this.$wrapper = this.$container.wrap(this.$wrapper).parent(); 131 this.$element.before(this.options.inverse ? this.$off : this.$on).before(this.$label).before(this.options.inverse ? this.$on : this.$off); 132 133 if (this.options.indeterminate) { 134 this.$element.prop('indeterminate', true); 135 } 136 137 this._init(); 138 this._elementHandlers(); 139 this._handleHandlers(); 140 this._labelHandlers(); 141 this._formHandler(); 142 this._externalLabelHandler(); 143 this.$element.trigger('init.bootstrapSwitch', this.options.state); 144 } 145 146 _createClass(BootstrapSwitch, [{ 147 key: 'setPrevOptions', 148 value: function setPrevOptions() { 149 this.prevOptions = _extends({}, this.options); 150 } 151 }, { 152 key: 'state', 153 value: function state(value, skip) { 154 if (typeof value === 'undefined') { 155 return this.options.state; 156 } 157 if (this.options.disabled || this.options.readonly || this.options.state && !this.options.radioAllOff && this.$element.is(':radio')) { 158 return this.$element; 159 } 160 if (this.$element.is(':radio')) { 161 $('[name="' + this.$element.attr('name') + '"]').trigger('setPreviousOptions.bootstrapSwitch'); 162 } else { 163 this.$element.trigger('setPreviousOptions.bootstrapSwitch'); 164 } 165 if (this.options.indeterminate) { 166 this.indeterminate(false); 167 } 168 this.$element.prop('checked', Boolean(value)).trigger('change.bootstrapSwitch', skip); 169 return this.$element; 170 } 171 }, { 172 key: 'toggleState', 173 value: function toggleState(skip) { 174 if (this.options.disabled || this.options.readonly) { 175 return this.$element; 176 } 177 if (this.options.indeterminate) { 178 this.indeterminate(false); 179 return this.state(true); 180 } else { 181 return this.$element.prop('checked', !this.options.state).trigger('change.bootstrapSwitch', skip); 182 } 183 } 184 }, { 185 key: 'size', 186 value: function size(value) { 187 if (typeof value === 'undefined') { 188 return this.options.size; 189 } 190 if (this.options.size != null) { 191 this.$wrapper.removeClass(this._getClass(this.options.size)); 192 } 193 if (value) { 194 this.$wrapper.addClass(this._getClass(value)); 195 } 196 this._width(); 197 this._containerPosition(); 198 this.options.size = value; 199 return this.$element; 200 } 201 }, { 202 key: 'animate', 203 value: function animate(value) { 204 if (typeof value === 'undefined') { 205 return this.options.animate; 206 } 207 if (this.options.animate === Boolean(value)) { 208 return this.$element; 209 } 210 return this.toggleAnimate(); 211 } 212 }, { 213 key: 'toggleAnimate', 214 value: function toggleAnimate() { 215 this.options.animate = !this.options.animate; 216 this.$wrapper.toggleClass(this._getClass('animate')); 217 return this.$element; 218 } 219 }, {
220 key: 'disabled', 221 value: function disabled(value) { 222 if (typeof value === 'undefined') { 223 return this.options.disabled; 224 } 225 if (this.options.disabled === Boolean(value)) { 226 return this.$element; 227 } 228 return this.toggleDisabled(); 229 } 230 }, { 231 key: 'toggleDisabled', 232 value: function toggleDisabled() { 233 this.options.disabled = !this.options.disabled; 234 this.$element.prop('disabled', this.options.disabled); 235 this.$wrapper.toggleClass(this._getClass('disabled')); 236 return this.$element; 237 } 238 }, { 239 key: 'readonly', 240 value: function readonly(value) { 241 if (typeof value === 'undefined') { 242 return this.options.readonly; 243 } 244 if (this.options.readonly === Boolean(value)) { 245 return this.$element; 246 } 247 return this.toggleReadonly(); 248 } 249 }, { 250 key: 'toggleReadonly', 251 value: function toggleReadonly() { 252 this.options.readonly = !this.options.readonly; 253 this.$element.prop('readonly', this.options.readonly); 254 this.$wrapper.toggleClass(this._getClass('readonly')); 255 return this.$element; 256 } 257 }, { 258 key: 'indeterminate', 259 value: function indeterminate(value) { 260 if (typeof value === 'undefined') { 261 return this.options.indeterminate; 262 } 263 if (this.options.indeterminate === Boolean(value)) { 264 return this.$element; 265 } 266 return this.toggleIndeterminate(); 267 } 268 }, { 269 key: 'toggleIndeterminate', 270 value: function toggleIndeterminate() { 271 this.options.indeterminate = !this.options.indeterminate; 272 this.$element.prop('indeterminate', this.options.indeterminate); 273 this.$wrapper.toggleClass(this._getClass('indeterminate')); 274 this._containerPosition(); 275 return this.$element; 276 } 277 }, { 278 key: 'inverse', 279 value: function inverse(value) { 280 if (typeof value === 'undefined') { 281 return this.options.inverse; 282 } 283 if (this.options.inverse === Boolean(value)) { 284 return this.$element; 285 } 286 return this.toggleInverse(); 287 } 288 }, { 289 key: 'toggleInverse', 290 value: function toggleInverse() { 291 this.$wrapper.toggleClass(this._getClass('inverse')); 292 var $on = this.$on.clone(true); 293 var $off = this.$off.clone(true); 294 this.$on.replaceWith($off); 295 this.$off.replaceWith($on); 296 this.$on = $off; 297 this.$off = $on; 298 this.options.inverse = !this.options.inverse; 299 return this.$element; 300 } 301 }, { 302 key: 'onColor', 303 value: function onColor(value) { 304 if (typeof value === 'undefined') { 305 return this.options.onColor; 306 } 307 if (this.options.onColor) { 308 this.$on.removeClass(this._getClass(this.options.onColor)); 309 } 310 this.$on.addClass(this._getClass(value)); 311 this.options.onColor = value; 312 return this.$element; 313 } 314 }, { 315 key: 'offColor', 316 value: function offColor(value) { 317 if (typeof value === 'undefined') { 318 return this.options.offColor; 319 } 320 if (this.options.offColor) { 321 this.$off.removeClass(this._getClass(this.options.offColor)); 322 } 323 this.$off.addClass(this._getClass(value)); 324 this.options.offColor = value; 325 return this.$element; 326 } 327 }, { 328 key: 'onText', 329 value: function onText(value) { 330 if (typeof value === 'undefined') { 331 return this.options.onText; 332 } 333 this.$on.html(value); 334 this._width(); 335 this._containerPosition(); 336 this.options.onText = value; 337 return this.$element; 338 } 339 }, { 340 key: 'offText', 341 value: function offText(value) { 342 if (typeof value === 'undefined') { 343 return this.options.offText; 344 } 345 this.$off.html(value); 346 this._width(); 347 this._containerPosition(); 348 this.options.offText = value; 349 return this.$element; 350 } 351 }, {
352 key: 'labelText', 353 value: function labelText(value) { 354 if (typeof value === 'undefined') { 355 return this.options.labelText; 356 } 357 this.$label.html(value); 358 this._width(); 359 this.options.labelText = value; 360 return this.$element; 361 } 362 }, { 363 key: 'handleWidth', 364 value: function handleWidth(value) { 365 if (typeof value === 'undefined') { 366 return this.options.handleWidth; 367 } 368 this.options.handleWidth = value; 369 this._width(); 370 this._containerPosition(); 371 return this.$element; 372 } 373 }, { 374 key: 'labelWidth', 375 value: function labelWidth(value) { 376 if (typeof value === 'undefined') { 377 return this.options.labelWidth; 378 } 379 this.options.labelWidth = value; 380 this._width(); 381 this._containerPosition(); 382 return this.$element; 383 } 384 }, { 385 key: 'baseClass', 386 value: function baseClass(value) { 387 return this.options.baseClass; 388 } 389 }, { 390 key: 'wrapperClass', 391 value: function wrapperClass(value) { 392 if (typeof value === 'undefined') { 393 return this.options.wrapperClass; 394 } 395 if (!value) { 396 value = $.fn.bootstrapSwitch.defaults.wrapperClass; 397 } 398 this.$wrapper.removeClass(this._getClasses(this.options.wrapperClass).join(' ')); 399 this.$wrapper.addClass(this._getClasses(value).join(' ')); 400 this.options.wrapperClass = value; 401 return this.$element; 402 } 403 }, { 404 key: 'radioAllOff', 405 value: function radioAllOff(value) { 406 if (typeof value === 'undefined') { 407 return this.options.radioAllOff; 408 } 409 var val = Boolean(value); 410 if (this.options.radioAllOff === val) { 411 return this.$element; 412 } 413 this.options.radioAllOff = val; 414 return this.$element; 415 } 416 }, { 417 key: 'onInit', 418 value: function onInit(value) { 419 if (typeof value === 'undefined') { 420 return this.options.onInit; 421 } 422 if (!value) { 423 value = $.fn.bootstrapSwitch.defaults.onInit; 424 } 425 this.options.onInit = value; 426 return this.$element; 427 } 428 }, { 429 key: 'onSwitchChange', 430 value: function onSwitchChange(value) { 431 if (typeof value === 'undefined') { 432 return this.options.onSwitchChange; 433 } 434 if (!value) { 435 value = $.fn.bootstrapSwitch.defaults.onSwitchChange; 436 } 437 this.options.onSwitchChange = value; 438 return this.$element; 439 } 440 }, { 441 key: 'destroy', 442 value: function destroy() { 443 var $form = this.$element.closest('form'); 444 if ($form.length) { 445 $form.off('reset.bootstrapSwitch').removeData('bootstrap-switch'); 446 } 447 this.$container.children().not(this.$element).remove(); 448 this.$element.unwrap().unwrap().off('.bootstrapSwitch').removeData('bootstrap-switch'); 449 return this.$element; 450 } 451 }, { 452 key: '_getElementOptions', 453 value: function _getElementOptions() { 454 return { 455 state: this.$element.is(':checked'), 456 size: this.$element.data('size'), 457 animate: this.$element.data('animate'), 458 disabled: this.$element.is(':disabled'), 459 readonly: this.$element.is('[readonly]'), 460 indeterminate: this.$element.data('indeterminate'), 461 inverse: this.$element.data('inverse'), 462 radioAllOff: this.$element.data('radio-all-off'), 463 onColor: this.$element.data('on-color'), 464 offColor: this.$element.data('off-color'), 465 onText: this.$element.data('on-text'), 466 offText: this.$element.data('off-text'), 467 labelText: this.$element.data('label-text'), 468 handleWidth: this.$element.data('handle-width'), 469 labelWidth: this.$element.data('label-width'), 470 baseClass: this.$element.data('base-class'), 471 wrapperClass: this.$element.data('wrapper-class') 472 }; 473 } 474 }, { 475 key: '_width', 476 value: function _width() { 477 var _this2 = this; 478 479 var $handles = this.$on.add(this.$off).add(this.$label).css('width', ''); 480 var handleWidth = this.options.handleWidth === 'auto' ? Math.round(Math.max(this.$on.width(), this.$off.width())) : this.options.handleWidth; 481 $handles.width(handleWidth);
482 this.$label.width(function (index, width) { 483 if (_this2.options.labelWidth !== 'auto') { 484 return _this2.options.labelWidth; 485 } 486 if (width < handleWidth) { 487 return handleWidth; 488 } 489 return width; 490 }); 491 this._handleWidth = this.$on.outerWidth(); 492 this._labelWidth = this.$label.outerWidth(); 493 this.$container.width(this._handleWidth * 2 + this._labelWidth); 494 return this.$wrapper.width(this._handleWidth + this._labelWidth); 495 } 496 }, { 497 key: '_containerPosition', 498 value: function _containerPosition() { 499 var _this3 = this; 500 501 var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.options.state; 502 var callback = arguments[1]; 503 504 this.$container.css('margin-left', function () { 505 var values = [0, '-' + _this3._handleWidth + 'px']; 506 if (_this3.options.indeterminate) { 507 return '-' + _this3._handleWidth / 2 + 'px'; 508 } 509 if (state) { 510 if (_this3.options.inverse) { 511 return values[1]; 512 } else { 513 return values[0]; 514 } 515 } else { 516 if (_this3.options.inverse) { 517 return values[0]; 518 } else { 519 return values[1]; 520 } 521 } 522 }); 523 } 524 }, { 525 key: '_init', 526 value: function _init() { 527 var _this4 = this; 528 529 var init = function init() { 530 _this4.setPrevOptions(); 531 _this4._width(); 532 _this4._containerPosition(); 533 setTimeout(function () { 534 if (_this4.options.animate) { 535 return _this4.$wrapper.addClass(_this4._getClass('animate')); 536 } 537 }, 50); 538 }; 539 if (this.$wrapper.is(':visible')) { 540 init(); 541 return; 542 } 543 var initInterval = window.setInterval(function () { 544 if (_this4.$wrapper.is(':visible')) { 545 init(); 546 return window.clearInterval(initInterval); 547 } 548 }, 50); 549 } 550 }, { 551 key: '_elementHandlers', 552 value: function _elementHandlers() { 553 var _this5 = this; 554 555 return this.$element.on({ 556 'setPreviousOptions.bootstrapSwitch': this.setPrevOptions.bind(this), 557 558 'previousState.bootstrapSwitch': function previousStateBootstrapSwitch() { 559 _this5.options = _this5.prevOptions; 560 if (_this5.options.indeterminate) { 561 _this5.$wrapper.addClass(_this5._getClass('indeterminate')); 562 } 563 _this5.$element.prop('checked', _this5.options.state).trigger('change.bootstrapSwitch', true); 564 }, 565 566 'change.bootstrapSwitch': function changeBootstrapSwitch(event, skip) { 567 event.preventDefault(); 568 event.stopImmediatePropagation(); 569 var state = _this5.$element.is(':checked'); 570 _this5._containerPosition(state); 571 if (state === _this5.options.state) { 572 return; 573 } 574 _this5.options.state = state; 575 _this5.$wrapper.toggleClass(_this5._getClass('off')).toggleClass(_this5._getClass('on')); 576 if (!skip) { 577 if (_this5.$element.is(':radio')) { 578 $('[name="' + _this5.$element.attr('name') + '"]').not(_this5.$element).prop('checked', false).trigger('change.bootstrapSwitch', true); 579 } 580 _this5.$element.trigger('switchChange.bootstrapSwitch', [state]); 581 } 582 }, 583 584 'focus.bootstrapSwitch': function focusBootstrapSwitch(event) { 585 event.preventDefault(); 586 _this5.$wrapper.addClass(_this5._getClass('focused')); 587 }, 588 589 'blur.bootstrapSwitch': function blurBootstrapSwitch(event) { 590 event.preventDefault(); 591 _this5.$wrapper.removeClass(_this5._getClass('focused')); 592 }, 593 594 'keydown.bootstrapSwitch': function keydownBootstrapSwitch(event) { 595 if (!event.which || _this5.options.disabled || _this5.options.readonly) { 596 return; 597 } 598 if (event.which === 37 || event.which === 39) { 599 event.preventDefault(); 600 event.stopImmediatePropagation(); 601 _this5.state(event.which === 39); 602 } 603 } 604 }); 605 } 606 }, {
607 key: '_handleHandlers', 608 value: function _handleHandlers() { 609 var _this6 = this; 610 611 this.$on.on('click.bootstrapSwitch', function (event) { 612 event.preventDefault(); 613 event.stopPropagation(); 614 _this6.state(false); 615 return _this6.$element.trigger('focus.bootstrapSwitch'); 616 }); 617 return this.$off.on('click.bootstrapSwitch', function (event) { 618 event.preventDefault(); 619 event.stopPropagation(); 620 _this6.state(true); 621 return _this6.$element.trigger('focus.bootstrapSwitch'); 622 }); 623 } 624 }, { 625 key: '_labelHandlers', 626 value: function _labelHandlers() { 627 var _this7 = this; 628 629 var handlers = { 630 click: function click(event) { 631 event.stopPropagation(); 632 }, 633 634 635 'mousedown.bootstrapSwitch touchstart.bootstrapSwitch': function mousedownBootstrapSwitchTouchstartBootstrapSwitch(event) { 636 if (_this7._dragStart || _this7.options.disabled || _this7.options.readonly) { 637 return; 638 } 639 event.preventDefault(); 640 event.stopPropagation(); 641 _this7._dragStart = (event.pageX || event.originalEvent.touches[0].pageX) - parseInt(_this7.$container.css('margin-left'), 10); 642 if (_this7.options.animate) { 643 _this7.$wrapper.removeClass(_this7._getClass('animate')); 644 } 645 _this7.$element.trigger('focus.bootstrapSwitch'); 646 }, 647 648 'mousemove.bootstrapSwitch touchmove.bootstrapSwitch': function mousemoveBootstrapSwitchTouchmoveBootstrapSwitch(event) { 649 if (_this7._dragStart == null) { 650 return; 651 } 652 var difference = (event.pageX || event.originalEvent.touches[0].pageX) - _this7._dragStart; 653 event.preventDefault(); 654 if (difference < -_this7._handleWidth || difference > 0) { 655 return; 656 } 657 _this7._dragEnd = difference; 658 _this7.$container.css('margin-left', _this7._dragEnd + 'px'); 659 }, 660 661 'mouseup.bootstrapSwitch touchend.bootstrapSwitch': function mouseupBootstrapSwitchTouchendBootstrapSwitch(event) { 662 if (!_this7._dragStart) { 663 return; 664 } 665 event.preventDefault(); 666 if (_this7.options.animate) { 667 _this7.$wrapper.addClass(_this7._getClass('animate')); 668 } 669 if (_this7._dragEnd) { 670 var state = _this7._dragEnd > -(_this7._handleWidth / 2); 671 _this7._dragEnd = false; 672 _this7.state(_this7.options.inverse ? !state : state); 673 } else { 674 _this7.state(!_this7.options.state); 675 } 676 _this7._dragStart = false;
677 }, 678 679 'mouseleave.bootstrapSwitch': function mouseleaveBootstrapSwitch() { 680 _this7.$label.trigger('mouseup.bootstrapSwitch'); 681 } 682 }; 683 this.$label.on(handlers); 684 } 685 }, { 686 key: '_externalLabelHandler', 687 value: function _externalLabelHandler() { 688 var _this8 = this; 689 690 var $externalLabel = this.$element.closest('label'); 691 $externalLabel.on('click', function (event) { 692 event.preventDefault(); 693 event.stopImmediatePropagation(); 694 if (event.target === $externalLabel[0]) { 695 _this8.toggleState(); 696 } 697 }); 698 } 699 }, { 700 key: '_formHandler', 701 value: function _formHandler() { 702 var $form = this.$element.closest('form'); 703 if ($form.data('bootstrap-switch')) { 704 return; 705 } 706 $form.on('reset.bootstrapSwitch', function () { 707 window.setTimeout(function () { 708 $form.find('input').filter(function () { 709 return $(this).data('bootstrap-switch'); 710 }).each(function () { 711 return $(this).bootstrapSwitch('state', this.checked); 712 }); 713 }, 1); 714 }).data('bootstrap-switch', true); 715 } 716 }, { 717 key: '_getClass', 718 value: function _getClass(name) { 719 return this.options.baseClass + '-' + name; 720 } 721 }, { 722 key: '_getClasses', 723 value: function _getClasses(classes) { 724 if (!$.isArray(classes)) { 725 return [this._getClass(classes)]; 726 } 727 return classes.map(this._getClass.bind(this)); 728 } 729 }]); 730 731 return BootstrapSwitch; 732 }(); 733 734 $.fn.bootstrapSwitch = function (option) { 735 for (var _len2 = arguments.length, args = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { 736 args[_key2 - 1] = arguments[_key2]; 737 } 738 739 function reducer(ret, next) { 740 var $this = $(next); 741 var existingData = $this.data('bootstrap-switch'); 742 var data = existingData || new BootstrapSwitch(next, option); 743 if (!existingData) { 744 $this.data('bootstrap-switch', data); 745 } 746 if (typeof option === 'string') { 747 return data[option].apply(data, args); 748 } 749 return ret; 750 } 751 return Array.prototype.reduce.call(this, reducer, this); 752 }; 753 $.fn.bootstrapSwitch.Constructor = BootstrapSwitch; 754 $.fn.bootstrapSwitch.defaults = { 755 state: true, 756 size: null, 757 animate: true, 758 disabled: false, 759 readonly: false, 760 indeterminate: false, 761 inverse: false, 762 radioAllOff: false, 763 onColor: 'primary', 764 offColor: 'default', 765 onText: 'ON', 766 offText: 'OFF', 767 labelText: ' ', 768 handleWidth: 'auto', 769 labelWidth: 'auto', 770 baseClass: 'bootstrap-switch', 771 wrapperClass: 'wrapper', 772 onInit: function onInit() {}, 773 onSwitchChange: function onSwitchChange() {} 774 }; 775});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.