bootstrap-switch
Advanced tools
Sorry, the diff of this file is not supported yet
| { | ||
| "globals": { | ||
| "title": "Bootstrap Switch", | ||
| "description": "Turn checkboxes and radio buttons into toggle switches", | ||
| "version": "3.3.4" | ||
| } | ||
| } |
| doctype html | ||
| html(lang='en') | ||
| head | ||
| meta(charset='utf-8') | ||
| meta(http-equiv='x-ua-Compatible' content='ie=edge') | ||
| meta(name='viewport', content='width=device-width, initial-scale=1.0') | ||
| meta(name='description', content=description) | ||
| meta(name='author', content='Mattia Larentis, Emanuele Marchi and Peter Stein') | ||
| title #{title} · #{description} | ||
| link(href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css' rel='stylesheet') | ||
| link(href='css/highlight.css' rel='stylesheet') | ||
| link(href="https://unpkg.com/bootstrap-switch/dist/css/bootstrap3/bootstrap-switch.css" rel='stylesheet') | ||
| link(href='https://getbootstrap.com/assets/css/docs.min.css' rel='stylesheet') | ||
| link(href='css/main.css' rel='stylesheet') | ||
| body | ||
| a(href='https://github.com/Bttstrp/bootstrap-switch', id='github') | ||
| img(src='https://s3.amazonaws.com/github/ribbons/forkme_right_gray_6d6d6d.png', alt='Fork me on GitHub') | ||
| header.navbar.navbar-static-top.bs-docs-nav(role='banner') | ||
| .container | ||
| .navbar-header | ||
| button.navbar-toggle(type='button', data-toggle='collapse', data-target='#collapse') | ||
| span.sr-only Toggle navigation | ||
| span.icon-bar | ||
| span.icon-bar | ||
| span.icon-bar | ||
| a.navbar-brand(href='../')= title | ||
| nav#collapse.collapse.navbar-collapse.bs-navbar-collapse(role='navigation') | ||
| ul.nav.navbar-nav | ||
| li: a(href='https://github.com/Bttstrp/bootstrap-switch/archive/master.zip', data-toggle='dropdown') Download | ||
| li: a(href='examples.html') Examples | ||
| li.dropdown | ||
| a(href='#', data-toggle='dropdown') | ||
| | Documentation | ||
| = ' ' | ||
| span.caret | ||
| ul.dropdown-menu | ||
| li: a(href='/options.html') Options | ||
| li: a(href='/methods.html') Methods | ||
| li: a(href='/events.html') Events | ||
| li.divider(role='presentation') | ||
| li: a(href='/documentation-2.html') Documentation (v2.0.1) | ||
| li: a(href='https://github.com/Bttstrp/bootstrap-switch/issues') Bug reports | ||
| main#content(role='main') | ||
| != yield | ||
| footer.bs-docs-footer | ||
| .container | ||
| p | ||
| | Code licensed under | ||
| = ' ' | ||
| a(href='https://www.apache.org/licenses/LICENSE-2.0', target='_blank') Apache License, Version 2.0 | ||
| br | ||
| | Created by | ||
| = ' ' | ||
| a(href='https://github.com/nostalgiaz', target='_blank') Mattia Larentis | ||
| br | ||
| | Mantained by | ||
| = ' ' | ||
| a(href='https://github.com/lostcrew', target='_blank') Emanuele Marchi | ||
| script(src='https://code.jquery.com/jquery-3.1.1.min.js') | ||
| script(src='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js') | ||
| script(src='js/highlight.js') | ||
| script(src="https://unpkg.com/bootstrap-switch") | ||
| script(src='js/main.js') |
| h1 404 | ||
| h3 Whoops. Looks like what you're looking for can't be found. |
Sorry, the diff of this file is not supported yet
| /* | ||
| Original style from softwaremaniacs.org (c) Ivan Sagalaev <Maniac@SoftwareManiacs.Org> | ||
| */ | ||
| .hljs { | ||
| display: block; padding: 0.5em; | ||
| background: #F0F0F0; | ||
| } | ||
| .hljs, | ||
| .hljs-subst, | ||
| .hljs-tag .hljs-title, | ||
| .lisp .hljs-title, | ||
| .clojure .hljs-built_in, | ||
| .nginx .hljs-title { | ||
| color: black; | ||
| } | ||
| .hljs-string, | ||
| .hljs-title, | ||
| .hljs-constant, | ||
| .hljs-parent, | ||
| .hljs-tag .hljs-value, | ||
| .hljs-rules .hljs-value, | ||
| .hljs-rules .hljs-value .hljs-number, | ||
| .hljs-preprocessor, | ||
| .hljs-pragma, | ||
| .haml .hljs-symbol, | ||
| .ruby .hljs-symbol, | ||
| .ruby .hljs-symbol .hljs-string, | ||
| .hljs-aggregate, | ||
| .hljs-template_tag, | ||
| .django .hljs-variable, | ||
| .smalltalk .hljs-class, | ||
| .hljs-addition, | ||
| .hljs-flow, | ||
| .hljs-stream, | ||
| .bash .hljs-variable, | ||
| .apache .hljs-tag, | ||
| .apache .hljs-cbracket, | ||
| .tex .hljs-command, | ||
| .tex .hljs-special, | ||
| .erlang_repl .hljs-function_or_atom, | ||
| .asciidoc .hljs-header, | ||
| .markdown .hljs-header, | ||
| .coffeescript .hljs-attribute { | ||
| color: #800; | ||
| } | ||
| .smartquote, | ||
| .hljs-comment, | ||
| .hljs-annotation, | ||
| .hljs-template_comment, | ||
| .diff .hljs-header, | ||
| .hljs-chunk, | ||
| .asciidoc .hljs-blockquote, | ||
| .markdown .hljs-blockquote { | ||
| color: #888; | ||
| } | ||
| .hljs-number, | ||
| .hljs-date, | ||
| .hljs-regexp, | ||
| .hljs-literal, | ||
| .hljs-hexcolor, | ||
| .smalltalk .hljs-symbol, | ||
| .smalltalk .hljs-char, | ||
| .go .hljs-constant, | ||
| .hljs-change, | ||
| .lasso .hljs-variable, | ||
| .makefile .hljs-variable, | ||
| .asciidoc .hljs-bullet, | ||
| .markdown .hljs-bullet, | ||
| .asciidoc .hljs-link_url, | ||
| .markdown .hljs-link_url { | ||
| color: #080; | ||
| } | ||
| .hljs-label, | ||
| .hljs-javadoc, | ||
| .ruby .hljs-string, | ||
| .hljs-decorator, | ||
| .hljs-filter .hljs-argument, | ||
| .hljs-localvars, | ||
| .hljs-array, | ||
| .hljs-attr_selector, | ||
| .hljs-important, | ||
| .hljs-pseudo, | ||
| .hljs-pi, | ||
| .haml .hljs-bullet, | ||
| .hljs-doctype, | ||
| .hljs-deletion, | ||
| .hljs-envvar, | ||
| .hljs-shebang, | ||
| .apache .hljs-sqbracket, | ||
| .nginx .hljs-built_in, | ||
| .tex .hljs-formula, | ||
| .erlang_repl .hljs-reserved, | ||
| .hljs-prompt, | ||
| .asciidoc .hljs-link_label, | ||
| .markdown .hljs-link_label, | ||
| .vhdl .hljs-attribute, | ||
| .clojure .hljs-attribute, | ||
| .asciidoc .hljs-attribute, | ||
| .lasso .hljs-attribute, | ||
| .coffeescript .hljs-property, | ||
| .hljs-phony { | ||
| color: #88F | ||
| } | ||
| .hljs-keyword, | ||
| .hljs-id, | ||
| .hljs-title, | ||
| .hljs-built_in, | ||
| .hljs-aggregate, | ||
| .css .hljs-tag, | ||
| .hljs-javadoctag, | ||
| .hljs-phpdoc, | ||
| .hljs-yardoctag, | ||
| .smalltalk .hljs-class, | ||
| .hljs-winutils, | ||
| .bash .hljs-variable, | ||
| .apache .hljs-tag, | ||
| .go .hljs-typename, | ||
| .tex .hljs-command, | ||
| .asciidoc .hljs-strong, | ||
| .markdown .hljs-strong, | ||
| .hljs-request, | ||
| .hljs-status { | ||
| font-weight: bold; | ||
| } | ||
| .asciidoc .hljs-emphasis, | ||
| .markdown .hljs-emphasis { | ||
| font-style: italic; | ||
| } | ||
| .nginx .hljs-built_in { | ||
| font-weight: normal; | ||
| } | ||
| .coffeescript .javascript, | ||
| .javascript .xml, | ||
| .lasso .markup, | ||
| .tex .hljs-formula, | ||
| .xml .javascript, | ||
| .xml .vbscript, | ||
| .xml .css, | ||
| .xml .hljs-cdata { | ||
| opacity: 0.5; | ||
| } |
| body { | ||
| font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; | ||
| padding-bottom: 50px; | ||
| } | ||
| .bs-docs-masthead, | ||
| .bs-docs-header { | ||
| color: #cdbfe3; | ||
| text-shadow: 0 1px 0 rgba(0,0,0,.1); | ||
| background-color: #6f5499; | ||
| background-image: -webkit-gradient(linear,left top,left bottom,from(#563d7c),to(#6f5499)); | ||
| background-image:-webkit-linear-gradient(top,#563d7c 0,#6f5499 100%); | ||
| background-image:-o-linear-gradient(top,#563d7c 0,#6f5499 100%); | ||
| background-image:linear-gradient(to bottom,#563d7c 0,#6f5499 100%); | ||
| filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#563d7c', endColorstr='#6F5499', GradientType=0); | ||
| background-repeat:repeat-x | ||
| } | ||
| .bs-docs-masthead h1 { | ||
| font-weight: 500; | ||
| } | ||
| .page-header { | ||
| text-align: left; | ||
| } | ||
| #github { | ||
| display: none; | ||
| position: fixed; | ||
| width: 150px; | ||
| height: 150px; | ||
| top: 0; | ||
| right: 0; | ||
| z-index: 2000; | ||
| } | ||
| .bottom { | ||
| border-top: 1px solid #eee; | ||
| margin-top: 40px; | ||
| padding-top: 20px; | ||
| padding-bottom: 20px; | ||
| text-align: center; | ||
| } | ||
| .hljs { | ||
| background-color: transparent; | ||
| } | ||
| @media (min-width: 768px) { | ||
| #github { | ||
| display: block; | ||
| } | ||
| } |
| .bs-docs-header | ||
| .container | ||
| h1 Documentation | ||
| p v2.0.1 | ||
| .container | ||
| #options | ||
| h2.page-header Options | ||
| .alert.alert-warning | ||
| p | ||
| | All the options are accepted only using <code>data-*</code> attributes on the element.<br> | ||
| | <code>checked</code>, <code>disabled</code> and <code>readonly</code> are exceptions to the rule, being | ||
| | default HTML input attributes.<br> | ||
| | Therefore, there is not any way to specify the options in JavaScript during initialization. | ||
| table.table.table-bordered.table-striped.table-responsive | ||
| thead | ||
| tr | ||
| th Name | ||
| th Type | ||
| th Description | ||
| th Values | ||
| th Default | ||
| tbody | ||
| tr | ||
| td state | ||
| td Boolean | ||
| td The checkbox state | ||
| td true, false | ||
| td 'checked' attribute or true | ||
| tr | ||
| td size | ||
| td String | ||
| td The checkbox state | ||
| td '', 'mini', 'small', 'normal', 'large' | ||
| td '' | ||
| tr | ||
| td animate | ||
| td Boolean | ||
| td Animate the switch | ||
| td true, false | ||
| td true | ||
| tr | ||
| td disabled | ||
| td Boolean | ||
| td Disable state | ||
| td true, false | ||
| td 'disabled' attribute or false | ||
| tr | ||
| td readonly | ||
| td Boolean | ||
| td Readonly state | ||
| td true, false | ||
| td 'readonly' attribute or false | ||
| tr | ||
| td on | ||
| td String | ||
| td Color of the left side of the switch | ||
| td 'primary', 'info', 'success', 'warning', 'danger', 'default' | ||
| td null | ||
| tr | ||
| td off | ||
| td String | ||
| td Color of the right side of the switch | ||
| td 'primary', 'info', 'success', 'warning', 'danger', 'default' | ||
| td null | ||
| tr | ||
| td on-label | ||
| td String | ||
| td Text of the left side of the switch | ||
| td String | ||
| td 'ON' | ||
| tr | ||
| td off-label | ||
| td String | ||
| td Text of the right side of the switch | ||
| td String | ||
| td 'OFF' | ||
| tr | ||
| td label-text | ||
| td String | ||
| td Text of the center handle of the switch | ||
| td String | ||
| td '&nbsp;' | ||
| tr | ||
| td label-icon | ||
| td String | ||
| td Text of the center handle of the switch. Use to include external services icons | ||
| td String | ||
| td null | ||
| #methods | ||
| h2.page-header Methods | ||
| table.table.table-bordered.table-striped.table-responsive | ||
| thead | ||
| tr | ||
| th Name | ||
| th Description | ||
| th Accepted Values | ||
| th Returned Values | ||
| tbody | ||
| tr | ||
| td state | ||
| td Get checkbox state | ||
| td | ||
| td true, false | ||
| tr | ||
| td setState | ||
| td Set checkbox state | ||
| td (value: true, false)[, skip: true, <strong>false</strong>] | ||
| td jQuery Object (input element) | ||
| tr | ||
| td toggleState | ||
| td Toggle checkbox state | ||
| td [skip: true, <strong>false</strong>] | ||
| td jQuery Object (input element) | ||
| tr | ||
| td toggleRadioState | ||
| td Toggle radio state | ||
| td [skip: true, <strong>false</strong>] | ||
| td jQuery Object (input element) | ||
| tr | ||
| td toggleRadioStateAllowUncheck | ||
| td Toggle radio state allowing uncheck of the radio input | ||
| td [uncheck: true, <strong>false</strong> | skip: true, <strong>false</strong>] | ||
| td jQuery Object (input element) | ||
| tr | ||
| td setSizeClass | ||
| td Set the size of the switch | ||
| td '', 'mini', 'small', 'normal', 'large' | ||
| td jQuery Object (input element) | ||
| tr | ||
| td setAnimated | ||
| td Animate the switch | ||
| td true, false | ||
| td jQuery Object (input element) | ||
| tr | ||
| td isDisabled | ||
| td Get disabled state | ||
| td | ||
| td true, false | ||
| tr | ||
| td setDisabled | ||
| td Set disable state | ||
| td true, false | ||
| td jQuery Object (input element) | ||
| tr | ||
| td toggleDisabled | ||
| td Toggle disabled state | ||
| td | ||
| td jQuery Object (input element) | ||
| tr | ||
| td isReadOnly | ||
| td Get Readonly state | ||
| td | ||
| td true, false | ||
| tr | ||
| td setReadOnly | ||
| td Set Readonly state | ||
| td true, false | ||
| td jQuery Object (input element) | ||
| tr | ||
| td toggleReadOnly | ||
| td Toggle readonly state | ||
| td | ||
| td jQuery Object (input element) | ||
| tr | ||
| td setOnClass | ||
| td Color of the left side of the switch | ||
| td 'primary', 'info', 'success', 'warning', 'danger', 'default' | ||
| td jQuery Object (input element) | ||
| tr | ||
| td setOffClass | ||
| td Color of the right side of the switch | ||
| td 'primary', 'info', 'success', 'warning', 'danger', 'default' | ||
| td jQuery Object (input element) | ||
| tr | ||
| td setOnLabel | ||
| td Text of the left side of the switch | ||
| td String | ||
| td jQuery Object (input element) | ||
| tr | ||
| td setOffLabel | ||
| td Text of the right side of the switch | ||
| td String | ||
| td jQuery Object (input element) | ||
| tr | ||
| td setTextLabel | ||
| td Text of the center handle of the switch | ||
| td String | ||
| td null | ||
| tr | ||
| td setTextIcon | ||
| td Text of the center handle of the switch. Use to include external services icons | ||
| td String | ||
| td null | ||
| tr | ||
| td destroy | ||
| td Destroy the instance of #{title} | ||
| td | ||
| td jQuery Object (input element) | ||
| #events | ||
| h2.page-header Events | ||
| p | ||
| | The only event triggered is <code>switch-change</code>. It returns two parameters: <code>event</code> and | ||
| | <code>data</code>.<br> | ||
| | The latter is an object that includes <code>el</code> (the input DOM element) and <code>value</code> (the | ||
| | new input state) |
| .bs-docs-header | ||
| .container | ||
| h1 Events | ||
| .container | ||
| p | ||
| | All the events are namespaced, therefore always append <code>.bootstrapSwitch</code> when you | ||
| | attach your handlers.<br> | ||
| | You can register to the emitted events as follows: | ||
| pre: code | ||
| | $('input[name="my-checkbox"]').on('switchChange.bootstrapSwitch', function(event, state) { | ||
| | console.log(this); // DOM element | ||
| | console.log(event); // jQuery event | ||
| | console.log(state); // true | false | ||
| | }); | ||
| table.table.table-bordered.table-striped.table-responsive | ||
| thead | ||
| tr | ||
| th Name | ||
| th Description | ||
| th Parameters | ||
| tbody | ||
| tr | ||
| td init | ||
| td Triggered on initialization. 'this' refers to the DOM element. | ||
| td | ||
| | event (<a href="https://api.jquery.com/category/events/event-object/" target="_blank">jQuery Event object</a>) | ||
| | state (true | false) | ||
| tr | ||
| td switchChange | ||
| td Triggered on switch state change. 'this' refers to the DOM element. | ||
| td | ||
| | event (<a href="https://api.jquery.com/category/events/event-object/" target="_blank">jQuery Event object</a>), | ||
| | state (true | false) |
| .bs-docs-header | ||
| .container | ||
| h1 Examples | ||
| .container | ||
| .row | ||
| .col-sm-6.col-lg-4 | ||
| h2.h4 State | ||
| p | ||
| input#switch-state(type='checkbox', checked) | ||
| .btn-group | ||
| button.btn.btn-default(type='button' data-switch-toggle='state') Toggle | ||
| button.btn.btn-default(type='button', data-switch-set='state', data-switch-value='true') Set true | ||
| button.btn.btn-default(type='button', data-switch-set='state', data-switch-value='false') Set false | ||
| button.btn.btn-default(type='button', data-switch-get='state') Get | ||
| .col-sm-6.col-lg-4 | ||
| h2.h4 Size | ||
| p | ||
| input#switch-size(type='checkbox', checked, data-size='mini') | ||
| .btn-group | ||
| button.btn.btn-default(type='button', data-switch-set='size', data-switch-value='mini') Mini | ||
| button.btn.btn-default(type='button', data-switch-set='size', data-switch-value='small') Small | ||
| button.btn.btn-default(type='button', data-switch-set='size', data-switch-value='normal') Normal | ||
| button.btn.btn-default(type='button', data-switch-set='size', data-switch-value='large') Large | ||
| button.btn.btn-default(type='button', data-switch-get='size') Get | ||
| .col-sm-6.col-lg-4 | ||
| h2.h4 Animate | ||
| p | ||
| input#switch-animate(type='checkbox', checked) | ||
| p | ||
| button.btn.btn-default(type='button', data-switch-toggle='animate') Toggle | ||
| button.btn.btn-default(type='button', data-switch-get='animate') Get | ||
| .col-sm-6.col-lg-4 | ||
| h2.h4 Disabled | ||
| p | ||
| input#switch-disabled(type='checkbox', checked, disabled) | ||
| p | ||
| button.btn.btn-default(type='button', data-switch-toggle='disabled') Toggle | ||
| button.btn.btn-default(type='button', data-switch-get='disabled') Get | ||
| .col-sm-6.col-lg-4 | ||
| h2.h4 Readonly | ||
| p | ||
| input#switch-readonly(type='checkbox', checked, readonly) | ||
| p | ||
| button.btn.btn-default(type='button', data-switch-toggle='readonly') Toggle | ||
| button.btn.btn-default(type='button', data-switch-get='readonly') Get | ||
| .col-sm-6.col-lg-4 | ||
| h2.h4 Indeterminate | ||
| p | ||
| input#switch-indeterminate(type='checkbox', checked, data-indeterminate='true') | ||
| p | ||
| button.btn.btn-default(type='button', data-switch-toggle='indeterminate') Toggle | ||
| button.btn.btn-default(type='button', data-switch-get='indeterminate') Get | ||
| .col-sm-6.col-lg-4 | ||
| h2.h4 Inverse | ||
| p | ||
| input#switch-inverse(type='checkbox', checked, data-inverse='true') | ||
| p | ||
| button.btn.btn-default(type='button', data-switch-toggle='inverse') Toggle | ||
| button.btn.btn-default(type='button', data-switch-get='inverse') Get | ||
| .col-sm-6.col-lg-4 | ||
| h2.h4 On Color | ||
| p | ||
| input#switch-onColor(type='checkbox', checked, data-on-color='info') | ||
| p.btn-group | ||
| .btn-group | ||
| button.btn.btn-default.dropdown-toggle(type='button', data-toggle='dropdown') | ||
| | Set | ||
| span.caret | ||
| .dropdown-menu(role='menu') | ||
| li: a(data-switch-set='onColor', data-switch-value='primary') Primary | ||
| li: a(data-switch-set='onColor', data-switch-value='info') Info | ||
| li: a(data-switch-set='onColor', data-switch-value='success') Success | ||
| li: a(data-switch-set='onColor', data-switch-value='warning') Warning | ||
| li: a(data-switch-set='onColor', data-switch-value='default') Default | ||
| button.btn.btn-default(type='button', data-switch-get='onColor') Get | ||
| .col-sm-6.col-lg-4 | ||
| h2.h4 Off Color | ||
| p | ||
| input#switch-offColor(type='checkbox', data-off-color='warning') | ||
| p.btn-group | ||
| .btn-group | ||
| button.btn.btn-default.dropdown-toggle(type='button', data-toggle='dropdown') | ||
| | Set | ||
| span.caret | ||
| .dropdown-menu(role='menu') | ||
| li: a(data-switch-set='offColor', data-switch-value='primary') Primary | ||
| li: a(data-switch-set='offColor', data-switch-value='info') Info | ||
| li: a(data-switch-set='offColor', data-switch-value='success') Success | ||
| li: a(data-switch-set='offColor', data-switch-value='warning') Warning | ||
| li: a(data-switch-set='offColor', data-switch-value='default') Default | ||
| button.btn.btn-default(type='button', data-switch-get='offColor') Get | ||
| .col-sm-6.col-lg-4 | ||
| h2.h4 On Text | ||
| p | ||
| input#switch-onText(type='checkbox', checked, data-on-text='Yes') | ||
| .row | ||
| .col-sm-6 | ||
| input.form-control(type='text', data-switch-set-value='onText', value='Yes') | ||
| .col-sm-6.col-lg-4 | ||
| h2.h4 Off Text | ||
| p | ||
| input#switch-offText(type='checkbox', data-off-text='No') | ||
| .row | ||
| .col-sm-6 | ||
| input.form-control(type='text', data-switch-set-value='offText', value='No') | ||
| .col-sm-6.col-lg-4 | ||
| h2.h4 Label Text | ||
| p | ||
| input#switch-labelText(type='checkbox', data-label-text='Label') | ||
| .row | ||
| .col-sm-6 | ||
| input.form-control(type='text', data-switch-set-value='labelText') | ||
| .col-sm-6.col-lg-4 | ||
| h2.h4 Handle Width | ||
| p | ||
| input#switch-handleWidth(type='checkbox', data-handle-width='100') | ||
| .row | ||
| .col-sm-6 | ||
| input.form-control(type='number', data-switch-set-value='handleWidth', value='100') | ||
| .col-sm-6.col-lg-4 | ||
| h2.h4 Label Width | ||
| p | ||
| input#switch-labelWidth(type='checkbox', data-label-width='100') | ||
| .row | ||
| .col-sm-6 | ||
| input.form-control(type='number', data-switch-set-value='labelWidth', value='100') | ||
| .col-sm-6.col-lg-4 | ||
| h2.h4 Create | Destroy | ||
| p | ||
| input#switch-create-destroy(type='checkbox', checked, data-switch-no-init) | ||
| .row | ||
| .col-sm-6 | ||
| button.btn.btn-default(type='button', data-switch-create-destroy, data-destroy-text="Destroy") Create | ||
| br | ||
| br | ||
| .text-center | ||
| h2.h4 Radio All Off | ||
| .row | ||
| .col-sm-6 | ||
| h3.h5 Disabled | ||
| input.switch-radio1(type='radio', name='radio1', checked) | ||
| input.switch-radio1(type='radio', name='radio1') | ||
| input.switch-radio1(type='radio', name='radio1') | ||
| .col-sm-6 | ||
| h3.h5 Enabled | ||
| input.switch-radio2(type='radio', name='radio2', checked, data-radio-all-off='true') | ||
| input.switch-radio2(type='radio', name='radio2', data-radio-all-off='true') | ||
| input.switch-radio2(type='radio', name='radio2', data-radio-all-off='true') | ||
| br | ||
| hr | ||
| h2.h4 Inside Modals | ||
| button.btn.btn-default(data-toggle='modal', data-target='#modal-switch') Open Modal | ||
| .modal.fade#modal-switch(tabindex='-1', role='dialog', aria-labelledby='modal-switch-label') | ||
| .modal-dialog | ||
| .modal-content | ||
| .modal-header | ||
| button.close(type='button', data-dismiss='modal') | ||
| span(aria-hidden='true') × | ||
| span.sr-only Close | ||
| .modal-title#modal-switch-label Title | ||
| .modal-body | ||
| input#switch-modal(type='checkbox', checked) |
| .bs-docs-masthead | ||
| .container | ||
| h1.title= title | ||
| p.lead | ||
| | Turn checkboxes | ||
| input(type='checkbox', checked, data-switch-no-init) | ||
| | and radio buttons | ||
| input(type='radio', checked, data-switch-no-init) | ||
| | into toggle switches | ||
| input(type='checkbox', checked) | ||
| p.lead | ||
| a.btn.btn-outline-inverse.btn-lg(href='https://github.com/Bttstrp/bootstrap-switch/archive/master.zip') Download #{title} | ||
| p.bs-docs-social | ||
| iframe(src='https://ghbtns.com/github-btn.html?user=Bttstrp&repo=bootstrap-switch&type=watch&count=true&size=large', allowtransparency='true', frameborder='0', scrolling='0', width='184', height='30') | ||
| iframe(src='https://ghbtns.com/github-btn.html?user=Bttstrp&repo=bootstrap-switch&type=fork&count=true&size=large', allowtransparency='true', frameborder='0', scrolling='0', width='144', height='30') | ||
| br | ||
| p.version | ||
| | Currently v#{version} · Compatible with Bootstrap 2 and 3 | ||
| .container | ||
| h2.page-header Getting Started | ||
| p Include the dependencies: jQuery, Bootstrap and #{title} CSS + Javascript. | ||
| pre: code | ||
| | [...] | ||
| | <link href="bootstrap.css" rel="stylesheet"> | ||
| | <link href="bootstrap-switch.css" rel="stylesheet"> | ||
| | <script src="jquery.js"></script> | ||
| | <script src="bootstrap-switch.js"></script> | ||
| | [...] | ||
| p Add your checkbox. | ||
| pre: code <input type="checkbox" name="my-checkbox" checked> | ||
| p Initialize #{title}. | ||
| pre: code $("[name='my-checkbox']").bootstrapSwitch(); | ||
| p Enjoy. | ||
| .text-center | ||
| a.btn.btn-lg.btn-primary(href='examples.html') See Examples | ||
| | | ||
| a.btn.btn-lg.btn-outline(href='options.html') Browse Documentation | ||
| var hljs=new function(){function k(v){return v.replace(/&/gm,"&").replace(/</gm,"<").replace(/>/gm,">")}function t(v){return v.nodeName.toLowerCase()}function i(w,x){var v=w&&w.exec(x);return v&&v.index==0}function d(v){return Array.prototype.map.call(v.childNodes,function(w){if(w.nodeType==3){return b.useBR?w.nodeValue.replace(/\n/g,""):w.nodeValue}if(t(w)=="br"){return"\n"}return d(w)}).join("")}function r(w){var v=(w.className+" "+(w.parentNode?w.parentNode.className:"")).split(/\s+/);v=v.map(function(x){return x.replace(/^language-/,"")});return v.filter(function(x){return j(x)||x=="no-highlight"})[0]}function o(x,y){var v={};for(var w in x){v[w]=x[w]}if(y){for(var w in y){v[w]=y[w]}}return v}function u(x){var v=[];(function w(y,z){for(var A=y.firstChild;A;A=A.nextSibling){if(A.nodeType==3){z+=A.nodeValue.length}else{if(t(A)=="br"){z+=1}else{if(A.nodeType==1){v.push({event:"start",offset:z,node:A});z=w(A,z);v.push({event:"stop",offset:z,node:A})}}}}return z})(x,0);return v}function q(w,y,C){var x=0;var F="";var z=[];function B(){if(!w.length||!y.length){return w.length?w:y}if(w[0].offset!=y[0].offset){return(w[0].offset<y[0].offset)?w:y}return y[0].event=="start"?w:y}function A(H){function G(I){return" "+I.nodeName+'="'+k(I.value)+'"'}F+="<"+t(H)+Array.prototype.map.call(H.attributes,G).join("")+">"}function E(G){F+="</"+t(G)+">"}function v(G){(G.event=="start"?A:E)(G.node)}while(w.length||y.length){var D=B();F+=k(C.substr(x,D[0].offset-x));x=D[0].offset;if(D==w){z.reverse().forEach(E);do{v(D.splice(0,1)[0]);D=B()}while(D==w&&D.length&&D[0].offset==x);z.reverse().forEach(A)}else{if(D[0].event=="start"){z.push(D[0].node)}else{z.pop()}v(D.splice(0,1)[0])}}return F+k(C.substr(x))}function m(y){function v(z){return(z&&z.source)||z}function w(A,z){return RegExp(v(A),"m"+(y.cI?"i":"")+(z?"g":""))}function x(D,C){if(D.compiled){return}D.compiled=true;D.k=D.k||D.bK;if(D.k){var z={};function E(G,F){if(y.cI){F=F.toLowerCase()}F.split(" ").forEach(function(H){var I=H.split("|");z[I[0]]=[G,I[1]?Number(I[1]):1]})}if(typeof D.k=="string"){E("keyword",D.k)}else{Object.keys(D.k).forEach(function(F){E(F,D.k[F])})}D.k=z}D.lR=w(D.l||/\b[A-Za-z0-9_]+\b/,true);if(C){if(D.bK){D.b=D.bK.split(" ").join("|")}if(!D.b){D.b=/\B|\b/}D.bR=w(D.b);if(!D.e&&!D.eW){D.e=/\B|\b/}if(D.e){D.eR=w(D.e)}D.tE=v(D.e)||"";if(D.eW&&C.tE){D.tE+=(D.e?"|":"")+C.tE}}if(D.i){D.iR=w(D.i)}if(D.r===undefined){D.r=1}if(!D.c){D.c=[]}var B=[];D.c.forEach(function(F){if(F.v){F.v.forEach(function(G){B.push(o(F,G))})}else{B.push(F=="self"?D:F)}});D.c=B;D.c.forEach(function(F){x(F,D)});if(D.starts){x(D.starts,C)}var A=D.c.map(function(F){return F.bK?"\\.?\\b("+F.b+")\\b\\.?":F.b}).concat([D.tE]).concat([D.i]).map(v).filter(Boolean);D.t=A.length?w(A.join("|"),true):{exec:function(F){return null}};D.continuation={}}x(y)}function c(S,L,J,R){function v(U,V){for(var T=0;T<V.c.length;T++){if(i(V.c[T].bR,U)){return V.c[T]}}}function z(U,T){if(i(U.eR,T)){return U}if(U.eW){return z(U.parent,T)}}function A(T,U){return !J&&i(U.iR,T)}function E(V,T){var U=M.cI?T[0].toLowerCase():T[0];return V.k.hasOwnProperty(U)&&V.k[U]}function w(Z,X,W,V){var T=V?"":b.classPrefix,U='<span class="'+T,Y=W?"":"</span>";U+=Z+'">';return U+X+Y}function N(){var U=k(C);if(!I.k){return U}var T="";var X=0;I.lR.lastIndex=0;var V=I.lR.exec(U);while(V){T+=U.substr(X,V.index-X);var W=E(I,V);if(W){H+=W[1];T+=w(W[0],V[0])}else{T+=V[0]}X=I.lR.lastIndex;V=I.lR.exec(U)}return T+U.substr(X)}function F(){if(I.sL&&!f[I.sL]){return k(C)}var T=I.sL?c(I.sL,C,true,I.continuation.top):g(C);if(I.r>0){H+=T.r}if(I.subLanguageMode=="continuous"){I.continuation.top=T.top}return w(T.language,T.value,false,true)}function Q(){return I.sL!==undefined?F():N()}function P(V,U){var T=V.cN?w(V.cN,"",true):"";if(V.rB){D+=T;C=""}else{if(V.eB){D+=k(U)+T;C=""}else{D+=T;C=U}}I=Object.create(V,{parent:{value:I}})}function G(T,X){C+=T;if(X===undefined){D+=Q();return 0}var V=v(X,I);if(V){D+=Q();P(V,X);return V.rB?0:X.length}var W=z(I,X);if(W){var U=I;if(!(U.rE||U.eE)){C+=X}D+=Q();do{if(I.cN){D+="</span>"}H+=I.r;I=I.parent}while(I!=W.parent);if(U.eE){D+=k(X)}C="";if(W.starts){P(W.starts,"")}return U.rE?0:X.length}if(A(X,I)){throw new Error('Illegal lexeme "'+X+'" for mode "'+(I.cN||"<unnamed>")+'"')}C+=X;return X.length||1}var M=j(S);if(!M){throw new Error('Unknown language: "'+S+'"')}m(M);var I=R||M;var D="";for(var K=I;K!=M;K=K.parent){if(K.cN){D=w(K.cN,D,true)}}var C="";var H=0;try{var B,y,x=0;while(true){I.t.lastIndex=x;B=I.t.exec(L);if(!B){break}y=G(L.substr(x,B.index-x),B[0]);x=B.index+y}G(L.substr(x));for(var K=I;K.parent;K=K.parent){if(K.cN){D+="</span>"}}return{r:H,value:D,language:S,top:I}}catch(O){if(O.message.indexOf("Illegal")!=-1){return{r:0,value:k(L)}}else{throw O}}}function g(y,x){x=x||b.languages||Object.keys(f);var v={r:0,value:k(y)};var w=v;x.forEach(function(z){if(!j(z)){return}var A=c(z,y,false);A.language=z;if(A.r>w.r){w=A}if(A.r>v.r){w=v;v=A}});if(w.language){v.second_best=w}return v}function h(v){if(b.tabReplace){v=v.replace(/^((<[^>]+>|\t)+)/gm,function(w,z,y,x){return z.replace(/\t/g,b.tabReplace)})}if(b.useBR){v=v.replace(/\n/g,"<br>")}return v}function p(z){var y=d(z);var A=r(z);if(A=="no-highlight"){return}var v=A?c(A,y,true):g(y);var w=u(z);if(w.length){var x=document.createElementNS("http://www.w3.org/1999/xhtml","pre");x.innerHTML=v.value;v.value=q(w,u(x),y)}v.value=h(v.value);z.innerHTML=v.value;z.className+=" hljs "+(!A&&v.language||"");z.result={language:v.language,re:v.r};if(v.second_best){z.second_best={language:v.second_best.language,re:v.second_best.r}}}var b={classPrefix:"hljs-",tabReplace:null,useBR:false,languages:undefined};function s(v){b=o(b,v)}function l(){if(l.called){return}l.called=true;var v=document.querySelectorAll("pre code");Array.prototype.forEach.call(v,p)}function a(){addEventListener("DOMContentLoaded",l,false);addEventListener("load",l,false)}var f={};var n={};function e(v,x){var w=f[v]=x(this);if(w.aliases){w.aliases.forEach(function(y){n[y]=v})}}function j(v){return f[v]||f[n[v]]}this.highlight=c;this.highlightAuto=g;this.fixMarkup=h;this.highlightBlock=p;this.configure=s;this.initHighlighting=l;this.initHighlightingOnLoad=a;this.registerLanguage=e;this.getLanguage=j;this.inherit=o;this.IR="[a-zA-Z][a-zA-Z0-9_]*";this.UIR="[a-zA-Z_][a-zA-Z0-9_]*";this.NR="\\b\\d+(\\.\\d+)?";this.CNR="(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)";this.BNR="\\b(0b[01]+)";this.RSR="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~";this.BE={b:"\\\\[\\s\\S]",r:0};this.ASM={cN:"string",b:"'",e:"'",i:"\\n",c:[this.BE]};this.QSM={cN:"string",b:'"',e:'"',i:"\\n",c:[this.BE]};this.CLCM={cN:"comment",b:"//",e:"$"};this.CBLCLM={cN:"comment",b:"/\\*",e:"\\*/"};this.HCM={cN:"comment",b:"#",e:"$"};this.NM={cN:"number",b:this.NR,r:0};this.CNM={cN:"number",b:this.CNR,r:0};this.BNM={cN:"number",b:this.BNR,r:0};this.REGEXP_MODE={cN:"regexp",b:/\//,e:/\/[gim]*/,i:/\n/,c:[this.BE,{b:/\[/,e:/\]/,r:0,c:[this.BE]}]};this.TM={cN:"title",b:this.IR,r:0};this.UTM={cN:"title",b:this.UIR,r:0}}();hljs.registerLanguage("bash",function(b){var a={cN:"variable",v:[{b:/\$[\w\d#@][\w\d_]*/},{b:/\$\{(.*?)\}/}]};var d={cN:"string",b:/"/,e:/"/,c:[b.BE,a,{cN:"variable",b:/\$\(/,e:/\)/,c:[b.BE]}]};var c={cN:"string",b:/'/,e:/'/};return{l:/-?[a-z\.]+/,k:{keyword:"if then else elif fi for break continue while in do done exit return set declare case esac export exec",literal:"true false",built_in:"printf echo read cd pwd pushd popd dirs let eval unset typeset readonly getopts source shopt caller type hash bind help sudo",operator:"-ne -eq -lt -gt -f -d -e -s -l -a"},c:[{cN:"shebang",b:/^#![^\n]+sh\s*$/,r:10},{cN:"function",b:/\w[\w\d_]*\s*\(\s*\)\s*\{/,rB:true,c:[b.inherit(b.TM,{b:/\w[\w\d_]*/})],r:0},b.HCM,b.NM,d,c,a]}});hljs.registerLanguage("javascript",function(a){return{aliases:["js"],k:{keyword:"in if for while finally var new function do return void else break catch instanceof with throw case default try this switch continue typeof delete let yield const class",literal:"true false null undefined NaN Infinity",built_in:"eval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Error EvalError InternalError RangeError ReferenceError StopIteration SyntaxError TypeError URIError Number Math Date String RegExp Array Float32Array Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require"},c:[{cN:"pi",b:/^\s*('|")use strict('|")/,r:10},a.ASM,a.QSM,a.CLCM,a.CBLCLM,a.CNM,{b:"("+a.RSR+"|\\b(case|return|throw)\\b)\\s*",k:"return throw case",c:[a.CLCM,a.CBLCLM,a.REGEXP_MODE,{b:/</,e:/>;/,r:0,sL:"xml"}],r:0},{cN:"function",bK:"function",e:/\{/,c:[a.inherit(a.TM,{b:/[A-Za-z$_][0-9A-Za-z$_]*/}),{cN:"params",b:/\(/,e:/\)/,c:[a.CLCM,a.CBLCLM],i:/["'\(]/}],i:/\[|%/},{b:/\$[(.]/},{b:"\\."+a.IR,r:0}]}});hljs.registerLanguage("xml",function(a){var c="[A-Za-z0-9\\._:-]+";var d={b:/<\?(php)?(?!\w)/,e:/\?>/,sL:"php",subLanguageMode:"continuous"};var b={eW:true,i:/</,r:0,c:[d,{cN:"attribute",b:c,r:0},{b:"=",r:0,c:[{cN:"value",v:[{b:/"/,e:/"/},{b:/'/,e:/'/},{b:/[^\s\/>]+/}]}]}]};return{aliases:["html"],cI:true,c:[{cN:"doctype",b:"<!DOCTYPE",e:">",r:10,c:[{b:"\\[",e:"\\]"}]},{cN:"comment",b:"<!--",e:"-->",r:10},{cN:"cdata",b:"<\\!\\[CDATA\\[",e:"\\]\\]>",r:10},{cN:"tag",b:"<style(?=\\s|>|$)",e:">",k:{title:"style"},c:[b],starts:{e:"</style>",rE:true,sL:"css"}},{cN:"tag",b:"<script(?=\\s|>|$)",e:">",k:{title:"script"},c:[b],starts:{e:"<\/script>",rE:true,sL:"javascript"}},{b:"<%",e:"%>",sL:"vbscript"},d,{cN:"pi",b:/<\?\w+/,e:/\?>/,r:10},{cN:"tag",b:"</?",e:"/?>",c:[{cN:"title",b:"[^ /><]+",r:0},b]}]}}); |
| var $ = window.jQuery | ||
| var $window = $(window) | ||
| var sectionTop = $('.top').outerHeight() + 20 | ||
| var $createDestroy = $('#switch-create-destroy') | ||
| function capitalize (string) { | ||
| return string.charAt(0).toUpperCase() + string.slice(1) | ||
| } | ||
| window.hljs.initHighlightingOnLoad() | ||
| $(function () { | ||
| $('a[href*=\'#\']').on('click', function (event) { | ||
| event.preventDefault() | ||
| var $target = $($(this).attr('href').slice('#')) | ||
| if ($target.length) { | ||
| $window.scrollTop($target.offset().top - sectionTop) | ||
| } | ||
| }) | ||
| $('input[type="checkbox"], input[type="radio"]') | ||
| .not('[data-switch-no-init]') | ||
| .bootstrapSwitch() | ||
| $('[data-switch-get]').on('click', function () { | ||
| var type = $(this).data('switch-get') | ||
| window.alert($('#switch-' + type).bootstrapSwitch(type)) | ||
| }) | ||
| $('[data-switch-set]').on('click', function () { | ||
| var type | ||
| type = $(this).data('switch-set') | ||
| $('#switch-' + type).bootstrapSwitch(type, $(this).data('switch-value')) | ||
| }) | ||
| $('[data-switch-toggle]').on('click', function () { | ||
| var type = $(this).data('switch-toggle') | ||
| $('#switch-' + type).bootstrapSwitch('toggle' + capitalize(type)) | ||
| }) | ||
| $('[data-switch-set-value]').on('input', function (event) { | ||
| var type, value | ||
| event.preventDefault() | ||
| type = $(this).data('switch-set-value') | ||
| value = $.trim($(this).val()) | ||
| if ($(this).data('value') === value) { | ||
| return | ||
| } | ||
| $('#switch-' + type).bootstrapSwitch(type, value) | ||
| }) | ||
| $('[data-switch-create-destroy]').on('click', function () { | ||
| var isSwitch | ||
| isSwitch = $createDestroy.data('bootstrap-switch') | ||
| $createDestroy.bootstrapSwitch((isSwitch ? 'destroy' : null)) | ||
| $(this).button((isSwitch ? 'reset' : 'destroy')) | ||
| }) | ||
| $('#confirm').bootstrapSwitch({ | ||
| size: 'large', | ||
| onSwitchChange: function (event, state) { | ||
| event.preventDefault() | ||
| return console.log(state, event.isDefaultPrevented()) | ||
| } | ||
| }) | ||
| }) |
| .bs-docs-header | ||
| .container | ||
| h1 Methods | ||
| .container | ||
| p In #{title}, every option is also a method. | ||
| p If the second parameter is omitted, the method returns the current value. | ||
| p You can invoke methods as follows: | ||
| pre: code $('input[name="my-checkbox"]').bootstrapSwitch('state', true, true); | ||
| h2 Additional Methods | ||
| table.table.table-bordered.table-striped.table-responsive | ||
| thead | ||
| tr | ||
| th Name | ||
| th Description | ||
| tbody | ||
| tr | ||
| td toggleState | ||
| td Toggle the switch state | ||
| tr | ||
| td toggleAnimate | ||
| td Toggle the animate option | ||
| tr | ||
| td toggleDisabled | ||
| td Toggle the disabled state | ||
| tr | ||
| td toggleReadonly | ||
| td Toggle the readonly state | ||
| tr | ||
| td toggleIndeterminate | ||
| td Toggle the indeterminate state | ||
| tr | ||
| td toggleInverse | ||
| td Toggle the inverse option | ||
| tr | ||
| td destroy | ||
| td Destroy the instance of #{title} | ||
| h2 Special Behaviours | ||
| ul | ||
| li The method <code>state</code> can receive an optional third parameter <code>skip</code>. if true, <code>switchChange</code> event is not executed. The default is false. | ||
| li The method <code>toggleState</code> can receive an optional second parameter <code>skip</code>. if true, <code>switchChange</code> event is not executed. The default is false. | ||
| li The method <code>wrapperClass</code> can accept a falsy value as second parameter. If so, it resets the class to its default. |
| .bs-docs-header | ||
| .container | ||
| h1 Options | ||
| .container | ||
| table.table.table-bordered.table-striped.table-responsive | ||
| thead | ||
| tr | ||
| th Name | ||
| th Attribute | ||
| th Type | ||
| th Description | ||
| th Values | ||
| th Default | ||
| tbody | ||
| tr | ||
| td state | ||
| td checked | ||
| td Boolean | ||
| td The checkbox state | ||
| td true, false | ||
| td true | ||
| tr | ||
| td size | ||
| td data-size | ||
| td String | ||
| td The checkbox size | ||
| td null, 'mini', 'small', 'normal', 'large' | ||
| td null | ||
| tr | ||
| td animate | ||
| td data-animate | ||
| td Boolean | ||
| td Animate the switch | ||
| td true, false | ||
| td true | ||
| tr | ||
| td disabled | ||
| td disabled | ||
| td Boolean | ||
| td Disable state | ||
| td true, false | ||
| td false | ||
| tr | ||
| td readonly | ||
| td readonly | ||
| td Boolean | ||
| td Readonly state | ||
| td true, false | ||
| td false | ||
| tr | ||
| td indeterminate | ||
| td data-indeterminate | ||
| td Boolean | ||
| td Indeterminate state | ||
| td true, false | ||
| td false | ||
| tr | ||
| td inverse | ||
| td data-inverse | ||
| td Boolean | ||
| td Inverse switch direction | ||
| td true, false | ||
| td false | ||
| tr | ||
| td radioAllOff | ||
| td data-radio-all-off | ||
| td Boolean | ||
| td Allow this radio button to be unchecked by the user | ||
| td true, false | ||
| td false | ||
| tr | ||
| td onColor | ||
| td data-on-color | ||
| td String | ||
| td Color of the left side of the switch | ||
| td 'primary', 'info', 'success', 'warning', 'danger', 'default' | ||
| td 'primary' | ||
| tr | ||
| td offColor | ||
| td data-off-color | ||
| td String | ||
| td Color of the right side of the switch | ||
| td 'primary', 'info', 'success', 'warning', 'danger', 'default' | ||
| td 'default' | ||
| tr | ||
| td onText | ||
| td data-on-text | ||
| td String | ||
| td Text of the left side of the switch | ||
| td String | ||
| td 'ON' | ||
| tr | ||
| td offText | ||
| td data-off-text | ||
| td String | ||
| td Text of the right side of the switch | ||
| td String | ||
| td 'OFF' | ||
| tr | ||
| td labelText | ||
| td data-label-text | ||
| td String | ||
| td Text of the center handle of the switch | ||
| td String | ||
| td '&nbsp;' | ||
| tr | ||
| td handleWidth | ||
| td data-handle-width | ||
| td String | Number | ||
| td Width of the left and right sides in pixels | ||
| td 'auto' or Number | ||
| td 'auto' | ||
| tr | ||
| td labelWidth | ||
| td data-label-width | ||
| td String | Number | ||
| td Width of the center handle in pixels | ||
| td 'auto' or Number | ||
| td 'auto' | ||
| tr | ||
| td baseClass | ||
| td data-base-class | ||
| td String | ||
| td Global class prefix | ||
| td String | ||
| td 'bootstrap-switch' | ||
| tr | ||
| td wrapperClass | ||
| td data-wrapper-class | ||
| td String | Array | ||
| td Container element class(es) | ||
| td String | Array | ||
| td 'wrapper' | ||
| tr | ||
| td onInit | ||
| td | ||
| td Function | ||
| td Callback function to execute on initialization | ||
| td Function | ||
| td: pre: code.javascript function(event, state) {} | ||
| tr | ||
| td onSwitchChange | ||
| td | ||
| td Function | ||
| td Callback function to execute on switch state change. If false is returned, the status will be reverted, otherwise nothing changes | ||
| td Function | ||
| td: pre: code.javascript function(event, state) {} | ||
| h2 Global Defaults Overriding | ||
| p Follow the jQuery convention to override the default options of the library. For instance: | ||
| pre | ||
| code | ||
| | $.fn.bootstrapSwitch.defaults.size = 'large'; | ||
| | $.fn.bootstrapSwitch.defaults.onColor = 'success'; |
Sorry, the diff of this file is too big to display
+3
-1
| { | ||
| "presets": [ | ||
| ["env", { | ||
| "modules": "umd", | ||
| "targets": { | ||
| "browsers": ["last 2 versions"] | ||
| } | ||
| }] | ||
| }], | ||
| "stage-2", | ||
| ], | ||
@@ -9,0 +11,0 @@ "env": { |
+1
-5
| { | ||
| "name": "bootstrap-switch", | ||
| "description": "Turn checkboxes and radio buttons into toggle switches.", | ||
| "version": "3.3.3", | ||
| "license": "Apache-2.0", | ||
@@ -21,7 +20,4 @@ "main": [ | ||
| "bootstrap": ">=2.3.2", | ||
| "jquery": ">=1.9.0" | ||
| }, | ||
| "devDependencies": { | ||
| "jquery": "~2.1" | ||
| "jquery": "~1.9.0" | ||
| } | ||
| } |
+4
-0
| # Changelog | ||
| ## 3.3.4 | ||
| - Fix Object.assign not working for IE <= 11 [#616](https://github.com/Bttstrp/bootstrap-switch/issues/616) | ||
| ## 3.3.3 | ||
@@ -4,0 +8,0 @@ |
+2
-2
| { | ||
| "name": "components/bootstrap-switch", | ||
| "description": "Turn checkboxes and radio buttons into toggle switches.", | ||
| "version": "3.3.3", | ||
| "version": "3.3.4", | ||
| "type": "component", | ||
@@ -12,3 +12,3 @@ "keywords": [ | ||
| ], | ||
| "homepage": "http://www.bootstrap-switch.org", | ||
| "homepage": "https://bttstrp.github.io/bootstrap-switch", | ||
| "license": "Apache License Version 2.0", | ||
@@ -15,0 +15,0 @@ "authors": [ |
+3
-2
@@ -7,8 +7,9 @@ Prerequisites: | ||
| - Fork the repository and checkout `develop` branch | ||
| - Fork the repository and checkout `master` branch | ||
| - Run `npm install` to get or update the dependencies | ||
| - Run `npm start` to build `dist/` and `docs/` directories | ||
| - Change JavaScript or LESS files in `src/` directories | ||
| - Once finished, submit a [Pull Request](https://github.com/nostalgiaz/bootstrap-switch/compare/develop...develop). Remember to target `develop` as destination branch | ||
| - Do not commit changes to dist/ or docs/. These will only be built on merge. | ||
| - Once finished, submit a [Pull Request](https://github.com/nostalgiaz/bootstrap-switch/compare/master...master). Remember to target `master` as destination branch | ||
| Thank you. |
| /** | ||
| * bootstrap-switch - Turn checkboxes and radio buttons into toggle switches. | ||
| * | ||
| * @version v3.3.3 | ||
| * @homepage http://www.bootstrap-switch.org | ||
| * @version v3.3.4 | ||
| * @homepage https://bttstrp.github.io/bootstrap-switch | ||
| * @author Mattia Larentis <mattia@larentis.eu> (http://larentis.eu) | ||
@@ -81,3 +81,2 @@ * @license Apache-2.0 | ||
| display: inline-block !important; | ||
| height: 100%; | ||
| padding-top: 4px; | ||
@@ -372,2 +371,5 @@ padding-bottom: 4px; | ||
| } | ||
| .bootstrap-switch span::before { | ||
| content: "\200b"; | ||
| } | ||
| .bootstrap-switch .bootstrap-switch-handle-on { | ||
@@ -397,2 +399,3 @@ -webkit-border-top-left-radius: 4px; | ||
| z-index: -1; | ||
| visibility: hidden; | ||
| } | ||
@@ -399,0 +402,0 @@ .bootstrap-switch input[type='radio'].form-control, |
| /** | ||
| * bootstrap-switch - Turn checkboxes and radio buttons into toggle switches. | ||
| * | ||
| * @version v3.3.3 | ||
| * @homepage http://www.bootstrap-switch.org | ||
| * @version v3.3.4 | ||
| * @homepage https://bttstrp.github.io/bootstrap-switch | ||
| * @author Mattia Larentis <mattia@larentis.eu> (http://larentis.eu) | ||
@@ -10,2 +10,2 @@ * @license Apache-2.0 | ||
| .clearfix:after,.clearfix:before{display:table;content:"";line-height:0}.clearfix:after{clear:both}.hide-text{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0}.input-block-level{display:block;width:100%;min-height:30px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.bootstrap-switch{display:inline-block;direction:ltr;cursor:pointer;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px;border:1px solid;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);position:relative;text-align:left;overflow:hidden;line-height:8px;z-index:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none;vertical-align:middle;-webkit-transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s;-moz-transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s;-o-transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s;transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s}.bootstrap-switch .bootstrap-switch-handle-on,.bootstrap-switch.bootstrap-switch-inverse .bootstrap-switch-handle-off{-webkit-border-top-left-radius:4px;-moz-border-radius-topleft:4px;-webkit-border-bottom-left-radius:4px;-moz-border-radius-bottomleft:4px}.bootstrap-switch .bootstrap-switch-container{display:inline-block;top:0;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-webkit-transform:translate3d(0,0,0);-moz-transform:translate3d(0,0,0);-o-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}.bootstrap-switch .bootstrap-switch-handle-off,.bootstrap-switch .bootstrap-switch-handle-on,.bootstrap-switch .bootstrap-switch-label{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;cursor:pointer;display:inline-block!important;height:100%;font-size:14px;line-height:20px;padding:4px 8px}.bootstrap-switch .bootstrap-switch-handle-off,.bootstrap-switch .bootstrap-switch-handle-on{text-align:center;z-index:1}.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-primary,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-primary{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#005fcc;background-image:-moz-linear-gradient(top,#04c,#08c);background-image:-webkit-gradient(linear,0 0,0 100%,from(#04c),to(#08c));background-image:-webkit-linear-gradient(top,#04c,#08c);background-image:-o-linear-gradient(top,#04c,#08c);background-image:linear-gradient(to bottom,#04c,#08c);background-repeat:repeat-x;border-color:#08c #08c #005580;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-primary.active,.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-primary.disabled,.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-primary:active,.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-primary:focus,.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-primary:hover,.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-primary[disabled],.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-primary.active,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-primary.disabled,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-primary:active,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-primary:focus,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-primary:hover,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-primary[disabled]{color:#fff;background-color:#08c}.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-primary.active,.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-primary:active,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-primary.active,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-primary:active{background-color:#069\9}.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-info,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-info{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#41a7c5;background-image:-moz-linear-gradient(top,#2f96b4,#5bc0de);background-image:-webkit-gradient(linear,0 0,0 100%,from(#2f96b4),to(#5bc0de));background-image:-webkit-linear-gradient(top,#2f96b4,#5bc0de);background-image:-o-linear-gradient(top,#2f96b4,#5bc0de);background-image:linear-gradient(to bottom,#2f96b4,#5bc0de);background-repeat:repeat-x;border-color:#5bc0de #5bc0de #28a1c5;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-info.active,.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-info.disabled,.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-info:active,.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-info:focus,.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-info:hover,.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-info[disabled],.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-info.active,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-info.disabled,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-info:active,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-info:focus,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-info:hover,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-info[disabled]{color:#fff;background-color:#5bc0de}.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-info.active,.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-info:active,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-info.active,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-info:active{background-color:#31b0d5\9}.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-success,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-success{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#58b058;background-image:-moz-linear-gradient(top,#51a351,#62c462);background-image:-webkit-gradient(linear,0 0,0 100%,from(#51a351),to(#62c462));background-image:-webkit-linear-gradient(top,#51a351,#62c462);background-image:-o-linear-gradient(top,#51a351,#62c462);background-image:linear-gradient(to bottom,#51a351,#62c462);background-repeat:repeat-x;border-color:#62c462 #62c462 #3b9e3b;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-success.active,.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-success.disabled,.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-success:active,.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-success:focus,.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-success:hover,.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-success[disabled],.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-success.active,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-success.disabled,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-success:active,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-success:focus,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-success:hover,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-success[disabled]{color:#fff;background-color:#62c462}.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-success.active,.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-success:active,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-success.active,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-success:active{background-color:#42b142\9}.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-warning,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-warning{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#f9a123;background-image:-moz-linear-gradient(top,#f89406,#fbb450);background-image:-webkit-gradient(linear,0 0,0 100%,from(#f89406),to(#fbb450));background-image:-webkit-linear-gradient(top,#f89406,#fbb450);background-image:-o-linear-gradient(top,#f89406,#fbb450);background-image:linear-gradient(to bottom,#f89406,#fbb450);background-repeat:repeat-x;border-color:#fbb450 #fbb450 #f89406;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-warning.active,.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-warning.disabled,.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-warning:active,.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-warning:focus,.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-warning:hover,.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-warning[disabled],.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-warning.active,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-warning.disabled,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-warning:active,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-warning:focus,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-warning:hover,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-warning[disabled]{color:#fff;background-color:#fbb450}.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-warning.active,.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-warning:active,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-warning.active,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-warning:active{background-color:#fa9f1e\9}.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-danger,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-danger{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#d14641;background-image:-moz-linear-gradient(top,#bd362f,#ee5f5b);background-image:-webkit-gradient(linear,0 0,0 100%,from(#bd362f),to(#ee5f5b));background-image:-webkit-linear-gradient(top,#bd362f,#ee5f5b);background-image:-o-linear-gradient(top,#bd362f,#ee5f5b);background-image:linear-gradient(to bottom,#bd362f,#ee5f5b);background-repeat:repeat-x;border-color:#ee5f5b #ee5f5b #e51d18;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-danger.active,.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-danger.disabled,.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-danger:active,.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-danger:focus,.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-danger:hover,.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-danger[disabled],.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-danger.active,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-danger.disabled,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-danger:active,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-danger:focus,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-danger:hover,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-danger[disabled]{color:#fff;background-color:#ee5f5b}.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-danger.active,.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-danger:active,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-danger.active,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-danger:active{background-color:#e9322d\9}.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-default,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-default{color:#333;text-shadow:0 1px 1px rgba(255,255,255,.75);background-color:#f0f0f0;background-image:-moz-linear-gradient(top,#e6e6e6,#fff);background-image:-webkit-gradient(linear,0 0,0 100%,from(#e6e6e6),to(#fff));background-image:-webkit-linear-gradient(top,#e6e6e6,#fff);background-image:-o-linear-gradient(top,#e6e6e6,#fff);background-image:linear-gradient(to bottom,#e6e6e6,#fff);background-repeat:repeat-x;border-color:#fff #fff #d9d9d9;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-default.active,.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-default.disabled,.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-default:active,.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-default:focus,.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-default:hover,.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-default[disabled],.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-default.active,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-default.disabled,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-default:active,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-default:focus,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-default:hover,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-default[disabled]{color:#333;background-color:#fff}.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-default.active,.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-default:active,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-default.active,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-default:active{background-color:#e6e6e6\9}.bootstrap-switch .bootstrap-switch-label{text-align:center;margin-top:-1px;margin-bottom:-1px;z-index:100;border-left:1px solid #ccc;border-right:1px solid #ccc;color:#333;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#f5f5f5;background-image:-moz-linear-gradient(top,#fff,#e6e6e6);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fff),to(#e6e6e6));background-image:-webkit-linear-gradient(top,#fff,#e6e6e6);background-image:-o-linear-gradient(top,#fff,#e6e6e6);background-image:linear-gradient(to bottom,#fff,#e6e6e6);background-repeat:repeat-x;border-color:#e6e6e6 #e6e6e6 #bfbfbf;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.bootstrap-switch .bootstrap-switch-label.active,.bootstrap-switch .bootstrap-switch-label.disabled,.bootstrap-switch .bootstrap-switch-label:active,.bootstrap-switch .bootstrap-switch-label:focus,.bootstrap-switch .bootstrap-switch-label:hover,.bootstrap-switch .bootstrap-switch-label[disabled]{color:#333;background-color:#e6e6e6}.bootstrap-switch .bootstrap-switch-label.active,.bootstrap-switch .bootstrap-switch-label:active{background-color:#ccc\9}.bootstrap-switch .bootstrap-switch-handle-on{border-top-left-radius:4px;border-bottom-left-radius:4px}.bootstrap-switch .bootstrap-switch-handle-off{-webkit-border-top-right-radius:4px;-moz-border-radius-topright:4px;border-top-right-radius:4px;-webkit-border-bottom-right-radius:4px;-moz-border-radius-bottomright:4px;border-bottom-right-radius:4px}.bootstrap-switch input[type=radio],.bootstrap-switch input[type=checkbox]{position:absolute!important;top:0;left:0;opacity:0;filter:alpha(opacity=0);z-index:-1}.bootstrap-switch input[type=radio].form-control,.bootstrap-switch input[type=checkbox].form-control{height:auto}.bootstrap-switch.bootstrap-switch-mini{min-width:71px}.bootstrap-switch.bootstrap-switch-mini .bootstrap-switch-handle-off,.bootstrap-switch.bootstrap-switch-mini .bootstrap-switch-handle-on,.bootstrap-switch.bootstrap-switch-mini .bootstrap-switch-label{padding:3px 6px;font-size:10px;line-height:9px}.bootstrap-switch.bootstrap-switch-small{min-width:79px}.bootstrap-switch.bootstrap-switch-small .bootstrap-switch-handle-off,.bootstrap-switch.bootstrap-switch-small .bootstrap-switch-handle-on,.bootstrap-switch.bootstrap-switch-small .bootstrap-switch-label{padding:3px 6px;font-size:12px;line-height:18px}.bootstrap-switch.bootstrap-switch-large{min-width:120px}.bootstrap-switch.bootstrap-switch-large .bootstrap-switch-handle-off,.bootstrap-switch.bootstrap-switch-large .bootstrap-switch-handle-on,.bootstrap-switch.bootstrap-switch-large .bootstrap-switch-label{padding:9px 12px;font-size:16px;line-height:normal}.bootstrap-switch.bootstrap-switch-disabled,.bootstrap-switch.bootstrap-switch-indeterminate,.bootstrap-switch.bootstrap-switch-readonly{cursor:default!important}.bootstrap-switch.bootstrap-switch-disabled .bootstrap-switch-handle-off,.bootstrap-switch.bootstrap-switch-disabled .bootstrap-switch-handle-on,.bootstrap-switch.bootstrap-switch-disabled .bootstrap-switch-label,.bootstrap-switch.bootstrap-switch-indeterminate .bootstrap-switch-handle-off,.bootstrap-switch.bootstrap-switch-indeterminate .bootstrap-switch-handle-on,.bootstrap-switch.bootstrap-switch-indeterminate .bootstrap-switch-label,.bootstrap-switch.bootstrap-switch-readonly .bootstrap-switch-handle-off,.bootstrap-switch.bootstrap-switch-readonly .bootstrap-switch-handle-on,.bootstrap-switch.bootstrap-switch-readonly .bootstrap-switch-label{opacity:.5;filter:alpha(opacity=50);cursor:default!important}.bootstrap-switch.bootstrap-switch-animate .bootstrap-switch-container{-webkit-transition:margin-left .5s;-moz-transition:margin-left .5s;-o-transition:margin-left .5s;transition:margin-left .5s}.bootstrap-switch.bootstrap-switch-inverse .bootstrap-switch-handle-on{-webkit-border-top-left-radius:0;-moz-border-radius-topleft:0;-webkit-border-bottom-left-radius:0;-moz-border-radius-bottomleft:0;-webkit-border-top-right-radius:4px;-moz-border-radius-topright:4px;-webkit-border-bottom-right-radius:4px;-moz-border-radius-bottomright:4px;border-radius:0 4px 4px 0}.bootstrap-switch.bootstrap-switch-inverse .bootstrap-switch-handle-off{-webkit-border-top-right-radius:0;-moz-border-radius-topright:0;-webkit-border-bottom-right-radius:0;-moz-border-radius-bottomright:0;border-radius:4px 0 0 4px}.bootstrap-switch.bootstrap-switch-focused{border-color:rgba(82,168,236,.8);outline:0;outline:dotted thin\9;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(82,168,236,.6);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(82,168,236,.6);box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(82,168,236,.6)}.bootstrap-switch.bootstrap-switch-inverse.bootstrap-switch-off .bootstrap-switch-label,.bootstrap-switch.bootstrap-switch-on .bootstrap-switch-label{-webkit-border-top-right-radius:4px;-moz-border-radius-topright:4px;border-top-right-radius:4px;-webkit-border-bottom-right-radius:4px;-moz-border-radius-bottomright:4px;border-bottom-right-radius:4px}.bootstrap-switch.bootstrap-switch-inverse.bootstrap-switch-on .bootstrap-switch-label,.bootstrap-switch.bootstrap-switch-off .bootstrap-switch-label{-webkit-border-top-left-radius:4px;-moz-border-radius-topleft:4px;border-top-left-radius:4px;-webkit-border-bottom-left-radius:4px;-moz-border-radius-bottomleft:4px;border-bottom-left-radius:4px} | ||
| .clearfix:after,.clearfix:before{display:table;content:"";line-height:0}.clearfix:after{clear:both}.hide-text{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0}.input-block-level{display:block;width:100%;min-height:30px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.bootstrap-switch{display:inline-block;direction:ltr;cursor:pointer;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px;border:1px solid;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);position:relative;text-align:left;overflow:hidden;line-height:8px;z-index:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none;vertical-align:middle;-webkit-transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s;-moz-transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s;-o-transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s;transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s}.bootstrap-switch .bootstrap-switch-handle-on,.bootstrap-switch.bootstrap-switch-inverse .bootstrap-switch-handle-off{-webkit-border-top-left-radius:4px;-moz-border-radius-topleft:4px;-webkit-border-bottom-left-radius:4px;-moz-border-radius-bottomleft:4px}.bootstrap-switch .bootstrap-switch-container{display:inline-block;top:0;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-webkit-transform:translate3d(0,0,0);-moz-transform:translate3d(0,0,0);-o-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}.bootstrap-switch .bootstrap-switch-handle-off,.bootstrap-switch .bootstrap-switch-handle-on,.bootstrap-switch .bootstrap-switch-label{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;cursor:pointer;display:inline-block!important;font-size:14px;line-height:20px;padding:4px 8px}.bootstrap-switch .bootstrap-switch-handle-off,.bootstrap-switch .bootstrap-switch-handle-on{text-align:center;z-index:1}.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-primary,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-primary{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#005fcc;background-image:-moz-linear-gradient(top,#04c,#08c);background-image:-webkit-gradient(linear,0 0,0 100%,from(#04c),to(#08c));background-image:-webkit-linear-gradient(top,#04c,#08c);background-image:-o-linear-gradient(top,#04c,#08c);background-image:linear-gradient(to bottom,#04c,#08c);background-repeat:repeat-x;border-color:#08c #08c #005580;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-primary.active,.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-primary.disabled,.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-primary:active,.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-primary:focus,.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-primary:hover,.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-primary[disabled],.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-primary.active,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-primary.disabled,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-primary:active,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-primary:focus,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-primary:hover,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-primary[disabled]{color:#fff;background-color:#08c}.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-primary.active,.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-primary:active,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-primary.active,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-primary:active{background-color:#069\9}.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-info,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-info{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#41a7c5;background-image:-moz-linear-gradient(top,#2f96b4,#5bc0de);background-image:-webkit-gradient(linear,0 0,0 100%,from(#2f96b4),to(#5bc0de));background-image:-webkit-linear-gradient(top,#2f96b4,#5bc0de);background-image:-o-linear-gradient(top,#2f96b4,#5bc0de);background-image:linear-gradient(to bottom,#2f96b4,#5bc0de);background-repeat:repeat-x;border-color:#5bc0de #5bc0de #28a1c5;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-info.active,.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-info.disabled,.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-info:active,.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-info:focus,.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-info:hover,.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-info[disabled],.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-info.active,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-info.disabled,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-info:active,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-info:focus,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-info:hover,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-info[disabled]{color:#fff;background-color:#5bc0de}.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-info.active,.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-info:active,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-info.active,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-info:active{background-color:#31b0d5\9}.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-success,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-success{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#58b058;background-image:-moz-linear-gradient(top,#51a351,#62c462);background-image:-webkit-gradient(linear,0 0,0 100%,from(#51a351),to(#62c462));background-image:-webkit-linear-gradient(top,#51a351,#62c462);background-image:-o-linear-gradient(top,#51a351,#62c462);background-image:linear-gradient(to bottom,#51a351,#62c462);background-repeat:repeat-x;border-color:#62c462 #62c462 #3b9e3b;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-success.active,.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-success.disabled,.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-success:active,.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-success:focus,.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-success:hover,.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-success[disabled],.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-success.active,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-success.disabled,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-success:active,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-success:focus,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-success:hover,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-success[disabled]{color:#fff;background-color:#62c462}.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-success.active,.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-success:active,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-success.active,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-success:active{background-color:#42b142\9}.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-warning,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-warning{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#f9a123;background-image:-moz-linear-gradient(top,#f89406,#fbb450);background-image:-webkit-gradient(linear,0 0,0 100%,from(#f89406),to(#fbb450));background-image:-webkit-linear-gradient(top,#f89406,#fbb450);background-image:-o-linear-gradient(top,#f89406,#fbb450);background-image:linear-gradient(to bottom,#f89406,#fbb450);background-repeat:repeat-x;border-color:#fbb450 #fbb450 #f89406;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-warning.active,.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-warning.disabled,.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-warning:active,.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-warning:focus,.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-warning:hover,.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-warning[disabled],.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-warning.active,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-warning.disabled,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-warning:active,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-warning:focus,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-warning:hover,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-warning[disabled]{color:#fff;background-color:#fbb450}.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-warning.active,.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-warning:active,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-warning.active,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-warning:active{background-color:#fa9f1e\9}.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-danger,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-danger{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#d14641;background-image:-moz-linear-gradient(top,#bd362f,#ee5f5b);background-image:-webkit-gradient(linear,0 0,0 100%,from(#bd362f),to(#ee5f5b));background-image:-webkit-linear-gradient(top,#bd362f,#ee5f5b);background-image:-o-linear-gradient(top,#bd362f,#ee5f5b);background-image:linear-gradient(to bottom,#bd362f,#ee5f5b);background-repeat:repeat-x;border-color:#ee5f5b #ee5f5b #e51d18;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-danger.active,.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-danger.disabled,.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-danger:active,.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-danger:focus,.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-danger:hover,.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-danger[disabled],.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-danger.active,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-danger.disabled,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-danger:active,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-danger:focus,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-danger:hover,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-danger[disabled]{color:#fff;background-color:#ee5f5b}.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-danger.active,.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-danger:active,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-danger.active,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-danger:active{background-color:#e9322d\9}.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-default,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-default{color:#333;text-shadow:0 1px 1px rgba(255,255,255,.75);background-color:#f0f0f0;background-image:-moz-linear-gradient(top,#e6e6e6,#fff);background-image:-webkit-gradient(linear,0 0,0 100%,from(#e6e6e6),to(#fff));background-image:-webkit-linear-gradient(top,#e6e6e6,#fff);background-image:-o-linear-gradient(top,#e6e6e6,#fff);background-image:linear-gradient(to bottom,#e6e6e6,#fff);background-repeat:repeat-x;border-color:#fff #fff #d9d9d9;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-default.active,.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-default.disabled,.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-default:active,.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-default:focus,.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-default:hover,.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-default[disabled],.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-default.active,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-default.disabled,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-default:active,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-default:focus,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-default:hover,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-default[disabled]{color:#333;background-color:#fff}.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-default.active,.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-default:active,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-default.active,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-default:active{background-color:#e6e6e6\9}.bootstrap-switch .bootstrap-switch-label{text-align:center;margin-top:-1px;margin-bottom:-1px;z-index:100;border-left:1px solid #ccc;border-right:1px solid #ccc;color:#333;text-shadow:0 -1px 0 rgba(0,0,0,.25);background-color:#f5f5f5;background-image:-moz-linear-gradient(top,#fff,#e6e6e6);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fff),to(#e6e6e6));background-image:-webkit-linear-gradient(top,#fff,#e6e6e6);background-image:-o-linear-gradient(top,#fff,#e6e6e6);background-image:linear-gradient(to bottom,#fff,#e6e6e6);background-repeat:repeat-x;border-color:#e6e6e6 #e6e6e6 #bfbfbf;border-color:rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.bootstrap-switch .bootstrap-switch-label.active,.bootstrap-switch .bootstrap-switch-label.disabled,.bootstrap-switch .bootstrap-switch-label:active,.bootstrap-switch .bootstrap-switch-label:focus,.bootstrap-switch .bootstrap-switch-label:hover,.bootstrap-switch .bootstrap-switch-label[disabled]{color:#333;background-color:#e6e6e6}.bootstrap-switch .bootstrap-switch-label.active,.bootstrap-switch .bootstrap-switch-label:active{background-color:#ccc\9}.bootstrap-switch span::before{content:"\200b"}.bootstrap-switch .bootstrap-switch-handle-on{border-top-left-radius:4px;border-bottom-left-radius:4px}.bootstrap-switch .bootstrap-switch-handle-off{-webkit-border-top-right-radius:4px;-moz-border-radius-topright:4px;border-top-right-radius:4px;-webkit-border-bottom-right-radius:4px;-moz-border-radius-bottomright:4px;border-bottom-right-radius:4px}.bootstrap-switch input[type=radio],.bootstrap-switch input[type=checkbox]{position:absolute!important;top:0;left:0;opacity:0;filter:alpha(opacity=0);z-index:-1;visibility:hidden}.bootstrap-switch input[type=radio].form-control,.bootstrap-switch input[type=checkbox].form-control{height:auto}.bootstrap-switch.bootstrap-switch-mini{min-width:71px}.bootstrap-switch.bootstrap-switch-mini .bootstrap-switch-handle-off,.bootstrap-switch.bootstrap-switch-mini .bootstrap-switch-handle-on,.bootstrap-switch.bootstrap-switch-mini .bootstrap-switch-label{padding:3px 6px;font-size:10px;line-height:9px}.bootstrap-switch.bootstrap-switch-small{min-width:79px}.bootstrap-switch.bootstrap-switch-small .bootstrap-switch-handle-off,.bootstrap-switch.bootstrap-switch-small .bootstrap-switch-handle-on,.bootstrap-switch.bootstrap-switch-small .bootstrap-switch-label{padding:3px 6px;font-size:12px;line-height:18px}.bootstrap-switch.bootstrap-switch-large{min-width:120px}.bootstrap-switch.bootstrap-switch-large .bootstrap-switch-handle-off,.bootstrap-switch.bootstrap-switch-large .bootstrap-switch-handle-on,.bootstrap-switch.bootstrap-switch-large .bootstrap-switch-label{padding:9px 12px;font-size:16px;line-height:normal}.bootstrap-switch.bootstrap-switch-disabled,.bootstrap-switch.bootstrap-switch-indeterminate,.bootstrap-switch.bootstrap-switch-readonly{cursor:default!important}.bootstrap-switch.bootstrap-switch-disabled .bootstrap-switch-handle-off,.bootstrap-switch.bootstrap-switch-disabled .bootstrap-switch-handle-on,.bootstrap-switch.bootstrap-switch-disabled .bootstrap-switch-label,.bootstrap-switch.bootstrap-switch-indeterminate .bootstrap-switch-handle-off,.bootstrap-switch.bootstrap-switch-indeterminate .bootstrap-switch-handle-on,.bootstrap-switch.bootstrap-switch-indeterminate .bootstrap-switch-label,.bootstrap-switch.bootstrap-switch-readonly .bootstrap-switch-handle-off,.bootstrap-switch.bootstrap-switch-readonly .bootstrap-switch-handle-on,.bootstrap-switch.bootstrap-switch-readonly .bootstrap-switch-label{opacity:.5;filter:alpha(opacity=50);cursor:default!important}.bootstrap-switch.bootstrap-switch-animate .bootstrap-switch-container{-webkit-transition:margin-left .5s;-moz-transition:margin-left .5s;-o-transition:margin-left .5s;transition:margin-left .5s}.bootstrap-switch.bootstrap-switch-inverse .bootstrap-switch-handle-on{-webkit-border-top-left-radius:0;-moz-border-radius-topleft:0;-webkit-border-bottom-left-radius:0;-moz-border-radius-bottomleft:0;-webkit-border-top-right-radius:4px;-moz-border-radius-topright:4px;-webkit-border-bottom-right-radius:4px;-moz-border-radius-bottomright:4px;border-radius:0 4px 4px 0}.bootstrap-switch.bootstrap-switch-inverse .bootstrap-switch-handle-off{-webkit-border-top-right-radius:0;-moz-border-radius-topright:0;-webkit-border-bottom-right-radius:0;-moz-border-radius-bottomright:0;border-radius:4px 0 0 4px}.bootstrap-switch.bootstrap-switch-focused{border-color:rgba(82,168,236,.8);outline:0;outline:dotted thin\9;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(82,168,236,.6);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(82,168,236,.6);box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(82,168,236,.6)}.bootstrap-switch.bootstrap-switch-inverse.bootstrap-switch-off .bootstrap-switch-label,.bootstrap-switch.bootstrap-switch-on .bootstrap-switch-label{-webkit-border-top-right-radius:4px;-moz-border-radius-topright:4px;border-top-right-radius:4px;-webkit-border-bottom-right-radius:4px;-moz-border-radius-bottomright:4px;border-bottom-right-radius:4px}.bootstrap-switch.bootstrap-switch-inverse.bootstrap-switch-on .bootstrap-switch-label,.bootstrap-switch.bootstrap-switch-off .bootstrap-switch-label{-webkit-border-top-left-radius:4px;-moz-border-radius-topleft:4px;border-top-left-radius:4px;-webkit-border-bottom-left-radius:4px;-moz-border-radius-bottomleft:4px;border-bottom-left-radius:4px} |
| /** | ||
| * bootstrap-switch - Turn checkboxes and radio buttons into toggle switches. | ||
| * | ||
| * @version v3.3.3 | ||
| * @homepage http://www.bootstrap-switch.org | ||
| * @version v3.3.4 | ||
| * @homepage https://bttstrp.github.io/bootstrap-switch | ||
| * @author Mattia Larentis <mattia@larentis.eu> (http://larentis.eu) | ||
@@ -45,4 +45,4 @@ * @license Apache-2.0 | ||
| cursor: pointer; | ||
| display: inline-block !important; | ||
| height: 100%; | ||
| display: table-cell; | ||
| vertical-align: middle; | ||
| padding: 6px 12px; | ||
@@ -95,2 +95,5 @@ font-size: 14px; | ||
| } | ||
| .bootstrap-switch span::before { | ||
| content: "\200b"; | ||
| } | ||
| .bootstrap-switch .bootstrap-switch-handle-on { | ||
@@ -113,2 +116,3 @@ border-bottom-left-radius: 3px; | ||
| filter: alpha(opacity=0); | ||
| visibility: hidden; | ||
| } | ||
@@ -115,0 +119,0 @@ .bootstrap-switch.bootstrap-switch-mini .bootstrap-switch-handle-on, |
| /** | ||
| * bootstrap-switch - Turn checkboxes and radio buttons into toggle switches. | ||
| * | ||
| * @version v3.3.3 | ||
| * @homepage http://www.bootstrap-switch.org | ||
| * @version v3.3.4 | ||
| * @homepage https://bttstrp.github.io/bootstrap-switch | ||
| * @author Mattia Larentis <mattia@larentis.eu> (http://larentis.eu) | ||
@@ -10,2 +10,2 @@ * @license Apache-2.0 | ||
| .bootstrap-switch{display:inline-block;direction:ltr;cursor:pointer;border-radius:4px;border:1px solid #ccc;position:relative;text-align:left;overflow:hidden;line-height:8px;z-index:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;vertical-align:middle;-webkit-transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s;-o-transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s;transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s}.bootstrap-switch .bootstrap-switch-container{display:inline-block;top:0;border-radius:4px;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}.bootstrap-switch .bootstrap-switch-handle-off,.bootstrap-switch .bootstrap-switch-handle-on,.bootstrap-switch .bootstrap-switch-label{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;cursor:pointer;display:inline-block!important;height:100%;padding:6px 12px;font-size:14px;line-height:20px}.bootstrap-switch .bootstrap-switch-handle-off,.bootstrap-switch .bootstrap-switch-handle-on{text-align:center;z-index:1}.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-primary,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-primary{color:#fff;background:#337ab7}.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-info,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-info{color:#fff;background:#5bc0de}.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-success,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-success{color:#fff;background:#5cb85c}.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-warning,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-warning{background:#f0ad4e;color:#fff}.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-danger,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-danger{color:#fff;background:#d9534f}.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-default,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-default{color:#000;background:#eee}.bootstrap-switch .bootstrap-switch-label{text-align:center;margin-top:-1px;margin-bottom:-1px;z-index:100;color:#333;background:#fff}.bootstrap-switch .bootstrap-switch-handle-on{border-bottom-left-radius:3px;border-top-left-radius:3px}.bootstrap-switch .bootstrap-switch-handle-off{border-bottom-right-radius:3px;border-top-right-radius:3px}.bootstrap-switch input[type=radio],.bootstrap-switch input[type=checkbox]{position:absolute!important;top:0;left:0;margin:0;z-index:-1;opacity:0;filter:alpha(opacity=0)}.bootstrap-switch.bootstrap-switch-mini .bootstrap-switch-handle-off,.bootstrap-switch.bootstrap-switch-mini .bootstrap-switch-handle-on,.bootstrap-switch.bootstrap-switch-mini .bootstrap-switch-label{padding:1px 5px;font-size:12px;line-height:1.5}.bootstrap-switch.bootstrap-switch-small .bootstrap-switch-handle-off,.bootstrap-switch.bootstrap-switch-small .bootstrap-switch-handle-on,.bootstrap-switch.bootstrap-switch-small .bootstrap-switch-label{padding:5px 10px;font-size:12px;line-height:1.5}.bootstrap-switch.bootstrap-switch-large .bootstrap-switch-handle-off,.bootstrap-switch.bootstrap-switch-large .bootstrap-switch-handle-on,.bootstrap-switch.bootstrap-switch-large .bootstrap-switch-label{padding:6px 16px;font-size:18px;line-height:1.3333333}.bootstrap-switch.bootstrap-switch-disabled,.bootstrap-switch.bootstrap-switch-indeterminate,.bootstrap-switch.bootstrap-switch-readonly{cursor:default!important}.bootstrap-switch.bootstrap-switch-disabled .bootstrap-switch-handle-off,.bootstrap-switch.bootstrap-switch-disabled .bootstrap-switch-handle-on,.bootstrap-switch.bootstrap-switch-disabled .bootstrap-switch-label,.bootstrap-switch.bootstrap-switch-indeterminate .bootstrap-switch-handle-off,.bootstrap-switch.bootstrap-switch-indeterminate .bootstrap-switch-handle-on,.bootstrap-switch.bootstrap-switch-indeterminate .bootstrap-switch-label,.bootstrap-switch.bootstrap-switch-readonly .bootstrap-switch-handle-off,.bootstrap-switch.bootstrap-switch-readonly .bootstrap-switch-handle-on,.bootstrap-switch.bootstrap-switch-readonly .bootstrap-switch-label{opacity:.5;filter:alpha(opacity=50);cursor:default!important}.bootstrap-switch.bootstrap-switch-animate .bootstrap-switch-container{-webkit-transition:margin-left .5s;-o-transition:margin-left .5s;transition:margin-left .5s}.bootstrap-switch.bootstrap-switch-inverse .bootstrap-switch-handle-on{border-radius:0 3px 3px 0}.bootstrap-switch.bootstrap-switch-inverse .bootstrap-switch-handle-off{border-radius:3px 0 0 3px}.bootstrap-switch.bootstrap-switch-focused{border-color:#66afe9;outline:0;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6);box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6)}.bootstrap-switch.bootstrap-switch-inverse.bootstrap-switch-off .bootstrap-switch-label,.bootstrap-switch.bootstrap-switch-on .bootstrap-switch-label{border-bottom-right-radius:3px;border-top-right-radius:3px}.bootstrap-switch.bootstrap-switch-inverse.bootstrap-switch-on .bootstrap-switch-label,.bootstrap-switch.bootstrap-switch-off .bootstrap-switch-label{border-bottom-left-radius:3px;border-top-left-radius:3px} | ||
| .bootstrap-switch{display:inline-block;direction:ltr;cursor:pointer;border-radius:4px;border:1px solid #ccc;position:relative;text-align:left;overflow:hidden;line-height:8px;z-index:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;vertical-align:middle;-webkit-transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s;-o-transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s;transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s}.bootstrap-switch .bootstrap-switch-container{display:inline-block;top:0;border-radius:4px;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}.bootstrap-switch .bootstrap-switch-handle-off,.bootstrap-switch .bootstrap-switch-handle-on,.bootstrap-switch .bootstrap-switch-label{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;cursor:pointer;display:table-cell;vertical-align:middle;padding:6px 12px;font-size:14px;line-height:20px}.bootstrap-switch .bootstrap-switch-handle-off,.bootstrap-switch .bootstrap-switch-handle-on{text-align:center;z-index:1}.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-primary,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-primary{color:#fff;background:#337ab7}.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-info,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-info{color:#fff;background:#5bc0de}.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-success,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-success{color:#fff;background:#5cb85c}.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-warning,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-warning{background:#f0ad4e;color:#fff}.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-danger,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-danger{color:#fff;background:#d9534f}.bootstrap-switch .bootstrap-switch-handle-off.bootstrap-switch-default,.bootstrap-switch .bootstrap-switch-handle-on.bootstrap-switch-default{color:#000;background:#eee}.bootstrap-switch .bootstrap-switch-label{text-align:center;margin-top:-1px;margin-bottom:-1px;z-index:100;color:#333;background:#fff}.bootstrap-switch span::before{content:"\200b"}.bootstrap-switch .bootstrap-switch-handle-on{border-bottom-left-radius:3px;border-top-left-radius:3px}.bootstrap-switch .bootstrap-switch-handle-off{border-bottom-right-radius:3px;border-top-right-radius:3px}.bootstrap-switch input[type=radio],.bootstrap-switch input[type=checkbox]{position:absolute!important;top:0;left:0;margin:0;z-index:-1;opacity:0;filter:alpha(opacity=0);visibility:hidden}.bootstrap-switch.bootstrap-switch-mini .bootstrap-switch-handle-off,.bootstrap-switch.bootstrap-switch-mini .bootstrap-switch-handle-on,.bootstrap-switch.bootstrap-switch-mini .bootstrap-switch-label{padding:1px 5px;font-size:12px;line-height:1.5}.bootstrap-switch.bootstrap-switch-small .bootstrap-switch-handle-off,.bootstrap-switch.bootstrap-switch-small .bootstrap-switch-handle-on,.bootstrap-switch.bootstrap-switch-small .bootstrap-switch-label{padding:5px 10px;font-size:12px;line-height:1.5}.bootstrap-switch.bootstrap-switch-large .bootstrap-switch-handle-off,.bootstrap-switch.bootstrap-switch-large .bootstrap-switch-handle-on,.bootstrap-switch.bootstrap-switch-large .bootstrap-switch-label{padding:6px 16px;font-size:18px;line-height:1.3333333}.bootstrap-switch.bootstrap-switch-disabled,.bootstrap-switch.bootstrap-switch-indeterminate,.bootstrap-switch.bootstrap-switch-readonly{cursor:default!important}.bootstrap-switch.bootstrap-switch-disabled .bootstrap-switch-handle-off,.bootstrap-switch.bootstrap-switch-disabled .bootstrap-switch-handle-on,.bootstrap-switch.bootstrap-switch-disabled .bootstrap-switch-label,.bootstrap-switch.bootstrap-switch-indeterminate .bootstrap-switch-handle-off,.bootstrap-switch.bootstrap-switch-indeterminate .bootstrap-switch-handle-on,.bootstrap-switch.bootstrap-switch-indeterminate .bootstrap-switch-label,.bootstrap-switch.bootstrap-switch-readonly .bootstrap-switch-handle-off,.bootstrap-switch.bootstrap-switch-readonly .bootstrap-switch-handle-on,.bootstrap-switch.bootstrap-switch-readonly .bootstrap-switch-label{opacity:.5;filter:alpha(opacity=50);cursor:default!important}.bootstrap-switch.bootstrap-switch-animate .bootstrap-switch-container{-webkit-transition:margin-left .5s;-o-transition:margin-left .5s;transition:margin-left .5s}.bootstrap-switch.bootstrap-switch-inverse .bootstrap-switch-handle-on{border-radius:0 3px 3px 0}.bootstrap-switch.bootstrap-switch-inverse .bootstrap-switch-handle-off{border-radius:3px 0 0 3px}.bootstrap-switch.bootstrap-switch-focused{border-color:#66afe9;outline:0;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6);box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6)}.bootstrap-switch.bootstrap-switch-inverse.bootstrap-switch-off .bootstrap-switch-label,.bootstrap-switch.bootstrap-switch-on .bootstrap-switch-label{border-bottom-right-radius:3px;border-top-right-radius:3px}.bootstrap-switch.bootstrap-switch-inverse.bootstrap-switch-on .bootstrap-switch-label,.bootstrap-switch.bootstrap-switch-off .bootstrap-switch-label{border-bottom-left-radius:3px;border-top-left-radius:3px} |
| /** | ||
| * bootstrap-switch - Turn checkboxes and radio buttons into toggle switches. | ||
| * | ||
| * @version v3.3.3 | ||
| * @homepage http://www.bootstrap-switch.org | ||
| * @version v3.3.4 | ||
| * @homepage https://bttstrp.github.io/bootstrap-switch | ||
| * @author Mattia Larentis <mattia@larentis.eu> (http://larentis.eu) | ||
@@ -10,9 +10,65 @@ * @license Apache-2.0 | ||
| 'use strict'; | ||
| (function (global, factory) { | ||
| if (typeof define === "function" && define.amd) { | ||
| define(['jquery'], factory); | ||
| } else if (typeof exports !== "undefined") { | ||
| factory(require('jquery')); | ||
| } else { | ||
| var mod = { | ||
| exports: {} | ||
| }; | ||
| factory(global.jquery); | ||
| global.bootstrapSwitch = mod.exports; | ||
| } | ||
| })(this, function (_jquery) { | ||
| 'use strict'; | ||
| var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
| var _jquery2 = _interopRequireDefault(_jquery); | ||
| function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
| function _interopRequireDefault(obj) { | ||
| return obj && obj.__esModule ? obj : { | ||
| default: obj | ||
| }; | ||
| } | ||
| (function ($, window) { | ||
| var _extends = Object.assign || function (target) { | ||
| for (var i = 1; i < arguments.length; i++) { | ||
| var source = arguments[i]; | ||
| for (var key in source) { | ||
| if (Object.prototype.hasOwnProperty.call(source, key)) { | ||
| target[key] = source[key]; | ||
| } | ||
| } | ||
| } | ||
| return target; | ||
| }; | ||
| function _classCallCheck(instance, Constructor) { | ||
| if (!(instance instanceof Constructor)) { | ||
| throw new TypeError("Cannot call a class as a function"); | ||
| } | ||
| } | ||
| var _createClass = function () { | ||
| function defineProperties(target, props) { | ||
| for (var i = 0; i < props.length; i++) { | ||
| var descriptor = props[i]; | ||
| descriptor.enumerable = descriptor.enumerable || false; | ||
| descriptor.configurable = true; | ||
| if ("value" in descriptor) descriptor.writable = true; | ||
| Object.defineProperty(target, descriptor.key, descriptor); | ||
| } | ||
| } | ||
| return function (Constructor, protoProps, staticProps) { | ||
| if (protoProps) defineProperties(Constructor.prototype, protoProps); | ||
| if (staticProps) defineProperties(Constructor, staticProps); | ||
| return Constructor; | ||
| }; | ||
| }(); | ||
| var $ = _jquery2.default || window.jQuery || window.$; | ||
| var BootstrapSwitch = function () { | ||
@@ -103,3 +159,3 @@ function BootstrapSwitch(element) { | ||
| value: function setPrevOptions() { | ||
| this.prevOptions = Object.assign({}, this.options); | ||
| this.prevOptions = _extends({}, this.options); | ||
| } | ||
@@ -435,8 +491,3 @@ }, { | ||
| var $handles = this.$on.add(this.$off).add(this.$label).css('width', ''); | ||
| var handleWidth = void 0; | ||
| if (this.options.handleWidth === 'auto') { | ||
| handleWidth = Math.round(Math.max(this.$on.width(), this.$off.width())); | ||
| } else { | ||
| handleWidth = this.options.handleWidth; | ||
| } | ||
| var handleWidth = this.options.handleWidth === 'auto' ? Math.round(Math.max(this.$on.width(), this.$off.width())) : this.options.handleWidth; | ||
| $handles.width(handleWidth); | ||
@@ -700,15 +751,15 @@ this.$label.width(function (index, width) { | ||
| var ret = this; | ||
| this.each(function () { | ||
| var $this = $(this); | ||
| var data = $this.data('bootstrap-switch'); | ||
| if (!data) { | ||
| data = new BootstrapSwitch(this, option); | ||
| function reducer(ret, next) { | ||
| var $this = $(next); | ||
| var existingData = $this.data('bootstrap-switch'); | ||
| var data = existingData || new BootstrapSwitch(next, option); | ||
| if (!existingData) { | ||
| $this.data('bootstrap-switch', data); | ||
| } | ||
| if (typeof option === 'string') { | ||
| ret = data[option].apply(data, args); | ||
| return data[option].apply(data, args); | ||
| } | ||
| }); | ||
| return ret; | ||
| return ret; | ||
| } | ||
| return Array.prototype.reduce.call(this, reducer, this); | ||
| }; | ||
@@ -737,2 +788,2 @@ $.fn.bootstrapSwitch.Constructor = BootstrapSwitch; | ||
| }; | ||
| })(window.jQuery, window); | ||
| }); |
| /** | ||
| * bootstrap-switch - Turn checkboxes and radio buttons into toggle switches. | ||
| * | ||
| * @version v3.3.3 | ||
| * @homepage http://www.bootstrap-switch.org | ||
| * @version v3.3.4 | ||
| * @homepage https://bttstrp.github.io/bootstrap-switch | ||
| * @author Mattia Larentis <mattia@larentis.eu> (http://larentis.eu) | ||
@@ -10,2 +10,2 @@ * @license Apache-2.0 | ||
| 'use strict';var _createClass=function(){function a(b,c){for(var e,d=0;d<c.length;d++)e=c[d],e.enumerable=e.enumerable||!1,e.configurable=!0,'value'in e&&(e.writable=!0),Object.defineProperty(b,e.key,e)}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}();function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError('Cannot call a class as a function')}(function(a,b){var c=function(){function d(e){var g=this,f=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};_classCallCheck(this,d),this.$element=a(e),this.options=a.extend({},a.fn.bootstrapSwitch.defaults,this._getElementOptions(),f),this.prevOptions={},this.$wrapper=a('<div>',{class:function _class(){var h=[];return h.push(g.options.state?'on':'off'),g.options.size&&h.push(g.options.size),g.options.disabled&&h.push('disabled'),g.options.readonly&&h.push('readonly'),g.options.indeterminate&&h.push('indeterminate'),g.options.inverse&&h.push('inverse'),g.$element.attr('id')&&h.push('id-'+g.$element.attr('id')),h.map(g._getClass.bind(g)).concat([g.options.baseClass],g._getClasses(g.options.wrapperClass)).join(' ')}}),this.$container=a('<div>',{class:this._getClass('container')}),this.$on=a('<span>',{html:this.options.onText,class:this._getClass('handle-on')+' '+this._getClass(this.options.onColor)}),this.$off=a('<span>',{html:this.options.offText,class:this._getClass('handle-off')+' '+this._getClass(this.options.offColor)}),this.$label=a('<span>',{html:this.options.labelText,class:this._getClass('label')}),this.$element.on('init.bootstrapSwitch',this.options.onInit.bind(this,e)),this.$element.on('switchChange.bootstrapSwitch',function(){for(var j=arguments.length,h=Array(j),k=0;k<j;k++)h[k]=arguments[k];!1===g.options.onSwitchChange.apply(e,h)&&(g.$element.is(':radio')?a('[name="'+g.$element.attr('name')+'"]').trigger('previousState.bootstrapSwitch',!0):g.$element.trigger('previousState.bootstrapSwitch',!0))}),this.$container=this.$element.wrap(this.$container).parent(),this.$wrapper=this.$container.wrap(this.$wrapper).parent(),this.$element.before(this.options.inverse?this.$off:this.$on).before(this.$label).before(this.options.inverse?this.$on:this.$off),this.options.indeterminate&&this.$element.prop('indeterminate',!0),this._init(),this._elementHandlers(),this._handleHandlers(),this._labelHandlers(),this._formHandler(),this._externalLabelHandler(),this.$element.trigger('init.bootstrapSwitch',this.options.state)}return _createClass(d,[{key:'setPrevOptions',value:function setPrevOptions(){this.prevOptions=Object.assign({},this.options)}},{key:'state',value:function state(e,f){return'undefined'==typeof e?this.options.state:this.options.disabled||this.options.readonly||this.options.state&&!this.options.radioAllOff&&this.$element.is(':radio')?this.$element:(this.$element.is(':radio')?a('[name="'+this.$element.attr('name')+'"]').trigger('setPreviousOptions.bootstrapSwitch'):this.$element.trigger('setPreviousOptions.bootstrapSwitch'),this.options.indeterminate&&this.indeterminate(!1),this.$element.prop('checked',!!e).trigger('change.bootstrapSwitch',f),this.$element)}},{key:'toggleState',value:function toggleState(e){return this.options.disabled||this.options.readonly?this.$element:this.options.indeterminate?(this.indeterminate(!1),this.state(!0)):this.$element.prop('checked',!this.options.state).trigger('change.bootstrapSwitch',e)}},{key:'size',value:function size(e){return'undefined'==typeof e?this.options.size:(null!=this.options.size&&this.$wrapper.removeClass(this._getClass(this.options.size)),e&&this.$wrapper.addClass(this._getClass(e)),this._width(),this._containerPosition(),this.options.size=e,this.$element)}},{key:'animate',value:function animate(e){return'undefined'==typeof e?this.options.animate:this.options.animate===!!e?this.$element:this.toggleAnimate()}},{key:'toggleAnimate',value:function toggleAnimate(){return this.options.animate=!this.options.animate,this.$wrapper.toggleClass(this._getClass('animate')),this.$element}},{key:'disabled',value:function disabled(e){return'undefined'==typeof e?this.options.disabled:this.options.disabled===!!e?this.$element:this.toggleDisabled()}},{key:'toggleDisabled',value:function toggleDisabled(){return this.options.disabled=!this.options.disabled,this.$element.prop('disabled',this.options.disabled),this.$wrapper.toggleClass(this._getClass('disabled')),this.$element}},{key:'readonly',value:function readonly(e){return'undefined'==typeof e?this.options.readonly:this.options.readonly===!!e?this.$element:this.toggleReadonly()}},{key:'toggleReadonly',value:function toggleReadonly(){return this.options.readonly=!this.options.readonly,this.$element.prop('readonly',this.options.readonly),this.$wrapper.toggleClass(this._getClass('readonly')),this.$element}},{key:'indeterminate',value:function indeterminate(e){return'undefined'==typeof e?this.options.indeterminate:this.options.indeterminate===!!e?this.$element:this.toggleIndeterminate()}},{key:'toggleIndeterminate',value:function toggleIndeterminate(){return this.options.indeterminate=!this.options.indeterminate,this.$element.prop('indeterminate',this.options.indeterminate),this.$wrapper.toggleClass(this._getClass('indeterminate')),this._containerPosition(),this.$element}},{key:'inverse',value:function inverse(e){return'undefined'==typeof e?this.options.inverse:this.options.inverse===!!e?this.$element:this.toggleInverse()}},{key:'toggleInverse',value:function toggleInverse(){this.$wrapper.toggleClass(this._getClass('inverse'));var e=this.$on.clone(!0),f=this.$off.clone(!0);return this.$on.replaceWith(f),this.$off.replaceWith(e),this.$on=f,this.$off=e,this.options.inverse=!this.options.inverse,this.$element}},{key:'onColor',value:function onColor(e){return'undefined'==typeof e?this.options.onColor:(this.options.onColor&&this.$on.removeClass(this._getClass(this.options.onColor)),this.$on.addClass(this._getClass(e)),this.options.onColor=e,this.$element)}},{key:'offColor',value:function offColor(e){return'undefined'==typeof e?this.options.offColor:(this.options.offColor&&this.$off.removeClass(this._getClass(this.options.offColor)),this.$off.addClass(this._getClass(e)),this.options.offColor=e,this.$element)}},{key:'onText',value:function onText(e){return'undefined'==typeof e?this.options.onText:(this.$on.html(e),this._width(),this._containerPosition(),this.options.onText=e,this.$element)}},{key:'offText',value:function offText(e){return'undefined'==typeof e?this.options.offText:(this.$off.html(e),this._width(),this._containerPosition(),this.options.offText=e,this.$element)}},{key:'labelText',value:function labelText(e){return'undefined'==typeof e?this.options.labelText:(this.$label.html(e),this._width(),this.options.labelText=e,this.$element)}},{key:'handleWidth',value:function handleWidth(e){return'undefined'==typeof e?this.options.handleWidth:(this.options.handleWidth=e,this._width(),this._containerPosition(),this.$element)}},{key:'labelWidth',value:function labelWidth(e){return'undefined'==typeof e?this.options.labelWidth:(this.options.labelWidth=e,this._width(),this._containerPosition(),this.$element)}},{key:'baseClass',value:function baseClass(){return this.options.baseClass}},{key:'wrapperClass',value:function wrapperClass(e){return'undefined'==typeof e?this.options.wrapperClass:(e||(e=a.fn.bootstrapSwitch.defaults.wrapperClass),this.$wrapper.removeClass(this._getClasses(this.options.wrapperClass).join(' ')),this.$wrapper.addClass(this._getClasses(e).join(' ')),this.options.wrapperClass=e,this.$element)}},{key:'radioAllOff',value:function radioAllOff(e){if('undefined'==typeof e)return this.options.radioAllOff;var f=!!e;return this.options.radioAllOff===f?this.$element:(this.options.radioAllOff=f,this.$element)}},{key:'onInit',value:function onInit(e){return'undefined'==typeof e?this.options.onInit:(e||(e=a.fn.bootstrapSwitch.defaults.onInit),this.options.onInit=e,this.$element)}},{key:'onSwitchChange',value:function onSwitchChange(e){return'undefined'==typeof e?this.options.onSwitchChange:(e||(e=a.fn.bootstrapSwitch.defaults.onSwitchChange),this.options.onSwitchChange=e,this.$element)}},{key:'destroy',value:function destroy(){var e=this.$element.closest('form');return e.length&&e.off('reset.bootstrapSwitch').removeData('bootstrap-switch'),this.$container.children().not(this.$element).remove(),this.$element.unwrap().unwrap().off('.bootstrapSwitch').removeData('bootstrap-switch'),this.$element}},{key:'_getElementOptions',value:function _getElementOptions(){return{state:this.$element.is(':checked'),size:this.$element.data('size'),animate:this.$element.data('animate'),disabled:this.$element.is(':disabled'),readonly:this.$element.is('[readonly]'),indeterminate:this.$element.data('indeterminate'),inverse:this.$element.data('inverse'),radioAllOff:this.$element.data('radio-all-off'),onColor:this.$element.data('on-color'),offColor:this.$element.data('off-color'),onText:this.$element.data('on-text'),offText:this.$element.data('off-text'),labelText:this.$element.data('label-text'),handleWidth:this.$element.data('handle-width'),labelWidth:this.$element.data('label-width'),baseClass:this.$element.data('base-class'),wrapperClass:this.$element.data('wrapper-class')}}},{key:'_width',value:function _width(){var g=this,e=this.$on.add(this.$off).add(this.$label).css('width',''),f=void 0;return f='auto'===this.options.handleWidth?Math.round(Math.max(this.$on.width(),this.$off.width())):this.options.handleWidth,e.width(f),this.$label.width(function(h,j){return'auto'===g.options.labelWidth?j<f?f:j:g.options.labelWidth}),this._handleWidth=this.$on.outerWidth(),this._labelWidth=this.$label.outerWidth(),this.$container.width(2*this._handleWidth+this._labelWidth),this.$wrapper.width(this._handleWidth+this._labelWidth)}},{key:'_containerPosition',value:function _containerPosition(){var g=this,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this.options.state,f=arguments[1];this.$container.css('margin-left',function(){var h=[0,'-'+g._handleWidth+'px'];return g.options.indeterminate?'-'+g._handleWidth/2+'px':e?g.options.inverse?h[1]:h[0]:g.options.inverse?h[0]:h[1]})}},{key:'_init',value:function _init(){var f=this,e=function(){f.setPrevOptions(),f._width(),f._containerPosition(),setTimeout(function(){if(f.options.animate)return f.$wrapper.addClass(f._getClass('animate'))},50)};if(this.$wrapper.is(':visible'))return void e();var g=b.setInterval(function(){if(f.$wrapper.is(':visible'))return e(),b.clearInterval(g)},50)}},{key:'_elementHandlers',value:function _elementHandlers(){var e=this;return this.$element.on({'setPreviousOptions.bootstrapSwitch':this.setPrevOptions.bind(this),'previousState.bootstrapSwitch':function previousStateBootstrapSwitch(){e.options=e.prevOptions,e.options.indeterminate&&e.$wrapper.addClass(e._getClass('indeterminate')),e.$element.prop('checked',e.options.state).trigger('change.bootstrapSwitch',!0)},'change.bootstrapSwitch':function changeBootstrapSwitch(f,g){f.preventDefault(),f.stopImmediatePropagation();var h=e.$element.is(':checked');e._containerPosition(h),h===e.options.state||(e.options.state=h,e.$wrapper.toggleClass(e._getClass('off')).toggleClass(e._getClass('on')),!g&&(e.$element.is(':radio')&&a('[name="'+e.$element.attr('name')+'"]').not(e.$element).prop('checked',!1).trigger('change.bootstrapSwitch',!0),e.$element.trigger('switchChange.bootstrapSwitch',[h])))},'focus.bootstrapSwitch':function focusBootstrapSwitch(f){f.preventDefault(),e.$wrapper.addClass(e._getClass('focused'))},'blur.bootstrapSwitch':function blurBootstrapSwitch(f){f.preventDefault(),e.$wrapper.removeClass(e._getClass('focused'))},'keydown.bootstrapSwitch':function keydownBootstrapSwitch(f){!f.which||e.options.disabled||e.options.readonly||(37===f.which||39===f.which)&&(f.preventDefault(),f.stopImmediatePropagation(),e.state(39===f.which))}})}},{key:'_handleHandlers',value:function _handleHandlers(){var e=this;return this.$on.on('click.bootstrapSwitch',function(f){return f.preventDefault(),f.stopPropagation(),e.state(!1),e.$element.trigger('focus.bootstrapSwitch')}),this.$off.on('click.bootstrapSwitch',function(f){return f.preventDefault(),f.stopPropagation(),e.state(!0),e.$element.trigger('focus.bootstrapSwitch')})}},{key:'_labelHandlers',value:function _labelHandlers(){var f=this;this.$label.on({click:function click(g){g.stopPropagation()},'mousedown.bootstrapSwitch touchstart.bootstrapSwitch':function mousedownBootstrapSwitchTouchstartBootstrapSwitch(g){f._dragStart||f.options.disabled||f.options.readonly||(g.preventDefault(),g.stopPropagation(),f._dragStart=(g.pageX||g.originalEvent.touches[0].pageX)-parseInt(f.$container.css('margin-left'),10),f.options.animate&&f.$wrapper.removeClass(f._getClass('animate')),f.$element.trigger('focus.bootstrapSwitch'))},'mousemove.bootstrapSwitch touchmove.bootstrapSwitch':function mousemoveBootstrapSwitchTouchmoveBootstrapSwitch(g){if(null!=f._dragStart){var h=(g.pageX||g.originalEvent.touches[0].pageX)-f._dragStart;g.preventDefault(),h<-f._handleWidth||0<h||(f._dragEnd=h,f.$container.css('margin-left',f._dragEnd+'px'))}},'mouseup.bootstrapSwitch touchend.bootstrapSwitch':function mouseupBootstrapSwitchTouchendBootstrapSwitch(g){if(f._dragStart){if(g.preventDefault(),f.options.animate&&f.$wrapper.addClass(f._getClass('animate')),f._dragEnd){var h=f._dragEnd>-(f._handleWidth/2);f._dragEnd=!1,f.state(f.options.inverse?!h:h)}else f.state(!f.options.state);f._dragStart=!1}},'mouseleave.bootstrapSwitch':function mouseleaveBootstrapSwitch(){f.$label.trigger('mouseup.bootstrapSwitch')}})}},{key:'_externalLabelHandler',value:function _externalLabelHandler(){var f=this,e=this.$element.closest('label');e.on('click',function(g){g.preventDefault(),g.stopImmediatePropagation(),g.target===e[0]&&f.toggleState()})}},{key:'_formHandler',value:function _formHandler(){var e=this.$element.closest('form');e.data('bootstrap-switch')||e.on('reset.bootstrapSwitch',function(){b.setTimeout(function(){e.find('input').filter(function(){return a(this).data('bootstrap-switch')}).each(function(){return a(this).bootstrapSwitch('state',this.checked)})},1)}).data('bootstrap-switch',!0)}},{key:'_getClass',value:function _getClass(e){return this.options.baseClass+'-'+e}},{key:'_getClasses',value:function _getClasses(e){return a.isArray(e)?e.map(this._getClass.bind(this)):[this._getClass(e)]}}]),d}();a.fn.bootstrapSwitch=function(d){for(var f=arguments.length,e=Array(1<f?f-1:0),g=1;g<f;g++)e[g-1]=arguments[g];var h=this;return this.each(function(){var j=a(this),k=j.data('bootstrap-switch');k||(k=new c(this,d),j.data('bootstrap-switch',k)),'string'==typeof d&&(h=k[d].apply(k,e))}),h},a.fn.bootstrapSwitch.Constructor=c,a.fn.bootstrapSwitch.defaults={state:!0,size:null,animate:!0,disabled:!1,readonly:!1,indeterminate:!1,inverse:!1,radioAllOff:!1,onColor:'primary',offColor:'default',onText:'ON',offText:'OFF',labelText:' ',handleWidth:'auto',labelWidth:'auto',baseClass:'bootstrap-switch',wrapperClass:'wrapper',onInit:function onInit(){},onSwitchChange:function onSwitchChange(){}}})(window.jQuery,window); | ||
| (function(a,b){if('function'==typeof define&&define.amd)define(['jquery'],b);else if('undefined'!=typeof exports)b(require('jquery'));else{b(a.jquery),a.bootstrapSwitch={exports:{}}.exports}})(this,function(a){'use strict';function c(j,k){if(!(j instanceof k))throw new TypeError('Cannot call a class as a function')}var d=function(j){return j&&j.__esModule?j:{default:j}}(a),e=Object.assign||function(j){for(var l,k=1;k<arguments.length;k++)for(var m in l=arguments[k],l)Object.prototype.hasOwnProperty.call(l,m)&&(j[m]=l[m]);return j},f=function(){function j(k,l){for(var n,m=0;m<l.length;m++)n=l[m],n.enumerable=n.enumerable||!1,n.configurable=!0,'value'in n&&(n.writable=!0),Object.defineProperty(k,n.key,n)}return function(k,l,m){return l&&j(k.prototype,l),m&&j(k,m),k}}(),g=d.default||window.jQuery||window.$,h=function(){function j(k){var l=this,m=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};c(this,j),this.$element=g(k),this.options=g.extend({},g.fn.bootstrapSwitch.defaults,this._getElementOptions(),m),this.prevOptions={},this.$wrapper=g('<div>',{class:function(){var o=[];return o.push(l.options.state?'on':'off'),l.options.size&&o.push(l.options.size),l.options.disabled&&o.push('disabled'),l.options.readonly&&o.push('readonly'),l.options.indeterminate&&o.push('indeterminate'),l.options.inverse&&o.push('inverse'),l.$element.attr('id')&&o.push('id-'+l.$element.attr('id')),o.map(l._getClass.bind(l)).concat([l.options.baseClass],l._getClasses(l.options.wrapperClass)).join(' ')}}),this.$container=g('<div>',{class:this._getClass('container')}),this.$on=g('<span>',{html:this.options.onText,class:this._getClass('handle-on')+' '+this._getClass(this.options.onColor)}),this.$off=g('<span>',{html:this.options.offText,class:this._getClass('handle-off')+' '+this._getClass(this.options.offColor)}),this.$label=g('<span>',{html:this.options.labelText,class:this._getClass('label')}),this.$element.on('init.bootstrapSwitch',this.options.onInit.bind(this,k)),this.$element.on('switchChange.bootstrapSwitch',function(){for(var n=arguments.length,o=Array(n),p=0;p<n;p++)o[p]=arguments[p];!1===l.options.onSwitchChange.apply(k,o)&&(l.$element.is(':radio')?g('[name="'+l.$element.attr('name')+'"]').trigger('previousState.bootstrapSwitch',!0):l.$element.trigger('previousState.bootstrapSwitch',!0))}),this.$container=this.$element.wrap(this.$container).parent(),this.$wrapper=this.$container.wrap(this.$wrapper).parent(),this.$element.before(this.options.inverse?this.$off:this.$on).before(this.$label).before(this.options.inverse?this.$on:this.$off),this.options.indeterminate&&this.$element.prop('indeterminate',!0),this._init(),this._elementHandlers(),this._handleHandlers(),this._labelHandlers(),this._formHandler(),this._externalLabelHandler(),this.$element.trigger('init.bootstrapSwitch',this.options.state)}return f(j,[{key:'setPrevOptions',value:function(){this.prevOptions=e({},this.options)}},{key:'state',value:function(l,m){return'undefined'==typeof l?this.options.state:this.options.disabled||this.options.readonly||this.options.state&&!this.options.radioAllOff&&this.$element.is(':radio')?this.$element:(this.$element.is(':radio')?g('[name="'+this.$element.attr('name')+'"]').trigger('setPreviousOptions.bootstrapSwitch'):this.$element.trigger('setPreviousOptions.bootstrapSwitch'),this.options.indeterminate&&this.indeterminate(!1),this.$element.prop('checked',!!l).trigger('change.bootstrapSwitch',m),this.$element)}},{key:'toggleState',value:function(l){return this.options.disabled||this.options.readonly?this.$element:this.options.indeterminate?(this.indeterminate(!1),this.state(!0)):this.$element.prop('checked',!this.options.state).trigger('change.bootstrapSwitch',l)}},{key:'size',value:function(l){return'undefined'==typeof l?this.options.size:(null!=this.options.size&&this.$wrapper.removeClass(this._getClass(this.options.size)),l&&this.$wrapper.addClass(this._getClass(l)),this._width(),this._containerPosition(),this.options.size=l,this.$element)}},{key:'animate',value:function(l){return'undefined'==typeof l?this.options.animate:this.options.animate===!!l?this.$element:this.toggleAnimate()}},{key:'toggleAnimate',value:function(){return this.options.animate=!this.options.animate,this.$wrapper.toggleClass(this._getClass('animate')),this.$element}},{key:'disabled',value:function(l){return'undefined'==typeof l?this.options.disabled:this.options.disabled===!!l?this.$element:this.toggleDisabled()}},{key:'toggleDisabled',value:function(){return this.options.disabled=!this.options.disabled,this.$element.prop('disabled',this.options.disabled),this.$wrapper.toggleClass(this._getClass('disabled')),this.$element}},{key:'readonly',value:function(l){return'undefined'==typeof l?this.options.readonly:this.options.readonly===!!l?this.$element:this.toggleReadonly()}},{key:'toggleReadonly',value:function(){return this.options.readonly=!this.options.readonly,this.$element.prop('readonly',this.options.readonly),this.$wrapper.toggleClass(this._getClass('readonly')),this.$element}},{key:'indeterminate',value:function(l){return'undefined'==typeof l?this.options.indeterminate:this.options.indeterminate===!!l?this.$element:this.toggleIndeterminate()}},{key:'toggleIndeterminate',value:function(){return this.options.indeterminate=!this.options.indeterminate,this.$element.prop('indeterminate',this.options.indeterminate),this.$wrapper.toggleClass(this._getClass('indeterminate')),this._containerPosition(),this.$element}},{key:'inverse',value:function(l){return'undefined'==typeof l?this.options.inverse:this.options.inverse===!!l?this.$element:this.toggleInverse()}},{key:'toggleInverse',value:function(){this.$wrapper.toggleClass(this._getClass('inverse'));var l=this.$on.clone(!0),m=this.$off.clone(!0);return this.$on.replaceWith(m),this.$off.replaceWith(l),this.$on=m,this.$off=l,this.options.inverse=!this.options.inverse,this.$element}},{key:'onColor',value:function(l){return'undefined'==typeof l?this.options.onColor:(this.options.onColor&&this.$on.removeClass(this._getClass(this.options.onColor)),this.$on.addClass(this._getClass(l)),this.options.onColor=l,this.$element)}},{key:'offColor',value:function(l){return'undefined'==typeof l?this.options.offColor:(this.options.offColor&&this.$off.removeClass(this._getClass(this.options.offColor)),this.$off.addClass(this._getClass(l)),this.options.offColor=l,this.$element)}},{key:'onText',value:function(l){return'undefined'==typeof l?this.options.onText:(this.$on.html(l),this._width(),this._containerPosition(),this.options.onText=l,this.$element)}},{key:'offText',value:function(l){return'undefined'==typeof l?this.options.offText:(this.$off.html(l),this._width(),this._containerPosition(),this.options.offText=l,this.$element)}},{key:'labelText',value:function(l){return'undefined'==typeof l?this.options.labelText:(this.$label.html(l),this._width(),this.options.labelText=l,this.$element)}},{key:'handleWidth',value:function(l){return'undefined'==typeof l?this.options.handleWidth:(this.options.handleWidth=l,this._width(),this._containerPosition(),this.$element)}},{key:'labelWidth',value:function(l){return'undefined'==typeof l?this.options.labelWidth:(this.options.labelWidth=l,this._width(),this._containerPosition(),this.$element)}},{key:'baseClass',value:function(){return this.options.baseClass}},{key:'wrapperClass',value:function(l){return'undefined'==typeof l?this.options.wrapperClass:(l||(l=g.fn.bootstrapSwitch.defaults.wrapperClass),this.$wrapper.removeClass(this._getClasses(this.options.wrapperClass).join(' ')),this.$wrapper.addClass(this._getClasses(l).join(' ')),this.options.wrapperClass=l,this.$element)}},{key:'radioAllOff',value:function(l){if('undefined'==typeof l)return this.options.radioAllOff;var m=!!l;return this.options.radioAllOff===m?this.$element:(this.options.radioAllOff=m,this.$element)}},{key:'onInit',value:function(l){return'undefined'==typeof l?this.options.onInit:(l||(l=g.fn.bootstrapSwitch.defaults.onInit),this.options.onInit=l,this.$element)}},{key:'onSwitchChange',value:function(l){return'undefined'==typeof l?this.options.onSwitchChange:(l||(l=g.fn.bootstrapSwitch.defaults.onSwitchChange),this.options.onSwitchChange=l,this.$element)}},{key:'destroy',value:function(){var l=this.$element.closest('form');return l.length&&l.off('reset.bootstrapSwitch').removeData('bootstrap-switch'),this.$container.children().not(this.$element).remove(),this.$element.unwrap().unwrap().off('.bootstrapSwitch').removeData('bootstrap-switch'),this.$element}},{key:'_getElementOptions',value:function(){return{state:this.$element.is(':checked'),size:this.$element.data('size'),animate:this.$element.data('animate'),disabled:this.$element.is(':disabled'),readonly:this.$element.is('[readonly]'),indeterminate:this.$element.data('indeterminate'),inverse:this.$element.data('inverse'),radioAllOff:this.$element.data('radio-all-off'),onColor:this.$element.data('on-color'),offColor:this.$element.data('off-color'),onText:this.$element.data('on-text'),offText:this.$element.data('off-text'),labelText:this.$element.data('label-text'),handleWidth:this.$element.data('handle-width'),labelWidth:this.$element.data('label-width'),baseClass:this.$element.data('base-class'),wrapperClass:this.$element.data('wrapper-class')}}},{key:'_width',value:function(){var l=this,m=this.$on.add(this.$off).add(this.$label).css('width',''),n='auto'===this.options.handleWidth?Math.round(Math.max(this.$on.width(),this.$off.width())):this.options.handleWidth;return m.width(n),this.$label.width(function(o,p){return'auto'===l.options.labelWidth?p<n?n:p:l.options.labelWidth}),this._handleWidth=this.$on.outerWidth(),this._labelWidth=this.$label.outerWidth(),this.$container.width(2*this._handleWidth+this._labelWidth),this.$wrapper.width(this._handleWidth+this._labelWidth)}},{key:'_containerPosition',value:function(){var l=this,m=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this.options.state,n=arguments[1];this.$container.css('margin-left',function(){var o=[0,'-'+l._handleWidth+'px'];return l.options.indeterminate?'-'+l._handleWidth/2+'px':m?l.options.inverse?o[1]:o[0]:l.options.inverse?o[0]:o[1]})}},{key:'_init',value:function(){var l=this,m=function(){l.setPrevOptions(),l._width(),l._containerPosition(),setTimeout(function(){if(l.options.animate)return l.$wrapper.addClass(l._getClass('animate'))},50)};if(this.$wrapper.is(':visible'))return void m();var n=window.setInterval(function(){if(l.$wrapper.is(':visible'))return m(),window.clearInterval(n)},50)}},{key:'_elementHandlers',value:function(){var l=this;return this.$element.on({'setPreviousOptions.bootstrapSwitch':this.setPrevOptions.bind(this),'previousState.bootstrapSwitch':function(){l.options=l.prevOptions,l.options.indeterminate&&l.$wrapper.addClass(l._getClass('indeterminate')),l.$element.prop('checked',l.options.state).trigger('change.bootstrapSwitch',!0)},'change.bootstrapSwitch':function(n,o){n.preventDefault(),n.stopImmediatePropagation();var p=l.$element.is(':checked');l._containerPosition(p),p===l.options.state||(l.options.state=p,l.$wrapper.toggleClass(l._getClass('off')).toggleClass(l._getClass('on')),!o&&(l.$element.is(':radio')&&g('[name="'+l.$element.attr('name')+'"]').not(l.$element).prop('checked',!1).trigger('change.bootstrapSwitch',!0),l.$element.trigger('switchChange.bootstrapSwitch',[p])))},'focus.bootstrapSwitch':function(n){n.preventDefault(),l.$wrapper.addClass(l._getClass('focused'))},'blur.bootstrapSwitch':function(n){n.preventDefault(),l.$wrapper.removeClass(l._getClass('focused'))},'keydown.bootstrapSwitch':function(n){!n.which||l.options.disabled||l.options.readonly||(37===n.which||39===n.which)&&(n.preventDefault(),n.stopImmediatePropagation(),l.state(39===n.which))}})}},{key:'_handleHandlers',value:function(){var l=this;return this.$on.on('click.bootstrapSwitch',function(m){return m.preventDefault(),m.stopPropagation(),l.state(!1),l.$element.trigger('focus.bootstrapSwitch')}),this.$off.on('click.bootstrapSwitch',function(m){return m.preventDefault(),m.stopPropagation(),l.state(!0),l.$element.trigger('focus.bootstrapSwitch')})}},{key:'_labelHandlers',value:function(){var l=this;this.$label.on({click:function(o){o.stopPropagation()},'mousedown.bootstrapSwitch touchstart.bootstrapSwitch':function(o){l._dragStart||l.options.disabled||l.options.readonly||(o.preventDefault(),o.stopPropagation(),l._dragStart=(o.pageX||o.originalEvent.touches[0].pageX)-parseInt(l.$container.css('margin-left'),10),l.options.animate&&l.$wrapper.removeClass(l._getClass('animate')),l.$element.trigger('focus.bootstrapSwitch'))},'mousemove.bootstrapSwitch touchmove.bootstrapSwitch':function(o){if(null!=l._dragStart){var p=(o.pageX||o.originalEvent.touches[0].pageX)-l._dragStart;o.preventDefault(),p<-l._handleWidth||0<p||(l._dragEnd=p,l.$container.css('margin-left',l._dragEnd+'px'))}},'mouseup.bootstrapSwitch touchend.bootstrapSwitch':function(o){if(l._dragStart){if(o.preventDefault(),l.options.animate&&l.$wrapper.addClass(l._getClass('animate')),l._dragEnd){var p=l._dragEnd>-(l._handleWidth/2);l._dragEnd=!1,l.state(l.options.inverse?!p:p)}else l.state(!l.options.state);l._dragStart=!1}},'mouseleave.bootstrapSwitch':function(){l.$label.trigger('mouseup.bootstrapSwitch')}})}},{key:'_externalLabelHandler',value:function(){var l=this,m=this.$element.closest('label');m.on('click',function(n){n.preventDefault(),n.stopImmediatePropagation(),n.target===m[0]&&l.toggleState()})}},{key:'_formHandler',value:function(){var l=this.$element.closest('form');l.data('bootstrap-switch')||l.on('reset.bootstrapSwitch',function(){window.setTimeout(function(){l.find('input').filter(function(){return g(this).data('bootstrap-switch')}).each(function(){return g(this).bootstrapSwitch('state',this.checked)})},1)}).data('bootstrap-switch',!0)}},{key:'_getClass',value:function(l){return this.options.baseClass+'-'+l}},{key:'_getClasses',value:function(l){return g.isArray(l)?l.map(this._getClass.bind(this)):[this._getClass(l)]}}]),j}();g.fn.bootstrapSwitch=function(j){for(var l=arguments.length,m=Array(1<l?l-1:0),n=1;n<l;n++)m[n-1]=arguments[n];return Array.prototype.reduce.call(this,function(o,p){var q=g(p),r=q.data('bootstrap-switch'),s=r||new h(p,j);return r||q.data('bootstrap-switch',s),'string'==typeof j?s[j].apply(s,m):o},this)},g.fn.bootstrapSwitch.Constructor=h,g.fn.bootstrapSwitch.defaults={state:!0,size:null,animate:!0,disabled:!1,readonly:!1,indeterminate:!1,inverse:!1,radioAllOff:!1,onColor:'primary',offColor:'default',onText:'ON',offText:'OFF',labelText:' ',handleWidth:'auto',labelWidth:'auto',baseClass:'bootstrap-switch',wrapperClass:'wrapper',onInit:function(){},onSwitchChange:function(){}}}); |
+1
-1
@@ -1,1 +0,1 @@ | ||
| <!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="x-ua-Compatible" content="ie=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="description" content="Turn checkboxes and radio buttons into toggle switches."><meta name="author" content="Mattia Larentis, Emanuele Marchi and Peter Stein"><title>Bootstrap Switch · Turn checkboxes and radio buttons into toggle switches</title><link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"><link href="css/highlight.css" rel="stylesheet"><link href="https://unpkg.com/bootstrap-switch/dist/css/bootstrap3/bootstrap-switch.css" rel="stylesheet"><link href="http://getbootstrap.com/assets/css/docs.min.css" rel="stylesheet"><link href="css/main.css" rel="stylesheet"></head><body><a href="https://github.com/nostalgiaz/bootstrap-switch" id="github"><img src="https://s3.amazonaws.com/github/ribbons/forkme_right_gray_6d6d6d.png" alt="Fork me on GitHub"></a><header role="banner" class="navbar navbar-static-top bs-docs-nav"><div class="container"><div class="navbar-header"><button type="button" data-toggle="collapse" data-target="#collapse" class="navbar-toggle"><span class="sr-only">Toggle navigation</span><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></button><a href="../" class="navbar-brand">Bootstrap Switch</a></div><nav id="collapse" role="navigation" class="collapse navbar-collapse bs-navbar-collapse"><ul class="nav navbar-nav"><li><a href="https://github.com/nostalgiaz/bootstrap-switch/archive/master.zip" data-toggle="dropdown">Download</a></li><li><a href="examples.html">Examples</a></li><li class="dropdown"><a href="#" data-toggle="dropdown">Documentation <span class="caret"></span></a><ul class="dropdown-menu"><li><a href="/options.html">Options</a></li><li><a href="/methods.html">Methods</a></li><li><a href="/events.html">Events</a></li><li role="presentation" class="divider"></li><li><a href="/documentation-2.html">Documentation (v2.0.1)</a></li></ul></li><li><a href="https://github.com/nostalgiaz/bootstrap-switch/issues">Bug reports</a></li></ul></nav></div></header><main id="content" role="main"><h1>404</h1><h3>Whoops. Looks like what you're looking for can't be found.</h3></main><footer class="bs-docs-footer"><div class="container"><p>Code licensed under <a href="http://www.apache.org/licenses/LICENSE-2.0" target="_blank">Apache License, Version 2.0</a><br>Created by <a href="https://github.com/nostalgiaz" target="_blank">Mattia Larentis</a><br>Mantained by <a href="https://github.com/lostcrew" target="_blank">Emanuele Marchi</a></p></div></footer><script src="https://code.jquery.com/jquery-3.1.1.min.js"></script><script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script><script src="js/highlight.js"></script><script src="https://unpkg.com/bootstrap-switch"></script><script src="js/main.js"></script></body></html> | ||
| <!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="x-ua-Compatible" content="ie=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="description" content="Turn checkboxes and radio buttons into toggle switches"><meta name="author" content="Mattia Larentis, Emanuele Marchi and Peter Stein"><title>Bootstrap Switch · Turn checkboxes and radio buttons into toggle switches</title><link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"><link href="css/highlight.css" rel="stylesheet"><link href="https://unpkg.com/bootstrap-switch/dist/css/bootstrap3/bootstrap-switch.css" rel="stylesheet"><link href="https://getbootstrap.com/assets/css/docs.min.css" rel="stylesheet"><link href="css/main.css" rel="stylesheet"></head><body><a href="https://github.com/Bttstrp/bootstrap-switch" id="github"><img src="https://s3.amazonaws.com/github/ribbons/forkme_right_gray_6d6d6d.png" alt="Fork me on GitHub"></a><header role="banner" class="navbar navbar-static-top bs-docs-nav"><div class="container"><div class="navbar-header"><button type="button" data-toggle="collapse" data-target="#collapse" class="navbar-toggle"><span class="sr-only">Toggle navigation</span><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></button><a href="../" class="navbar-brand">Bootstrap Switch</a></div><nav id="collapse" role="navigation" class="collapse navbar-collapse bs-navbar-collapse"><ul class="nav navbar-nav"><li><a href="https://github.com/Bttstrp/bootstrap-switch/archive/master.zip" data-toggle="dropdown">Download</a></li><li><a href="examples.html">Examples</a></li><li class="dropdown"><a href="#" data-toggle="dropdown">Documentation <span class="caret"></span></a><ul class="dropdown-menu"><li><a href="/options.html">Options</a></li><li><a href="/methods.html">Methods</a></li><li><a href="/events.html">Events</a></li><li role="presentation" class="divider"></li><li><a href="/documentation-2.html">Documentation (v2.0.1)</a></li></ul></li><li><a href="https://github.com/Bttstrp/bootstrap-switch/issues">Bug reports</a></li></ul></nav></div></header><main id="content" role="main"><h1>404</h1><h3>Whoops. Looks like what you're looking for can't be found.</h3></main><footer class="bs-docs-footer"><div class="container"><p>Code licensed under <a href="https://www.apache.org/licenses/LICENSE-2.0" target="_blank">Apache License, Version 2.0</a><br>Created by <a href="https://github.com/nostalgiaz" target="_blank">Mattia Larentis</a><br>Mantained by <a href="https://github.com/lostcrew" target="_blank">Emanuele Marchi</a></p></div></footer><script src="https://code.jquery.com/jquery-3.1.1.min.js"></script><script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script><script src="js/highlight.js"></script><script src="https://unpkg.com/bootstrap-switch"></script><script src="js/main.js"></script></body></html> |
@@ -1,2 +0,2 @@ | ||
| <!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="x-ua-Compatible" content="ie=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="description" content="Turn checkboxes and radio buttons into toggle switches."><meta name="author" content="Mattia Larentis, Emanuele Marchi and Peter Stein"><title>Bootstrap Switch · Turn checkboxes and radio buttons into toggle switches</title><link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"><link href="css/highlight.css" rel="stylesheet"><link href="https://unpkg.com/bootstrap-switch/dist/css/bootstrap3/bootstrap-switch.css" rel="stylesheet"><link href="http://getbootstrap.com/assets/css/docs.min.css" rel="stylesheet"><link href="css/main.css" rel="stylesheet"></head><body><a href="https://github.com/nostalgiaz/bootstrap-switch" id="github"><img src="https://s3.amazonaws.com/github/ribbons/forkme_right_gray_6d6d6d.png" alt="Fork me on GitHub"></a><header role="banner" class="navbar navbar-static-top bs-docs-nav"><div class="container"><div class="navbar-header"><button type="button" data-toggle="collapse" data-target="#collapse" class="navbar-toggle"><span class="sr-only">Toggle navigation</span><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></button><a href="../" class="navbar-brand">Bootstrap Switch</a></div><nav id="collapse" role="navigation" class="collapse navbar-collapse bs-navbar-collapse"><ul class="nav navbar-nav"><li><a href="https://github.com/nostalgiaz/bootstrap-switch/archive/master.zip" data-toggle="dropdown">Download</a></li><li><a href="examples.html">Examples</a></li><li class="dropdown"><a href="#" data-toggle="dropdown">Documentation <span class="caret"></span></a><ul class="dropdown-menu"><li><a href="/options.html">Options</a></li><li><a href="/methods.html">Methods</a></li><li><a href="/events.html">Events</a></li><li role="presentation" class="divider"></li><li><a href="/documentation-2.html">Documentation (v2.0.1)</a></li></ul></li><li><a href="https://github.com/nostalgiaz/bootstrap-switch/issues">Bug reports</a></li></ul></nav></div></header><main id="content" role="main"><div class="bs-docs-header"><div class="container"><h1>Documentation</h1><p>v2.0.1</p></div></div><div class="container"><div id="options"><h2 class="page-header">Options</h2><div class="alert alert-warning"><p>All the options are accepted only using <code>data-*</code> attributes on the element.<br> | ||
| <!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="x-ua-Compatible" content="ie=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="description" content="Turn checkboxes and radio buttons into toggle switches"><meta name="author" content="Mattia Larentis, Emanuele Marchi and Peter Stein"><title>Bootstrap Switch · Turn checkboxes and radio buttons into toggle switches</title><link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"><link href="css/highlight.css" rel="stylesheet"><link href="https://unpkg.com/bootstrap-switch/dist/css/bootstrap3/bootstrap-switch.css" rel="stylesheet"><link href="https://getbootstrap.com/assets/css/docs.min.css" rel="stylesheet"><link href="css/main.css" rel="stylesheet"></head><body><a href="https://github.com/Bttstrp/bootstrap-switch" id="github"><img src="https://s3.amazonaws.com/github/ribbons/forkme_right_gray_6d6d6d.png" alt="Fork me on GitHub"></a><header role="banner" class="navbar navbar-static-top bs-docs-nav"><div class="container"><div class="navbar-header"><button type="button" data-toggle="collapse" data-target="#collapse" class="navbar-toggle"><span class="sr-only">Toggle navigation</span><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></button><a href="../" class="navbar-brand">Bootstrap Switch</a></div><nav id="collapse" role="navigation" class="collapse navbar-collapse bs-navbar-collapse"><ul class="nav navbar-nav"><li><a href="https://github.com/Bttstrp/bootstrap-switch/archive/master.zip" data-toggle="dropdown">Download</a></li><li><a href="examples.html">Examples</a></li><li class="dropdown"><a href="#" data-toggle="dropdown">Documentation <span class="caret"></span></a><ul class="dropdown-menu"><li><a href="/options.html">Options</a></li><li><a href="/methods.html">Methods</a></li><li><a href="/events.html">Events</a></li><li role="presentation" class="divider"></li><li><a href="/documentation-2.html">Documentation (v2.0.1)</a></li></ul></li><li><a href="https://github.com/Bttstrp/bootstrap-switch/issues">Bug reports</a></li></ul></nav></div></header><main id="content" role="main"><div class="bs-docs-header"><div class="container"><h1>Documentation</h1><p>v2.0.1</p></div></div><div class="container"><div id="options"><h2 class="page-header">Options</h2><div class="alert alert-warning"><p>All the options are accepted only using <code>data-*</code> attributes on the element.<br> | ||
| <code>checked</code>, <code>disabled</code> and <code>readonly</code> are exceptions to the rule, being | ||
@@ -7,2 +7,2 @@ default HTML input attributes.<br> | ||
| The latter is an object that includes <code>el</code> (the input DOM element) and <code>value</code> (the | ||
| new input state)</p></div></div></main><footer class="bs-docs-footer"><div class="container"><p>Code licensed under <a href="http://www.apache.org/licenses/LICENSE-2.0" target="_blank">Apache License, Version 2.0</a><br>Created by <a href="https://github.com/nostalgiaz" target="_blank">Mattia Larentis</a><br>Mantained by <a href="https://github.com/lostcrew" target="_blank">Emanuele Marchi</a></p></div></footer><script src="https://code.jquery.com/jquery-3.1.1.min.js"></script><script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script><script src="js/highlight.js"></script><script src="https://unpkg.com/bootstrap-switch"></script><script src="js/main.js"></script></body></html> | ||
| new input state)</p></div></div></main><footer class="bs-docs-footer"><div class="container"><p>Code licensed under <a href="https://www.apache.org/licenses/LICENSE-2.0" target="_blank">Apache License, Version 2.0</a><br>Created by <a href="https://github.com/nostalgiaz" target="_blank">Mattia Larentis</a><br>Mantained by <a href="https://github.com/lostcrew" target="_blank">Emanuele Marchi</a></p></div></footer><script src="https://code.jquery.com/jquery-3.1.1.min.js"></script><script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script><script src="js/highlight.js"></script><script src="https://unpkg.com/bootstrap-switch"></script><script src="js/main.js"></script></body></html> |
+2
-2
@@ -1,2 +0,2 @@ | ||
| <!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="x-ua-Compatible" content="ie=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="description" content="Turn checkboxes and radio buttons into toggle switches."><meta name="author" content="Mattia Larentis, Emanuele Marchi and Peter Stein"><title>Bootstrap Switch · Turn checkboxes and radio buttons into toggle switches</title><link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"><link href="css/highlight.css" rel="stylesheet"><link href="https://unpkg.com/bootstrap-switch/dist/css/bootstrap3/bootstrap-switch.css" rel="stylesheet"><link href="http://getbootstrap.com/assets/css/docs.min.css" rel="stylesheet"><link href="css/main.css" rel="stylesheet"></head><body><a href="https://github.com/nostalgiaz/bootstrap-switch" id="github"><img src="https://s3.amazonaws.com/github/ribbons/forkme_right_gray_6d6d6d.png" alt="Fork me on GitHub"></a><header role="banner" class="navbar navbar-static-top bs-docs-nav"><div class="container"><div class="navbar-header"><button type="button" data-toggle="collapse" data-target="#collapse" class="navbar-toggle"><span class="sr-only">Toggle navigation</span><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></button><a href="../" class="navbar-brand">Bootstrap Switch</a></div><nav id="collapse" role="navigation" class="collapse navbar-collapse bs-navbar-collapse"><ul class="nav navbar-nav"><li><a href="https://github.com/nostalgiaz/bootstrap-switch/archive/master.zip" data-toggle="dropdown">Download</a></li><li><a href="examples.html">Examples</a></li><li class="dropdown"><a href="#" data-toggle="dropdown">Documentation <span class="caret"></span></a><ul class="dropdown-menu"><li><a href="/options.html">Options</a></li><li><a href="/methods.html">Methods</a></li><li><a href="/events.html">Events</a></li><li role="presentation" class="divider"></li><li><a href="/documentation-2.html">Documentation (v2.0.1)</a></li></ul></li><li><a href="https://github.com/nostalgiaz/bootstrap-switch/issues">Bug reports</a></li></ul></nav></div></header><main id="content" role="main"><div class="bs-docs-header"><div class="container"><h1>Events</h1></div></div><div class="container"><p>All the events are namespaced, therefore always append <code>.bootstrapSwitch</code> when you | ||
| <!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="x-ua-Compatible" content="ie=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="description" content="Turn checkboxes and radio buttons into toggle switches"><meta name="author" content="Mattia Larentis, Emanuele Marchi and Peter Stein"><title>Bootstrap Switch · Turn checkboxes and radio buttons into toggle switches</title><link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"><link href="css/highlight.css" rel="stylesheet"><link href="https://unpkg.com/bootstrap-switch/dist/css/bootstrap3/bootstrap-switch.css" rel="stylesheet"><link href="https://getbootstrap.com/assets/css/docs.min.css" rel="stylesheet"><link href="css/main.css" rel="stylesheet"></head><body><a href="https://github.com/Bttstrp/bootstrap-switch" id="github"><img src="https://s3.amazonaws.com/github/ribbons/forkme_right_gray_6d6d6d.png" alt="Fork me on GitHub"></a><header role="banner" class="navbar navbar-static-top bs-docs-nav"><div class="container"><div class="navbar-header"><button type="button" data-toggle="collapse" data-target="#collapse" class="navbar-toggle"><span class="sr-only">Toggle navigation</span><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></button><a href="../" class="navbar-brand">Bootstrap Switch</a></div><nav id="collapse" role="navigation" class="collapse navbar-collapse bs-navbar-collapse"><ul class="nav navbar-nav"><li><a href="https://github.com/Bttstrp/bootstrap-switch/archive/master.zip" data-toggle="dropdown">Download</a></li><li><a href="examples.html">Examples</a></li><li class="dropdown"><a href="#" data-toggle="dropdown">Documentation <span class="caret"></span></a><ul class="dropdown-menu"><li><a href="/options.html">Options</a></li><li><a href="/methods.html">Methods</a></li><li><a href="/events.html">Events</a></li><li role="presentation" class="divider"></li><li><a href="/documentation-2.html">Documentation (v2.0.1)</a></li></ul></li><li><a href="https://github.com/Bttstrp/bootstrap-switch/issues">Bug reports</a></li></ul></nav></div></header><main id="content" role="main"><div class="bs-docs-header"><div class="container"><h1>Events</h1></div></div><div class="container"><p>All the events are namespaced, therefore always append <code>.bootstrapSwitch</code> when you | ||
| attach your handlers.<br> | ||
@@ -9,2 +9,2 @@ You can register to the emitted events as follows:</p><pre><code>$('input[name="my-checkbox"]').on('switchChange.bootstrapSwitch', function(event, state) { | ||
| state (true | false)</td></tr><tr><td>switchChange</td><td>Triggered on switch state change. 'this' refers to the DOM element.</td><td>event (<a href="https://api.jquery.com/category/events/event-object/" target="_blank">jQuery Event object</a>), | ||
| state (true | false)</td></tr></tbody></table></div></main><footer class="bs-docs-footer"><div class="container"><p>Code licensed under <a href="http://www.apache.org/licenses/LICENSE-2.0" target="_blank">Apache License, Version 2.0</a><br>Created by <a href="https://github.com/nostalgiaz" target="_blank">Mattia Larentis</a><br>Mantained by <a href="https://github.com/lostcrew" target="_blank">Emanuele Marchi</a></p></div></footer><script src="https://code.jquery.com/jquery-3.1.1.min.js"></script><script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script><script src="js/highlight.js"></script><script src="https://unpkg.com/bootstrap-switch"></script><script src="js/main.js"></script></body></html> | ||
| state (true | false)</td></tr></tbody></table></div></main><footer class="bs-docs-footer"><div class="container"><p>Code licensed under <a href="https://www.apache.org/licenses/LICENSE-2.0" target="_blank">Apache License, Version 2.0</a><br>Created by <a href="https://github.com/nostalgiaz" target="_blank">Mattia Larentis</a><br>Mantained by <a href="https://github.com/lostcrew" target="_blank">Emanuele Marchi</a></p></div></footer><script src="https://code.jquery.com/jquery-3.1.1.min.js"></script><script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script><script src="js/highlight.js"></script><script src="https://unpkg.com/bootstrap-switch"></script><script src="js/main.js"></script></body></html> |
@@ -1,1 +0,1 @@ | ||
| <!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="x-ua-Compatible" content="ie=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="description" content="Turn checkboxes and radio buttons into toggle switches."><meta name="author" content="Mattia Larentis, Emanuele Marchi and Peter Stein"><title>Bootstrap Switch · Turn checkboxes and radio buttons into toggle switches</title><link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"><link href="css/highlight.css" rel="stylesheet"><link href="https://unpkg.com/bootstrap-switch/dist/css/bootstrap3/bootstrap-switch.css" rel="stylesheet"><link href="http://getbootstrap.com/assets/css/docs.min.css" rel="stylesheet"><link href="css/main.css" rel="stylesheet"></head><body><a href="https://github.com/nostalgiaz/bootstrap-switch" id="github"><img src="https://s3.amazonaws.com/github/ribbons/forkme_right_gray_6d6d6d.png" alt="Fork me on GitHub"></a><header role="banner" class="navbar navbar-static-top bs-docs-nav"><div class="container"><div class="navbar-header"><button type="button" data-toggle="collapse" data-target="#collapse" class="navbar-toggle"><span class="sr-only">Toggle navigation</span><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></button><a href="../" class="navbar-brand">Bootstrap Switch</a></div><nav id="collapse" role="navigation" class="collapse navbar-collapse bs-navbar-collapse"><ul class="nav navbar-nav"><li><a href="https://github.com/nostalgiaz/bootstrap-switch/archive/master.zip" data-toggle="dropdown">Download</a></li><li><a href="examples.html">Examples</a></li><li class="dropdown"><a href="#" data-toggle="dropdown">Documentation <span class="caret"></span></a><ul class="dropdown-menu"><li><a href="/options.html">Options</a></li><li><a href="/methods.html">Methods</a></li><li><a href="/events.html">Events</a></li><li role="presentation" class="divider"></li><li><a href="/documentation-2.html">Documentation (v2.0.1)</a></li></ul></li><li><a href="https://github.com/nostalgiaz/bootstrap-switch/issues">Bug reports</a></li></ul></nav></div></header><main id="content" role="main"><div class="bs-docs-header"><div class="container"><h1>Examples</h1></div></div><div class="container"><div class="row"><div class="col-sm-6 col-lg-4"><h2 class="h4">State</h2><p><input id="switch-state" type="checkbox" checked="checked"></p><div class="btn-group"><button type="button" data-switch-toggle="state" class="btn btn-default">Toggle</button><button type="button" data-switch-set="state" data-switch-value="true" class="btn btn-default">Set true</button><button type="button" data-switch-set="state" data-switch-value="false" class="btn btn-default">Set false</button><button type="button" data-switch-get="state" class="btn btn-default">Get</button></div></div><div class="col-sm-6 col-lg-4"><h2 class="h4">Size</h2><p><input id="switch-size" type="checkbox" checked="checked" data-size="mini"></p><div class="btn-group"><button type="button" data-switch-set="size" data-switch-value="mini" class="btn btn-default">Mini</button><button type="button" data-switch-set="size" data-switch-value="small" class="btn btn-default">Small</button><button type="button" data-switch-set="size" data-switch-value="normal" class="btn btn-default">Normal</button><button type="button" data-switch-set="size" data-switch-value="large" class="btn btn-default">Large</button><button type="button" data-switch-get="size" class="btn btn-default">Get</button></div></div><div class="col-sm-6 col-lg-4"><h2 class="h4">Animate</h2><p><input id="switch-animate" type="checkbox" checked="checked"></p><p><button type="button" data-switch-toggle="animate" class="btn btn-default">Toggle</button><button type="button" data-switch-get="animate" class="btn btn-default">Get</button></p></div><div class="col-sm-6 col-lg-4"><h2 class="h4">Disabled</h2><p><input id="switch-disabled" type="checkbox" checked="checked" disabled="disabled"></p><p><button type="button" data-switch-toggle="disabled" class="btn btn-default">Toggle</button><button type="button" data-switch-get="disabled" class="btn btn-default">Get</button></p></div><div class="col-sm-6 col-lg-4"><h2 class="h4">Readonly</h2><p><input id="switch-readonly" type="checkbox" checked="checked" readonly="readonly"></p><p><button type="button" data-switch-toggle="readonly" class="btn btn-default">Toggle</button><button type="button" data-switch-get="readonly" class="btn btn-default">Get</button></p></div><div class="col-sm-6 col-lg-4"><h2 class="h4">Indeterminate</h2><p><input id="switch-indeterminate" type="checkbox" checked="checked" data-indeterminate="true"></p><p><button type="button" data-switch-toggle="indeterminate" class="btn btn-default">Toggle</button><button type="button" data-switch-get="indeterminate" class="btn btn-default">Get</button></p></div><div class="col-sm-6 col-lg-4"><h2 class="h4">Inverse</h2><p><input id="switch-inverse" type="checkbox" checked="checked" data-inverse="true"></p><p><button type="button" data-switch-toggle="inverse" class="btn btn-default">Toggle</button><button type="button" data-switch-get="inverse" class="btn btn-default">Get</button></p></div><div class="col-sm-6 col-lg-4"><h2 class="h4">On Color</h2><p><input id="switch-onColor" type="checkbox" checked="checked" data-on-color="info"></p><p class="btn-group"><div class="btn-group"><button type="button" data-toggle="dropdown" class="btn btn-default dropdown-toggle">Set <span class="caret"></span></button><div role="menu" class="dropdown-menu"><li><a data-switch-set="onColor" data-switch-value="primary">Primary</a></li><li><a data-switch-set="onColor" data-switch-value="info">Info</a></li><li><a data-switch-set="onColor" data-switch-value="success">Success</a></li><li><a data-switch-set="onColor" data-switch-value="warning">Warning</a></li><li><a data-switch-set="onColor" data-switch-value="default">Default</a></li></div></div><button type="button" data-switch-get="onColor" class="btn btn-default">Get</button></p></div><div class="col-sm-6 col-lg-4"><h2 class="h4">Off Color</h2><p><input id="switch-offColor" type="checkbox" data-off-color="warning"></p><p class="btn-group"><div class="btn-group"><button type="button" data-toggle="dropdown" class="btn btn-default dropdown-toggle">Set <span class="caret"></span></button><div role="menu" class="dropdown-menu"><li><a data-switch-set="offColor" data-switch-value="primary">Primary</a></li><li><a data-switch-set="offColor" data-switch-value="info">Info</a></li><li><a data-switch-set="offColor" data-switch-value="success">Success</a></li><li><a data-switch-set="offColor" data-switch-value="warning">Warning</a></li><li><a data-switch-set="offColor" data-switch-value="default">Default</a></li></div></div><button type="button" data-switch-get="offColor" class="btn btn-default">Get</button></p></div><div class="col-sm-6 col-lg-4"><h2 class="h4">On Text</h2><p><input id="switch-onText" type="checkbox" checked="checked" data-on-text="Yes"></p><div class="row"><div class="col-sm-6"><input type="text" data-switch-set-value="onText" value="Yes" class="form-control"></div></div></div><div class="col-sm-6 col-lg-4"><h2 class="h4">Off Text</h2><p><input id="switch-offText" type="checkbox" data-off-text="No"></p><div class="row"><div class="col-sm-6"><input type="text" data-switch-set-value="offText" value="No" class="form-control"></div></div></div><div class="col-sm-6 col-lg-4"><h2 class="h4">Label Text</h2><p><input id="switch-labelText" type="checkbox" data-label-text="Label"></p><div class="row"><div class="col-sm-6"><input type="text" data-switch-set-value="labelText" class="form-control"></div></div></div><div class="col-sm-6 col-lg-4"><h2 class="h4">Handle Width</h2><p><input id="switch-handleWidth" type="checkbox" data-handle-width="100"></p><div class="row"><div class="col-sm-6"><input type="number" data-switch-set-value="handleWidth" value="100" class="form-control"></div></div></div><div class="col-sm-6 col-lg-4"><h2 class="h4">Label Width</h2><p><input id="switch-labelWidth" type="checkbox" data-label-width="100"></p><div class="row"><div class="col-sm-6"><input type="number" data-switch-set-value="labelWidth" value="100" class="form-control"></div></div></div><div class="col-sm-6 col-lg-4"><h2 class="h4">Create | Destroy</h2><p><input id="switch-create-destroy" type="checkbox" checked="checked" data-switch-no-init="data-switch-no-init"></p><div class="row"><div class="col-sm-6"><button type="button" data-switch-create-destroy="data-switch-create-destroy" data-destroy-text="Destroy" class="btn btn-default">Create</button></div></div></div></div><br><br><div class="text-center"><h2 class="h4">Radio All Off</h2><div class="row"><div class="col-sm-6"><h3 class="h5">Disabled</h3><input type="radio" name="radio1" checked="checked" class="switch-radio1"><input type="radio" name="radio1" class="switch-radio1"><input type="radio" name="radio1" class="switch-radio1"></div><div class="col-sm-6"><h3 class="h5">Enabled</h3><input type="radio" name="radio2" checked="checked" data-radio-all-off="true" class="switch-radio2"><input type="radio" name="radio2" data-radio-all-off="true" class="switch-radio2"><input type="radio" name="radio2" data-radio-all-off="true" class="switch-radio2"></div></div><br><hr><h2 class="h4">Inside Modals</h2><button data-toggle="modal" data-target="#modal-switch" class="btn btn-default">Open Modal</button><div id="modal-switch" tabindex="-1" role="dialog" aria-labelledby="modal-switch-label" class="modal fade"><div class="modal-dialog"><div class="modal-content"><div class="modal-header"><button type="button" data-dismiss="modal" class="close"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button><div id="modal-switch-label" class="modal-title">Title</div></div><div class="modal-body"><input id="switch-modal" type="checkbox" checked="checked"></div></div></div></div></div></div></main><footer class="bs-docs-footer"><div class="container"><p>Code licensed under <a href="http://www.apache.org/licenses/LICENSE-2.0" target="_blank">Apache License, Version 2.0</a><br>Created by <a href="https://github.com/nostalgiaz" target="_blank">Mattia Larentis</a><br>Mantained by <a href="https://github.com/lostcrew" target="_blank">Emanuele Marchi</a></p></div></footer><script src="https://code.jquery.com/jquery-3.1.1.min.js"></script><script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script><script src="js/highlight.js"></script><script src="https://unpkg.com/bootstrap-switch"></script><script src="js/main.js"></script></body></html> | ||
| <!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="x-ua-Compatible" content="ie=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="description" content="Turn checkboxes and radio buttons into toggle switches"><meta name="author" content="Mattia Larentis, Emanuele Marchi and Peter Stein"><title>Bootstrap Switch · Turn checkboxes and radio buttons into toggle switches</title><link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"><link href="css/highlight.css" rel="stylesheet"><link href="https://unpkg.com/bootstrap-switch/dist/css/bootstrap3/bootstrap-switch.css" rel="stylesheet"><link href="https://getbootstrap.com/assets/css/docs.min.css" rel="stylesheet"><link href="css/main.css" rel="stylesheet"></head><body><a href="https://github.com/Bttstrp/bootstrap-switch" id="github"><img src="https://s3.amazonaws.com/github/ribbons/forkme_right_gray_6d6d6d.png" alt="Fork me on GitHub"></a><header role="banner" class="navbar navbar-static-top bs-docs-nav"><div class="container"><div class="navbar-header"><button type="button" data-toggle="collapse" data-target="#collapse" class="navbar-toggle"><span class="sr-only">Toggle navigation</span><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></button><a href="../" class="navbar-brand">Bootstrap Switch</a></div><nav id="collapse" role="navigation" class="collapse navbar-collapse bs-navbar-collapse"><ul class="nav navbar-nav"><li><a href="https://github.com/Bttstrp/bootstrap-switch/archive/master.zip" data-toggle="dropdown">Download</a></li><li><a href="examples.html">Examples</a></li><li class="dropdown"><a href="#" data-toggle="dropdown">Documentation <span class="caret"></span></a><ul class="dropdown-menu"><li><a href="/options.html">Options</a></li><li><a href="/methods.html">Methods</a></li><li><a href="/events.html">Events</a></li><li role="presentation" class="divider"></li><li><a href="/documentation-2.html">Documentation (v2.0.1)</a></li></ul></li><li><a href="https://github.com/Bttstrp/bootstrap-switch/issues">Bug reports</a></li></ul></nav></div></header><main id="content" role="main"><div class="bs-docs-header"><div class="container"><h1>Examples</h1></div></div><div class="container"><div class="row"><div class="col-sm-6 col-lg-4"><h2 class="h4">State</h2><p><input id="switch-state" type="checkbox" checked="checked"></p><div class="btn-group"><button type="button" data-switch-toggle="state" class="btn btn-default">Toggle</button><button type="button" data-switch-set="state" data-switch-value="true" class="btn btn-default">Set true</button><button type="button" data-switch-set="state" data-switch-value="false" class="btn btn-default">Set false</button><button type="button" data-switch-get="state" class="btn btn-default">Get</button></div></div><div class="col-sm-6 col-lg-4"><h2 class="h4">Size</h2><p><input id="switch-size" type="checkbox" checked="checked" data-size="mini"></p><div class="btn-group"><button type="button" data-switch-set="size" data-switch-value="mini" class="btn btn-default">Mini</button><button type="button" data-switch-set="size" data-switch-value="small" class="btn btn-default">Small</button><button type="button" data-switch-set="size" data-switch-value="normal" class="btn btn-default">Normal</button><button type="button" data-switch-set="size" data-switch-value="large" class="btn btn-default">Large</button><button type="button" data-switch-get="size" class="btn btn-default">Get</button></div></div><div class="col-sm-6 col-lg-4"><h2 class="h4">Animate</h2><p><input id="switch-animate" type="checkbox" checked="checked"></p><p><button type="button" data-switch-toggle="animate" class="btn btn-default">Toggle</button><button type="button" data-switch-get="animate" class="btn btn-default">Get</button></p></div><div class="col-sm-6 col-lg-4"><h2 class="h4">Disabled</h2><p><input id="switch-disabled" type="checkbox" checked="checked" disabled="disabled"></p><p><button type="button" data-switch-toggle="disabled" class="btn btn-default">Toggle</button><button type="button" data-switch-get="disabled" class="btn btn-default">Get</button></p></div><div class="col-sm-6 col-lg-4"><h2 class="h4">Readonly</h2><p><input id="switch-readonly" type="checkbox" checked="checked" readonly="readonly"></p><p><button type="button" data-switch-toggle="readonly" class="btn btn-default">Toggle</button><button type="button" data-switch-get="readonly" class="btn btn-default">Get</button></p></div><div class="col-sm-6 col-lg-4"><h2 class="h4">Indeterminate</h2><p><input id="switch-indeterminate" type="checkbox" checked="checked" data-indeterminate="true"></p><p><button type="button" data-switch-toggle="indeterminate" class="btn btn-default">Toggle</button><button type="button" data-switch-get="indeterminate" class="btn btn-default">Get</button></p></div><div class="col-sm-6 col-lg-4"><h2 class="h4">Inverse</h2><p><input id="switch-inverse" type="checkbox" checked="checked" data-inverse="true"></p><p><button type="button" data-switch-toggle="inverse" class="btn btn-default">Toggle</button><button type="button" data-switch-get="inverse" class="btn btn-default">Get</button></p></div><div class="col-sm-6 col-lg-4"><h2 class="h4">On Color</h2><p><input id="switch-onColor" type="checkbox" checked="checked" data-on-color="info"></p><p class="btn-group"><div class="btn-group"><button type="button" data-toggle="dropdown" class="btn btn-default dropdown-toggle">Set <span class="caret"></span></button><div role="menu" class="dropdown-menu"><li><a data-switch-set="onColor" data-switch-value="primary">Primary</a></li><li><a data-switch-set="onColor" data-switch-value="info">Info</a></li><li><a data-switch-set="onColor" data-switch-value="success">Success</a></li><li><a data-switch-set="onColor" data-switch-value="warning">Warning</a></li><li><a data-switch-set="onColor" data-switch-value="default">Default</a></li></div></div><button type="button" data-switch-get="onColor" class="btn btn-default">Get</button></p></div><div class="col-sm-6 col-lg-4"><h2 class="h4">Off Color</h2><p><input id="switch-offColor" type="checkbox" data-off-color="warning"></p><p class="btn-group"><div class="btn-group"><button type="button" data-toggle="dropdown" class="btn btn-default dropdown-toggle">Set <span class="caret"></span></button><div role="menu" class="dropdown-menu"><li><a data-switch-set="offColor" data-switch-value="primary">Primary</a></li><li><a data-switch-set="offColor" data-switch-value="info">Info</a></li><li><a data-switch-set="offColor" data-switch-value="success">Success</a></li><li><a data-switch-set="offColor" data-switch-value="warning">Warning</a></li><li><a data-switch-set="offColor" data-switch-value="default">Default</a></li></div></div><button type="button" data-switch-get="offColor" class="btn btn-default">Get</button></p></div><div class="col-sm-6 col-lg-4"><h2 class="h4">On Text</h2><p><input id="switch-onText" type="checkbox" checked="checked" data-on-text="Yes"></p><div class="row"><div class="col-sm-6"><input type="text" data-switch-set-value="onText" value="Yes" class="form-control"></div></div></div><div class="col-sm-6 col-lg-4"><h2 class="h4">Off Text</h2><p><input id="switch-offText" type="checkbox" data-off-text="No"></p><div class="row"><div class="col-sm-6"><input type="text" data-switch-set-value="offText" value="No" class="form-control"></div></div></div><div class="col-sm-6 col-lg-4"><h2 class="h4">Label Text</h2><p><input id="switch-labelText" type="checkbox" data-label-text="Label"></p><div class="row"><div class="col-sm-6"><input type="text" data-switch-set-value="labelText" class="form-control"></div></div></div><div class="col-sm-6 col-lg-4"><h2 class="h4">Handle Width</h2><p><input id="switch-handleWidth" type="checkbox" data-handle-width="100"></p><div class="row"><div class="col-sm-6"><input type="number" data-switch-set-value="handleWidth" value="100" class="form-control"></div></div></div><div class="col-sm-6 col-lg-4"><h2 class="h4">Label Width</h2><p><input id="switch-labelWidth" type="checkbox" data-label-width="100"></p><div class="row"><div class="col-sm-6"><input type="number" data-switch-set-value="labelWidth" value="100" class="form-control"></div></div></div><div class="col-sm-6 col-lg-4"><h2 class="h4">Create | Destroy</h2><p><input id="switch-create-destroy" type="checkbox" checked="checked" data-switch-no-init="data-switch-no-init"></p><div class="row"><div class="col-sm-6"><button type="button" data-switch-create-destroy="data-switch-create-destroy" data-destroy-text="Destroy" class="btn btn-default">Create</button></div></div></div></div><br><br><div class="text-center"><h2 class="h4">Radio All Off</h2><div class="row"><div class="col-sm-6"><h3 class="h5">Disabled</h3><input type="radio" name="radio1" checked="checked" class="switch-radio1"><input type="radio" name="radio1" class="switch-radio1"><input type="radio" name="radio1" class="switch-radio1"></div><div class="col-sm-6"><h3 class="h5">Enabled</h3><input type="radio" name="radio2" checked="checked" data-radio-all-off="true" class="switch-radio2"><input type="radio" name="radio2" data-radio-all-off="true" class="switch-radio2"><input type="radio" name="radio2" data-radio-all-off="true" class="switch-radio2"></div></div><br><hr><h2 class="h4">Inside Modals</h2><button data-toggle="modal" data-target="#modal-switch" class="btn btn-default">Open Modal</button><div id="modal-switch" tabindex="-1" role="dialog" aria-labelledby="modal-switch-label" class="modal fade"><div class="modal-dialog"><div class="modal-content"><div class="modal-header"><button type="button" data-dismiss="modal" class="close"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button><div id="modal-switch-label" class="modal-title">Title</div></div><div class="modal-body"><input id="switch-modal" type="checkbox" checked="checked"></div></div></div></div></div></div></main><footer class="bs-docs-footer"><div class="container"><p>Code licensed under <a href="https://www.apache.org/licenses/LICENSE-2.0" target="_blank">Apache License, Version 2.0</a><br>Created by <a href="https://github.com/nostalgiaz" target="_blank">Mattia Larentis</a><br>Mantained by <a href="https://github.com/lostcrew" target="_blank">Emanuele Marchi</a></p></div></footer><script src="https://code.jquery.com/jquery-3.1.1.min.js"></script><script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script><script src="js/highlight.js"></script><script src="https://unpkg.com/bootstrap-switch"></script><script src="js/main.js"></script></body></html> |
+2
-2
@@ -1,2 +0,2 @@ | ||
| <!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="x-ua-Compatible" content="ie=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="description" content="Turn checkboxes and radio buttons into toggle switches."><meta name="author" content="Mattia Larentis, Emanuele Marchi and Peter Stein"><title>Bootstrap Switch · Turn checkboxes and radio buttons into toggle switches</title><link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"><link href="css/highlight.css" rel="stylesheet"><link href="https://unpkg.com/bootstrap-switch/dist/css/bootstrap3/bootstrap-switch.css" rel="stylesheet"><link href="http://getbootstrap.com/assets/css/docs.min.css" rel="stylesheet"><link href="css/main.css" rel="stylesheet"></head><body><a href="https://github.com/nostalgiaz/bootstrap-switch" id="github"><img src="https://s3.amazonaws.com/github/ribbons/forkme_right_gray_6d6d6d.png" alt="Fork me on GitHub"></a><header role="banner" class="navbar navbar-static-top bs-docs-nav"><div class="container"><div class="navbar-header"><button type="button" data-toggle="collapse" data-target="#collapse" class="navbar-toggle"><span class="sr-only">Toggle navigation</span><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></button><a href="../" class="navbar-brand">Bootstrap Switch</a></div><nav id="collapse" role="navigation" class="collapse navbar-collapse bs-navbar-collapse"><ul class="nav navbar-nav"><li><a href="https://github.com/nostalgiaz/bootstrap-switch/archive/master.zip" data-toggle="dropdown">Download</a></li><li><a href="examples.html">Examples</a></li><li class="dropdown"><a href="#" data-toggle="dropdown">Documentation <span class="caret"></span></a><ul class="dropdown-menu"><li><a href="/options.html">Options</a></li><li><a href="/methods.html">Methods</a></li><li><a href="/events.html">Events</a></li><li role="presentation" class="divider"></li><li><a href="/documentation-2.html">Documentation (v2.0.1)</a></li></ul></li><li><a href="https://github.com/nostalgiaz/bootstrap-switch/issues">Bug reports</a></li></ul></nav></div></header><main id="content" role="main"><div class="bs-docs-masthead"><div class="container"><h1 class="title">Bootstrap Switch</h1><p class="lead">Turn checkboxes <input type="checkbox" checked="checked" data-switch-no-init="data-switch-no-init"> and radio buttons <input type="radio" checked="checked" data-switch-no-init="data-switch-no-init"> into toggle switches <input type="checkbox" checked="checked"></p><p class="lead"><a href="https://github.com/nostalgiaz/bootstrap-switch/archive/master.zip" class="btn btn-outline-inverse btn-lg">Download Bootstrap Switch</a></p><p class="bs-docs-social"><iframe src="http://ghbtns.com/github-btn.html?user=nostalgiaz&repo=bootstrap-switch&type=watch&count=true&size=large" allowtransparency="true" frameborder="0" scrolling="0" width="184" height="30"></iframe><iframe src="http://ghbtns.com/github-btn.html?user=nostalgiaz&repo=bootstrap-switch&type=fork&count=true&size=large" allowtransparency="true" frameborder="0" scrolling="0" width="144" height="30"></iframe></p><br><p class="version">Currently v3.3.3 · Compatible with Bootstrap 2 and 3</p></div></div><div class="container"><h2 class="page-header">Getting Started</h2><p>Include the dependencies: jQuery, Bootstrap and Bootstrap Switch CSS + Javascript.</p><pre><code>[...] | ||
| <!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="x-ua-Compatible" content="ie=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="description" content="Turn checkboxes and radio buttons into toggle switches"><meta name="author" content="Mattia Larentis, Emanuele Marchi and Peter Stein"><title>Bootstrap Switch · Turn checkboxes and radio buttons into toggle switches</title><link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"><link href="css/highlight.css" rel="stylesheet"><link href="https://unpkg.com/bootstrap-switch/dist/css/bootstrap3/bootstrap-switch.css" rel="stylesheet"><link href="https://getbootstrap.com/assets/css/docs.min.css" rel="stylesheet"><link href="css/main.css" rel="stylesheet"></head><body><a href="https://github.com/Bttstrp/bootstrap-switch" id="github"><img src="https://s3.amazonaws.com/github/ribbons/forkme_right_gray_6d6d6d.png" alt="Fork me on GitHub"></a><header role="banner" class="navbar navbar-static-top bs-docs-nav"><div class="container"><div class="navbar-header"><button type="button" data-toggle="collapse" data-target="#collapse" class="navbar-toggle"><span class="sr-only">Toggle navigation</span><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></button><a href="../" class="navbar-brand">Bootstrap Switch</a></div><nav id="collapse" role="navigation" class="collapse navbar-collapse bs-navbar-collapse"><ul class="nav navbar-nav"><li><a href="https://github.com/Bttstrp/bootstrap-switch/archive/master.zip" data-toggle="dropdown">Download</a></li><li><a href="examples.html">Examples</a></li><li class="dropdown"><a href="#" data-toggle="dropdown">Documentation <span class="caret"></span></a><ul class="dropdown-menu"><li><a href="/options.html">Options</a></li><li><a href="/methods.html">Methods</a></li><li><a href="/events.html">Events</a></li><li role="presentation" class="divider"></li><li><a href="/documentation-2.html">Documentation (v2.0.1)</a></li></ul></li><li><a href="https://github.com/Bttstrp/bootstrap-switch/issues">Bug reports</a></li></ul></nav></div></header><main id="content" role="main"><div class="bs-docs-masthead"><div class="container"><h1 class="title">Bootstrap Switch</h1><p class="lead">Turn checkboxes <input type="checkbox" checked="checked" data-switch-no-init="data-switch-no-init"> and radio buttons <input type="radio" checked="checked" data-switch-no-init="data-switch-no-init"> into toggle switches <input type="checkbox" checked="checked"></p><p class="lead"><a href="https://github.com/Bttstrp/bootstrap-switch/archive/master.zip" class="btn btn-outline-inverse btn-lg">Download Bootstrap Switch</a></p><p class="bs-docs-social"><iframe src="https://ghbtns.com/github-btn.html?user=Bttstrp&repo=bootstrap-switch&type=watch&count=true&size=large" allowtransparency="true" frameborder="0" scrolling="0" width="184" height="30"></iframe><iframe src="https://ghbtns.com/github-btn.html?user=Bttstrp&repo=bootstrap-switch&type=fork&count=true&size=large" allowtransparency="true" frameborder="0" scrolling="0" width="144" height="30"></iframe></p><br><p class="version">Currently v3.3.4 · Compatible with Bootstrap 2 and 3</p></div></div><div class="container"><h2 class="page-header">Getting Started</h2><p>Include the dependencies: jQuery, Bootstrap and Bootstrap Switch CSS + Javascript.</p><pre><code>[...] | ||
| <link href="bootstrap.css" rel="stylesheet"> | ||
@@ -6,2 +6,2 @@ <link href="bootstrap-switch.css" rel="stylesheet"> | ||
| <script src="bootstrap-switch.js"></script> | ||
| [...]</code></pre><p>Add your checkbox.</p><pre><code><input type="checkbox" name="my-checkbox" checked></code></pre><p>Initialize Bootstrap Switch.</p><pre><code>$("[name='my-checkbox']").bootstrapSwitch();</code></pre><p>Enjoy.</p><div class="text-center"><a href="examples.html" class="btn btn-lg btn-primary">See Examples</a> <a href="options.html" class="btn btn-lg btn-outline">Browse Documentation</a></div></div></main><footer class="bs-docs-footer"><div class="container"><p>Code licensed under <a href="http://www.apache.org/licenses/LICENSE-2.0" target="_blank">Apache License, Version 2.0</a><br>Created by <a href="https://github.com/nostalgiaz" target="_blank">Mattia Larentis</a><br>Mantained by <a href="https://github.com/lostcrew" target="_blank">Emanuele Marchi</a></p></div></footer><script src="https://code.jquery.com/jquery-3.1.1.min.js"></script><script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script><script src="js/highlight.js"></script><script src="https://unpkg.com/bootstrap-switch"></script><script src="js/main.js"></script></body></html> | ||
| [...]</code></pre><p>Add your checkbox.</p><pre><code><input type="checkbox" name="my-checkbox" checked></code></pre><p>Initialize Bootstrap Switch.</p><pre><code>$("[name='my-checkbox']").bootstrapSwitch();</code></pre><p>Enjoy.</p><div class="text-center"><a href="examples.html" class="btn btn-lg btn-primary">See Examples</a> <a href="options.html" class="btn btn-lg btn-outline">Browse Documentation</a></div></div></main><footer class="bs-docs-footer"><div class="container"><p>Code licensed under <a href="https://www.apache.org/licenses/LICENSE-2.0" target="_blank">Apache License, Version 2.0</a><br>Created by <a href="https://github.com/nostalgiaz" target="_blank">Mattia Larentis</a><br>Mantained by <a href="https://github.com/lostcrew" target="_blank">Emanuele Marchi</a></p></div></footer><script src="https://code.jquery.com/jquery-3.1.1.min.js"></script><script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script><script src="js/highlight.js"></script><script src="https://unpkg.com/bootstrap-switch"></script><script src="js/main.js"></script></body></html> |
+0
-2
@@ -7,4 +7,2 @@ var $ = window.jQuery | ||
| console.log($) | ||
| function capitalize (string) { | ||
@@ -11,0 +9,0 @@ return string.charAt(0).toUpperCase() + string.slice(1) |
@@ -1,1 +0,1 @@ | ||
| <!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="x-ua-Compatible" content="ie=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="description" content="Turn checkboxes and radio buttons into toggle switches."><meta name="author" content="Mattia Larentis, Emanuele Marchi and Peter Stein"><title>Bootstrap Switch · Turn checkboxes and radio buttons into toggle switches</title><link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"><link href="css/highlight.css" rel="stylesheet"><link href="https://unpkg.com/bootstrap-switch/dist/css/bootstrap3/bootstrap-switch.css" rel="stylesheet"><link href="http://getbootstrap.com/assets/css/docs.min.css" rel="stylesheet"><link href="css/main.css" rel="stylesheet"></head><body><a href="https://github.com/nostalgiaz/bootstrap-switch" id="github"><img src="https://s3.amazonaws.com/github/ribbons/forkme_right_gray_6d6d6d.png" alt="Fork me on GitHub"></a><header role="banner" class="navbar navbar-static-top bs-docs-nav"><div class="container"><div class="navbar-header"><button type="button" data-toggle="collapse" data-target="#collapse" class="navbar-toggle"><span class="sr-only">Toggle navigation</span><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></button><a href="../" class="navbar-brand">Bootstrap Switch</a></div><nav id="collapse" role="navigation" class="collapse navbar-collapse bs-navbar-collapse"><ul class="nav navbar-nav"><li><a href="https://github.com/nostalgiaz/bootstrap-switch/archive/master.zip" data-toggle="dropdown">Download</a></li><li><a href="examples.html">Examples</a></li><li class="dropdown"><a href="#" data-toggle="dropdown">Documentation <span class="caret"></span></a><ul class="dropdown-menu"><li><a href="/options.html">Options</a></li><li><a href="/methods.html">Methods</a></li><li><a href="/events.html">Events</a></li><li role="presentation" class="divider"></li><li><a href="/documentation-2.html">Documentation (v2.0.1)</a></li></ul></li><li><a href="https://github.com/nostalgiaz/bootstrap-switch/issues">Bug reports</a></li></ul></nav></div></header><main id="content" role="main"><div class="bs-docs-header"><div class="container"><h1>Methods</h1></div></div><div class="container"><p>In Bootstrap Switch, every option is also a method.</p><p>If the second parameter is omitted, the method returns the current value.</p><p>You can invoke methods as follows:</p><pre><code>$('input[name="my-checkbox"]').bootstrapSwitch('state', true, true);</code></pre><h2>Additional Methods</h2><table class="table table-bordered table-striped table-responsive"><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td>toggleState</td><td>Toggle the switch state</td></tr><tr><td>toggleAnimate</td><td>Toggle the animate option</td></tr><tr><td>toggleDisabled</td><td>Toggle the disabled state</td></tr><tr><td>toggleReadonly</td><td>Toggle the readonly state</td></tr><tr><td>toggleIndeterminate</td><td>Toggle the indeterminate state</td></tr><tr><td>toggleInverse</td><td>Toggle the inverse option</td></tr><tr><td>destroy</td><td>Destroy the instance of Bootstrap Switch</td></tr></tbody></table><h2>Special Behaviours</h2><ul><li>The method <code>state</code> can receive an optional third parameter <code>skip</code>. if true, <code>switchChange</code> event is not executed. The default is false.</li><li>The method <code>toggleState</code> can receive an optional second parameter <code>skip</code>. if true, <code>switchChange</code> event is not executed. The default is false.</li><li>The method <code>wrapperClass</code> can accept a falsy value as second parameter. If so, it resets the class to its default.</li></ul></div></main><footer class="bs-docs-footer"><div class="container"><p>Code licensed under <a href="http://www.apache.org/licenses/LICENSE-2.0" target="_blank">Apache License, Version 2.0</a><br>Created by <a href="https://github.com/nostalgiaz" target="_blank">Mattia Larentis</a><br>Mantained by <a href="https://github.com/lostcrew" target="_blank">Emanuele Marchi</a></p></div></footer><script src="https://code.jquery.com/jquery-3.1.1.min.js"></script><script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script><script src="js/highlight.js"></script><script src="https://unpkg.com/bootstrap-switch"></script><script src="js/main.js"></script></body></html> | ||
| <!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="x-ua-Compatible" content="ie=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="description" content="Turn checkboxes and radio buttons into toggle switches"><meta name="author" content="Mattia Larentis, Emanuele Marchi and Peter Stein"><title>Bootstrap Switch · Turn checkboxes and radio buttons into toggle switches</title><link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"><link href="css/highlight.css" rel="stylesheet"><link href="https://unpkg.com/bootstrap-switch/dist/css/bootstrap3/bootstrap-switch.css" rel="stylesheet"><link href="https://getbootstrap.com/assets/css/docs.min.css" rel="stylesheet"><link href="css/main.css" rel="stylesheet"></head><body><a href="https://github.com/Bttstrp/bootstrap-switch" id="github"><img src="https://s3.amazonaws.com/github/ribbons/forkme_right_gray_6d6d6d.png" alt="Fork me on GitHub"></a><header role="banner" class="navbar navbar-static-top bs-docs-nav"><div class="container"><div class="navbar-header"><button type="button" data-toggle="collapse" data-target="#collapse" class="navbar-toggle"><span class="sr-only">Toggle navigation</span><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></button><a href="../" class="navbar-brand">Bootstrap Switch</a></div><nav id="collapse" role="navigation" class="collapse navbar-collapse bs-navbar-collapse"><ul class="nav navbar-nav"><li><a href="https://github.com/Bttstrp/bootstrap-switch/archive/master.zip" data-toggle="dropdown">Download</a></li><li><a href="examples.html">Examples</a></li><li class="dropdown"><a href="#" data-toggle="dropdown">Documentation <span class="caret"></span></a><ul class="dropdown-menu"><li><a href="/options.html">Options</a></li><li><a href="/methods.html">Methods</a></li><li><a href="/events.html">Events</a></li><li role="presentation" class="divider"></li><li><a href="/documentation-2.html">Documentation (v2.0.1)</a></li></ul></li><li><a href="https://github.com/Bttstrp/bootstrap-switch/issues">Bug reports</a></li></ul></nav></div></header><main id="content" role="main"><div class="bs-docs-header"><div class="container"><h1>Methods</h1></div></div><div class="container"><p>In Bootstrap Switch, every option is also a method.</p><p>If the second parameter is omitted, the method returns the current value.</p><p>You can invoke methods as follows:</p><pre><code>$('input[name="my-checkbox"]').bootstrapSwitch('state', true, true);</code></pre><h2>Additional Methods</h2><table class="table table-bordered table-striped table-responsive"><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td>toggleState</td><td>Toggle the switch state</td></tr><tr><td>toggleAnimate</td><td>Toggle the animate option</td></tr><tr><td>toggleDisabled</td><td>Toggle the disabled state</td></tr><tr><td>toggleReadonly</td><td>Toggle the readonly state</td></tr><tr><td>toggleIndeterminate</td><td>Toggle the indeterminate state</td></tr><tr><td>toggleInverse</td><td>Toggle the inverse option</td></tr><tr><td>destroy</td><td>Destroy the instance of Bootstrap Switch</td></tr></tbody></table><h2>Special Behaviours</h2><ul><li>The method <code>state</code> can receive an optional third parameter <code>skip</code>. if true, <code>switchChange</code> event is not executed. The default is false.</li><li>The method <code>toggleState</code> can receive an optional second parameter <code>skip</code>. if true, <code>switchChange</code> event is not executed. The default is false.</li><li>The method <code>wrapperClass</code> can accept a falsy value as second parameter. If so, it resets the class to its default.</li></ul></div></main><footer class="bs-docs-footer"><div class="container"><p>Code licensed under <a href="https://www.apache.org/licenses/LICENSE-2.0" target="_blank">Apache License, Version 2.0</a><br>Created by <a href="https://github.com/nostalgiaz" target="_blank">Mattia Larentis</a><br>Mantained by <a href="https://github.com/lostcrew" target="_blank">Emanuele Marchi</a></p></div></footer><script src="https://code.jquery.com/jquery-3.1.1.min.js"></script><script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script><script src="js/highlight.js"></script><script src="https://unpkg.com/bootstrap-switch"></script><script src="js/main.js"></script></body></html> |
@@ -1,2 +0,2 @@ | ||
| <!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="x-ua-Compatible" content="ie=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="description" content="Turn checkboxes and radio buttons into toggle switches."><meta name="author" content="Mattia Larentis, Emanuele Marchi and Peter Stein"><title>Bootstrap Switch · Turn checkboxes and radio buttons into toggle switches</title><link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"><link href="css/highlight.css" rel="stylesheet"><link href="https://unpkg.com/bootstrap-switch/dist/css/bootstrap3/bootstrap-switch.css" rel="stylesheet"><link href="http://getbootstrap.com/assets/css/docs.min.css" rel="stylesheet"><link href="css/main.css" rel="stylesheet"></head><body><a href="https://github.com/nostalgiaz/bootstrap-switch" id="github"><img src="https://s3.amazonaws.com/github/ribbons/forkme_right_gray_6d6d6d.png" alt="Fork me on GitHub"></a><header role="banner" class="navbar navbar-static-top bs-docs-nav"><div class="container"><div class="navbar-header"><button type="button" data-toggle="collapse" data-target="#collapse" class="navbar-toggle"><span class="sr-only">Toggle navigation</span><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></button><a href="../" class="navbar-brand">Bootstrap Switch</a></div><nav id="collapse" role="navigation" class="collapse navbar-collapse bs-navbar-collapse"><ul class="nav navbar-nav"><li><a href="https://github.com/nostalgiaz/bootstrap-switch/archive/master.zip" data-toggle="dropdown">Download</a></li><li><a href="examples.html">Examples</a></li><li class="dropdown"><a href="#" data-toggle="dropdown">Documentation <span class="caret"></span></a><ul class="dropdown-menu"><li><a href="/options.html">Options</a></li><li><a href="/methods.html">Methods</a></li><li><a href="/events.html">Events</a></li><li role="presentation" class="divider"></li><li><a href="/documentation-2.html">Documentation (v2.0.1)</a></li></ul></li><li><a href="https://github.com/nostalgiaz/bootstrap-switch/issues">Bug reports</a></li></ul></nav></div></header><main id="content" role="main"><div class="bs-docs-header"><div class="container"><h1>Options</h1></div></div><div class="container"><table class="table table-bordered table-striped table-responsive"><thead><tr><th>Name</th><th>Attribute</th><th>Type</th><th>Description</th><th>Values</th><th>Default</th></tr></thead><tbody><tr><td>state</td><td>checked</td><td>Boolean</td><td>The checkbox state</td><td>true, false</td><td>true</td></tr><tr><td>size</td><td>data-size</td><td>String</td><td>The checkbox size</td><td>null, 'mini', 'small', 'normal', 'large'</td><td>null</td></tr><tr><td>animate</td><td>data-animate</td><td>Boolean</td><td>Animate the switch</td><td>true, false</td><td>true</td></tr><tr><td>disabled</td><td>disabled</td><td>Boolean</td><td>Disable state</td><td>true, false</td><td>false</td></tr><tr><td>readonly</td><td>readonly</td><td>Boolean</td><td>Readonly state</td><td>true, false</td><td>false</td></tr><tr><td>indeterminate</td><td>data-indeterminate</td><td>Boolean</td><td>Indeterminate state</td><td>true, false</td><td>false</td></tr><tr><td>inverse</td><td>data-inverse</td><td>Boolean</td><td>Inverse switch direction</td><td>true, false</td><td>false</td></tr><tr><td>radioAllOff</td><td>data-radio-all-off</td><td>Boolean</td><td>Allow this radio button to be unchecked by the user</td><td>true, false</td><td>false</td></tr><tr><td>onColor</td><td>data-on-color</td><td>String</td><td>Color of the left side of the switch</td><td>'primary', 'info', 'success', 'warning', 'danger', 'default'</td><td>'primary'</td></tr><tr><td>offColor</td><td>data-off-color</td><td>String</td><td>Color of the right side of the switch</td><td>'primary', 'info', 'success', 'warning', 'danger', 'default'</td><td>'default'</td></tr><tr><td>onText</td><td>data-on-text</td><td>String</td><td>Text of the left side of the switch</td><td>String</td><td>'ON'</td></tr><tr><td>offText</td><td>data-off-text</td><td>String</td><td>Text of the right side of the switch</td><td>String</td><td>'OFF'</td></tr><tr><td>labelText</td><td>data-label-text</td><td>String</td><td>Text of the center handle of the switch</td><td>String</td><td>'&nbsp;'</td></tr><tr><td>handleWidth</td><td>data-handle-width</td><td>String | Number</td><td>Width of the left and right sides in pixels</td><td>'auto' or Number</td><td>'auto'</td></tr><tr><td>labelWidth</td><td>data-label-width</td><td>String | Number</td><td>Width of the center handle in pixels</td><td>'auto' or Number</td><td>'auto'</td></tr><tr><td>baseClass</td><td>data-base-class</td><td>String</td><td>Global class prefix</td><td>String</td><td>'bootstrap-switch'</td></tr><tr><td>wrapperClass</td><td>data-wrapper-class</td><td>String | Array</td><td>Container element class(es)</td><td>String | Array</td><td>'wrapper'</td></tr><tr><td>onInit</td><td></td><td>Function</td><td>Callback function to execute on initialization</td><td>Function</td><td><pre><code class="javascript">function(event, state) {}</code></pre></td></tr><tr><td>onSwitchChange</td><td></td><td>Function</td><td>Callback function to execute on switch state change. If false is returned, the status will be reverted, otherwise nothing changes</td><td>Function</td><td><pre><code class="javascript">function(event, state) {}</code></pre></td></tr></tbody></table><h2>Global Defaults Overriding</h2><p>Follow the jQuery convention to override the default options of the library. For instance:</p><pre><code>$.fn.bootstrapSwitch.defaults.size = 'large'; | ||
| $.fn.bootstrapSwitch.defaults.onColor = 'success';</code></pre></div></main><footer class="bs-docs-footer"><div class="container"><p>Code licensed under <a href="http://www.apache.org/licenses/LICENSE-2.0" target="_blank">Apache License, Version 2.0</a><br>Created by <a href="https://github.com/nostalgiaz" target="_blank">Mattia Larentis</a><br>Mantained by <a href="https://github.com/lostcrew" target="_blank">Emanuele Marchi</a></p></div></footer><script src="https://code.jquery.com/jquery-3.1.1.min.js"></script><script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script><script src="js/highlight.js"></script><script src="https://unpkg.com/bootstrap-switch"></script><script src="js/main.js"></script></body></html> | ||
| <!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="x-ua-Compatible" content="ie=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="description" content="Turn checkboxes and radio buttons into toggle switches"><meta name="author" content="Mattia Larentis, Emanuele Marchi and Peter Stein"><title>Bootstrap Switch · Turn checkboxes and radio buttons into toggle switches</title><link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"><link href="css/highlight.css" rel="stylesheet"><link href="https://unpkg.com/bootstrap-switch/dist/css/bootstrap3/bootstrap-switch.css" rel="stylesheet"><link href="https://getbootstrap.com/assets/css/docs.min.css" rel="stylesheet"><link href="css/main.css" rel="stylesheet"></head><body><a href="https://github.com/Bttstrp/bootstrap-switch" id="github"><img src="https://s3.amazonaws.com/github/ribbons/forkme_right_gray_6d6d6d.png" alt="Fork me on GitHub"></a><header role="banner" class="navbar navbar-static-top bs-docs-nav"><div class="container"><div class="navbar-header"><button type="button" data-toggle="collapse" data-target="#collapse" class="navbar-toggle"><span class="sr-only">Toggle navigation</span><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></button><a href="../" class="navbar-brand">Bootstrap Switch</a></div><nav id="collapse" role="navigation" class="collapse navbar-collapse bs-navbar-collapse"><ul class="nav navbar-nav"><li><a href="https://github.com/Bttstrp/bootstrap-switch/archive/master.zip" data-toggle="dropdown">Download</a></li><li><a href="examples.html">Examples</a></li><li class="dropdown"><a href="#" data-toggle="dropdown">Documentation <span class="caret"></span></a><ul class="dropdown-menu"><li><a href="/options.html">Options</a></li><li><a href="/methods.html">Methods</a></li><li><a href="/events.html">Events</a></li><li role="presentation" class="divider"></li><li><a href="/documentation-2.html">Documentation (v2.0.1)</a></li></ul></li><li><a href="https://github.com/Bttstrp/bootstrap-switch/issues">Bug reports</a></li></ul></nav></div></header><main id="content" role="main"><div class="bs-docs-header"><div class="container"><h1>Options</h1></div></div><div class="container"><table class="table table-bordered table-striped table-responsive"><thead><tr><th>Name</th><th>Attribute</th><th>Type</th><th>Description</th><th>Values</th><th>Default</th></tr></thead><tbody><tr><td>state</td><td>checked</td><td>Boolean</td><td>The checkbox state</td><td>true, false</td><td>true</td></tr><tr><td>size</td><td>data-size</td><td>String</td><td>The checkbox size</td><td>null, 'mini', 'small', 'normal', 'large'</td><td>null</td></tr><tr><td>animate</td><td>data-animate</td><td>Boolean</td><td>Animate the switch</td><td>true, false</td><td>true</td></tr><tr><td>disabled</td><td>disabled</td><td>Boolean</td><td>Disable state</td><td>true, false</td><td>false</td></tr><tr><td>readonly</td><td>readonly</td><td>Boolean</td><td>Readonly state</td><td>true, false</td><td>false</td></tr><tr><td>indeterminate</td><td>data-indeterminate</td><td>Boolean</td><td>Indeterminate state</td><td>true, false</td><td>false</td></tr><tr><td>inverse</td><td>data-inverse</td><td>Boolean</td><td>Inverse switch direction</td><td>true, false</td><td>false</td></tr><tr><td>radioAllOff</td><td>data-radio-all-off</td><td>Boolean</td><td>Allow this radio button to be unchecked by the user</td><td>true, false</td><td>false</td></tr><tr><td>onColor</td><td>data-on-color</td><td>String</td><td>Color of the left side of the switch</td><td>'primary', 'info', 'success', 'warning', 'danger', 'default'</td><td>'primary'</td></tr><tr><td>offColor</td><td>data-off-color</td><td>String</td><td>Color of the right side of the switch</td><td>'primary', 'info', 'success', 'warning', 'danger', 'default'</td><td>'default'</td></tr><tr><td>onText</td><td>data-on-text</td><td>String</td><td>Text of the left side of the switch</td><td>String</td><td>'ON'</td></tr><tr><td>offText</td><td>data-off-text</td><td>String</td><td>Text of the right side of the switch</td><td>String</td><td>'OFF'</td></tr><tr><td>labelText</td><td>data-label-text</td><td>String</td><td>Text of the center handle of the switch</td><td>String</td><td>'&nbsp;'</td></tr><tr><td>handleWidth</td><td>data-handle-width</td><td>String | Number</td><td>Width of the left and right sides in pixels</td><td>'auto' or Number</td><td>'auto'</td></tr><tr><td>labelWidth</td><td>data-label-width</td><td>String | Number</td><td>Width of the center handle in pixels</td><td>'auto' or Number</td><td>'auto'</td></tr><tr><td>baseClass</td><td>data-base-class</td><td>String</td><td>Global class prefix</td><td>String</td><td>'bootstrap-switch'</td></tr><tr><td>wrapperClass</td><td>data-wrapper-class</td><td>String | Array</td><td>Container element class(es)</td><td>String | Array</td><td>'wrapper'</td></tr><tr><td>onInit</td><td></td><td>Function</td><td>Callback function to execute on initialization</td><td>Function</td><td><pre><code class="javascript">function(event, state) {}</code></pre></td></tr><tr><td>onSwitchChange</td><td></td><td>Function</td><td>Callback function to execute on switch state change. If false is returned, the status will be reverted, otherwise nothing changes</td><td>Function</td><td><pre><code class="javascript">function(event, state) {}</code></pre></td></tr></tbody></table><h2>Global Defaults Overriding</h2><p>Follow the jQuery convention to override the default options of the library. For instance:</p><pre><code>$.fn.bootstrapSwitch.defaults.size = 'large'; | ||
| $.fn.bootstrapSwitch.defaults.onColor = 'success';</code></pre></div></main><footer class="bs-docs-footer"><div class="container"><p>Code licensed under <a href="https://www.apache.org/licenses/LICENSE-2.0" target="_blank">Apache License, Version 2.0</a><br>Created by <a href="https://github.com/nostalgiaz" target="_blank">Mattia Larentis</a><br>Mantained by <a href="https://github.com/lostcrew" target="_blank">Emanuele Marchi</a></p></div></footer><script src="https://code.jquery.com/jquery-3.1.1.min.js"></script><script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script><script src="js/highlight.js"></script><script src="https://unpkg.com/bootstrap-switch"></script><script src="js/main.js"></script></body></html> |
+10
-7
| { | ||
| "name": "bootstrap-switch", | ||
| "description": "Turn checkboxes and radio buttons into toggle switches.", | ||
| "version": "3.3.3", | ||
| "version": "3.3.4", | ||
| "keywords": [ | ||
@@ -11,3 +11,3 @@ "bootstrap", | ||
| ], | ||
| "homepage": "http://www.bootstrap-switch.org", | ||
| "homepage": "https://bttstrp.github.io/bootstrap-switch", | ||
| "author": "Mattia Larentis <mattia@larentis.eu> (http://larentis.eu)", | ||
@@ -21,9 +21,9 @@ "contributors": [ | ||
| "bootstrap": "^3.1.1", | ||
| "jquery": "^1.9.0" | ||
| "jquery": ">=1.9.0" | ||
| }, | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "git://github.com/nostalgiaz/bootstrap-switch.git" | ||
| "url": "git://github.com/Bttstrp/bootstrap-switch.git" | ||
| }, | ||
| "bugs": "https://github.com/nostalgiaz/bootstrap-switch/issues", | ||
| "bugs": "https://github.com/Bttstrp/bootstrap-switch/issues", | ||
| "license": "Apache-2.0", | ||
@@ -36,2 +36,3 @@ "readmeFilename": "README.md", | ||
| "babel-preset-env": "^1.1.8", | ||
| "babel-preset-stage-2": "^6.22.0", | ||
| "bootstrap": "^3.3.7", | ||
@@ -69,2 +70,5 @@ "harp": "^0.23.0", | ||
| "css": "run-p css:build", | ||
| "docs:build": "harp compile src/docs docs", | ||
| "docs": "run-p docs:build", | ||
| "publish-docs": "git subtree push --prefix docs origin gh-pages", | ||
| "clean": "rm -rf dist", | ||
@@ -74,4 +78,3 @@ "lint": "run-p js:lint", | ||
| "build": "run-p *:build", | ||
| "docs": "harp compile src/docs docs", | ||
| "prepublish": "run-s clean lint test build docs", | ||
| "prepublish": "run-s clean lint test build", | ||
| "start": "run-s prepublish" | ||
@@ -78,0 +81,0 @@ }, |
+24
-46
| # Bootstrap Switch | ||
| [](https://david-dm.org/nostalgiaz/bootstrap-switch) | ||
| [](https://david-dm.org/nostalgiaz/bootstrap-switch#info=devDependencies) | ||
| [](https://david-dm.org/Bttstrp/bootstrap-switch) | ||
| [](https://david-dm.org/Bttstrp/bootstrap-switch#info=devDependencies) | ||
| [](https://www.npmjs.org/) | ||
| Turn checkboxes and radio buttons into toggle switches. | ||
| This library is created by [Mattia Larentis](http://github.com/nostalgiaz) and maintained by the core team, with the help of the community. | ||
| Turn checkboxes and radio buttons into toggle switches. Created by [Mattia Larentis](http://github.com/nostalgiaz), maintained by [Emanuele Marchi](http://github.com/lostcrew) and [Peter Stein](http://www.bdmdesign.org) with the help of the community. | ||
| To get started, check out [http://bootstrap-switch.org](http://bootstrap-switch.org)! | ||
| To get started, check out [https://bttstrp.github.io/bootstrap-switch](https://bttstrp.github.io/bootstrap-switch)! | ||
| #### Core team | ||
| - [Mattia Larentis](http://github.com/nostalgiaz) | ||
| - [Emanuele Marchi](http://github.com/lostcrew) | ||
| - **you?** drop me a line. | ||
| ## Quick start | ||
| Several quick start options are available: | ||
| ## Demo and Documentation | ||
| - Download the [latest release](https://github.com/Bttstrp/bootstrap-switch/releases/latest) | ||
| - Clone the repo: `git clone https://github.com/Bttstrp/bootstrap-switch.git` | ||
| - Install with npm: `npm install bootstrap-switch` | ||
| - Install with yarn: `yarn add bootstrap-switch` | ||
| - Install with Composer: `composer require components/bootstrap-switch` | ||
| - Install with Bower: `bower install bootstrap-switch` | ||
| - Install with NuGet: `PM> Install-Package Bootstrap.Switch` ([NuGet package](https://github.com/blachniet/bootstrap-switch-nuget)) | ||
| - [Examples](http://www.bootstrap-switch.org/examples.html) | ||
| - [Options](http://www.bootstrap-switch.org/options.html) | ||
| - [Methods](http://www.bootstrap-switch.org/methods.html) | ||
| - [Events](http://www.bootstrap-switch.org/events.html) | ||
| ## Getting started | ||
| Include the dependencies: jQuery, Bootstrap and Bootstrap Switch CSS + Javascript: | ||
| ``` html | ||
| [...] | ||
| <link href="bootstrap.css" rel="stylesheet"> | ||
@@ -35,3 +29,2 @@ <link href="bootstrap-switch.css" rel="stylesheet"> | ||
| <script src="bootstrap-switch.js"></script> | ||
| [...] | ||
| ``` | ||
@@ -53,3 +46,2 @@ | ||
| ## Supported browsers | ||
@@ -59,11 +51,10 @@ | ||
| ## LESS | ||
| ## LESS + SASS | ||
| - For Bootstrap 2 (no longer officially supported), import `src/less/bootstrap2/bootstrap-switch.less` | ||
| - For Bootstrap 3, import `src/less/bootstrap3/bootstrap-switch.less` | ||
| Import `src/less/bootstrap2/bootstrap-switch.less` for version <= 2.3.2 or `src/less/bootstrap3/bootstrap-switch.less` for version <= 3.3.4 in your compilation stack. | ||
| ## Bugs and feature requests | ||
| Have a bug or a feature request? Please first search for existing and closed issues. If your problem or idea is not addressed yet, [please open a new issue](https://github.com/nostalgiaz/bootstrap-switch/issues/new). | ||
| Have a bug or a feature request? Please first search for existing and closed issues. If your problem or idea is not addressed yet, [please open a new issue](https://github.com/Bttstrp/bootstrap-switch/issues/new). | ||
@@ -73,30 +64,17 @@ The new issue should contain both a summary of the issue and the browser/OS environment in which it occurs and a link to the playground you prefer with the reduced test case. | ||
| Please do not use the issue tracker for personal support requests: [Stack Overflow](http://stackoverflow.com/questions/tagged/bootstrap-switch) is a better place to get help. | ||
| Please do not use the issue tracker for personal support requests: [Stack Overflow](https://stackoverflow.com/questions/tagged/bootstrap-switch) is a better place to get help. | ||
| #### Known issues | ||
| ### Known issues | ||
| - Make sure `.form-control` is not applied to the input. Bootstrap does not support that, refer to [Checkboxes and radios](http://getbootstrap.com/css/#checkboxes-and-radios) | ||
| - Make sure `.form-control` is not applied to the input. Bootstrap does not support that, refer to [Checkboxes and radios](https://getbootstrap.com/css/#checkboxes-and-radios) | ||
| ## Integrations | ||
| ### AngularJs | ||
| - Angular: [angular-bootstrap-switch](https://github.com/frapontillo/angular-bootstrap-switch) | ||
| - Angular: [angular-toggle-switch](https://github.com/JumpLink/angular-toggle-switch) | ||
| - Knockout: [knockout-bootstrap-switch](https://github.com/pauloortins/knockout-bootstrap-switch) | ||
| Two custom directives are available: | ||
| - [angular-bootstrap-switch](https://github.com/frapontillo/angular-bootstrap-switch) | ||
| - [angular-toggle-switch](https://github.com/JumpLink/angular-toggle-switch) | ||
| ### KnockoutJs | ||
| A Knockout binding handler is available [here](https://github.com/pauloortins/knockout-bootstrap-switch) | ||
| ### NuGet | ||
| A NuGet package is available [here](https://github.com/blachniet/bootstrap-switch-nuget) | ||
| ## License | ||
| Licensed under the MIT License | ||
| [https://github.com/nostalgiaz/bootstrap-switch/issues/347](https://github.com/nostalgiaz/bootstrap-switch/issues/347) | ||
| Licensed under the [MIT License](https://github.com/Bttstrp/bootstrap-switch/blob/master/LICENSE). | ||
+533
-534
@@ -1,615 +0,614 @@ | ||
| (function ($, window) { | ||
| class BootstrapSwitch { | ||
| constructor (element, options = {}) { | ||
| this.$element = $(element) | ||
| this.options = $.extend( | ||
| {}, | ||
| $.fn.bootstrapSwitch.defaults, | ||
| this._getElementOptions(), | ||
| options | ||
| ) | ||
| this.prevOptions = {} | ||
| this.$wrapper = $('<div>', { | ||
| class: () => { | ||
| const classes = [] | ||
| classes.push(this.options.state ? 'on' : 'off') | ||
| if (this.options.size) { | ||
| classes.push(this.options.size) | ||
| } | ||
| if (this.options.disabled) { | ||
| classes.push('disabled') | ||
| } | ||
| if (this.options.readonly) { | ||
| classes.push('readonly') | ||
| } | ||
| if (this.options.indeterminate) { | ||
| classes.push('indeterminate') | ||
| } | ||
| if (this.options.inverse) { | ||
| classes.push('inverse') | ||
| } | ||
| if (this.$element.attr('id')) { | ||
| classes.push(`id-${this.$element.attr('id')}`) | ||
| } | ||
| return classes | ||
| .map(this._getClass.bind(this)) | ||
| .concat([this.options.baseClass], this._getClasses(this.options.wrapperClass)) | ||
| .join(' ') | ||
| import jquery from 'jquery' | ||
| const $ = jquery || window.jQuery || window.$ | ||
| class BootstrapSwitch { | ||
| constructor (element, options = {}) { | ||
| this.$element = $(element) | ||
| this.options = $.extend( | ||
| {}, | ||
| $.fn.bootstrapSwitch.defaults, | ||
| this._getElementOptions(), | ||
| options | ||
| ) | ||
| this.prevOptions = {} | ||
| this.$wrapper = $('<div>', { | ||
| class: () => { | ||
| const classes = [] | ||
| classes.push(this.options.state ? 'on' : 'off') | ||
| if (this.options.size) { | ||
| classes.push(this.options.size) | ||
| } | ||
| }) | ||
| this.$container = $('<div>', { class: this._getClass('container') }) | ||
| this.$on = $('<span>', { | ||
| html: this.options.onText, | ||
| class: `${this._getClass('handle-on')} ${this._getClass(this.options.onColor)}` | ||
| }) | ||
| this.$off = $('<span>', { | ||
| html: this.options.offText, | ||
| class: `${this._getClass('handle-off')} ${this._getClass(this.options.offColor)}` | ||
| }) | ||
| this.$label = $('<span>', { | ||
| html: this.options.labelText, | ||
| class: this._getClass('label') | ||
| }) | ||
| if (this.options.disabled) { | ||
| classes.push('disabled') | ||
| } | ||
| if (this.options.readonly) { | ||
| classes.push('readonly') | ||
| } | ||
| if (this.options.indeterminate) { | ||
| classes.push('indeterminate') | ||
| } | ||
| if (this.options.inverse) { | ||
| classes.push('inverse') | ||
| } | ||
| if (this.$element.attr('id')) { | ||
| classes.push(`id-${this.$element.attr('id')}`) | ||
| } | ||
| return classes | ||
| .map(this._getClass.bind(this)) | ||
| .concat([this.options.baseClass], this._getClasses(this.options.wrapperClass)) | ||
| .join(' ') | ||
| } | ||
| }) | ||
| this.$container = $('<div>', { class: this._getClass('container') }) | ||
| this.$on = $('<span>', { | ||
| html: this.options.onText, | ||
| class: `${this._getClass('handle-on')} ${this._getClass(this.options.onColor)}` | ||
| }) | ||
| this.$off = $('<span>', { | ||
| html: this.options.offText, | ||
| class: `${this._getClass('handle-off')} ${this._getClass(this.options.offColor)}` | ||
| }) | ||
| this.$label = $('<span>', { | ||
| html: this.options.labelText, | ||
| class: this._getClass('label') | ||
| }) | ||
| this.$element.on('init.bootstrapSwitch', this.options.onInit.bind(this, element)) | ||
| this.$element.on('switchChange.bootstrapSwitch', (...args) => { | ||
| if (this.options.onSwitchChange.apply(element, args) === false) { | ||
| if (this.$element.is(':radio')) { | ||
| $(`[name="${this.$element.attr('name')}"]`).trigger('previousState.bootstrapSwitch', true) | ||
| } else { | ||
| this.$element.trigger('previousState.bootstrapSwitch', true) | ||
| } | ||
| this.$element.on('init.bootstrapSwitch', this.options.onInit.bind(this, element)) | ||
| this.$element.on('switchChange.bootstrapSwitch', (...args) => { | ||
| if (this.options.onSwitchChange.apply(element, args) === false) { | ||
| if (this.$element.is(':radio')) { | ||
| $(`[name="${this.$element.attr('name')}"]`).trigger('previousState.bootstrapSwitch', true) | ||
| } else { | ||
| this.$element.trigger('previousState.bootstrapSwitch', true) | ||
| } | ||
| }) | ||
| this.$container = this.$element.wrap(this.$container).parent() | ||
| this.$wrapper = this.$container.wrap(this.$wrapper).parent() | ||
| this.$element | ||
| .before(this.options.inverse ? this.$off : this.$on) | ||
| .before(this.$label) | ||
| .before(this.options.inverse ? this.$on : this.$off) | ||
| if (this.options.indeterminate) { | ||
| this.$element.prop('indeterminate', true) | ||
| } | ||
| }) | ||
| this._init() | ||
| this._elementHandlers() | ||
| this._handleHandlers() | ||
| this._labelHandlers() | ||
| this._formHandler() | ||
| this._externalLabelHandler() | ||
| this.$element.trigger('init.bootstrapSwitch', this.options.state) | ||
| } | ||
| this.$container = this.$element.wrap(this.$container).parent() | ||
| this.$wrapper = this.$container.wrap(this.$wrapper).parent() | ||
| this.$element | ||
| .before(this.options.inverse ? this.$off : this.$on) | ||
| .before(this.$label) | ||
| .before(this.options.inverse ? this.$on : this.$off) | ||
| setPrevOptions () { | ||
| this.prevOptions = Object.assign({}, this.options) | ||
| if (this.options.indeterminate) { | ||
| this.$element.prop('indeterminate', true) | ||
| } | ||
| state (value, skip) { | ||
| if (typeof value === 'undefined') { return this.options.state } | ||
| if ( | ||
| (this.options.disabled || this.options.readonly) || | ||
| (this.options.state && !this.options.radioAllOff && this.$element.is(':radio')) | ||
| ) { return this.$element } | ||
| if (this.$element.is(':radio')) { | ||
| $(`[name="${this.$element.attr('name')}"]`).trigger('setPreviousOptions.bootstrapSwitch') | ||
| } else { | ||
| this.$element.trigger('setPreviousOptions.bootstrapSwitch') | ||
| } | ||
| if (this.options.indeterminate) { | ||
| this.indeterminate(false) | ||
| } | ||
| this.$element | ||
| .prop('checked', Boolean(value)) | ||
| .trigger('change.bootstrapSwitch', skip) | ||
| return this.$element | ||
| } | ||
| this._init() | ||
| this._elementHandlers() | ||
| this._handleHandlers() | ||
| this._labelHandlers() | ||
| this._formHandler() | ||
| this._externalLabelHandler() | ||
| this.$element.trigger('init.bootstrapSwitch', this.options.state) | ||
| } | ||
| toggleState (skip) { | ||
| if (this.options.disabled || this.options.readonly) { return this.$element } | ||
| if (this.options.indeterminate) { | ||
| this.indeterminate(false) | ||
| return this.state(true) | ||
| } else { | ||
| return this.$element.prop('checked', !this.options.state).trigger('change.bootstrapSwitch', skip) | ||
| } | ||
| } | ||
| setPrevOptions () { | ||
| this.prevOptions = { ...this.options } | ||
| } | ||
| size (value) { | ||
| if (typeof value === 'undefined') { return this.options.size } | ||
| if (this.options.size != null) { | ||
| this.$wrapper.removeClass(this._getClass(this.options.size)) | ||
| } | ||
| if (value) { | ||
| this.$wrapper.addClass(this._getClass(value)) | ||
| } | ||
| this._width() | ||
| this._containerPosition() | ||
| this.options.size = value | ||
| return this.$element | ||
| state (value, skip) { | ||
| if (typeof value === 'undefined') { return this.options.state } | ||
| if ( | ||
| (this.options.disabled || this.options.readonly) || | ||
| (this.options.state && !this.options.radioAllOff && this.$element.is(':radio')) | ||
| ) { return this.$element } | ||
| if (this.$element.is(':radio')) { | ||
| $(`[name="${this.$element.attr('name')}"]`).trigger('setPreviousOptions.bootstrapSwitch') | ||
| } else { | ||
| this.$element.trigger('setPreviousOptions.bootstrapSwitch') | ||
| } | ||
| animate (value) { | ||
| if (typeof value === 'undefined') { return this.options.animate } | ||
| if (this.options.animate === Boolean(value)) { return this.$element } | ||
| return this.toggleAnimate() | ||
| if (this.options.indeterminate) { | ||
| this.indeterminate(false) | ||
| } | ||
| this.$element | ||
| .prop('checked', Boolean(value)) | ||
| .trigger('change.bootstrapSwitch', skip) | ||
| return this.$element | ||
| } | ||
| toggleAnimate () { | ||
| this.options.animate = !this.options.animate | ||
| this.$wrapper.toggleClass(this._getClass('animate')) | ||
| return this.$element | ||
| toggleState (skip) { | ||
| if (this.options.disabled || this.options.readonly) { return this.$element } | ||
| if (this.options.indeterminate) { | ||
| this.indeterminate(false) | ||
| return this.state(true) | ||
| } else { | ||
| return this.$element.prop('checked', !this.options.state).trigger('change.bootstrapSwitch', skip) | ||
| } | ||
| } | ||
| disabled (value) { | ||
| if (typeof value === 'undefined') { return this.options.disabled } | ||
| if (this.options.disabled === Boolean(value)) { return this.$element } | ||
| return this.toggleDisabled() | ||
| size (value) { | ||
| if (typeof value === 'undefined') { return this.options.size } | ||
| if (this.options.size != null) { | ||
| this.$wrapper.removeClass(this._getClass(this.options.size)) | ||
| } | ||
| toggleDisabled () { | ||
| this.options.disabled = !this.options.disabled | ||
| this.$element.prop('disabled', this.options.disabled) | ||
| this.$wrapper.toggleClass(this._getClass('disabled')) | ||
| return this.$element | ||
| if (value) { | ||
| this.$wrapper.addClass(this._getClass(value)) | ||
| } | ||
| this._width() | ||
| this._containerPosition() | ||
| this.options.size = value | ||
| return this.$element | ||
| } | ||
| readonly (value) { | ||
| if (typeof value === 'undefined') { return this.options.readonly } | ||
| if (this.options.readonly === Boolean(value)) { return this.$element } | ||
| return this.toggleReadonly() | ||
| } | ||
| animate (value) { | ||
| if (typeof value === 'undefined') { return this.options.animate } | ||
| if (this.options.animate === Boolean(value)) { return this.$element } | ||
| return this.toggleAnimate() | ||
| } | ||
| toggleReadonly () { | ||
| this.options.readonly = !this.options.readonly | ||
| this.$element.prop('readonly', this.options.readonly) | ||
| this.$wrapper.toggleClass(this._getClass('readonly')) | ||
| return this.$element | ||
| } | ||
| toggleAnimate () { | ||
| this.options.animate = !this.options.animate | ||
| this.$wrapper.toggleClass(this._getClass('animate')) | ||
| return this.$element | ||
| } | ||
| indeterminate (value) { | ||
| if (typeof value === 'undefined') { return this.options.indeterminate } | ||
| if (this.options.indeterminate === Boolean(value)) { return this.$element } | ||
| return this.toggleIndeterminate() | ||
| } | ||
| disabled (value) { | ||
| if (typeof value === 'undefined') { return this.options.disabled } | ||
| if (this.options.disabled === Boolean(value)) { return this.$element } | ||
| return this.toggleDisabled() | ||
| } | ||
| toggleIndeterminate () { | ||
| this.options.indeterminate = !this.options.indeterminate | ||
| this.$element.prop('indeterminate', this.options.indeterminate) | ||
| this.$wrapper.toggleClass(this._getClass('indeterminate')) | ||
| this._containerPosition() | ||
| return this.$element | ||
| } | ||
| toggleDisabled () { | ||
| this.options.disabled = !this.options.disabled | ||
| this.$element.prop('disabled', this.options.disabled) | ||
| this.$wrapper.toggleClass(this._getClass('disabled')) | ||
| return this.$element | ||
| } | ||
| inverse (value) { | ||
| if (typeof value === 'undefined') { return this.options.inverse } | ||
| if (this.options.inverse === Boolean(value)) { return this.$element } | ||
| return this.toggleInverse() | ||
| } | ||
| readonly (value) { | ||
| if (typeof value === 'undefined') { return this.options.readonly } | ||
| if (this.options.readonly === Boolean(value)) { return this.$element } | ||
| return this.toggleReadonly() | ||
| } | ||
| toggleInverse () { | ||
| this.$wrapper.toggleClass(this._getClass('inverse')) | ||
| const $on = this.$on.clone(true) | ||
| const $off = this.$off.clone(true) | ||
| this.$on.replaceWith($off) | ||
| this.$off.replaceWith($on) | ||
| this.$on = $off | ||
| this.$off = $on | ||
| this.options.inverse = !this.options.inverse | ||
| return this.$element | ||
| } | ||
| toggleReadonly () { | ||
| this.options.readonly = !this.options.readonly | ||
| this.$element.prop('readonly', this.options.readonly) | ||
| this.$wrapper.toggleClass(this._getClass('readonly')) | ||
| return this.$element | ||
| } | ||
| onColor (value) { | ||
| if (typeof value === 'undefined') { return this.options.onColor } | ||
| if (this.options.onColor) { | ||
| this.$on.removeClass(this._getClass(this.options.onColor)) | ||
| } | ||
| this.$on.addClass(this._getClass(value)) | ||
| this.options.onColor = value | ||
| return this.$element | ||
| } | ||
| indeterminate (value) { | ||
| if (typeof value === 'undefined') { return this.options.indeterminate } | ||
| if (this.options.indeterminate === Boolean(value)) { return this.$element } | ||
| return this.toggleIndeterminate() | ||
| } | ||
| offColor (value) { | ||
| if (typeof value === 'undefined') { return this.options.offColor } | ||
| if (this.options.offColor) { | ||
| this.$off.removeClass(this._getClass(this.options.offColor)) | ||
| } | ||
| this.$off.addClass(this._getClass(value)) | ||
| this.options.offColor = value | ||
| return this.$element | ||
| } | ||
| toggleIndeterminate () { | ||
| this.options.indeterminate = !this.options.indeterminate | ||
| this.$element.prop('indeterminate', this.options.indeterminate) | ||
| this.$wrapper.toggleClass(this._getClass('indeterminate')) | ||
| this._containerPosition() | ||
| return this.$element | ||
| } | ||
| onText (value) { | ||
| if (typeof value === 'undefined') { return this.options.onText } | ||
| this.$on.html(value) | ||
| this._width() | ||
| this._containerPosition() | ||
| this.options.onText = value | ||
| return this.$element | ||
| } | ||
| inverse (value) { | ||
| if (typeof value === 'undefined') { return this.options.inverse } | ||
| if (this.options.inverse === Boolean(value)) { return this.$element } | ||
| return this.toggleInverse() | ||
| } | ||
| offText (value) { | ||
| if (typeof value === 'undefined') { return this.options.offText } | ||
| this.$off.html(value) | ||
| this._width() | ||
| this._containerPosition() | ||
| this.options.offText = value | ||
| return this.$element | ||
| } | ||
| toggleInverse () { | ||
| this.$wrapper.toggleClass(this._getClass('inverse')) | ||
| const $on = this.$on.clone(true) | ||
| const $off = this.$off.clone(true) | ||
| this.$on.replaceWith($off) | ||
| this.$off.replaceWith($on) | ||
| this.$on = $off | ||
| this.$off = $on | ||
| this.options.inverse = !this.options.inverse | ||
| return this.$element | ||
| } | ||
| labelText (value) { | ||
| if (typeof value === 'undefined') { return this.options.labelText } | ||
| this.$label.html(value) | ||
| this._width() | ||
| this.options.labelText = value | ||
| return this.$element | ||
| onColor (value) { | ||
| if (typeof value === 'undefined') { return this.options.onColor } | ||
| if (this.options.onColor) { | ||
| this.$on.removeClass(this._getClass(this.options.onColor)) | ||
| } | ||
| this.$on.addClass(this._getClass(value)) | ||
| this.options.onColor = value | ||
| return this.$element | ||
| } | ||
| handleWidth (value) { | ||
| if (typeof value === 'undefined') { return this.options.handleWidth } | ||
| this.options.handleWidth = value | ||
| this._width() | ||
| this._containerPosition() | ||
| return this.$element | ||
| offColor (value) { | ||
| if (typeof value === 'undefined') { return this.options.offColor } | ||
| if (this.options.offColor) { | ||
| this.$off.removeClass(this._getClass(this.options.offColor)) | ||
| } | ||
| this.$off.addClass(this._getClass(value)) | ||
| this.options.offColor = value | ||
| return this.$element | ||
| } | ||
| labelWidth (value) { | ||
| if (typeof value === 'undefined') { return this.options.labelWidth } | ||
| this.options.labelWidth = value | ||
| this._width() | ||
| this._containerPosition() | ||
| return this.$element | ||
| } | ||
| onText (value) { | ||
| if (typeof value === 'undefined') { return this.options.onText } | ||
| this.$on.html(value) | ||
| this._width() | ||
| this._containerPosition() | ||
| this.options.onText = value | ||
| return this.$element | ||
| } | ||
| baseClass (value) { | ||
| return this.options.baseClass | ||
| } | ||
| offText (value) { | ||
| if (typeof value === 'undefined') { return this.options.offText } | ||
| this.$off.html(value) | ||
| this._width() | ||
| this._containerPosition() | ||
| this.options.offText = value | ||
| return this.$element | ||
| } | ||
| wrapperClass (value) { | ||
| if (typeof value === 'undefined') { return this.options.wrapperClass } | ||
| if (!value) { | ||
| value = $.fn.bootstrapSwitch.defaults.wrapperClass | ||
| } | ||
| this.$wrapper.removeClass(this._getClasses(this.options.wrapperClass).join(' ')) | ||
| this.$wrapper.addClass(this._getClasses(value).join(' ')) | ||
| this.options.wrapperClass = value | ||
| return this.$element | ||
| labelText (value) { | ||
| if (typeof value === 'undefined') { return this.options.labelText } | ||
| this.$label.html(value) | ||
| this._width() | ||
| this.options.labelText = value | ||
| return this.$element | ||
| } | ||
| handleWidth (value) { | ||
| if (typeof value === 'undefined') { return this.options.handleWidth } | ||
| this.options.handleWidth = value | ||
| this._width() | ||
| this._containerPosition() | ||
| return this.$element | ||
| } | ||
| labelWidth (value) { | ||
| if (typeof value === 'undefined') { return this.options.labelWidth } | ||
| this.options.labelWidth = value | ||
| this._width() | ||
| this._containerPosition() | ||
| return this.$element | ||
| } | ||
| baseClass (value) { | ||
| return this.options.baseClass | ||
| } | ||
| wrapperClass (value) { | ||
| if (typeof value === 'undefined') { return this.options.wrapperClass } | ||
| if (!value) { | ||
| value = $.fn.bootstrapSwitch.defaults.wrapperClass | ||
| } | ||
| this.$wrapper.removeClass(this._getClasses(this.options.wrapperClass).join(' ')) | ||
| this.$wrapper.addClass(this._getClasses(value).join(' ')) | ||
| this.options.wrapperClass = value | ||
| return this.$element | ||
| } | ||
| radioAllOff (value) { | ||
| if (typeof value === 'undefined') { return this.options.radioAllOff } | ||
| const val = Boolean(value) | ||
| if (this.options.radioAllOff === val) { return this.$element } | ||
| this.options.radioAllOff = val | ||
| return this.$element | ||
| radioAllOff (value) { | ||
| if (typeof value === 'undefined') { return this.options.radioAllOff } | ||
| const val = Boolean(value) | ||
| if (this.options.radioAllOff === val) { return this.$element } | ||
| this.options.radioAllOff = val | ||
| return this.$element | ||
| } | ||
| onInit (value) { | ||
| if (typeof value === 'undefined') { return this.options.onInit } | ||
| if (!value) { | ||
| value = $.fn.bootstrapSwitch.defaults.onInit | ||
| } | ||
| this.options.onInit = value | ||
| return this.$element | ||
| } | ||
| onInit (value) { | ||
| if (typeof value === 'undefined') { return this.options.onInit } | ||
| if (!value) { | ||
| value = $.fn.bootstrapSwitch.defaults.onInit | ||
| } | ||
| this.options.onInit = value | ||
| return this.$element | ||
| onSwitchChange (value) { | ||
| if (typeof value === 'undefined') { | ||
| return this.options.onSwitchChange | ||
| } | ||
| if (!value) { | ||
| value = $.fn.bootstrapSwitch.defaults.onSwitchChange | ||
| } | ||
| this.options.onSwitchChange = value | ||
| return this.$element | ||
| } | ||
| onSwitchChange (value) { | ||
| if (typeof value === 'undefined') { | ||
| return this.options.onSwitchChange | ||
| } | ||
| if (!value) { | ||
| value = $.fn.bootstrapSwitch.defaults.onSwitchChange | ||
| } | ||
| this.options.onSwitchChange = value | ||
| return this.$element | ||
| destroy () { | ||
| const $form = this.$element.closest('form') | ||
| if ($form.length) { | ||
| $form.off('reset.bootstrapSwitch').removeData('bootstrap-switch') | ||
| } | ||
| this.$container | ||
| .children() | ||
| .not(this.$element) | ||
| .remove() | ||
| this.$element | ||
| .unwrap() | ||
| .unwrap() | ||
| .off('.bootstrapSwitch') | ||
| .removeData('bootstrap-switch') | ||
| return this.$element | ||
| } | ||
| destroy () { | ||
| const $form = this.$element.closest('form') | ||
| if ($form.length) { | ||
| $form.off('reset.bootstrapSwitch').removeData('bootstrap-switch') | ||
| } | ||
| this.$container | ||
| .children() | ||
| .not(this.$element) | ||
| .remove() | ||
| this.$element | ||
| .unwrap() | ||
| .unwrap() | ||
| .off('.bootstrapSwitch') | ||
| .removeData('bootstrap-switch') | ||
| return this.$element | ||
| _getElementOptions () { | ||
| return { | ||
| state: this.$element.is(':checked'), | ||
| size: this.$element.data('size'), | ||
| animate: this.$element.data('animate'), | ||
| disabled: this.$element.is(':disabled'), | ||
| readonly: this.$element.is('[readonly]'), | ||
| indeterminate: this.$element.data('indeterminate'), | ||
| inverse: this.$element.data('inverse'), | ||
| radioAllOff: this.$element.data('radio-all-off'), | ||
| onColor: this.$element.data('on-color'), | ||
| offColor: this.$element.data('off-color'), | ||
| onText: this.$element.data('on-text'), | ||
| offText: this.$element.data('off-text'), | ||
| labelText: this.$element.data('label-text'), | ||
| handleWidth: this.$element.data('handle-width'), | ||
| labelWidth: this.$element.data('label-width'), | ||
| baseClass: this.$element.data('base-class'), | ||
| wrapperClass: this.$element.data('wrapper-class') | ||
| } | ||
| } | ||
| _getElementOptions () { | ||
| return { | ||
| state: this.$element.is(':checked'), | ||
| size: this.$element.data('size'), | ||
| animate: this.$element.data('animate'), | ||
| disabled: this.$element.is(':disabled'), | ||
| readonly: this.$element.is('[readonly]'), | ||
| indeterminate: this.$element.data('indeterminate'), | ||
| inverse: this.$element.data('inverse'), | ||
| radioAllOff: this.$element.data('radio-all-off'), | ||
| onColor: this.$element.data('on-color'), | ||
| offColor: this.$element.data('off-color'), | ||
| onText: this.$element.data('on-text'), | ||
| offText: this.$element.data('off-text'), | ||
| labelText: this.$element.data('label-text'), | ||
| handleWidth: this.$element.data('handle-width'), | ||
| labelWidth: this.$element.data('label-width'), | ||
| baseClass: this.$element.data('base-class'), | ||
| wrapperClass: this.$element.data('wrapper-class') | ||
| _width () { | ||
| const $handles = this.$on | ||
| .add(this.$off) | ||
| .add(this.$label) | ||
| .css('width', '') | ||
| const handleWidth = this.options.handleWidth === 'auto' | ||
| ? Math.round(Math.max(this.$on.width(), this.$off.width())) | ||
| : this.options.handleWidth | ||
| $handles.width(handleWidth) | ||
| this.$label.width((index, width) => { | ||
| if (this.options.labelWidth !== 'auto') { return this.options.labelWidth } | ||
| if (width < handleWidth) { return handleWidth } | ||
| return width | ||
| }) | ||
| this._handleWidth = this.$on.outerWidth() | ||
| this._labelWidth = this.$label.outerWidth() | ||
| this.$container.width((this._handleWidth * 2) + this._labelWidth) | ||
| return this.$wrapper.width(this._handleWidth + this._labelWidth) | ||
| } | ||
| _containerPosition (state = this.options.state, callback) { | ||
| this.$container.css('margin-left', () => { | ||
| const values = [0, `-${this._handleWidth}px`] | ||
| if (this.options.indeterminate) { | ||
| return `-${this._handleWidth / 2}px` | ||
| } | ||
| } | ||
| _width () { | ||
| const $handles = this.$on | ||
| .add(this.$off) | ||
| .add(this.$label) | ||
| .css('width', '') | ||
| let handleWidth | ||
| if (this.options.handleWidth === 'auto') { | ||
| handleWidth = Math.round(Math.max(this.$on.width(), this.$off.width())) | ||
| if (state) { | ||
| if (this.options.inverse) { | ||
| return values[1] | ||
| } else { | ||
| return values[0] | ||
| } | ||
| } else { | ||
| handleWidth = this.options.handleWidth | ||
| if (this.options.inverse) { | ||
| return values[0] | ||
| } else { | ||
| return values[1] | ||
| } | ||
| } | ||
| $handles.width(handleWidth) | ||
| this.$label.width((index, width) => { | ||
| if (this.options.labelWidth !== 'auto') { return this.options.labelWidth } | ||
| if (width < handleWidth) { return handleWidth } | ||
| return width | ||
| }) | ||
| this._handleWidth = this.$on.outerWidth() | ||
| this._labelWidth = this.$label.outerWidth() | ||
| this.$container.width((this._handleWidth * 2) + this._labelWidth) | ||
| return this.$wrapper.width(this._handleWidth + this._labelWidth) | ||
| } | ||
| }) | ||
| } | ||
| _containerPosition (state = this.options.state, callback) { | ||
| this.$container.css('margin-left', () => { | ||
| const values = [0, `-${this._handleWidth}px`] | ||
| if (this.options.indeterminate) { | ||
| return `-${this._handleWidth / 2}px` | ||
| _init () { | ||
| const init = () => { | ||
| this.setPrevOptions() | ||
| this._width() | ||
| this._containerPosition() | ||
| setTimeout(() => { | ||
| if (this.options.animate) { | ||
| return this.$wrapper.addClass(this._getClass('animate')) | ||
| } | ||
| if (state) { | ||
| if (this.options.inverse) { | ||
| return values[1] | ||
| } else { | ||
| return values[0] | ||
| } | ||
| } else { | ||
| if (this.options.inverse) { | ||
| return values[0] | ||
| } else { | ||
| return values[1] | ||
| } | ||
| } | ||
| }) | ||
| }, 50) | ||
| } | ||
| _init () { | ||
| const init = () => { | ||
| this.setPrevOptions() | ||
| this._width() | ||
| this._containerPosition() | ||
| setTimeout(() => { | ||
| if (this.options.animate) { | ||
| return this.$wrapper.addClass(this._getClass('animate')) | ||
| } | ||
| }, 50) | ||
| } | ||
| if (this.$wrapper.is(':visible')) { | ||
| init() | ||
| return | ||
| } | ||
| const initInterval = window.setInterval(() => { | ||
| if (this.$wrapper.is(':visible')) { | ||
| init() | ||
| return | ||
| return window.clearInterval(initInterval) | ||
| } | ||
| const initInterval = window.setInterval(() => { | ||
| if (this.$wrapper.is(':visible')) { | ||
| init() | ||
| return window.clearInterval(initInterval) | ||
| } | ||
| }, 50) | ||
| } | ||
| }, 50) | ||
| } | ||
| _elementHandlers () { | ||
| return this.$element.on({ | ||
| 'setPreviousOptions.bootstrapSwitch': this.setPrevOptions.bind(this), | ||
| _elementHandlers () { | ||
| return this.$element.on({ | ||
| 'setPreviousOptions.bootstrapSwitch': this.setPrevOptions.bind(this), | ||
| 'previousState.bootstrapSwitch': () => { | ||
| this.options = this.prevOptions | ||
| if (this.options.indeterminate) { | ||
| this.$wrapper.addClass(this._getClass('indeterminate')) | ||
| } | ||
| this.$element | ||
| .prop('checked', this.options.state) | ||
| .trigger('change.bootstrapSwitch', true) | ||
| }, | ||
| 'previousState.bootstrapSwitch': () => { | ||
| this.options = this.prevOptions | ||
| if (this.options.indeterminate) { | ||
| this.$wrapper.addClass(this._getClass('indeterminate')) | ||
| } | ||
| this.$element | ||
| .prop('checked', this.options.state) | ||
| .trigger('change.bootstrapSwitch', true) | ||
| }, | ||
| 'change.bootstrapSwitch': (event, skip) => { | ||
| event.preventDefault() | ||
| event.stopImmediatePropagation() | ||
| const state = this.$element.is(':checked') | ||
| this._containerPosition(state) | ||
| if (state === this.options.state) { | ||
| return | ||
| 'change.bootstrapSwitch': (event, skip) => { | ||
| event.preventDefault() | ||
| event.stopImmediatePropagation() | ||
| const state = this.$element.is(':checked') | ||
| this._containerPosition(state) | ||
| if (state === this.options.state) { | ||
| return | ||
| } | ||
| this.options.state = state | ||
| this.$wrapper | ||
| .toggleClass(this._getClass('off')) | ||
| .toggleClass(this._getClass('on')) | ||
| if (!skip) { | ||
| if (this.$element.is(':radio')) { | ||
| $(`[name="${this.$element.attr('name')}"]`) | ||
| .not(this.$element) | ||
| .prop('checked', false) | ||
| .trigger('change.bootstrapSwitch', true) | ||
| } | ||
| this.options.state = state | ||
| this.$wrapper | ||
| .toggleClass(this._getClass('off')) | ||
| .toggleClass(this._getClass('on')) | ||
| if (!skip) { | ||
| if (this.$element.is(':radio')) { | ||
| $(`[name="${this.$element.attr('name')}"]`) | ||
| .not(this.$element) | ||
| .prop('checked', false) | ||
| .trigger('change.bootstrapSwitch', true) | ||
| } | ||
| this.$element.trigger('switchChange.bootstrapSwitch', [state]) | ||
| } | ||
| }, | ||
| 'focus.bootstrapSwitch': event => { | ||
| event.preventDefault() | ||
| this.$wrapper.addClass(this._getClass('focused')) | ||
| }, | ||
| 'blur.bootstrapSwitch': event => { | ||
| event.preventDefault() | ||
| this.$wrapper.removeClass(this._getClass('focused')) | ||
| }, | ||
| 'keydown.bootstrapSwitch': event => { | ||
| if (!event.which || this.options.disabled || this.options.readonly) { | ||
| return | ||
| } | ||
| if (event.which === 37 || event.which === 39) { | ||
| event.preventDefault() | ||
| event.stopImmediatePropagation() | ||
| this.state(event.which === 39) | ||
| } | ||
| this.$element.trigger('switchChange.bootstrapSwitch', [state]) | ||
| } | ||
| }) | ||
| } | ||
| }, | ||
| _handleHandlers () { | ||
| this.$on.on('click.bootstrapSwitch', event => { | ||
| 'focus.bootstrapSwitch': event => { | ||
| event.preventDefault() | ||
| event.stopPropagation() | ||
| this.state(false) | ||
| return this.$element.trigger('focus.bootstrapSwitch') | ||
| }) | ||
| return this.$off.on('click.bootstrapSwitch', event => { | ||
| this.$wrapper.addClass(this._getClass('focused')) | ||
| }, | ||
| 'blur.bootstrapSwitch': event => { | ||
| event.preventDefault() | ||
| event.stopPropagation() | ||
| this.state(true) | ||
| return this.$element.trigger('focus.bootstrapSwitch') | ||
| }) | ||
| } | ||
| this.$wrapper.removeClass(this._getClass('focused')) | ||
| }, | ||
| _labelHandlers () { | ||
| const handlers = { | ||
| click (event) { event.stopPropagation() }, | ||
| 'mousedown.bootstrapSwitch touchstart.bootstrapSwitch': event => { | ||
| if (this._dragStart || this.options.disabled || this.options.readonly) { | ||
| return | ||
| } | ||
| 'keydown.bootstrapSwitch': event => { | ||
| if (!event.which || this.options.disabled || this.options.readonly) { | ||
| return | ||
| } | ||
| if (event.which === 37 || event.which === 39) { | ||
| event.preventDefault() | ||
| event.stopPropagation() | ||
| this._dragStart = (event.pageX || event.originalEvent.touches[0].pageX) - parseInt(this.$container.css('margin-left'), 10) | ||
| if (this.options.animate) { | ||
| this.$wrapper.removeClass(this._getClass('animate')) | ||
| } | ||
| this.$element.trigger('focus.bootstrapSwitch') | ||
| }, | ||
| event.stopImmediatePropagation() | ||
| this.state(event.which === 39) | ||
| } | ||
| } | ||
| }) | ||
| } | ||
| 'mousemove.bootstrapSwitch touchmove.bootstrapSwitch': event => { | ||
| if (this._dragStart == null) { return } | ||
| const difference = (event.pageX || event.originalEvent.touches[0].pageX) - this._dragStart | ||
| event.preventDefault() | ||
| if (difference < -this._handleWidth || difference > 0) { return } | ||
| this._dragEnd = difference | ||
| this.$container.css('margin-left', `${this._dragEnd}px`) | ||
| }, | ||
| _handleHandlers () { | ||
| this.$on.on('click.bootstrapSwitch', event => { | ||
| event.preventDefault() | ||
| event.stopPropagation() | ||
| this.state(false) | ||
| return this.$element.trigger('focus.bootstrapSwitch') | ||
| }) | ||
| return this.$off.on('click.bootstrapSwitch', event => { | ||
| event.preventDefault() | ||
| event.stopPropagation() | ||
| this.state(true) | ||
| return this.$element.trigger('focus.bootstrapSwitch') | ||
| }) | ||
| } | ||
| 'mouseup.bootstrapSwitch touchend.bootstrapSwitch': event => { | ||
| if (!this._dragStart) { return } | ||
| event.preventDefault() | ||
| if (this.options.animate) { | ||
| this.$wrapper.addClass(this._getClass('animate')) | ||
| } | ||
| if (this._dragEnd) { | ||
| const state = this._dragEnd > -(this._handleWidth / 2) | ||
| this._dragEnd = false | ||
| this.state(this.options.inverse ? !state : state) | ||
| } else { | ||
| this.state(!this.options.state) | ||
| } | ||
| this._dragStart = false | ||
| }, | ||
| _labelHandlers () { | ||
| const handlers = { | ||
| click (event) { event.stopPropagation() }, | ||
| 'mouseleave.bootstrapSwitch': () => { | ||
| this.$label.trigger('mouseup.bootstrapSwitch') | ||
| 'mousedown.bootstrapSwitch touchstart.bootstrapSwitch': event => { | ||
| if (this._dragStart || this.options.disabled || this.options.readonly) { | ||
| return | ||
| } | ||
| } | ||
| this.$label.on(handlers) | ||
| } | ||
| event.preventDefault() | ||
| event.stopPropagation() | ||
| this._dragStart = (event.pageX || event.originalEvent.touches[0].pageX) - parseInt(this.$container.css('margin-left'), 10) | ||
| if (this.options.animate) { | ||
| this.$wrapper.removeClass(this._getClass('animate')) | ||
| } | ||
| this.$element.trigger('focus.bootstrapSwitch') | ||
| }, | ||
| _externalLabelHandler () { | ||
| const $externalLabel = this.$element.closest('label') | ||
| $externalLabel.on('click', event => { | ||
| 'mousemove.bootstrapSwitch touchmove.bootstrapSwitch': event => { | ||
| if (this._dragStart == null) { return } | ||
| const difference = (event.pageX || event.originalEvent.touches[0].pageX) - this._dragStart | ||
| event.preventDefault() | ||
| event.stopImmediatePropagation() | ||
| if (event.target === $externalLabel[0]) { | ||
| this.toggleState() | ||
| if (difference < -this._handleWidth || difference > 0) { return } | ||
| this._dragEnd = difference | ||
| this.$container.css('margin-left', `${this._dragEnd}px`) | ||
| }, | ||
| 'mouseup.bootstrapSwitch touchend.bootstrapSwitch': event => { | ||
| if (!this._dragStart) { return } | ||
| event.preventDefault() | ||
| if (this.options.animate) { | ||
| this.$wrapper.addClass(this._getClass('animate')) | ||
| } | ||
| }) | ||
| } | ||
| if (this._dragEnd) { | ||
| const state = this._dragEnd > -(this._handleWidth / 2) | ||
| this._dragEnd = false | ||
| this.state(this.options.inverse ? !state : state) | ||
| } else { | ||
| this.state(!this.options.state) | ||
| } | ||
| this._dragStart = false | ||
| }, | ||
| _formHandler () { | ||
| const $form = this.$element.closest('form') | ||
| if ($form.data('bootstrap-switch')) { | ||
| return | ||
| 'mouseleave.bootstrapSwitch': () => { | ||
| this.$label.trigger('mouseup.bootstrapSwitch') | ||
| } | ||
| $form | ||
| .on('reset.bootstrapSwitch', () => { | ||
| window.setTimeout(() => { | ||
| $form.find('input') | ||
| .filter(function () { return $(this).data('bootstrap-switch') }) | ||
| .each(function () { return $(this).bootstrapSwitch('state', this.checked) }) | ||
| }, 1) | ||
| }) | ||
| .data('bootstrap-switch', true) | ||
| } | ||
| this.$label.on(handlers) | ||
| } | ||
| _getClass (name) { | ||
| return `${this.options.baseClass}-${name}` | ||
| _externalLabelHandler () { | ||
| const $externalLabel = this.$element.closest('label') | ||
| $externalLabel.on('click', event => { | ||
| event.preventDefault() | ||
| event.stopImmediatePropagation() | ||
| if (event.target === $externalLabel[0]) { | ||
| this.toggleState() | ||
| } | ||
| }) | ||
| } | ||
| _formHandler () { | ||
| const $form = this.$element.closest('form') | ||
| if ($form.data('bootstrap-switch')) { | ||
| return | ||
| } | ||
| $form | ||
| .on('reset.bootstrapSwitch', () => { | ||
| window.setTimeout(() => { | ||
| $form.find('input') | ||
| .filter(function () { return $(this).data('bootstrap-switch') }) | ||
| .each(function () { return $(this).bootstrapSwitch('state', this.checked) }) | ||
| }, 1) | ||
| }) | ||
| .data('bootstrap-switch', true) | ||
| } | ||
| _getClasses (classes) { | ||
| if (!$.isArray(classes)) { | ||
| return [this._getClass(classes)] | ||
| } | ||
| return classes.map(this._getClass.bind(this)) | ||
| _getClass (name) { | ||
| return `${this.options.baseClass}-${name}` | ||
| } | ||
| _getClasses (classes) { | ||
| if (!$.isArray(classes)) { | ||
| return [this._getClass(classes)] | ||
| } | ||
| return classes.map(this._getClass.bind(this)) | ||
| } | ||
| } | ||
| $.fn.bootstrapSwitch = function (option, ...args) { | ||
| let ret = this | ||
| this.each(function () { | ||
| const $this = $(this) | ||
| let data = $this.data('bootstrap-switch') | ||
| if (!data) { | ||
| data = new BootstrapSwitch(this, option) | ||
| $this.data('bootstrap-switch', data) | ||
| } | ||
| if (typeof option === 'string') { | ||
| ret = data[option].apply(data, args) | ||
| } | ||
| }) | ||
| $.fn.bootstrapSwitch = function (option, ...args) { | ||
| function reducer (ret, next) { | ||
| const $this = $(next) | ||
| const existingData = $this.data('bootstrap-switch') | ||
| const data = existingData || new BootstrapSwitch(next, option) | ||
| if (!existingData) { | ||
| $this.data('bootstrap-switch', data) | ||
| } | ||
| if (typeof option === 'string') { | ||
| return data[option].apply(data, args) | ||
| } | ||
| return ret | ||
| } | ||
| $.fn.bootstrapSwitch.Constructor = BootstrapSwitch | ||
| $.fn.bootstrapSwitch.defaults = { | ||
| state: true, | ||
| size: null, | ||
| animate: true, | ||
| disabled: false, | ||
| readonly: false, | ||
| indeterminate: false, | ||
| inverse: false, | ||
| radioAllOff: false, | ||
| onColor: 'primary', | ||
| offColor: 'default', | ||
| onText: 'ON', | ||
| offText: 'OFF', | ||
| labelText: ' ', | ||
| handleWidth: 'auto', | ||
| labelWidth: 'auto', | ||
| baseClass: 'bootstrap-switch', | ||
| wrapperClass: 'wrapper', | ||
| onInit: () => {}, | ||
| onSwitchChange: () => {} | ||
| } | ||
| })(window.jQuery, window) | ||
| return Array.prototype.reduce.call(this, reducer, this) | ||
| } | ||
| $.fn.bootstrapSwitch.Constructor = BootstrapSwitch | ||
| $.fn.bootstrapSwitch.defaults = { | ||
| state: true, | ||
| size: null, | ||
| animate: true, | ||
| disabled: false, | ||
| readonly: false, | ||
| indeterminate: false, | ||
| inverse: false, | ||
| radioAllOff: false, | ||
| onColor: 'primary', | ||
| offColor: 'default', | ||
| onText: 'ON', | ||
| offText: 'OFF', | ||
| labelText: ' ', | ||
| handleWidth: 'auto', | ||
| labelWidth: 'auto', | ||
| baseClass: 'bootstrap-switch', | ||
| wrapperClass: 'wrapper', | ||
| onInit: () => {}, | ||
| onSwitchChange: () => {} | ||
| } |
@@ -32,3 +32,2 @@ @bootstrap-switch-base: bootstrap-switch; | ||
| display: inline-block !important; | ||
| height: 100%; | ||
| padding-top: 4px; | ||
@@ -82,2 +81,6 @@ padding-bottom: 4px; | ||
| span::before { | ||
| content: "\200b"; | ||
| } | ||
| .@{bootstrap-switch-base}-handle-on { | ||
@@ -98,2 +101,3 @@ .border-left-radius(4px); | ||
| z-index: -1; | ||
| visibility: hidden; | ||
@@ -100,0 +104,0 @@ &.form-control { |
@@ -31,4 +31,4 @@ @bootstrap-switch-base: bootstrap-switch; | ||
| cursor: pointer; | ||
| display: inline-block !important; | ||
| height: 100%; | ||
| display: table-cell; | ||
| vertical-align: middle; | ||
| padding: @padding-base-vertical @padding-base-horizontal; | ||
@@ -84,2 +84,6 @@ font-size: @font-size-base; | ||
| span::before { | ||
| content: "\200b"; | ||
| } | ||
| .@{bootstrap-switch-base}-handle-on { | ||
@@ -101,2 +105,3 @@ .border-left-radius(@border-radius-base - 1); | ||
| .opacity(0); | ||
| visibility: hidden; | ||
| } | ||
@@ -103,0 +108,0 @@ |
| doctype html | ||
| html(lang='en') | ||
| head | ||
| meta(charset='utf-8') | ||
| meta(http-equiv='x-ua-Compatible' content='ie=edge') | ||
| meta(name='viewport', content='width=device-width, initial-scale=1.0') | ||
| meta(name='description', content='Turn checkboxes and radio buttons into toggle switches.') | ||
| meta(name='author', content='Mattia Larentis, Emanuele Marchi and Peter Stein') | ||
| title Bootstrap Switch · Turn checkboxes and radio buttons into toggle switches | ||
| link(href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css' rel='stylesheet') | ||
| link(href='css/highlight.css' rel='stylesheet') | ||
| link(href="https://unpkg.com/bootstrap-switch/dist/css/bootstrap3/bootstrap-switch.css" rel='stylesheet') | ||
| link(href='http://getbootstrap.com/assets/css/docs.min.css' rel='stylesheet') | ||
| link(href='css/main.css' rel='stylesheet') | ||
| body | ||
| a(href='https://github.com/nostalgiaz/bootstrap-switch', id='github') | ||
| img(src='https://s3.amazonaws.com/github/ribbons/forkme_right_gray_6d6d6d.png', alt='Fork me on GitHub') | ||
| header.navbar.navbar-static-top.bs-docs-nav(role='banner') | ||
| .container | ||
| .navbar-header | ||
| button.navbar-toggle(type='button', data-toggle='collapse', data-target='#collapse') | ||
| span.sr-only Toggle navigation | ||
| span.icon-bar | ||
| span.icon-bar | ||
| span.icon-bar | ||
| a.navbar-brand(href='../') Bootstrap Switch | ||
| nav#collapse.collapse.navbar-collapse.bs-navbar-collapse(role='navigation') | ||
| ul.nav.navbar-nav | ||
| li: a(href='https://github.com/nostalgiaz/bootstrap-switch/archive/master.zip', data-toggle='dropdown') Download | ||
| li: a(href='examples.html') Examples | ||
| li.dropdown | ||
| a(href='#', data-toggle='dropdown') | ||
| | Documentation | ||
| = ' ' | ||
| span.caret | ||
| ul.dropdown-menu | ||
| li: a(href='/options.html') Options | ||
| li: a(href='/methods.html') Methods | ||
| li: a(href='/events.html') Events | ||
| li.divider(role='presentation') | ||
| li: a(href='/documentation-2.html') Documentation (v2.0.1) | ||
| li: a(href='https://github.com/nostalgiaz/bootstrap-switch/issues') Bug reports | ||
| main#content(role='main') | ||
| != yield | ||
| footer.bs-docs-footer | ||
| .container | ||
| p | ||
| | Code licensed under | ||
| = ' ' | ||
| a(href='http://www.apache.org/licenses/LICENSE-2.0', target='_blank') Apache License, Version 2.0 | ||
| br | ||
| | Created by | ||
| = ' ' | ||
| a(href='https://github.com/nostalgiaz', target='_blank') Mattia Larentis | ||
| br | ||
| | Mantained by | ||
| = ' ' | ||
| a(href='https://github.com/lostcrew', target='_blank') Emanuele Marchi | ||
| script(src='https://code.jquery.com/jquery-3.1.1.min.js') | ||
| script(src='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js') | ||
| script(src='js/highlight.js') | ||
| script(src="https://unpkg.com/bootstrap-switch") | ||
| script(src='js/main.js') |
| h1 404 | ||
| h3 Whoops. Looks like what you're looking for can't be found. |
| /* | ||
| Original style from softwaremaniacs.org (c) Ivan Sagalaev <Maniac@SoftwareManiacs.Org> | ||
| */ | ||
| .hljs { | ||
| display: block; padding: 0.5em; | ||
| background: #F0F0F0; | ||
| } | ||
| .hljs, | ||
| .hljs-subst, | ||
| .hljs-tag .hljs-title, | ||
| .lisp .hljs-title, | ||
| .clojure .hljs-built_in, | ||
| .nginx .hljs-title { | ||
| color: black; | ||
| } | ||
| .hljs-string, | ||
| .hljs-title, | ||
| .hljs-constant, | ||
| .hljs-parent, | ||
| .hljs-tag .hljs-value, | ||
| .hljs-rules .hljs-value, | ||
| .hljs-rules .hljs-value .hljs-number, | ||
| .hljs-preprocessor, | ||
| .hljs-pragma, | ||
| .haml .hljs-symbol, | ||
| .ruby .hljs-symbol, | ||
| .ruby .hljs-symbol .hljs-string, | ||
| .hljs-aggregate, | ||
| .hljs-template_tag, | ||
| .django .hljs-variable, | ||
| .smalltalk .hljs-class, | ||
| .hljs-addition, | ||
| .hljs-flow, | ||
| .hljs-stream, | ||
| .bash .hljs-variable, | ||
| .apache .hljs-tag, | ||
| .apache .hljs-cbracket, | ||
| .tex .hljs-command, | ||
| .tex .hljs-special, | ||
| .erlang_repl .hljs-function_or_atom, | ||
| .asciidoc .hljs-header, | ||
| .markdown .hljs-header, | ||
| .coffeescript .hljs-attribute { | ||
| color: #800; | ||
| } | ||
| .smartquote, | ||
| .hljs-comment, | ||
| .hljs-annotation, | ||
| .hljs-template_comment, | ||
| .diff .hljs-header, | ||
| .hljs-chunk, | ||
| .asciidoc .hljs-blockquote, | ||
| .markdown .hljs-blockquote { | ||
| color: #888; | ||
| } | ||
| .hljs-number, | ||
| .hljs-date, | ||
| .hljs-regexp, | ||
| .hljs-literal, | ||
| .hljs-hexcolor, | ||
| .smalltalk .hljs-symbol, | ||
| .smalltalk .hljs-char, | ||
| .go .hljs-constant, | ||
| .hljs-change, | ||
| .lasso .hljs-variable, | ||
| .makefile .hljs-variable, | ||
| .asciidoc .hljs-bullet, | ||
| .markdown .hljs-bullet, | ||
| .asciidoc .hljs-link_url, | ||
| .markdown .hljs-link_url { | ||
| color: #080; | ||
| } | ||
| .hljs-label, | ||
| .hljs-javadoc, | ||
| .ruby .hljs-string, | ||
| .hljs-decorator, | ||
| .hljs-filter .hljs-argument, | ||
| .hljs-localvars, | ||
| .hljs-array, | ||
| .hljs-attr_selector, | ||
| .hljs-important, | ||
| .hljs-pseudo, | ||
| .hljs-pi, | ||
| .haml .hljs-bullet, | ||
| .hljs-doctype, | ||
| .hljs-deletion, | ||
| .hljs-envvar, | ||
| .hljs-shebang, | ||
| .apache .hljs-sqbracket, | ||
| .nginx .hljs-built_in, | ||
| .tex .hljs-formula, | ||
| .erlang_repl .hljs-reserved, | ||
| .hljs-prompt, | ||
| .asciidoc .hljs-link_label, | ||
| .markdown .hljs-link_label, | ||
| .vhdl .hljs-attribute, | ||
| .clojure .hljs-attribute, | ||
| .asciidoc .hljs-attribute, | ||
| .lasso .hljs-attribute, | ||
| .coffeescript .hljs-property, | ||
| .hljs-phony { | ||
| color: #88F | ||
| } | ||
| .hljs-keyword, | ||
| .hljs-id, | ||
| .hljs-title, | ||
| .hljs-built_in, | ||
| .hljs-aggregate, | ||
| .css .hljs-tag, | ||
| .hljs-javadoctag, | ||
| .hljs-phpdoc, | ||
| .hljs-yardoctag, | ||
| .smalltalk .hljs-class, | ||
| .hljs-winutils, | ||
| .bash .hljs-variable, | ||
| .apache .hljs-tag, | ||
| .go .hljs-typename, | ||
| .tex .hljs-command, | ||
| .asciidoc .hljs-strong, | ||
| .markdown .hljs-strong, | ||
| .hljs-request, | ||
| .hljs-status { | ||
| font-weight: bold; | ||
| } | ||
| .asciidoc .hljs-emphasis, | ||
| .markdown .hljs-emphasis { | ||
| font-style: italic; | ||
| } | ||
| .nginx .hljs-built_in { | ||
| font-weight: normal; | ||
| } | ||
| .coffeescript .javascript, | ||
| .javascript .xml, | ||
| .lasso .markup, | ||
| .tex .hljs-formula, | ||
| .xml .javascript, | ||
| .xml .vbscript, | ||
| .xml .css, | ||
| .xml .hljs-cdata { | ||
| opacity: 0.5; | ||
| } |
| body { | ||
| font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; | ||
| padding-bottom: 50px; | ||
| } | ||
| .bs-docs-masthead, | ||
| .bs-docs-header { | ||
| color: #cdbfe3; | ||
| text-shadow: 0 1px 0 rgba(0,0,0,.1); | ||
| background-color: #6f5499; | ||
| background-image: -webkit-gradient(linear,left top,left bottom,from(#563d7c),to(#6f5499)); | ||
| background-image:-webkit-linear-gradient(top,#563d7c 0,#6f5499 100%); | ||
| background-image:-o-linear-gradient(top,#563d7c 0,#6f5499 100%); | ||
| background-image:linear-gradient(to bottom,#563d7c 0,#6f5499 100%); | ||
| filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#563d7c', endColorstr='#6F5499', GradientType=0); | ||
| background-repeat:repeat-x | ||
| } | ||
| .bs-docs-masthead h1 { | ||
| font-weight: 500; | ||
| } | ||
| .page-header { | ||
| text-align: left; | ||
| } | ||
| #github { | ||
| display: none; | ||
| position: fixed; | ||
| width: 150px; | ||
| height: 150px; | ||
| top: 0; | ||
| right: 0; | ||
| z-index: 2000; | ||
| } | ||
| .bottom { | ||
| border-top: 1px solid #eee; | ||
| margin-top: 40px; | ||
| padding-top: 20px; | ||
| padding-bottom: 20px; | ||
| text-align: center; | ||
| } | ||
| .hljs { | ||
| background-color: transparent; | ||
| } | ||
| @media (min-width: 768px) { | ||
| #github { | ||
| display: block; | ||
| } | ||
| } |
| .bs-docs-header | ||
| .container | ||
| h1 Documentation | ||
| p v2.0.1 | ||
| .container | ||
| #options | ||
| h2.page-header Options | ||
| .alert.alert-warning | ||
| p | ||
| | All the options are accepted only using <code>data-*</code> attributes on the element.<br> | ||
| | <code>checked</code>, <code>disabled</code> and <code>readonly</code> are exceptions to the rule, being | ||
| | default HTML input attributes.<br> | ||
| | Therefore, there is not any way to specify the options in JavaScript during initialization. | ||
| table.table.table-bordered.table-striped.table-responsive | ||
| thead | ||
| tr | ||
| th Name | ||
| th Type | ||
| th Description | ||
| th Values | ||
| th Default | ||
| tbody | ||
| tr | ||
| td state | ||
| td Boolean | ||
| td The checkbox state | ||
| td true, false | ||
| td 'checked' attribute or true | ||
| tr | ||
| td size | ||
| td String | ||
| td The checkbox state | ||
| td '', 'mini', 'small', 'normal', 'large' | ||
| td '' | ||
| tr | ||
| td animate | ||
| td Boolean | ||
| td Animate the switch | ||
| td true, false | ||
| td true | ||
| tr | ||
| td disabled | ||
| td Boolean | ||
| td Disable state | ||
| td true, false | ||
| td 'disabled' attribute or false | ||
| tr | ||
| td readonly | ||
| td Boolean | ||
| td Readonly state | ||
| td true, false | ||
| td 'readonly' attribute or false | ||
| tr | ||
| td on | ||
| td String | ||
| td Color of the left side of the switch | ||
| td 'primary', 'info', 'success', 'warning', 'danger', 'default' | ||
| td null | ||
| tr | ||
| td off | ||
| td String | ||
| td Color of the right side of the switch | ||
| td 'primary', 'info', 'success', 'warning', 'danger', 'default' | ||
| td null | ||
| tr | ||
| td on-label | ||
| td String | ||
| td Text of the left side of the switch | ||
| td String | ||
| td 'ON' | ||
| tr | ||
| td off-label | ||
| td String | ||
| td Text of the right side of the switch | ||
| td String | ||
| td 'OFF' | ||
| tr | ||
| td label-text | ||
| td String | ||
| td Text of the center handle of the switch | ||
| td String | ||
| td '&nbsp;' | ||
| tr | ||
| td label-icon | ||
| td String | ||
| td Text of the center handle of the switch. Use to include external services icons | ||
| td String | ||
| td null | ||
| #methods | ||
| h2.page-header Methods | ||
| table.table.table-bordered.table-striped.table-responsive | ||
| thead | ||
| tr | ||
| th Name | ||
| th Description | ||
| th Accepted Values | ||
| th Returned Values | ||
| tbody | ||
| tr | ||
| td state | ||
| td Get checkbox state | ||
| td | ||
| td true, false | ||
| tr | ||
| td setState | ||
| td Set checkbox state | ||
| td (value: true, false)[, skip: true, <strong>false</strong>] | ||
| td jQuery Object (input element) | ||
| tr | ||
| td toggleState | ||
| td Toggle checkbox state | ||
| td [skip: true, <strong>false</strong>] | ||
| td jQuery Object (input element) | ||
| tr | ||
| td toggleRadioState | ||
| td Toggle radio state | ||
| td [skip: true, <strong>false</strong>] | ||
| td jQuery Object (input element) | ||
| tr | ||
| td toggleRadioStateAllowUncheck | ||
| td Toggle radio state allowing uncheck of the radio input | ||
| td [uncheck: true, <strong>false</strong> | skip: true, <strong>false</strong>] | ||
| td jQuery Object (input element) | ||
| tr | ||
| td setSizeClass | ||
| td Set the size of the switch | ||
| td '', 'mini', 'small', 'normal', 'large' | ||
| td jQuery Object (input element) | ||
| tr | ||
| td setAnimated | ||
| td Animate the switch | ||
| td true, false | ||
| td jQuery Object (input element) | ||
| tr | ||
| td isDisabled | ||
| td Get disabled state | ||
| td | ||
| td true, false | ||
| tr | ||
| td setDisabled | ||
| td Set disable state | ||
| td true, false | ||
| td jQuery Object (input element) | ||
| tr | ||
| td toggleDisabled | ||
| td Toggle disabled state | ||
| td | ||
| td jQuery Object (input element) | ||
| tr | ||
| td isReadOnly | ||
| td Get Readonly state | ||
| td | ||
| td true, false | ||
| tr | ||
| td setReadOnly | ||
| td Set Readonly state | ||
| td true, false | ||
| td jQuery Object (input element) | ||
| tr | ||
| td toggleReadOnly | ||
| td Toggle readonly state | ||
| td | ||
| td jQuery Object (input element) | ||
| tr | ||
| td setOnClass | ||
| td Color of the left side of the switch | ||
| td 'primary', 'info', 'success', 'warning', 'danger', 'default' | ||
| td jQuery Object (input element) | ||
| tr | ||
| td setOffClass | ||
| td Color of the right side of the switch | ||
| td 'primary', 'info', 'success', 'warning', 'danger', 'default' | ||
| td jQuery Object (input element) | ||
| tr | ||
| td setOnLabel | ||
| td Text of the left side of the switch | ||
| td String | ||
| td jQuery Object (input element) | ||
| tr | ||
| td setOffLabel | ||
| td Text of the right side of the switch | ||
| td String | ||
| td jQuery Object (input element) | ||
| tr | ||
| td setTextLabel | ||
| td Text of the center handle of the switch | ||
| td String | ||
| td null | ||
| tr | ||
| td setTextIcon | ||
| td Text of the center handle of the switch. Use to include external services icons | ||
| td String | ||
| td null | ||
| tr | ||
| td destroy | ||
| td Destroy the instance of Bootstrap Switch | ||
| td | ||
| td jQuery Object (input element) | ||
| #events | ||
| h2.page-header Events | ||
| p | ||
| | The only event triggered is <code>switch-change</code>. It returns two parameters: <code>event</code> and | ||
| | <code>data</code>.<br> | ||
| | The latter is an object that includes <code>el</code> (the input DOM element) and <code>value</code> (the | ||
| | new input state) |
| .bs-docs-header | ||
| .container | ||
| h1 Events | ||
| .container | ||
| p | ||
| | All the events are namespaced, therefore always append <code>.bootstrapSwitch</code> when you | ||
| | attach your handlers.<br> | ||
| | You can register to the emitted events as follows: | ||
| pre: code | ||
| | $('input[name="my-checkbox"]').on('switchChange.bootstrapSwitch', function(event, state) { | ||
| | console.log(this); // DOM element | ||
| | console.log(event); // jQuery event | ||
| | console.log(state); // true | false | ||
| | }); | ||
| table.table.table-bordered.table-striped.table-responsive | ||
| thead | ||
| tr | ||
| th Name | ||
| th Description | ||
| th Parameters | ||
| tbody | ||
| tr | ||
| td init | ||
| td Triggered on initialization. 'this' refers to the DOM element. | ||
| td | ||
| | event (<a href="https://api.jquery.com/category/events/event-object/" target="_blank">jQuery Event object</a>) | ||
| | state (true | false) | ||
| tr | ||
| td switchChange | ||
| td Triggered on switch state change. 'this' refers to the DOM element. | ||
| td | ||
| | event (<a href="https://api.jquery.com/category/events/event-object/" target="_blank">jQuery Event object</a>), | ||
| | state (true | false) |
| .bs-docs-header | ||
| .container | ||
| h1 Examples | ||
| .container | ||
| .row | ||
| .col-sm-6.col-lg-4 | ||
| h2.h4 State | ||
| p | ||
| input#switch-state(type='checkbox', checked) | ||
| .btn-group | ||
| button.btn.btn-default(type='button' data-switch-toggle='state') Toggle | ||
| button.btn.btn-default(type='button', data-switch-set='state', data-switch-value='true') Set true | ||
| button.btn.btn-default(type='button', data-switch-set='state', data-switch-value='false') Set false | ||
| button.btn.btn-default(type='button', data-switch-get='state') Get | ||
| .col-sm-6.col-lg-4 | ||
| h2.h4 Size | ||
| p | ||
| input#switch-size(type='checkbox', checked, data-size='mini') | ||
| .btn-group | ||
| button.btn.btn-default(type='button', data-switch-set='size', data-switch-value='mini') Mini | ||
| button.btn.btn-default(type='button', data-switch-set='size', data-switch-value='small') Small | ||
| button.btn.btn-default(type='button', data-switch-set='size', data-switch-value='normal') Normal | ||
| button.btn.btn-default(type='button', data-switch-set='size', data-switch-value='large') Large | ||
| button.btn.btn-default(type='button', data-switch-get='size') Get | ||
| .col-sm-6.col-lg-4 | ||
| h2.h4 Animate | ||
| p | ||
| input#switch-animate(type='checkbox', checked) | ||
| p | ||
| button.btn.btn-default(type='button', data-switch-toggle='animate') Toggle | ||
| button.btn.btn-default(type='button', data-switch-get='animate') Get | ||
| .col-sm-6.col-lg-4 | ||
| h2.h4 Disabled | ||
| p | ||
| input#switch-disabled(type='checkbox', checked, disabled) | ||
| p | ||
| button.btn.btn-default(type='button', data-switch-toggle='disabled') Toggle | ||
| button.btn.btn-default(type='button', data-switch-get='disabled') Get | ||
| .col-sm-6.col-lg-4 | ||
| h2.h4 Readonly | ||
| p | ||
| input#switch-readonly(type='checkbox', checked, readonly) | ||
| p | ||
| button.btn.btn-default(type='button', data-switch-toggle='readonly') Toggle | ||
| button.btn.btn-default(type='button', data-switch-get='readonly') Get | ||
| .col-sm-6.col-lg-4 | ||
| h2.h4 Indeterminate | ||
| p | ||
| input#switch-indeterminate(type='checkbox', checked, data-indeterminate='true') | ||
| p | ||
| button.btn.btn-default(type='button', data-switch-toggle='indeterminate') Toggle | ||
| button.btn.btn-default(type='button', data-switch-get='indeterminate') Get | ||
| .col-sm-6.col-lg-4 | ||
| h2.h4 Inverse | ||
| p | ||
| input#switch-inverse(type='checkbox', checked, data-inverse='true') | ||
| p | ||
| button.btn.btn-default(type='button', data-switch-toggle='inverse') Toggle | ||
| button.btn.btn-default(type='button', data-switch-get='inverse') Get | ||
| .col-sm-6.col-lg-4 | ||
| h2.h4 On Color | ||
| p | ||
| input#switch-onColor(type='checkbox', checked, data-on-color='info') | ||
| p.btn-group | ||
| .btn-group | ||
| button.btn.btn-default.dropdown-toggle(type='button', data-toggle='dropdown') | ||
| | Set | ||
| span.caret | ||
| .dropdown-menu(role='menu') | ||
| li: a(data-switch-set='onColor', data-switch-value='primary') Primary | ||
| li: a(data-switch-set='onColor', data-switch-value='info') Info | ||
| li: a(data-switch-set='onColor', data-switch-value='success') Success | ||
| li: a(data-switch-set='onColor', data-switch-value='warning') Warning | ||
| li: a(data-switch-set='onColor', data-switch-value='default') Default | ||
| button.btn.btn-default(type='button', data-switch-get='onColor') Get | ||
| .col-sm-6.col-lg-4 | ||
| h2.h4 Off Color | ||
| p | ||
| input#switch-offColor(type='checkbox', data-off-color='warning') | ||
| p.btn-group | ||
| .btn-group | ||
| button.btn.btn-default.dropdown-toggle(type='button', data-toggle='dropdown') | ||
| | Set | ||
| span.caret | ||
| .dropdown-menu(role='menu') | ||
| li: a(data-switch-set='offColor', data-switch-value='primary') Primary | ||
| li: a(data-switch-set='offColor', data-switch-value='info') Info | ||
| li: a(data-switch-set='offColor', data-switch-value='success') Success | ||
| li: a(data-switch-set='offColor', data-switch-value='warning') Warning | ||
| li: a(data-switch-set='offColor', data-switch-value='default') Default | ||
| button.btn.btn-default(type='button', data-switch-get='offColor') Get | ||
| .col-sm-6.col-lg-4 | ||
| h2.h4 On Text | ||
| p | ||
| input#switch-onText(type='checkbox', checked, data-on-text='Yes') | ||
| .row | ||
| .col-sm-6 | ||
| input.form-control(type='text', data-switch-set-value='onText', value='Yes') | ||
| .col-sm-6.col-lg-4 | ||
| h2.h4 Off Text | ||
| p | ||
| input#switch-offText(type='checkbox', data-off-text='No') | ||
| .row | ||
| .col-sm-6 | ||
| input.form-control(type='text', data-switch-set-value='offText', value='No') | ||
| .col-sm-6.col-lg-4 | ||
| h2.h4 Label Text | ||
| p | ||
| input#switch-labelText(type='checkbox', data-label-text='Label') | ||
| .row | ||
| .col-sm-6 | ||
| input.form-control(type='text', data-switch-set-value='labelText') | ||
| .col-sm-6.col-lg-4 | ||
| h2.h4 Handle Width | ||
| p | ||
| input#switch-handleWidth(type='checkbox', data-handle-width='100') | ||
| .row | ||
| .col-sm-6 | ||
| input.form-control(type='number', data-switch-set-value='handleWidth', value='100') | ||
| .col-sm-6.col-lg-4 | ||
| h2.h4 Label Width | ||
| p | ||
| input#switch-labelWidth(type='checkbox', data-label-width='100') | ||
| .row | ||
| .col-sm-6 | ||
| input.form-control(type='number', data-switch-set-value='labelWidth', value='100') | ||
| .col-sm-6.col-lg-4 | ||
| h2.h4 Create | Destroy | ||
| p | ||
| input#switch-create-destroy(type='checkbox', checked, data-switch-no-init) | ||
| .row | ||
| .col-sm-6 | ||
| button.btn.btn-default(type='button', data-switch-create-destroy, data-destroy-text="Destroy") Create | ||
| br | ||
| br | ||
| .text-center | ||
| h2.h4 Radio All Off | ||
| .row | ||
| .col-sm-6 | ||
| h3.h5 Disabled | ||
| input.switch-radio1(type='radio', name='radio1', checked) | ||
| input.switch-radio1(type='radio', name='radio1') | ||
| input.switch-radio1(type='radio', name='radio1') | ||
| .col-sm-6 | ||
| h3.h5 Enabled | ||
| input.switch-radio2(type='radio', name='radio2', checked, data-radio-all-off='true') | ||
| input.switch-radio2(type='radio', name='radio2', data-radio-all-off='true') | ||
| input.switch-radio2(type='radio', name='radio2', data-radio-all-off='true') | ||
| br | ||
| hr | ||
| h2.h4 Inside Modals | ||
| button.btn.btn-default(data-toggle='modal', data-target='#modal-switch') Open Modal | ||
| .modal.fade#modal-switch(tabindex='-1', role='dialog', aria-labelledby='modal-switch-label') | ||
| .modal-dialog | ||
| .modal-content | ||
| .modal-header | ||
| button.close(type='button', data-dismiss='modal') | ||
| span(aria-hidden='true') × | ||
| span.sr-only Close | ||
| .modal-title#modal-switch-label Title | ||
| .modal-body | ||
| input#switch-modal(type='checkbox', checked) |
| .bs-docs-masthead | ||
| .container | ||
| h1.title Bootstrap Switch | ||
| p.lead | ||
| | Turn checkboxes | ||
| input(type='checkbox', checked, data-switch-no-init) | ||
| | and radio buttons | ||
| input(type='radio', checked, data-switch-no-init) | ||
| | into toggle switches | ||
| input(type='checkbox', checked) | ||
| p.lead | ||
| a.btn.btn-outline-inverse.btn-lg(href='https://github.com/nostalgiaz/bootstrap-switch/archive/master.zip') Download Bootstrap Switch | ||
| p.bs-docs-social | ||
| iframe(src='http://ghbtns.com/github-btn.html?user=nostalgiaz&repo=bootstrap-switch&type=watch&count=true&size=large', allowtransparency='true', frameborder='0', scrolling='0', width='184', height='30') | ||
| iframe(src='http://ghbtns.com/github-btn.html?user=nostalgiaz&repo=bootstrap-switch&type=fork&count=true&size=large', allowtransparency='true', frameborder='0', scrolling='0', width='144', height='30') | ||
| br | ||
| p.version | ||
| | Currently v3.3.3 · Compatible with Bootstrap 2 and 3 | ||
| .container | ||
| h2.page-header Getting Started | ||
| p Include the dependencies: jQuery, Bootstrap and Bootstrap Switch CSS + Javascript. | ||
| pre: code | ||
| | [...] | ||
| | <link href="bootstrap.css" rel="stylesheet"> | ||
| | <link href="bootstrap-switch.css" rel="stylesheet"> | ||
| | <script src="jquery.js"></script> | ||
| | <script src="bootstrap-switch.js"></script> | ||
| | [...] | ||
| p Add your checkbox. | ||
| pre: code <input type="checkbox" name="my-checkbox" checked> | ||
| p Initialize Bootstrap Switch. | ||
| pre: code $("[name='my-checkbox']").bootstrapSwitch(); | ||
| p Enjoy. | ||
| .text-center | ||
| a.btn.btn-lg.btn-primary(href='examples.html') See Examples | ||
| | | ||
| a.btn.btn-lg.btn-outline(href='options.html') Browse Documentation | ||
| var hljs=new function(){function k(v){return v.replace(/&/gm,"&").replace(/</gm,"<").replace(/>/gm,">")}function t(v){return v.nodeName.toLowerCase()}function i(w,x){var v=w&&w.exec(x);return v&&v.index==0}function d(v){return Array.prototype.map.call(v.childNodes,function(w){if(w.nodeType==3){return b.useBR?w.nodeValue.replace(/\n/g,""):w.nodeValue}if(t(w)=="br"){return"\n"}return d(w)}).join("")}function r(w){var v=(w.className+" "+(w.parentNode?w.parentNode.className:"")).split(/\s+/);v=v.map(function(x){return x.replace(/^language-/,"")});return v.filter(function(x){return j(x)||x=="no-highlight"})[0]}function o(x,y){var v={};for(var w in x){v[w]=x[w]}if(y){for(var w in y){v[w]=y[w]}}return v}function u(x){var v=[];(function w(y,z){for(var A=y.firstChild;A;A=A.nextSibling){if(A.nodeType==3){z+=A.nodeValue.length}else{if(t(A)=="br"){z+=1}else{if(A.nodeType==1){v.push({event:"start",offset:z,node:A});z=w(A,z);v.push({event:"stop",offset:z,node:A})}}}}return z})(x,0);return v}function q(w,y,C){var x=0;var F="";var z=[];function B(){if(!w.length||!y.length){return w.length?w:y}if(w[0].offset!=y[0].offset){return(w[0].offset<y[0].offset)?w:y}return y[0].event=="start"?w:y}function A(H){function G(I){return" "+I.nodeName+'="'+k(I.value)+'"'}F+="<"+t(H)+Array.prototype.map.call(H.attributes,G).join("")+">"}function E(G){F+="</"+t(G)+">"}function v(G){(G.event=="start"?A:E)(G.node)}while(w.length||y.length){var D=B();F+=k(C.substr(x,D[0].offset-x));x=D[0].offset;if(D==w){z.reverse().forEach(E);do{v(D.splice(0,1)[0]);D=B()}while(D==w&&D.length&&D[0].offset==x);z.reverse().forEach(A)}else{if(D[0].event=="start"){z.push(D[0].node)}else{z.pop()}v(D.splice(0,1)[0])}}return F+k(C.substr(x))}function m(y){function v(z){return(z&&z.source)||z}function w(A,z){return RegExp(v(A),"m"+(y.cI?"i":"")+(z?"g":""))}function x(D,C){if(D.compiled){return}D.compiled=true;D.k=D.k||D.bK;if(D.k){var z={};function E(G,F){if(y.cI){F=F.toLowerCase()}F.split(" ").forEach(function(H){var I=H.split("|");z[I[0]]=[G,I[1]?Number(I[1]):1]})}if(typeof D.k=="string"){E("keyword",D.k)}else{Object.keys(D.k).forEach(function(F){E(F,D.k[F])})}D.k=z}D.lR=w(D.l||/\b[A-Za-z0-9_]+\b/,true);if(C){if(D.bK){D.b=D.bK.split(" ").join("|")}if(!D.b){D.b=/\B|\b/}D.bR=w(D.b);if(!D.e&&!D.eW){D.e=/\B|\b/}if(D.e){D.eR=w(D.e)}D.tE=v(D.e)||"";if(D.eW&&C.tE){D.tE+=(D.e?"|":"")+C.tE}}if(D.i){D.iR=w(D.i)}if(D.r===undefined){D.r=1}if(!D.c){D.c=[]}var B=[];D.c.forEach(function(F){if(F.v){F.v.forEach(function(G){B.push(o(F,G))})}else{B.push(F=="self"?D:F)}});D.c=B;D.c.forEach(function(F){x(F,D)});if(D.starts){x(D.starts,C)}var A=D.c.map(function(F){return F.bK?"\\.?\\b("+F.b+")\\b\\.?":F.b}).concat([D.tE]).concat([D.i]).map(v).filter(Boolean);D.t=A.length?w(A.join("|"),true):{exec:function(F){return null}};D.continuation={}}x(y)}function c(S,L,J,R){function v(U,V){for(var T=0;T<V.c.length;T++){if(i(V.c[T].bR,U)){return V.c[T]}}}function z(U,T){if(i(U.eR,T)){return U}if(U.eW){return z(U.parent,T)}}function A(T,U){return !J&&i(U.iR,T)}function E(V,T){var U=M.cI?T[0].toLowerCase():T[0];return V.k.hasOwnProperty(U)&&V.k[U]}function w(Z,X,W,V){var T=V?"":b.classPrefix,U='<span class="'+T,Y=W?"":"</span>";U+=Z+'">';return U+X+Y}function N(){var U=k(C);if(!I.k){return U}var T="";var X=0;I.lR.lastIndex=0;var V=I.lR.exec(U);while(V){T+=U.substr(X,V.index-X);var W=E(I,V);if(W){H+=W[1];T+=w(W[0],V[0])}else{T+=V[0]}X=I.lR.lastIndex;V=I.lR.exec(U)}return T+U.substr(X)}function F(){if(I.sL&&!f[I.sL]){return k(C)}var T=I.sL?c(I.sL,C,true,I.continuation.top):g(C);if(I.r>0){H+=T.r}if(I.subLanguageMode=="continuous"){I.continuation.top=T.top}return w(T.language,T.value,false,true)}function Q(){return I.sL!==undefined?F():N()}function P(V,U){var T=V.cN?w(V.cN,"",true):"";if(V.rB){D+=T;C=""}else{if(V.eB){D+=k(U)+T;C=""}else{D+=T;C=U}}I=Object.create(V,{parent:{value:I}})}function G(T,X){C+=T;if(X===undefined){D+=Q();return 0}var V=v(X,I);if(V){D+=Q();P(V,X);return V.rB?0:X.length}var W=z(I,X);if(W){var U=I;if(!(U.rE||U.eE)){C+=X}D+=Q();do{if(I.cN){D+="</span>"}H+=I.r;I=I.parent}while(I!=W.parent);if(U.eE){D+=k(X)}C="";if(W.starts){P(W.starts,"")}return U.rE?0:X.length}if(A(X,I)){throw new Error('Illegal lexeme "'+X+'" for mode "'+(I.cN||"<unnamed>")+'"')}C+=X;return X.length||1}var M=j(S);if(!M){throw new Error('Unknown language: "'+S+'"')}m(M);var I=R||M;var D="";for(var K=I;K!=M;K=K.parent){if(K.cN){D=w(K.cN,D,true)}}var C="";var H=0;try{var B,y,x=0;while(true){I.t.lastIndex=x;B=I.t.exec(L);if(!B){break}y=G(L.substr(x,B.index-x),B[0]);x=B.index+y}G(L.substr(x));for(var K=I;K.parent;K=K.parent){if(K.cN){D+="</span>"}}return{r:H,value:D,language:S,top:I}}catch(O){if(O.message.indexOf("Illegal")!=-1){return{r:0,value:k(L)}}else{throw O}}}function g(y,x){x=x||b.languages||Object.keys(f);var v={r:0,value:k(y)};var w=v;x.forEach(function(z){if(!j(z)){return}var A=c(z,y,false);A.language=z;if(A.r>w.r){w=A}if(A.r>v.r){w=v;v=A}});if(w.language){v.second_best=w}return v}function h(v){if(b.tabReplace){v=v.replace(/^((<[^>]+>|\t)+)/gm,function(w,z,y,x){return z.replace(/\t/g,b.tabReplace)})}if(b.useBR){v=v.replace(/\n/g,"<br>")}return v}function p(z){var y=d(z);var A=r(z);if(A=="no-highlight"){return}var v=A?c(A,y,true):g(y);var w=u(z);if(w.length){var x=document.createElementNS("http://www.w3.org/1999/xhtml","pre");x.innerHTML=v.value;v.value=q(w,u(x),y)}v.value=h(v.value);z.innerHTML=v.value;z.className+=" hljs "+(!A&&v.language||"");z.result={language:v.language,re:v.r};if(v.second_best){z.second_best={language:v.second_best.language,re:v.second_best.r}}}var b={classPrefix:"hljs-",tabReplace:null,useBR:false,languages:undefined};function s(v){b=o(b,v)}function l(){if(l.called){return}l.called=true;var v=document.querySelectorAll("pre code");Array.prototype.forEach.call(v,p)}function a(){addEventListener("DOMContentLoaded",l,false);addEventListener("load",l,false)}var f={};var n={};function e(v,x){var w=f[v]=x(this);if(w.aliases){w.aliases.forEach(function(y){n[y]=v})}}function j(v){return f[v]||f[n[v]]}this.highlight=c;this.highlightAuto=g;this.fixMarkup=h;this.highlightBlock=p;this.configure=s;this.initHighlighting=l;this.initHighlightingOnLoad=a;this.registerLanguage=e;this.getLanguage=j;this.inherit=o;this.IR="[a-zA-Z][a-zA-Z0-9_]*";this.UIR="[a-zA-Z_][a-zA-Z0-9_]*";this.NR="\\b\\d+(\\.\\d+)?";this.CNR="(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)";this.BNR="\\b(0b[01]+)";this.RSR="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~";this.BE={b:"\\\\[\\s\\S]",r:0};this.ASM={cN:"string",b:"'",e:"'",i:"\\n",c:[this.BE]};this.QSM={cN:"string",b:'"',e:'"',i:"\\n",c:[this.BE]};this.CLCM={cN:"comment",b:"//",e:"$"};this.CBLCLM={cN:"comment",b:"/\\*",e:"\\*/"};this.HCM={cN:"comment",b:"#",e:"$"};this.NM={cN:"number",b:this.NR,r:0};this.CNM={cN:"number",b:this.CNR,r:0};this.BNM={cN:"number",b:this.BNR,r:0};this.REGEXP_MODE={cN:"regexp",b:/\//,e:/\/[gim]*/,i:/\n/,c:[this.BE,{b:/\[/,e:/\]/,r:0,c:[this.BE]}]};this.TM={cN:"title",b:this.IR,r:0};this.UTM={cN:"title",b:this.UIR,r:0}}();hljs.registerLanguage("bash",function(b){var a={cN:"variable",v:[{b:/\$[\w\d#@][\w\d_]*/},{b:/\$\{(.*?)\}/}]};var d={cN:"string",b:/"/,e:/"/,c:[b.BE,a,{cN:"variable",b:/\$\(/,e:/\)/,c:[b.BE]}]};var c={cN:"string",b:/'/,e:/'/};return{l:/-?[a-z\.]+/,k:{keyword:"if then else elif fi for break continue while in do done exit return set declare case esac export exec",literal:"true false",built_in:"printf echo read cd pwd pushd popd dirs let eval unset typeset readonly getopts source shopt caller type hash bind help sudo",operator:"-ne -eq -lt -gt -f -d -e -s -l -a"},c:[{cN:"shebang",b:/^#![^\n]+sh\s*$/,r:10},{cN:"function",b:/\w[\w\d_]*\s*\(\s*\)\s*\{/,rB:true,c:[b.inherit(b.TM,{b:/\w[\w\d_]*/})],r:0},b.HCM,b.NM,d,c,a]}});hljs.registerLanguage("javascript",function(a){return{aliases:["js"],k:{keyword:"in if for while finally var new function do return void else break catch instanceof with throw case default try this switch continue typeof delete let yield const class",literal:"true false null undefined NaN Infinity",built_in:"eval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Error EvalError InternalError RangeError ReferenceError StopIteration SyntaxError TypeError URIError Number Math Date String RegExp Array Float32Array Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require"},c:[{cN:"pi",b:/^\s*('|")use strict('|")/,r:10},a.ASM,a.QSM,a.CLCM,a.CBLCLM,a.CNM,{b:"("+a.RSR+"|\\b(case|return|throw)\\b)\\s*",k:"return throw case",c:[a.CLCM,a.CBLCLM,a.REGEXP_MODE,{b:/</,e:/>;/,r:0,sL:"xml"}],r:0},{cN:"function",bK:"function",e:/\{/,c:[a.inherit(a.TM,{b:/[A-Za-z$_][0-9A-Za-z$_]*/}),{cN:"params",b:/\(/,e:/\)/,c:[a.CLCM,a.CBLCLM],i:/["'\(]/}],i:/\[|%/},{b:/\$[(.]/},{b:"\\."+a.IR,r:0}]}});hljs.registerLanguage("xml",function(a){var c="[A-Za-z0-9\\._:-]+";var d={b:/<\?(php)?(?!\w)/,e:/\?>/,sL:"php",subLanguageMode:"continuous"};var b={eW:true,i:/</,r:0,c:[d,{cN:"attribute",b:c,r:0},{b:"=",r:0,c:[{cN:"value",v:[{b:/"/,e:/"/},{b:/'/,e:/'/},{b:/[^\s\/>]+/}]}]}]};return{aliases:["html"],cI:true,c:[{cN:"doctype",b:"<!DOCTYPE",e:">",r:10,c:[{b:"\\[",e:"\\]"}]},{cN:"comment",b:"<!--",e:"-->",r:10},{cN:"cdata",b:"<\\!\\[CDATA\\[",e:"\\]\\]>",r:10},{cN:"tag",b:"<style(?=\\s|>|$)",e:">",k:{title:"style"},c:[b],starts:{e:"</style>",rE:true,sL:"css"}},{cN:"tag",b:"<script(?=\\s|>|$)",e:">",k:{title:"script"},c:[b],starts:{e:"<\/script>",rE:true,sL:"javascript"}},{b:"<%",e:"%>",sL:"vbscript"},d,{cN:"pi",b:/<\?\w+/,e:/\?>/,r:10},{cN:"tag",b:"</?",e:"/?>",c:[{cN:"title",b:"[^ /><]+",r:0},b]}]}}); |
| var $ = window.jQuery | ||
| var $window = $(window) | ||
| var sectionTop = $('.top').outerHeight() + 20 | ||
| var $createDestroy = $('#switch-create-destroy') | ||
| console.log($) | ||
| function capitalize (string) { | ||
| return string.charAt(0).toUpperCase() + string.slice(1) | ||
| } | ||
| window.hljs.initHighlightingOnLoad() | ||
| $(function () { | ||
| $('a[href*=\'#\']').on('click', function (event) { | ||
| event.preventDefault() | ||
| var $target = $($(this).attr('href').slice('#')) | ||
| if ($target.length) { | ||
| $window.scrollTop($target.offset().top - sectionTop) | ||
| } | ||
| }) | ||
| $('input[type="checkbox"], input[type="radio"]') | ||
| .not('[data-switch-no-init]') | ||
| .bootstrapSwitch() | ||
| $('[data-switch-get]').on('click', function () { | ||
| var type = $(this).data('switch-get') | ||
| window.alert($('#switch-' + type).bootstrapSwitch(type)) | ||
| }) | ||
| $('[data-switch-set]').on('click', function () { | ||
| var type | ||
| type = $(this).data('switch-set') | ||
| $('#switch-' + type).bootstrapSwitch(type, $(this).data('switch-value')) | ||
| }) | ||
| $('[data-switch-toggle]').on('click', function () { | ||
| var type = $(this).data('switch-toggle') | ||
| $('#switch-' + type).bootstrapSwitch('toggle' + capitalize(type)) | ||
| }) | ||
| $('[data-switch-set-value]').on('input', function (event) { | ||
| var type, value | ||
| event.preventDefault() | ||
| type = $(this).data('switch-set-value') | ||
| value = $.trim($(this).val()) | ||
| if ($(this).data('value') === value) { | ||
| return | ||
| } | ||
| $('#switch-' + type).bootstrapSwitch(type, value) | ||
| }) | ||
| $('[data-switch-create-destroy]').on('click', function () { | ||
| var isSwitch | ||
| isSwitch = $createDestroy.data('bootstrap-switch') | ||
| $createDestroy.bootstrapSwitch((isSwitch ? 'destroy' : null)) | ||
| $(this).button((isSwitch ? 'reset' : 'destroy')) | ||
| }) | ||
| $('#confirm').bootstrapSwitch({ | ||
| size: 'large', | ||
| onSwitchChange: function (event, state) { | ||
| event.preventDefault() | ||
| return console.log(state, event.isDefaultPrevented()) | ||
| } | ||
| }) | ||
| }) |
| .bs-docs-header | ||
| .container | ||
| h1 Methods | ||
| .container | ||
| p In Bootstrap Switch, every option is also a method. | ||
| p If the second parameter is omitted, the method returns the current value. | ||
| p You can invoke methods as follows: | ||
| pre: code $('input[name="my-checkbox"]').bootstrapSwitch('state', true, true); | ||
| h2 Additional Methods | ||
| table.table.table-bordered.table-striped.table-responsive | ||
| thead | ||
| tr | ||
| th Name | ||
| th Description | ||
| tbody | ||
| tr | ||
| td toggleState | ||
| td Toggle the switch state | ||
| tr | ||
| td toggleAnimate | ||
| td Toggle the animate option | ||
| tr | ||
| td toggleDisabled | ||
| td Toggle the disabled state | ||
| tr | ||
| td toggleReadonly | ||
| td Toggle the readonly state | ||
| tr | ||
| td toggleIndeterminate | ||
| td Toggle the indeterminate state | ||
| tr | ||
| td toggleInverse | ||
| td Toggle the inverse option | ||
| tr | ||
| td destroy | ||
| td Destroy the instance of Bootstrap Switch | ||
| h2 Special Behaviours | ||
| ul | ||
| li The method <code>state</code> can receive an optional third parameter <code>skip</code>. if true, <code>switchChange</code> event is not executed. The default is false. | ||
| li The method <code>toggleState</code> can receive an optional second parameter <code>skip</code>. if true, <code>switchChange</code> event is not executed. The default is false. | ||
| li The method <code>wrapperClass</code> can accept a falsy value as second parameter. If so, it resets the class to its default. |
| .bs-docs-header | ||
| .container | ||
| h1 Options | ||
| .container | ||
| table.table.table-bordered.table-striped.table-responsive | ||
| thead | ||
| tr | ||
| th Name | ||
| th Attribute | ||
| th Type | ||
| th Description | ||
| th Values | ||
| th Default | ||
| tbody | ||
| tr | ||
| td state | ||
| td checked | ||
| td Boolean | ||
| td The checkbox state | ||
| td true, false | ||
| td true | ||
| tr | ||
| td size | ||
| td data-size | ||
| td String | ||
| td The checkbox size | ||
| td null, 'mini', 'small', 'normal', 'large' | ||
| td null | ||
| tr | ||
| td animate | ||
| td data-animate | ||
| td Boolean | ||
| td Animate the switch | ||
| td true, false | ||
| td true | ||
| tr | ||
| td disabled | ||
| td disabled | ||
| td Boolean | ||
| td Disable state | ||
| td true, false | ||
| td false | ||
| tr | ||
| td readonly | ||
| td readonly | ||
| td Boolean | ||
| td Readonly state | ||
| td true, false | ||
| td false | ||
| tr | ||
| td indeterminate | ||
| td data-indeterminate | ||
| td Boolean | ||
| td Indeterminate state | ||
| td true, false | ||
| td false | ||
| tr | ||
| td inverse | ||
| td data-inverse | ||
| td Boolean | ||
| td Inverse switch direction | ||
| td true, false | ||
| td false | ||
| tr | ||
| td radioAllOff | ||
| td data-radio-all-off | ||
| td Boolean | ||
| td Allow this radio button to be unchecked by the user | ||
| td true, false | ||
| td false | ||
| tr | ||
| td onColor | ||
| td data-on-color | ||
| td String | ||
| td Color of the left side of the switch | ||
| td 'primary', 'info', 'success', 'warning', 'danger', 'default' | ||
| td 'primary' | ||
| tr | ||
| td offColor | ||
| td data-off-color | ||
| td String | ||
| td Color of the right side of the switch | ||
| td 'primary', 'info', 'success', 'warning', 'danger', 'default' | ||
| td 'default' | ||
| tr | ||
| td onText | ||
| td data-on-text | ||
| td String | ||
| td Text of the left side of the switch | ||
| td String | ||
| td 'ON' | ||
| tr | ||
| td offText | ||
| td data-off-text | ||
| td String | ||
| td Text of the right side of the switch | ||
| td String | ||
| td 'OFF' | ||
| tr | ||
| td labelText | ||
| td data-label-text | ||
| td String | ||
| td Text of the center handle of the switch | ||
| td String | ||
| td '&nbsp;' | ||
| tr | ||
| td handleWidth | ||
| td data-handle-width | ||
| td String | Number | ||
| td Width of the left and right sides in pixels | ||
| td 'auto' or Number | ||
| td 'auto' | ||
| tr | ||
| td labelWidth | ||
| td data-label-width | ||
| td String | Number | ||
| td Width of the center handle in pixels | ||
| td 'auto' or Number | ||
| td 'auto' | ||
| tr | ||
| td baseClass | ||
| td data-base-class | ||
| td String | ||
| td Global class prefix | ||
| td String | ||
| td 'bootstrap-switch' | ||
| tr | ||
| td wrapperClass | ||
| td data-wrapper-class | ||
| td String | Array | ||
| td Container element class(es) | ||
| td String | Array | ||
| td 'wrapper' | ||
| tr | ||
| td onInit | ||
| td | ||
| td Function | ||
| td Callback function to execute on initialization | ||
| td Function | ||
| td: pre: code.javascript function(event, state) {} | ||
| tr | ||
| td onSwitchChange | ||
| td | ||
| td Function | ||
| td Callback function to execute on switch state change. If false is returned, the status will be reverted, otherwise nothing changes | ||
| td Function | ||
| td: pre: code.javascript function(event, state) {} | ||
| h2 Global Defaults Overriding | ||
| p Follow the jQuery convention to override the default options of the library. For instance: | ||
| pre | ||
| code | ||
| | $.fn.bootstrapSwitch.defaults.size = 'large'; | ||
| | $.fn.bootstrapSwitch.defaults.onColor = 'success'; |
Sorry, the diff of this file is not supported yet
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
533941
60.38%84
5%2766
1.69%3
-25%0
-100%22
4.76%77
-22.22%2
100%