creative_tim 1.0.13 → 1.0.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/creative_tim/version.rb +1 -1
- data/vendor/assets/javascripts/creative-tim/{awesome-landing-page.js → awesome_landing_page/awesome-landing-page.js} +0 -0
- data/vendor/assets/javascripts/creative-tim/{gaia.js → gaia/gaia.js} +0 -0
- data/vendor/assets/javascripts/creative-tim/light_dashboard/bootstrap-checkbox-radio-switch.js +502 -0
- data/vendor/assets/javascripts/creative-tim/light_dashboard/bootstrap-notify.js +404 -0
- data/vendor/assets/javascripts/creative-tim/light_dashboard/bootstrap-select.js +438 -0
- data/vendor/assets/javascripts/creative-tim/light_dashboard/chartist.min.js +9 -0
- data/vendor/assets/javascripts/creative-tim/light_dashboard/demo.js +152 -0
- data/vendor/assets/javascripts/creative-tim/light_dashboard/light-bootstrap-dashboard.js +159 -0
- data/vendor/assets/javascripts/creative-tim/paper_dashboard/bootstrap-checkbox-radio.js +179 -179
- data/vendor/assets/javascripts/creative-tim/paper_kit/bootstrap-datepicker.js +492 -0
- data/vendor/assets/javascripts/creative-tim/paper_kit/bootstrap-select.js +438 -0
- data/vendor/assets/javascripts/creative-tim/paper_kit/ct-paper-checkbox.js +109 -0
- data/vendor/assets/javascripts/creative-tim/paper_kit/ct-paper-radio.js +140 -0
- data/vendor/assets/javascripts/creative-tim/paper_kit/ct-paper.js +378 -0
- data/vendor/assets/javascripts/creative-tim/shit_done/custom.js +9 -0
- data/vendor/assets/javascripts/creative-tim/shit_done/get-shit-done.js +108 -0
- data/vendor/assets/javascripts/creative-tim/shit_done/gsdk-bootstrapswitch.js +249 -0
- data/vendor/assets/javascripts/creative-tim/shit_done/gsdk-checkbox.js +109 -0
- data/vendor/assets/javascripts/creative-tim/shit_done/gsdk-radio.js +140 -0
- data/vendor/assets/stylesheets/creative-tim/{awesome_landing → awesome_landing_page}/landing-page.css +41 -41
- data/vendor/assets/stylesheets/creative-tim/awesome_landing_page/pe-icon-7-stroke.css +632 -0
- data/vendor/assets/stylesheets/creative-tim/light_dashboard/animate.min.css +6 -0
- data/vendor/assets/stylesheets/creative-tim/light_dashboard/demo.css +61 -0
- data/vendor/assets/stylesheets/creative-tim/light_dashboard/light-bootstrap-dashboard.css +3393 -0
- data/vendor/assets/stylesheets/creative-tim/light_dashboard/pe-icon-7-stroke.css +632 -0
- data/vendor/assets/stylesheets/creative-tim/paper_dashboard/paper-dashboard.css +2 -2
- data/vendor/assets/stylesheets/creative-tim/{paper_dashboard/sass/paper → paper_kit/ct-paper}/_alerts.scss +0 -23
- data/vendor/assets/stylesheets/creative-tim/{paper_dashboard/sass/paper → paper_kit/ct-paper}/_buttons.scss +7 -1
- data/vendor/assets/stylesheets/creative-tim/paper_kit/ct-paper/_carousel.scss +59 -0
- data/vendor/assets/stylesheets/creative-tim/{paper_dashboard/sass/paper → paper_kit/ct-paper}/_checkbox-radio.scss +10 -13
- data/vendor/assets/stylesheets/creative-tim/paper_kit/ct-paper/_collapse.scss +30 -0
- data/vendor/assets/stylesheets/creative-tim/paper_kit/ct-paper/_datepicker.scss +221 -0
- data/vendor/assets/stylesheets/creative-tim/{paper_dashboard/sass/paper → paper_kit/ct-paper}/_dropdown.scss +2 -0
- data/vendor/assets/stylesheets/creative-tim/paper_kit/ct-paper/_images.scss +28 -0
- data/vendor/assets/stylesheets/creative-tim/{paper_dashboard/sass/paper → paper_kit/ct-paper}/_inputs.scss +5 -38
- data/vendor/assets/stylesheets/creative-tim/paper_kit/ct-paper/_labels.scss +26 -0
- data/vendor/assets/stylesheets/creative-tim/paper_kit/ct-paper/_misc.scss +127 -0
- data/vendor/assets/stylesheets/creative-tim/{paper_dashboard/sass/paper → paper_kit/ct-paper}/_mixins.scss +1 -4
- data/vendor/assets/stylesheets/creative-tim/paper_kit/ct-paper/_modal.scss +54 -0
- data/vendor/assets/stylesheets/creative-tim/{paper_dashboard/sass/paper → paper_kit/ct-paper}/_navbars.scss +117 -13
- data/vendor/assets/stylesheets/creative-tim/paper_kit/ct-paper/_progress-bars.scss +27 -0
- data/vendor/assets/stylesheets/creative-tim/{paper_dashboard/sass/paper → paper_kit/ct-paper}/_responsive.scss +124 -218
- data/vendor/assets/stylesheets/creative-tim/paper_kit/ct-paper/_sections.scss +38 -0
- data/vendor/assets/stylesheets/creative-tim/paper_kit/ct-paper/_sliders.scss +222 -0
- data/vendor/assets/stylesheets/creative-tim/paper_kit/ct-paper/_tabs-navs-pagination.scss +353 -0
- data/vendor/assets/stylesheets/creative-tim/paper_kit/ct-paper/_tooltips-and-popovers.scss +171 -0
- data/vendor/assets/stylesheets/creative-tim/{paper_dashboard/sass/paper → paper_kit/ct-paper}/_typography.scss +7 -41
- data/vendor/assets/stylesheets/creative-tim/{paper_dashboard/sass/paper → paper_kit/ct-paper}/_variables.scss +55 -79
- data/vendor/assets/stylesheets/creative-tim/{paper_dashboard/sass/paper → paper_kit/ct-paper}/mixins/_buttons.scss +1 -0
- data/vendor/assets/stylesheets/creative-tim/{paper_dashboard/sass/paper → paper_kit/ct-paper}/mixins/_inputs.scss +0 -0
- data/vendor/assets/stylesheets/creative-tim/{paper_dashboard/sass/paper → paper_kit/ct-paper}/mixins/_labels.scss +0 -0
- data/vendor/assets/stylesheets/creative-tim/{paper_dashboard/sass/paper → paper_kit/ct-paper}/mixins/_navbars.scss +0 -0
- data/vendor/assets/stylesheets/creative-tim/{paper_dashboard/sass/paper → paper_kit/ct-paper}/mixins/_tabs.scss +0 -0
- data/vendor/assets/stylesheets/creative-tim/{paper_dashboard/sass/paper → paper_kit/ct-paper}/mixins/_transparency.scss +0 -0
- data/vendor/assets/stylesheets/creative-tim/{paper_dashboard/sass/paper → paper_kit/ct-paper}/mixins/_vendor-prefixes.scss +0 -12
- data/vendor/assets/stylesheets/creative-tim/paper_kit/ct-paper.css +3323 -0
- data/vendor/assets/stylesheets/creative-tim/paper_kit/ct-paper.scss +34 -0
- data/vendor/assets/stylesheets/creative-tim/paper_kit/demo.css +994 -0
- data/vendor/assets/stylesheets/creative-tim/paper_kit/examples.css +179 -0
- data/vendor/assets/stylesheets/creative-tim/paper_kit/examples.scss +150 -0
- data/vendor/assets/stylesheets/creative-tim/shit_done/demo.css +324 -0
- data/vendor/assets/stylesheets/creative-tim/shit_done/get-shit-done.css +7 -0
- data/vendor/assets/stylesheets/creative-tim/shit_done/gsdk-base.css +1187 -0
- data/vendor/assets/stylesheets/creative-tim/shit_done/gsdk-checkbox-radio-switch.css +257 -0
- data/vendor/assets/stylesheets/creative-tim/shit_done/gsdk-sliders.css +220 -0
- metadata +64 -39
- data/vendor/assets/javascripts/creative-tim/paper_dashboard/bootstrap.min.js +0 -7
- data/vendor/assets/javascripts/creative-tim/paper_dashboard/jquery-1.10.2.js +0 -9789
- data/vendor/assets/stylesheets/creative-tim/awesome_landing/bootstrap.css +0 -6358
- data/vendor/assets/stylesheets/creative-tim/awesome_landing/fixes.scss +0 -39
- data/vendor/assets/stylesheets/creative-tim/paper_dashboard/bootstrap.min.css +0 -5
- data/vendor/assets/stylesheets/creative-tim/paper_dashboard/sass/fixes.scss +0 -45
- data/vendor/assets/stylesheets/creative-tim/paper_dashboard/sass/paper/_cards.scss +0 -243
- data/vendor/assets/stylesheets/creative-tim/paper_dashboard/sass/paper/_chartist.scss +0 -230
- data/vendor/assets/stylesheets/creative-tim/paper_dashboard/sass/paper/_footers.scss +0 -43
- data/vendor/assets/stylesheets/creative-tim/paper_dashboard/sass/paper/_misc.scss +0 -69
- data/vendor/assets/stylesheets/creative-tim/paper_dashboard/sass/paper/_sidebar-and-main-panel.scss +0 -195
- data/vendor/assets/stylesheets/creative-tim/paper_dashboard/sass/paper/_tables.scss +0 -77
- data/vendor/assets/stylesheets/creative-tim/paper_dashboard/sass/paper/mixins/_cards.scss +0 -8
- data/vendor/assets/stylesheets/creative-tim/paper_dashboard/sass/paper/mixins/_chartist.scss +0 -104
- data/vendor/assets/stylesheets/creative-tim/paper_dashboard/sass/paper/mixins/_icons.scss +0 -13
- data/vendor/assets/stylesheets/creative-tim/paper_dashboard/sass/paper/mixins/_sidebar.scss +0 -42
- data/vendor/assets/stylesheets/creative-tim/paper_dashboard/sass/paper-dashboard.scss +0 -28
- data/vendor/assets/stylesheets/creative-tim/paper_dashboard/themify-icons.css +0 -1081
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a5aebc91c3737eebc694d82a8732a37309622391
|
4
|
+
data.tar.gz: 0081c5d49ebe051ea9df11542cfd2cddb37c7852
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e75c69a3dfc008572f87d52a4b33c3c8b626a512e0ce5d8fc315fa6bd544e6317b622c896dcd493e9894ce7c3bc1d2a6b522dc89981501cce176fcfcfd281e7a
|
7
|
+
data.tar.gz: 1c5aba8df2fc05e02e71eeaac26c3c39b564a09ac152cb29c0a7c20b5bcf931ffe06c3de0916c3eb2d1ff10fde5474f80a4170dd38a648a32fb85b4a53e00a25
|
data/lib/creative_tim/version.rb
CHANGED
File without changes
|
File without changes
|
data/vendor/assets/javascripts/creative-tim/light_dashboard/bootstrap-checkbox-radio-switch.js
ADDED
@@ -0,0 +1,502 @@
|
|
1
|
+
!function ($) {
|
2
|
+
|
3
|
+
/* CHECKBOX PUBLIC CLASS DEFINITION
|
4
|
+
* ============================== */
|
5
|
+
|
6
|
+
var Checkbox = function (element, options) {
|
7
|
+
this.init(element, options);
|
8
|
+
}
|
9
|
+
|
10
|
+
Checkbox.prototype = {
|
11
|
+
|
12
|
+
constructor: Checkbox
|
13
|
+
|
14
|
+
, init: function (element, options) {
|
15
|
+
var $el = this.$element = $(element)
|
16
|
+
|
17
|
+
this.options = $.extend({}, $.fn.checkbox.defaults, options);
|
18
|
+
$el.before(this.options.template);
|
19
|
+
this.setState();
|
20
|
+
}
|
21
|
+
|
22
|
+
, setState: function () {
|
23
|
+
var $el = this.$element
|
24
|
+
, $parent = $el.closest('.checkbox');
|
25
|
+
|
26
|
+
$el.prop('disabled') && $parent.addClass('disabled');
|
27
|
+
$el.prop('checked') && $parent.addClass('checked');
|
28
|
+
}
|
29
|
+
|
30
|
+
, toggle: function () {
|
31
|
+
var ch = 'checked'
|
32
|
+
, $el = this.$element
|
33
|
+
, $parent = $el.closest('.checkbox')
|
34
|
+
, checked = $el.prop(ch)
|
35
|
+
, e = $.Event('toggle')
|
36
|
+
|
37
|
+
if ($el.prop('disabled') == false) {
|
38
|
+
$parent.toggleClass(ch) && checked ? $el.removeAttr(ch) : $el.prop(ch, ch);
|
39
|
+
$el.trigger(e).trigger('change');
|
40
|
+
}
|
41
|
+
}
|
42
|
+
|
43
|
+
, setCheck: function (option) {
|
44
|
+
var d = 'disabled'
|
45
|
+
, ch = 'checked'
|
46
|
+
, $el = this.$element
|
47
|
+
, $parent = $el.closest('.checkbox')
|
48
|
+
, checkAction = option == 'check' ? true : false
|
49
|
+
, e = $.Event(option)
|
50
|
+
|
51
|
+
$parent[checkAction ? 'addClass' : 'removeClass' ](ch) && checkAction ? $el.prop(ch, ch) : $el.removeAttr(ch);
|
52
|
+
$el.trigger(e).trigger('change');
|
53
|
+
}
|
54
|
+
|
55
|
+
}
|
56
|
+
|
57
|
+
|
58
|
+
/* CHECKBOX PLUGIN DEFINITION
|
59
|
+
* ======================== */
|
60
|
+
|
61
|
+
var old = $.fn.checkbox
|
62
|
+
|
63
|
+
$.fn.checkbox = function (option) {
|
64
|
+
return this.each(function () {
|
65
|
+
var $this = $(this)
|
66
|
+
, data = $this.data('checkbox')
|
67
|
+
, options = $.extend({}, $.fn.checkbox.defaults, $this.data(), typeof option == 'object' && option);
|
68
|
+
if (!data) $this.data('checkbox', (data = new Checkbox(this, options)));
|
69
|
+
if (option == 'toggle') data.toggle()
|
70
|
+
if (option == 'check' || option == 'uncheck') data.setCheck(option)
|
71
|
+
else if (option) data.setState();
|
72
|
+
});
|
73
|
+
}
|
74
|
+
|
75
|
+
$.fn.checkbox.defaults = {
|
76
|
+
template: '<span class="icons"><span class="first-icon fa fa-square-o"></span><span class="second-icon fa fa-check-square-o"></span></span>'
|
77
|
+
}
|
78
|
+
|
79
|
+
|
80
|
+
/* CHECKBOX NO CONFLICT
|
81
|
+
* ================== */
|
82
|
+
|
83
|
+
$.fn.checkbox.noConflict = function () {
|
84
|
+
$.fn.checkbox = old;
|
85
|
+
return this;
|
86
|
+
}
|
87
|
+
|
88
|
+
|
89
|
+
/* CHECKBOX DATA-API
|
90
|
+
* =============== */
|
91
|
+
|
92
|
+
$(document).on('click.checkbox.data-api', '[data-toggle^=checkbox], .checkbox', function (e) {
|
93
|
+
var $checkbox = $(e.target);
|
94
|
+
if (e.target.tagName != "A") {
|
95
|
+
e && e.preventDefault() && e.stopPropagation();
|
96
|
+
if (!$checkbox.hasClass('checkbox')) $checkbox = $checkbox.closest('.checkbox');
|
97
|
+
$checkbox.find(':checkbox').checkbox('toggle');
|
98
|
+
}
|
99
|
+
});
|
100
|
+
|
101
|
+
$(function () {
|
102
|
+
$('[data-toggle="checkbox"]').each(function () {
|
103
|
+
var $checkbox = $(this);
|
104
|
+
$checkbox.checkbox();
|
105
|
+
});
|
106
|
+
});
|
107
|
+
|
108
|
+
}(window.jQuery);
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
/* =============================================================
|
113
|
+
* flatui-radio v0.0.3
|
114
|
+
* ============================================================ */
|
115
|
+
|
116
|
+
!function ($) {
|
117
|
+
|
118
|
+
/* RADIO PUBLIC CLASS DEFINITION
|
119
|
+
* ============================== */
|
120
|
+
|
121
|
+
var Radio = function (element, options) {
|
122
|
+
this.init(element, options);
|
123
|
+
}
|
124
|
+
|
125
|
+
Radio.prototype = {
|
126
|
+
|
127
|
+
constructor: Radio
|
128
|
+
|
129
|
+
, init: function (element, options) {
|
130
|
+
var $el = this.$element = $(element)
|
131
|
+
|
132
|
+
this.options = $.extend({}, $.fn.radio.defaults, options);
|
133
|
+
$el.before(this.options.template);
|
134
|
+
this.setState();
|
135
|
+
}
|
136
|
+
|
137
|
+
, setState: function () {
|
138
|
+
var $el = this.$element
|
139
|
+
, $parent = $el.closest('.radio');
|
140
|
+
|
141
|
+
$el.prop('disabled') && $parent.addClass('disabled');
|
142
|
+
$el.prop('checked') && $parent.addClass('checked');
|
143
|
+
}
|
144
|
+
|
145
|
+
, toggle: function () {
|
146
|
+
var d = 'disabled'
|
147
|
+
, ch = 'checked'
|
148
|
+
, $el = this.$element
|
149
|
+
, checked = $el.prop(ch)
|
150
|
+
, $parent = $el.closest('.radio')
|
151
|
+
, $parentWrap = $el.closest('form').length ? $el.closest('form') : $el.closest('body')
|
152
|
+
, $elemGroup = $parentWrap.find(':radio[name="' + $el.attr('name') + '"]')
|
153
|
+
, e = $.Event('toggle')
|
154
|
+
|
155
|
+
if ($el.prop(d) == false) {
|
156
|
+
$elemGroup.not($el).each(function () {
|
157
|
+
var $el = $(this)
|
158
|
+
, $parent = $(this).closest('.radio');
|
159
|
+
|
160
|
+
if ($el.prop(d) == false) {
|
161
|
+
$parent.removeClass(ch) && $el.removeAttr(ch).trigger('change');
|
162
|
+
}
|
163
|
+
});
|
164
|
+
|
165
|
+
if (checked == false) $parent.addClass(ch) && $el.prop(ch, true);
|
166
|
+
$el.trigger(e);
|
167
|
+
|
168
|
+
if (checked !== $el.prop(ch)) {
|
169
|
+
$el.trigger('change');
|
170
|
+
}
|
171
|
+
}
|
172
|
+
}
|
173
|
+
|
174
|
+
, setCheck: function (option) {
|
175
|
+
var ch = 'checked'
|
176
|
+
, $el = this.$element
|
177
|
+
, $parent = $el.closest('.radio')
|
178
|
+
, checkAction = option == 'check' ? true : false
|
179
|
+
, checked = $el.prop(ch)
|
180
|
+
, $parentWrap = $el.closest('form').length ? $el.closest('form') : $el.closest('body')
|
181
|
+
, $elemGroup = $parentWrap.find(':radio[name="' + $el['attr']('name') + '"]')
|
182
|
+
, e = $.Event(option)
|
183
|
+
|
184
|
+
$elemGroup.not($el).each(function () {
|
185
|
+
var $el = $(this)
|
186
|
+
, $parent = $(this).closest('.radio');
|
187
|
+
|
188
|
+
$parent.removeClass(ch) && $el.removeAttr(ch);
|
189
|
+
});
|
190
|
+
|
191
|
+
$parent[checkAction ? 'addClass' : 'removeClass'](ch) && checkAction ? $el.prop(ch, ch) : $el.removeAttr(ch);
|
192
|
+
$el.trigger(e);
|
193
|
+
|
194
|
+
if (checked !== $el.prop(ch)) {
|
195
|
+
$el.trigger('change');
|
196
|
+
}
|
197
|
+
}
|
198
|
+
|
199
|
+
}
|
200
|
+
|
201
|
+
|
202
|
+
/* RADIO PLUGIN DEFINITION
|
203
|
+
* ======================== */
|
204
|
+
|
205
|
+
var old = $.fn.radio
|
206
|
+
|
207
|
+
$.fn.radio = function (option) {
|
208
|
+
return this.each(function () {
|
209
|
+
var $this = $(this)
|
210
|
+
, data = $this.data('radio')
|
211
|
+
, options = $.extend({}, $.fn.radio.defaults, $this.data(), typeof option == 'object' && option);
|
212
|
+
if (!data) $this.data('radio', (data = new Radio(this, options)));
|
213
|
+
if (option == 'toggle') data.toggle()
|
214
|
+
if (option == 'check' || option == 'uncheck') data.setCheck(option)
|
215
|
+
else if (option) data.setState();
|
216
|
+
});
|
217
|
+
}
|
218
|
+
|
219
|
+
$.fn.radio.defaults = {
|
220
|
+
template: '<span class="icons"><span class="first-icon fa fa-circle-o"></span><span class="second-icon fa fa-dot-circle-o"></span></span>'
|
221
|
+
}
|
222
|
+
|
223
|
+
|
224
|
+
/* RADIO NO CONFLICT
|
225
|
+
* ================== */
|
226
|
+
|
227
|
+
$.fn.radio.noConflict = function () {
|
228
|
+
$.fn.radio = old;
|
229
|
+
return this;
|
230
|
+
}
|
231
|
+
|
232
|
+
|
233
|
+
/* RADIO DATA-API
|
234
|
+
* =============== */
|
235
|
+
|
236
|
+
$(document).on('click.radio.data-api', '[data-toggle^=radio], .radio', function (e) {
|
237
|
+
var $radio = $(e.target);
|
238
|
+
e && e.preventDefault() && e.stopPropagation();
|
239
|
+
if (!$radio.hasClass('radio')) $radio = $radio.closest('.radio');
|
240
|
+
$radio.find(':radio').radio('toggle');
|
241
|
+
});
|
242
|
+
|
243
|
+
$(function () {
|
244
|
+
$('[data-toggle="radio"]').each(function () {
|
245
|
+
var $radio = $(this);
|
246
|
+
$radio.radio();
|
247
|
+
});
|
248
|
+
});
|
249
|
+
|
250
|
+
}(window.jQuery);
|
251
|
+
|
252
|
+
|
253
|
+
|
254
|
+
/* ============================================================
|
255
|
+
* bootstrapSwitch v1.3 by Larentis Mattia @spiritualGuru
|
256
|
+
* http://www.larentis.eu/switch/
|
257
|
+
* ============================================================
|
258
|
+
* Licensed under the Apache License, Version 2.0
|
259
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
260
|
+
* ============================================================ */
|
261
|
+
|
262
|
+
!function ($) {
|
263
|
+
"use strict";
|
264
|
+
|
265
|
+
$.fn['bootstrapSwitch'] = function (method) {
|
266
|
+
var methods = {
|
267
|
+
init: function () {
|
268
|
+
return this.each(function () {
|
269
|
+
var $element = $(this)
|
270
|
+
, $div
|
271
|
+
, $switchLeft
|
272
|
+
, $switchRight
|
273
|
+
, $label
|
274
|
+
, myClasses = ""
|
275
|
+
, classes = $element.attr('class')
|
276
|
+
, color
|
277
|
+
, moving
|
278
|
+
, onLabel = "ON"
|
279
|
+
, offLabel = "OFF"
|
280
|
+
, icon = false;
|
281
|
+
|
282
|
+
$.each(['switch-mini', 'switch-small', 'switch-large'], function (i, el) {
|
283
|
+
if (classes.indexOf(el) >= 0)
|
284
|
+
myClasses = el;
|
285
|
+
});
|
286
|
+
|
287
|
+
$element.addClass('has-switch');
|
288
|
+
|
289
|
+
if ($element.data('on') !== undefined)
|
290
|
+
color = "switch-" + $element.data('on');
|
291
|
+
|
292
|
+
if ($element.data('on-label') !== undefined)
|
293
|
+
onLabel = $element.data('on-label');
|
294
|
+
|
295
|
+
if ($element.data('off-label') !== undefined)
|
296
|
+
offLabel = $element.data('off-label');
|
297
|
+
|
298
|
+
if ($element.data('icon') !== undefined)
|
299
|
+
icon = $element.data('icon');
|
300
|
+
|
301
|
+
$switchLeft = $('<span>')
|
302
|
+
.addClass("switch-left")
|
303
|
+
.addClass(myClasses)
|
304
|
+
.addClass(color)
|
305
|
+
.html(onLabel);
|
306
|
+
|
307
|
+
color = '';
|
308
|
+
if ($element.data('off') !== undefined)
|
309
|
+
color = "switch-" + $element.data('off');
|
310
|
+
|
311
|
+
$switchRight = $('<span>')
|
312
|
+
.addClass("switch-right")
|
313
|
+
.addClass(myClasses)
|
314
|
+
.addClass(color)
|
315
|
+
.html(offLabel);
|
316
|
+
|
317
|
+
$label = $('<label>')
|
318
|
+
.html(" ")
|
319
|
+
.addClass(myClasses)
|
320
|
+
.attr('for', $element.find('input').attr('id'));
|
321
|
+
|
322
|
+
if (icon) {
|
323
|
+
$label.html('<i class="' + icon + '"></i>');
|
324
|
+
}
|
325
|
+
|
326
|
+
$div = $element.find(':checkbox').wrap($('<div>')).parent().data('animated', false);
|
327
|
+
|
328
|
+
if ($element.data('animated') !== false)
|
329
|
+
$div.addClass('switch-animate').data('animated', true);
|
330
|
+
|
331
|
+
$div
|
332
|
+
.append($switchLeft)
|
333
|
+
.append($label)
|
334
|
+
.append($switchRight);
|
335
|
+
|
336
|
+
$element.find('>div').addClass(
|
337
|
+
$element.find('input').is(':checked') ? 'switch-on' : 'switch-off'
|
338
|
+
);
|
339
|
+
|
340
|
+
if ($element.find('input').is(':disabled'))
|
341
|
+
$(this).addClass('deactivate');
|
342
|
+
|
343
|
+
var changeStatus = function ($this) {
|
344
|
+
$this.siblings('label').trigger('mousedown').trigger('mouseup').trigger('click');
|
345
|
+
};
|
346
|
+
|
347
|
+
$element.on('keydown', function (e) {
|
348
|
+
if (e.keyCode === 32) {
|
349
|
+
e.stopImmediatePropagation();
|
350
|
+
e.preventDefault();
|
351
|
+
changeStatus($(e.target).find('span:first'));
|
352
|
+
}
|
353
|
+
});
|
354
|
+
|
355
|
+
$switchLeft.on('click', function (e) {
|
356
|
+
changeStatus($(this));
|
357
|
+
});
|
358
|
+
|
359
|
+
$switchRight.on('click', function (e) {
|
360
|
+
changeStatus($(this));
|
361
|
+
});
|
362
|
+
|
363
|
+
$element.find('input').on('change', function (e) {
|
364
|
+
var $this = $(this)
|
365
|
+
, $element = $this.parent()
|
366
|
+
, thisState = $this.is(':checked')
|
367
|
+
, state = $element.is('.switch-off');
|
368
|
+
|
369
|
+
e.preventDefault();
|
370
|
+
|
371
|
+
$element.css('left', '');
|
372
|
+
|
373
|
+
if (state === thisState) {
|
374
|
+
|
375
|
+
if (thisState)
|
376
|
+
$element.removeClass('switch-off').addClass('switch-on');
|
377
|
+
else $element.removeClass('switch-on').addClass('switch-off');
|
378
|
+
|
379
|
+
if ($element.data('animated') !== false)
|
380
|
+
$element.addClass("switch-animate");
|
381
|
+
|
382
|
+
$element.parent().trigger('switch-change', {'el': $this, 'value': thisState})
|
383
|
+
}
|
384
|
+
});
|
385
|
+
|
386
|
+
$element.find('label').on('mousedown touchstart', function (e) {
|
387
|
+
var $this = $(this);
|
388
|
+
moving = false;
|
389
|
+
|
390
|
+
e.preventDefault();
|
391
|
+
e.stopImmediatePropagation();
|
392
|
+
|
393
|
+
$this.closest('div').removeClass('switch-animate');
|
394
|
+
|
395
|
+
if ($this.closest('.has-switch').is('.deactivate'))
|
396
|
+
$this.unbind('click');
|
397
|
+
else {
|
398
|
+
$this.on('mousemove touchmove', function (e) {
|
399
|
+
var $element = $(this).closest('.switch')
|
400
|
+
, relativeX = (e.pageX || e.originalEvent.targetTouches[0].pageX) - $element.offset().left
|
401
|
+
, percent = (relativeX / $element.width()) * 100
|
402
|
+
, left = 25
|
403
|
+
, right = 75;
|
404
|
+
|
405
|
+
moving = true;
|
406
|
+
|
407
|
+
if (percent < left)
|
408
|
+
percent = left;
|
409
|
+
else if (percent > right)
|
410
|
+
percent = right;
|
411
|
+
|
412
|
+
$element.find('>div').css('left', (percent - right) + "%")
|
413
|
+
});
|
414
|
+
|
415
|
+
$this.on('click touchend', function (e) {
|
416
|
+
var $this = $(this)
|
417
|
+
, $target = $(e.target)
|
418
|
+
, $myCheckBox = $target.siblings('input');
|
419
|
+
|
420
|
+
e.stopImmediatePropagation();
|
421
|
+
e.preventDefault();
|
422
|
+
|
423
|
+
$this.unbind('mouseleave');
|
424
|
+
|
425
|
+
if (moving)
|
426
|
+
$myCheckBox.prop('checked', !(parseInt($this.parent().css('left')) < -25));
|
427
|
+
else $myCheckBox.prop("checked", !$myCheckBox.is(":checked"));
|
428
|
+
|
429
|
+
moving = false;
|
430
|
+
$myCheckBox.trigger('change');
|
431
|
+
});
|
432
|
+
|
433
|
+
$this.on('mouseleave', function (e) {
|
434
|
+
var $this = $(this)
|
435
|
+
, $myCheckBox = $this.siblings('input');
|
436
|
+
|
437
|
+
e.preventDefault();
|
438
|
+
e.stopImmediatePropagation();
|
439
|
+
|
440
|
+
$this.unbind('mouseleave');
|
441
|
+
$this.trigger('mouseup');
|
442
|
+
|
443
|
+
$myCheckBox.prop('checked', !(parseInt($this.parent().css('left')) < -25)).trigger('change');
|
444
|
+
});
|
445
|
+
|
446
|
+
$this.on('mouseup', function (e) {
|
447
|
+
e.stopImmediatePropagation();
|
448
|
+
e.preventDefault();
|
449
|
+
|
450
|
+
$(this).unbind('mousemove');
|
451
|
+
});
|
452
|
+
}
|
453
|
+
});
|
454
|
+
}
|
455
|
+
);
|
456
|
+
},
|
457
|
+
toggleActivation: function () {
|
458
|
+
$(this).toggleClass('deactivate');
|
459
|
+
},
|
460
|
+
isActive: function () {
|
461
|
+
return !$(this).hasClass('deactivate');
|
462
|
+
},
|
463
|
+
setActive: function (active) {
|
464
|
+
if (active)
|
465
|
+
$(this).removeClass('deactivate');
|
466
|
+
else $(this).addClass('deactivate');
|
467
|
+
},
|
468
|
+
toggleState: function (skipOnChange) {
|
469
|
+
var $input = $(this).find('input:checkbox');
|
470
|
+
$input.prop('checked', !$input.is(':checked')).trigger('change', skipOnChange);
|
471
|
+
},
|
472
|
+
setState: function (value, skipOnChange) {
|
473
|
+
$(this).find('input:checkbox').prop('checked', value).trigger('change', skipOnChange);
|
474
|
+
},
|
475
|
+
status: function () {
|
476
|
+
return $(this).find('input:checkbox').is(':checked');
|
477
|
+
},
|
478
|
+
destroy: function () {
|
479
|
+
var $div = $(this).find('div')
|
480
|
+
, $checkbox;
|
481
|
+
|
482
|
+
$div.find(':not(input:checkbox)').remove();
|
483
|
+
|
484
|
+
$checkbox = $div.children();
|
485
|
+
$checkbox.unwrap().unwrap();
|
486
|
+
|
487
|
+
$checkbox.unbind('change');
|
488
|
+
|
489
|
+
return $checkbox;
|
490
|
+
}
|
491
|
+
};
|
492
|
+
|
493
|
+
if (methods[method])
|
494
|
+
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
|
495
|
+
else if (typeof method === 'object' || !method)
|
496
|
+
return methods.init.apply(this, arguments);
|
497
|
+
else
|
498
|
+
$.error('Method ' + method + ' does not exist!');
|
499
|
+
};
|
500
|
+
}(jQuery);
|
501
|
+
|
502
|
+
|