fomantic-ui-sass 2.9.0 → 2.9.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/fonts/semantic-ui/Lato-Bold.woff +0 -0
  3. data/app/assets/fonts/semantic-ui/Lato-Bold.woff2 +0 -0
  4. data/app/assets/fonts/semantic-ui/Lato-BoldItalic.woff +0 -0
  5. data/app/assets/fonts/semantic-ui/Lato-BoldItalic.woff2 +0 -0
  6. data/app/assets/fonts/semantic-ui/Lato-Italic.woff +0 -0
  7. data/app/assets/fonts/semantic-ui/Lato-Italic.woff2 +0 -0
  8. data/app/assets/fonts/semantic-ui/Lato-Regular.woff +0 -0
  9. data/app/assets/fonts/semantic-ui/Lato-Regular.woff2 +0 -0
  10. data/app/assets/fonts/semantic-ui/LatoLatin-Bold.woff +0 -0
  11. data/app/assets/fonts/semantic-ui/LatoLatin-Bold.woff2 +0 -0
  12. data/app/assets/fonts/semantic-ui/LatoLatin-BoldItalic.woff +0 -0
  13. data/app/assets/fonts/semantic-ui/LatoLatin-BoldItalic.woff2 +0 -0
  14. data/app/assets/fonts/semantic-ui/LatoLatin-Italic.woff +0 -0
  15. data/app/assets/fonts/semantic-ui/LatoLatin-Italic.woff2 +0 -0
  16. data/app/assets/fonts/semantic-ui/LatoLatin-Regular.woff +0 -0
  17. data/app/assets/fonts/semantic-ui/LatoLatin-Regular.woff2 +0 -0
  18. data/app/assets/fonts/semantic-ui/brand-icons.woff +0 -0
  19. data/app/assets/fonts/semantic-ui/brand-icons.woff2 +0 -0
  20. data/app/assets/fonts/semantic-ui/icons.woff +0 -0
  21. data/app/assets/fonts/semantic-ui/icons.woff2 +0 -0
  22. data/app/assets/fonts/semantic-ui/outline-icons.woff +0 -0
  23. data/app/assets/fonts/semantic-ui/outline-icons.woff2 +0 -0
  24. data/app/assets/javascripts/semantic-ui/accordion.js +569 -596
  25. data/app/assets/javascripts/semantic-ui/api.js +1158 -1180
  26. data/app/assets/javascripts/semantic-ui/calendar.js +1935 -1810
  27. data/app/assets/javascripts/semantic-ui/checkbox.js +843 -842
  28. data/app/assets/javascripts/semantic-ui/dimmer.js +707 -738
  29. data/app/assets/javascripts/semantic-ui/dropdown.js +4196 -4237
  30. data/app/assets/javascripts/semantic-ui/embed.js +646 -676
  31. data/app/assets/javascripts/semantic-ui/flyout.js +1515 -1466
  32. data/app/assets/javascripts/semantic-ui/form.js +2023 -2005
  33. data/app/assets/javascripts/semantic-ui/modal.js +1545 -1487
  34. data/app/assets/javascripts/semantic-ui/nag.js +521 -527
  35. data/app/assets/javascripts/semantic-ui/popup.js +1457 -1457
  36. data/app/assets/javascripts/semantic-ui/progress.js +970 -998
  37. data/app/assets/javascripts/semantic-ui/rating.js +508 -524
  38. data/app/assets/javascripts/semantic-ui/search.js +1521 -1535
  39. data/app/assets/javascripts/semantic-ui/shape.js +784 -811
  40. data/app/assets/javascripts/semantic-ui/sidebar.js +1062 -1100
  41. data/app/assets/javascripts/semantic-ui/site.js +437 -477
  42. data/app/assets/javascripts/semantic-ui/slider.js +1311 -1312
  43. data/app/assets/javascripts/semantic-ui/state.js +639 -658
  44. data/app/assets/javascripts/semantic-ui/sticky.js +848 -902
  45. data/app/assets/javascripts/semantic-ui/tab.js +903 -967
  46. data/app/assets/javascripts/semantic-ui/toast.js +911 -885
  47. data/app/assets/javascripts/semantic-ui/transition.js +1049 -1078
  48. data/app/assets/javascripts/semantic-ui/visibility.js +1214 -1246
  49. data/app/assets/stylesheets/semantic-ui/collections/_breadcrumb.scss +7 -7
  50. data/app/assets/stylesheets/semantic-ui/collections/_form.scss +246 -341
  51. data/app/assets/stylesheets/semantic-ui/collections/_grid.scss +185 -331
  52. data/app/assets/stylesheets/semantic-ui/collections/_menu.scss +272 -433
  53. data/app/assets/stylesheets/semantic-ui/collections/_message.scss +127 -199
  54. data/app/assets/stylesheets/semantic-ui/collections/_table.scss +549 -776
  55. data/app/assets/stylesheets/semantic-ui/elements/_button.scss +711 -1123
  56. data/app/assets/stylesheets/semantic-ui/elements/_container.scss +9 -8
  57. data/app/assets/stylesheets/semantic-ui/elements/_divider.scss +45 -63
  58. data/app/assets/stylesheets/semantic-ui/elements/_emoji.scss +3556 -3556
  59. data/app/assets/stylesheets/semantic-ui/elements/_flag.scss +272 -270
  60. data/app/assets/stylesheets/semantic-ui/elements/_header.scss +120 -144
  61. data/app/assets/stylesheets/semantic-ui/elements/_icon.scss +667 -747
  62. data/app/assets/stylesheets/semantic-ui/elements/_image.scss +41 -65
  63. data/app/assets/stylesheets/semantic-ui/elements/_input.scss +358 -276
  64. data/app/assets/stylesheets/semantic-ui/elements/_label.scss +361 -412
  65. data/app/assets/stylesheets/semantic-ui/elements/_list.scss +51 -72
  66. data/app/assets/stylesheets/semantic-ui/elements/_loader.scss +69 -157
  67. data/app/assets/stylesheets/semantic-ui/elements/_placeholder.scss +24 -44
  68. data/app/assets/stylesheets/semantic-ui/elements/_rail.scss +17 -22
  69. data/app/assets/stylesheets/semantic-ui/elements/_reveal.scss +46 -85
  70. data/app/assets/stylesheets/semantic-ui/elements/_segment.scss +150 -226
  71. data/app/assets/stylesheets/semantic-ui/elements/_step.scss +79 -152
  72. data/app/assets/stylesheets/semantic-ui/elements/_text.scss +33 -33
  73. data/app/assets/stylesheets/semantic-ui/globals/_reset.scss +10 -15
  74. data/app/assets/stylesheets/semantic-ui/globals/_site.scss +30 -43
  75. data/app/assets/stylesheets/semantic-ui/modules/_accordion.scss +37 -55
  76. data/app/assets/stylesheets/semantic-ui/modules/_calendar.scss +26 -29
  77. data/app/assets/stylesheets/semantic-ui/modules/_checkbox.scss +122 -193
  78. data/app/assets/stylesheets/semantic-ui/modules/_dimmer.scss +55 -174
  79. data/app/assets/stylesheets/semantic-ui/modules/_dropdown.scss +254 -388
  80. data/app/assets/stylesheets/semantic-ui/modules/_embed.scss +20 -31
  81. data/app/assets/stylesheets/semantic-ui/modules/_flyout.scss +97 -143
  82. data/app/assets/stylesheets/semantic-ui/modules/_modal.scss +122 -156
  83. data/app/assets/stylesheets/semantic-ui/modules/_nag.scss +55 -65
  84. data/app/assets/stylesheets/semantic-ui/modules/_popup.scss +426 -204
  85. data/app/assets/stylesheets/semantic-ui/modules/_progress.scss +108 -213
  86. data/app/assets/stylesheets/semantic-ui/modules/_rating.scss +83 -124
  87. data/app/assets/stylesheets/semantic-ui/modules/_search.scss +71 -100
  88. data/app/assets/stylesheets/semantic-ui/modules/_shape.scss +16 -32
  89. data/app/assets/stylesheets/semantic-ui/modules/_sidebar.scss +105 -208
  90. data/app/assets/stylesheets/semantic-ui/modules/_slider.scss +93 -121
  91. data/app/assets/stylesheets/semantic-ui/modules/_sticky.scss +3 -7
  92. data/app/assets/stylesheets/semantic-ui/modules/_tab.scss +12 -16
  93. data/app/assets/stylesheets/semantic-ui/modules/_toast.scss +71 -149
  94. data/app/assets/stylesheets/semantic-ui/modules/_transition.scss +371 -1282
  95. data/app/assets/stylesheets/semantic-ui/views/_ad.scss +36 -47
  96. data/app/assets/stylesheets/semantic-ui/views/_card.scss +221 -367
  97. data/app/assets/stylesheets/semantic-ui/views/_comment.scss +43 -61
  98. data/app/assets/stylesheets/semantic-ui/views/_feed.scss +37 -59
  99. data/app/assets/stylesheets/semantic-ui/views/_item.scss +86 -133
  100. data/app/assets/stylesheets/semantic-ui/views/_statistic.scss +77 -118
  101. data/lib/fomantic/ui/sass/version.rb +2 -2
  102. data/tasks/converter.rb +1 -1
  103. metadata +17 -1
@@ -1,1353 +1,1352 @@
1
1
  /*!
2
2
  * # Fomantic-UI - Slider
3
- * http://github.com/fomantic/Fomantic-UI/
3
+ * https://github.com/fomantic/Fomantic-UI/
4
4
  *
5
5
  *
6
6
  * Released under the MIT license
7
- * http://opensource.org/licenses/MIT
7
+ * https://opensource.org/licenses/MIT
8
8
  *
9
9
  */
10
10
 
