materialize-sass 0.99.0 → 0.100.0

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.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +2 -2
  3. data/app/assets/javascripts/materialize.js +6015 -5060
  4. data/app/assets/javascripts/materialize/animation.js +4 -5
  5. data/app/assets/javascripts/materialize/buttons.js +24 -38
  6. data/app/assets/javascripts/materialize/cards.js +13 -21
  7. data/app/assets/javascripts/materialize/carousel.js +122 -110
  8. data/app/assets/javascripts/materialize/character_counter.js +14 -22
  9. data/app/assets/javascripts/materialize/chips.js +41 -44
  10. data/app/assets/javascripts/materialize/collapsible.js +41 -46
  11. data/app/assets/javascripts/materialize/date_picker/picker.date.js +965 -1167
  12. data/app/assets/javascripts/materialize/date_picker/picker.js +546 -634
  13. data/app/assets/javascripts/materialize/date_picker/picker.time.js +166 -212
  14. data/app/assets/javascripts/materialize/dropdown.js +53 -68
  15. data/app/assets/javascripts/materialize/extras/nouislider.js +3 -1
  16. data/app/assets/javascripts/materialize/extras/nouislider.min.js +1 -1
  17. data/app/assets/javascripts/materialize/forms.js +156 -154
  18. data/app/assets/javascripts/materialize/global.js +34 -43
  19. data/app/assets/javascripts/materialize/hammer.min.js +424 -1
  20. data/app/assets/javascripts/materialize/initial.js +3 -3
  21. data/app/assets/javascripts/materialize/jquery.easing.1.4.js +120 -142
  22. data/app/assets/javascripts/materialize/jquery.hammer.js +9 -9
  23. data/app/assets/javascripts/materialize/materialbox.js +81 -107
  24. data/app/assets/javascripts/materialize/modal.js +373 -162
  25. data/app/assets/javascripts/materialize/parallax.js +11 -15
  26. data/app/assets/javascripts/materialize/pushpin.js +2 -5
  27. data/app/assets/javascripts/materialize/scrollFire.js +9 -11
  28. data/app/assets/javascripts/materialize/scrollspy.js +84 -92
  29. data/app/assets/javascripts/materialize/sideNav.js +128 -139
  30. data/app/assets/javascripts/materialize/slider.js +83 -112
  31. data/app/assets/javascripts/materialize/tabs.js +196 -196
  32. data/app/assets/javascripts/materialize/tapTarget.js +170 -173
  33. data/app/assets/javascripts/materialize/toasts.js +330 -112
  34. data/app/assets/javascripts/materialize/tooltip.js +134 -145
  35. data/app/assets/javascripts/materialize/transitions.js +43 -49
  36. data/app/assets/javascripts/materialize/velocity.min.js +623 -2
  37. data/app/assets/javascripts/materialize/waves.js +42 -47
  38. data/app/assets/stylesheets/materialize/components/_buttons.scss +1 -1
  39. data/app/assets/stylesheets/materialize/components/_carousel.scss +4 -5
  40. data/app/assets/stylesheets/materialize/components/_chips.scss +1 -0
  41. data/app/assets/stylesheets/materialize/components/_collapsible.scss +4 -7
  42. data/app/assets/stylesheets/materialize/components/_color.scss +1 -1
  43. data/app/assets/stylesheets/materialize/components/_global.scss +8 -14
  44. data/app/assets/stylesheets/materialize/components/_navbar.scss +0 -1
  45. data/app/assets/stylesheets/materialize/components/_tabs.scss +1 -7
  46. data/app/assets/stylesheets/materialize/components/_toast.scss +6 -12
  47. data/app/assets/stylesheets/materialize/components/_variables.scss +55 -43
  48. data/app/assets/stylesheets/materialize/components/date_picker/_default.scss +1 -0
  49. data/app/assets/stylesheets/materialize/components/forms/_checkboxes.scss +2 -12
  50. data/app/assets/stylesheets/materialize/components/forms/_file-input.scss +6 -0
  51. data/app/assets/stylesheets/materialize/components/forms/_input-fields.scss +67 -37
  52. data/app/assets/stylesheets/materialize/components/forms/_radio-buttons.scss +1 -3
  53. data/app/assets/stylesheets/materialize/components/forms/_select.scss +72 -11
  54. data/app/assets/stylesheets/materialize/components/forms/_switches.scss +2 -4
  55. data/app/assets/stylesheets/materialize/extras/nouislider.css +8 -1
  56. data/lib/materialize-sass/version.rb +1 -1
  57. metadata +2 -5
  58. data/app/assets/javascripts/materialize/init.js +0 -214
  59. data/app/assets/javascripts/materialize/jquery.timeago.min.js +0 -1
  60. data/app/assets/javascripts/materialize/prism.js +0 -8
