fomantic-ui-sass 2.8.7.1 → 2.8.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -0
  3. data/app/assets/javascripts/semantic-ui/calendar.js +9 -11
  4. data/app/assets/javascripts/semantic-ui/dimmer.js +8 -11
  5. data/app/assets/javascripts/semantic-ui/dropdown.js +191 -99
  6. data/app/assets/javascripts/semantic-ui/form.js +98 -60
  7. data/app/assets/javascripts/semantic-ui/modal.js +259 -16
  8. data/app/assets/javascripts/semantic-ui/nag.js +130 -64
  9. data/app/assets/javascripts/semantic-ui/popup.js +4 -4
  10. data/app/assets/javascripts/semantic-ui/progress.js +6 -8
  11. data/app/assets/javascripts/semantic-ui/search.js +14 -12
  12. data/app/assets/javascripts/semantic-ui/slider.js +55 -31
  13. data/app/assets/javascripts/semantic-ui/toast.js +26 -6
  14. data/app/assets/stylesheets/semantic-ui/collections/_breadcrumb.scss +1 -1
  15. data/app/assets/stylesheets/semantic-ui/collections/_form.scss +46 -5
  16. data/app/assets/stylesheets/semantic-ui/collections/_grid.scss +14 -7
  17. data/app/assets/stylesheets/semantic-ui/collections/_menu.scss +6 -4
  18. data/app/assets/stylesheets/semantic-ui/collections/_message.scss +50 -3
  19. data/app/assets/stylesheets/semantic-ui/collections/_table.scss +6 -2
  20. data/app/assets/stylesheets/semantic-ui/elements/_button.scss +29 -2
  21. data/app/assets/stylesheets/semantic-ui/elements/_container.scss +3 -4
  22. data/app/assets/stylesheets/semantic-ui/elements/_divider.scss +1 -1
  23. data/app/assets/stylesheets/semantic-ui/elements/_flag.scss +1 -1
  24. data/app/assets/stylesheets/semantic-ui/elements/_header.scss +10 -5
  25. data/app/assets/stylesheets/semantic-ui/elements/_icon.scss +237 -65
  26. data/app/assets/stylesheets/semantic-ui/elements/_image.scss +1 -1
  27. data/app/assets/stylesheets/semantic-ui/elements/_input.scss +2 -1
  28. data/app/assets/stylesheets/semantic-ui/elements/_label.scss +1 -1
  29. data/app/assets/stylesheets/semantic-ui/elements/_list.scss +1 -1
  30. data/app/assets/stylesheets/semantic-ui/elements/_loader.scss +41 -37
  31. data/app/assets/stylesheets/semantic-ui/elements/_placeholder.scss +1 -1
  32. data/app/assets/stylesheets/semantic-ui/elements/_rail.scss +1 -1
  33. data/app/assets/stylesheets/semantic-ui/elements/_reveal.scss +1 -1
  34. data/app/assets/stylesheets/semantic-ui/elements/_segment.scss +34 -2
  35. data/app/assets/stylesheets/semantic-ui/elements/_step.scss +1 -1
  36. data/app/assets/stylesheets/semantic-ui/elements/_text.scss +1 -1
  37. data/app/assets/stylesheets/semantic-ui/globals/_reset.scss +2 -3
  38. data/app/assets/stylesheets/semantic-ui/globals/_site.scss +2 -2
  39. data/app/assets/stylesheets/semantic-ui/modules/_accordion.scss +1 -1
  40. data/app/assets/stylesheets/semantic-ui/modules/_calendar.scss +3 -3
  41. data/app/assets/stylesheets/semantic-ui/modules/_checkbox.scss +46 -4
  42. data/app/assets/stylesheets/semantic-ui/modules/_dimmer.scss +1 -1
  43. data/app/assets/stylesheets/semantic-ui/modules/_dropdown.scss +72 -3
  44. data/app/assets/stylesheets/semantic-ui/modules/_embed.scss +1 -1
  45. data/app/assets/stylesheets/semantic-ui/modules/_modal.scss +19 -8
  46. data/app/assets/stylesheets/semantic-ui/modules/_nag.scss +168 -16
  47. data/app/assets/stylesheets/semantic-ui/modules/_popup.scss +4 -2
  48. data/app/assets/stylesheets/semantic-ui/modules/_progress.scss +18 -10
  49. data/app/assets/stylesheets/semantic-ui/modules/_rating.scss +18 -33
  50. data/app/assets/stylesheets/semantic-ui/modules/_search.scss +1 -1
  51. data/app/assets/stylesheets/semantic-ui/modules/_shape.scss +1 -1
  52. data/app/assets/stylesheets/semantic-ui/modules/_sidebar.scss +1 -1
  53. data/app/assets/stylesheets/semantic-ui/modules/_slider.scss +3 -1
  54. data/app/assets/stylesheets/semantic-ui/modules/_sticky.scss +1 -2
  55. data/app/assets/stylesheets/semantic-ui/modules/_tab.scss +1 -1
  56. data/app/assets/stylesheets/semantic-ui/modules/_toast.scss +97 -10
  57. data/app/assets/stylesheets/semantic-ui/modules/_transition.scss +1 -1
  58. data/app/assets/stylesheets/semantic-ui/views/_ad.scss +1 -1
  59. data/app/assets/stylesheets/semantic-ui/views/_card.scss +74 -2
  60. data/app/assets/stylesheets/semantic-ui/views/_comment.scss +1 -1
  61. data/app/assets/stylesheets/semantic-ui/views/_feed.scss +1 -1
  62. data/app/assets/stylesheets/semantic-ui/views/_item.scss +1 -1
  63. data/app/assets/stylesheets/semantic-ui/views/_statistic.scss +1 -1
  64. data/lib/fomantic/ui/sass/version.rb +2 -2
  65. metadata +6 -6
