flashgrid 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +4 -0
  3. data/Gemfile.lock +17 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +78 -0
  6. data/Rakefile +1 -0
  7. data/app/assets/fonts/gotham/gotham-bold.eot +0 -0
  8. data/app/assets/fonts/gotham/gotham-bold.svg +2066 -0
  9. data/app/assets/fonts/gotham/gotham-bold.ttf +0 -0
  10. data/app/assets/fonts/gotham/gotham-bold.woff +0 -0
  11. data/app/assets/fonts/gotham/gotham-book.eot +0 -0
  12. data/app/assets/fonts/gotham/gotham-book.svg +631 -0
  13. data/app/assets/fonts/gotham/gotham-book.ttf +0 -0
  14. data/app/assets/fonts/gotham/gotham-book.woff +0 -0
  15. data/app/assets/fonts/gotham/gotham-light.eot +0 -0
  16. data/app/assets/fonts/gotham/gotham-light.svg +635 -0
  17. data/app/assets/fonts/gotham/gotham-light.ttf +0 -0
  18. data/app/assets/fonts/gotham/gotham-light.woff +0 -0
  19. data/app/assets/fonts/gotham/gotham-medium.eot +0 -0
  20. data/app/assets/fonts/gotham/gotham-medium.svg +629 -0
  21. data/app/assets/fonts/gotham/gotham-medium.ttf +0 -0
  22. data/app/assets/fonts/gotham/gotham-medium.woff +0 -0
  23. data/app/assets/fonts/ionicons/ionicons.eot +0 -0
  24. data/app/assets/fonts/ionicons/ionicons.svg +1623 -0
  25. data/app/assets/fonts/ionicons/ionicons.ttf +0 -0
  26. data/app/assets/fonts/ionicons/ionicons.woff +0 -0
  27. data/flashgrid.gemspec +23 -0
  28. data/lib/flashgrid.rb +6 -0
  29. data/lib/flashgrid/version.rb +3 -0
  30. data/vendor/assets/javascripts/affix.js +127 -0
  31. data/vendor/assets/javascripts/alert.js +78 -0
  32. data/vendor/assets/javascripts/collapse.js +159 -0
  33. data/vendor/assets/javascripts/date_picker.js +1645 -0
  34. data/vendor/assets/javascripts/dropdown.js +134 -0
  35. data/vendor/assets/javascripts/file_input.js +94 -0
  36. data/vendor/assets/javascripts/map.js +2065 -0
  37. data/vendor/assets/javascripts/modal.js +226 -0
  38. data/vendor/assets/javascripts/popover.js +97 -0
  39. data/vendor/assets/javascripts/switch.js +346 -0
  40. data/vendor/assets/javascripts/tab.js +115 -0
  41. data/vendor/assets/javascripts/time_picker.js +1087 -0
  42. data/vendor/assets/javascripts/tooltip.js +365 -0
  43. data/vendor/assets/javascripts/transition.js +36 -0
  44. data/vendor/assets/stylesheets/ad.css.scss +72 -0
  45. data/vendor/assets/stylesheets/affix.css.scss +7 -0
  46. data/vendor/assets/stylesheets/alert.css.scss +72 -0
  47. data/vendor/assets/stylesheets/breadcrumb.css.scss +26 -0
  48. data/vendor/assets/stylesheets/button.css.scss +227 -0
  49. data/vendor/assets/stylesheets/code.css.scss +49 -0
  50. data/vendor/assets/stylesheets/collapse.css.scss +15 -0
  51. data/vendor/assets/stylesheets/datepicker.css.scss +122 -0
  52. data/vendor/assets/stylesheets/dropdown.css.scss +83 -0
  53. data/vendor/assets/stylesheets/footer.css.scss +33 -0
  54. data/vendor/assets/stylesheets/form.css.scss +213 -0
  55. data/vendor/assets/stylesheets/grid.css.scss +291 -0
  56. data/vendor/assets/stylesheets/header.css.scss +134 -0
  57. data/vendor/assets/stylesheets/icon.css.scss +1130 -0
  58. data/vendor/assets/stylesheets/image.css.scss +108 -0
  59. data/vendor/assets/stylesheets/label_and_badge.css.scss +53 -0
  60. data/vendor/assets/stylesheets/link.css.scss +21 -0
  61. data/vendor/assets/stylesheets/list.css.scss +38 -0
  62. data/vendor/assets/stylesheets/map.css.scss +13 -0
  63. data/vendor/assets/stylesheets/modal.css.scss +117 -0
  64. data/vendor/assets/stylesheets/pagination.css.scss +37 -0
  65. data/vendor/assets/stylesheets/placeholder.css.scss +27 -0
  66. data/vendor/assets/stylesheets/popover.css.scss +107 -0
  67. data/vendor/assets/stylesheets/progress.css.scss +25 -0
  68. data/vendor/assets/stylesheets/reset.css.scss +56 -0
  69. data/vendor/assets/stylesheets/switch.css.scss +73 -0
  70. data/vendor/assets/stylesheets/tab.css.scss +179 -0
  71. data/vendor/assets/stylesheets/table.css.scss +73 -0
  72. data/vendor/assets/stylesheets/timepicker.css.scss +81 -0
  73. data/vendor/assets/stylesheets/tooltip.css.scss +81 -0
  74. data/vendor/assets/stylesheets/transition.css.scss +12 -0
  75. data/vendor/assets/stylesheets/trunk.css.scss +69 -0
  76. data/vendor/assets/stylesheets/typography.css.scss +160 -0
  77. metadata +148 -0