11
- ;(function ( $, window, document, undefined ) {
11
+ (function ($, window, document) {
12
+ 'use strict';
12
13
 
13
- "use strict";
14
+ function isFunction(obj) {
15
+ return typeof obj === 'function' && typeof obj.nodeType !== 'number';
16
+ }
14
17
 
15
- window = (typeof window != 'undefined' && window.Math == Math)
16
- ? window
17
- : (typeof self != 'undefined' && self.Math == Math)
18
- ? self
19
- : Function('return this')()
20
- ;
18
+ window = window !== undefined && window.Math === Math
19
+ ? window
20
+ : globalThis;
21
21
 
22
- $.fn.slider = function(parameters) {
22
+ $.fn.slider = function (parameters) {
23
+ var
24
+ $allModules = $(this),
25
+ $document = $(document),
26
+ $window = $(window),
23
27
 
24
- var
25
- $allModules = $(this),
26
- $window = $(window),
28
+ moduleSelector = $allModules.selector || '',
27
29
 
28
- moduleSelector = $allModules.selector || '',
30
+ time = Date.now(),
31
+ performance = [],
29
32
 
30
- time = new Date().getTime(),
31
- performance = [],
33
+ query = arguments[0],
34
+ methodInvoked = typeof query === 'string',
35
+ queryArguments = [].slice.call(arguments, 1),
32
36
 
33
- query = arguments[0],
34
- methodInvoked = (typeof query == 'string'),
35
- queryArguments = [].slice.call(arguments, 1),
37
+ alphabet = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'],
36
38
 
37
- alphabet = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'],
39
+ SINGLE_STEP = 1,
40
+ BIG_STEP = 2,
41
+ NO_STEP = 0,
42
+ SINGLE_BACKSTEP = -1,
43
+ BIG_BACKSTEP = -2,
38
44
 
39
- SINGLE_STEP = 1,
40
- BIG_STEP = 2,
41
- NO_STEP = 0,
42
- SINGLE_BACKSTEP = -1,
43
- BIG_BACKSTEP = -2,
45
+ // Used to manage document bound events.
46
+ // Use this so that we can distinguish between which document events are bound to which range.
47
+ currentRange = 0,
44
48
 
45
- // Used to manage document bound events.
46
- // Use this so that we can distinguish between which document events are bound to which range.
47
- currentRange = 0,
49
+ returnedValue
50
+ ;
48
51
 
49
- returnedValue
50
- ;
51
-
52
- $allModules
53
- .each(function() {
54
-
55
- var
56
- settings = ( $.isPlainObject(parameters) )
57
- ? $.extend(true, {}, $.fn.slider.settings, parameters)
58
- : $.extend({}, $.fn.slider.settings),
59
-
60
- className = settings.className,
61
- metadata = settings.metadata,
62
- namespace = settings.namespace,
63
- error = settings.error,
64
- keys = settings.keys,
65
- interpretLabel = settings.interpretLabel,
66
-
67
- isHover = false,
68
- eventNamespace = '.' + namespace,
69
- moduleNamespace = 'module-' + namespace,
70
-
71
- $module = $(this),
72
- $currThumb,
73
- touchIdentifier,
74
- $thumb,
75
- $secondThumb,
76
- $track,
77
- $trackFill,
78
- $labels,
79
-
80
- element = this,
81
- instance = $module.data(moduleNamespace),
82
-
83
- documentEventID,
84
-
85
- value,
86
- position,
87
- secondPos,
88
- offset,
89
- precision,
90
- gapRatio = 1,
91
- previousValue,
92
-
93
- initialPosition,
94
- initialLoad,
95
- module
96
- ;
97
-
98
- module = {
99
-
100
- initialize: function() {
101
- module.debug('Initializing slider', settings);
102
- initialLoad = true;
103
-
104
- currentRange += 1;
105
- documentEventID = currentRange;
106
-
107
- module.setup.layout();
108
- module.setup.labels();
109
-
110
- if(!module.is.disabled()) {
111
- module.bind.events();
112
- }
113
-
114
- module.read.metadata();
115
- module.read.settings();
116
-
117
- initialLoad = false;
118
- module.instantiate();
119
- },
120
-
121
- instantiate: function() {
122
- module.verbose('Storing instance of slider', module);
123
- instance = module;
124
- $module
125
- .data(moduleNamespace, module)
126
- ;
127
- },
128
-
129
- destroy: function() {
130
- module.verbose('Destroying previous slider for', $module);
131
- clearInterval(instance.interval);
132
- module.unbind.events();
133
- module.unbind.slidingEvents();
134
- $module.removeData(moduleNamespace);
135
- instance = undefined;
136
- },
137
-
138
- setup: {
139
- layout: function() {
140
- if( $module.attr('tabindex') === undefined) {
141
- $module.attr('tabindex', 0);
142
- }
143
- if($module.find('.inner').length == 0) {
144
- $module.append("<div class='inner'>"
145
- + "<div class='track'></div>"
146
- + "<div class='track-fill'></div>"
147
- + "<div class='thumb'></div>"
148
- + "</div>");
149
- }
150
- precision = module.get.precision();
151
- $thumb = $module.find('.thumb:not(.second)');
152
- $currThumb = $thumb;
153
- if(module.is.range()) {
154
- if($module.find('.thumb.second').length == 0) {
155
- $module.find('.inner').append("<div class='thumb second'></div>");
156
- }
157
- $secondThumb = $module.find('.thumb.second');
158
- }
159
- $track = $module.find('.track');
160
- $trackFill = $module.find('.track-fill');
161
- offset = $thumb.width() / 2;
162
- },
163
- labels: function() {
164
- if(module.is.labeled()) {
165
- $labels = $module.find('.labels:not(.auto)');
166
- if($labels.length != 0) {
167
- module.setup.customLabel();
168
- } else {
169
- module.setup.autoLabel();
170
- }
171
-
172
- if (settings.showLabelTicks) {
173
- $module.addClass(className.ticked)
174
- }
175
- }
176
- },
177
- customLabel: function() {
52
+ $allModules.each(function () {
178
53
  var
179
- $children = $labels.find('.label'),
180
- numChildren = $children.length,
181
- min = module.get.min(),
182
- max = module.get.max(),
183
- ratio
54
+ settings = $.isPlainObject(parameters)
55
+ ? $.extend(true, {}, $.fn.slider.settings, parameters)
56
+ : $.extend({}, $.fn.slider.settings),
57
+
58
+ className = settings.className,
59
+ metadata = settings.metadata,
60
+ namespace = settings.namespace,
61
+ error = settings.error,
62
+ keys = settings.keys,
63
+ interpretLabel = settings.interpretLabel,
64
+
65
+ isHover = false,
66
+ eventNamespace = '.' + namespace,
67
+ moduleNamespace = 'module-' + namespace,
68
+
69
+ $module = $(this),
70
+ $currThumb,
71
+ touchIdentifier,
72
+ $thumb,
73
+ $secondThumb,
74
+ $track,
75
+ $trackFill,
76
+ $labels,
77
+
78
+ element = this,
79
+ instance = $module.data(moduleNamespace),
80
+
81
+ documentEventID,
82
+
83
+ value,
84
+ position,
85
+ secondPos,
86
+ offset,
87
+ precision,
88
+ gapRatio = 1,
89
+ previousValue,
90
+
91
+ initialPosition,
92
+ initialLoad,
93
+ module
184
94
  ;
185
- $children.each(function(index) {
186
- var
187
- $child = $(this),
188
- attrValue = $child.attr('data-value')
189
- ;
190
- if(attrValue) {
191
- attrValue = attrValue > max ? max : attrValue < min ? min : attrValue;
192
- ratio = (attrValue - min) / (max - min);
193
- } else {
194
- ratio = (index + 1) / (numChildren + 1);
195
- }
196
- module.update.labelPosition(ratio, $(this));
197
- });
198
- },
199
- autoLabel: function() {
200
- $labels = $module.find('.labels');
201
- if($labels.length != 0) {
202
- $labels.empty();
203
- }
204
- else {
205
- $labels = $module.append('<ul class="auto labels"></ul>').find('.labels');
206
- }
207
- for(var i = 0, len = module.get.numLabels(); i <= len; i++) {
208
- var
209
- labelText = module.get.label(i),
210
- $label = (labelText !== "")
211
- ? !(i % module.get.gapRatio())
212
- ? $('<li class="label">' + labelText + '</li>')
213
- : $('<li class="halftick label"></li>')
214
- : null,
215
- ratio = i / len
216
- ;
217
- if($label) {
218
- module.update.labelPosition(ratio, $label);
219
- $labels.append($label);
220
- }
221
- }
222
- }
223
- },
224
95
 
225
- bind: {
226
- events: function() {
227
- module.bind.globalKeyboardEvents();
228
- module.bind.keyboardEvents();
229
- module.bind.mouseEvents();
230
- if (settings.autoAdjustLabels) {
231
- module.bind.windowEvents();
232
- }
233
- },
234
- keyboardEvents: function() {
235
- module.verbose('Binding keyboard events');
236
- $module.on('keydown' + eventNamespace, module.event.keydown);
237
- },
238
- globalKeyboardEvents: function() {
239
- $(document).on('keydown' + eventNamespace + documentEventID, module.event.activateFocus);
240
- },
241
- mouseEvents: function() {
242
- module.verbose('Binding mouse and touch events');
243
- $module.find('.track, .thumb, .inner').on('mousedown' + eventNamespace, function(event) {
244
- event.stopImmediatePropagation();
245
- event.preventDefault();
246
- module.event.down(event);
247
- });
248
- $module.on('mousedown' + eventNamespace, module.event.down);
249
- $module.on('mouseenter' + eventNamespace, function(event) {
250
- isHover = true;
251
- });
252
- $module.on('mouseleave' + eventNamespace, function(event) {
253
- isHover = false;
254
- });
255
- // All touch events are invoked on the element where the touch *started*. Thus, we can bind them all
256
- // on the thumb(s) and don't need to worry about interference with other components, i.e. no dynamic binding
257
- // and unbinding required.
258
- $module.find('.thumb')
259
- .on('touchstart' + eventNamespace, module.event.touchDown)
260
- .on('touchmove' + eventNamespace, module.event.move)
261
- .on('touchend' + eventNamespace, module.event.up)
262
- .on('touchcancel' + eventNamespace, module.event.touchCancel);
263
- },
264
- slidingEvents: function() {
265
- // these don't need the identifier because we only ever want one of them to be registered with document
266
- module.verbose('Binding page wide events while handle is being draged');
267
- $(document).on('mousemove' + eventNamespace, module.event.move);
268
- $(document).on('mouseup' + eventNamespace, module.event.up);
269
- },
270
- windowEvents: function() {
271
- $window.on('resize' + eventNamespace, module.event.resize);
272
- }
273
- },
274
-
275
- unbind: {
276
- events: function() {
277
- $module.find('.track, .thumb, .inner').off('mousedown' + eventNamespace);
278
- $module.off('mousedown' + eventNamespace);
279
- $module.off('mouseenter' + eventNamespace);
280
- $module.off('mouseleave' + eventNamespace);
281
- $module.find('.thumb')
282
- .off('touchstart' + eventNamespace)
283
- .off('touchmove' + eventNamespace)
284
- .off('touchend' + eventNamespace)
285
- .off('touchcancel' + eventNamespace);
286
- $module.off('keydown' + eventNamespace);
287
- $module.off('focusout' + eventNamespace);
288
- $(document).off('keydown' + eventNamespace + documentEventID, module.event.activateFocus);
289
- $window.off('resize' + eventNamespace);
290
- },
291
- slidingEvents: function() {
292
- $(document).off('mousemove' + eventNamespace);
293
- $(document).off('mouseup' + eventNamespace);
294
- },
295
- },
296
-
297
- event: {
298
- down: function(event) {
299
- event.preventDefault();
300
- if(module.is.range()) {
301
- var
302
- eventPos = module.determine.eventPos(event),
303
- newPos = module.determine.pos(eventPos)
304
- ;
305
- // Special handling if range mode and both thumbs have the same value
306
- if(settings.preventCrossover && module.is.range() && module.thumbVal === module.secondThumbVal) {
307
- initialPosition = newPos;
308
- $currThumb = undefined;
309
- } else {
310
- $currThumb = module.determine.closestThumb(newPos);
311
- }
312
- if (previousValue === undefined) {
313
- previousValue = module.get.currentThumbValue();
314
- }
315
- } else if (previousValue === undefined) {
316
- previousValue = module.get.value();
317
- }
318
-
319
- if(!module.is.disabled()) {
320
- module.bind.slidingEvents();
321
- }
322
- },
323
- touchDown: function(event) {
324
- event.preventDefault(); // disable mouse emulation and touch-scrolling
325
- event.stopImmediatePropagation();
326
- if(touchIdentifier !== undefined) {
327
- // ignore multiple touches on the same slider --
328
- // we cannot handle changing both thumbs at once due to shared state
329
- return;
330
- }
331
- $currThumb = $(event.target);
332
- var touchEvent = event.touches ? event : event.originalEvent;
333
- touchIdentifier = touchEvent.targetTouches[0].identifier;
334
- if(previousValue === undefined) {
335
- previousValue = module.get.currentThumbValue();
336
- }
337
- },
338
- move: function(event) {
339
- if(event.type == 'mousemove') {
340
- event.preventDefault(); // prevent text selection etc.
341
- }
342
- if(module.is.disabled()) {
343
- // touch events are always bound, so we need to prevent touch-sliding on disabled sliders here
344
- return;
345
- }
346
- var value = module.determine.valueFromEvent(event);
347
- if(event.type == 'mousemove' && $currThumb === undefined) {
348
- var
349
- eventPos = module.determine.eventPos(event),
350
- newPos = module.determine.pos(eventPos)
351
- ;
352
- $currThumb = initialPosition > newPos ? $thumb : $secondThumb;
353
- }
354
- if(module.get.step() == 0 || module.is.smooth()) {
355
- var
356
- thumbVal = module.thumbVal,
357
- secondThumbVal = module.secondThumbVal,
358
- thumbSmoothVal = module.determine.smoothValueFromEvent(event)
359
- ;
360
- if(!$currThumb.hasClass('second')) {
361
- if(settings.preventCrossover && module.is.range()) {
362
- value = Math.min(secondThumbVal, value);
363
- thumbSmoothVal = Math.min(secondThumbVal, thumbSmoothVal);
364
- }
365
- thumbVal = value;
366
- } else {
367
- if(settings.preventCrossover && module.is.range()) {
368
- value = Math.max(thumbVal, value);
369
- thumbSmoothVal = Math.max(thumbVal, thumbSmoothVal);
96
+ module = {
97
+
98
+ initialize: function () {
99
+ module.debug('Initializing slider', settings);
100
+ initialLoad = true;
101
+
102
+ currentRange += 1;
103
+ documentEventID = currentRange;
104
+
105
+ module.setup.layout();
106
+ module.setup.labels();
107
+
108
+ if (!module.is.disabled()) {
109
+ module.bind.events();
110
+ }
111
+
112
+ module.read.metadata();
113
+ module.read.settings();
114
+
115
+ initialLoad = false;
116
+ module.instantiate();
117
+ },
118
+
119
+ instantiate: function () {
120
+ module.verbose('Storing instance of slider', module);
121
+ instance = module;
122
+ $module
123
+ .data(moduleNamespace, module)
124
+ ;
125
+ },
126
+
127
+ destroy: function () {
128
+ module.verbose('Destroying previous slider for', $module);
129
+ clearInterval(instance.interval);
130
+ module.unbind.events();
131
+ module.unbind.slidingEvents();
132
+ $module.removeData(moduleNamespace);
133
+ instance = undefined;
134
+ },
135
+
136
+ setup: {
137
+ layout: function () {
138
+ if ($module.attr('tabindex') === undefined) {
139
+ $module.attr('tabindex', 0);
140
+ }
141
+ if ($module.find('.inner').length === 0) {
142
+ $module.append("<div class='inner'>"
143
+ + "<div class='track'></div>"
144
+ + "<div class='track-fill'></div>"
145
+ + "<div class='thumb'></div>"
146
+ + '</div>');
147
+ }
148
+ precision = module.get.precision();
149
+ $thumb = $module.find('.thumb:not(.second)');
150
+ $currThumb = $thumb;
151
+ if (module.is.range()) {
152
+ if ($module.find('.thumb.second').length === 0) {
153
+ $module.find('.inner').append("<div class='thumb second'></div>");
154
+ }
155
+ $secondThumb = $module.find('.thumb.second');
156
+ }
157
+ $track = $module.find('.track');
158
+ $trackFill = $module.find('.track-fill');
159
+ offset = $thumb.width() / 2;
160
+ },
161
+ labels: function () {
162
+ if (module.is.labeled()) {
163
+ $labels = $module.find('.labels:not(.auto)');
164
+ if ($labels.length > 0) {
165
+ module.setup.customLabel();
166
+ } else {
167
+ module.setup.autoLabel();
168
+ }
169
+
170
+ if (settings.showLabelTicks) {
171
+ $module.addClass(className.ticked);
172
+ }
173
+ }
174
+ },
175
+ customLabel: function () {
176
+ var
177
+ $children = $labels.find('.label'),
178
+ numChildren = $children.length,
179
+ min = module.get.min(),
180
+ max = module.get.max(),
181
+ ratio
182
+ ;
183
+ $children.each(function (index) {
184
+ var
185
+ $child = $(this),
186
+ attrValue = $child.attr('data-value')
187
+ ;
188
+ if (attrValue) {
189
+ attrValue = attrValue > max
190
+ ? max
191
+ : (attrValue < min ? min : attrValue);
192
+ ratio = (attrValue - min) / (max - min);
193
+ } else {
194
+ ratio = (index + 1) / (numChildren + 1);
195
+ }
196
+ module.update.labelPosition(ratio, $(this));
197
+ });
198
+ },
199
+ autoLabel: function () {
200
+ $labels = $module.find('.labels');
201
+ if ($labels.length > 0) {
202
+ $labels.empty();
203
+ } else {
204
+ $labels = $module.append('<ul class="auto labels"></ul>').find('.labels');
205
+ }
206
+ for (var i = 0, len = module.get.numLabels(); i <= len; i++) {
207
+ var
208
+ labelText = module.get.label(i),
209
+ $label = labelText !== ''
210
+ ? (!(i % module.get.gapRatio())
211
+ ? $('<li class="label">' + labelText + '</li>')
212
+ : $('<li class="halftick label"></li>'))
213
+ : null,
214
+ ratio = i / len
215
+ ;
216
+ if ($label) {
217
+ module.update.labelPosition(ratio, $label);
218
+ $labels.append($label);
219
+ }
220
+ }
221
+ },
222
+ },
223
+
224
+ bind: {
225
+ events: function () {
226
+ module.bind.globalKeyboardEvents();
227
+ module.bind.keyboardEvents();
228
+ module.bind.mouseEvents();
229
+ if (settings.autoAdjustLabels) {
230
+ module.bind.windowEvents();
231
+ }
232
+ },
233
+ keyboardEvents: function () {
234
+ module.verbose('Binding keyboard events');
235
+ $module.on('keydown' + eventNamespace, module.event.keydown);
236
+ },
237
+ globalKeyboardEvents: function () {
238
+ $document.on('keydown' + eventNamespace + documentEventID, module.event.activateFocus);
239
+ },
240
+ mouseEvents: function () {
241
+ module.verbose('Binding mouse and touch events');
242
+ $module.find('.track, .thumb, .inner').on('mousedown' + eventNamespace, function (event) {
243
+ event.stopImmediatePropagation();
244
+ event.preventDefault();
245
+ module.event.down(event);
246
+ });
247
+ $module.on('mousedown' + eventNamespace, module.event.down);
248
+ $module.on('mouseenter' + eventNamespace, function (event) {
249
+ isHover = true;
250
+ });
251
+ $module.on('mouseleave' + eventNamespace, function (event) {
252
+ isHover = false;
253
+ });
254
+ // All touch events are invoked on the element where the touch *started*. Thus, we can bind them all
255
+ // on the thumb(s) and don't need to worry about interference with other components, i.e. no dynamic binding
256
+ // and unbinding required.
257
+ $module.find('.thumb')
258
+ .on('touchstart' + eventNamespace, module.event.touchDown)
259
+ .on('touchmove' + eventNamespace, module.event.move)
260
+ .on('touchend' + eventNamespace, module.event.up)
261
+ .on('touchcancel' + eventNamespace, module.event.touchCancel)
262
+ ;
263
+ },
264
+ slidingEvents: function () {
265
+ // these don't need the identifier because we only ever want one of them to be registered with document
266
+ module.verbose('Binding page wide events while handle is being draged');
267
+ $document.on('mousemove' + eventNamespace, module.event.move);
268
+ $document.on('mouseup' + eventNamespace, module.event.up);
269
+ },
270
+ windowEvents: function () {
271
+ $window.on('resize' + eventNamespace, module.event.resize);
272
+ },
273
+ },
274
+
275
+ unbind: {
276
+ events: function () {
277
+ $module.find('.track, .thumb, .inner').off('mousedown' + eventNamespace);
278
+ $module.off('mousedown' + eventNamespace);
279
+ $module.off('mouseenter' + eventNamespace);
280
+ $module.off('mouseleave' + eventNamespace);
281
+ $module.find('.thumb')
282
+ .off('touchstart' + eventNamespace)
283
+ .off('touchmove' + eventNamespace)
284
+ .off('touchend' + eventNamespace)
285
+ .off('touchcancel' + eventNamespace)
286
+ ;
287
+ $module.off('keydown' + eventNamespace);
288
+ $module.off('focusout' + eventNamespace);
289
+ $document.off('keydown' + eventNamespace + documentEventID, module.event.activateFocus);
290
+ $window.off('resize' + eventNamespace);
291
+ },
292
+ slidingEvents: function () {
293
+ $document.off('mousemove' + eventNamespace);
294
+ $document.off('mouseup' + eventNamespace);
295
+ },
296
+ },
297
+
298
+ event: {
299
+ down: function (event) {
300
+ event.preventDefault();
301
+ if (module.is.range()) {
302
+ var
303
+ eventPos = module.determine.eventPos(event),
304
+ newPos = module.determine.pos(eventPos)
305
+ ;
306
+ // Special handling if range mode and both thumbs have the same value
307
+ if (settings.preventCrossover && module.is.range() && module.thumbVal === module.secondThumbVal) {
308
+ initialPosition = newPos;
309
+ $currThumb = undefined;
310
+ } else {
311
+ $currThumb = module.determine.closestThumb(newPos);
312
+ }
313
+ if (previousValue === undefined) {
314
+ previousValue = module.get.currentThumbValue();
315
+ }
316
+ } else if (previousValue === undefined) {
317
+ previousValue = module.get.value();
318
+ }
319
+
320
+ if (!module.is.disabled()) {
321
+ module.bind.slidingEvents();
322
+ }
323
+ },
324
+ touchDown: function (event) {
325
+ event.preventDefault(); // disable mouse emulation and touch-scrolling
326
+ event.stopImmediatePropagation();
327
+ if (touchIdentifier !== undefined) {
328
+ // ignore multiple touches on the same slider --
329
+ // we cannot handle changing both thumbs at once due to shared state
330
+ return;
331
+ }
332
+ $currThumb = $(event.target);
333
+ var touchEvent = event.touches ? event : event.originalEvent;
334
+ touchIdentifier = touchEvent.targetTouches[0].identifier;
335
+ if (previousValue === undefined) {
336
+ previousValue = module.get.currentThumbValue();
337
+ }
338
+ },
339
+ move: function (event) {
340
+ if (event.type === 'mousemove') {
341
+ event.preventDefault(); // prevent text selection etc.
342
+ }
343
+ if (module.is.disabled()) {
344
+ // touch events are always bound, so we need to prevent touch-sliding on disabled sliders here
345
+ return;
346
+ }
347
+ var value = module.determine.valueFromEvent(event);
348
+ if (event.type === 'mousemove' && $currThumb === undefined) {
349
+ var
350
+ eventPos = module.determine.eventPos(event),
351
+ newPos = module.determine.pos(eventPos)
352
+ ;
353
+ $currThumb = initialPosition > newPos ? $thumb : $secondThumb;
354
+ }
355
+ if (module.get.step() === 0 || module.is.smooth()) {
356
+ var
357
+ thumbVal = module.thumbVal,
358
+ secondThumbVal = module.secondThumbVal,
359
+ thumbSmoothVal = module.determine.smoothValueFromEvent(event)
360
+ ;
361
+ if (!$currThumb.hasClass('second')) {
362
+ if (settings.preventCrossover && module.is.range()) {
363
+ value = Math.min(secondThumbVal, value);
364
+ thumbSmoothVal = Math.min(secondThumbVal, thumbSmoothVal);
365
+ }
366
+ thumbVal = value;
367
+ } else {
368
+ if (settings.preventCrossover && module.is.range()) {
369
+ value = Math.max(thumbVal, value);
370
+ thumbSmoothVal = Math.max(thumbVal, thumbSmoothVal);
371
+ }
372
+ secondThumbVal = value;
373
+ }
374
+ value = Math.abs(thumbVal - (secondThumbVal || 0));
375
+ module.update.position(thumbSmoothVal);
376
+ settings.onMove.call(element, value, thumbVal, secondThumbVal);
377
+ } else {
378
+ module.update.value(value, function (value, thumbVal, secondThumbVal) {
379
+ settings.onMove.call(element, value, thumbVal, secondThumbVal);
380
+ });
381
+ }
382
+ },
383
+ up: function (event) {
384
+ event.preventDefault();
385
+ if (module.is.disabled()) {
386
+ // touch events are always bound, so we need to prevent touch-sliding on disabled sliders here
387
+ return;
388
+ }
389
+ var value = module.determine.valueFromEvent(event);
390
+ module.set.value(value);
391
+ module.unbind.slidingEvents();
392
+ touchIdentifier = undefined;
393
+ if (previousValue !== undefined) {
394
+ previousValue = undefined;
395
+ }
396
+ },
397
+ touchCancel: function (event) {
398
+ event.preventDefault();
399
+ touchIdentifier = undefined;
400
+ if (previousValue !== undefined) {
401
+ module.update.value(previousValue);
402
+ previousValue = undefined;
403
+ }
404
+ },
405
+ keydown: function (event, first) {
406
+ if (settings.preventCrossover && module.is.range() && module.thumbVal === module.secondThumbVal) {
407
+ $currThumb = undefined;
408
+ }
409
+ if (module.is.focused()) {
410
+ $document.trigger(event);
411
+ }
412
+ if (first || module.is.focused()) {
413
+ var step = module.determine.keyMovement(event);
414
+ if (step !== NO_STEP) {
415
+ event.preventDefault();
416
+ switch (step) {
417
+ case SINGLE_STEP: {
418
+ module.takeStep();
419
+
420
+ break;
421
+ }
422
+ case BIG_STEP: {
423
+ module.takeStep(module.get.multiplier());
424
+
425
+ break;
426
+ }
427
+ case SINGLE_BACKSTEP: {
428
+ module.backStep();
429
+
430
+ break;
431
+ }
432
+ case BIG_BACKSTEP: {
433
+ module.backStep(module.get.multiplier());
434
+
435
+ break;
436
+ }
437
+ }
438
+ }
439
+ }
440
+ },
441
+ activateFocus: function (event) {
442
+ if (!module.is.focused() && module.is.hover() && module.determine.keyMovement(event) !== NO_STEP) {
443
+ event.preventDefault();
444
+ module.event.keydown(event, true);
445
+ $module.trigger('focus');
446
+ }
447
+ },
448
+ resize: function (_event) {
449
+ // To avoid a useless performance cost, we only call the label refresh when its necessary
450
+ if (gapRatio !== module.get.gapRatio()) {
451
+ module.setup.labels();
452
+ gapRatio = module.get.gapRatio();
453
+ }
454
+ },
455
+ },
456
+
457
+ resync: function () {
458
+ module.verbose('Resyncing thumb position based on value');
459
+ if (module.is.range()) {
460
+ module.update.position(module.secondThumbVal, $secondThumb);
461
+ }
462
+ module.update.position(module.thumbVal, $thumb);
463
+ module.setup.labels();
464
+ },
465
+ takeStep: function (multiplier) {
466
+ if (!multiplier) {
467
+ multiplier = 1;
468
+ }
469
+ var
470
+ step = module.get.step(),
471
+ currValue = module.get.currentThumbValue()
472
+ ;
473
+ module.verbose('Taking a step');
474
+ if (step > 0) {
475
+ module.set.value(currValue + step * multiplier);
476
+ } else if (step === 0) {
477
+ var
478
+ precision = module.get.precision(),
479
+ newValue = currValue + (multiplier / precision)
480
+ ;
481
+ module.set.value(Math.round(newValue * precision) / precision);
482
+ }
483
+ },
484
+
485
+ backStep: function (multiplier) {
486
+ if (!multiplier) {
487
+ multiplier = 1;
488
+ }
489
+ var
490
+ step = module.get.step(),
491
+ currValue = module.get.currentThumbValue()
492
+ ;
493
+ module.verbose('Going back a step');
494
+ if (step > 0) {
495
+ module.set.value(currValue - step * multiplier);
496
+ } else if (step === 0) {
497
+ var
498
+ precision = module.get.precision(),
499
+ newValue = currValue - (multiplier / precision)
500
+ ;
501
+ module.set.value(Math.round(newValue * precision) / precision);
502
+ }
503
+ },
504
+
505
+ is: {
506
+ range: function () {
507
+ return $module.hasClass(settings.className.range);
508
+ },
509
+ hover: function () {
510
+ return isHover;
511
+ },
512
+ focused: function () {
513
+ return $module.is(':focus');
514
+ },
515
+ disabled: function () {
516
+ return $module.hasClass(settings.className.disabled);
517
+ },
518
+ labeled: function () {
519
+ return $module.hasClass(settings.className.labeled);
520
+ },
521
+ reversed: function () {
522
+ return $module.hasClass(settings.className.reversed);
523
+ },
524
+ vertical: function () {
525
+ return $module.hasClass(settings.className.vertical);
526
+ },
527
+ smooth: function () {
528
+ return settings.smooth || $module.hasClass(settings.className.smooth);
529
+ },
530
+ },
531
+
532
+ get: {
533
+ trackOffset: function () {
534
+ if (module.is.vertical()) {
535
+ return $track.offset().top;
536
+ }
537
+
538
+ return $track.offset().left;
539
+ },
540
+ trackLength: function () {
541
+ if (module.is.vertical()) {
542
+ return $track.height();
543
+ }
544
+
545
+ return $track.width();
546
+ },
547
+ trackLeft: function () {
548
+ if (module.is.vertical()) {
549
+ return $track.position().top;
550
+ }
551
+
552
+ return $track.position().left;
553
+ },
554
+ trackStartPos: function () {
555
+ return module.is.reversed() ? module.get.trackLeft() + module.get.trackLength() : module.get.trackLeft();
556
+ },
557
+ trackEndPos: function () {
558
+ return module.is.reversed() ? module.get.trackLeft() : module.get.trackLeft() + module.get.trackLength();
559
+ },
560
+ trackStartMargin: function () {
561
+ var margin;
562
+ if (module.is.vertical()) {
563
+ margin = module.is.reversed() ? $module.css('padding-bottom') : $module.css('padding-top');
564
+ } else {
565
+ margin = module.is.reversed() ? $module.css('padding-right') : $module.css('padding-left');
566
+ }
567
+
568
+ return margin || '0px';
569
+ },
570
+ trackEndMargin: function () {
571
+ var margin;
572
+ if (module.is.vertical()) {
573
+ margin = module.is.reversed() ? $module.css('padding-top') : $module.css('padding-bottom');
574
+ } else {
575
+ margin = module.is.reversed() ? $module.css('padding-left') : $module.css('padding-right');
576
+ }
577
+
578
+ return margin || '0px';
579
+ },
580
+ precision: function () {
581
+ var
582
+ decimalPlaces,
583
+ step = module.get.step()
584
+ ;
585
+ if (step !== 0) {
586
+ var split = String(step).split('.');
587
+ decimalPlaces = split.length === 2 ? split[1].length : 0;
588
+ } else {
589
+ decimalPlaces = settings.decimalPlaces;
590
+ }
591
+ var precision = Math.pow(10, decimalPlaces);
592
+ module.debug('Precision determined', precision);
593
+
594
+ return precision;
595
+ },
596
+ min: function () {
597
+ return settings.min;
598
+ },
599
+ max: function () {
600
+ var
601
+ step = module.get.step(),
602
+ min = module.get.min(),
603
+ quotient = step === 0 ? 0 : Math.floor((settings.max - min) / step),
604
+ remainder = step === 0 ? 0 : (settings.max - min) % step
605
+ ;
606
+
607
+ return remainder === 0 ? settings.max : min + quotient * step;
608
+ },
609
+ step: function () {
610
+ return settings.step;
611
+ },
612
+ numLabels: function () {
613
+ var value = Math.round((module.get.max() - module.get.min()) / (module.get.step() === 0 ? 1 : module.get.step()));
614
+ module.debug('Determined that there should be ' + value + ' labels');
615
+
616
+ return value;
617
+ },
618
+ labelType: function () {
619
+ return settings.labelType;
620
+ },
621
+ label: function (value) {
622
+ if (interpretLabel) {
623
+ return interpretLabel(value);
624
+ }
625
+
626
+ switch (settings.labelType) {
627
+ case settings.labelTypes.number: {
628
+ return Math.round(((value * (module.get.step() === 0 ? 1 : module.get.step())) + module.get.min()) * precision) / precision;
629
+ }
630
+ case settings.labelTypes.letter: {
631
+ return alphabet[value % 26];
632
+ }
633
+ default: {
634
+ return value;
635
+ }
636
+ }
637
+ },
638
+ value: function () {
639
+ return value;
640
+ },
641
+ currentThumbValue: function () {
642
+ return $currThumb !== undefined && $currThumb.hasClass('second') ? module.secondThumbVal : module.thumbVal;
643
+ },
644
+ thumbValue: function (which) {
645
+ switch (which) {
646
+ case 'second': {
647
+ if (module.is.range()) {
648
+ return module.secondThumbVal;
649
+ }
650
+
651
+ module.error(error.notrange);
652
+
653
+ break;
654
+ }
655
+ default: {
656
+ return module.thumbVal;
657
+ }
658
+ }
659
+ },
660
+ multiplier: function () {
661
+ return settings.pageMultiplier;
662
+ },
663
+ thumbPosition: function (which) {
664
+ switch (which) {
665
+ case 'second': {
666
+ if (module.is.range()) {
667
+ return secondPos;
668
+ }
669
+
670
+ module.error(error.notrange);
671
+
672
+ break;
673
+ }
674
+ default: {
675
+ return position;
676
+ }
677
+ }
678
+ },
679
+ gapRatio: function () {
680
+ var gapRatio = 1;
681
+
682
+ if (settings.autoAdjustLabels) {
683
+ var
684
+ numLabels = module.get.numLabels(),
685
+ trackLength = module.get.trackLength(),
686
+ gapCounter = 1
687
+ ;
688
+
689
+ // While the distance between two labels is too short,
690
+ // we divide the number of labels at each iteration
691
+ // and apply only if the modulo of the operation is an odd number.
692
+ if (trackLength > 0) {
693
+ while ((trackLength / numLabels) * gapCounter < settings.labelDistance) {
694
+ if (!(numLabels % gapCounter)) {
695
+ gapRatio = gapCounter;
696
+ }
697
+ gapCounter += 1;
698
+ }
699
+ }
700
+ }
701
+
702
+ return gapRatio;
703
+ },
704
+ },
705
+
706
+ determine: {
707
+ pos: function (pagePos) {
708
+ return module.is.reversed()
709
+ ? module.get.trackStartPos() - pagePos + module.get.trackOffset()
710
+ : pagePos - module.get.trackOffset() - module.get.trackStartPos();
711
+ },
712
+ closestThumb: function (eventPos) {
713
+ var
714
+ thumbPos = parseFloat(module.determine.thumbPos($thumb)),
715
+ thumbDelta = Math.abs(eventPos - thumbPos),
716
+ secondThumbPos = parseFloat(module.determine.thumbPos($secondThumb)),
717
+ secondThumbDelta = Math.abs(eventPos - secondThumbPos)
718
+ ;
719
+ if (thumbDelta === secondThumbDelta && module.get.thumbValue() === module.get.min()) {
720
+ return $secondThumb;
721
+ }
722
+
723
+ return thumbDelta <= secondThumbDelta ? $thumb : $secondThumb;
724
+ },
725
+ closestThumbPos: function (eventPos) {
726
+ var
727
+ thumbPos = parseFloat(module.determine.thumbPos($thumb)),
728
+ thumbDelta = Math.abs(eventPos - thumbPos),
729
+ secondThumbPos = parseFloat(module.determine.thumbPos($secondThumb)),
730
+ secondThumbDelta = Math.abs(eventPos - secondThumbPos)
731
+ ;
732
+
733
+ return thumbDelta <= secondThumbDelta ? thumbPos : secondThumbPos;
734
+ },
735
+ thumbPos: function ($element) {
736
+ var
737
+ pos = module.is.vertical()
738
+ ? (module.is.reversed() ? $element.css('bottom') : $element.css('top'))
739
+ : (module.is.reversed() ? $element.css('right') : $element.css('left'))
740
+ ;
741
+
742
+ return pos;
743
+ },
744
+ positionFromValue: function (val) {
745
+ var
746
+ min = module.get.min(),
747
+ max = module.get.max(),
748
+ value = val > max
749
+ ? max
750
+ : (val < min ? min : val),
751
+ trackLength = module.get.trackLength(),
752
+ ratio = (value - min) / (max - min),
753
+ position = Math.round(ratio * trackLength)
754
+ ;
755
+ module.verbose('Determined position: ' + position + ' from value: ' + value);
756
+
757
+ return position;
758
+ },
759
+ positionFromRatio: function (ratio) {
760
+ var
761
+ trackLength = module.get.trackLength(),
762
+ step = module.get.step(),
763
+ position = Math.round(ratio * trackLength),
764
+ adjustedPos = step === 0 ? position : Math.round(position / step) * step
765
+ ;
766
+
767
+ return adjustedPos;
768
+ },
769
+ valueFromEvent: function (event) {
770
+ var
771
+ eventPos = module.determine.eventPos(event),
772
+ newPos = module.determine.pos(eventPos),
773
+ value
774
+ ;
775
+ if (eventPos < module.get.trackOffset()) {
776
+ value = module.is.reversed() ? module.get.max() : module.get.min();
777
+ } else if (eventPos > module.get.trackOffset() + module.get.trackLength()) {
778
+ value = module.is.reversed() ? module.get.min() : module.get.max();
779
+ } else {
780
+ value = module.determine.value(newPos);
781
+ }
782
+
783
+ return value;
784
+ },
785
+ smoothValueFromEvent: function (event) {
786
+ var
787
+ min = module.get.min(),
788
+ max = module.get.max(),
789
+ trackLength = module.get.trackLength(),
790
+ eventPos = module.determine.eventPos(event),
791
+ newPos = eventPos - module.get.trackOffset(),
792
+ ratio,
793
+ value
794
+ ;
795
+ newPos = newPos < 0
796
+ ? 0
797
+ : (newPos > trackLength ? trackLength : newPos);
798
+ ratio = newPos / trackLength;
799
+ if (module.is.reversed()) {
800
+ ratio = 1 - ratio;
801
+ }
802
+ value = ratio * (max - min) + min;
803
+
804
+ return value;
805
+ },
806
+ eventPos: function (event) {
807
+ if (event.type === 'touchmove' || event.type === 'touchend') {
808
+ var
809
+ touchEvent = event.touches ? event : event.originalEvent,
810
+ touch = touchEvent.changedTouches[0]; // fall back to first touch if correct touch not found
811
+ for (var i = 0; i < touchEvent.touches.length; i++) {
812
+ if (touchEvent.touches[i].identifier === touchIdentifier) {
813
+ touch = touchEvent.touches[i];
814
+
815
+ break;
816
+ }
817
+ }
818
+ var
819
+ touchY = touch.pageY,
820
+ touchX = touch.pageX
821
+ ;
822
+
823
+ return module.is.vertical() ? touchY : touchX;
824
+ }
825
+ var
826
+ clickY = event.pageY || event.originalEvent.pageY,
827
+ clickX = event.pageX || event.originalEvent.pageX
828
+ ;
829
+
830
+ return module.is.vertical() ? clickY : clickX;
831
+ },
832
+ value: function (position) {
833
+ var
834
+ startPos = module.is.reversed() ? module.get.trackEndPos() : module.get.trackStartPos(),
835
+ endPos = module.is.reversed() ? module.get.trackStartPos() : module.get.trackEndPos(),
836
+ ratio = (position - startPos) / (endPos - startPos),
837
+ range = module.get.max() - module.get.min(),
838
+ step = module.get.step(),
839
+ value = ratio * range,
840
+ difference = step === 0 ? value : Math.round(value / step) * step
841
+ ;
842
+ module.verbose('Determined value based upon position: ' + position + ' as: ' + value);
843
+ if (value !== difference) {
844
+ module.verbose('Rounding value to closest step: ' + difference);
845
+ }
846
+ // Use precision to avoid ugly Javascript floating point rounding issues
847
+ // (like 35 * .01 = 0.35000000000000003)
848
+ module.verbose('Cutting off additional decimal places');
849
+
850
+ return Math.round((difference + module.get.min()) * precision) / precision;
851
+ },
852
+ keyMovement: function (event) {
853
+ var
854
+ key = event.which,
855
+ downArrow = module.is.vertical()
856
+ ? (module.is.reversed() ? keys.downArrow : keys.upArrow)
857
+ : keys.downArrow,
858
+ upArrow = module.is.vertical()
859
+ ? (module.is.reversed() ? keys.upArrow : keys.downArrow)
860
+ : keys.upArrow,
861
+ leftArrow = !module.is.vertical()
862
+ ? (module.is.reversed() ? keys.rightArrow : keys.leftArrow)
863
+ : keys.leftArrow,
864
+ rightArrow = !module.is.vertical()
865
+ ? (module.is.reversed() ? keys.leftArrow : keys.rightArrow)
866
+ : keys.rightArrow
867
+ ;
868
+ if (key === downArrow || key === leftArrow) {
869
+ return SINGLE_BACKSTEP;
870
+ }
871
+ if (key === upArrow || key === rightArrow) {
872
+ return SINGLE_STEP;
873
+ }
874
+ if (key === keys.pageDown) {
875
+ return BIG_BACKSTEP;
876
+ }
877
+ if (key === keys.pageUp) {
878
+ return BIG_STEP;
879
+ }
880
+
881
+ return NO_STEP;
882
+ },
883
+ },
884
+
885
+ handleNewValuePosition: function (val) {
886
+ var
887
+ min = module.get.min(),
888
+ max = module.get.max(),
889
+ newPos
890
+ ;
891
+ if (val <= min) {
892
+ val = min;
893
+ } else if (val >= max) {
894
+ val = max;
895
+ }
896
+ newPos = module.determine.positionFromValue(val);
897
+
898
+ return newPos;
899
+ },
900
+
901
+ set: {
902
+ value: function (newValue, fireChange) {
903
+ fireChange = fireChange !== false;
904
+ var toReset = previousValue === undefined;
905
+ previousValue = previousValue === undefined ? module.get.value() : previousValue;
906
+ module.update.value(newValue, function (value, thumbVal, secondThumbVal) {
907
+ if ((!initialLoad || settings.fireOnInit) && fireChange) {
908
+ if (newValue !== previousValue) {
909
+ settings.onChange.call(element, value, thumbVal, secondThumbVal);
910
+ }
911
+ settings.onMove.call(element, value, thumbVal, secondThumbVal);
912
+ }
913
+ if (toReset) {
914
+ previousValue = undefined;
915
+ }
916
+ });
917
+ },
918
+ rangeValue: function (first, second, fireChange) {
919
+ fireChange = fireChange !== false;
920
+ if (module.is.range()) {
921
+ var
922
+ min = module.get.min(),
923
+ max = module.get.max(),
924
+ toReset = previousValue === undefined
925
+ ;
926
+ previousValue = previousValue === undefined ? module.get.value() : previousValue;
927
+ if (first <= min) {
928
+ first = min;
929
+ } else if (first >= max) {
930
+ first = max;
931
+ }
932
+ if (second <= min) {
933
+ second = min;
934
+ } else if (second >= max) {
935
+ second = max;
936
+ }
937
+ module.thumbVal = first;
938
+ module.secondThumbVal = second;
939
+ value = Math.abs(module.thumbVal - module.secondThumbVal);
940
+ module.update.position(module.thumbVal, $thumb);
941
+ module.update.position(module.secondThumbVal, $secondThumb);
942
+ if ((!initialLoad || settings.fireOnInit) && fireChange) {
943
+ if (value !== previousValue) {
944
+ settings.onChange.call(element, value, module.thumbVal, module.secondThumbVal);
945
+ }
946
+ settings.onMove.call(element, value, module.thumbVal, module.secondThumbVal);
947
+ }
948
+ if (toReset) {
949
+ previousValue = undefined;
950
+ }
951
+ } else {
952
+ module.error(error.notrange);
953
+ }
954
+ },
955
+ position: function (position, which) {
956
+ var thumbVal = module.determine.value(position);
957
+ if (which === 'second') {
958
+ module.secondThumbVal = thumbVal;
959
+ module.update.position(thumbVal, $secondThumb);
960
+ } else {
961
+ module.thumbVal = thumbVal;
962
+ module.update.position(thumbVal, $thumb);
963
+ }
964
+ value = Math.abs(module.thumbVal - (module.secondThumbVal || 0));
965
+ module.set.value(value);
966
+ },
967
+ },
968
+
969
+ update: {
970
+ value: function (newValue, callback) {
971
+ var
972
+ min = module.get.min(),
973
+ max = module.get.max()
974
+ ;
975
+ if (newValue <= min) {
976
+ newValue = min;
977
+ } else if (newValue >= max) {
978
+ newValue = max;
979
+ }
980
+ if (!module.is.range()) {
981
+ value = newValue;
982
+ module.thumbVal = value;
983
+ } else {
984
+ if ($currThumb === undefined) {
985
+ $currThumb = newValue <= module.get.currentThumbValue() ? $thumb : $secondThumb;
986
+ }
987
+ if (!$currThumb.hasClass('second')) {
988
+ if (settings.preventCrossover && module.is.range()) {
989
+ newValue = Math.min(module.secondThumbVal, newValue);
990
+ }
991
+ module.thumbVal = newValue;
992
+ } else {
993
+ if (settings.preventCrossover && module.is.range()) {
994
+ newValue = Math.max(module.thumbVal, newValue);
995
+ }
996
+ module.secondThumbVal = newValue;
997
+ }
998
+ value = Math.abs(module.thumbVal - module.secondThumbVal);
999
+ }
1000
+ module.update.position(newValue);
1001
+ module.debug('Setting slider value to ' + value);
1002
+ if (typeof callback === 'function') {
1003
+ callback(value, module.thumbVal, module.secondThumbVal);
1004
+ }
1005
+ },
1006
+ position: function (newValue, $element) {
1007
+ var
1008
+ newPos = module.handleNewValuePosition(newValue),
1009
+ $targetThumb = $element || $currThumb,
1010
+ thumbVal = module.thumbVal || module.get.min(),
1011
+ secondThumbVal = module.secondThumbVal || module.get.min()
1012
+ ;
1013
+ if (module.is.range()) {
1014
+ if (!$targetThumb.hasClass('second')) {
1015
+ position = newPos;
1016
+ thumbVal = newValue;
1017
+ } else {
1018
+ secondPos = newPos;
1019
+ secondThumbVal = newValue;
1020
+ }
1021
+ } else {
1022
+ position = newPos;
1023
+ thumbVal = newValue;
1024
+ }
1025
+ var
1026
+ trackPosValue,
1027
+ thumbPosValue,
1028
+ min = module.get.min(),
1029
+ max = module.get.max(),
1030
+ thumbPosPercent = 100 * ((newValue - min) / (max - min)),
1031
+ trackStartPosPercent = 100 * ((Math.min(thumbVal, secondThumbVal) - min) / (max - min)),
1032
+ trackEndPosPercent = 100 * (1 - (Math.max(thumbVal, secondThumbVal) - min) / (max - min))
1033
+ ;
1034
+ if (module.is.vertical()) {
1035
+ if (module.is.reversed()) {
1036
+ thumbPosValue = { bottom: 'calc(' + thumbPosPercent + '% - ' + offset + 'px)', top: 'auto' };
1037
+ trackPosValue = { bottom: trackStartPosPercent + '%', top: trackEndPosPercent + '%' };
1038
+ } else {
1039
+ thumbPosValue = { top: 'calc(' + thumbPosPercent + '% - ' + offset + 'px)', bottom: 'auto' };
1040
+ trackPosValue = { top: trackStartPosPercent + '%', bottom: trackEndPosPercent + '%' };
1041
+ }
1042
+ } else {
1043
+ if (module.is.reversed()) {
1044
+ thumbPosValue = { right: 'calc(' + thumbPosPercent + '% - ' + offset + 'px)', left: 'auto' };
1045
+ trackPosValue = { right: trackStartPosPercent + '%', left: trackEndPosPercent + '%' };
1046
+ } else {
1047
+ thumbPosValue = { left: 'calc(' + thumbPosPercent + '% - ' + offset + 'px)', right: 'auto' };
1048
+ trackPosValue = { left: trackStartPosPercent + '%', right: trackEndPosPercent + '%' };
1049
+ }
1050
+ }
1051
+ $targetThumb.css(thumbPosValue);
1052
+ $trackFill.css(trackPosValue);
1053
+ module.debug('Setting slider position to ' + newPos);
1054
+ },
1055
+ labelPosition: function (ratio, $label) {
1056
+ var
1057
+ startMargin = module.get.trackStartMargin(),
1058
+ endMargin = module.get.trackEndMargin(),
1059
+ posDir = module.is.vertical()
1060
+ ? (module.is.reversed() ? 'bottom' : 'top')
1061
+ : (module.is.reversed() ? 'right' : 'left'),
1062
+ startMarginMod = module.is.reversed() && !module.is.vertical()
1063
+ ? ' - '
1064
+ : ' + '
1065
+ ;
1066
+ var position = '(100% - ' + startMargin + ' - ' + endMargin + ') * ' + ratio;
1067
+ $label.css(posDir, 'calc(' + position + startMarginMod + startMargin + ')');
1068
+ },
1069
+ },
1070
+
1071
+ goto: {
1072
+ max: function () {
1073
+ module.set.value(module.get.max());
1074
+ },
1075
+ min: function () {
1076
+ module.set.value(module.get.min());
1077
+ },
1078
+ },
1079
+
1080
+ read: {
1081
+ metadata: function () {
1082
+ var
1083
+ data = {
1084
+ thumbVal: $module.data(metadata.thumbVal),
1085
+ secondThumbVal: $module.data(metadata.secondThumbVal),
1086
+ }
1087
+ ;
1088
+ if (data.thumbVal) {
1089
+ if (module.is.range() && data.secondThumbVal) {
1090
+ module.debug('Current value set from metadata', data.thumbVal, data.secondThumbVal);
1091
+ module.set.rangeValue(data.thumbVal, data.secondThumbVal);
1092
+ } else {
1093
+ module.debug('Current value set from metadata', data.thumbVal);
1094
+ module.set.value(data.thumbVal);
1095
+ }
1096
+ }
1097
+ },
1098
+ settings: function () {
1099
+ if (settings.start !== false) {
1100
+ if (module.is.range()) {
1101
+ module.debug('Start position set from settings', settings.start, settings.end);
1102
+ module.set.rangeValue(settings.start, settings.end);
1103
+ } else {
1104
+ module.debug('Start position set from settings', settings.start);
1105
+ module.set.value(settings.start);
1106
+ }
1107
+ }
1108
+ },
1109
+ },
1110
+
1111
+ setting: function (name, value) {
1112
+ module.debug('Changing setting', name, value);
1113
+ if ($.isPlainObject(name)) {
1114
+ $.extend(true, settings, name);
1115
+ } else if (value !== undefined) {
1116
+ if ($.isPlainObject(settings[name])) {
1117
+ $.extend(true, settings[name], value);
1118
+ } else {
1119
+ settings[name] = value;
1120
+ }
1121
+ } else {
1122
+ return settings[name];
1123
+ }
1124
+ },
1125
+ internal: function (name, value) {
1126
+ if ($.isPlainObject(name)) {
1127
+ $.extend(true, module, name);
1128
+ } else if (value !== undefined) {
1129
+ module[name] = value;
1130
+ } else {
1131
+ return module[name];
1132
+ }
1133
+ },
1134
+ debug: function () {
1135
+ if (!settings.silent && settings.debug) {
1136
+ if (settings.performance) {
1137
+ module.performance.log(arguments);
1138
+ } else {
1139
+ module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
1140
+ module.debug.apply(console, arguments);
1141
+ }
1142
+ }
1143
+ },
1144
+ verbose: function () {
1145
+ if (!settings.silent && settings.verbose && settings.debug) {
1146
+ if (settings.performance) {
1147
+ module.performance.log(arguments);
1148
+ } else {
1149
+ module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
1150
+ module.verbose.apply(console, arguments);
1151
+ }
1152
+ }
1153
+ },
1154
+ error: function () {
1155
+ if (!settings.silent) {
1156
+ module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
1157
+ module.error.apply(console, arguments);
1158
+ }
1159
+ },
1160
+
1161
+ performance: {
1162
+ log: function (message) {
1163
+ var
1164
+ currentTime,
1165
+ executionTime,
1166
+ previousTime
1167
+ ;
1168
+ if (settings.performance) {
1169
+ currentTime = Date.now();
1170
+ previousTime = time || currentTime;
1171
+ executionTime = currentTime - previousTime;
1172
+ time = currentTime;
1173
+ performance.push({
1174
+ Name: message[0],
1175
+ Arguments: [].slice.call(message, 1) || '',
1176
+ Element: element,
1177
+ 'Execution Time': executionTime,
1178
+ });
1179
+ }
1180
+ clearTimeout(module.performance.timer);
1181
+ module.performance.timer = setTimeout(module.performance.display, 500);
1182
+ },
1183
+ display: function () {
1184
+ var
1185
+ title = settings.name + ':',
1186
+ totalTime = 0
1187
+ ;
1188
+ time = false;
1189
+ clearTimeout(module.performance.timer);
1190
+ $.each(performance, function (index, data) {
1191
+ totalTime += data['Execution Time'];
1192
+ });
1193
+ title += ' ' + totalTime + 'ms';
1194
+ if (moduleSelector) {
1195
+ title += ' \'' + moduleSelector + '\'';
1196
+ }
1197
+ if (performance.length > 0) {
1198
+ console.groupCollapsed(title);
1199
+ if (console.table) {
1200
+ console.table(performance);
1201
+ } else {
1202
+ $.each(performance, function (index, data) {
1203
+ console.log(data.Name + ': ' + data['Execution Time'] + 'ms');
1204
+ });
1205
+ }
1206
+ console.groupEnd();
1207
+ }
1208
+ performance = [];
1209
+ },
1210
+ },
1211
+
1212
+ invoke: function (query, passedArguments, context) {
1213
+ var
1214
+ object = instance,
1215
+ maxDepth,
1216
+ found,
1217
+ response
1218
+ ;
1219
+ passedArguments = passedArguments || queryArguments;
1220
+ context = context || element;
1221
+ if (typeof query === 'string' && object !== undefined) {
1222
+ query = query.split(/[ .]/);
1223
+ maxDepth = query.length - 1;
1224
+ $.each(query, function (depth, value) {
1225
+ var camelCaseValue = depth !== maxDepth
1226
+ ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
1227
+ : query
1228
+ ;
1229
+ if ($.isPlainObject(object[camelCaseValue]) && (depth !== maxDepth)) {
1230
+ object = object[camelCaseValue];
1231
+ } else if (object[camelCaseValue] !== undefined) {
1232
+ found = object[camelCaseValue];
1233
+
1234
+ return false;
1235
+ } else if ($.isPlainObject(object[value]) && (depth !== maxDepth)) {
1236
+ object = object[value];
1237
+ } else if (object[value] !== undefined) {
1238
+ found = object[value];
1239
+
1240
+ return false;
1241
+ } else {
1242
+ module.error(error.method, query);
1243
+
1244
+ return false;
1245
+ }
1246
+ });
1247
+ }
1248
+ if (isFunction(found)) {
1249
+ response = found.apply(context, passedArguments);
1250
+ } else if (found !== undefined) {
1251
+ response = found;
1252
+ }
1253
+ if (Array.isArray(returnedValue)) {
1254
+ returnedValue.push(response);
1255
+ } else if (returnedValue !== undefined) {
1256
+ returnedValue = [returnedValue, response];
1257
+ } else if (response !== undefined) {
1258
+ returnedValue = response;
1259
+ }
1260
+
1261
+ return found;
1262
+ },
1263
+ };
1264
+
1265
+ if (methodInvoked) {
1266
+ if (instance === undefined) {
1267
+ module.initialize();
370
1268
  }
371
- secondThumbVal = value;
372
- }
373
- value = Math.abs(thumbVal - (secondThumbVal || 0));
374
- module.update.position(thumbSmoothVal);
375
- settings.onMove.call(element, value, thumbVal, secondThumbVal);
1269
+ module.invoke(query);
376
1270
  } else {
377
- module.update.value(value, function(value, thumbVal, secondThumbVal) {
378
- settings.onMove.call(element, value, thumbVal, secondThumbVal);
379
- });
380
- }
381
- },
382
- up: function(event) {
383
- event.preventDefault();
384
- if(module.is.disabled()) {
385
- // touch events are always bound, so we need to prevent touch-sliding on disabled sliders here
386
- return;
387
- }
388
- var value = module.determine.valueFromEvent(event);
389
- module.set.value(value);
390
- module.unbind.slidingEvents();
391
- touchIdentifier = undefined;
392
- if (previousValue !== undefined) {
393
- previousValue = undefined;
394
- }
395
- },
396
- touchCancel: function(event) {
397
- event.preventDefault();
398
- touchIdentifier = undefined;
399
- if (previousValue !== undefined) {
400
- module.update.value(previousValue);
401
- previousValue = undefined;
402
- }
403
- },
404
- keydown: function(event, first) {
405
- if(settings.preventCrossover && module.is.range() && module.thumbVal === module.secondThumbVal) {
406
- $currThumb = undefined;
407
- }
408
- if(module.is.focused()) {
409
- $(document).trigger(event);
410
- }
411
- if(first || module.is.focused()) {
412
- var step = module.determine.keyMovement(event);
413
- if(step != NO_STEP) {
414
- event.preventDefault();
415
- switch(step) {
416
- case SINGLE_STEP:
417
- module.takeStep();
418
- break;
419
- case BIG_STEP:
420
- module.takeStep(module.get.multiplier());
421
- break;
422
- case SINGLE_BACKSTEP:
423
- module.backStep();
424
- break;
425
- case BIG_BACKSTEP:
426
- module.backStep(module.get.multiplier());
427
- break;
1271
+ if (instance !== undefined) {
1272
+ instance.invoke('destroy');
428
1273
  }
429
- }
430
- }
431
- },
432
- activateFocus: function(event) {
433
- if(!module.is.focused() && module.is.hover() && module.determine.keyMovement(event) != NO_STEP) {
434
- event.preventDefault();
435
- module.event.keydown(event, true);
436
- $module.focus();
1274
+ module.initialize();
437
1275
  }
438
- },
439
- resize: function(_event) {
440
- // To avoid a useless performance cost, we only call the label refresh when its necessary
441
- if (gapRatio != module.get.gapRatio()) {
442
- module.setup.labels();
443
- gapRatio = module.get.gapRatio();
444
- }
445
- }
446
- },
1276
+ });
447
1277
 
448
- resync: function() {
449
- module.verbose('Resyncing thumb position based on value');
450
- if(module.is.range()) {
451
- module.update.position(module.secondThumbVal, $secondThumb);
452
- }
453
- module.update.position(module.thumbVal, $thumb);
454
- module.setup.labels();
455
- },
456
- takeStep: function(multiplier) {
457
- multiplier = multiplier != undefined ? multiplier : 1;
458
- var
459
- step = module.get.step(),
460
- currValue = module.get.currentThumbValue()
461
- ;
462
- module.verbose('Taking a step');
463
- if(step > 0) {
464
- module.set.value(currValue + step * multiplier);
465
- } else if (step == 0){
466
- var
467
- precision = module.get.precision(),
468
- newValue = currValue + (multiplier/precision)
469
- ;
470
- module.set.value(Math.round(newValue * precision) / precision);
471
- }
472
- },
1278
+ return returnedValue !== undefined
1279
+ ? returnedValue
1280
+ : this;
1281
+ };
473
1282
 
474
- backStep: function(multiplier) {
475
- multiplier = multiplier != undefined ? multiplier : 1;
476
- var
477
- step = module.get.step(),
478
- currValue = module.get.currentThumbValue()
479
- ;
480
- module.verbose('Going back a step');
481
- if(step > 0) {
482
- module.set.value(currValue - step * multiplier);
483
- } else if (step == 0) {
484
- var
485
- precision = module.get.precision(),
486
- newValue = currValue - (multiplier/precision)
487
- ;
488
- module.set.value(Math.round(newValue * precision) / precision);
489
- }
490
- },
1283
+ $.fn.slider.settings = {
491
1284
 
492
- is: {
493
- range: function() {
494
- return $module.hasClass(settings.className.range);
495
- },
496
- hover: function() {
497
- return isHover;
498
- },
499
- focused: function() {
500
- return $module.is(':focus');
501
- },
502
- disabled: function() {
503
- return $module.hasClass(settings.className.disabled);
504
- },
505
- labeled: function() {
506
- return $module.hasClass(settings.className.labeled);
507
- },
508
- reversed: function() {
509
- return $module.hasClass(settings.className.reversed);
510
- },
511
- vertical: function() {
512
- return $module.hasClass(settings.className.vertical);
513
- },
514
- smooth: function() {
515
- return settings.smooth || $module.hasClass(settings.className.smooth);
516
- }
517
- },
1285
+ silent: false,
1286
+ debug: false,
1287
+ verbose: false,
1288
+ performance: true,
518
1289
 
519
- get: {
520
- trackOffset: function() {
521
- if (module.is.vertical()) {
522
- return $track.offset().top;
523
- } else {
524
- return $track.offset().left;
525
- }
526
- },
527
- trackLength: function() {
528
- if (module.is.vertical()) {
529
- return $track.height();
530
- } else {
531
- return $track.width();
532
- }
533
- },
534
- trackLeft: function() {
535
- if (module.is.vertical()) {
536
- return $track.position().top;
537
- } else {
538
- return $track.position().left;
539
- }
540
- },
541
- trackStartPos: function() {
542
- return module.is.reversed() ? module.get.trackLeft() + module.get.trackLength() : module.get.trackLeft();
543
- },
544
- trackEndPos: function() {
545
- return module.is.reversed() ? module.get.trackLeft() : module.get.trackLeft() + module.get.trackLength();
546
- },
547
- trackStartMargin: function () {
548
- var margin;
549
- if (module.is.vertical()) {
550
- margin = module.is.reversed() ? $module.css('padding-bottom') : $module.css('padding-top');
551
- } else {
552
- margin = module.is.reversed() ? $module.css('padding-right') : $module.css('padding-left');
553
- }
554
- return margin || '0px';
555
- },
556
- trackEndMargin: function () {
557
- var margin;
558
- if (module.is.vertical()) {
559
- margin = module.is.reversed() ? $module.css('padding-top') : $module.css('padding-bottom');
560
- } else {
561
- margin = module.is.reversed() ? $module.css('padding-left') : $module.css('padding-right');
562
- }
563
- return margin || '0px';
564
- },
565
- precision: function() {
566
- var
567
- decimalPlaces,
568
- step = module.get.step()
569
- ;
570
- if(step != 0) {
571
- var split = String(step).split('.');
572
- if(split.length == 2) {
573
- decimalPlaces = split[1].length;
574
- } else {
575
- decimalPlaces = 0;
576
- }
577
- } else {
578
- decimalPlaces = settings.decimalPlaces;
579
- }
580
- var precision = Math.pow(10, decimalPlaces);
581
- module.debug('Precision determined', precision);
582
- return precision;
583
- },
584
- min: function() {
585
- return settings.min;
586
- },
587
- max: function() {
588
- var step = module.get.step(),
589
- min = module.get.min(),
590
- quotient = step === 0 ? 0 : Math.floor((settings.max - min) / step),
591
- remainder = step === 0 ? 0 : (settings.max - min) % step;
592
- return remainder === 0 ? settings.max : min + quotient * step;
593
- },
594
- step: function() {
595
- return settings.step;
596
- },
597
- numLabels: function() {
598
- var value = Math.round((module.get.max() - module.get.min()) / (module.get.step() === 0 ? 1 : module.get.step()));
599
- module.debug('Determined that there should be ' + value + ' labels');
600
- return value;
601
- },
602
- labelType: function() {
603
- return settings.labelType;
604
- },
605
- label: function(value) {
606
- if(interpretLabel) {
607
- return interpretLabel(value);
608
- }
1290
+ name: 'Slider',
1291
+ namespace: 'slider',
609
1292
 
610
- switch (settings.labelType) {
611
- case settings.labelTypes.number:
612
- return Math.round(((value * (module.get.step() === 0 ? 1 : module.get.step())) + module.get.min()) * precision ) / precision;
613
- case settings.labelTypes.letter:
614
- return alphabet[(value) % 26];
615
- default:
616
- return value;
617
- }
618
- },
619
- value: function() {
620
- return value;
621
- },
622
- currentThumbValue: function() {
623
- return $currThumb !== undefined && $currThumb.hasClass('second') ? module.secondThumbVal : module.thumbVal;
624
- },
625
- thumbValue: function(which) {
626
- switch(which) {
627
- case 'second':
628
- if(module.is.range()) {
629
- return module.secondThumbVal;
630
- }
631
- else {
632
- module.error(error.notrange);
633
- break;
634
- }
635
- case 'first':
636
- default:
637
- return module.thumbVal;
638
- }
639
- },
640
- multiplier: function() {
641
- return settings.pageMultiplier;
642
- },
643
- thumbPosition: function(which) {
644
- switch(which) {
645
- case 'second':
646
- if(module.is.range()) {
647
- return secondPos;
648
- }
649
- else {
650
- module.error(error.notrange);
651
- break;
652
- }
653
- case 'first':
654
- default:
655
- return position;
656
- }
657
- },
658
- gapRatio: function() {
659
- var gapRatio = 1;
660
-
661
- if( settings.autoAdjustLabels ) {
662
- var
663
- numLabels = module.get.numLabels(),
664
- trackLength = module.get.trackLength(),
665
- gapCounter = 1
666
- ;
667
-
668
- // While the distance between two labels is too short,
669
- // we divide the number of labels at each iteration
670
- // and apply only if the modulo of the operation is an odd number.
671
- if(trackLength>0){
672
- while ((trackLength / numLabels) * gapCounter < settings.labelDistance) {
673
- if( !(numLabels % gapCounter) ) {
674
- gapRatio = gapCounter;
675
- }
676
- gapCounter += 1;
677
- }
678
- }
679
- }
680
- return gapRatio;
681
- }
1293
+ error: {
1294
+ method: 'The method you called is not defined.',
1295
+ notrange: 'This slider is not a range slider',
682
1296
  },
683
1297
 
684
- determine: {
685
- pos: function(pagePos) {
686
- return module.is.reversed()
687
- ?
688
- module.get.trackStartPos() - pagePos + module.get.trackOffset()
689
- :
690
- pagePos - module.get.trackOffset() - module.get.trackStartPos()
691
- ;
692
- },
693
- closestThumb: function(eventPos) {
694
- var
695
- thumbPos = parseFloat(module.determine.thumbPos($thumb)),
696
- thumbDelta = Math.abs(eventPos - thumbPos),
697
- secondThumbPos = parseFloat(module.determine.thumbPos($secondThumb)),
698
- secondThumbDelta = Math.abs(eventPos - secondThumbPos)
699
- ;
700
- if(thumbDelta === secondThumbDelta && module.get.thumbValue() === module.get.min()) {
701
- return $secondThumb;
702
- }
703
- return thumbDelta <= secondThumbDelta ? $thumb : $secondThumb;
704
- },
705
- closestThumbPos: function(eventPos) {
706
- var
707
- thumbPos = parseFloat(module.determine.thumbPos($thumb)),
708
- thumbDelta = Math.abs(eventPos - thumbPos),
709
- secondThumbPos = parseFloat(module.determine.thumbPos($secondThumb)),
710
- secondThumbDelta = Math.abs(eventPos - secondThumbPos)
711
- ;
712
- return thumbDelta <= secondThumbDelta ? thumbPos : secondThumbPos;
713
- },
714
- thumbPos: function($element) {
715
- var pos =
716
- module.is.vertical()
717
- ?
718
- module.is.reversed() ? $element.css('bottom') : $element.css('top')
719
- :
720
- module.is.reversed() ? $element.css('right') : $element.css('left')
721
- ;
722
- return pos;
723
- },
724
- positionFromValue: function(val) {
725
- var
726
- min = module.get.min(),
727
- max = module.get.max(),
728
- value = val > max ? max : val < min ? min : val,
729
- trackLength = module.get.trackLength(),
730
- ratio = (value - min) / (max - min),
731
- position = Math.round(ratio * trackLength)
732
- ;
733
- module.verbose('Determined position: ' + position + ' from value: ' + value);
734
- return position;
735
- },
736
- positionFromRatio: function(ratio) {
737
- var
738
- trackLength = module.get.trackLength(),
739
- step = module.get.step(),
740
- position = Math.round(ratio * trackLength),
741
- adjustedPos = (step == 0) ? position : Math.round(position / step) * step
742
- ;
743
- return adjustedPos;
744
- },
745
- valueFromEvent: function(event) {
746
- var
747
- eventPos = module.determine.eventPos(event),
748
- newPos = module.determine.pos(eventPos),
749
- value
750
- ;
751
- if(eventPos < module.get.trackOffset()) {
752
- value = module.is.reversed() ? module.get.max() : module.get.min();
753
- } else if(eventPos > module.get.trackOffset() + module.get.trackLength()) {
754
- value = module.is.reversed() ? module.get.min() : module.get.max();
755
- } else {
756
- value = module.determine.value(newPos);
757
- }
758
- return value;
759
- },
760
- smoothValueFromEvent: function(event) {
761
- var
762
- min = module.get.min(),
763
- max = module.get.max(),
764
- trackLength = module.get.trackLength(),
765
- eventPos = module.determine.eventPos(event),
766
- newPos = eventPos - module.get.trackOffset(),
767
- ratio,
768
- value
769
- ;
770
- newPos = newPos < 0 ? 0 : newPos > trackLength ? trackLength : newPos;
771
- ratio = newPos / trackLength;
772
- if (module.is.reversed()) {
773
- ratio = 1 - ratio;
774
- }
775
- value = ratio * (max - min) + min;
776
- return value;
777
- },
778
- eventPos: function(event) {
779
- if(event.type === "touchmove" || event.type === "touchend") {
780
- var
781
- touchEvent = event.touches ? event : event.originalEvent,
782
- touch = touchEvent.changedTouches[0]; // fall back to first touch if correct touch not found
783
- for(var i=0; i < touchEvent.touches.length; i++) {
784
- if(touchEvent.touches[i].identifier === touchIdentifier) {
785
- touch = touchEvent.touches[i];
786
- break;
787
- }
788
- }
789
- var
790
- touchY = touch.pageY,
791
- touchX = touch.pageX
792
- ;
793
- return module.is.vertical() ? touchY : touchX;
794
- }
795
- var
796
- clickY = event.pageY || event.originalEvent.pageY,
797
- clickX = event.pageX || event.originalEvent.pageX
798
- ;
799
- return module.is.vertical() ? clickY : clickX;
800
- },
801
- value: function(position) {
802
- var
803
- startPos = module.is.reversed() ? module.get.trackEndPos() : module.get.trackStartPos(),
804
- endPos = module.is.reversed() ? module.get.trackStartPos() : module.get.trackEndPos(),
805
- ratio = (position - startPos) / (endPos - startPos),
806
- range = module.get.max() - module.get.min(),
807
- step = module.get.step(),
808
- value = (ratio * range),
809
- difference = (step == 0) ? value : Math.round(value / step) * step
810
- ;
811
- module.verbose('Determined value based upon position: ' + position + ' as: ' + value);
812
- if(value != difference) {
813
- module.verbose('Rounding value to closest step: ' + difference);
814
- }
815
- // Use precision to avoid ugly Javascript floating point rounding issues
816
- // (like 35 * .01 = 0.35000000000000003)
817
- module.verbose('Cutting off additional decimal places');
818
- return Math.round((difference + module.get.min()) * precision) / precision;
819
- },
820
- keyMovement: function(event) {
821
- var
822
- key = event.which,
823
- downArrow =
824
- module.is.vertical()
825
- ?
826
- module.is.reversed() ? keys.downArrow : keys.upArrow
827
- :
828
- keys.downArrow
829
- ,
830
- upArrow =
831
- module.is.vertical()
832
- ?
833
- module.is.reversed() ? keys.upArrow : keys.downArrow
834
- :
835
- keys.upArrow
836
- ,
837
- leftArrow =
838
- !module.is.vertical()
839
- ?
840
- module.is.reversed() ? keys.rightArrow : keys.leftArrow
841
- :
842
- keys.leftArrow
843
- ,
844
- rightArrow =
845
- !module.is.vertical()
846
- ?
847
- module.is.reversed() ? keys.leftArrow : keys.rightArrow
848
- :
849
- keys.rightArrow
850
- ;
851
- if(key == downArrow || key == leftArrow) {
852
- return SINGLE_BACKSTEP;
853
- } else if(key == upArrow || key == rightArrow) {
854
- return SINGLE_STEP;
855
- } else if (key == keys.pageDown) {
856
- return BIG_BACKSTEP;
857
- } else if (key == keys.pageUp) {
858
- return BIG_STEP;
859
- } else {
860
- return NO_STEP;
861
- }
862
- }
1298
+ metadata: {
1299
+ thumbVal: 'thumbVal',
1300
+ secondThumbVal: 'secondThumbVal',
863
1301
  },
864
1302
 
865
- handleNewValuePosition: function(val) {
866
- var
867
- min = module.get.min(),
868
- max = module.get.max(),
869
- newPos
870
- ;
871
- if (val <= min) {
872
- val = min;
873
- } else if (val >= max) {
874
- val = max;
875
- }
876
- newPos = module.determine.positionFromValue(val);
877
- return newPos;
1303
+ min: 0,
1304
+ max: 20,
1305
+ step: 1,
1306
+ start: 0,
1307
+ end: 20,
1308
+ labelType: 'number',
1309
+ showLabelTicks: false,
1310
+ smooth: false,
1311
+ autoAdjustLabels: true,
1312
+ labelDistance: 100,
1313
+ preventCrossover: true,
1314
+ fireOnInit: false,
1315
+ interpretLabel: false,
1316
+
1317
+ // the decimal place to round to if step is undefined
1318
+ decimalPlaces: 2,
1319
+
1320
+ // page up/down multiplier. How many more times the steps to take on page up/down press
1321
+ pageMultiplier: 2,
1322
+
1323
+ selector: {},
1324
+
1325
+ className: {
1326
+ reversed: 'reversed',
1327
+ disabled: 'disabled',
1328
+ labeled: 'labeled',
1329
+ ticked: 'ticked',
1330
+ vertical: 'vertical',
1331
+ range: 'range',
1332
+ smooth: 'smooth',
878
1333
  },
879
1334
 
880
- set: {
881
- value: function(newValue, fireChange) {
882
- fireChange = fireChange !== false;
883
- var toReset = previousValue === undefined;
884
- previousValue = previousValue === undefined ? module.get.value() : previousValue;
885
- module.update.value(newValue, function(value, thumbVal, secondThumbVal) {
886
- if ((!initialLoad || settings.fireOnInit) && fireChange){
887
- if (newValue !== previousValue) {
888
- settings.onChange.call(element, value, thumbVal, secondThumbVal);
889
- }
890
- settings.onMove.call(element, value, thumbVal, secondThumbVal);
891
- }
892
- if (toReset) {
893
- previousValue = undefined;
894
- }
895
- });
896
- },
897
- rangeValue: function(first, second, fireChange) {
898
- fireChange = fireChange !== false;
899
- if(module.is.range()) {
900
- var
901
- min = module.get.min(),
902
- max = module.get.max(),
903
- toReset = previousValue === undefined
904
- ;
905
- previousValue = previousValue === undefined ? module.get.value() : previousValue;
906
- if (first <= min) {
907
- first = min;
908
- } else if(first >= max){
909
- first = max;
910
- }
911
- if (second <= min) {
912
- second = min;
913
- } else if(second >= max){
914
- second = max;
915
- }
916
- module.thumbVal = first;
917
- module.secondThumbVal = second;
918
- value = Math.abs(module.thumbVal - module.secondThumbVal);
919
- module.update.position(module.thumbVal, $thumb);
920
- module.update.position(module.secondThumbVal, $secondThumb);
921
- if ((!initialLoad || settings.fireOnInit) && fireChange) {
922
- if (value !== previousValue) {
923
- settings.onChange.call(element, value, module.thumbVal, module.secondThumbVal);
924
- }
925
- settings.onMove.call(element, value, module.thumbVal, module.secondThumbVal);
926
- }
927
- if (toReset) {
928
- previousValue = undefined;
929
- }
930
- } else {
931
- module.error(error.notrange);
932
- }
933
- },
934
- position: function(position, which) {
935
- var thumbVal = module.determine.value(position);
936
- if (which === 'second') {
937
- module.secondThumbVal = thumbVal;
938
- module.update.position(thumbVal, $secondThumb);
939
- } else {
940
- module.thumbVal = thumbVal;
941
- module.update.position(thumbVal, $thumb);
942
- }
943
- value = Math.abs(module.thumbVal - (module.secondThumbVal || 0));
944
- module.set.value(value);
945
- }
1335
+ keys: {
1336
+ pageUp: 33,
1337
+ pageDown: 34,
1338
+ leftArrow: 37,
1339
+ upArrow: 38,
1340
+ rightArrow: 39,
1341
+ downArrow: 40,
946
1342
  },
947
1343
 
948
- update: {
949
- value: function(newValue, callback) {
950
- var
951
- min = module.get.min(),
952
- max = module.get.max()
953
- ;
954
- if (newValue <= min) {
955
- newValue = min;
956
- } else if(newValue >= max){
957
- newValue = max;
958
- }
959
- if(!module.is.range()) {
960
- value = newValue;
961
- module.thumbVal = value;
962
- } else {
963
- if($currThumb === undefined) {
964
- $currThumb = newValue <= module.get.currentThumbValue() ? $thumb : $secondThumb;
965
- }
966
- if(!$currThumb.hasClass('second')) {
967
- if(settings.preventCrossover && module.is.range()) {
968
- newValue = Math.min(module.secondThumbVal, newValue);
969
- }
970
- module.thumbVal = newValue;
971
- } else {
972
- if(settings.preventCrossover && module.is.range()) {
973
- newValue = Math.max(module.thumbVal, newValue);
974
- }
975
- module.secondThumbVal = newValue;
976
- }
977
- value = Math.abs(module.thumbVal - module.secondThumbVal);
978
- }
979
- module.update.position(newValue);
980
- module.debug('Setting slider value to ' + value);
981
- if(typeof callback === 'function') {
982
- callback(value, module.thumbVal, module.secondThumbVal);
983
- }
984
- },
985
- position: function(newValue, $element) {
986
- var
987
- newPos = module.handleNewValuePosition(newValue),
988
- $targetThumb = $element != undefined ? $element : $currThumb,
989
- thumbVal = module.thumbVal || module.get.min(),
990
- secondThumbVal = module.secondThumbVal || module.get.min()
991
- ;
992
- if(module.is.range()) {
993
- if(!$targetThumb.hasClass('second')) {
994
- position = newPos;
995
- thumbVal = newValue;
996
- } else {
997
- secondPos = newPos;
998
- secondThumbVal = newValue;
999
- }
1000
- } else {
1001
- position = newPos;
1002
- thumbVal = newValue;
1003
- }
1004
- var
1005
- trackPosValue,
1006
- thumbPosValue,
1007
- min = module.get.min(),
1008
- max = module.get.max(),
1009
- thumbPosPercent = 100 * (newValue - min) / (max - min),
1010
- trackStartPosPercent = 100 * (Math.min(thumbVal, secondThumbVal) - min) / (max - min),
1011
- trackEndPosPercent = 100 * (1 - (Math.max(thumbVal, secondThumbVal) - min) / (max - min))
1012
- ;
1013
- if (module.is.vertical()) {
1014
- if (module.is.reversed()) {
1015
- thumbPosValue = {bottom: 'calc(' + thumbPosPercent + '% - ' + offset + 'px)', top: 'auto'};
1016
- trackPosValue = {bottom: trackStartPosPercent + '%', top: trackEndPosPercent + '%'};
1017
- }
1018
- else {
1019
- thumbPosValue = {top: 'calc(' + thumbPosPercent + '% - ' + offset + 'px)', bottom: 'auto'};
1020
- trackPosValue = {top: trackStartPosPercent + '%', bottom: trackEndPosPercent + '%'};
1021
- }
1022
- } else {
1023
- if (module.is.reversed()) {
1024
- thumbPosValue = {right: 'calc(' + thumbPosPercent + '% - ' + offset + 'px)', left: 'auto'};
1025
- trackPosValue = {right: trackStartPosPercent + '%', left: trackEndPosPercent + '%'};
1026
- }
1027
- else {
1028
- thumbPosValue = {left: 'calc(' + thumbPosPercent + '% - ' + offset + 'px)', right: 'auto'};
1029
- trackPosValue = {left: trackStartPosPercent + '%', right: trackEndPosPercent + '%'};
1030
- }
1031
- }
1032
- $targetThumb.css(thumbPosValue);
1033
- $trackFill.css(trackPosValue);
1034
- module.debug('Setting slider position to ' + newPos);
1035
- },
1036
- labelPosition: function (ratio, $label) {
1037
- var
1038
- startMargin = module.get.trackStartMargin(),
1039
- endMargin = module.get.trackEndMargin(),
1040
- posDir =
1041
- module.is.vertical()
1042
- ?
1043
- module.is.reversed() ? 'bottom' : 'top'
1044
- :
1045
- module.is.reversed() ? 'right' : 'left',
1046
- startMarginMod = module.is.reversed() && !module.is.vertical() ? ' - ' : ' + '
1047
- ;
1048
- var position = '(100% - ' + startMargin + ' - ' + endMargin + ') * ' + ratio;
1049
- $label.css(posDir, 'calc(' + position + startMarginMod + startMargin + ')');
1050
- }
1051
- },
1052
-
1053
- goto: {
1054
- max: function() {
1055
- module.set.value(module.get.max());
1056
- },
1057
- min: function() {
1058
- module.set.value(module.get.min());
1059
- },
1060
- },
1061
-
1062
- read: {
1063
- metadata: function() {
1064
- var
1065
- data = {
1066
- thumbVal : $module.data(metadata.thumbVal),
1067
- secondThumbVal : $module.data(metadata.secondThumbVal)
1068
- }
1069
- ;
1070
- if(data.thumbVal) {
1071
- if(module.is.range() && data.secondThumbVal) {
1072
- module.debug('Current value set from metadata', data.thumbVal, data.secondThumbVal);
1073
- module.set.rangeValue(data.thumbVal, data.secondThumbVal);
1074
- } else {
1075
- module.debug('Current value set from metadata', data.thumbVal);
1076
- module.set.value(data.thumbVal);
1077
- }
1078
- }
1079
- },
1080
- settings: function() {
1081
- if(settings.start !== false) {
1082
- if(module.is.range()) {
1083
- module.debug('Start position set from settings', settings.start, settings.end);
1084
- module.set.rangeValue(settings.start, settings.end);
1085
- } else {
1086
- module.debug('Start position set from settings', settings.start);
1087
- module.set.value(settings.start);
1088
- }
1089
- }
1090
- }
1091
- },
1092
-
1093
- setting: function(name, value) {
1094
- module.debug('Changing setting', name, value);
1095
- if( $.isPlainObject(name) ) {
1096
- $.extend(true, settings, name);
1097
- }
1098
- else if(value !== undefined) {
1099
- if($.isPlainObject(settings[name])) {
1100
- $.extend(true, settings[name], value);
1101
- }
1102
- else {
1103
- settings[name] = value;
1104
- }
1105
- }
1106
- else {
1107
- return settings[name];
1108
- }
1109
- },
1110
- internal: function(name, value) {
1111
- if( $.isPlainObject(name) ) {
1112
- $.extend(true, module, name);
1113
- }
1114
- else if(value !== undefined) {
1115
- module[name] = value;
1116
- }
1117
- else {
1118
- return module[name];
1119
- }
1120
- },
1121
- debug: function() {
1122
- if(!settings.silent && settings.debug) {
1123
- if(settings.performance) {
1124
- module.performance.log(arguments);
1125
- }
1126
- else {
1127
- module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
1128
- module.debug.apply(console, arguments);
1129
- }
1130
- }
1131
- },
1132
- verbose: function() {
1133
- if(!settings.silent && settings.verbose && settings.debug) {
1134
- if(settings.performance) {
1135
- module.performance.log(arguments);
1136
- }
1137
- else {
1138
- module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
1139
- module.verbose.apply(console, arguments);
1140
- }
1141
- }
1142
- },
1143
- error: function() {
1144
- if(!settings.silent) {
1145
- module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
1146
- module.error.apply(console, arguments);
1147
- }
1148
- },
1149
-
1150
- performance: {
1151
- log: function(message) {
1152
- var
1153
- currentTime,
1154
- executionTime,
1155
- previousTime
1156
- ;
1157
- if(settings.performance) {
1158
- currentTime = new Date().getTime();
1159
- previousTime = time || currentTime;
1160
- executionTime = currentTime - previousTime;
1161
- time = currentTime;
1162
- performance.push({
1163
- 'Name' : message[0],
1164
- 'Arguments' : [].slice.call(message, 1) || '',
1165
- 'Element' : element,
1166
- 'Execution Time' : executionTime
1167
- });
1168
- }
1169
- clearTimeout(module.performance.timer);
1170
- module.performance.timer = setTimeout(module.performance.display, 500);
1171
- },
1172
- display: function() {
1173
- var
1174
- title = settings.name + ':',
1175
- totalTime = 0
1176
- ;
1177
- time = false;
1178
- clearTimeout(module.performance.timer);
1179
- $.each(performance, function(index, data) {
1180
- totalTime += data['Execution Time'];
1181
- });
1182
- title += ' ' + totalTime + 'ms';
1183
- if(moduleSelector) {
1184
- title += ' \'' + moduleSelector + '\'';
1185
- }
1186
- if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
1187
- console.groupCollapsed(title);
1188
- if(console.table) {
1189
- console.table(performance);
1190
- }
1191
- else {
1192
- $.each(performance, function(index, data) {
1193
- console.log(data['Name'] + ': ' + data['Execution Time']+'ms');
1194
- });
1195
- }
1196
- console.groupEnd();
1197
- }
1198
- performance = [];
1199
- }
1344
+ labelTypes: {
1345
+ number: 'number',
1346
+ letter: 'letter',
1200
1347
  },
1201
1348
 
1202
- invoke: function(query, passedArguments, context) {
1203
- var
1204
- object = instance,
1205
- maxDepth,
1206
- found,
1207
- response
1208
- ;
1209
- passedArguments = passedArguments || queryArguments;
1210
- context = context || element;
1211
- if(typeof query == 'string' && object !== undefined) {
1212
- query = query.split(/[\. ]/);
1213
- maxDepth = query.length - 1;
1214
- $.each(query, function(depth, value) {
1215
- var camelCaseValue = (depth != maxDepth)
1216
- ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
1217
- : query
1218
- ;
1219
- if( $.isPlainObject( object[camelCaseValue] ) && (depth != maxDepth) ) {
1220
- object = object[camelCaseValue];
1221
- }
1222
- else if( object[camelCaseValue] !== undefined ) {
1223
- found = object[camelCaseValue];
1224
- return false;
1225
- }
1226
- else if( $.isPlainObject( object[value] ) && (depth != maxDepth) ) {
1227
- object = object[value];
1228
- }
1229
- else if( object[value] !== undefined ) {
1230
- found = object[value];
1231
- return false;
1232
- }
1233
- else {
1234
- module.error(error.method, query);
1235
- return false;
1236
- }
1237
- });
1238
- }
1239
- if ( $.isFunction( found ) ) {
1240
- response = found.apply(context, passedArguments);
1241
- }
1242
- else if(found !== undefined) {
1243
- response = found;
1244
- }
1245
- if($.isArray(returnedValue)) {
1246
- returnedValue.push(response);
1247
- }
1248
- else if(returnedValue !== undefined) {
1249
- returnedValue = [returnedValue, response];
1250
- }
1251
- else if(response !== undefined) {
1252
- returnedValue = response;
1253
- }
1254
- return found;
1255
- }
1256
- };
1257
-
1258
- if(methodInvoked) {
1259
- if(instance === undefined) {
1260
- module.initialize();
1261
- }
1262
- module.invoke(query);
1263
- }
1264
- else {
1265
- if(instance !== undefined) {
1266
- instance.invoke('destroy');
1267
- }
1268
- module.initialize();
1269
- }
1270
- })
1271
- ;
1272
-
1273
- return (returnedValue !== undefined)
1274
- ? returnedValue
1275
- : this
1276
- ;
1277
-
1278
- };
1279
-
1280
- $.fn.slider.settings = {
1281
-
1282
- silent : false,
1283
- debug : false,
1284
- verbose : false,
1285
- performance : true,
1286
-
1287
- name : 'Slider',
1288
- namespace : 'slider',
1289
-
1290
- error : {
1291
- method : 'The method you called is not defined.',
1292
- notrange : 'This slider is not a range slider'
1293
- },
1294
-
1295
- metadata: {
1296
- thumbVal : 'thumbVal',
1297
- secondThumbVal : 'secondThumbVal'
1298
- },
1299
-
1300
- min : 0,
1301
- max : 20,
1302
- step : 1,
1303
- start : 0,
1304
- end : 20,
1305
- labelType : 'number',
1306
- showLabelTicks : false,
1307
- smooth : false,
1308
- autoAdjustLabels : true,
1309
- labelDistance : 100,
1310
- preventCrossover : true,
1311
- fireOnInit : false,
1312
- interpretLabel : false,
1313
-
1314
- //the decimal place to round to if step is undefined
1315
- decimalPlaces : 2,
1316
-
1317
- // page up/down multiplier. How many more times the steps to take on page up/down press
1318
- pageMultiplier : 2,
1319
-
1320
- selector: {
1321
-
1322
- },
1323
-
1324
- className : {
1325
- reversed : 'reversed',
1326
- disabled : 'disabled',
1327
- labeled : 'labeled',
1328
- ticked : 'ticked',
1329
- vertical : 'vertical',
1330
- range : 'range',
1331
- smooth : 'smooth'
1332
- },
1333
-
1334
- keys : {
1335
- pageUp : 33,
1336
- pageDown : 34,
1337
- leftArrow : 37,
1338
- upArrow : 38,
1339
- rightArrow : 39,
1340
- downArrow : 40
1341
- },
1342
-
1343
- labelTypes : {
1344
- number : 'number',
1345
- letter : 'letter'
1346
- },
1347
-
1348
- onChange : function(value, thumbVal, secondThumbVal){},
1349
- onMove : function(value, thumbVal, secondThumbVal){},
1350
- };
1351
-
1352
-
1353
- })( jQuery, window, document );
1349
+ onChange: function (value, thumbVal, secondThumbVal) {},
1350
+ onMove: function (value, thumbVal, secondThumbVal) {},
1351
+ };
1352
+ })(jQuery, window, document);