jquery-ui-rails-dox-fork 7.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +2 -0
- data/.gitmodules +3 -0
- data/.travis.yml +2 -0
- data/CONTRIBUTING.txt +30 -0
- data/Gemfile +3 -0
- data/History.md +172 -0
- data/License.txt +2 -0
- data/README.md +311 -0
- data/Rakefile +263 -0
- data/VERSIONS.md +41 -0
- data/app/assets/images/jquery-ui/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_444444_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_555555_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_777620_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_777777_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_cc0000_256x240.png +0 -0
- data/app/assets/images/jquery-ui/ui-icons_ffffff_256x240.png +0 -0
- data/app/assets/javascripts/jquery-ui/core.js +15 -0
- data/app/assets/javascripts/jquery-ui/data.js +45 -0
- data/app/assets/javascripts/jquery-ui/disable-selection.js +51 -0
- data/app/assets/javascripts/jquery-ui/effect.all.js +15 -0
- data/app/assets/javascripts/jquery-ui/effect.js +975 -0
- data/app/assets/javascripts/jquery-ui/effects/effect-blind.js +76 -0
- data/app/assets/javascripts/jquery-ui/effects/effect-bounce.js +116 -0
- data/app/assets/javascripts/jquery-ui/effects/effect-clip.js +71 -0
- data/app/assets/javascripts/jquery-ui/effects/effect-drop.js +75 -0
- data/app/assets/javascripts/jquery-ui/effects/effect-explode.js +117 -0
- data/app/assets/javascripts/jquery-ui/effects/effect-fade.js +53 -0
- data/app/assets/javascripts/jquery-ui/effects/effect-fold.js +95 -0
- data/app/assets/javascripts/jquery-ui/effects/effect-highlight.js +63 -0
- data/app/assets/javascripts/jquery-ui/effects/effect-puff.js +49 -0
- data/app/assets/javascripts/jquery-ui/effects/effect-pulsate.js +70 -0
- data/app/assets/javascripts/jquery-ui/effects/effect-scale.js +63 -0
- data/app/assets/javascripts/jquery-ui/effects/effect-shake.js +80 -0
- data/app/assets/javascripts/jquery-ui/effects/effect-size.js +199 -0
- data/app/assets/javascripts/jquery-ui/effects/effect-slide.js +82 -0
- data/app/assets/javascripts/jquery-ui/effects/effect-transfer.js +46 -0
- data/app/assets/javascripts/jquery-ui/focusable.js +89 -0
- data/app/assets/javascripts/jquery-ui/form-reset-mixin.js +83 -0
- data/app/assets/javascripts/jquery-ui/form.js +25 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-af.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-ar-DZ.js +42 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-ar.js +42 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-az.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-be.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-bg.js +41 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-bs.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-ca.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-cs.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-cy-GB.js +48 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-da.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-de-AT.js +41 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-de.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-el.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-en-AU.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-en-GB.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-en-NZ.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-eo.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-es.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-et.js +48 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-eu.js +39 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-fa.js +76 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-fi.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-fo.js +48 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-fr-CA.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-fr-CH.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-fr.js +42 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-gl.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-he.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-hi.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-hr.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-hu.js +39 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-hy.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-id.js +41 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-is.js +48 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-it-CH.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-it.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-ja.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-ka.js +51 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-kk.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-km.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-ko.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-ky.js +41 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-lb.js +48 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-lt.js +48 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-lv.js +48 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-mk.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-ml.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-ms.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-nb.js +52 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-nl-BE.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-nl.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-nn.js +52 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-no.js +53 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-pl.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-pt-BR.js +48 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-pt.js +47 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-rm.js +64 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-ro.js +43 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-ru.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-sk.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-sl.js +41 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-sq.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-sr-SR.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-sr.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-sv.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-ta.js +56 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-th.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-tj.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-tr.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-uk.js +41 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-vi.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-zh-CN.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-zh-HK.js +40 -0
- data/app/assets/javascripts/jquery-ui/i18n/datepicker-zh-TW.js +40 -0
- data/app/assets/javascripts/jquery-ui/ie.js +20 -0
- data/app/assets/javascripts/jquery-ui/jquery-patch.js +91 -0
- data/app/assets/javascripts/jquery-ui/jquery-var-for-color.js +24 -0
- data/app/assets/javascripts/jquery-ui/keycode.js +51 -0
- data/app/assets/javascripts/jquery-ui/labels.js +71 -0
- data/app/assets/javascripts/jquery-ui/plugin.js +49 -0
- data/app/assets/javascripts/jquery-ui/position.js +513 -0
- data/app/assets/javascripts/jquery-ui/safe-active-element.js +46 -0
- data/app/assets/javascripts/jquery-ui/safe-blur.js +27 -0
- data/app/assets/javascripts/jquery-ui/scroll-parent.js +50 -0
- data/app/assets/javascripts/jquery-ui/tabbable.js +41 -0
- data/app/assets/javascripts/jquery-ui/unique-id.js +54 -0
- data/app/assets/javascripts/jquery-ui/vendor/jquery-color/jquery.color.js +722 -0
- data/app/assets/javascripts/jquery-ui/version.js +20 -0
- data/app/assets/javascripts/jquery-ui/widget.js +758 -0
- data/app/assets/javascripts/jquery-ui/widgets/accordion.js +627 -0
- data/app/assets/javascripts/jquery-ui/widgets/autocomplete.js +685 -0
- data/app/assets/javascripts/jquery-ui/widgets/button.js +454 -0
- data/app/assets/javascripts/jquery-ui/widgets/checkboxradio.js +294 -0
- data/app/assets/javascripts/jquery-ui/widgets/controlgroup.js +304 -0
- data/app/assets/javascripts/jquery-ui/widgets/datepicker.js +2243 -0
- data/app/assets/javascripts/jquery-ui/widgets/dialog.js +968 -0
- data/app/assets/javascripts/jquery-ui/widgets/draggable.js +1268 -0
- data/app/assets/javascripts/jquery-ui/widgets/droppable.js +508 -0
- data/app/assets/javascripts/jquery-ui/widgets/menu.js +720 -0
- data/app/assets/javascripts/jquery-ui/widgets/mouse.js +241 -0
- data/app/assets/javascripts/jquery-ui/widgets/progressbar.js +184 -0
- data/app/assets/javascripts/jquery-ui/widgets/resizable.js +1225 -0
- data/app/assets/javascripts/jquery-ui/widgets/selectable.js +321 -0
- data/app/assets/javascripts/jquery-ui/widgets/selectmenu.js +702 -0
- data/app/assets/javascripts/jquery-ui/widgets/slider.js +760 -0
- data/app/assets/javascripts/jquery-ui/widgets/sortable.js +1622 -0
- data/app/assets/javascripts/jquery-ui/widgets/spinner.js +588 -0
- data/app/assets/javascripts/jquery-ui/widgets/tabs.js +931 -0
- data/app/assets/javascripts/jquery-ui/widgets/tooltip.js +533 -0
- data/app/assets/javascripts/jquery-ui.js +57 -0
- data/app/assets/stylesheets/jquery-ui/accordion.css +26 -0
- data/app/assets/stylesheets/jquery-ui/all.css +14 -0
- data/app/assets/stylesheets/jquery-ui/autocomplete.css +19 -0
- data/app/assets/stylesheets/jquery-ui/base.css +32 -0
- data/app/assets/stylesheets/jquery-ui/button.css +85 -0
- data/app/assets/stylesheets/jquery-ui/checkboxradio.css +37 -0
- data/app/assets/stylesheets/jquery-ui/controlgroup.css +68 -0
- data/app/assets/stylesheets/jquery-ui/core.css +100 -0
- data/app/assets/stylesheets/jquery-ui/datepicker.css +188 -0
- data/app/assets/stylesheets/jquery-ui/dialog.css +104 -0
- data/app/assets/stylesheets/jquery-ui/draggable.css +15 -0
- data/app/assets/stylesheets/jquery-ui/menu.css +67 -0
- data/app/assets/stylesheets/jquery-ui/progressbar.css +31 -0
- data/app/assets/stylesheets/jquery-ui/resizable.css +81 -0
- data/app/assets/stylesheets/jquery-ui/selectable.css +20 -0
- data/app/assets/stylesheets/jquery-ui/selectmenu.css +53 -0
- data/app/assets/stylesheets/jquery-ui/slider.css +78 -0
- data/app/assets/stylesheets/jquery-ui/sortable.css +15 -0
- data/app/assets/stylesheets/jquery-ui/spinner.css +55 -0
- data/app/assets/stylesheets/jquery-ui/tabs.css +54 -0
- data/app/assets/stylesheets/jquery-ui/theme.css.erb +456 -0
- data/app/assets/stylesheets/jquery-ui/tooltip.css +22 -0
- data/app/assets/stylesheets/jquery-ui.css +1 -0
- data/lib/jquery/ui/rails/engine.rb +8 -0
- data/lib/jquery/ui/rails/version.rb +8 -0
- data/lib/jquery/ui/rails.rb +2 -0
- data/lib/jquery-ui-rails.rb +1 -0
- metadata +250 -0
@@ -0,0 +1,760 @@
|
|
1
|
+
//= require jquery-ui/widgets/mouse
|
2
|
+
//= require jquery-ui/keycode
|
3
|
+
//= require jquery-ui/version
|
4
|
+
//= require jquery-ui/widget
|
5
|
+
|
6
|
+
/*!
|
7
|
+
* jQuery UI Slider 1.13.2
|
8
|
+
* http://jqueryui.com
|
9
|
+
*
|
10
|
+
* Copyright jQuery Foundation and other contributors
|
11
|
+
* Released under the MIT license.
|
12
|
+
* http://jquery.org/license
|
13
|
+
*/
|
14
|
+
|
15
|
+
//>>label: Slider
|
16
|
+
//>>group: Widgets
|
17
|
+
//>>description: Displays a flexible slider with ranges and accessibility via keyboard.
|
18
|
+
//>>docs: http://api.jqueryui.com/slider/
|
19
|
+
//>>demos: http://jqueryui.com/slider/
|
20
|
+
//>>css.structure: ../../themes/base/core.css
|
21
|
+
//>>css.structure: ../../themes/base/slider.css
|
22
|
+
//>>css.theme: ../../themes/base/theme.css
|
23
|
+
|
24
|
+
( function( factory ) {
|
25
|
+
"use strict";
|
26
|
+
|
27
|
+
if ( typeof define === "function" && define.amd ) {
|
28
|
+
|
29
|
+
// AMD. Register as an anonymous module.
|
30
|
+
define( [
|
31
|
+
"jquery",
|
32
|
+
"./mouse",
|
33
|
+
"../keycode",
|
34
|
+
"../version",
|
35
|
+
"../widget"
|
36
|
+
], factory );
|
37
|
+
} else {
|
38
|
+
|
39
|
+
// Browser globals
|
40
|
+
factory( jQuery );
|
41
|
+
}
|
42
|
+
} )( function( $ ) {
|
43
|
+
"use strict";
|
44
|
+
|
45
|
+
return $.widget( "ui.slider", $.ui.mouse, {
|
46
|
+
version: "1.13.2",
|
47
|
+
widgetEventPrefix: "slide",
|
48
|
+
|
49
|
+
options: {
|
50
|
+
animate: false,
|
51
|
+
classes: {
|
52
|
+
"ui-slider": "ui-corner-all",
|
53
|
+
"ui-slider-handle": "ui-corner-all",
|
54
|
+
|
55
|
+
// Note: ui-widget-header isn't the most fittingly semantic framework class for this
|
56
|
+
// element, but worked best visually with a variety of themes
|
57
|
+
"ui-slider-range": "ui-corner-all ui-widget-header"
|
58
|
+
},
|
59
|
+
distance: 0,
|
60
|
+
max: 100,
|
61
|
+
min: 0,
|
62
|
+
orientation: "horizontal",
|
63
|
+
range: false,
|
64
|
+
step: 1,
|
65
|
+
value: 0,
|
66
|
+
values: null,
|
67
|
+
|
68
|
+
// Callbacks
|
69
|
+
change: null,
|
70
|
+
slide: null,
|
71
|
+
start: null,
|
72
|
+
stop: null
|
73
|
+
},
|
74
|
+
|
75
|
+
// Number of pages in a slider
|
76
|
+
// (how many times can you page up/down to go through the whole range)
|
77
|
+
numPages: 5,
|
78
|
+
|
79
|
+
_create: function() {
|
80
|
+
this._keySliding = false;
|
81
|
+
this._mouseSliding = false;
|
82
|
+
this._animateOff = true;
|
83
|
+
this._handleIndex = null;
|
84
|
+
this._detectOrientation();
|
85
|
+
this._mouseInit();
|
86
|
+
this._calculateNewMax();
|
87
|
+
|
88
|
+
this._addClass( "ui-slider ui-slider-" + this.orientation,
|
89
|
+
"ui-widget ui-widget-content" );
|
90
|
+
|
91
|
+
this._refresh();
|
92
|
+
|
93
|
+
this._animateOff = false;
|
94
|
+
},
|
95
|
+
|
96
|
+
_refresh: function() {
|
97
|
+
this._createRange();
|
98
|
+
this._createHandles();
|
99
|
+
this._setupEvents();
|
100
|
+
this._refreshValue();
|
101
|
+
},
|
102
|
+
|
103
|
+
_createHandles: function() {
|
104
|
+
var i, handleCount,
|
105
|
+
options = this.options,
|
106
|
+
existingHandles = this.element.find( ".ui-slider-handle" ),
|
107
|
+
handle = "<span tabindex='0'></span>",
|
108
|
+
handles = [];
|
109
|
+
|
110
|
+
handleCount = ( options.values && options.values.length ) || 1;
|
111
|
+
|
112
|
+
if ( existingHandles.length > handleCount ) {
|
113
|
+
existingHandles.slice( handleCount ).remove();
|
114
|
+
existingHandles = existingHandles.slice( 0, handleCount );
|
115
|
+
}
|
116
|
+
|
117
|
+
for ( i = existingHandles.length; i < handleCount; i++ ) {
|
118
|
+
handles.push( handle );
|
119
|
+
}
|
120
|
+
|
121
|
+
this.handles = existingHandles.add( $( handles.join( "" ) ).appendTo( this.element ) );
|
122
|
+
|
123
|
+
this._addClass( this.handles, "ui-slider-handle", "ui-state-default" );
|
124
|
+
|
125
|
+
this.handle = this.handles.eq( 0 );
|
126
|
+
|
127
|
+
this.handles.each( function( i ) {
|
128
|
+
$( this )
|
129
|
+
.data( "ui-slider-handle-index", i )
|
130
|
+
.attr( "tabIndex", 0 );
|
131
|
+
} );
|
132
|
+
},
|
133
|
+
|
134
|
+
_createRange: function() {
|
135
|
+
var options = this.options;
|
136
|
+
|
137
|
+
if ( options.range ) {
|
138
|
+
if ( options.range === true ) {
|
139
|
+
if ( !options.values ) {
|
140
|
+
options.values = [ this._valueMin(), this._valueMin() ];
|
141
|
+
} else if ( options.values.length && options.values.length !== 2 ) {
|
142
|
+
options.values = [ options.values[ 0 ], options.values[ 0 ] ];
|
143
|
+
} else if ( Array.isArray( options.values ) ) {
|
144
|
+
options.values = options.values.slice( 0 );
|
145
|
+
}
|
146
|
+
}
|
147
|
+
|
148
|
+
if ( !this.range || !this.range.length ) {
|
149
|
+
this.range = $( "<div>" )
|
150
|
+
.appendTo( this.element );
|
151
|
+
|
152
|
+
this._addClass( this.range, "ui-slider-range" );
|
153
|
+
} else {
|
154
|
+
this._removeClass( this.range, "ui-slider-range-min ui-slider-range-max" );
|
155
|
+
|
156
|
+
// Handle range switching from true to min/max
|
157
|
+
this.range.css( {
|
158
|
+
"left": "",
|
159
|
+
"bottom": ""
|
160
|
+
} );
|
161
|
+
}
|
162
|
+
if ( options.range === "min" || options.range === "max" ) {
|
163
|
+
this._addClass( this.range, "ui-slider-range-" + options.range );
|
164
|
+
}
|
165
|
+
} else {
|
166
|
+
if ( this.range ) {
|
167
|
+
this.range.remove();
|
168
|
+
}
|
169
|
+
this.range = null;
|
170
|
+
}
|
171
|
+
},
|
172
|
+
|
173
|
+
_setupEvents: function() {
|
174
|
+
this._off( this.handles );
|
175
|
+
this._on( this.handles, this._handleEvents );
|
176
|
+
this._hoverable( this.handles );
|
177
|
+
this._focusable( this.handles );
|
178
|
+
},
|
179
|
+
|
180
|
+
_destroy: function() {
|
181
|
+
this.handles.remove();
|
182
|
+
if ( this.range ) {
|
183
|
+
this.range.remove();
|
184
|
+
}
|
185
|
+
|
186
|
+
this._mouseDestroy();
|
187
|
+
},
|
188
|
+
|
189
|
+
_mouseCapture: function( event ) {
|
190
|
+
var position, normValue, distance, closestHandle, index, allowed, offset, mouseOverHandle,
|
191
|
+
that = this,
|
192
|
+
o = this.options;
|
193
|
+
|
194
|
+
if ( o.disabled ) {
|
195
|
+
return false;
|
196
|
+
}
|
197
|
+
|
198
|
+
this.elementSize = {
|
199
|
+
width: this.element.outerWidth(),
|
200
|
+
height: this.element.outerHeight()
|
201
|
+
};
|
202
|
+
this.elementOffset = this.element.offset();
|
203
|
+
|
204
|
+
position = { x: event.pageX, y: event.pageY };
|
205
|
+
normValue = this._normValueFromMouse( position );
|
206
|
+
distance = this._valueMax() - this._valueMin() + 1;
|
207
|
+
this.handles.each( function( i ) {
|
208
|
+
var thisDistance = Math.abs( normValue - that.values( i ) );
|
209
|
+
if ( ( distance > thisDistance ) ||
|
210
|
+
( distance === thisDistance &&
|
211
|
+
( i === that._lastChangedValue || that.values( i ) === o.min ) ) ) {
|
212
|
+
distance = thisDistance;
|
213
|
+
closestHandle = $( this );
|
214
|
+
index = i;
|
215
|
+
}
|
216
|
+
} );
|
217
|
+
|
218
|
+
allowed = this._start( event, index );
|
219
|
+
if ( allowed === false ) {
|
220
|
+
return false;
|
221
|
+
}
|
222
|
+
this._mouseSliding = true;
|
223
|
+
|
224
|
+
this._handleIndex = index;
|
225
|
+
|
226
|
+
this._addClass( closestHandle, null, "ui-state-active" );
|
227
|
+
closestHandle.trigger( "focus" );
|
228
|
+
|
229
|
+
offset = closestHandle.offset();
|
230
|
+
mouseOverHandle = !$( event.target ).parents().addBack().is( ".ui-slider-handle" );
|
231
|
+
this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : {
|
232
|
+
left: event.pageX - offset.left - ( closestHandle.width() / 2 ),
|
233
|
+
top: event.pageY - offset.top -
|
234
|
+
( closestHandle.height() / 2 ) -
|
235
|
+
( parseInt( closestHandle.css( "borderTopWidth" ), 10 ) || 0 ) -
|
236
|
+
( parseInt( closestHandle.css( "borderBottomWidth" ), 10 ) || 0 ) +
|
237
|
+
( parseInt( closestHandle.css( "marginTop" ), 10 ) || 0 )
|
238
|
+
};
|
239
|
+
|
240
|
+
if ( !this.handles.hasClass( "ui-state-hover" ) ) {
|
241
|
+
this._slide( event, index, normValue );
|
242
|
+
}
|
243
|
+
this._animateOff = true;
|
244
|
+
return true;
|
245
|
+
},
|
246
|
+
|
247
|
+
_mouseStart: function() {
|
248
|
+
return true;
|
249
|
+
},
|
250
|
+
|
251
|
+
_mouseDrag: function( event ) {
|
252
|
+
var position = { x: event.pageX, y: event.pageY },
|
253
|
+
normValue = this._normValueFromMouse( position );
|
254
|
+
|
255
|
+
this._slide( event, this._handleIndex, normValue );
|
256
|
+
|
257
|
+
return false;
|
258
|
+
},
|
259
|
+
|
260
|
+
_mouseStop: function( event ) {
|
261
|
+
this._removeClass( this.handles, null, "ui-state-active" );
|
262
|
+
this._mouseSliding = false;
|
263
|
+
|
264
|
+
this._stop( event, this._handleIndex );
|
265
|
+
this._change( event, this._handleIndex );
|
266
|
+
|
267
|
+
this._handleIndex = null;
|
268
|
+
this._clickOffset = null;
|
269
|
+
this._animateOff = false;
|
270
|
+
|
271
|
+
return false;
|
272
|
+
},
|
273
|
+
|
274
|
+
_detectOrientation: function() {
|
275
|
+
this.orientation = ( this.options.orientation === "vertical" ) ? "vertical" : "horizontal";
|
276
|
+
},
|
277
|
+
|
278
|
+
_normValueFromMouse: function( position ) {
|
279
|
+
var pixelTotal,
|
280
|
+
pixelMouse,
|
281
|
+
percentMouse,
|
282
|
+
valueTotal,
|
283
|
+
valueMouse;
|
284
|
+
|
285
|
+
if ( this.orientation === "horizontal" ) {
|
286
|
+
pixelTotal = this.elementSize.width;
|
287
|
+
pixelMouse = position.x - this.elementOffset.left -
|
288
|
+
( this._clickOffset ? this._clickOffset.left : 0 );
|
289
|
+
} else {
|
290
|
+
pixelTotal = this.elementSize.height;
|
291
|
+
pixelMouse = position.y - this.elementOffset.top -
|
292
|
+
( this._clickOffset ? this._clickOffset.top : 0 );
|
293
|
+
}
|
294
|
+
|
295
|
+
percentMouse = ( pixelMouse / pixelTotal );
|
296
|
+
if ( percentMouse > 1 ) {
|
297
|
+
percentMouse = 1;
|
298
|
+
}
|
299
|
+
if ( percentMouse < 0 ) {
|
300
|
+
percentMouse = 0;
|
301
|
+
}
|
302
|
+
if ( this.orientation === "vertical" ) {
|
303
|
+
percentMouse = 1 - percentMouse;
|
304
|
+
}
|
305
|
+
|
306
|
+
valueTotal = this._valueMax() - this._valueMin();
|
307
|
+
valueMouse = this._valueMin() + percentMouse * valueTotal;
|
308
|
+
|
309
|
+
return this._trimAlignValue( valueMouse );
|
310
|
+
},
|
311
|
+
|
312
|
+
_uiHash: function( index, value, values ) {
|
313
|
+
var uiHash = {
|
314
|
+
handle: this.handles[ index ],
|
315
|
+
handleIndex: index,
|
316
|
+
value: value !== undefined ? value : this.value()
|
317
|
+
};
|
318
|
+
|
319
|
+
if ( this._hasMultipleValues() ) {
|
320
|
+
uiHash.value = value !== undefined ? value : this.values( index );
|
321
|
+
uiHash.values = values || this.values();
|
322
|
+
}
|
323
|
+
|
324
|
+
return uiHash;
|
325
|
+
},
|
326
|
+
|
327
|
+
_hasMultipleValues: function() {
|
328
|
+
return this.options.values && this.options.values.length;
|
329
|
+
},
|
330
|
+
|
331
|
+
_start: function( event, index ) {
|
332
|
+
return this._trigger( "start", event, this._uiHash( index ) );
|
333
|
+
},
|
334
|
+
|
335
|
+
_slide: function( event, index, newVal ) {
|
336
|
+
var allowed, otherVal,
|
337
|
+
currentValue = this.value(),
|
338
|
+
newValues = this.values();
|
339
|
+
|
340
|
+
if ( this._hasMultipleValues() ) {
|
341
|
+
otherVal = this.values( index ? 0 : 1 );
|
342
|
+
currentValue = this.values( index );
|
343
|
+
|
344
|
+
if ( this.options.values.length === 2 && this.options.range === true ) {
|
345
|
+
newVal = index === 0 ? Math.min( otherVal, newVal ) : Math.max( otherVal, newVal );
|
346
|
+
}
|
347
|
+
|
348
|
+
newValues[ index ] = newVal;
|
349
|
+
}
|
350
|
+
|
351
|
+
if ( newVal === currentValue ) {
|
352
|
+
return;
|
353
|
+
}
|
354
|
+
|
355
|
+
allowed = this._trigger( "slide", event, this._uiHash( index, newVal, newValues ) );
|
356
|
+
|
357
|
+
// A slide can be canceled by returning false from the slide callback
|
358
|
+
if ( allowed === false ) {
|
359
|
+
return;
|
360
|
+
}
|
361
|
+
|
362
|
+
if ( this._hasMultipleValues() ) {
|
363
|
+
this.values( index, newVal );
|
364
|
+
} else {
|
365
|
+
this.value( newVal );
|
366
|
+
}
|
367
|
+
},
|
368
|
+
|
369
|
+
_stop: function( event, index ) {
|
370
|
+
this._trigger( "stop", event, this._uiHash( index ) );
|
371
|
+
},
|
372
|
+
|
373
|
+
_change: function( event, index ) {
|
374
|
+
if ( !this._keySliding && !this._mouseSliding ) {
|
375
|
+
|
376
|
+
//store the last changed value index for reference when handles overlap
|
377
|
+
this._lastChangedValue = index;
|
378
|
+
this._trigger( "change", event, this._uiHash( index ) );
|
379
|
+
}
|
380
|
+
},
|
381
|
+
|
382
|
+
value: function( newValue ) {
|
383
|
+
if ( arguments.length ) {
|
384
|
+
this.options.value = this._trimAlignValue( newValue );
|
385
|
+
this._refreshValue();
|
386
|
+
this._change( null, 0 );
|
387
|
+
return;
|
388
|
+
}
|
389
|
+
|
390
|
+
return this._value();
|
391
|
+
},
|
392
|
+
|
393
|
+
values: function( index, newValue ) {
|
394
|
+
var vals,
|
395
|
+
newValues,
|
396
|
+
i;
|
397
|
+
|
398
|
+
if ( arguments.length > 1 ) {
|
399
|
+
this.options.values[ index ] = this._trimAlignValue( newValue );
|
400
|
+
this._refreshValue();
|
401
|
+
this._change( null, index );
|
402
|
+
return;
|
403
|
+
}
|
404
|
+
|
405
|
+
if ( arguments.length ) {
|
406
|
+
if ( Array.isArray( arguments[ 0 ] ) ) {
|
407
|
+
vals = this.options.values;
|
408
|
+
newValues = arguments[ 0 ];
|
409
|
+
for ( i = 0; i < vals.length; i += 1 ) {
|
410
|
+
vals[ i ] = this._trimAlignValue( newValues[ i ] );
|
411
|
+
this._change( null, i );
|
412
|
+
}
|
413
|
+
this._refreshValue();
|
414
|
+
} else {
|
415
|
+
if ( this._hasMultipleValues() ) {
|
416
|
+
return this._values( index );
|
417
|
+
} else {
|
418
|
+
return this.value();
|
419
|
+
}
|
420
|
+
}
|
421
|
+
} else {
|
422
|
+
return this._values();
|
423
|
+
}
|
424
|
+
},
|
425
|
+
|
426
|
+
_setOption: function( key, value ) {
|
427
|
+
var i,
|
428
|
+
valsLength = 0;
|
429
|
+
|
430
|
+
if ( key === "range" && this.options.range === true ) {
|
431
|
+
if ( value === "min" ) {
|
432
|
+
this.options.value = this._values( 0 );
|
433
|
+
this.options.values = null;
|
434
|
+
} else if ( value === "max" ) {
|
435
|
+
this.options.value = this._values( this.options.values.length - 1 );
|
436
|
+
this.options.values = null;
|
437
|
+
}
|
438
|
+
}
|
439
|
+
|
440
|
+
if ( Array.isArray( this.options.values ) ) {
|
441
|
+
valsLength = this.options.values.length;
|
442
|
+
}
|
443
|
+
|
444
|
+
this._super( key, value );
|
445
|
+
|
446
|
+
switch ( key ) {
|
447
|
+
case "orientation":
|
448
|
+
this._detectOrientation();
|
449
|
+
this._removeClass( "ui-slider-horizontal ui-slider-vertical" )
|
450
|
+
._addClass( "ui-slider-" + this.orientation );
|
451
|
+
this._refreshValue();
|
452
|
+
if ( this.options.range ) {
|
453
|
+
this._refreshRange( value );
|
454
|
+
}
|
455
|
+
|
456
|
+
// Reset positioning from previous orientation
|
457
|
+
this.handles.css( value === "horizontal" ? "bottom" : "left", "" );
|
458
|
+
break;
|
459
|
+
case "value":
|
460
|
+
this._animateOff = true;
|
461
|
+
this._refreshValue();
|
462
|
+
this._change( null, 0 );
|
463
|
+
this._animateOff = false;
|
464
|
+
break;
|
465
|
+
case "values":
|
466
|
+
this._animateOff = true;
|
467
|
+
this._refreshValue();
|
468
|
+
|
469
|
+
// Start from the last handle to prevent unreachable handles (#9046)
|
470
|
+
for ( i = valsLength - 1; i >= 0; i-- ) {
|
471
|
+
this._change( null, i );
|
472
|
+
}
|
473
|
+
this._animateOff = false;
|
474
|
+
break;
|
475
|
+
case "step":
|
476
|
+
case "min":
|
477
|
+
case "max":
|
478
|
+
this._animateOff = true;
|
479
|
+
this._calculateNewMax();
|
480
|
+
this._refreshValue();
|
481
|
+
this._animateOff = false;
|
482
|
+
break;
|
483
|
+
case "range":
|
484
|
+
this._animateOff = true;
|
485
|
+
this._refresh();
|
486
|
+
this._animateOff = false;
|
487
|
+
break;
|
488
|
+
}
|
489
|
+
},
|
490
|
+
|
491
|
+
_setOptionDisabled: function( value ) {
|
492
|
+
this._super( value );
|
493
|
+
|
494
|
+
this._toggleClass( null, "ui-state-disabled", !!value );
|
495
|
+
},
|
496
|
+
|
497
|
+
//internal value getter
|
498
|
+
// _value() returns value trimmed by min and max, aligned by step
|
499
|
+
_value: function() {
|
500
|
+
var val = this.options.value;
|
501
|
+
val = this._trimAlignValue( val );
|
502
|
+
|
503
|
+
return val;
|
504
|
+
},
|
505
|
+
|
506
|
+
//internal values getter
|
507
|
+
// _values() returns array of values trimmed by min and max, aligned by step
|
508
|
+
// _values( index ) returns single value trimmed by min and max, aligned by step
|
509
|
+
_values: function( index ) {
|
510
|
+
var val,
|
511
|
+
vals,
|
512
|
+
i;
|
513
|
+
|
514
|
+
if ( arguments.length ) {
|
515
|
+
val = this.options.values[ index ];
|
516
|
+
val = this._trimAlignValue( val );
|
517
|
+
|
518
|
+
return val;
|
519
|
+
} else if ( this._hasMultipleValues() ) {
|
520
|
+
|
521
|
+
// .slice() creates a copy of the array
|
522
|
+
// this copy gets trimmed by min and max and then returned
|
523
|
+
vals = this.options.values.slice();
|
524
|
+
for ( i = 0; i < vals.length; i += 1 ) {
|
525
|
+
vals[ i ] = this._trimAlignValue( vals[ i ] );
|
526
|
+
}
|
527
|
+
|
528
|
+
return vals;
|
529
|
+
} else {
|
530
|
+
return [];
|
531
|
+
}
|
532
|
+
},
|
533
|
+
|
534
|
+
// Returns the step-aligned value that val is closest to, between (inclusive) min and max
|
535
|
+
_trimAlignValue: function( val ) {
|
536
|
+
if ( val <= this._valueMin() ) {
|
537
|
+
return this._valueMin();
|
538
|
+
}
|
539
|
+
if ( val >= this._valueMax() ) {
|
540
|
+
return this._valueMax();
|
541
|
+
}
|
542
|
+
var step = ( this.options.step > 0 ) ? this.options.step : 1,
|
543
|
+
valModStep = ( val - this._valueMin() ) % step,
|
544
|
+
alignValue = val - valModStep;
|
545
|
+
|
546
|
+
if ( Math.abs( valModStep ) * 2 >= step ) {
|
547
|
+
alignValue += ( valModStep > 0 ) ? step : ( -step );
|
548
|
+
}
|
549
|
+
|
550
|
+
// Since JavaScript has problems with large floats, round
|
551
|
+
// the final value to 5 digits after the decimal point (see #4124)
|
552
|
+
return parseFloat( alignValue.toFixed( 5 ) );
|
553
|
+
},
|
554
|
+
|
555
|
+
_calculateNewMax: function() {
|
556
|
+
var max = this.options.max,
|
557
|
+
min = this._valueMin(),
|
558
|
+
step = this.options.step,
|
559
|
+
aboveMin = Math.round( ( max - min ) / step ) * step;
|
560
|
+
max = aboveMin + min;
|
561
|
+
if ( max > this.options.max ) {
|
562
|
+
|
563
|
+
//If max is not divisible by step, rounding off may increase its value
|
564
|
+
max -= step;
|
565
|
+
}
|
566
|
+
this.max = parseFloat( max.toFixed( this._precision() ) );
|
567
|
+
},
|
568
|
+
|
569
|
+
_precision: function() {
|
570
|
+
var precision = this._precisionOf( this.options.step );
|
571
|
+
if ( this.options.min !== null ) {
|
572
|
+
precision = Math.max( precision, this._precisionOf( this.options.min ) );
|
573
|
+
}
|
574
|
+
return precision;
|
575
|
+
},
|
576
|
+
|
577
|
+
_precisionOf: function( num ) {
|
578
|
+
var str = num.toString(),
|
579
|
+
decimal = str.indexOf( "." );
|
580
|
+
return decimal === -1 ? 0 : str.length - decimal - 1;
|
581
|
+
},
|
582
|
+
|
583
|
+
_valueMin: function() {
|
584
|
+
return this.options.min;
|
585
|
+
},
|
586
|
+
|
587
|
+
_valueMax: function() {
|
588
|
+
return this.max;
|
589
|
+
},
|
590
|
+
|
591
|
+
_refreshRange: function( orientation ) {
|
592
|
+
if ( orientation === "vertical" ) {
|
593
|
+
this.range.css( { "width": "", "left": "" } );
|
594
|
+
}
|
595
|
+
if ( orientation === "horizontal" ) {
|
596
|
+
this.range.css( { "height": "", "bottom": "" } );
|
597
|
+
}
|
598
|
+
},
|
599
|
+
|
600
|
+
_refreshValue: function() {
|
601
|
+
var lastValPercent, valPercent, value, valueMin, valueMax,
|
602
|
+
oRange = this.options.range,
|
603
|
+
o = this.options,
|
604
|
+
that = this,
|
605
|
+
animate = ( !this._animateOff ) ? o.animate : false,
|
606
|
+
_set = {};
|
607
|
+
|
608
|
+
if ( this._hasMultipleValues() ) {
|
609
|
+
this.handles.each( function( i ) {
|
610
|
+
valPercent = ( that.values( i ) - that._valueMin() ) / ( that._valueMax() -
|
611
|
+
that._valueMin() ) * 100;
|
612
|
+
_set[ that.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
|
613
|
+
$( this ).stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
|
614
|
+
if ( that.options.range === true ) {
|
615
|
+
if ( that.orientation === "horizontal" ) {
|
616
|
+
if ( i === 0 ) {
|
617
|
+
that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
|
618
|
+
left: valPercent + "%"
|
619
|
+
}, o.animate );
|
620
|
+
}
|
621
|
+
if ( i === 1 ) {
|
622
|
+
that.range[ animate ? "animate" : "css" ]( {
|
623
|
+
width: ( valPercent - lastValPercent ) + "%"
|
624
|
+
}, {
|
625
|
+
queue: false,
|
626
|
+
duration: o.animate
|
627
|
+
} );
|
628
|
+
}
|
629
|
+
} else {
|
630
|
+
if ( i === 0 ) {
|
631
|
+
that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
|
632
|
+
bottom: ( valPercent ) + "%"
|
633
|
+
}, o.animate );
|
634
|
+
}
|
635
|
+
if ( i === 1 ) {
|
636
|
+
that.range[ animate ? "animate" : "css" ]( {
|
637
|
+
height: ( valPercent - lastValPercent ) + "%"
|
638
|
+
}, {
|
639
|
+
queue: false,
|
640
|
+
duration: o.animate
|
641
|
+
} );
|
642
|
+
}
|
643
|
+
}
|
644
|
+
}
|
645
|
+
lastValPercent = valPercent;
|
646
|
+
} );
|
647
|
+
} else {
|
648
|
+
value = this.value();
|
649
|
+
valueMin = this._valueMin();
|
650
|
+
valueMax = this._valueMax();
|
651
|
+
valPercent = ( valueMax !== valueMin ) ?
|
652
|
+
( value - valueMin ) / ( valueMax - valueMin ) * 100 :
|
653
|
+
0;
|
654
|
+
_set[ this.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
|
655
|
+
this.handle.stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
|
656
|
+
|
657
|
+
if ( oRange === "min" && this.orientation === "horizontal" ) {
|
658
|
+
this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
|
659
|
+
width: valPercent + "%"
|
660
|
+
}, o.animate );
|
661
|
+
}
|
662
|
+
if ( oRange === "max" && this.orientation === "horizontal" ) {
|
663
|
+
this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
|
664
|
+
width: ( 100 - valPercent ) + "%"
|
665
|
+
}, o.animate );
|
666
|
+
}
|
667
|
+
if ( oRange === "min" && this.orientation === "vertical" ) {
|
668
|
+
this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
|
669
|
+
height: valPercent + "%"
|
670
|
+
}, o.animate );
|
671
|
+
}
|
672
|
+
if ( oRange === "max" && this.orientation === "vertical" ) {
|
673
|
+
this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( {
|
674
|
+
height: ( 100 - valPercent ) + "%"
|
675
|
+
}, o.animate );
|
676
|
+
}
|
677
|
+
}
|
678
|
+
},
|
679
|
+
|
680
|
+
_handleEvents: {
|
681
|
+
keydown: function( event ) {
|
682
|
+
var allowed, curVal, newVal, step,
|
683
|
+
index = $( event.target ).data( "ui-slider-handle-index" );
|
684
|
+
|
685
|
+
switch ( event.keyCode ) {
|
686
|
+
case $.ui.keyCode.HOME:
|
687
|
+
case $.ui.keyCode.END:
|
688
|
+
case $.ui.keyCode.PAGE_UP:
|
689
|
+
case $.ui.keyCode.PAGE_DOWN:
|
690
|
+
case $.ui.keyCode.UP:
|
691
|
+
case $.ui.keyCode.RIGHT:
|
692
|
+
case $.ui.keyCode.DOWN:
|
693
|
+
case $.ui.keyCode.LEFT:
|
694
|
+
event.preventDefault();
|
695
|
+
if ( !this._keySliding ) {
|
696
|
+
this._keySliding = true;
|
697
|
+
this._addClass( $( event.target ), null, "ui-state-active" );
|
698
|
+
allowed = this._start( event, index );
|
699
|
+
if ( allowed === false ) {
|
700
|
+
return;
|
701
|
+
}
|
702
|
+
}
|
703
|
+
break;
|
704
|
+
}
|
705
|
+
|
706
|
+
step = this.options.step;
|
707
|
+
if ( this._hasMultipleValues() ) {
|
708
|
+
curVal = newVal = this.values( index );
|
709
|
+
} else {
|
710
|
+
curVal = newVal = this.value();
|
711
|
+
}
|
712
|
+
|
713
|
+
switch ( event.keyCode ) {
|
714
|
+
case $.ui.keyCode.HOME:
|
715
|
+
newVal = this._valueMin();
|
716
|
+
break;
|
717
|
+
case $.ui.keyCode.END:
|
718
|
+
newVal = this._valueMax();
|
719
|
+
break;
|
720
|
+
case $.ui.keyCode.PAGE_UP:
|
721
|
+
newVal = this._trimAlignValue(
|
722
|
+
curVal + ( ( this._valueMax() - this._valueMin() ) / this.numPages )
|
723
|
+
);
|
724
|
+
break;
|
725
|
+
case $.ui.keyCode.PAGE_DOWN:
|
726
|
+
newVal = this._trimAlignValue(
|
727
|
+
curVal - ( ( this._valueMax() - this._valueMin() ) / this.numPages ) );
|
728
|
+
break;
|
729
|
+
case $.ui.keyCode.UP:
|
730
|
+
case $.ui.keyCode.RIGHT:
|
731
|
+
if ( curVal === this._valueMax() ) {
|
732
|
+
return;
|
733
|
+
}
|
734
|
+
newVal = this._trimAlignValue( curVal + step );
|
735
|
+
break;
|
736
|
+
case $.ui.keyCode.DOWN:
|
737
|
+
case $.ui.keyCode.LEFT:
|
738
|
+
if ( curVal === this._valueMin() ) {
|
739
|
+
return;
|
740
|
+
}
|
741
|
+
newVal = this._trimAlignValue( curVal - step );
|
742
|
+
break;
|
743
|
+
}
|
744
|
+
|
745
|
+
this._slide( event, index, newVal );
|
746
|
+
},
|
747
|
+
keyup: function( event ) {
|
748
|
+
var index = $( event.target ).data( "ui-slider-handle-index" );
|
749
|
+
|
750
|
+
if ( this._keySliding ) {
|
751
|
+
this._keySliding = false;
|
752
|
+
this._stop( event, index );
|
753
|
+
this._change( event, index );
|
754
|
+
this._removeClass( $( event.target ), null, "ui-state-active" );
|
755
|
+
}
|
756
|
+
}
|
757
|
+
}
|
758
|
+
} );
|
759
|
+
|
760
|
+
} );
|