@@ -0,0 +1,226 @@
1
+ +function ($) { "use strict";
2
+
3
+ // MODAL CLASS DEFINITION
4
+ // ======================
5
+
6
+ var Modal = function (element, options) {
7
+ this.options = options
8
+ this.$element = $(element)
9
+ this.$backdrop =
10
+ this.isShown = null
11
+
12
+ if (this.options.remote) this.$element.load(this.options.remote)
13
+ }
14
+
15
+ Modal.DEFAULTS = {
16
+ backdrop: true
17
+ , keyboard: true
18
+ , show: true
19
+ }
20
+
21
+ Modal.prototype.toggle = function (_relatedTarget) {
22
+ return this[!this.isShown ? 'show' : 'hide'](_relatedTarget)
23
+ }
24
+
25
+ Modal.prototype.show = function (_relatedTarget) {
26
+ var that = this
27
+ var e = $.Event('show.bs.modal', { relatedTarget: _relatedTarget })
28
+
29
+ this.$element.trigger(e)
30
+
31
+ if (this.isShown || e.isDefaultPrevented()) return
32
+
33
+ this.isShown = true
34
+
35
+ this.escape()
36
+
37
+ this.$element.on('click.dismiss.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))
38
+
39
+ this.backdrop(function () {
40
+ var transition = $.support.transition && that.$element.hasClass('fade')
41
+
42
+ if (!that.$element.parent().length) {
43
+ that.$element.appendTo(document.body) // don't move modals dom position
44
+ }
45
+
46
+ that.$element.show()
47
+
48
+ if (transition) {
49
+ that.$element[0].offsetWidth // force reflow
50
+ }
51
+
52
+ that.$element
53
+ .addClass('in')
54
+ .attr('aria-hidden', false)
55
+
56
+ that.enforceFocus()
57
+
58
+ var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget })
59
+
60
+ transition ?
61
+ that.$element.find('.modal-dialog') // wait for modal to slide in
62
+ .one($.support.transition.end, function () {
63
+ that.$element.focus().trigger(e)
64
+ })
65
+ .emulateTransitionEnd(300) :
66
+ that.$element.focus().trigger(e)
67
+ })
68
+ }
69
+
70
+ Modal.prototype.hide = function (e) {
71
+ if (e) e.preventDefault()
72
+
73
+ e = $.Event('hide.bs.modal')
74
+
75
+ this.$element.trigger(e)
76
+
77
+ if (!this.isShown || e.isDefaultPrevented()) return
78
+
79
+ this.isShown = false
80
+
81
+ this.escape()
82
+
83
+ $(document).off('focusin.bs.modal')
84
+
85
+ this.$element
86
+ .removeClass('in')
87
+ .attr('aria-hidden', true)
88
+ .off('click.dismiss.modal')
89
+
90
+ $.support.transition && this.$element.hasClass('fade') ?
91
+ this.$element
92
+ .one($.support.transition.end, $.proxy(this.hideModal, this))
93
+ .emulateTransitionEnd(300) :
94
+ this.hideModal()
95
+ }
96
+
97
+ Modal.prototype.enforceFocus = function () {
98
+ $(document)
99
+ .off('focusin.bs.modal') // guard against infinite focus loop
100
+ .on('focusin.bs.modal', $.proxy(function (e) {
101
+ if (this.$element[0] !== e.target && !this.$element.has(e.target).length) {
102
+ this.$element.focus()
103
+ }
104
+ }, this))
105
+ }
106
+
107
+ Modal.prototype.escape = function () {
108
+ if (this.isShown && this.options.keyboard) {
109
+ this.$element.on('keyup.dismiss.bs.modal', $.proxy(function (e) {
110
+ e.which == 27 && this.hide()
111
+ }, this))
112
+ } else if (!this.isShown) {
113
+ this.$element.off('keyup.dismiss.bs.modal')
114
+ }
115
+ }
116
+
117
+ Modal.prototype.hideModal = function () {
118
+ var that = this
119
+ this.$element.hide()
120
+ this.backdrop(function () {
121
+ that.removeBackdrop()
122
+ that.$element.trigger('hidden.bs.modal')
123
+ })
124
+ }
125
+
126
+ Modal.prototype.removeBackdrop = function () {
127
+ this.$backdrop && this.$backdrop.remove()
128
+ this.$backdrop = null
129
+ }
130
+
131
+ Modal.prototype.backdrop = function (callback) {
132
+ var that = this
133
+ var animate = this.$element.hasClass('fade') ? 'fade' : ''
134
+
135
+ if (this.isShown && this.options.backdrop) {
136
+ var doAnimate = $.support.transition && animate
137
+
138
+ this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
139
+ .appendTo(document.body)
140
+
141
+ this.$element.on('click.dismiss.modal', $.proxy(function (e) {
142
+ if (e.target !== e.currentTarget) return
143
+ this.options.backdrop == 'static'
144
+ ? this.$element[0].focus.call(this.$element[0])
145
+ : this.hide.call(this)
146
+ }, this))
147
+
148
+ if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
149
+
150
+ this.$backdrop.addClass('in')
151
+
152
+ if (!callback) return
153
+
154
+ doAnimate ?
155
+ this.$backdrop
156
+ .one($.support.transition.end, callback)
157
+ .emulateTransitionEnd(150) :
158
+ callback()
159
+
160
+ } else if (!this.isShown && this.$backdrop) {
161
+ this.$backdrop.removeClass('in')
162
+
163
+ $.support.transition && this.$element.hasClass('fade')?
164
+ this.$backdrop
165
+ .one($.support.transition.end, callback)
166
+ .emulateTransitionEnd(150) :
167
+ callback()
168
+
169
+ } else if (callback) {
170
+ callback()
171
+ }
172
+ }
173
+
174
+
175
+ // MODAL PLUGIN DEFINITION
176
+ // =======================
177
+
178
+ var old = $.fn.modal
179
+
180
+ $.fn.modal = function (option, _relatedTarget) {
181
+ return this.each(function () {
182
+ var $this = $(this)
183
+ var data = $this.data('bs.modal')
184
+ var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option)
185
+
186
+ if (!data) $this.data('bs.modal', (data = new Modal(this, options)))
187
+ if (typeof option == 'string') data[option](_relatedTarget)
188
+ else if (options.show) data.show(_relatedTarget)
189
+ })
190
+ }
191
+
192
+ $.fn.modal.Constructor = Modal
193
+
194
+
195
+ // MODAL NO CONFLICT
196
+ // =================
197
+
198
+ $.fn.modal.noConflict = function () {
199
+ $.fn.modal = old
200
+ return this
201
+ }
202
+
203
+
204
+ // MODAL DATA-API
205
+ // ==============
206
+
207
+ $(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) {
208
+ var $this = $(this)
209
+ var href = $this.attr('href')
210
+ var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7
211
+ var option = $target.data('modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data())
212
+
213
+ e.preventDefault()
214
+
215
+ $target
216
+ .modal(option, this)
217
+ .one('hide', function () {
218
+ $this.is(':visible') && $this.focus()
219
+ })
220
+ })
221
+
222
+ $(document)
223
+ .on('show.bs.modal', '.modal', function () { $(document.body).addClass('modal-open') })
224
+ .on('hidden.bs.modal', '.modal', function () { $(document.body).removeClass('modal-open') })
225
+
226
+ }(jQuery);
@@ -0,0 +1,97 @@
1
+ +function ($) { "use strict";
2
+
3
+ // POPOVER PUBLIC CLASS DEFINITION
4
+ // ===============================
5
+
6
+ var Popover = function (element, options) {
7
+ this.init('popover', element, options)
8
+ }
9
+
10
+ if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js')
11
+
12
+ Popover.DEFAULTS = $.extend({} , $.fn.tooltip.Constructor.DEFAULTS, {
13
+ placement: 'right'
14
+ , trigger: 'click'
15
+ , content: ''
16
+ , template: '<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
17
+ })
18
+
19
+
20
+ // NOTE: POPOVER EXTENDS tooltip.js
21
+ // ================================
22
+
23
+ Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype)
24
+
25
+ Popover.prototype.constructor = Popover
26
+
27
+ Popover.prototype.getDefaults = function () {
28
+ return Popover.DEFAULTS
29
+ }
30
+
31
+ Popover.prototype.setContent = function () {
32
+ var $tip = this.tip()
33
+ var title = this.getTitle()
34
+ var content = this.getContent()
35
+
36
+ $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title)
37
+ $tip.find('.popover-content')[this.options.html ? 'html' : 'text'](content)
38
+
39
+ $tip.removeClass('fade top bottom left right in')
40
+
41
+ // IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do
42
+ // this manually by checking the contents.
43
+ if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide()
44
+ }
45
+
46
+ Popover.prototype.hasContent = function () {
47
+ return this.getTitle() || this.getContent()
48
+ }
49
+
50
+ Popover.prototype.getContent = function () {
51
+ var $e = this.$element
52
+ var o = this.options
53
+
54
+ return $e.attr('data-content')
55
+ || (typeof o.content == 'function' ?
56
+ o.content.call($e[0]) :
57
+ o.content)
58
+ }
59
+
60
+ Popover.prototype.arrow = function () {
61
+ return this.$arrow = this.$arrow || this.tip().find('.arrow')
62
+ }
63
+
64
+ Popover.prototype.tip = function () {
65
+ if (!this.$tip) this.$tip = $(this.options.template)
66
+ return this.$tip
67
+ }
68
+
69
+
70
+ // POPOVER PLUGIN DEFINITION
71
+ // =========================
72
+
73
+ var old = $.fn.popover
74
+
75
+ $.fn.popover = function (option) {
76
+ return this.each(function () {
77
+ var $this = $(this)
78
+ var data = $this.data('bs.popover')
79
+ var options = typeof option == 'object' && option
80
+
81
+ if (!data) $this.data('bs.popover', (data = new Popover(this, options)))
82
+ if (typeof option == 'string') data[option]()
83
+ })
84
+ }
85
+
86
+ $.fn.popover.Constructor = Popover
87
+
88
+
89
+ // POPOVER NO CONFLICT
90
+ // ===================
91
+
92
+ $.fn.popover.noConflict = function () {
93
+ $.fn.popover = old
94
+ return this
95
+ }
96
+
97
+ }(jQuery);
@@ -0,0 +1,346 @@
1
+ !function ($) {
2
+ "use strict";
3
+
4
+ $.fn['switch'] = function (method) {
5
+ var inputSelector = 'input[type!="hidden"]';
6
+ var methods = {
7
+ init: function () {
8
+ return this.each(function () {
9
+ var $element = $(this)
10
+ , $div
11
+ , $switchLeft
12
+ , $switchRight
13
+ , $label
14
+ , $form = $element.closest('form')
15
+ , myClasses = ""
16
+ , classes = $element.attr('class')
17
+ , color
18
+ , moving
19
+ , onLabel = "On"
20
+ , offLabel = "Off"
21
+ , icon = false
22
+ , textLabel = false;
23
+
24
+ $element.addClass('switch');
25
+
26
+ if ($element.data('on') !== undefined)
27
+ color = "switch-" + $element.data('on');
28
+
29
+ if ($element.data('on-label') !== undefined)
30
+ onLabel = $element.data('on-label');
31
+
32
+ if ($element.data('off-label') !== undefined)
33
+ offLabel = $element.data('off-label');
34
+
35
+ if ($element.data('label-icon') !== undefined)
36
+ icon = $element.data('label-icon');
37
+
38
+ if ($element.data('text-label') !== undefined)
39
+ textLabel = $element.data('text-label');
40
+
41
+ $switchLeft = $('<span>')
42
+ .addClass("switch-left")
43
+ .addClass(myClasses)
44
+ .addClass(color)
45
+ .html('' + onLabel + '');
46
+
47
+ color = '';
48
+ if ($element.data('off') !== undefined)
49
+ color = "switch-" + $element.data('off');
50
+
51
+ $switchRight = $('<span>')
52
+ .addClass("switch-right")
53
+ .addClass(myClasses)
54
+ .addClass(color)
55
+ .html('' + offLabel + '');
56
+
57
+ $label = $('<label>')
58
+ .html("&nbsp;")
59
+ .addClass(myClasses)
60
+ .attr('for', $element.find(inputSelector).attr('id'));
61
+
62
+ if (icon) {
63
+ $label.html('<i class="icon ' + icon + '"></i>');
64
+ }
65
+
66
+ if (textLabel) {
67
+ $label.html('' + textLabel + '');
68
+ }
69
+
70
+ $div = $element.find(inputSelector).wrap($('<div>')).parent().data('animated', false);
71
+
72
+ if ($element.data('animated') !== false)
73
+ $div.addClass('switch-animate').data('animated', true);
74
+
75
+ $div
76
+ .append($switchLeft)
77
+ .append($label)
78
+ .append($switchRight);
79
+
80
+ $element.find('>div').addClass(
81
+ $element.find(inputSelector).is(':checked') ? 'switch-on' : 'switch-off'
82
+ );
83
+
84
+ if ($element.find(inputSelector).is(':disabled'))
85
+ $(this).addClass('deactivate');
86
+
87
+ var changeStatus = function ($this) {
88
+ if ($element.parent('label').is('.label-change-switch')) {
89
+
90
+ } else {
91
+ $this.siblings('label').trigger('mousedown').trigger('mouseup').trigger('click');
92
+ }
93
+ };
94
+
95
+ $element.on('keydown', function (e) {
96
+ if (e.keyCode === 32) {
97
+ e.stopImmediatePropagation();
98
+ e.preventDefault();
99
+ changeStatus($(e.target).find('span:first'));
100
+ }
101
+ });
102
+
103
+ $switchLeft.on('click', function (e) {
104
+ changeStatus($(this));
105
+ });
106
+
107
+ $switchRight.on('click', function (e) {
108
+ changeStatus($(this));
109
+ });
110
+
111
+ $element.find(inputSelector).on('change', function (e, skipOnChange) {
112
+ var $this = $(this)
113
+ , $element = $this.parent()
114
+ , thisState = $this.is(':checked')
115
+ , state = $element.is('.switch-off');
116
+
117
+ e.preventDefault();
118
+
119
+ $element.css('left', '');
120
+
121
+ if (state === thisState) {
122
+
123
+ if (thisState)
124
+ $element.removeClass('switch-off').addClass('switch-on');
125
+ else $element.removeClass('switch-on').addClass('switch-off');
126
+
127
+ if ($element.data('animated') !== false)
128
+ $element.addClass("switch-animate");
129
+
130
+ if (typeof skipOnChange === 'boolean' && skipOnChange)
131
+ return;
132
+
133
+ $element.parent().trigger('switch-change', {'el': $this, 'value': thisState})
134
+ }
135
+ });
136
+
137
+ $element.find('label').on('mousedown touchstart', function (e) {
138
+ var $this = $(this);
139
+ moving = false;
140
+
141
+ e.preventDefault();
142
+ e.stopImmediatePropagation();
143
+
144
+ $this.closest('div').removeClass('switch-animate');
145
+
146
+ if ($this.closest('.switch').is('.deactivate')) {
147
+ $this.unbind('click');
148
+ } else if ($this.closest('.switch-on').parent().is('.radio-no-uncheck')) {
149
+ $this.unbind('click');
150
+ } else {
151
+ $this.on('mousemove touchmove', function (e) {
152
+ var $element = $(this).closest('.form-switch')
153
+ , relativeX = (e.pageX || e.originalEvent.targetTouches[0].pageX) - $element.offset().left
154
+ , percent = (relativeX / $element.width()) * 100
155
+ , left = 25
156
+ , right = 75;
157
+
158
+ moving = true;
159
+
160
+ if (percent < left)
161
+ percent = left;
162
+ else if (percent > right)
163
+ percent = right;
164
+
165
+ $element.find('>div').css('left', (percent - right) + "%")
166
+ });
167
+
168
+ $this.on('click touchend', function (e) {
169
+ var $this = $(this)
170
+ , $myInputBox = $this.siblings('input');
171
+
172
+ e.stopImmediatePropagation();
173
+ e.preventDefault();
174
+
175
+ $this.unbind('mouseleave');
176
+
177
+ if (moving)
178
+ $myInputBox.prop('checked', !(parseInt($this.parent().css('left')) < -25));
179
+ else
180
+ $myInputBox.prop("checked", !$myInputBox.is(":checked"));
181
+
182
+ moving = false;
183
+ $myInputBox.trigger('change');
184
+ });
185
+
186
+ $this.on('mouseleave', function (e) {
187
+ var $this = $(this)
188
+ , $myInputBox = $this.siblings('input');
189
+
190
+ e.preventDefault();
191
+ e.stopImmediatePropagation();
192
+
193
+ $this.unbind('mouseleave mousemove');
194
+ $this.trigger('mouseup');
195
+
196
+ $myInputBox.prop('checked', !(parseInt($this.parent().css('left')) < -25)).trigger('change');
197
+ });
198
+
199
+ $this.on('mouseup', function (e) {
200
+ e.stopImmediatePropagation();
201
+ e.preventDefault();
202
+
203
+ $(this).trigger('mouseleave');
204
+ });
205
+ }
206
+ });
207
+
208
+ if ($form.data('switch') !== 'injected') {
209
+ $form.bind('reset', function () {
210
+ setTimeout(function () {
211
+ $form.find('.form-switch').each(function () {
212
+ var $input = $(this).find(inputSelector);
213
+
214
+ $input.prop('checked', $input.is(':checked')).trigger('change');
215
+ });
216
+ }, 1);
217
+ });
218
+ $form.data('switch', 'injected');
219
+ }
220
+ }
221
+ );
222
+ },
223
+ toggleActivation: function () {
224
+ var $this = $(this);
225
+
226
+ $this.toggleClass('deactivate');
227
+ $this.find(inputSelector).prop('disabled', $this.is('.deactivate'));
228
+ },
229
+ isActive: function () {
230
+ return !$(this).hasClass('deactivate');
231
+ },
232
+ setActive: function (active) {
233
+ var $this = $(this);
234
+
235
+ if (active) {
236
+ $this.removeClass('deactivate');
237
+ $this.find(inputSelector).removeAttr('disabled');
238
+ }
239
+ else {
240
+ $this.addClass('deactivate');
241
+ $this.find(inputSelector).attr('disabled', 'disabled');
242
+ }
243
+ },
244
+ toggleState: function (skipOnChange) {
245
+ var $input = $(this).find(':checkbox');
246
+ $input.prop('checked', !$input.is(':checked')).trigger('change', skipOnChange);
247
+ },
248
+ toggleRadioState: function (skipOnChange) {
249
+ var $radioinput = $(this).find(':radio');
250
+ $radioinput.not(':checked').prop('checked', !$radioinput.is(':checked')).trigger('change', skipOnChange);
251
+ },
252
+ toggleRadioStateAllowUncheck: function (uncheck, skipOnChange) {
253
+ var $radioinput = $(this).find(':radio');
254
+ if (uncheck) {
255
+ $radioinput.not(':checked').trigger('change', skipOnChange);
256
+ }
257
+ else {
258
+ $radioinput.not(':checked').prop('checked', !$radioinput.is(':checked')).trigger('change', skipOnChange);
259
+ }
260
+ },
261
+ setState: function (value, skipOnChange) {
262
+ $(this).find(inputSelector).prop('checked', value).trigger('change', skipOnChange);
263
+ },
264
+ setOnLabel: function (value) {
265
+ var $switchLeft = $(this).find(".switch-left");
266
+ $switchLeft.html(value);
267
+ },
268
+ setOffLabel: function (value) {
269
+ var $switchRight = $(this).find(".switch-right");
270
+ $switchRight.html(value);
271
+ },
272
+ setOnClass: function (value) {
273
+ var $switchLeft = $(this).find(".switch-left");
274
+ var color = '';
275
+ if (value !== undefined) {
276
+ if ($(this).attr('data-on') !== undefined) {
277
+ color = "switch-" + $(this).attr('data-on')
278
+ }
279
+ $switchLeft.removeClass(color);
280
+ color = "switch-" + value;
281
+ $switchLeft.addClass(color);
282
+ }
283
+ },
284
+ setOffClass: function (value) {
285
+ var $switchRight = $(this).find(".switch-right");
286
+ var color = '';
287
+ if (value !== undefined) {
288
+ if ($(this).attr('data-off') !== undefined) {
289
+ color = "switch-" + $(this).attr('data-off')
290
+ }
291
+ $switchRight.removeClass(color);
292
+ color = "switch-" + value;
293
+ $switchRight.addClass(color);
294
+ }
295
+ },
296
+ setAnimated: function (value) {
297
+ var $element = $(this).find(inputSelector).parent();
298
+ if (value === undefined) value = false;
299
+ $element.data('animated', value);
300
+ $element.attr('data-animated', value);
301
+
302
+ if ($element.data('animated') !== false) {
303
+ $element.addClass("switch-animate");
304
+ } else {
305
+ $element.removeClass("switch-animate");
306
+ }
307
+ },
308
+ status: function () {
309
+ return $(this).find(inputSelector).is(':checked');
310
+ },
311
+ destroy: function () {
312
+ var $element = $(this)
313
+ , $div = $element.find('div')
314
+ , $form = $element.closest('form')
315
+ , $inputbox;
316
+
317
+ $div.find(':not(input)').remove();
318
+
319
+ $inputbox = $div.children();
320
+ $inputbox.unwrap().unwrap();
321
+
322
+ $inputbox.unbind('change');
323
+
324
+ if ($form) {
325
+ $form.unbind('reset');
326
+ $form.removeData('switch');
327
+ }
328
+
329
+ return $inputbox;
330
+ }
331
+ };
332
+
333
+ if (methods[method])
334
+ return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
335
+ else if (typeof method === 'object' || !method)
336
+ return methods.init.apply(this, arguments);
337
+ else
338
+ $.error('Method ' + method + ' does not exist!');
339
+ };
340
+ }(jQuery);
341
+
342
+ (function ($) {
343
+ $(function () {
344
+ $('.form-switch')['switch']();
345
+ });
346
+ })(jQuery);