materialize-sass 0.97.7 → 0.97.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/README.md +23 -1
  4. data/Rakefile +112 -1
  5. data/app/assets/javascripts/materialize-sprockets.js +2 -2
  6. data/app/assets/javascripts/materialize.js +5 -7468
  7. data/app/assets/javascripts/materialize/buttons.js +182 -6
  8. data/app/assets/javascripts/materialize/cards.js +2 -2
  9. data/app/assets/javascripts/materialize/carousel.js +1 -1
  10. data/app/assets/javascripts/materialize/character_counter.js +1 -1
  11. data/app/assets/javascripts/materialize/chips.js +76 -54
  12. data/app/assets/javascripts/materialize/collapsible.js +62 -39
  13. data/app/assets/javascripts/materialize/dropdown.js +21 -21
  14. data/app/assets/javascripts/materialize/extras/nouislider.js +1 -1
  15. data/app/assets/javascripts/materialize/forms.js +5 -4
  16. data/app/assets/javascripts/materialize/global.js +56 -3
  17. data/app/assets/javascripts/materialize/init.js +3 -2
  18. data/app/assets/javascripts/materialize/materialbox.js +1 -1
  19. data/app/assets/javascripts/materialize/modal.js +184 -0
  20. data/app/assets/javascripts/materialize/parallax.js +2 -2
  21. data/app/assets/javascripts/materialize/scrollspy.js +7 -6
  22. data/app/assets/javascripts/materialize/sideNav.js +193 -175
  23. data/app/assets/javascripts/materialize/tabs.js +31 -15
  24. data/app/assets/javascripts/materialize/toasts.js +29 -28
  25. data/app/assets/javascripts/materialize/tooltip.js +7 -1
  26. data/app/assets/javascripts/materialize/transitions.js +1 -1
  27. data/app/assets/stylesheets/materialize.scss +5 -5
  28. data/app/assets/stylesheets/materialize/components/_buttons.scss +78 -8
  29. data/app/assets/stylesheets/materialize/components/_cards.scss +2 -0
  30. data/app/assets/stylesheets/materialize/components/_chips.scss +15 -6
  31. data/app/assets/stylesheets/materialize/components/_dropdown.scss +9 -1
  32. data/app/assets/stylesheets/materialize/components/_global.scss +46 -27
  33. data/app/assets/stylesheets/materialize/components/_materialbox.scss +1 -1
  34. data/app/assets/stylesheets/materialize/components/_mixins.scss +1 -1
  35. data/app/assets/stylesheets/materialize/components/_modal.scss +12 -12
  36. data/app/assets/stylesheets/materialize/components/_navbar.scss +11 -3
  37. data/app/assets/stylesheets/materialize/components/_normalize.scss +0 -0
  38. data/app/assets/stylesheets/materialize/components/_preloader.scss +1 -1
  39. data/app/assets/stylesheets/materialize/components/_roboto.scss +0 -0
  40. data/app/assets/stylesheets/materialize/components/_sideNav.scss +6 -16
  41. data/app/assets/stylesheets/materialize/components/_slider.scss +1 -1
  42. data/app/assets/stylesheets/materialize/components/_table_of_contents.scss +0 -0
  43. data/app/assets/stylesheets/materialize/components/_tabs.scss +62 -19
  44. data/app/assets/stylesheets/materialize/components/_typography.scss +1 -1
  45. data/app/assets/stylesheets/materialize/components/_variables.scss +82 -82
  46. data/app/assets/stylesheets/materialize/components/_waves.scss +2 -2
  47. data/app/assets/stylesheets/materialize/components/forms/_input-fields.scss +13 -0
  48. data/app/assets/stylesheets/materialize/components/forms/_radio-buttons.scss +0 -2
  49. data/app/assets/stylesheets/materialize/components/forms/_select.scss +6 -1
  50. data/app/assets/stylesheets/materialize/extras/nouislider.css +1 -1
  51. data/lib/materialize-sass/version.rb +1 -1
  52. metadata +4 -5
  53. data/app/assets/javascripts/materialize.min.js +0 -10
  54. data/app/assets/javascripts/materialize/leanModal.js +0 -192
