now-ui-kit-rails 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rspec +1 -0
- data/CODE_OF_CONDUCT.md +49 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +31 -0
- data/Rakefile +27 -0
- data/app/assets/fonts/now_ui_kit/.keep +0 -0
- data/app/assets/fonts/now_ui_kit/nucleo-outline.eot +0 -0
- data/app/assets/fonts/now_ui_kit/nucleo-outline.ttf +0 -0
- data/app/assets/fonts/now_ui_kit/nucleo-outline.woff +0 -0
- data/app/assets/fonts/now_ui_kit/nucleo-outline.woff2 +0 -0
- data/app/assets/images/now_ui_kit/.keep +0 -0
- data/app/assets/images/now_ui_kit/apple-icon.png +0 -0
- data/app/assets/images/now_ui_kit/avatar.jpg +0 -0
- data/app/assets/images/now_ui_kit/bg1.jpg +0 -0
- data/app/assets/images/now_ui_kit/bg11.jpg +0 -0
- data/app/assets/images/now_ui_kit/bg3.jpg +0 -0
- data/app/assets/images/now_ui_kit/bg4.jpg +0 -0
- data/app/assets/images/now_ui_kit/bg5.jpg +0 -0
- data/app/assets/images/now_ui_kit/bg6.jpg +0 -0
- data/app/assets/images/now_ui_kit/bg7.jpg +0 -0
- data/app/assets/images/now_ui_kit/bg8.jpg +0 -0
- data/app/assets/images/now_ui_kit/blurred-image-1.jpg +0 -0
- data/app/assets/images/now_ui_kit/creative-tim-white-slim2.png +0 -0
- data/app/assets/images/now_ui_kit/default-avatar.png +0 -0
- data/app/assets/images/now_ui_kit/eva.jpg +0 -0
- data/app/assets/images/now_ui_kit/favicon.png +0 -0
- data/app/assets/images/now_ui_kit/flags/AD.png +0 -0
- data/app/assets/images/now_ui_kit/flags/AE.png +0 -0
- data/app/assets/images/now_ui_kit/flags/AG.png +0 -0
- data/app/assets/images/now_ui_kit/flags/AM.png +0 -0
- data/app/assets/images/now_ui_kit/flags/AR.png +0 -0
- data/app/assets/images/now_ui_kit/flags/AT.png +0 -0
- data/app/assets/images/now_ui_kit/flags/AU.png +0 -0
- data/app/assets/images/now_ui_kit/flags/BE.png +0 -0
- data/app/assets/images/now_ui_kit/flags/BF.png +0 -0
- data/app/assets/images/now_ui_kit/flags/BG.png +0 -0
- data/app/assets/images/now_ui_kit/flags/BO.png +0 -0
- data/app/assets/images/now_ui_kit/flags/BR.png +0 -0
- data/app/assets/images/now_ui_kit/flags/CA.png +0 -0
- data/app/assets/images/now_ui_kit/flags/CD.png +0 -0
- data/app/assets/images/now_ui_kit/flags/CG.png +0 -0
- data/app/assets/images/now_ui_kit/flags/CH.png +0 -0
- data/app/assets/images/now_ui_kit/flags/CL.png +0 -0
- data/app/assets/images/now_ui_kit/flags/CM.png +0 -0
- data/app/assets/images/now_ui_kit/flags/CN.png +0 -0
- data/app/assets/images/now_ui_kit/flags/CO.png +0 -0
- data/app/assets/images/now_ui_kit/flags/CZ.png +0 -0
- data/app/assets/images/now_ui_kit/flags/DE.png +0 -0
- data/app/assets/images/now_ui_kit/flags/DJ.png +0 -0
- data/app/assets/images/now_ui_kit/flags/DK.png +0 -0
- data/app/assets/images/now_ui_kit/flags/DZ.png +0 -0
- data/app/assets/images/now_ui_kit/flags/EE.png +0 -0
- data/app/assets/images/now_ui_kit/flags/EG.png +0 -0
- data/app/assets/images/now_ui_kit/flags/ES.png +0 -0
- data/app/assets/images/now_ui_kit/flags/FI.png +0 -0
- data/app/assets/images/now_ui_kit/flags/FR.png +0 -0
- data/app/assets/images/now_ui_kit/flags/GA.png +0 -0
- data/app/assets/images/now_ui_kit/flags/GB.png +0 -0
- data/app/assets/images/now_ui_kit/flags/GM.png +0 -0
- data/app/assets/images/now_ui_kit/flags/GT.png +0 -0
- data/app/assets/images/now_ui_kit/flags/HN.png +0 -0
- data/app/assets/images/now_ui_kit/flags/HT.png +0 -0
- data/app/assets/images/now_ui_kit/flags/HU.png +0 -0
- data/app/assets/images/now_ui_kit/flags/ID.png +0 -0
- data/app/assets/images/now_ui_kit/flags/IE.png +0 -0
- data/app/assets/images/now_ui_kit/flags/IL.png +0 -0
- data/app/assets/images/now_ui_kit/flags/IN.png +0 -0
- data/app/assets/images/now_ui_kit/flags/IQ.png +0 -0
- data/app/assets/images/now_ui_kit/flags/IR.png +0 -0
- data/app/assets/images/now_ui_kit/flags/IT.png +0 -0
- data/app/assets/images/now_ui_kit/flags/JM.png +0 -0
- data/app/assets/images/now_ui_kit/flags/JO.png +0 -0
- data/app/assets/images/now_ui_kit/flags/JP.png +0 -0
- data/app/assets/images/now_ui_kit/flags/KG.png +0 -0
- data/app/assets/images/now_ui_kit/flags/KN.png +0 -0
- data/app/assets/images/now_ui_kit/flags/KP.png +0 -0
- data/app/assets/images/now_ui_kit/flags/KR.png +0 -0
- data/app/assets/images/now_ui_kit/flags/KW.png +0 -0
- data/app/assets/images/now_ui_kit/flags/KZ.png +0 -0
- data/app/assets/images/now_ui_kit/flags/LA.png +0 -0
- data/app/assets/images/now_ui_kit/flags/LB.png +0 -0
- data/app/assets/images/now_ui_kit/flags/LC.png +0 -0
- data/app/assets/images/now_ui_kit/flags/LS.png +0 -0
- data/app/assets/images/now_ui_kit/flags/LU.png +0 -0
- data/app/assets/images/now_ui_kit/flags/LV.png +0 -0
- data/app/assets/images/now_ui_kit/flags/MG.png +0 -0
- data/app/assets/images/now_ui_kit/flags/MK.png +0 -0
- data/app/assets/images/now_ui_kit/flags/ML.png +0 -0
- data/app/assets/images/now_ui_kit/flags/MM.png +0 -0
- data/app/assets/images/now_ui_kit/flags/MT.png +0 -0
- data/app/assets/images/now_ui_kit/flags/MX.png +0 -0
- data/app/assets/images/now_ui_kit/flags/NA.png +0 -0
- data/app/assets/images/now_ui_kit/flags/NE.png +0 -0
- data/app/assets/images/now_ui_kit/flags/NG.png +0 -0
- data/app/assets/images/now_ui_kit/flags/NI.png +0 -0
- data/app/assets/images/now_ui_kit/flags/NL.png +0 -0
- data/app/assets/images/now_ui_kit/flags/NO.png +0 -0
- data/app/assets/images/now_ui_kit/flags/OM.png +0 -0
- data/app/assets/images/now_ui_kit/flags/PA.png +0 -0
- data/app/assets/images/now_ui_kit/flags/PE.png +0 -0
- data/app/assets/images/now_ui_kit/flags/PG.png +0 -0
- data/app/assets/images/now_ui_kit/flags/PK.png +0 -0
- data/app/assets/images/now_ui_kit/flags/PL.png +0 -0
- data/app/assets/images/now_ui_kit/flags/PT.png +0 -0
- data/app/assets/images/now_ui_kit/flags/PY.png +0 -0
- data/app/assets/images/now_ui_kit/flags/QA.png +0 -0
- data/app/assets/images/now_ui_kit/flags/RO.png +0 -0
- data/app/assets/images/now_ui_kit/flags/RU.png +0 -0
- data/app/assets/images/now_ui_kit/flags/RW.png +0 -0
- data/app/assets/images/now_ui_kit/flags/SA.png +0 -0
- data/app/assets/images/now_ui_kit/flags/SE.png +0 -0
- data/app/assets/images/now_ui_kit/flags/SG.png +0 -0
- data/app/assets/images/now_ui_kit/flags/SL.png +0 -0
- data/app/assets/images/now_ui_kit/flags/SN.png +0 -0
- data/app/assets/images/now_ui_kit/flags/SO.png +0 -0
- data/app/assets/images/now_ui_kit/flags/SV.png +0 -0
- data/app/assets/images/now_ui_kit/flags/TD.png +0 -0
- data/app/assets/images/now_ui_kit/flags/TJ.png +0 -0
- data/app/assets/images/now_ui_kit/flags/TL.png +0 -0
- data/app/assets/images/now_ui_kit/flags/TR.png +0 -0
- data/app/assets/images/now_ui_kit/flags/TZ.png +0 -0
- data/app/assets/images/now_ui_kit/flags/UA.png +0 -0
- data/app/assets/images/now_ui_kit/flags/US.png +0 -0
- data/app/assets/images/now_ui_kit/flags/VE.png +0 -0
- data/app/assets/images/now_ui_kit/flags/VN.png +0 -0
- data/app/assets/images/now_ui_kit/flags/YE.png +0 -0
- data/app/assets/images/now_ui_kit/header.jpg +0 -0
- data/app/assets/images/now_ui_kit/hero-image-1.png +0 -0
- data/app/assets/images/now_ui_kit/hero-image-2.png +0 -0
- data/app/assets/images/now_ui_kit/hero-image-3.png +0 -0
- data/app/assets/images/now_ui_kit/invision-white-slim.png +0 -0
- data/app/assets/images/now_ui_kit/landing.jpg +0 -0
- data/app/assets/images/now_ui_kit/login.jpg +0 -0
- data/app/assets/images/now_ui_kit/logo-square.jpg +0 -0
- data/app/assets/images/now_ui_kit/logo.png +0 -0
- data/app/assets/images/now_ui_kit/now-logo.png +0 -0
- data/app/assets/images/now_ui_kit/nucleo-logo.svg +1 -0
- data/app/assets/images/now_ui_kit/profile.jpg +0 -0
- data/app/assets/images/now_ui_kit/ryan.jpg +0 -0
- data/app/assets/javascripts/now_ui_kit/.keep +0 -0
- data/app/assets/javascripts/now_ui_kit/core/bootstrap.min.js +7 -0
- data/app/assets/javascripts/now_ui_kit/core/jquery.3.2.1.min.js +4 -0
- data/app/assets/javascripts/now_ui_kit/core/tether.min.js +1 -0
- data/app/assets/javascripts/now_ui_kit/now-ui-kit.js +238 -0
- data/app/assets/javascripts/now_ui_kit/plugins/bootstrap-datepicker.js +2031 -0
- data/app/assets/javascripts/now_ui_kit/plugins/bootstrap-switch.js +744 -0
- data/app/assets/javascripts/now_ui_kit/plugins/nouislider.min.js +3 -0
- data/app/assets/stylesheets/now_ui_kit/.keep +0 -0
- data/app/assets/stylesheets/now_ui_kit/now-ui-kit.scss +57 -0
- data/app/assets/stylesheets/now_ui_kit/now-ui-kit/_alerts.scss +53 -0
- data/app/assets/stylesheets/now_ui_kit/now-ui-kit/_badges.scss +39 -0
- data/app/assets/stylesheets/now_ui_kit/now-ui-kit/_buttons.scss +158 -0
- data/app/assets/stylesheets/now_ui_kit/now-ui-kit/_cards.scss +96 -0
- data/app/assets/stylesheets/now_ui_kit/now-ui-kit/_carousel.scss +15 -0
- data/app/assets/stylesheets/now_ui_kit/now-ui-kit/_checkboxes-radio.scss +178 -0
- data/app/assets/stylesheets/now_ui_kit/now-ui-kit/_dropdown.scss +106 -0
- data/app/assets/stylesheets/now_ui_kit/now-ui-kit/_example-pages.scss +256 -0
- data/app/assets/stylesheets/now_ui_kit/now-ui-kit/_footers.scss +45 -0
- data/app/assets/stylesheets/now_ui_kit/now-ui-kit/_images.scss +7 -0
- data/app/assets/stylesheets/now_ui_kit/now-ui-kit/_inputs.scss +248 -0
- data/app/assets/stylesheets/now_ui_kit/now-ui-kit/_misc.scss +62 -0
- data/app/assets/stylesheets/now_ui_kit/now-ui-kit/_mixins.scss +13 -0
- data/app/assets/stylesheets/now_ui_kit/now-ui-kit/_modals.scss +173 -0
- data/app/assets/stylesheets/now_ui_kit/now-ui-kit/_navbar.scss +183 -0
- data/app/assets/stylesheets/now_ui_kit/now-ui-kit/_nucleo-outline.scss +534 -0
- data/app/assets/stylesheets/now_ui_kit/now-ui-kit/_pagination.scss +136 -0
- data/app/assets/stylesheets/now_ui_kit/now-ui-kit/_pills.scss +131 -0
- data/app/assets/stylesheets/now_ui_kit/now-ui-kit/_popups.scss +75 -0
- data/app/assets/stylesheets/now_ui_kit/now-ui-kit/_progress.scss +126 -0
- data/app/assets/stylesheets/now_ui_kit/now-ui-kit/_responsive.scss +454 -0
- data/app/assets/stylesheets/now_ui_kit/now-ui-kit/_sections.scss +384 -0
- data/app/assets/stylesheets/now_ui_kit/now-ui-kit/_social-buttons.scss +39 -0
- data/app/assets/stylesheets/now_ui_kit/now-ui-kit/_tabs.scss +110 -0
- data/app/assets/stylesheets/now_ui_kit/now-ui-kit/_typography.scss +150 -0
- data/app/assets/stylesheets/now_ui_kit/now-ui-kit/_variables.scss +248 -0
- data/app/assets/stylesheets/now_ui_kit/now-ui-kit/mixins/_badges.scss +4 -0
- data/app/assets/stylesheets/now_ui_kit/now-ui-kit/mixins/_buttons.scss +152 -0
- data/app/assets/stylesheets/now_ui_kit/now-ui-kit/mixins/_datepicker.scss +121 -0
- data/app/assets/stylesheets/now_ui_kit/now-ui-kit/mixins/_dropdown.scss +24 -0
- data/app/assets/stylesheets/now_ui_kit/now-ui-kit/mixins/_inputs.scss +205 -0
- data/app/assets/stylesheets/now_ui_kit/now-ui-kit/mixins/_modals.scss +12 -0
- data/app/assets/stylesheets/now_ui_kit/now-ui-kit/mixins/_pages.scss +7 -0
- data/app/assets/stylesheets/now_ui_kit/now-ui-kit/mixins/_popovers.scss +25 -0
- data/app/assets/stylesheets/now_ui_kit/now-ui-kit/mixins/_transparency.scss +8 -0
- data/app/assets/stylesheets/now_ui_kit/now-ui-kit/mixins/_vendor-prefixes.scss +160 -0
- data/app/assets/stylesheets/now_ui_kit/now-ui-kit/plugins/_plugin-bootstrap-switch.scss +304 -0
- data/app/assets/stylesheets/now_ui_kit/now-ui-kit/plugins/_plugin-datepicker.scss +521 -0
- data/app/assets/stylesheets/now_ui_kit/now-ui-kit/plugins/_plugin-nouislider.scss +351 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/now-ui-kit.rb +1 -0
- data/lib/now_ui_kit.rb +2 -0
- data/lib/now_ui_kit/engine.rb +6 -0
- data/lib/now_ui_kit/version.rb +5 -0
- data/now-ui-kit-rails.gemspec +27 -0
- metadata +297 -0
@@ -0,0 +1,744 @@
|
|
1
|
+
/* ========================================================================
|
2
|
+
* bootstrap-switch - v3.3.2
|
3
|
+
* http://www.bootstrap-switch.org
|
4
|
+
* ========================================================================
|
5
|
+
* Copyright 2012-2013 Mattia Larentis
|
6
|
+
*
|
7
|
+
* ========================================================================
|
8
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
9
|
+
* you may not use this file except in compliance with the License.
|
10
|
+
* You may obtain a copy of the License at
|
11
|
+
*
|
12
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
13
|
+
*
|
14
|
+
* Unless required by applicable law or agreed to in writing, software
|
15
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
16
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
17
|
+
* See the License for the specific language governing permissions and
|
18
|
+
* limitations under the License.
|
19
|
+
* ========================================================================
|
20
|
+
*/
|
21
|
+
|
22
|
+
(function() {
|
23
|
+
var slice = [].slice;
|
24
|
+
|
25
|
+
(function($, window) {
|
26
|
+
"use strict";
|
27
|
+
var BootstrapSwitch;
|
28
|
+
BootstrapSwitch = (function() {
|
29
|
+
function BootstrapSwitch(element, options) {
|
30
|
+
if (options == null) {
|
31
|
+
options = {};
|
32
|
+
}
|
33
|
+
this.$element = $(element);
|
34
|
+
this.options = $.extend({}, $.fn.bootstrapSwitch.defaults, {
|
35
|
+
state: this.$element.is(":checked"),
|
36
|
+
size: this.$element.data("size"),
|
37
|
+
animate: this.$element.data("animate"),
|
38
|
+
disabled: this.$element.is(":disabled"),
|
39
|
+
readonly: this.$element.is("[readonly]"),
|
40
|
+
indeterminate: this.$element.data("indeterminate"),
|
41
|
+
inverse: this.$element.data("inverse"),
|
42
|
+
radioAllOff: this.$element.data("radio-all-off"),
|
43
|
+
onColor: this.$element.data("on-color"),
|
44
|
+
offColor: this.$element.data("off-color"),
|
45
|
+
onText: this.$element.data("on-text"),
|
46
|
+
offText: this.$element.data("off-text"),
|
47
|
+
labelText: this.$element.data("label-text"),
|
48
|
+
handleWidth: this.$element.data("handle-width"),
|
49
|
+
labelWidth: this.$element.data("label-width"),
|
50
|
+
baseClass: this.$element.data("base-class"),
|
51
|
+
wrapperClass: this.$element.data("wrapper-class")
|
52
|
+
}, options);
|
53
|
+
this.prevOptions = {};
|
54
|
+
this.$wrapper = $("<div>", {
|
55
|
+
"class": (function(_this) {
|
56
|
+
return function() {
|
57
|
+
var classes;
|
58
|
+
classes = ["" + _this.options.baseClass].concat(_this._getClasses(_this.options.wrapperClass));
|
59
|
+
classes.push(_this.options.state ? _this.options.baseClass + "-on" : _this.options.baseClass + "-off");
|
60
|
+
if (_this.options.size != null) {
|
61
|
+
classes.push(_this.options.baseClass + "-" + _this.options.size);
|
62
|
+
}
|
63
|
+
if (_this.options.disabled) {
|
64
|
+
classes.push(_this.options.baseClass + "-disabled");
|
65
|
+
}
|
66
|
+
if (_this.options.readonly) {
|
67
|
+
classes.push(_this.options.baseClass + "-readonly");
|
68
|
+
}
|
69
|
+
if (_this.options.indeterminate) {
|
70
|
+
classes.push(_this.options.baseClass + "-indeterminate");
|
71
|
+
}
|
72
|
+
if (_this.options.inverse) {
|
73
|
+
classes.push(_this.options.baseClass + "-inverse");
|
74
|
+
}
|
75
|
+
if (_this.$element.attr("id")) {
|
76
|
+
classes.push(_this.options.baseClass + "-id-" + (_this.$element.attr("id")));
|
77
|
+
}
|
78
|
+
return classes.join(" ");
|
79
|
+
};
|
80
|
+
})(this)()
|
81
|
+
});
|
82
|
+
this.$container = $("<div>", {
|
83
|
+
"class": this.options.baseClass + "-container"
|
84
|
+
});
|
85
|
+
this.$on = $("<span>", {
|
86
|
+
html: this.options.onText,
|
87
|
+
"class": this.options.baseClass + "-handle-on " + this.options.baseClass + "-" + this.options.onColor
|
88
|
+
});
|
89
|
+
this.$off = $("<span>", {
|
90
|
+
html: this.options.offText,
|
91
|
+
"class": this.options.baseClass + "-handle-off " + this.options.baseClass + "-" + this.options.offColor
|
92
|
+
});
|
93
|
+
this.$label = $("<span>", {
|
94
|
+
html: this.options.labelText,
|
95
|
+
"class": this.options.baseClass + "-label"
|
96
|
+
});
|
97
|
+
this.$element.on("init.bootstrapSwitch", (function(_this) {
|
98
|
+
return function() {
|
99
|
+
return _this.options.onInit.apply(element, arguments);
|
100
|
+
};
|
101
|
+
})(this));
|
102
|
+
this.$element.on("switchChange.bootstrapSwitch", (function(_this) {
|
103
|
+
return function(e) {
|
104
|
+
if (false === _this.options.onSwitchChange.apply(element, arguments)) {
|
105
|
+
if (_this.$element.is(":radio")) {
|
106
|
+
return $("[name='" + (_this.$element.attr('name')) + "']").trigger("previousState.bootstrapSwitch", true);
|
107
|
+
} else {
|
108
|
+
return _this.$element.trigger("previousState.bootstrapSwitch", true);
|
109
|
+
}
|
110
|
+
}
|
111
|
+
};
|
112
|
+
})(this));
|
113
|
+
this.$container = this.$element.wrap(this.$container).parent();
|
114
|
+
this.$wrapper = this.$container.wrap(this.$wrapper).parent();
|
115
|
+
this.$element.before(this.options.inverse ? this.$off : this.$on).before(this.$label).before(this.options.inverse ? this.$on : this.$off);
|
116
|
+
if (this.options.indeterminate) {
|
117
|
+
this.$element.prop("indeterminate", true);
|
118
|
+
}
|
119
|
+
this._init();
|
120
|
+
this._elementHandlers();
|
121
|
+
this._handleHandlers();
|
122
|
+
this._labelHandlers();
|
123
|
+
this._formHandler();
|
124
|
+
this._externalLabelHandler();
|
125
|
+
this.$element.trigger("init.bootstrapSwitch", this.options.state);
|
126
|
+
}
|
127
|
+
|
128
|
+
BootstrapSwitch.prototype._constructor = BootstrapSwitch;
|
129
|
+
|
130
|
+
BootstrapSwitch.prototype.setPrevOptions = function() {
|
131
|
+
return this.prevOptions = $.extend(true, {}, this.options);
|
132
|
+
};
|
133
|
+
|
134
|
+
BootstrapSwitch.prototype.state = function(value, skip) {
|
135
|
+
if (typeof value === "undefined") {
|
136
|
+
return this.options.state;
|
137
|
+
}
|
138
|
+
if (this.options.disabled || this.options.readonly) {
|
139
|
+
return this.$element;
|
140
|
+
}
|
141
|
+
if (this.options.state && !this.options.radioAllOff && this.$element.is(":radio")) {
|
142
|
+
return this.$element;
|
143
|
+
}
|
144
|
+
if (this.$element.is(":radio")) {
|
145
|
+
$("[name='" + (this.$element.attr('name')) + "']").trigger("setPreviousOptions.bootstrapSwitch");
|
146
|
+
} else {
|
147
|
+
this.$element.trigger("setPreviousOptions.bootstrapSwitch");
|
148
|
+
}
|
149
|
+
if (this.options.indeterminate) {
|
150
|
+
this.indeterminate(false);
|
151
|
+
}
|
152
|
+
value = !!value;
|
153
|
+
this.$element.prop("checked", value).trigger("change.bootstrapSwitch", skip);
|
154
|
+
return this.$element;
|
155
|
+
};
|
156
|
+
|
157
|
+
BootstrapSwitch.prototype.toggleState = function(skip) {
|
158
|
+
if (this.options.disabled || this.options.readonly) {
|
159
|
+
return this.$element;
|
160
|
+
}
|
161
|
+
if (this.options.indeterminate) {
|
162
|
+
this.indeterminate(false);
|
163
|
+
return this.state(true);
|
164
|
+
} else {
|
165
|
+
return this.$element.prop("checked", !this.options.state).trigger("change.bootstrapSwitch", skip);
|
166
|
+
}
|
167
|
+
};
|
168
|
+
|
169
|
+
BootstrapSwitch.prototype.size = function(value) {
|
170
|
+
if (typeof value === "undefined") {
|
171
|
+
return this.options.size;
|
172
|
+
}
|
173
|
+
if (this.options.size != null) {
|
174
|
+
this.$wrapper.removeClass(this.options.baseClass + "-" + this.options.size);
|
175
|
+
}
|
176
|
+
if (value) {
|
177
|
+
this.$wrapper.addClass(this.options.baseClass + "-" + value);
|
178
|
+
}
|
179
|
+
this._width();
|
180
|
+
this._containerPosition();
|
181
|
+
this.options.size = value;
|
182
|
+
return this.$element;
|
183
|
+
};
|
184
|
+
|
185
|
+
BootstrapSwitch.prototype.animate = function(value) {
|
186
|
+
if (typeof value === "undefined") {
|
187
|
+
return this.options.animate;
|
188
|
+
}
|
189
|
+
value = !!value;
|
190
|
+
if (value === this.options.animate) {
|
191
|
+
return this.$element;
|
192
|
+
}
|
193
|
+
return this.toggleAnimate();
|
194
|
+
};
|
195
|
+
|
196
|
+
BootstrapSwitch.prototype.toggleAnimate = function() {
|
197
|
+
this.options.animate = !this.options.animate;
|
198
|
+
this.$wrapper.toggleClass(this.options.baseClass + "-animate");
|
199
|
+
return this.$element;
|
200
|
+
};
|
201
|
+
|
202
|
+
BootstrapSwitch.prototype.disabled = function(value) {
|
203
|
+
if (typeof value === "undefined") {
|
204
|
+
return this.options.disabled;
|
205
|
+
}
|
206
|
+
value = !!value;
|
207
|
+
if (value === this.options.disabled) {
|
208
|
+
return this.$element;
|
209
|
+
}
|
210
|
+
return this.toggleDisabled();
|
211
|
+
};
|
212
|
+
|
213
|
+
BootstrapSwitch.prototype.toggleDisabled = function() {
|
214
|
+
this.options.disabled = !this.options.disabled;
|
215
|
+
this.$element.prop("disabled", this.options.disabled);
|
216
|
+
this.$wrapper.toggleClass(this.options.baseClass + "-disabled");
|
217
|
+
return this.$element;
|
218
|
+
};
|
219
|
+
|
220
|
+
BootstrapSwitch.prototype.readonly = function(value) {
|
221
|
+
if (typeof value === "undefined") {
|
222
|
+
return this.options.readonly;
|
223
|
+
}
|
224
|
+
value = !!value;
|
225
|
+
if (value === this.options.readonly) {
|
226
|
+
return this.$element;
|
227
|
+
}
|
228
|
+
return this.toggleReadonly();
|
229
|
+
};
|
230
|
+
|
231
|
+
BootstrapSwitch.prototype.toggleReadonly = function() {
|
232
|
+
this.options.readonly = !this.options.readonly;
|
233
|
+
this.$element.prop("readonly", this.options.readonly);
|
234
|
+
this.$wrapper.toggleClass(this.options.baseClass + "-readonly");
|
235
|
+
return this.$element;
|
236
|
+
};
|
237
|
+
|
238
|
+
BootstrapSwitch.prototype.indeterminate = function(value) {
|
239
|
+
if (typeof value === "undefined") {
|
240
|
+
return this.options.indeterminate;
|
241
|
+
}
|
242
|
+
value = !!value;
|
243
|
+
if (value === this.options.indeterminate) {
|
244
|
+
return this.$element;
|
245
|
+
}
|
246
|
+
return this.toggleIndeterminate();
|
247
|
+
};
|
248
|
+
|
249
|
+
BootstrapSwitch.prototype.toggleIndeterminate = function() {
|
250
|
+
this.options.indeterminate = !this.options.indeterminate;
|
251
|
+
this.$element.prop("indeterminate", this.options.indeterminate);
|
252
|
+
this.$wrapper.toggleClass(this.options.baseClass + "-indeterminate");
|
253
|
+
this._containerPosition();
|
254
|
+
return this.$element;
|
255
|
+
};
|
256
|
+
|
257
|
+
BootstrapSwitch.prototype.inverse = function(value) {
|
258
|
+
if (typeof value === "undefined") {
|
259
|
+
return this.options.inverse;
|
260
|
+
}
|
261
|
+
value = !!value;
|
262
|
+
if (value === this.options.inverse) {
|
263
|
+
return this.$element;
|
264
|
+
}
|
265
|
+
return this.toggleInverse();
|
266
|
+
};
|
267
|
+
|
268
|
+
BootstrapSwitch.prototype.toggleInverse = function() {
|
269
|
+
var $off, $on;
|
270
|
+
this.$wrapper.toggleClass(this.options.baseClass + "-inverse");
|
271
|
+
$on = this.$on.clone(true);
|
272
|
+
$off = this.$off.clone(true);
|
273
|
+
this.$on.replaceWith($off);
|
274
|
+
this.$off.replaceWith($on);
|
275
|
+
this.$on = $off;
|
276
|
+
this.$off = $on;
|
277
|
+
this.options.inverse = !this.options.inverse;
|
278
|
+
return this.$element;
|
279
|
+
};
|
280
|
+
|
281
|
+
BootstrapSwitch.prototype.onColor = function(value) {
|
282
|
+
var color;
|
283
|
+
color = this.options.onColor;
|
284
|
+
if (typeof value === "undefined") {
|
285
|
+
return color;
|
286
|
+
}
|
287
|
+
if (color != null) {
|
288
|
+
this.$on.removeClass(this.options.baseClass + "-" + color);
|
289
|
+
}
|
290
|
+
this.$on.addClass(this.options.baseClass + "-" + value);
|
291
|
+
this.options.onColor = value;
|
292
|
+
return this.$element;
|
293
|
+
};
|
294
|
+
|
295
|
+
BootstrapSwitch.prototype.offColor = function(value) {
|
296
|
+
var color;
|
297
|
+
color = this.options.offColor;
|
298
|
+
if (typeof value === "undefined") {
|
299
|
+
return color;
|
300
|
+
}
|
301
|
+
if (color != null) {
|
302
|
+
this.$off.removeClass(this.options.baseClass + "-" + color);
|
303
|
+
}
|
304
|
+
this.$off.addClass(this.options.baseClass + "-" + value);
|
305
|
+
this.options.offColor = value;
|
306
|
+
return this.$element;
|
307
|
+
};
|
308
|
+
|
309
|
+
BootstrapSwitch.prototype.onText = function(value) {
|
310
|
+
if (typeof value === "undefined") {
|
311
|
+
return this.options.onText;
|
312
|
+
}
|
313
|
+
this.$on.html(value);
|
314
|
+
this._width();
|
315
|
+
this._containerPosition();
|
316
|
+
this.options.onText = value;
|
317
|
+
return this.$element;
|
318
|
+
};
|
319
|
+
|
320
|
+
BootstrapSwitch.prototype.offText = function(value) {
|
321
|
+
if (typeof value === "undefined") {
|
322
|
+
return this.options.offText;
|
323
|
+
}
|
324
|
+
this.$off.html(value);
|
325
|
+
this._width();
|
326
|
+
this._containerPosition();
|
327
|
+
this.options.offText = value;
|
328
|
+
return this.$element;
|
329
|
+
};
|
330
|
+
|
331
|
+
BootstrapSwitch.prototype.labelText = function(value) {
|
332
|
+
if (typeof value === "undefined") {
|
333
|
+
return this.options.labelText;
|
334
|
+
}
|
335
|
+
this.$label.html(value);
|
336
|
+
this._width();
|
337
|
+
this.options.labelText = value;
|
338
|
+
return this.$element;
|
339
|
+
};
|
340
|
+
|
341
|
+
BootstrapSwitch.prototype.handleWidth = function(value) {
|
342
|
+
if (typeof value === "undefined") {
|
343
|
+
return this.options.handleWidth;
|
344
|
+
}
|
345
|
+
this.options.handleWidth = value;
|
346
|
+
this._width();
|
347
|
+
this._containerPosition();
|
348
|
+
return this.$element;
|
349
|
+
};
|
350
|
+
|
351
|
+
BootstrapSwitch.prototype.labelWidth = function(value) {
|
352
|
+
if (typeof value === "undefined") {
|
353
|
+
return this.options.labelWidth;
|
354
|
+
}
|
355
|
+
this.options.labelWidth = value;
|
356
|
+
this._width();
|
357
|
+
this._containerPosition();
|
358
|
+
return this.$element;
|
359
|
+
};
|
360
|
+
|
361
|
+
BootstrapSwitch.prototype.baseClass = function(value) {
|
362
|
+
return this.options.baseClass;
|
363
|
+
};
|
364
|
+
|
365
|
+
BootstrapSwitch.prototype.wrapperClass = function(value) {
|
366
|
+
if (typeof value === "undefined") {
|
367
|
+
return this.options.wrapperClass;
|
368
|
+
}
|
369
|
+
if (!value) {
|
370
|
+
value = $.fn.bootstrapSwitch.defaults.wrapperClass;
|
371
|
+
}
|
372
|
+
this.$wrapper.removeClass(this._getClasses(this.options.wrapperClass).join(" "));
|
373
|
+
this.$wrapper.addClass(this._getClasses(value).join(" "));
|
374
|
+
this.options.wrapperClass = value;
|
375
|
+
return this.$element;
|
376
|
+
};
|
377
|
+
|
378
|
+
BootstrapSwitch.prototype.radioAllOff = function(value) {
|
379
|
+
if (typeof value === "undefined") {
|
380
|
+
return this.options.radioAllOff;
|
381
|
+
}
|
382
|
+
value = !!value;
|
383
|
+
if (value === this.options.radioAllOff) {
|
384
|
+
return this.$element;
|
385
|
+
}
|
386
|
+
this.options.radioAllOff = value;
|
387
|
+
return this.$element;
|
388
|
+
};
|
389
|
+
|
390
|
+
BootstrapSwitch.prototype.onInit = function(value) {
|
391
|
+
if (typeof value === "undefined") {
|
392
|
+
return this.options.onInit;
|
393
|
+
}
|
394
|
+
if (!value) {
|
395
|
+
value = $.fn.bootstrapSwitch.defaults.onInit;
|
396
|
+
}
|
397
|
+
this.options.onInit = value;
|
398
|
+
return this.$element;
|
399
|
+
};
|
400
|
+
|
401
|
+
BootstrapSwitch.prototype.onSwitchChange = function(value) {
|
402
|
+
if (typeof value === "undefined") {
|
403
|
+
return this.options.onSwitchChange;
|
404
|
+
}
|
405
|
+
if (!value) {
|
406
|
+
value = $.fn.bootstrapSwitch.defaults.onSwitchChange;
|
407
|
+
}
|
408
|
+
this.options.onSwitchChange = value;
|
409
|
+
return this.$element;
|
410
|
+
};
|
411
|
+
|
412
|
+
BootstrapSwitch.prototype.destroy = function() {
|
413
|
+
var $form;
|
414
|
+
$form = this.$element.closest("form");
|
415
|
+
if ($form.length) {
|
416
|
+
$form.off("reset.bootstrapSwitch").removeData("bootstrap-switch");
|
417
|
+
}
|
418
|
+
this.$container.children().not(this.$element).remove();
|
419
|
+
this.$element.unwrap().unwrap().off(".bootstrapSwitch").removeData("bootstrap-switch");
|
420
|
+
return this.$element;
|
421
|
+
};
|
422
|
+
|
423
|
+
BootstrapSwitch.prototype._width = function() {
|
424
|
+
var $handles, handleWidth;
|
425
|
+
$handles = this.$on.add(this.$off);
|
426
|
+
$handles.add(this.$label).css("width", "");
|
427
|
+
handleWidth = this.options.handleWidth === "auto" ? Math.max(this.$on.width(), this.$off.width()) : this.options.handleWidth;
|
428
|
+
$handles.width(handleWidth);
|
429
|
+
this.$label.width((function(_this) {
|
430
|
+
return function(index, width) {
|
431
|
+
if (_this.options.labelWidth !== "auto") {
|
432
|
+
return _this.options.labelWidth;
|
433
|
+
}
|
434
|
+
if (width < handleWidth) {
|
435
|
+
return handleWidth;
|
436
|
+
} else {
|
437
|
+
return width;
|
438
|
+
}
|
439
|
+
};
|
440
|
+
})(this));
|
441
|
+
this._handleWidth = this.$on.outerWidth();
|
442
|
+
this._labelWidth = this.$label.outerWidth();
|
443
|
+
this.$container.width((this._handleWidth * 2) + this._labelWidth);
|
444
|
+
return this.$wrapper.width(this._handleWidth + this._labelWidth);
|
445
|
+
};
|
446
|
+
|
447
|
+
BootstrapSwitch.prototype._containerPosition = function(state, callback) {
|
448
|
+
if (state == null) {
|
449
|
+
state = this.options.state;
|
450
|
+
}
|
451
|
+
this.$container.css("margin-left", (function(_this) {
|
452
|
+
return function() {
|
453
|
+
var values;
|
454
|
+
values = [0, "-" + _this._handleWidth + "px"];
|
455
|
+
if (_this.options.indeterminate) {
|
456
|
+
return "-" + (_this._handleWidth / 2) + "px";
|
457
|
+
}
|
458
|
+
if (state) {
|
459
|
+
if (_this.options.inverse) {
|
460
|
+
return values[1];
|
461
|
+
} else {
|
462
|
+
return values[0];
|
463
|
+
}
|
464
|
+
} else {
|
465
|
+
if (_this.options.inverse) {
|
466
|
+
return values[0];
|
467
|
+
} else {
|
468
|
+
return values[1];
|
469
|
+
}
|
470
|
+
}
|
471
|
+
};
|
472
|
+
})(this));
|
473
|
+
if (!callback) {
|
474
|
+
return;
|
475
|
+
}
|
476
|
+
return setTimeout(function() {
|
477
|
+
return callback();
|
478
|
+
}, 50);
|
479
|
+
};
|
480
|
+
|
481
|
+
BootstrapSwitch.prototype._init = function() {
|
482
|
+
var init, initInterval;
|
483
|
+
init = (function(_this) {
|
484
|
+
return function() {
|
485
|
+
_this.setPrevOptions();
|
486
|
+
_this._width();
|
487
|
+
return _this._containerPosition(null, function() {
|
488
|
+
if (_this.options.animate) {
|
489
|
+
return _this.$wrapper.addClass(_this.options.baseClass + "-animate");
|
490
|
+
}
|
491
|
+
});
|
492
|
+
};
|
493
|
+
})(this);
|
494
|
+
if (this.$wrapper.is(":visible")) {
|
495
|
+
return init();
|
496
|
+
}
|
497
|
+
return initInterval = window.setInterval((function(_this) {
|
498
|
+
return function() {
|
499
|
+
if (_this.$wrapper.is(":visible")) {
|
500
|
+
init();
|
501
|
+
return window.clearInterval(initInterval);
|
502
|
+
}
|
503
|
+
};
|
504
|
+
})(this), 50);
|
505
|
+
};
|
506
|
+
|
507
|
+
BootstrapSwitch.prototype._elementHandlers = function() {
|
508
|
+
return this.$element.on({
|
509
|
+
"setPreviousOptions.bootstrapSwitch": (function(_this) {
|
510
|
+
return function(e) {
|
511
|
+
return _this.setPrevOptions();
|
512
|
+
};
|
513
|
+
})(this),
|
514
|
+
"previousState.bootstrapSwitch": (function(_this) {
|
515
|
+
return function(e) {
|
516
|
+
_this.options = _this.prevOptions;
|
517
|
+
if (_this.options.indeterminate) {
|
518
|
+
_this.$wrapper.addClass(_this.options.baseClass + "-indeterminate");
|
519
|
+
}
|
520
|
+
return _this.$element.prop("checked", _this.options.state).trigger("change.bootstrapSwitch", true);
|
521
|
+
};
|
522
|
+
})(this),
|
523
|
+
"change.bootstrapSwitch": (function(_this) {
|
524
|
+
return function(e, skip) {
|
525
|
+
var state;
|
526
|
+
e.preventDefault();
|
527
|
+
e.stopImmediatePropagation();
|
528
|
+
state = _this.$element.is(":checked");
|
529
|
+
_this._containerPosition(state);
|
530
|
+
if (state === _this.options.state) {
|
531
|
+
return;
|
532
|
+
}
|
533
|
+
_this.options.state = state;
|
534
|
+
_this.$wrapper.toggleClass(_this.options.baseClass + "-off").toggleClass(_this.options.baseClass + "-on");
|
535
|
+
if (!skip) {
|
536
|
+
if (_this.$element.is(":radio")) {
|
537
|
+
$("[name='" + (_this.$element.attr('name')) + "']").not(_this.$element).prop("checked", false).trigger("change.bootstrapSwitch", true);
|
538
|
+
}
|
539
|
+
return _this.$element.trigger("switchChange.bootstrapSwitch", [state]);
|
540
|
+
}
|
541
|
+
};
|
542
|
+
})(this),
|
543
|
+
"focus.bootstrapSwitch": (function(_this) {
|
544
|
+
return function(e) {
|
545
|
+
e.preventDefault();
|
546
|
+
return _this.$wrapper.addClass(_this.options.baseClass + "-focused");
|
547
|
+
};
|
548
|
+
})(this),
|
549
|
+
"blur.bootstrapSwitch": (function(_this) {
|
550
|
+
return function(e) {
|
551
|
+
e.preventDefault();
|
552
|
+
return _this.$wrapper.removeClass(_this.options.baseClass + "-focused");
|
553
|
+
};
|
554
|
+
})(this),
|
555
|
+
"keydown.bootstrapSwitch": (function(_this) {
|
556
|
+
return function(e) {
|
557
|
+
if (!e.which || _this.options.disabled || _this.options.readonly) {
|
558
|
+
return;
|
559
|
+
}
|
560
|
+
switch (e.which) {
|
561
|
+
case 37:
|
562
|
+
e.preventDefault();
|
563
|
+
e.stopImmediatePropagation();
|
564
|
+
return _this.state(false);
|
565
|
+
case 39:
|
566
|
+
e.preventDefault();
|
567
|
+
e.stopImmediatePropagation();
|
568
|
+
return _this.state(true);
|
569
|
+
}
|
570
|
+
};
|
571
|
+
})(this)
|
572
|
+
});
|
573
|
+
};
|
574
|
+
|
575
|
+
BootstrapSwitch.prototype._handleHandlers = function() {
|
576
|
+
this.$on.on("click.bootstrapSwitch", (function(_this) {
|
577
|
+
return function(event) {
|
578
|
+
event.preventDefault();
|
579
|
+
event.stopPropagation();
|
580
|
+
_this.state(false);
|
581
|
+
return _this.$element.trigger("focus.bootstrapSwitch");
|
582
|
+
};
|
583
|
+
})(this));
|
584
|
+
return this.$off.on("click.bootstrapSwitch", (function(_this) {
|
585
|
+
return function(event) {
|
586
|
+
event.preventDefault();
|
587
|
+
event.stopPropagation();
|
588
|
+
_this.state(true);
|
589
|
+
return _this.$element.trigger("focus.bootstrapSwitch");
|
590
|
+
};
|
591
|
+
})(this));
|
592
|
+
};
|
593
|
+
|
594
|
+
BootstrapSwitch.prototype._labelHandlers = function() {
|
595
|
+
return this.$label.on({
|
596
|
+
"click": function(e) {
|
597
|
+
return e.stopPropagation();
|
598
|
+
},
|
599
|
+
"mousedown.bootstrapSwitch touchstart.bootstrapSwitch": (function(_this) {
|
600
|
+
return function(e) {
|
601
|
+
if (_this._dragStart || _this.options.disabled || _this.options.readonly) {
|
602
|
+
return;
|
603
|
+
}
|
604
|
+
e.preventDefault();
|
605
|
+
e.stopPropagation();
|
606
|
+
_this._dragStart = (e.pageX || e.originalEvent.touches[0].pageX) - parseInt(_this.$container.css("margin-left"), 10);
|
607
|
+
if (_this.options.animate) {
|
608
|
+
_this.$wrapper.removeClass(_this.options.baseClass + "-animate");
|
609
|
+
}
|
610
|
+
return _this.$element.trigger("focus.bootstrapSwitch");
|
611
|
+
};
|
612
|
+
})(this),
|
613
|
+
"mousemove.bootstrapSwitch touchmove.bootstrapSwitch": (function(_this) {
|
614
|
+
return function(e) {
|
615
|
+
var difference;
|
616
|
+
if (_this._dragStart == null) {
|
617
|
+
return;
|
618
|
+
}
|
619
|
+
e.preventDefault();
|
620
|
+
difference = (e.pageX || e.originalEvent.touches[0].pageX) - _this._dragStart;
|
621
|
+
if (difference < -_this._handleWidth || difference > 0) {
|
622
|
+
return;
|
623
|
+
}
|
624
|
+
_this._dragEnd = difference;
|
625
|
+
return _this.$container.css("margin-left", _this._dragEnd + "px");
|
626
|
+
};
|
627
|
+
})(this),
|
628
|
+
"mouseup.bootstrapSwitch touchend.bootstrapSwitch": (function(_this) {
|
629
|
+
return function(e) {
|
630
|
+
var state;
|
631
|
+
if (!_this._dragStart) {
|
632
|
+
return;
|
633
|
+
}
|
634
|
+
e.preventDefault();
|
635
|
+
if (_this.options.animate) {
|
636
|
+
_this.$wrapper.addClass(_this.options.baseClass + "-animate");
|
637
|
+
}
|
638
|
+
if (_this._dragEnd) {
|
639
|
+
state = _this._dragEnd > -(_this._handleWidth / 2);
|
640
|
+
_this._dragEnd = false;
|
641
|
+
_this.state(_this.options.inverse ? !state : state);
|
642
|
+
} else {
|
643
|
+
_this.state(!_this.options.state);
|
644
|
+
}
|
645
|
+
return _this._dragStart = false;
|
646
|
+
};
|
647
|
+
})(this),
|
648
|
+
"mouseleave.bootstrapSwitch": (function(_this) {
|
649
|
+
return function(e) {
|
650
|
+
return _this.$label.trigger("mouseup.bootstrapSwitch");
|
651
|
+
};
|
652
|
+
})(this)
|
653
|
+
});
|
654
|
+
};
|
655
|
+
|
656
|
+
BootstrapSwitch.prototype._externalLabelHandler = function() {
|
657
|
+
var $externalLabel;
|
658
|
+
$externalLabel = this.$element.closest("label");
|
659
|
+
return $externalLabel.on("click", (function(_this) {
|
660
|
+
return function(event) {
|
661
|
+
event.preventDefault();
|
662
|
+
event.stopImmediatePropagation();
|
663
|
+
if (event.target === $externalLabel[0]) {
|
664
|
+
return _this.toggleState();
|
665
|
+
}
|
666
|
+
};
|
667
|
+
})(this));
|
668
|
+
};
|
669
|
+
|
670
|
+
BootstrapSwitch.prototype._formHandler = function() {
|
671
|
+
var $form;
|
672
|
+
$form = this.$element.closest("form");
|
673
|
+
if ($form.data("bootstrap-switch")) {
|
674
|
+
return;
|
675
|
+
}
|
676
|
+
return $form.on("reset.bootstrapSwitch", function() {
|
677
|
+
return window.setTimeout(function() {
|
678
|
+
return $form.find("input").filter(function() {
|
679
|
+
return $(this).data("bootstrap-switch");
|
680
|
+
}).each(function() {
|
681
|
+
return $(this).bootstrapSwitch("state", this.checked);
|
682
|
+
});
|
683
|
+
}, 1);
|
684
|
+
}).data("bootstrap-switch", true);
|
685
|
+
};
|
686
|
+
|
687
|
+
BootstrapSwitch.prototype._getClasses = function(classes) {
|
688
|
+
var c, cls, i, len;
|
689
|
+
if (!$.isArray(classes)) {
|
690
|
+
return [this.options.baseClass + "-" + classes];
|
691
|
+
}
|
692
|
+
cls = [];
|
693
|
+
for (i = 0, len = classes.length; i < len; i++) {
|
694
|
+
c = classes[i];
|
695
|
+
cls.push(this.options.baseClass + "-" + c);
|
696
|
+
}
|
697
|
+
return cls;
|
698
|
+
};
|
699
|
+
|
700
|
+
return BootstrapSwitch;
|
701
|
+
|
702
|
+
})();
|
703
|
+
$.fn.bootstrapSwitch = function() {
|
704
|
+
var args, option, ret;
|
705
|
+
option = arguments[0], args = 2 <= arguments.length ? slice.call(arguments, 1) : [];
|
706
|
+
ret = this;
|
707
|
+
this.each(function() {
|
708
|
+
var $this, data;
|
709
|
+
$this = $(this);
|
710
|
+
data = $this.data("bootstrap-switch");
|
711
|
+
if (!data) {
|
712
|
+
$this.data("bootstrap-switch", data = new BootstrapSwitch(this, option));
|
713
|
+
}
|
714
|
+
if (typeof option === "string") {
|
715
|
+
return ret = data[option].apply(data, args);
|
716
|
+
}
|
717
|
+
});
|
718
|
+
return ret;
|
719
|
+
};
|
720
|
+
$.fn.bootstrapSwitch.Constructor = BootstrapSwitch;
|
721
|
+
return $.fn.bootstrapSwitch.defaults = {
|
722
|
+
state: true,
|
723
|
+
size: null,
|
724
|
+
animate: true,
|
725
|
+
disabled: false,
|
726
|
+
readonly: false,
|
727
|
+
indeterminate: false,
|
728
|
+
inverse: false,
|
729
|
+
radioAllOff: false,
|
730
|
+
onColor: "primary",
|
731
|
+
offColor: "default",
|
732
|
+
onText: "ON",
|
733
|
+
offText: "OFF",
|
734
|
+
labelText: " ",
|
735
|
+
handleWidth: "auto",
|
736
|
+
labelWidth: "auto",
|
737
|
+
baseClass: "bootstrap-switch",
|
738
|
+
wrapperClass: "wrapper",
|
739
|
+
onInit: function() {},
|
740
|
+
onSwitchChange: function() {}
|
741
|
+
};
|
742
|
+
})(window.jQuery, window);
|
743
|
+
|
744
|
+
}).call(this);
|