@@ -58,14 +58,14 @@ $.fn.nag = function(parameters) {
58
58
 
59
59
  element = this,
60
60
  instance = $module.data(moduleNamespace),
61
-
61
+ storage,
62
62
  module
63
63
  ;
64
64
  module = {
65
65
 
66
66
  initialize: function() {
67
67
  module.verbose('Initializing element');
68
-
68
+ storage = module.get.storage();
69
69
  $module
70
70
  .on('click' + eventNamespace, selector.close, module.dismiss)
71
71
  .data(moduleNamespace, module)
@@ -94,47 +94,47 @@ $.fn.nag = function(parameters) {
94
94
 
95
95
  show: function() {
96
96
  if( module.should.show() && !$module.is(':visible') ) {
97
+ if(settings.onShow.call(element) === false) {
98
+ module.debug('onShow callback returned false, cancelling nag animation');
99
+ return false;
100
+ }
97
101
  module.debug('Showing nag', settings.animation.show);
98
- if(settings.animation.show == 'fade') {
102
+ if(settings.animation.show === 'fade') {
99
103
  $module
100
- .fadeIn(settings.duration, settings.easing)
104
+ .fadeIn(settings.duration, settings.easing, settings.onVisible)
101
105
  ;
102
106
  }
103
107
  else {
104
108
  $module
105
- .slideDown(settings.duration, settings.easing)
109
+ .slideDown(settings.duration, settings.easing, settings.onVisible)
106
110
  ;
107
111
  }
108
112
  }
109
113
  },
110
114
 
111
115
  hide: function() {
112
- module.debug('Showing nag', settings.animation.hide);
113
- if(settings.animation.show == 'fade') {
116
+ if(settings.onHide.call(element) === false) {
117
+ module.debug('onHide callback returned false, cancelling nag animation');
118
+ return false;
119
+ }
120
+ module.debug('Hiding nag', settings.animation.hide);
121
+ if(settings.animation.hide === 'fade') {
114
122
  $module
115
- .fadeIn(settings.duration, settings.easing)
123
+ .fadeOut(settings.duration, settings.easing, settings.onHidden)
116
124
  ;
117
125
  }
118
126
  else {
119
127
  $module
120
- .slideUp(settings.duration, settings.easing)
128
+ .slideUp(settings.duration, settings.easing, settings.onHidden)
121
129
  ;
122
130
  }
123
131
  },
124
132
 
125
- onHide: function() {
126
- module.debug('Removing nag', settings.animation.hide);
127
- $module.remove();
128
- if (settings.onHide) {
129
- settings.onHide();
130
- }
131
- },
132
-
133
133
  dismiss: function(event) {
134
- if(settings.storageMethod) {
134
+ if(module.hide() !== false && settings.storageMethod) {
135
+ module.debug('Dismissing nag', settings.storageMethod, settings.key, settings.value, settings.expires);
135
136
  module.storage.set(settings.key, settings.value);
136
137
  }
137
- module.hide();
138
138
  event.stopImmediatePropagation();
139
139
  event.preventDefault();
140
140
  },
@@ -155,12 +155,71 @@ $.fn.nag = function(parameters) {
155
155
  },
156
156
 
157
157
  get: {
158
+ expirationDate: function(expires) {
159
+ if (typeof expires === 'number') {
160
+ expires = new Date(Date.now() + expires * 864e5);
161
+ }
162
+ if(expires instanceof Date && expires.getTime() ){
163
+ return expires.toUTCString();
164
+ } else {
165
+ module.error(error.expiresFormat);
166
+ }
167
+ },
168
+ storage: function(){
169
+ if(settings.storageMethod === 'localstorage' && window.localStorage !== undefined) {
170
+ module.debug('Using local storage');
171
+ return window.localStorage;
172
+ }
173
+ else if(settings.storageMethod === 'sessionstorage' && window.sessionStorage !== undefined) {
174
+ module.debug('Using session storage');
175
+ return window.sessionStorage;
176
+ }
177
+ else if("cookie" in document) {
178
+ module.debug('Using cookie');
179
+ return {
180
+ setItem: function(key, value, options) {
181
+ // RFC6265 compliant encoding
182
+ key = encodeURIComponent(key)
183
+ .replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent)
184
+ .replace(/[()]/g, escape);
185
+ value = encodeURIComponent(value)
186
+ .replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g, decodeURIComponent);
187
+
188
+ var cookieOptions = '';
189
+ for (var option in options) {
190
+ if (options.hasOwnProperty(option)) {
191
+ cookieOptions += '; ' + option;
192
+ if (typeof options[option] === 'string') {
193
+ cookieOptions += '=' + options[option].split(';')[0];
194
+ }
195
+ }
196
+ }
197
+ document.cookie = key + '=' + value + cookieOptions;
198
+ },
199
+ getItem: function(key) {
200
+ var cookies = document.cookie.split('; ');
201
+ for (var i = 0, il = cookies.length; i < il; i++) {
202
+ var parts = cookies[i].split('='),
203
+ foundKey = parts[0].replace(/(%[\dA-F]{2})+/gi, decodeURIComponent);
204
+ if (key === foundKey) {
205
+ return parts[1] || '';
206
+ }
207
+ }
208
+ },
209
+ removeItem: function(key, options) {
210
+ storage.setItem(key,'',options);
211
+ }
212
+ };
213
+ } else {
214
+ module.error(error.noStorage);
215
+ }
216
+ },
158
217
  storageOptions: function() {
159
218
  var
160
219
  options = {}
161
220
  ;
162
221
  if(settings.expires) {
163
- options.expires = settings.expires;
222
+ options.expires = module.get.expirationDate(settings.expires);
164
223
  }
165
224
  if(settings.domain) {
166
225
  options.domain = settings.domain;
@@ -168,6 +227,12 @@ $.fn.nag = function(parameters) {
168
227
  if(settings.path) {
169
228
  options.path = settings.path;
170
229
  }
230
+ if(settings.secure) {
231
+ options.secure = settings.secure;
232
+ }
233
+ if(settings.samesite) {
234
+ options.samesite = settings.samesite;
235
+ }
171
236
  return options;
172
237
  }
173
238
  },
@@ -181,39 +246,30 @@ $.fn.nag = function(parameters) {
181
246
  var
182
247
  options = module.get.storageOptions()
183
248
  ;
184
- if(settings.storageMethod == 'localstorage' && window.localStorage !== undefined) {
185
- window.localStorage.setItem(key, value);
186
- module.debug('Value stored using local storage', key, value);
249
+ if(storage === window.localStorage && options.expires) {
250
+ module.debug('Storing expiration value in localStorage', key, options.expires);
251
+ storage.setItem(key + settings.expirationKey, options.expires );
187
252
  }
188
- else if(settings.storageMethod == 'sessionstorage' && window.sessionStorage !== undefined) {
189
- window.sessionStorage.setItem(key, value);
190
- module.debug('Value stored using session storage', key, value);
253
+ module.debug('Value stored', key, value);
254
+ try {
255
+ storage.setItem(key, value, options);
191
256
  }
192
- else if($.cookie !== undefined) {
193
- $.cookie(key, value, options);
194
- module.debug('Value stored using cookie', key, value, options);
195
- }
196
- else {
197
- module.error(error.noCookieStorage);
198
- return;
257
+ catch(e) {
258
+ module.error(error.setItem, e);
199
259
  }
200
260
  },
201
- get: function(key, value) {
261
+ get: function(key) {
202
262
  var
203
263
  storedValue
204
264
  ;
205
- if(settings.storageMethod == 'localstorage' && window.localStorage !== undefined) {
206
- storedValue = window.localStorage.getItem(key);
207
- }
208
- else if(settings.storageMethod == 'sessionstorage' && window.sessionStorage !== undefined) {
209
- storedValue = window.sessionStorage.getItem(key);
210
- }
211
- // get by cookie
212
- else if($.cookie !== undefined) {
213
- storedValue = $.cookie(key);
214
- }
215
- else {
216
- module.error(error.noCookieStorage);
265
+ storedValue = storage.getItem(key);
266
+ if(storage === window.localStorage) {
267
+ var expiration = storage.getItem(key + settings.expirationKey);
268
+ if(expiration !== null && expiration !== undefined && new Date(expiration) < new Date()) {
269
+ module.debug('Value in localStorage has expired. Deleting key', key);
270
+ module.storage.remove(key);
271
+ storedValue = null;
272
+ }
217
273
  }
218
274
  if(storedValue == 'undefined' || storedValue == 'null' || storedValue === undefined || storedValue === null) {
219
275
  storedValue = undefined;
@@ -224,19 +280,11 @@ $.fn.nag = function(parameters) {
224
280
  var
225
281
  options = module.get.storageOptions()
226
282
  ;
227
- if(settings.storageMethod == 'localstorage' && window.localStorage !== undefined) {
228
- window.localStorage.removeItem(key);
229
- }
230
- else if(settings.storageMethod == 'sessionstorage' && window.sessionStorage !== undefined) {
231
- window.sessionStorage.removeItem(key);
232
- }
233
- // store by cookie
234
- else if($.cookie !== undefined) {
235
- $.removeCookie(key, options);
236
- }
237
- else {
238
- module.error(error.noStorage);
283
+ options.expires = module.get.expirationDate(-1);
284
+ if(storage === window.localStorage) {
285
+ storage.removeItem(key + settings.expirationKey);
239
286
  }
287
+ storage.removeItem(key, options);
240
288
  }
241
289
  },
242
290
 
@@ -450,8 +498,12 @@ $.fn.nag.settings = {
450
498
  detachable : false,
451
499
 
452
500
  expires : 30,
501
+
502
+ // cookie storage only options
453
503
  domain : false,
454
504
  path : '/',
505
+ secure : false,
506
+ samesite : false,
455
507
 
456
508
  // type of storage to use
457
509
  storageMethod : 'cookie',
@@ -460,10 +512,14 @@ $.fn.nag.settings = {
460
512
  key : 'nag',
461
513
  value : 'dismiss',
462
514
 
515
+ // Key suffix to support expiration in localstorage
516
+ expirationKey : 'ExpirationDate',
517
+
463
518
  error: {
464
- noCookieStorage : '$.cookie is not included. A storage solution is required.',
465
- noStorage : 'Neither $.cookie or store is defined. A storage solution is required for storing state',
466
- method : 'The method you called is not defined.'
519
+ noStorage : 'Unsupported storage method',
520
+ method : 'The method you called is not defined.',
521
+ setItem : 'Unexpected error while setting value',
522
+ expiresFormat : '"expires" must be a number of days or a Date Object'
467
523
  },
468
524
 
469
525
  className : {
@@ -472,13 +528,23 @@ $.fn.nag.settings = {
472
528
  },
473
529
 
474
530
  selector : {
475
- close : '.close.icon'
531
+ close : '> .close.icon'
476
532
  },
477
533
 
478
- speed : 500,
534
+ duration : 500,
479
535
  easing : 'easeOutQuad',
480
536
 
481
- onHide: function() {}
537
+ // callback before show animation, return false to prevent show
538
+ onShow : function() {},
539
+
540
+ // called after show animation
541
+ onVisible : function() {},
542
+
543
+ // callback before hide animation, return false to prevent hide
544
+ onHide : function() {},
545
+
546
+ // callback after hide animation
547
+ onHidden : function() {}
482
548
 
483
549
  };
484
550
 
@@ -434,11 +434,11 @@ $.fn.popup = function(parameters) {
434
434
  module.set.visible();
435
435
  $popup
436
436
  .transition({
437
- animation : settings.transition + ' in',
437
+ animation : (settings.transition.showMethod || settings.transition) + ' in',
438
438
  queue : false,
439
439
  debug : settings.debug,
440
440
  verbose : settings.verbose,
441
- duration : settings.duration,
441
+ duration : settings.transition.showDuration || settings.duration,
442
442
  onComplete : function() {
443
443
  module.bind.close();
444
444
  callback.call($popup, element);
@@ -457,9 +457,9 @@ $.fn.popup = function(parameters) {
457
457
  if(settings.transition && $.fn.transition !== undefined && $module.transition('is supported')) {
458
458
  $popup
459
459
  .transition({
460
- animation : settings.transition + ' out',
460
+ animation : (settings.transition.hideMethod || settings.transition) + ' out',
461
461
  queue : false,
462
- duration : settings.duration,
462
+ duration : settings.transition.hideDuration || settings.duration,
463
463
  debug : settings.debug,
464
464
  verbose : settings.verbose,
465
465
  onComplete : function() {
@@ -500,10 +500,14 @@ $.fn.progress = function(parameters) {
500
500
  },
501
501
  percent: function(percents) {
502
502
  percents = module.helper.forceArray(percents).map(function(percent) {
503
- return (typeof percent == 'string')
503
+ percent = (typeof percent == 'string')
504
504
  ? +(percent.replace('%', ''))
505
505
  : percent
506
506
  ;
507
+ return (settings.limitValues)
508
+ ? Math.max(0, Math.min(100, percent))
509
+ : percent
510
+ ;
507
511
  });
508
512
  var hasTotal = module.has.total();
509
513
  var totalPercent = module.helper.sum(percents);
@@ -533,21 +537,15 @@ $.fn.progress = function(parameters) {
533
537
  });
534
538
  module.percent = roundedPercents;
535
539
  if (hasTotal) {
536
- module.value = roundedPercents.map(function (percent) {
540
+ module.value = percents.map(function (percent) {
537
541
  return (autoPrecision > 0)
538
542
  ? Math.round((percent / 100) * module.total * (10 * autoPrecision)) / (10 * autoPrecision)
539
543
  : Math.round((percent / 100) * module.total * 10) / 10
540
544
  ;
541
545
  });
542
- if (settings.limitValues) {
543
- module.value = module.value.map(function (value) {
544
- return Math.max(0, Math.min(100, value));
545
- });
546
- }
547
546
  }
548
547
  module.set.barWidth(percents);
549
548
  module.set.labelInterval();
550
- module.set.labels();
551
549
  }
552
550
  settings.onChange.call(element, percents, module.value, module.total);
553
551
  },
@@ -118,7 +118,7 @@ $.fn.search = function(parameters) {
118
118
  .on(module.get.inputEvent() + eventNamespace, selector.prompt, module.event.input)
119
119
  ;
120
120
  $prompt
121
- .attr('autocomplete', 'off')
121
+ .attr('autocomplete', module.is.chrome() ? 'fomantic-search' : 'off')
122
122
  ;
123
123
  }
124
124
  $module
@@ -227,9 +227,7 @@ $.fn.search = function(parameters) {
227
227
  results = module.get.results(),
228
228
  result = $result.data(metadata.result) || module.get.result(value, results)
229
229
  ;
230
- if(value) {
231
- module.set.value(value);
232
- }
230
+ var oldValue = module.get.value();
233
231
  if( $.isFunction(settings.onSelect) ) {
234
232
  if(settings.onSelect.call(element, result, results) === false) {
235
233
  module.debug('Custom onSelect callback cancelled default select action');
@@ -238,6 +236,9 @@ $.fn.search = function(parameters) {
238
236
  }
239
237
  }
240
238
  module.hideResults();
239
+ if(value && module.get.value() === oldValue) {
240
+ module.set.value(value);
241
+ }
241
242
  if(href) {
242
243
  event.preventDefault();
243
244
  module.verbose('Opening search link found in result', $link);
@@ -251,16 +252,16 @@ $.fn.search = function(parameters) {
251
252
  }
252
253
  }
253
254
  },
254
- ensureVisible: function ensureVisible($el) {
255
+ ensureVisible: function($el) {
255
256
  var elTop, elBottom, resultsScrollTop, resultsHeight;
256
-
257
+ if($el.length === 0) {
258
+ return;
259
+ }
257
260
  elTop = $el.position().top;
258
261
  elBottom = elTop + $el.outerHeight(true);
259
262
 
260
263
  resultsScrollTop = $results.scrollTop();
261
- resultsHeight = $results.height()
262
- parseInt($results.css('paddingTop'), 0) +
263
- parseInt($results.css('paddingBottom'), 0);
264
+ resultsHeight = $results.height();
264
265
 
265
266
  if (elTop < 0) {
266
267
  $results.scrollTop(resultsScrollTop + elTop);
@@ -401,6 +402,9 @@ $.fn.search = function(parameters) {
401
402
  animating: function() {
402
403
  return $results.hasClass(className.animating);
403
404
  },
405
+ chrome: function() {
406
+ return !!window.chrome && (!!window.chrome.webstore || !!window.chrome.runtime);
407
+ },
404
408
  hidden: function() {
405
409
  return $results.hasClass(className.hidden);
406
410
  },
@@ -976,9 +980,7 @@ $.fn.search = function(parameters) {
976
980
  duration : settings.duration,
977
981
  onShow : function() {
978
982
  var $firstResult = $module.find(selector.result).eq(0);
979
- if($firstResult.length > 0) {
980
- module.ensureVisible($firstResult);
981
- }
983
+ module.ensureVisible($firstResult);
982
984
  },
983
985
  onComplete : function() {
984
986
  callback();
@@ -88,6 +88,7 @@ $.fn.slider = function(parameters) {
88
88
  precision,
89
89
  isTouch,
90
90
  gapRatio = 1,
91
+ previousValue,
91
92
 
92
93
  initialPosition,
93
94
  initialLoad,
@@ -205,28 +206,26 @@ $.fn.slider = function(parameters) {
205
206
  });
206
207
  },
207
208
  autoLabel: function() {
208
- if(module.get.step() != 0) {
209
- $labels = $module.find('.labels');
210
- if($labels.length != 0) {
211
- $labels.empty();
212
- }
213
- else {
214
- $labels = $module.append('<ul class="auto labels"></ul>').find('.labels');
215
- }
216
- for(var i = 0, len = module.get.numLabels(); i <= len; i++) {
217
- var
218
- labelText = module.get.label(i),
219
- $label = (labelText !== "")
220
- ? !(i % module.get.gapRatio())
221
- ? $('<li class="label">' + labelText + '</li>')
222
- : $('<li class="halftick label"></li>')
223
- : null,
224
- ratio = i / len
225
- ;
226
- if($label) {
227
- module.update.labelPosition(ratio, $label);
228
- $labels.append($label);
229
- }
209
+ $labels = $module.find('.labels');
210
+ if($labels.length != 0) {
211
+ $labels.empty();
212
+ }
213
+ else {
214
+ $labels = $module.append('<ul class="auto labels"></ul>').find('.labels');
215
+ }
216
+ for(var i = 0, len = module.get.numLabels(); i <= len; i++) {
217
+ var
218
+ labelText = module.get.label(i),
219
+ $label = (labelText !== "")
220
+ ? !(i % module.get.gapRatio())
221
+ ? $('<li class="label">' + labelText + '</li>')
222
+ : $('<li class="halftick label"></li>')
223
+ : null,
224
+ ratio = i / len
225
+ ;
226
+ if($label) {
227
+ module.update.labelPosition(ratio, $label);
228
+ $labels.append($label);
230
229
  }
231
230
  }
232
231
  }
@@ -331,7 +330,13 @@ $.fn.slider = function(parameters) {
331
330
  } else {
332
331
  $currThumb = module.determine.closestThumb(newPos);
333
332
  }
333
+ if (previousValue === undefined) {
334
+ previousValue = module.get.currentThumbValue();
335
+ }
336
+ } else if (previousValue === undefined) {
337
+ previousValue = module.get.value();
334
338
  }
339
+
335
340
  if(!module.is.disabled()) {
336
341
  module.bind.slidingEvents();
337
342
  }
@@ -379,6 +384,9 @@ $.fn.slider = function(parameters) {
379
384
  var value = module.determine.valueFromEvent(event);
380
385
  module.set.value(value);
381
386
  module.unbind.slidingEvents();
387
+ if (previousValue !== undefined) {
388
+ previousValue = undefined;
389
+ }
382
390
  },
383
391
  keydown: function(event, first) {
384
392
  if(settings.preventCrossover && module.is.range() && module.thumbVal === module.secondThumbVal) {
@@ -577,7 +585,7 @@ $.fn.slider = function(parameters) {
577
585
  return settings.step;
578
586
  },
579
587
  numLabels: function() {
580
- var value = Math.round((module.get.max() - module.get.min()) / module.get.step());
588
+ var value = Math.round((module.get.max() - module.get.min()) / (module.get.step() === 0 ? 1 : module.get.step()));
581
589
  module.debug('Determined that there should be ' + value + ' labels');
582
590
  return value;
583
591
  },
@@ -591,7 +599,7 @@ $.fn.slider = function(parameters) {
591
599
 
592
600
  switch (settings.labelType) {
593
601
  case settings.labelTypes.number:
594
- return Math.round(((value * module.get.step()) + module.get.min()) * precision ) / precision;
602
+ return Math.round(((value * (module.get.step() === 0 ? 1 : module.get.step())) + module.get.min()) * precision ) / precision;
595
603
  case settings.labelTypes.letter:
596
604
  return alphabet[(value) % 26];
597
605
  default:
@@ -853,20 +861,31 @@ $.fn.slider = function(parameters) {
853
861
  },
854
862
 
855
863
  set: {
856
- value: function(newValue) {
864
+ value: function(newValue, fireChange) {
865
+ fireChange = fireChange !== false;
866
+ var toReset = previousValue === undefined;
867
+ previousValue = previousValue === undefined ? module.get.value() : previousValue;
857
868
  module.update.value(newValue, function(value, thumbVal, secondThumbVal) {
858
- if (!initialLoad || settings.fireOnInit){
859
- settings.onChange.call(element, value, thumbVal, secondThumbVal);
869
+ if ((!initialLoad || settings.fireOnInit) && fireChange){
870
+ if (newValue !== previousValue) {
871
+ settings.onChange.call(element, value, thumbVal, secondThumbVal);
872
+ }
860
873
  settings.onMove.call(element, value, thumbVal, secondThumbVal);
861
874
  }
875
+ if (toReset) {
876
+ previousValue = undefined;
877
+ }
862
878
  });
863
879
  },
864
- rangeValue: function(first, second) {
880
+ rangeValue: function(first, second, fireChange) {
881
+ fireChange = fireChange !== false;
865
882
  if(module.is.range()) {
866
883
  var
867
884
  min = module.get.min(),
868
- max = module.get.max()
885
+ max = module.get.max(),
886
+ toReset = previousValue === undefined
869
887
  ;
888
+ previousValue = previousValue === undefined ? module.get.value() : previousValue;
870
889
  if (first <= min) {
871
890
  first = min;
872
891
  } else if(first >= max){
@@ -882,10 +901,15 @@ $.fn.slider = function(parameters) {
882
901
  value = Math.abs(module.thumbVal - module.secondThumbVal);
883
902
  module.update.position(module.thumbVal, $thumb);
884
903
  module.update.position(module.secondThumbVal, $secondThumb);
885
- if (!initialLoad || settings.fireOnInit) {
886
- settings.onChange.call(element, value, module.thumbVal, module.secondThumbVal);
904
+ if ((!initialLoad || settings.fireOnInit) && fireChange) {
905
+ if (value !== previousValue) {
906
+ settings.onChange.call(element, value, module.thumbVal, module.secondThumbVal);
907
+ }
887
908
  settings.onMove.call(element, value, module.thumbVal, module.secondThumbVal);
888
909
  }
910
+ if (toReset) {
911
+ previousValue = undefined;
912
+ }
889
913
  } else {
890
914
  module.error(error.notrange);
891
915
  }