sn-jquery-ui-rails 6.0.2

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