pageflow 17.0.1 → 17.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/entry_types/scrolled/package/frontend/index.css +1 -1
- data/lib/pageflow/version.rb +1 -1
- data/package/config/jest/index.js +9 -9
- data/package/vendor/backbone.babysitter.js +168 -0
- data/package/vendor/backbone.js +1574 -0
- data/package/vendor/backbone.marionette.js +2369 -0
- data/package/vendor/cocktail.js +81 -0
- data/package/vendor/i18n.js +453 -0
- data/package/vendor/iscroll.js +1834 -0
- data/package/vendor/jquery-ui/core.js +305 -0
- data/package/vendor/jquery-ui/datepicker.js +2084 -0
- data/package/vendor/jquery-ui/index.js +8 -0
- data/package/vendor/jquery-ui/menu.js +651 -0
- data/package/vendor/jquery-ui/mouse.js +199 -0
- data/package/vendor/jquery-ui/selectmenu.js +621 -0
- data/package/vendor/jquery-ui/slider.js +717 -0
- data/package/vendor/jquery-ui/sortable.js +1315 -0
- data/package/vendor/jquery-ui/widget.js +559 -0
- data/package/vendor/jquery.js +11009 -0
- data/package/vendor/jquery.minicolors.js +1108 -0
- data/package/vendor/underscore.js +1246 -0
- metadata +19 -1
@@ -0,0 +1,717 @@
|
|
1
|
+
/*!
|
2
|
+
* jQuery UI Slider 1.11.4
|
3
|
+
* http://jqueryui.com
|
4
|
+
*
|
5
|
+
* Copyright jQuery Foundation and other contributors
|
6
|
+
* Released under the MIT license.
|
7
|
+
* http://jquery.org/license
|
8
|
+
*
|
9
|
+
* http://api.jqueryui.com/slider/
|
10
|
+
*/
|
11
|
+
(function( factory ) {
|
12
|
+
if ( typeof define === "function" && define.amd ) {
|
13
|
+
|
14
|
+
// AMD. Register as an anonymous module.
|
15
|
+
define([
|
16
|
+
"jquery",
|
17
|
+
"./core",
|
18
|
+
"./mouse",
|
19
|
+
"./widget"
|
20
|
+
], factory );
|
21
|
+
} else {
|
22
|
+
|
23
|
+
// Browser globals
|
24
|
+
factory( require('jquery') );
|
25
|
+
}
|
26
|
+
}(function( $ ) {
|
27
|
+
|
28
|
+
return $.widget( "ui.slider", $.ui.mouse, {
|
29
|
+
version: "1.11.4",
|
30
|
+
widgetEventPrefix: "slide",
|
31
|
+
|
32
|
+
options: {
|
33
|
+
animate: false,
|
34
|
+
distance: 0,
|
35
|
+
max: 100,
|
36
|
+
min: 0,
|
37
|
+
orientation: "horizontal",
|
38
|
+
range: false,
|
39
|
+
step: 1,
|
40
|
+
value: 0,
|
41
|
+
values: null,
|
42
|
+
|
43
|
+
// callbacks
|
44
|
+
change: null,
|
45
|
+
slide: null,
|
46
|
+
start: null,
|
47
|
+
stop: null
|
48
|
+
},
|
49
|
+
|
50
|
+
// number of pages in a slider
|
51
|
+
// (how many times can you page up/down to go through the whole range)
|
52
|
+
numPages: 5,
|
53
|
+
|
54
|
+
_create: function() {
|
55
|
+
this._keySliding = false;
|
56
|
+
this._mouseSliding = false;
|
57
|
+
this._animateOff = true;
|
58
|
+
this._handleIndex = null;
|
59
|
+
this._detectOrientation();
|
60
|
+
this._mouseInit();
|
61
|
+
this._calculateNewMax();
|
62
|
+
|
63
|
+
this.element
|
64
|
+
.addClass( "ui-slider" +
|
65
|
+
" ui-slider-" + this.orientation +
|
66
|
+
" ui-widget" +
|
67
|
+
" ui-widget-content" +
|
68
|
+
" ui-corner-all");
|
69
|
+
|
70
|
+
this._refresh();
|
71
|
+
this._setOption( "disabled", this.options.disabled );
|
72
|
+
|
73
|
+
this._animateOff = false;
|
74
|
+
},
|
75
|
+
|
76
|
+
_refresh: function() {
|
77
|
+
this._createRange();
|
78
|
+
this._createHandles();
|
79
|
+
this._setupEvents();
|
80
|
+
this._refreshValue();
|
81
|
+
},
|
82
|
+
|
83
|
+
_createHandles: function() {
|
84
|
+
var i, handleCount,
|
85
|
+
options = this.options,
|
86
|
+
existingHandles = this.element.find( ".ui-slider-handle" ).addClass( "ui-state-default ui-corner-all" ),
|
87
|
+
handle = "<span class='ui-slider-handle ui-state-default ui-corner-all' tabindex='0'></span>",
|
88
|
+
handles = [];
|
89
|
+
|
90
|
+
handleCount = ( options.values && options.values.length ) || 1;
|
91
|
+
|
92
|
+
if ( existingHandles.length > handleCount ) {
|
93
|
+
existingHandles.slice( handleCount ).remove();
|
94
|
+
existingHandles = existingHandles.slice( 0, handleCount );
|
95
|
+
}
|
96
|
+
|
97
|
+
for ( i = existingHandles.length; i < handleCount; i++ ) {
|
98
|
+
handles.push( handle );
|
99
|
+
}
|
100
|
+
|
101
|
+
this.handles = existingHandles.add( $( handles.join( "" ) ).appendTo( this.element ) );
|
102
|
+
|
103
|
+
this.handle = this.handles.eq( 0 );
|
104
|
+
|
105
|
+
this.handles.each(function( i ) {
|
106
|
+
$( this ).data( "ui-slider-handle-index", i );
|
107
|
+
});
|
108
|
+
},
|
109
|
+
|
110
|
+
_createRange: function() {
|
111
|
+
var options = this.options,
|
112
|
+
classes = "";
|
113
|
+
|
114
|
+
if ( options.range ) {
|
115
|
+
if ( options.range === true ) {
|
116
|
+
if ( !options.values ) {
|
117
|
+
options.values = [ this._valueMin(), this._valueMin() ];
|
118
|
+
} else if ( options.values.length && options.values.length !== 2 ) {
|
119
|
+
options.values = [ options.values[0], options.values[0] ];
|
120
|
+
} else if ( $.isArray( options.values ) ) {
|
121
|
+
options.values = options.values.slice(0);
|
122
|
+
}
|
123
|
+
}
|
124
|
+
|
125
|
+
if ( !this.range || !this.range.length ) {
|
126
|
+
this.range = $( "<div></div>" )
|
127
|
+
.appendTo( this.element );
|
128
|
+
|
129
|
+
classes = "ui-slider-range" +
|
130
|
+
// note: this isn't the most fittingly semantic framework class for this element,
|
131
|
+
// but worked best visually with a variety of themes
|
132
|
+
" ui-widget-header ui-corner-all";
|
133
|
+
} else {
|
134
|
+
this.range.removeClass( "ui-slider-range-min ui-slider-range-max" )
|
135
|
+
// Handle range switching from true to min/max
|
136
|
+
.css({
|
137
|
+
"left": "",
|
138
|
+
"bottom": ""
|
139
|
+
});
|
140
|
+
}
|
141
|
+
|
142
|
+
this.range.addClass( classes +
|
143
|
+
( ( options.range === "min" || options.range === "max" ) ? " ui-slider-range-" + options.range : "" ) );
|
144
|
+
} else {
|
145
|
+
if ( this.range ) {
|
146
|
+
this.range.remove();
|
147
|
+
}
|
148
|
+
this.range = null;
|
149
|
+
}
|
150
|
+
},
|
151
|
+
|
152
|
+
_setupEvents: function() {
|
153
|
+
this._off( this.handles );
|
154
|
+
this._on( this.handles, this._handleEvents );
|
155
|
+
this._hoverable( this.handles );
|
156
|
+
this._focusable( this.handles );
|
157
|
+
},
|
158
|
+
|
159
|
+
_destroy: function() {
|
160
|
+
this.handles.remove();
|
161
|
+
if ( this.range ) {
|
162
|
+
this.range.remove();
|
163
|
+
}
|
164
|
+
|
165
|
+
this.element
|
166
|
+
.removeClass( "ui-slider" +
|
167
|
+
" ui-slider-horizontal" +
|
168
|
+
" ui-slider-vertical" +
|
169
|
+
" ui-widget" +
|
170
|
+
" ui-widget-content" +
|
171
|
+
" ui-corner-all" );
|
172
|
+
|
173
|
+
this._mouseDestroy();
|
174
|
+
},
|
175
|
+
|
176
|
+
_mouseCapture: function( event ) {
|
177
|
+
var position, normValue, distance, closestHandle, index, allowed, offset, mouseOverHandle,
|
178
|
+
that = this,
|
179
|
+
o = this.options;
|
180
|
+
|
181
|
+
if ( o.disabled ) {
|
182
|
+
return false;
|
183
|
+
}
|
184
|
+
|
185
|
+
this.elementSize = {
|
186
|
+
width: this.element.outerWidth(),
|
187
|
+
height: this.element.outerHeight()
|
188
|
+
};
|
189
|
+
this.elementOffset = this.element.offset();
|
190
|
+
|
191
|
+
position = { x: event.pageX, y: event.pageY };
|
192
|
+
normValue = this._normValueFromMouse( position );
|
193
|
+
distance = this._valueMax() - this._valueMin() + 1;
|
194
|
+
this.handles.each(function( i ) {
|
195
|
+
var thisDistance = Math.abs( normValue - that.values(i) );
|
196
|
+
if (( distance > thisDistance ) ||
|
197
|
+
( distance === thisDistance &&
|
198
|
+
(i === that._lastChangedValue || that.values(i) === o.min ))) {
|
199
|
+
distance = thisDistance;
|
200
|
+
closestHandle = $( this );
|
201
|
+
index = i;
|
202
|
+
}
|
203
|
+
});
|
204
|
+
|
205
|
+
allowed = this._start( event, index );
|
206
|
+
if ( allowed === false ) {
|
207
|
+
return false;
|
208
|
+
}
|
209
|
+
this._mouseSliding = true;
|
210
|
+
|
211
|
+
this._handleIndex = index;
|
212
|
+
|
213
|
+
closestHandle
|
214
|
+
.addClass( "ui-state-active" )
|
215
|
+
.focus();
|
216
|
+
|
217
|
+
offset = closestHandle.offset();
|
218
|
+
mouseOverHandle = !$( event.target ).parents().addBack().is( ".ui-slider-handle" );
|
219
|
+
this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : {
|
220
|
+
left: event.pageX - offset.left - ( closestHandle.width() / 2 ),
|
221
|
+
top: event.pageY - offset.top -
|
222
|
+
( closestHandle.height() / 2 ) -
|
223
|
+
( parseInt( closestHandle.css("borderTopWidth"), 10 ) || 0 ) -
|
224
|
+
( parseInt( closestHandle.css("borderBottomWidth"), 10 ) || 0) +
|
225
|
+
( parseInt( closestHandle.css("marginTop"), 10 ) || 0)
|
226
|
+
};
|
227
|
+
|
228
|
+
if ( !this.handles.hasClass( "ui-state-hover" ) ) {
|
229
|
+
this._slide( event, index, normValue );
|
230
|
+
}
|
231
|
+
this._animateOff = true;
|
232
|
+
return true;
|
233
|
+
},
|
234
|
+
|
235
|
+
_mouseStart: function() {
|
236
|
+
return true;
|
237
|
+
},
|
238
|
+
|
239
|
+
_mouseDrag: function( event ) {
|
240
|
+
var position = { x: event.pageX, y: event.pageY },
|
241
|
+
normValue = this._normValueFromMouse( position );
|
242
|
+
|
243
|
+
this._slide( event, this._handleIndex, normValue );
|
244
|
+
|
245
|
+
return false;
|
246
|
+
},
|
247
|
+
|
248
|
+
_mouseStop: function( event ) {
|
249
|
+
this.handles.removeClass( "ui-state-active" );
|
250
|
+
this._mouseSliding = false;
|
251
|
+
|
252
|
+
this._stop( event, this._handleIndex );
|
253
|
+
this._change( event, this._handleIndex );
|
254
|
+
|
255
|
+
this._handleIndex = null;
|
256
|
+
this._clickOffset = null;
|
257
|
+
this._animateOff = false;
|
258
|
+
|
259
|
+
return false;
|
260
|
+
},
|
261
|
+
|
262
|
+
_detectOrientation: function() {
|
263
|
+
this.orientation = ( this.options.orientation === "vertical" ) ? "vertical" : "horizontal";
|
264
|
+
},
|
265
|
+
|
266
|
+
_normValueFromMouse: function( position ) {
|
267
|
+
var pixelTotal,
|
268
|
+
pixelMouse,
|
269
|
+
percentMouse,
|
270
|
+
valueTotal,
|
271
|
+
valueMouse;
|
272
|
+
|
273
|
+
if ( this.orientation === "horizontal" ) {
|
274
|
+
pixelTotal = this.elementSize.width;
|
275
|
+
pixelMouse = position.x - this.elementOffset.left - ( this._clickOffset ? this._clickOffset.left : 0 );
|
276
|
+
} else {
|
277
|
+
pixelTotal = this.elementSize.height;
|
278
|
+
pixelMouse = position.y - this.elementOffset.top - ( this._clickOffset ? this._clickOffset.top : 0 );
|
279
|
+
}
|
280
|
+
|
281
|
+
percentMouse = ( pixelMouse / pixelTotal );
|
282
|
+
if ( percentMouse > 1 ) {
|
283
|
+
percentMouse = 1;
|
284
|
+
}
|
285
|
+
if ( percentMouse < 0 ) {
|
286
|
+
percentMouse = 0;
|
287
|
+
}
|
288
|
+
if ( this.orientation === "vertical" ) {
|
289
|
+
percentMouse = 1 - percentMouse;
|
290
|
+
}
|
291
|
+
|
292
|
+
valueTotal = this._valueMax() - this._valueMin();
|
293
|
+
valueMouse = this._valueMin() + percentMouse * valueTotal;
|
294
|
+
|
295
|
+
return this._trimAlignValue( valueMouse );
|
296
|
+
},
|
297
|
+
|
298
|
+
_start: function( event, index ) {
|
299
|
+
var uiHash = {
|
300
|
+
handle: this.handles[ index ],
|
301
|
+
value: this.value()
|
302
|
+
};
|
303
|
+
if ( this.options.values && this.options.values.length ) {
|
304
|
+
uiHash.value = this.values( index );
|
305
|
+
uiHash.values = this.values();
|
306
|
+
}
|
307
|
+
return this._trigger( "start", event, uiHash );
|
308
|
+
},
|
309
|
+
|
310
|
+
_slide: function( event, index, newVal ) {
|
311
|
+
var otherVal,
|
312
|
+
newValues,
|
313
|
+
allowed;
|
314
|
+
|
315
|
+
if ( this.options.values && this.options.values.length ) {
|
316
|
+
otherVal = this.values( index ? 0 : 1 );
|
317
|
+
|
318
|
+
if ( ( this.options.values.length === 2 && this.options.range === true ) &&
|
319
|
+
( ( index === 0 && newVal > otherVal) || ( index === 1 && newVal < otherVal ) )
|
320
|
+
) {
|
321
|
+
newVal = otherVal;
|
322
|
+
}
|
323
|
+
|
324
|
+
if ( newVal !== this.values( index ) ) {
|
325
|
+
newValues = this.values();
|
326
|
+
newValues[ index ] = newVal;
|
327
|
+
// A slide can be canceled by returning false from the slide callback
|
328
|
+
allowed = this._trigger( "slide", event, {
|
329
|
+
handle: this.handles[ index ],
|
330
|
+
value: newVal,
|
331
|
+
values: newValues
|
332
|
+
} );
|
333
|
+
otherVal = this.values( index ? 0 : 1 );
|
334
|
+
if ( allowed !== false ) {
|
335
|
+
this.values( index, newVal );
|
336
|
+
}
|
337
|
+
}
|
338
|
+
} else {
|
339
|
+
if ( newVal !== this.value() ) {
|
340
|
+
// A slide can be canceled by returning false from the slide callback
|
341
|
+
allowed = this._trigger( "slide", event, {
|
342
|
+
handle: this.handles[ index ],
|
343
|
+
value: newVal
|
344
|
+
} );
|
345
|
+
if ( allowed !== false ) {
|
346
|
+
this.value( newVal );
|
347
|
+
}
|
348
|
+
}
|
349
|
+
}
|
350
|
+
},
|
351
|
+
|
352
|
+
_stop: function( event, index ) {
|
353
|
+
var uiHash = {
|
354
|
+
handle: this.handles[ index ],
|
355
|
+
value: this.value()
|
356
|
+
};
|
357
|
+
if ( this.options.values && this.options.values.length ) {
|
358
|
+
uiHash.value = this.values( index );
|
359
|
+
uiHash.values = this.values();
|
360
|
+
}
|
361
|
+
|
362
|
+
this._trigger( "stop", event, uiHash );
|
363
|
+
},
|
364
|
+
|
365
|
+
_change: function( event, index ) {
|
366
|
+
if ( !this._keySliding && !this._mouseSliding ) {
|
367
|
+
var uiHash = {
|
368
|
+
handle: this.handles[ index ],
|
369
|
+
value: this.value()
|
370
|
+
};
|
371
|
+
if ( this.options.values && this.options.values.length ) {
|
372
|
+
uiHash.value = this.values( index );
|
373
|
+
uiHash.values = this.values();
|
374
|
+
}
|
375
|
+
|
376
|
+
//store the last changed value index for reference when handles overlap
|
377
|
+
this._lastChangedValue = index;
|
378
|
+
|
379
|
+
this._trigger( "change", event, uiHash );
|
380
|
+
}
|
381
|
+
},
|
382
|
+
|
383
|
+
value: function( newValue ) {
|
384
|
+
if ( arguments.length ) {
|
385
|
+
this.options.value = this._trimAlignValue( newValue );
|
386
|
+
this._refreshValue();
|
387
|
+
this._change( null, 0 );
|
388
|
+
return;
|
389
|
+
}
|
390
|
+
|
391
|
+
return this._value();
|
392
|
+
},
|
393
|
+
|
394
|
+
values: function( index, newValue ) {
|
395
|
+
var vals,
|
396
|
+
newValues,
|
397
|
+
i;
|
398
|
+
|
399
|
+
if ( arguments.length > 1 ) {
|
400
|
+
this.options.values[ index ] = this._trimAlignValue( newValue );
|
401
|
+
this._refreshValue();
|
402
|
+
this._change( null, index );
|
403
|
+
return;
|
404
|
+
}
|
405
|
+
|
406
|
+
if ( arguments.length ) {
|
407
|
+
if ( $.isArray( arguments[ 0 ] ) ) {
|
408
|
+
vals = this.options.values;
|
409
|
+
newValues = arguments[ 0 ];
|
410
|
+
for ( i = 0; i < vals.length; i += 1 ) {
|
411
|
+
vals[ i ] = this._trimAlignValue( newValues[ i ] );
|
412
|
+
this._change( null, i );
|
413
|
+
}
|
414
|
+
this._refreshValue();
|
415
|
+
} else {
|
416
|
+
if ( this.options.values && this.options.values.length ) {
|
417
|
+
return this._values( index );
|
418
|
+
} else {
|
419
|
+
return this.value();
|
420
|
+
}
|
421
|
+
}
|
422
|
+
} else {
|
423
|
+
return this._values();
|
424
|
+
}
|
425
|
+
},
|
426
|
+
|
427
|
+
_setOption: function( key, value ) {
|
428
|
+
var i,
|
429
|
+
valsLength = 0;
|
430
|
+
|
431
|
+
if ( key === "range" && this.options.range === true ) {
|
432
|
+
if ( value === "min" ) {
|
433
|
+
this.options.value = this._values( 0 );
|
434
|
+
this.options.values = null;
|
435
|
+
} else if ( value === "max" ) {
|
436
|
+
this.options.value = this._values( this.options.values.length - 1 );
|
437
|
+
this.options.values = null;
|
438
|
+
}
|
439
|
+
}
|
440
|
+
|
441
|
+
if ( $.isArray( this.options.values ) ) {
|
442
|
+
valsLength = this.options.values.length;
|
443
|
+
}
|
444
|
+
|
445
|
+
if ( key === "disabled" ) {
|
446
|
+
this.element.toggleClass( "ui-state-disabled", !!value );
|
447
|
+
}
|
448
|
+
|
449
|
+
this._super( key, value );
|
450
|
+
|
451
|
+
switch ( key ) {
|
452
|
+
case "orientation":
|
453
|
+
this._detectOrientation();
|
454
|
+
this.element
|
455
|
+
.removeClass( "ui-slider-horizontal ui-slider-vertical" )
|
456
|
+
.addClass( "ui-slider-" + this.orientation );
|
457
|
+
this._refreshValue();
|
458
|
+
|
459
|
+
// Reset positioning from previous orientation
|
460
|
+
this.handles.css( value === "horizontal" ? "bottom" : "left", "" );
|
461
|
+
break;
|
462
|
+
case "value":
|
463
|
+
this._animateOff = true;
|
464
|
+
this._refreshValue();
|
465
|
+
this._change( null, 0 );
|
466
|
+
this._animateOff = false;
|
467
|
+
break;
|
468
|
+
case "values":
|
469
|
+
this._animateOff = true;
|
470
|
+
this._refreshValue();
|
471
|
+
for ( i = 0; i < valsLength; i += 1 ) {
|
472
|
+
this._change( null, i );
|
473
|
+
}
|
474
|
+
this._animateOff = false;
|
475
|
+
break;
|
476
|
+
case "step":
|
477
|
+
case "min":
|
478
|
+
case "max":
|
479
|
+
this._animateOff = true;
|
480
|
+
this._calculateNewMax();
|
481
|
+
this._refreshValue();
|
482
|
+
this._animateOff = false;
|
483
|
+
break;
|
484
|
+
case "range":
|
485
|
+
this._animateOff = true;
|
486
|
+
this._refresh();
|
487
|
+
this._animateOff = false;
|
488
|
+
break;
|
489
|
+
}
|
490
|
+
},
|
491
|
+
|
492
|
+
//internal value getter
|
493
|
+
// _value() returns value trimmed by min and max, aligned by step
|
494
|
+
_value: function() {
|
495
|
+
var val = this.options.value;
|
496
|
+
val = this._trimAlignValue( val );
|
497
|
+
|
498
|
+
return val;
|
499
|
+
},
|
500
|
+
|
501
|
+
//internal values getter
|
502
|
+
// _values() returns array of values trimmed by min and max, aligned by step
|
503
|
+
// _values( index ) returns single value trimmed by min and max, aligned by step
|
504
|
+
_values: function( index ) {
|
505
|
+
var val,
|
506
|
+
vals,
|
507
|
+
i;
|
508
|
+
|
509
|
+
if ( arguments.length ) {
|
510
|
+
val = this.options.values[ index ];
|
511
|
+
val = this._trimAlignValue( val );
|
512
|
+
|
513
|
+
return val;
|
514
|
+
} else if ( this.options.values && this.options.values.length ) {
|
515
|
+
// .slice() creates a copy of the array
|
516
|
+
// this copy gets trimmed by min and max and then returned
|
517
|
+
vals = this.options.values.slice();
|
518
|
+
for ( i = 0; i < vals.length; i += 1) {
|
519
|
+
vals[ i ] = this._trimAlignValue( vals[ i ] );
|
520
|
+
}
|
521
|
+
|
522
|
+
return vals;
|
523
|
+
} else {
|
524
|
+
return [];
|
525
|
+
}
|
526
|
+
},
|
527
|
+
|
528
|
+
// returns the step-aligned value that val is closest to, between (inclusive) min and max
|
529
|
+
_trimAlignValue: function( val ) {
|
530
|
+
if ( val <= this._valueMin() ) {
|
531
|
+
return this._valueMin();
|
532
|
+
}
|
533
|
+
if ( val >= this._valueMax() ) {
|
534
|
+
return this._valueMax();
|
535
|
+
}
|
536
|
+
var step = ( this.options.step > 0 ) ? this.options.step : 1,
|
537
|
+
valModStep = (val - this._valueMin()) % step,
|
538
|
+
alignValue = val - valModStep;
|
539
|
+
|
540
|
+
if ( Math.abs(valModStep) * 2 >= step ) {
|
541
|
+
alignValue += ( valModStep > 0 ) ? step : ( -step );
|
542
|
+
}
|
543
|
+
|
544
|
+
// Since JavaScript has problems with large floats, round
|
545
|
+
// the final value to 5 digits after the decimal point (see #4124)
|
546
|
+
return parseFloat( alignValue.toFixed(5) );
|
547
|
+
},
|
548
|
+
|
549
|
+
_calculateNewMax: function() {
|
550
|
+
var max = this.options.max,
|
551
|
+
min = this._valueMin(),
|
552
|
+
step = this.options.step,
|
553
|
+
aboveMin = Math.floor( ( +( max - min ).toFixed( this._precision() ) ) / step ) * step;
|
554
|
+
max = aboveMin + min;
|
555
|
+
this.max = parseFloat( max.toFixed( this._precision() ) );
|
556
|
+
},
|
557
|
+
|
558
|
+
_precision: function() {
|
559
|
+
var precision = this._precisionOf( this.options.step );
|
560
|
+
if ( this.options.min !== null ) {
|
561
|
+
precision = Math.max( precision, this._precisionOf( this.options.min ) );
|
562
|
+
}
|
563
|
+
return precision;
|
564
|
+
},
|
565
|
+
|
566
|
+
_precisionOf: function( num ) {
|
567
|
+
var str = num.toString(),
|
568
|
+
decimal = str.indexOf( "." );
|
569
|
+
return decimal === -1 ? 0 : str.length - decimal - 1;
|
570
|
+
},
|
571
|
+
|
572
|
+
_valueMin: function() {
|
573
|
+
return this.options.min;
|
574
|
+
},
|
575
|
+
|
576
|
+
_valueMax: function() {
|
577
|
+
return this.max;
|
578
|
+
},
|
579
|
+
|
580
|
+
_refreshValue: function() {
|
581
|
+
var lastValPercent, valPercent, value, valueMin, valueMax,
|
582
|
+
oRange = this.options.range,
|
583
|
+
o = this.options,
|
584
|
+
that = this,
|
585
|
+
animate = ( !this._animateOff ) ? o.animate : false,
|
586
|
+
_set = {};
|
587
|
+
|
588
|
+
if ( this.options.values && this.options.values.length ) {
|
589
|
+
this.handles.each(function( i ) {
|
590
|
+
valPercent = ( that.values(i) - that._valueMin() ) / ( that._valueMax() - that._valueMin() ) * 100;
|
591
|
+
_set[ that.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
|
592
|
+
$( this ).stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
|
593
|
+
if ( that.options.range === true ) {
|
594
|
+
if ( that.orientation === "horizontal" ) {
|
595
|
+
if ( i === 0 ) {
|
596
|
+
that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { left: valPercent + "%" }, o.animate );
|
597
|
+
}
|
598
|
+
if ( i === 1 ) {
|
599
|
+
that.range[ animate ? "animate" : "css" ]( { width: ( valPercent - lastValPercent ) + "%" }, { queue: false, duration: o.animate } );
|
600
|
+
}
|
601
|
+
} else {
|
602
|
+
if ( i === 0 ) {
|
603
|
+
that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { bottom: ( valPercent ) + "%" }, o.animate );
|
604
|
+
}
|
605
|
+
if ( i === 1 ) {
|
606
|
+
that.range[ animate ? "animate" : "css" ]( { height: ( valPercent - lastValPercent ) + "%" }, { queue: false, duration: o.animate } );
|
607
|
+
}
|
608
|
+
}
|
609
|
+
}
|
610
|
+
lastValPercent = valPercent;
|
611
|
+
});
|
612
|
+
} else {
|
613
|
+
value = this.value();
|
614
|
+
valueMin = this._valueMin();
|
615
|
+
valueMax = this._valueMax();
|
616
|
+
valPercent = ( valueMax !== valueMin ) ?
|
617
|
+
( value - valueMin ) / ( valueMax - valueMin ) * 100 :
|
618
|
+
0;
|
619
|
+
_set[ this.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
|
620
|
+
this.handle.stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
|
621
|
+
|
622
|
+
if ( oRange === "min" && this.orientation === "horizontal" ) {
|
623
|
+
this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { width: valPercent + "%" }, o.animate );
|
624
|
+
}
|
625
|
+
if ( oRange === "max" && this.orientation === "horizontal" ) {
|
626
|
+
this.range[ animate ? "animate" : "css" ]( { width: ( 100 - valPercent ) + "%" }, { queue: false, duration: o.animate } );
|
627
|
+
}
|
628
|
+
if ( oRange === "min" && this.orientation === "vertical" ) {
|
629
|
+
this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { height: valPercent + "%" }, o.animate );
|
630
|
+
}
|
631
|
+
if ( oRange === "max" && this.orientation === "vertical" ) {
|
632
|
+
this.range[ animate ? "animate" : "css" ]( { height: ( 100 - valPercent ) + "%" }, { queue: false, duration: o.animate } );
|
633
|
+
}
|
634
|
+
}
|
635
|
+
},
|
636
|
+
|
637
|
+
_handleEvents: {
|
638
|
+
keydown: function( event ) {
|
639
|
+
var allowed, curVal, newVal, step,
|
640
|
+
index = $( event.target ).data( "ui-slider-handle-index" );
|
641
|
+
|
642
|
+
switch ( event.keyCode ) {
|
643
|
+
case $.ui.keyCode.HOME:
|
644
|
+
case $.ui.keyCode.END:
|
645
|
+
case $.ui.keyCode.PAGE_UP:
|
646
|
+
case $.ui.keyCode.PAGE_DOWN:
|
647
|
+
case $.ui.keyCode.UP:
|
648
|
+
case $.ui.keyCode.RIGHT:
|
649
|
+
case $.ui.keyCode.DOWN:
|
650
|
+
case $.ui.keyCode.LEFT:
|
651
|
+
event.preventDefault();
|
652
|
+
if ( !this._keySliding ) {
|
653
|
+
this._keySliding = true;
|
654
|
+
$( event.target ).addClass( "ui-state-active" );
|
655
|
+
allowed = this._start( event, index );
|
656
|
+
if ( allowed === false ) {
|
657
|
+
return;
|
658
|
+
}
|
659
|
+
}
|
660
|
+
break;
|
661
|
+
}
|
662
|
+
|
663
|
+
step = this.options.step;
|
664
|
+
if ( this.options.values && this.options.values.length ) {
|
665
|
+
curVal = newVal = this.values( index );
|
666
|
+
} else {
|
667
|
+
curVal = newVal = this.value();
|
668
|
+
}
|
669
|
+
|
670
|
+
switch ( event.keyCode ) {
|
671
|
+
case $.ui.keyCode.HOME:
|
672
|
+
newVal = this._valueMin();
|
673
|
+
break;
|
674
|
+
case $.ui.keyCode.END:
|
675
|
+
newVal = this._valueMax();
|
676
|
+
break;
|
677
|
+
case $.ui.keyCode.PAGE_UP:
|
678
|
+
newVal = this._trimAlignValue(
|
679
|
+
curVal + ( ( this._valueMax() - this._valueMin() ) / this.numPages )
|
680
|
+
);
|
681
|
+
break;
|
682
|
+
case $.ui.keyCode.PAGE_DOWN:
|
683
|
+
newVal = this._trimAlignValue(
|
684
|
+
curVal - ( (this._valueMax() - this._valueMin()) / this.numPages ) );
|
685
|
+
break;
|
686
|
+
case $.ui.keyCode.UP:
|
687
|
+
case $.ui.keyCode.RIGHT:
|
688
|
+
if ( curVal === this._valueMax() ) {
|
689
|
+
return;
|
690
|
+
}
|
691
|
+
newVal = this._trimAlignValue( curVal + step );
|
692
|
+
break;
|
693
|
+
case $.ui.keyCode.DOWN:
|
694
|
+
case $.ui.keyCode.LEFT:
|
695
|
+
if ( curVal === this._valueMin() ) {
|
696
|
+
return;
|
697
|
+
}
|
698
|
+
newVal = this._trimAlignValue( curVal - step );
|
699
|
+
break;
|
700
|
+
}
|
701
|
+
|
702
|
+
this._slide( event, index, newVal );
|
703
|
+
},
|
704
|
+
keyup: function( event ) {
|
705
|
+
var index = $( event.target ).data( "ui-slider-handle-index" );
|
706
|
+
|
707
|
+
if ( this._keySliding ) {
|
708
|
+
this._keySliding = false;
|
709
|
+
this._stop( event, index );
|
710
|
+
this._change( event, index );
|
711
|
+
$( event.target ).removeClass( "ui-state-active" );
|
712
|
+
}
|
713
|
+
}
|
714
|
+
}
|
715
|
+
});
|
716
|
+
|
717
|
+
}));
|