@@ -1,7 +1,7 @@
1
1
  (function ($) {
2
2
 
3
- $.fn.characterCounter = function(){
4
- return this.each(function(){
3
+ $.fn.characterCounter = function () {
4
+ return this.each(function () {
5
5
  var $input = $(this);
6
6
  var $counterElement = $input.parent().find('span[class="character-counter"]');
7
7
 
@@ -12,24 +12,22 @@
12
12
 
13
13
  var itHasLengthAttribute = $input.attr('data-length') !== undefined;
14
14
 
15
- if(itHasLengthAttribute){
15
+ if (itHasLengthAttribute) {
16
16
  $input.on('input', updateCounter);
17
17
  $input.on('focus', updateCounter);
18
18
  $input.on('blur', removeCounterElement);
19
19
 
20
20
  addCounterElement($input);
21
21
  }
22
-
23
22
  });
24
23
  };
25
24
 
26
- function updateCounter(){
27
- var maxLength = +$(this).attr('data-length'),
28
- actualLength = +$(this).val().length,
29
- isValidLength = actualLength <= maxLength;
25
+ function updateCounter() {
26
+ var maxLength = +$(this).attr('data-length'),
27
+ actualLength = +$(this).val().length,
28
+ isValidLength = actualLength <= maxLength;
30
29
 
31
- $(this).parent().find('span[class="character-counter"]')
32
- .html( actualLength + '/' + maxLength);
30
+ $(this).parent().find('span[class="character-counter"]').html(actualLength + '/' + maxLength);
33
31
 
34
32
  addInputStyle(isValidLength, $(this));
35
33
  }
@@ -41,32 +39,26 @@
41
39
  return;
42
40
  }
43
41
 
44
- $counterElement = $('<span/>')
45
- .addClass('character-counter')
46
- .css('float','right')
47
- .css('font-size','12px')
48
- .css('height', 1);
42
+ $counterElement = $('<span/>').addClass('character-counter').css('float', 'right').css('font-size', '12px').css('height', 1);
49
43
 
50
44
  $input.parent().append($counterElement);
51
45
  }
52
46
 
53
- function removeCounterElement(){
47
+ function removeCounterElement() {
54
48
  $(this).parent().find('span[class="character-counter"]').html('');
55
49
  }
56
50
 
57
- function addInputStyle(isValidLength, $input){
51
+ function addInputStyle(isValidLength, $input) {
58
52
  var inputHasInvalidClass = $input.hasClass('invalid');
59
53
  if (isValidLength && inputHasInvalidClass) {
60
54
  $input.removeClass('invalid');
61
- }
62
- else if(!isValidLength && !inputHasInvalidClass){
55
+ } else if (!isValidLength && !inputHasInvalidClass) {
63
56
  $input.removeClass('valid');
64
57
  $input.addClass('invalid');
65
58
  }
66
59
  }
67
60
 
68
- $(document).on('ready turbolinks:load', function(){
61
+ $(document).on('ready turbolinks:load', function () {
69
62
  $('input, textarea').characterCounter();
70
63
  });
71
-
72
- }( jQuery ));
64
+ })(jQuery);
@@ -3,12 +3,12 @@
3
3
  data: [],
4
4
  placeholder: '',
5
5
  secondaryPlaceholder: '',
6
- autocompleteOptions: {},
6
+ autocompleteOptions: {}
7
7
  };
8
8
 
9
- $(document).on('ready turbolinks:load', function() {
9
+ $(document).on('ready turbolinks:load', function () {
10
10
  // Handle removal of static chips.
11
- $(document).on('click', '.chip .close', function(e){
11
+ $(document).on('click', '.chip .close', function (e) {
12
12
  var $chips = $(this).closest('.chips');
13
13
  if ($chips.attr('data-initialized')) {
14
14
  return;
@@ -26,7 +26,7 @@
26
26
  CHIP: '.chip',
27
27
  INPUT: 'input',
28
28
  DELETE: '.material-icons',
29
- SELECTED_CHIP: '.selected',
29
+ SELECTED_CHIP: '.selected'
30
30
  };
31
31
 
32
32
  if ('data' === options) {
@@ -37,10 +37,10 @@
37
37
  self.hasAutocomplete = !$.isEmptyObject(curr_options.autocompleteOptions.data);
38
38
 
39
39
  // Initialize
40
- this.init = function() {
40
+ this.init = function () {
41
41
  var i = 0;
42
42
  var chips;
43
- self.$el.each(function(){
43
+ self.$el.each(function () {
44
44
  var $chips = $(this);
45
45
  var chipId = Materialize.guid();
46
46
  self.chipId = chipId;
@@ -61,14 +61,14 @@
61
61
  });
62
62
  };
63
63
 
64
- this.handleEvents = function() {
64
+ this.handleEvents = function () {
65
65
  var SELS = self.SELS;
66
66
 
67
- self.$document.off('click.chips-focus', SELS.CHIPS).on('click.chips-focus', SELS.CHIPS, function(e){
67
+ self.$document.off('click.chips-focus', SELS.CHIPS).on('click.chips-focus', SELS.CHIPS, function (e) {
68
68
  $(e.target).find(SELS.INPUT).focus();
69
69
  });
70
70
 
71
- self.$document.off('click.chips-select', SELS.CHIP).on('click.chips-select', SELS.CHIP, function(e){
71
+ self.$document.off('click.chips-select', SELS.CHIP).on('click.chips-select', SELS.CHIP, function (e) {
72
72
  var $chip = $(e.target);
73
73
  if ($chip.length) {
74
74
  var wasSelected = $chip.hasClass('selected');
@@ -81,7 +81,7 @@
81
81
  }
82
82
  });
83
83
 
84
- self.$document.off('keydown.chips').on('keydown.chips', function(e){
84
+ self.$document.off('keydown.chips').on('keydown.chips', function (e) {
85
85
  if ($(e.target).is('input, textarea')) {
86
86
  return;
87
87
  }
@@ -103,9 +103,9 @@
103
103
  self.deleteChip(index, $chips);
104
104
 
105
105
  var selectIndex = null;
106
- if ((index + 1) < length) {
106
+ if (index + 1 < length) {
107
107
  selectIndex = index;
108
- } else if (index === length || (index + 1) === length) {
108
+ } else if (index === length || index + 1 === length) {
109
109
  selectIndex = length - 1;
110
110
  }
111
111
 
@@ -116,7 +116,7 @@
116
116
  }
117
117
  if (!length) $chips.find('input').focus();
118
118
 
119
- // left
119
+ // left
120
120
  } else if (e.which === 37) {
121
121
  index = $chip.index() - 1;
122
122
  if (index < 0) {
@@ -125,7 +125,7 @@
125
125
  $(SELS.CHIP).removeClass('selected');
126
126
  self.selectChip(index, $chips);
127
127
 
128
- // right
128
+ // right
129
129
  } else if (e.which === 39) {
130
130
  index = $chip.index() + 1;
131
131
  $(SELS.CHIP).removeClass('selected');
@@ -137,14 +137,14 @@
137
137
  }
138
138
  });
139
139
 
140
- self.$document.off('focusin.chips', SELS.CHIPS + ' ' + SELS.INPUT).on('focusin.chips', SELS.CHIPS + ' ' + SELS.INPUT, function(e){
140
+ self.$document.off('focusin.chips', SELS.CHIPS + ' ' + SELS.INPUT).on('focusin.chips', SELS.CHIPS + ' ' + SELS.INPUT, function (e) {
141
141
  var $currChips = $(e.target).closest(SELS.CHIPS);
142
142
  $currChips.addClass('focus');
143
143
  $currChips.siblings('label, .prefix').addClass('active');
144
144
  $(SELS.CHIP).removeClass('selected');
145
145
  });
146
146
 
147
- self.$document.off('focusout.chips', SELS.CHIPS + ' ' + SELS.INPUT).on('focusout.chips', SELS.CHIPS + ' ' + SELS.INPUT, function(e){
147
+ self.$document.off('focusout.chips', SELS.CHIPS + ' ' + SELS.INPUT).on('focusout.chips', SELS.CHIPS + ' ' + SELS.INPUT, function (e) {
148
148
  var $currChips = $(e.target).closest(SELS.CHIPS);
149
149
  $currChips.removeClass('focus');
150
150
 
@@ -155,7 +155,7 @@
155
155
  $currChips.siblings('.prefix').removeClass('active');
156
156
  });
157
157
 
158
- self.$document.off('keydown.chips-add', SELS.CHIPS + ' ' + SELS.INPUT).on('keydown.chips-add', SELS.CHIPS + ' ' + SELS.INPUT, function(e){
158
+ self.$document.off('keydown.chips-add', SELS.CHIPS + ' ' + SELS.INPUT).on('keydown.chips-add', SELS.CHIPS + ' ' + SELS.INPUT, function (e) {
159
159
  var $target = $(e.target);
160
160
  var $chips = $target.closest(SELS.CHIPS);
161
161
  var chipsLength = $chips.children(SELS.CHIP).length;
@@ -163,14 +163,12 @@
163
163
  // enter
164
164
  if (13 === e.which) {
165
165
  // Override enter if autocompleting.
166
- if (self.hasAutocomplete &&
167
- $chips.find('.autocomplete-content.dropdown-content').length &&
168
- $chips.find('.autocomplete-content.dropdown-content').children().length) {
166
+ if (self.hasAutocomplete && $chips.find('.autocomplete-content.dropdown-content').length && $chips.find('.autocomplete-content.dropdown-content').children().length) {
169
167
  return;
170
168
  }
171
169
 
172
170
  e.preventDefault();
173
- self.addChip({tag: $target.val()}, $chips);
171
+ self.addChip({ tag: $target.val() }, $chips);
174
172
  $target.val('');
175
173
  return;
176
174
  }
@@ -185,7 +183,7 @@
185
183
  });
186
184
 
187
185
  // Click on delete icon in chip.
188
- self.$document.off('click.chips-delete', SELS.CHIPS + ' ' + SELS.DELETE).on('click.chips-delete', SELS.CHIPS + ' ' + SELS.DELETE, function(e) {
186
+ self.$document.off('click.chips-delete', SELS.CHIPS + ' ' + SELS.DELETE).on('click.chips-delete', SELS.CHIPS + ' ' + SELS.DELETE, function (e) {
189
187
  var $target = $(e.target);
190
188
  var $chips = $target.closest(SELS.CHIPS);
191
189
  var $chip = $target.closest(SELS.CHIP);
@@ -195,12 +193,12 @@
195
193
  });
196
194
  };
197
195
 
198
- this.chips = function($chips, chipId) {
196
+ this.chips = function ($chips, chipId) {
199
197
  $chips.empty();
200
- $chips.data('chips').forEach(function(elem){
198
+ $chips.data('chips').forEach(function (elem) {
201
199
  $chips.append(self.renderChip(elem));
202
200
  });
203
- $chips.append($('<input id="' + chipId +'" class="input" placeholder="">'));
201
+ $chips.append($('<input id="' + chipId + '" class="input" placeholder="">'));
204
202
  self.setPlaceholder($chips);
205
203
 
206
204
  // Set for attribute for label
@@ -208,7 +206,7 @@
208
206
  if (label.length) {
209
207
  label.attr('for', chipId);
210
208
 
211
- if ($chips.data('chips')!== undefined && $chips.data('chips').length) {
209
+ if ($chips.data('chips') !== undefined && $chips.data('chips').length) {
212
210
  label.addClass('active');
213
211
  }
214
212
  }
@@ -216,11 +214,11 @@
216
214
  // Setup autocomplete if needed.
217
215
  var input = $('#' + chipId);
218
216
  if (self.hasAutocomplete) {
219
- curr_options.autocompleteOptions.onAutocomplete = function(val) {
220
- self.addChip({tag: val}, $chips);
217
+ curr_options.autocompleteOptions.onAutocomplete = function (val) {
218
+ self.addChip({ tag: val }, $chips);
221
219
  input.val('');
222
220
  input.focus();
223
- }
221
+ };
224
222
  input.autocomplete(curr_options.autocompleteOptions);
225
223
  }
226
224
  };
@@ -230,40 +228,39 @@
230
228
  * @param {Object} elem
231
229
  * @return {jQuery}
232
230
  */
233
- this.renderChip = function(elem) {
231
+ this.renderChip = function (elem) {
234
232
  if (!elem.tag) return;
235
233
 
236
234
  var $renderedChip = $('<div class="chip"></div>');
237
235
  $renderedChip.text(elem.tag);
238
236
  if (elem.image) {
239
- $renderedChip.prepend($('<img />').attr('src', elem.image))
237
+ $renderedChip.prepend($('<img />').attr('src', elem.image));
240
238
  }
241
239
  $renderedChip.append($('<i class="material-icons close">close</i>'));
242
240
  return $renderedChip;
243
241
  };
244
242
 
245
- this.setPlaceholder = function($chips) {
246
- if ($chips.data('chips') !== undefined && $chips.data('chips').length && curr_options.placeholder) {
243
+ this.setPlaceholder = function ($chips) {
244
+ if ($chips.data('chips') !== undefined && !$chips.data('chips').length && curr_options.placeholder) {
247
245
  $chips.find('input').prop('placeholder', curr_options.placeholder);
248
-
249
- } else if (($chips.data('chips') === undefined || !$chips.data('chips').length) && curr_options.secondaryPlaceholder) {
246
+ } else if (($chips.data('chips') === undefined || !!$chips.data('chips').length) && curr_options.secondaryPlaceholder) {
250
247
  $chips.find('input').prop('placeholder', curr_options.secondaryPlaceholder);
251
248
  }
252
249
  };
253
250
 
254
- this.isValid = function($chips, elem) {
251
+ this.isValid = function ($chips, elem) {
255
252
  var chips = $chips.data('chips');
256
253
  var exists = false;
257
- for (var i=0; i < chips.length; i++) {
254
+ for (var i = 0; i < chips.length; i++) {
258
255
  if (chips[i].tag === elem.tag) {
259
- exists = true;
260
- return;
256
+ exists = true;
257
+ return;
261
258
  }
262
259
  }
263
260
  return '' !== elem.tag && !exists;
264
261
  };
265
262
 
266
- this.addChip = function(elem, $chips) {
263
+ this.addChip = function (elem, $chips) {
267
264
  if (!self.isValid($chips, elem)) {
268
265
  return;
269
266
  }
@@ -281,7 +278,7 @@
281
278
  self.setPlaceholder($chips);
282
279
  };
283
280
 
284
- this.deleteChip = function(chipIndex, $chips) {
281
+ this.deleteChip = function (chipIndex, $chips) {
285
282
  var chip = $chips.data('chips')[chipIndex];
286
283
  $chips.find('.chip').eq(chipIndex).remove();
287
284
 
@@ -298,7 +295,7 @@
298
295
  self.setPlaceholder($chips);
299
296
  };
300
297
 
301
- this.selectChip = function(chipIndex, $chips) {
298
+ this.selectChip = function (chipIndex, $chips) {
302
299
  var $chip = $chips.find('.chip').eq(chipIndex);
303
300
  if ($chip && false === $chip.hasClass('selected')) {
304
301
  $chip.addClass('selected');
@@ -306,7 +303,7 @@
306
303
  }
307
304
  };
308
305
 
309
- this.getChipsElement = function(index, $chips) {
306
+ this.getChipsElement = function (index, $chips) {
310
307
  return $chips.eq(index);
311
308
  };
312
309
 
@@ -315,4 +312,4 @@
315
312
 
316
313
  this.handleEvents();
317
314
  };
318
- }( jQuery ));
315
+ })(jQuery);
@@ -1,5 +1,5 @@
1
1
  (function ($) {
2
- $.fn.collapsible = function(options, methodParam) {
2
+ $.fn.collapsible = function (options, methodParam) {
3
3
  var defaults = {
4
4
  accordion: undefined,
5
5
  onOpen: undefined,
@@ -9,8 +9,7 @@
9
9
  var methodName = options;
10
10
  options = $.extend(defaults, options);
11
11
 
12
-
13
- return this.each(function() {
12
+ return this.each(function () {
14
13
 
15
14
  var $this = $(this);
16
15
 
@@ -27,31 +26,32 @@
27
26
  $panel_headers = $this.find('> li > .collapsible-header');
28
27
  if (object.hasClass('active')) {
29
28
  object.parent().addClass('active');
30
- }
31
- else {
29
+ } else {
32
30
  object.parent().removeClass('active');
33
31
  }
34
- if (object.parent().hasClass('active')){
35
- object.siblings('.collapsible-body').stop(true,false).slideDown({ duration: 350, easing: "easeOutQuart", queue: false, complete: function() {$(this).css('height', '');}});
36
- }
37
- else{
38
- object.siblings('.collapsible-body').stop(true,false).slideUp({ duration: 350, easing: "easeOutQuart", queue: false, complete: function() {$(this).css('height', '');}});
32
+ if (object.parent().hasClass('active')) {
33
+ object.siblings('.collapsible-body').stop(true, false).slideDown({ duration: 350, easing: "easeOutQuart", queue: false, complete: function () {
34
+ $(this).css('height', '');
35
+ } });
36
+ } else {
37
+ object.siblings('.collapsible-body').stop(true, false).slideUp({ duration: 350, easing: "easeOutQuart", queue: false, complete: function () {
38
+ $(this).css('height', '');
39
+ } });
39
40
  }
40
41
 
41
42
  $panel_headers.not(object).removeClass('active').parent().removeClass('active');
42
43
 
43
44
  // Close previously open accordion elements.
44
- $panel_headers.not(object).parent().children('.collapsible-body').stop(true,false).each(function() {
45
+ $panel_headers.not(object).parent().children('.collapsible-body').stop(true, false).each(function () {
45
46
  if ($(this).is(':visible')) {
46
47
  $(this).slideUp({
47
48
  duration: 350,
48
49
  easing: "easeOutQuart",
49
50
  queue: false,
50
- complete:
51
- function() {
52
- $(this).css('height', '');
53
- execCallbacks($(this).siblings('.collapsible-header'));
54
- }
51
+ complete: function () {
52
+ $(this).css('height', '');
53
+ execCallbacks($(this).siblings('.collapsible-header'));
54
+ }
55
55
  });
56
56
  }
57
57
  });
@@ -61,15 +61,17 @@
61
61
  function expandableOpen(object) {
62
62
  if (object.hasClass('active')) {
63
63
  object.parent().addClass('active');
64
- }
65
- else {
64
+ } else {
66
65
  object.parent().removeClass('active');
67
66
  }
68
- if (object.parent().hasClass('active')){
69
- object.siblings('.collapsible-body').stop(true,false).slideDown({ duration: 350, easing: "easeOutQuart", queue: false, complete: function() {$(this).css('height', '');}});
70
- }
71
- else {
72
- object.siblings('.collapsible-body').stop(true,false).slideUp({ duration: 350, easing: "easeOutQuart", queue: false, complete: function() {$(this).css('height', '');}});
67
+ if (object.parent().hasClass('active')) {
68
+ object.siblings('.collapsible-body').stop(true, false).slideDown({ duration: 350, easing: "easeOutQuart", queue: false, complete: function () {
69
+ $(this).css('height', '');
70
+ } });
71
+ } else {
72
+ object.siblings('.collapsible-body').stop(true, false).slideUp({ duration: 350, easing: "easeOutQuart", queue: false, complete: function () {
73
+ $(this).css('height', '');
74
+ } });
73
75
  }
74
76
  }
75
77
 
@@ -79,9 +81,11 @@
79
81
  object.toggleClass('active');
80
82
  }
81
83
 
82
- if (options.accordion || collapsible_type === "accordion" || collapsible_type === undefined) { // Handle Accordion
84
+ if (options.accordion || collapsible_type === "accordion" || collapsible_type === undefined) {
85
+ // Handle Accordion
83
86
  accordionOpen(object);
84
- } else { // Handle Expandables
87
+ } else {
88
+ // Handle Expandables
85
89
  expandableOpen(object);
86
90
  }
87
91
 
@@ -91,11 +95,11 @@
91
95
  // Handle callbacks
92
96
  function execCallbacks(object) {
93
97
  if (object.hasClass('active')) {
94
- if (typeof(options.onOpen) === "function") {
98
+ if (typeof options.onOpen === "function") {
95
99
  options.onOpen.call(this, object.parent());
96
100
  }
97
101
  } else {
98
- if (typeof(options.onClose) === "function") {
102
+ if (typeof options.onClose === "function") {
99
103
  options.onClose.call(this, object.parent());
100
104
  }
101
105
  }
@@ -123,7 +127,6 @@
123
127
  return object.closest('li > .collapsible-header');
124
128
  }
125
129
 
126
-
127
130
  // Turn off any existing event handlers
128
131
  function removeEventHandlers() {
129
132
  $this.off('click.collapse', '> li > .collapsible-header');
@@ -131,29 +134,22 @@
131
134
 
132
135
  /***** End Helper Functions *****/
133
136
 
134
-
135
137
  // Methods
136
138
  if (methodName === 'destroy') {
137
139
  removeEventHandlers();
138
140
  return;
139
- } else if (methodParam >= 0 &&
140
- methodParam < $panel_headers.length) {
141
+ } else if (methodParam >= 0 && methodParam < $panel_headers.length) {
141
142
  var $curr_header = $panel_headers.eq(methodParam);
142
- if ($curr_header.length &&
143
- (methodName === 'open' ||
144
- (methodName === 'close' &&
145
- $curr_header.hasClass('active')))) {
143
+ if ($curr_header.length && (methodName === 'open' || methodName === 'close' && $curr_header.hasClass('active'))) {
146
144
  collapsibleOpen($curr_header);
147
145
  }
148
146
  return;
149
147
  }
150
148
 
151
-
152
149
  removeEventHandlers();
153
150
 
154
-
155
151
  // Add click handler to only direct collapsible header children
156
- $this.on('click.collapse', '> li > .collapsible-header', function(e) {
152
+ $this.on('click.collapse', '> li > .collapsible-header', function (e) {
157
153
  var element = $(e.target);
158
154
 
159
155
  if (isChildrenOfPanelHeader(element)) {
@@ -163,21 +159,20 @@
163
159
  collapsibleOpen(element);
164
160
  });
165
161
 
166
-
167
162
  // Open first active
168
- if (options.accordion || collapsible_type === "accordion" || collapsible_type === undefined) { // Handle Accordion
163
+ if (options.accordion || collapsible_type === "accordion" || collapsible_type === undefined) {
164
+ // Handle Accordion
169
165
  collapsibleOpen($panel_headers.filter('.active').first(), true);
170
-
171
- } else { // Handle Expandables
172
- $panel_headers.filter('.active').each(function() {
166
+ } else {
167
+ // Handle Expandables
168
+ $panel_headers.filter('.active').each(function () {
173
169
  collapsibleOpen($(this), true);
174
170
  });
175
171
  }
176
-
177
172
  });
178
173
  };
179
174
 
180
- $(document).on('ready turbolinks:load', function(){
175
+ $(document).on('ready turbolinks:load', function () {
181
176
  $('.collapsible').collapsible();
182
177
  });
183
- }( jQuery ));
178
+ })(jQuery);