@@ -1,21 +1,21 @@
1
1
  (function ($) {
2
- $(document).ready(function() {
2
+ $(document).on('turbolinks:load', function() {
3
3
 
4
4
  // jQuery reverse
5
5
  $.fn.reverse = [].reverse;
6
6
 
7
7
  // Hover behaviour: make sure this doesn't work on .click-to-toggle FABs!
8
- $(document).on('mouseenter.fixedActionBtn', '.fixed-action-btn:not(.click-to-toggle)', function(e) {
8
+ $(document).on('mouseenter.fixedActionBtn', '.fixed-action-btn:not(.click-to-toggle):not(.toolbar)', function(e) {
9
9
  var $this = $(this);
10
10
  openFABMenu($this);
11
11
  });
12
- $(document).on('mouseleave.fixedActionBtn', '.fixed-action-btn:not(.click-to-toggle)', function(e) {
12
+ $(document).on('mouseleave.fixedActionBtn', '.fixed-action-btn:not(.click-to-toggle):not(.toolbar)', function(e) {
13
13
  var $this = $(this);
14
14
  closeFABMenu($this);
15
15
  });
16
16
 
17
17
  // Toggle-on-click behaviour.
18
- $(document).on('click.fixedActionBtn', '.fixed-action-btn.click-to-toggle > a', function(e) {
18
+ $(document).on('click.fabClickToggle', '.fixed-action-btn.click-to-toggle > a', function(e) {
19
19
  var $this = $(this);
20
20
  var $menu = $this.parent();
21
21
  if ($menu.hasClass('active')) {
@@ -25,6 +25,13 @@
25
25
  }
26
26
  });
27
27
 
28
+ // Toolbar transition behaviour.
29
+ $(document).on('click.fabToolbar', '.fixed-action-btn.toolbar > a', function(e) {
30
+ var $this = $(this);
31
+ var $menu = $this.parent();
32
+ FABtoToolbar($menu);
33
+ });
34
+
28
35
  });
29
36
 
30
37
  $.fn.extend({
@@ -33,12 +40,18 @@
33
40
  },
34
41
  closeFAB: function() {
35
42
  closeFABMenu($(this));
43
+ },
44
+ openToolbar: function() {
45
+ FABtoToolbar($(this));
46
+ },
47
+ closeToolbar: function() {
48
+ toolbarToFAB($(this));
36
49
  }
37
50
  });
38
51
 
39
52
 
40
53
  var openFABMenu = function (btn) {
41
- $this = btn;
54
+ var $this = btn;
42
55
  if ($this.hasClass('active') === false) {
43
56
 
44
57
  // Get direction option
@@ -67,7 +80,7 @@
67
80
  };
68
81
 
69
82
  var closeFABMenu = function (btn) {
70
- $this = btn;
83
+ var $this = btn;
71
84
  // Get direction option
72
85
  var horizontal = $this.hasClass('horizontal');
73
86
  var offsetY, offsetX;
@@ -88,4 +101,167 @@
88
101
  };
89
102
 
90
103
 
104
+ /**
105
+ * Transform FAB into toolbar
106
+ * @param {Object} object jQuery object
107
+ */
108
+ var FABtoToolbar = function(btn) {
109
+ if (btn.attr('data-open') === "true") {
110
+ return;
111
+ }
112
+
113
+ var offsetX, offsetY, scaleFactor;
114
+ var windowWidth = window.innerWidth;
115
+ var windowHeight = window.innerHeight;
116
+ var btnRect = btn[0].getBoundingClientRect();
117
+ var anchor = btn.find('> a').first();
118
+ var menu = btn.find('> ul').first();
119
+ var backdrop = $('<div class="fab-backdrop"></div>');
120
+ var fabColor = anchor.css('background-color');
121
+ anchor.append(backdrop);
122
+
123
+ offsetX = btnRect.left - (windowWidth / 2) + (btnRect.width / 2);
124
+ offsetY = windowHeight - btnRect.bottom;
125
+ scaleFactor = windowWidth / backdrop.width();
126
+ btn.attr('data-origin-bottom', btnRect.bottom);
127
+ btn.attr('data-origin-left', btnRect.left);
128
+ btn.attr('data-origin-width', btnRect.width);
129
+
130
+ // Set initial state
131
+ btn.addClass('active');
132
+ btn.attr('data-open', true);
133
+ btn.css({
134
+ 'text-align': 'center',
135
+ width: '100%',
136
+ bottom: 0,
137
+ left: 0,
138
+ transform: 'translateX(' + offsetX + 'px)',
139
+ transition: 'none'
140
+ });
141
+ anchor.css({
142
+ transform: 'translateY(' + -offsetY + 'px)',
143
+ transition: 'none'
144
+ });
145
+ backdrop.css({
146
+ 'background-color': fabColor
147
+ });
148
+
149
+
150
+ setTimeout(function() {
151
+ btn.css({
152
+ transform: '',
153
+ transition: 'transform .2s cubic-bezier(0.550, 0.085, 0.680, 0.530), background-color 0s linear .2s'
154
+ });
155
+ anchor.css({
156
+ overflow: 'visible',
157
+ transform: '',
158
+ transition: 'transform .2s'
159
+ });
160
+
161
+ setTimeout(function() {
162
+ btn.css({
163
+ overflow: 'hidden',
164
+ 'background-color': fabColor
165
+ });
166
+ backdrop.css({
167
+ transform: 'scale(' + scaleFactor + ')',
168
+ transition: 'transform .2s cubic-bezier(0.550, 0.055, 0.675, 0.190)'
169
+ });
170
+ menu.find('> li > a').css({
171
+ opacity: 1
172
+ });
173
+
174
+ // Scroll to close.
175
+ $(window).on('scroll.fabToolbarClose', function() {
176
+ toolbarToFAB(btn);
177
+ $(window).off('scroll.fabToolbarClose');
178
+ $(document).off('click.fabToolbarClose');
179
+ });
180
+
181
+ $(document).on('click.fabToolbarClose', function(e) {
182
+ if (!$(e.target).closest(menu).length) {
183
+ toolbarToFAB(btn);
184
+ $(window).off('scroll.fabToolbarClose');
185
+ $(document).off('click.fabToolbarClose');
186
+ }
187
+ });
188
+ }, 100);
189
+ }, 0);
190
+ };
191
+
192
+ /**
193
+ * Transform toolbar back into FAB
194
+ * @param {Object} object jQuery object
195
+ */
196
+ var toolbarToFAB = function(btn) {
197
+ if (btn.attr('data-open') !== "true") {
198
+ return;
199
+ }
200
+
201
+ var offsetX, offsetY, scaleFactor;
202
+ var windowWidth = window.innerWidth;
203
+ var windowHeight = window.innerHeight;
204
+ var btnWidth = btn.attr('data-origin-width');
205
+ var btnBottom = btn.attr('data-origin-bottom');
206
+ var btnLeft = btn.attr('data-origin-left');
207
+ var anchor = btn.find('> .btn-floating').first();
208
+ var menu = btn.find('> ul').first();
209
+ var backdrop = btn.find('.fab-backdrop');
210
+ var fabColor = anchor.css('background-color');
211
+
212
+ offsetX = btnLeft - (windowWidth / 2) + (btnWidth / 2);
213
+ offsetY = windowHeight - btnBottom;
214
+ scaleFactor = windowWidth / backdrop.width();
215
+
216
+
217
+ // Hide backdrop
218
+ btn.removeClass('active');
219
+ btn.attr('data-open', false);
220
+ btn.css({
221
+ 'background-color': 'transparent',
222
+ transition: 'none'
223
+ });
224
+ anchor.css({
225
+ transition: 'none'
226
+ });
227
+ backdrop.css({
228
+ transform: 'scale(0)',
229
+ 'background-color': fabColor
230
+ });
231
+ menu.find('> li > a').css({
232
+ opacity: ''
233
+ });
234
+
235
+ setTimeout(function() {
236
+ backdrop.remove();
237
+
238
+ // Set initial state.
239
+ btn.css({
240
+ 'text-align': '',
241
+ width: '',
242
+ bottom: '',
243
+ left: '',
244
+ overflow: '',
245
+ 'background-color': '',
246
+ transform: 'translate3d(' + -offsetX + 'px,0,0)'
247
+ });
248
+ anchor.css({
249
+ overflow: '',
250
+ transform: 'translate3d(0,' + offsetY + 'px,0)'
251
+ });
252
+
253
+ setTimeout(function() {
254
+ btn.css({
255
+ transform: 'translate3d(0,0,0)',
256
+ transition: 'transform .2s'
257
+ });
258
+ anchor.css({
259
+ transform: 'translate3d(0,0,0)',
260
+ transition: 'transform .2s cubic-bezier(0.550, 0.055, 0.675, 0.190)'
261
+ });
262
+ }, 20);
263
+ }, 200);
264
+ };
265
+
266
+
91
267
  }( jQuery ));
@@ -1,5 +1,5 @@
1
1
  (function ($) {
2
- $(document).ready(function() {
2
+ $(document).on('turbolinks:load', function() {
3
3
 
4
4
  $(document).on('click.card', '.card', function (e) {
5
5
  if ($(this).find('> .card-reveal').length) {
@@ -23,4 +23,4 @@
23
23
  });
24
24
 
25
25
  });
26
- }( jQuery ));
26
+ }( jQuery ));
@@ -39,7 +39,7 @@
39
39
  options.dist = 0;
40
40
  var firstImage = view.find('.carousel-item img').first();
41
41
  if (firstImage.length) {
42
- imageHeight = firstImage.load(function(){
42
+ imageHeight = firstImage.on('load', function(){
43
43
  view.css('height', $(this).height());
44
44
  });
45
45
  } else {
@@ -65,7 +65,7 @@
65
65
  }
66
66
  }
67
67
 
68
- $(document).ready(function(){
68
+ $(document).on('turbolinks:load', function(){
69
69
  $('input, textarea').characterCounter();
70
70
  });
71
71
 
@@ -6,11 +6,11 @@
6
6
  secondaryPlaceholder: '',
7
7
  };
8
8
 
9
- $(document).ready(function(){
9
+ $(document).on('turbolinks:load', function() {
10
10
  // Handle removal of static chips.
11
11
  $(document).on('click', '.chip .close', function(e){
12
12
  var $chips = $(this).closest('.chips');
13
- if ($chips.data('initialized')) {
13
+ if ($chips.attr('data-initialized')) {
14
14
  return;
15
15
  }
16
16
  $(this).closest('.chip').remove();
@@ -33,11 +33,8 @@
33
33
  return this.$el.data('chips');
34
34
  }
35
35
 
36
- if ('options' === options) {
37
- return this.$el.data('options');
38
- }
36
+ var curr_options = $.extend({}, materialChipsDefaults, options);
39
37
 
40
- this.$el.data('options', $.extend({}, materialChipsDefaults, options));
41
38
 
42
39
  // Initialize
43
40
  this.init = function() {
@@ -45,23 +42,20 @@
45
42
  var chips;
46
43
  self.$el.each(function(){
47
44
  var $chips = $(this);
48
- if ($chips.data('initialized')) {
49
- // Prevent double initialization.
50
- return;
51
- }
52
- var options = $chips.data('options');
53
- if (!options.data || !options.data instanceof Array) {
54
- options.data = [];
45
+ var chipId = Materialize.guid();
46
+
47
+ if (!curr_options.data || !(curr_options.data instanceof Array)) {
48
+ curr_options.data = [];
55
49
  }
56
- $chips.data('chips', options.data);
57
- $chips.data('index', i);
58
- $chips.data('initialized', true);
50
+ $chips.data('chips', curr_options.data);
51
+ $chips.attr('data-index', i);
52
+ $chips.attr('data-initialized', true);
59
53
 
60
54
  if (!$chips.hasClass(self.SELS.CHIPS)) {
61
55
  $chips.addClass('chips');
62
56
  }
63
57
 
64
- self.chips($chips);
58
+ self.chips($chips, chipId);
65
59
  i++;
66
60
  });
67
61
  };
@@ -69,16 +63,16 @@
69
63
  this.handleEvents = function(){
70
64
  var SELS = self.SELS;
71
65
 
72
- self.$document.on('click', SELS.CHIPS, function(e){
66
+ self.$document.off('click.chips-focus', SELS.CHIPS).on('click.chips-focus', SELS.CHIPS, function(e){
73
67
  $(e.target).find(SELS.INPUT).focus();
74
68
  });
75
69
 
76
- self.$document.on('click', SELS.CHIP, function(e){
70
+ self.$document.off('click.chips-select', SELS.CHIP).on('click.chips-select', SELS.CHIP, function(e){
77
71
  $(SELS.CHIP).removeClass('selected');
78
72
  $(this).toggleClass('selected');
79
73
  });
80
74
 
81
- self.$document.on('keydown', function(e){
75
+ self.$document.off('keydown.chips').on('keydown.chips', function(e){
82
76
  if ($(e.target).is('input, textarea')) {
83
77
  return;
84
78
  }
@@ -95,10 +89,9 @@
95
89
 
96
90
  if (e.which === 8 || e.which === 46) {
97
91
  e.preventDefault();
98
- var chipsIndex = $chips.data('index');
99
92
 
100
93
  index = $chip.index();
101
- self.deleteChip(chipsIndex, index, $chips);
94
+ self.deleteChip(index, $chips);
102
95
 
103
96
  var selectIndex = null;
104
97
  if ((index + 1) < length) {
@@ -110,7 +103,7 @@
110
103
  if (selectIndex < 0) selectIndex = null;
111
104
 
112
105
  if (null !== selectIndex) {
113
- self.selectChip(chipsIndex, selectIndex, $chips);
106
+ self.selectChip(selectIndex, $chips);
114
107
  }
115
108
  if (!length) $chips.find('input').focus();
116
109
 
@@ -121,7 +114,7 @@
121
114
  return;
122
115
  }
123
116
  $(SELS.CHIP).removeClass('selected');
124
- self.selectChip($chips.data('index'), index, $chips);
117
+ self.selectChip(index, $chips);
125
118
 
126
119
  // right
127
120
  } else if (e.which === 39) {
@@ -131,64 +124,78 @@
131
124
  $chips.find('input').focus();
132
125
  return;
133
126
  }
134
- self.selectChip($chips.data('index'), index, $chips);
127
+ self.selectChip(index, $chips);
135
128
  }
136
129
  });
137
130
 
138
- self.$document.on('focusin', SELS.CHIPS + ' ' + SELS.INPUT, function(e){
139
- $(e.target).closest(SELS.CHIPS).addClass('focus');
131
+ self.$document.off('focusin.chips', SELS.CHIPS + ' ' + SELS.INPUT).on('focusin.chips', SELS.CHIPS + ' ' + SELS.INPUT, function(e){
132
+ var $currChips = $(e.target).closest(SELS.CHIPS);
133
+ $currChips.addClass('focus');
134
+ $currChips.siblings('label, .prefix').addClass('active');
140
135
  $(SELS.CHIP).removeClass('selected');
141
136
  });
142
137
 
143
- self.$document.on('focusout', SELS.CHIPS + ' ' + SELS.INPUT, function(e){
144
- $(e.target).closest(SELS.CHIPS).removeClass('focus');
138
+ self.$document.off('focusout.chips', SELS.CHIPS + ' ' + SELS.INPUT).on('focusout.chips', SELS.CHIPS + ' ' + SELS.INPUT, function(e){
139
+ var $currChips = $(e.target).closest(SELS.CHIPS);
140
+ $currChips.removeClass('focus');
141
+
142
+ // Remove active if empty
143
+ if (!$currChips.data('chips').length) {
144
+ $currChips.siblings('label').removeClass('active');
145
+ }
146
+ $currChips.siblings('.prefix').removeClass('active');
145
147
  });
146
148
 
147
- self.$document.on('keydown', SELS.CHIPS + ' ' + SELS.INPUT, function(e){
149
+ self.$document.off('keydown.chips-add', SELS.CHIPS + ' ' + SELS.INPUT).on('keydown.chips-add', SELS.CHIPS + ' ' + SELS.INPUT, function(e){
148
150
  var $target = $(e.target);
149
151
  var $chips = $target.closest(SELS.CHIPS);
150
- var chipsIndex = $chips.data('index');
151
152
  var chipsLength = $chips.children(SELS.CHIP).length;
152
153
 
153
154
  // enter
154
155
  if (13 === e.which) {
155
156
  e.preventDefault();
156
- self.addChip(chipsIndex, {tag: $target.val()}, $chips);
157
+ self.addChip({tag: $target.val()}, $chips);
157
158
  $target.val('');
158
159
  return;
159
160
  }
160
161
 
161
162
  // delete or left
162
163
  if ((8 === e.keyCode || 37 === e.keyCode) && '' === $target.val() && chipsLength) {
163
- self.selectChip(chipsIndex, chipsLength - 1, $chips);
164
+ self.selectChip(chipsLength - 1, $chips);
164
165
  $target.blur();
165
166
  return;
166
167
  }
167
168
  });
168
169
 
169
- self.$document.on('click', SELS.CHIPS + ' ' + SELS.DELETE, function(e) {
170
+ // Click on delete icon in chip.
171
+ self.$document.off('click.chips-delete', SELS.CHIPS + ' ' + SELS.DELETE).on('click.chips-delete', SELS.CHIPS + ' ' + SELS.DELETE, function(e) {
170
172
  var $target = $(e.target);
171
173
  var $chips = $target.closest(SELS.CHIPS);
172
174
  var $chip = $target.closest(SELS.CHIP);
173
175
  e.stopPropagation();
174
- self.deleteChip(
175
- $chips.data('index'),
176
- $chip.index(),
177
- $chips
178
- );
176
+ self.deleteChip($chip.index(), $chips);
179
177
  $chips.find('input').focus();
180
178
  });
181
179
  };
182
180
 
183
- this.chips = function($chips) {
181
+ this.chips = function($chips, chipId) {
184
182
  var html = '';
185
- var options = $chips.data('options');
186
183
  $chips.data('chips').forEach(function(elem){
187
184
  html += self.renderChip(elem);
188
185
  });
189
- html += '<input class="input" placeholder="">';
186
+ html += '<input id="' + chipId +'" class="input" placeholder="">';
190
187
  $chips.html(html);
191
188
  self.setPlaceholder($chips);
189
+
190
+ // Set for attribute for label
191
+ var label = $chips.next('label');
192
+ if (label.length) {
193
+ label.attr('for', chipId);
194
+
195
+ if ($chips.data('chips').length) {
196
+ label.addClass('active');
197
+ }
198
+ }
192
199
  };
193
200
 
194
201
  this.renderChip = function(elem) {
@@ -204,11 +211,11 @@
204
211
  };
205
212
 
206
213
  this.setPlaceholder = function($chips) {
207
- var options = $chips.data('options');
208
- if ($chips.data('chips').length && options.placeholder) {
209
- $chips.find('input').prop('placeholder', options.placeholder);
210
- } else if (!$chips.data('chips').length && options.secondaryPlaceholder) {
211
- $chips.find('input').prop('placeholder', options.secondaryPlaceholder);
214
+ if ($chips.data('chips').length && curr_options.placeholder) {
215
+ $chips.find('input').prop('placeholder', curr_options.placeholder);
216
+
217
+ } else if (!$chips.data('chips').length && curr_options.secondaryPlaceholder) {
218
+ $chips.find('input').prop('placeholder', curr_options.secondaryPlaceholder);
212
219
  }
213
220
  };
214
221
 
@@ -224,27 +231,42 @@
224
231
  return '' !== elem.tag && !exists;
225
232
  };
226
233
 
227
- this.addChip = function(chipsIndex, elem, $chips) {
234
+ this.addChip = function(elem, $chips) {
228
235
  if (!self.isValid($chips, elem)) {
229
236
  return;
230
237
  }
231
- var options = $chips.data('options');
232
238
  var chipHtml = self.renderChip(elem);
233
- $chips.data('chips').push(elem);
239
+ var newData = [];
240
+ var oldData = $chips.data('chips');
241
+ for (var i = 0; i < oldData.length; i++) {
242
+ newData.push(oldData[i]);
243
+ }
244
+ newData.push(elem);
245
+
246
+ $chips.data('chips', newData);
234
247
  $(chipHtml).insertBefore($chips.find('input'));
235
248
  $chips.trigger('chip.add', elem);
236
249
  self.setPlaceholder($chips);
237
250
  };
238
251
 
239
- this.deleteChip = function(chipsIndex, chipIndex, $chips) {
252
+ this.deleteChip = function(chipIndex, $chips) {
240
253
  var chip = $chips.data('chips')[chipIndex];
241
254
  $chips.find('.chip').eq(chipIndex).remove();
242
- $chips.data('chips').splice(chipIndex, 1);
255
+
256
+ var newData = [];
257
+ var oldData = $chips.data('chips');
258
+ for (var i = 0; i < oldData.length; i++) {
259
+ if (i !== chipIndex) {
260
+ newData.push(oldData[i]);
261
+ }
262
+ }
263
+
264
+ $chips.data('chips', newData);
243
265
  $chips.trigger('chip.delete', chip);
244
266
  self.setPlaceholder($chips);
245
267
  };
246
268
 
247
- this.selectChip = function(chipsIndex, chipIndex, $chips) {
269
+ this.selectChip = function(chipIndex, $chips) {
248
270
  var $chip = $chips.find('.chip').eq(chipIndex);
249
271
  if ($chip && false === $chip.hasClass('selected')) {
250
272
  $chip.addClass('selected');
@@ -264,4 +286,4 @@
264
286
  chipsHandleEvents = true;
265
287
  }
266
288
  };
267
- }( jQuery ));
289
+ }( jQuery ));