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.
Files changed (180) 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/CONTRIBUTING.txt +30 -0
  6. data/Gemfile +3 -0
  7. data/History.md +172 -0
  8. data/License.txt +2 -0
  9. data/README.md +311 -0
  10. data/Rakefile +263 -0
  11. data/VERSIONS.md +41 -0
  12. data/app/assets/images/jquery-ui/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  13. data/app/assets/images/jquery-ui/ui-icons_444444_256x240.png +0 -0
  14. data/app/assets/images/jquery-ui/ui-icons_555555_256x240.png +0 -0
  15. data/app/assets/images/jquery-ui/ui-icons_777620_256x240.png +0 -0
  16. data/app/assets/images/jquery-ui/ui-icons_777777_256x240.png +0 -0
  17. data/app/assets/images/jquery-ui/ui-icons_cc0000_256x240.png +0 -0
  18. data/app/assets/images/jquery-ui/ui-icons_ffffff_256x240.png +0 -0
  19. data/app/assets/javascripts/jquery-ui/core.js +15 -0
  20. data/app/assets/javascripts/jquery-ui/data.js +45 -0
  21. data/app/assets/javascripts/jquery-ui/disable-selection.js +51 -0
  22. data/app/assets/javascripts/jquery-ui/effect.all.js +15 -0
  23. data/app/assets/javascripts/jquery-ui/effect.js +975 -0
  24. data/app/assets/javascripts/jquery-ui/effects/effect-blind.js +76 -0
  25. data/app/assets/javascripts/jquery-ui/effects/effect-bounce.js +116 -0
  26. data/app/assets/javascripts/jquery-ui/effects/effect-clip.js +71 -0
  27. data/app/assets/javascripts/jquery-ui/effects/effect-drop.js +75 -0
  28. data/app/assets/javascripts/jquery-ui/effects/effect-explode.js +117 -0
  29. data/app/assets/javascripts/jquery-ui/effects/effect-fade.js +53 -0
  30. data/app/assets/javascripts/jquery-ui/effects/effect-fold.js +95 -0
  31. data/app/assets/javascripts/jquery-ui/effects/effect-highlight.js +63 -0
  32. data/app/assets/javascripts/jquery-ui/effects/effect-puff.js +49 -0
  33. data/app/assets/javascripts/jquery-ui/effects/effect-pulsate.js +70 -0
  34. data/app/assets/javascripts/jquery-ui/effects/effect-scale.js +63 -0
  35. data/app/assets/javascripts/jquery-ui/effects/effect-shake.js +80 -0
  36. data/app/assets/javascripts/jquery-ui/effects/effect-size.js +199 -0
  37. data/app/assets/javascripts/jquery-ui/effects/effect-slide.js +82 -0
  38. data/app/assets/javascripts/jquery-ui/effects/effect-transfer.js +46 -0
  39. data/app/assets/javascripts/jquery-ui/focusable.js +89 -0
  40. data/app/assets/javascripts/jquery-ui/form-reset-mixin.js +83 -0
  41. data/app/assets/javascripts/jquery-ui/form.js +25 -0
  42. data/app/assets/javascripts/jquery-ui/i18n/datepicker-af.js +40 -0
  43. data/app/assets/javascripts/jquery-ui/i18n/datepicker-ar-DZ.js +42 -0
  44. data/app/assets/javascripts/jquery-ui/i18n/datepicker-ar.js +42 -0
  45. data/app/assets/javascripts/jquery-ui/i18n/datepicker-az.js +40 -0
  46. data/app/assets/javascripts/jquery-ui/i18n/datepicker-be.js +40 -0
  47. data/app/assets/javascripts/jquery-ui/i18n/datepicker-bg.js +41 -0
  48. data/app/assets/javascripts/jquery-ui/i18n/datepicker-bs.js +40 -0
  49. data/app/assets/javascripts/jquery-ui/i18n/datepicker-ca.js +40 -0
  50. data/app/assets/javascripts/jquery-ui/i18n/datepicker-cs.js +40 -0
  51. data/app/assets/javascripts/jquery-ui/i18n/datepicker-cy-GB.js +48 -0
  52. data/app/assets/javascripts/jquery-ui/i18n/datepicker-da.js +40 -0
  53. data/app/assets/javascripts/jquery-ui/i18n/datepicker-de-AT.js +41 -0
  54. data/app/assets/javascripts/jquery-ui/i18n/datepicker-de.js +40 -0
  55. data/app/assets/javascripts/jquery-ui/i18n/datepicker-el.js +40 -0
  56. data/app/assets/javascripts/jquery-ui/i18n/datepicker-en-AU.js +40 -0
  57. data/app/assets/javascripts/jquery-ui/i18n/datepicker-en-GB.js +40 -0
  58. data/app/assets/javascripts/jquery-ui/i18n/datepicker-en-NZ.js +40 -0
  59. data/app/assets/javascripts/jquery-ui/i18n/datepicker-eo.js +40 -0
  60. data/app/assets/javascripts/jquery-ui/i18n/datepicker-es.js +40 -0
  61. data/app/assets/javascripts/jquery-ui/i18n/datepicker-et.js +48 -0
  62. data/app/assets/javascripts/jquery-ui/i18n/datepicker-eu.js +39 -0
  63. data/app/assets/javascripts/jquery-ui/i18n/datepicker-fa.js +76 -0
  64. data/app/assets/javascripts/jquery-ui/i18n/datepicker-fi.js +40 -0
  65. data/app/assets/javascripts/jquery-ui/i18n/datepicker-fo.js +48 -0
  66. data/app/assets/javascripts/jquery-ui/i18n/datepicker-fr-CA.js +40 -0
  67. data/app/assets/javascripts/jquery-ui/i18n/datepicker-fr-CH.js +40 -0
  68. data/app/assets/javascripts/jquery-ui/i18n/datepicker-fr.js +42 -0
  69. data/app/assets/javascripts/jquery-ui/i18n/datepicker-gl.js +40 -0
  70. data/app/assets/javascripts/jquery-ui/i18n/datepicker-he.js +40 -0
  71. data/app/assets/javascripts/jquery-ui/i18n/datepicker-hi.js +40 -0
  72. data/app/assets/javascripts/jquery-ui/i18n/datepicker-hr.js +40 -0
  73. data/app/assets/javascripts/jquery-ui/i18n/datepicker-hu.js +39 -0
  74. data/app/assets/javascripts/jquery-ui/i18n/datepicker-hy.js +40 -0
  75. data/app/assets/javascripts/jquery-ui/i18n/datepicker-id.js +41 -0
  76. data/app/assets/javascripts/jquery-ui/i18n/datepicker-is.js +48 -0
  77. data/app/assets/javascripts/jquery-ui/i18n/datepicker-it-CH.js +40 -0
  78. data/app/assets/javascripts/jquery-ui/i18n/datepicker-it.js +40 -0
  79. data/app/assets/javascripts/jquery-ui/i18n/datepicker-ja.js +40 -0
  80. data/app/assets/javascripts/jquery-ui/i18n/datepicker-ka.js +51 -0
  81. data/app/assets/javascripts/jquery-ui/i18n/datepicker-kk.js +40 -0
  82. data/app/assets/javascripts/jquery-ui/i18n/datepicker-km.js +40 -0
  83. data/app/assets/javascripts/jquery-ui/i18n/datepicker-ko.js +40 -0
  84. data/app/assets/javascripts/jquery-ui/i18n/datepicker-ky.js +41 -0
  85. data/app/assets/javascripts/jquery-ui/i18n/datepicker-lb.js +48 -0
  86. data/app/assets/javascripts/jquery-ui/i18n/datepicker-lt.js +48 -0
  87. data/app/assets/javascripts/jquery-ui/i18n/datepicker-lv.js +48 -0
  88. data/app/assets/javascripts/jquery-ui/i18n/datepicker-mk.js +40 -0
  89. data/app/assets/javascripts/jquery-ui/i18n/datepicker-ml.js +40 -0
  90. data/app/assets/javascripts/jquery-ui/i18n/datepicker-ms.js +40 -0
  91. data/app/assets/javascripts/jquery-ui/i18n/datepicker-nb.js +52 -0
  92. data/app/assets/javascripts/jquery-ui/i18n/datepicker-nl-BE.js +40 -0
  93. data/app/assets/javascripts/jquery-ui/i18n/datepicker-nl.js +40 -0
  94. data/app/assets/javascripts/jquery-ui/i18n/datepicker-nn.js +52 -0
  95. data/app/assets/javascripts/jquery-ui/i18n/datepicker-no.js +53 -0
  96. data/app/assets/javascripts/jquery-ui/i18n/datepicker-pl.js +40 -0
  97. data/app/assets/javascripts/jquery-ui/i18n/datepicker-pt-BR.js +48 -0
  98. data/app/assets/javascripts/jquery-ui/i18n/datepicker-pt.js +47 -0
  99. data/app/assets/javascripts/jquery-ui/i18n/datepicker-rm.js +64 -0
  100. data/app/assets/javascripts/jquery-ui/i18n/datepicker-ro.js +43 -0
  101. data/app/assets/javascripts/jquery-ui/i18n/datepicker-ru.js +40 -0
  102. data/app/assets/javascripts/jquery-ui/i18n/datepicker-sk.js +40 -0
  103. data/app/assets/javascripts/jquery-ui/i18n/datepicker-sl.js +41 -0
  104. data/app/assets/javascripts/jquery-ui/i18n/datepicker-sq.js +40 -0
  105. data/app/assets/javascripts/jquery-ui/i18n/datepicker-sr-SR.js +40 -0
  106. data/app/assets/javascripts/jquery-ui/i18n/datepicker-sr.js +40 -0
  107. data/app/assets/javascripts/jquery-ui/i18n/datepicker-sv.js +40 -0
  108. data/app/assets/javascripts/jquery-ui/i18n/datepicker-ta.js +56 -0
  109. data/app/assets/javascripts/jquery-ui/i18n/datepicker-th.js +40 -0
  110. data/app/assets/javascripts/jquery-ui/i18n/datepicker-tj.js +40 -0
  111. data/app/assets/javascripts/jquery-ui/i18n/datepicker-tr.js +40 -0
  112. data/app/assets/javascripts/jquery-ui/i18n/datepicker-uk.js +41 -0
  113. data/app/assets/javascripts/jquery-ui/i18n/datepicker-vi.js +40 -0
  114. data/app/assets/javascripts/jquery-ui/i18n/datepicker-zh-CN.js +40 -0
  115. data/app/assets/javascripts/jquery-ui/i18n/datepicker-zh-HK.js +40 -0
  116. data/app/assets/javascripts/jquery-ui/i18n/datepicker-zh-TW.js +40 -0
  117. data/app/assets/javascripts/jquery-ui/ie.js +20 -0
  118. data/app/assets/javascripts/jquery-ui/jquery-patch.js +91 -0
  119. data/app/assets/javascripts/jquery-ui/jquery-var-for-color.js +24 -0
  120. data/app/assets/javascripts/jquery-ui/keycode.js +51 -0
  121. data/app/assets/javascripts/jquery-ui/labels.js +71 -0
  122. data/app/assets/javascripts/jquery-ui/plugin.js +49 -0
  123. data/app/assets/javascripts/jquery-ui/position.js +513 -0
  124. data/app/assets/javascripts/jquery-ui/safe-active-element.js +46 -0
  125. data/app/assets/javascripts/jquery-ui/safe-blur.js +27 -0
  126. data/app/assets/javascripts/jquery-ui/scroll-parent.js +50 -0
  127. data/app/assets/javascripts/jquery-ui/tabbable.js +41 -0
  128. data/app/assets/javascripts/jquery-ui/unique-id.js +54 -0
  129. data/app/assets/javascripts/jquery-ui/vendor/jquery-color/jquery.color.js +722 -0
  130. data/app/assets/javascripts/jquery-ui/version.js +20 -0
  131. data/app/assets/javascripts/jquery-ui/widget.js +758 -0
  132. data/app/assets/javascripts/jquery-ui/widgets/accordion.js +627 -0
  133. data/app/assets/javascripts/jquery-ui/widgets/autocomplete.js +685 -0
  134. data/app/assets/javascripts/jquery-ui/widgets/button.js +454 -0
  135. data/app/assets/javascripts/jquery-ui/widgets/checkboxradio.js +294 -0
  136. data/app/assets/javascripts/jquery-ui/widgets/controlgroup.js +304 -0
  137. data/app/assets/javascripts/jquery-ui/widgets/datepicker.js +2243 -0
  138. data/app/assets/javascripts/jquery-ui/widgets/dialog.js +968 -0
  139. data/app/assets/javascripts/jquery-ui/widgets/draggable.js +1268 -0
  140. data/app/assets/javascripts/jquery-ui/widgets/droppable.js +508 -0
  141. data/app/assets/javascripts/jquery-ui/widgets/menu.js +720 -0
  142. data/app/assets/javascripts/jquery-ui/widgets/mouse.js +241 -0
  143. data/app/assets/javascripts/jquery-ui/widgets/progressbar.js +184 -0
  144. data/app/assets/javascripts/jquery-ui/widgets/resizable.js +1225 -0
  145. data/app/assets/javascripts/jquery-ui/widgets/selectable.js +321 -0
  146. data/app/assets/javascripts/jquery-ui/widgets/selectmenu.js +702 -0
  147. data/app/assets/javascripts/jquery-ui/widgets/slider.js +760 -0
  148. data/app/assets/javascripts/jquery-ui/widgets/sortable.js +1622 -0
  149. data/app/assets/javascripts/jquery-ui/widgets/spinner.js +588 -0
  150. data/app/assets/javascripts/jquery-ui/widgets/tabs.js +931 -0
  151. data/app/assets/javascripts/jquery-ui/widgets/tooltip.js +533 -0
  152. data/app/assets/javascripts/jquery-ui.js +57 -0
  153. data/app/assets/stylesheets/jquery-ui/accordion.css +26 -0
  154. data/app/assets/stylesheets/jquery-ui/all.css +14 -0
  155. data/app/assets/stylesheets/jquery-ui/autocomplete.css +19 -0
  156. data/app/assets/stylesheets/jquery-ui/base.css +32 -0
  157. data/app/assets/stylesheets/jquery-ui/button.css +85 -0
  158. data/app/assets/stylesheets/jquery-ui/checkboxradio.css +37 -0
  159. data/app/assets/stylesheets/jquery-ui/controlgroup.css +68 -0
  160. data/app/assets/stylesheets/jquery-ui/core.css +100 -0
  161. data/app/assets/stylesheets/jquery-ui/datepicker.css +188 -0
  162. data/app/assets/stylesheets/jquery-ui/dialog.css +104 -0
  163. data/app/assets/stylesheets/jquery-ui/draggable.css +15 -0
  164. data/app/assets/stylesheets/jquery-ui/menu.css +67 -0
  165. data/app/assets/stylesheets/jquery-ui/progressbar.css +31 -0
  166. data/app/assets/stylesheets/jquery-ui/resizable.css +81 -0
  167. data/app/assets/stylesheets/jquery-ui/selectable.css +20 -0
  168. data/app/assets/stylesheets/jquery-ui/selectmenu.css +53 -0
  169. data/app/assets/stylesheets/jquery-ui/slider.css +78 -0
  170. data/app/assets/stylesheets/jquery-ui/sortable.css +15 -0
  171. data/app/assets/stylesheets/jquery-ui/spinner.css +55 -0
  172. data/app/assets/stylesheets/jquery-ui/tabs.css +54 -0
  173. data/app/assets/stylesheets/jquery-ui/theme.css.erb +456 -0
  174. data/app/assets/stylesheets/jquery-ui/tooltip.css +22 -0
  175. data/app/assets/stylesheets/jquery-ui.css +1 -0
  176. data/lib/jquery/ui/rails/engine.rb +8 -0
  177. data/lib/jquery/ui/rails/version.rb +8 -0
  178. data/lib/jquery/ui/rails.rb +2 -0
  179. data/lib/jquery-ui-rails.rb +1 -0
  180. metadata +250 -0
@@ -0,0 +1,588 @@
1
+ //= require jquery-ui/widgets/button
2
+ //= require jquery-ui/version
3
+ //= require jquery-ui/keycode
4
+ //= require jquery-ui/safe-active-element
5
+ //= require jquery-ui/widget
6
+
7
+ /*!
8
+ * jQuery UI Spinner 1.13.2
9
+ * http://jqueryui.com
10
+ *
11
+ * Copyright jQuery Foundation and other contributors
12
+ * Released under the MIT license.
13
+ * http://jquery.org/license
14
+ */
15
+
16
+ //>>label: Spinner
17
+ //>>group: Widgets
18
+ //>>description: Displays buttons to easily input numbers via the keyboard or mouse.
19
+ //>>docs: http://api.jqueryui.com/spinner/
20
+ //>>demos: http://jqueryui.com/spinner/
21
+ //>>css.structure: ../../themes/base/core.css
22
+ //>>css.structure: ../../themes/base/spinner.css
23
+ //>>css.theme: ../../themes/base/theme.css
24
+
25
+ ( function( factory ) {
26
+ "use strict";
27
+
28
+ if ( typeof define === "function" && define.amd ) {
29
+
30
+ // AMD. Register as an anonymous module.
31
+ define( [
32
+ "jquery",
33
+ "./button",
34
+ "../version",
35
+ "../keycode",
36
+ "../safe-active-element",
37
+ "../widget"
38
+ ], factory );
39
+ } else {
40
+
41
+ // Browser globals
42
+ factory( jQuery );
43
+ }
44
+ } )( function( $ ) {
45
+ "use strict";
46
+
47
+ function spinnerModifier( fn ) {
48
+ return function() {
49
+ var previous = this.element.val();
50
+ fn.apply( this, arguments );
51
+ this._refresh();
52
+ if ( previous !== this.element.val() ) {
53
+ this._trigger( "change" );
54
+ }
55
+ };
56
+ }
57
+
58
+ $.widget( "ui.spinner", {
59
+ version: "1.13.2",
60
+ defaultElement: "<input>",
61
+ widgetEventPrefix: "spin",
62
+ options: {
63
+ classes: {
64
+ "ui-spinner": "ui-corner-all",
65
+ "ui-spinner-down": "ui-corner-br",
66
+ "ui-spinner-up": "ui-corner-tr"
67
+ },
68
+ culture: null,
69
+ icons: {
70
+ down: "ui-icon-triangle-1-s",
71
+ up: "ui-icon-triangle-1-n"
72
+ },
73
+ incremental: true,
74
+ max: null,
75
+ min: null,
76
+ numberFormat: null,
77
+ page: 10,
78
+ step: 1,
79
+
80
+ change: null,
81
+ spin: null,
82
+ start: null,
83
+ stop: null
84
+ },
85
+
86
+ _create: function() {
87
+
88
+ // handle string values that need to be parsed
89
+ this._setOption( "max", this.options.max );
90
+ this._setOption( "min", this.options.min );
91
+ this._setOption( "step", this.options.step );
92
+
93
+ // Only format if there is a value, prevents the field from being marked
94
+ // as invalid in Firefox, see #9573.
95
+ if ( this.value() !== "" ) {
96
+
97
+ // Format the value, but don't constrain.
98
+ this._value( this.element.val(), true );
99
+ }
100
+
101
+ this._draw();
102
+ this._on( this._events );
103
+ this._refresh();
104
+
105
+ // Turning off autocomplete prevents the browser from remembering the
106
+ // value when navigating through history, so we re-enable autocomplete
107
+ // if the page is unloaded before the widget is destroyed. #7790
108
+ this._on( this.window, {
109
+ beforeunload: function() {
110
+ this.element.removeAttr( "autocomplete" );
111
+ }
112
+ } );
113
+ },
114
+
115
+ _getCreateOptions: function() {
116
+ var options = this._super();
117
+ var element = this.element;
118
+
119
+ $.each( [ "min", "max", "step" ], function( i, option ) {
120
+ var value = element.attr( option );
121
+ if ( value != null && value.length ) {
122
+ options[ option ] = value;
123
+ }
124
+ } );
125
+
126
+ return options;
127
+ },
128
+
129
+ _events: {
130
+ keydown: function( event ) {
131
+ if ( this._start( event ) && this._keydown( event ) ) {
132
+ event.preventDefault();
133
+ }
134
+ },
135
+ keyup: "_stop",
136
+ focus: function() {
137
+ this.previous = this.element.val();
138
+ },
139
+ blur: function( event ) {
140
+ if ( this.cancelBlur ) {
141
+ delete this.cancelBlur;
142
+ return;
143
+ }
144
+
145
+ this._stop();
146
+ this._refresh();
147
+ if ( this.previous !== this.element.val() ) {
148
+ this._trigger( "change", event );
149
+ }
150
+ },
151
+ mousewheel: function( event, delta ) {
152
+ var activeElement = $.ui.safeActiveElement( this.document[ 0 ] );
153
+ var isActive = this.element[ 0 ] === activeElement;
154
+
155
+ if ( !isActive || !delta ) {
156
+ return;
157
+ }
158
+
159
+ if ( !this.spinning && !this._start( event ) ) {
160
+ return false;
161
+ }
162
+
163
+ this._spin( ( delta > 0 ? 1 : -1 ) * this.options.step, event );
164
+ clearTimeout( this.mousewheelTimer );
165
+ this.mousewheelTimer = this._delay( function() {
166
+ if ( this.spinning ) {
167
+ this._stop( event );
168
+ }
169
+ }, 100 );
170
+ event.preventDefault();
171
+ },
172
+ "mousedown .ui-spinner-button": function( event ) {
173
+ var previous;
174
+
175
+ // We never want the buttons to have focus; whenever the user is
176
+ // interacting with the spinner, the focus should be on the input.
177
+ // If the input is focused then this.previous is properly set from
178
+ // when the input first received focus. If the input is not focused
179
+ // then we need to set this.previous based on the value before spinning.
180
+ previous = this.element[ 0 ] === $.ui.safeActiveElement( this.document[ 0 ] ) ?
181
+ this.previous : this.element.val();
182
+ function checkFocus() {
183
+ var isActive = this.element[ 0 ] === $.ui.safeActiveElement( this.document[ 0 ] );
184
+ if ( !isActive ) {
185
+ this.element.trigger( "focus" );
186
+ this.previous = previous;
187
+
188
+ // support: IE
189
+ // IE sets focus asynchronously, so we need to check if focus
190
+ // moved off of the input because the user clicked on the button.
191
+ this._delay( function() {
192
+ this.previous = previous;
193
+ } );
194
+ }
195
+ }
196
+
197
+ // Ensure focus is on (or stays on) the text field
198
+ event.preventDefault();
199
+ checkFocus.call( this );
200
+
201
+ // Support: IE
202
+ // IE doesn't prevent moving focus even with event.preventDefault()
203
+ // so we set a flag to know when we should ignore the blur event
204
+ // and check (again) if focus moved off of the input.
205
+ this.cancelBlur = true;
206
+ this._delay( function() {
207
+ delete this.cancelBlur;
208
+ checkFocus.call( this );
209
+ } );
210
+
211
+ if ( this._start( event ) === false ) {
212
+ return;
213
+ }
214
+
215
+ this._repeat( null, $( event.currentTarget )
216
+ .hasClass( "ui-spinner-up" ) ? 1 : -1, event );
217
+ },
218
+ "mouseup .ui-spinner-button": "_stop",
219
+ "mouseenter .ui-spinner-button": function( event ) {
220
+
221
+ // button will add ui-state-active if mouse was down while mouseleave and kept down
222
+ if ( !$( event.currentTarget ).hasClass( "ui-state-active" ) ) {
223
+ return;
224
+ }
225
+
226
+ if ( this._start( event ) === false ) {
227
+ return false;
228
+ }
229
+ this._repeat( null, $( event.currentTarget )
230
+ .hasClass( "ui-spinner-up" ) ? 1 : -1, event );
231
+ },
232
+
233
+ // TODO: do we really want to consider this a stop?
234
+ // shouldn't we just stop the repeater and wait until mouseup before
235
+ // we trigger the stop event?
236
+ "mouseleave .ui-spinner-button": "_stop"
237
+ },
238
+
239
+ // Support mobile enhanced option and make backcompat more sane
240
+ _enhance: function() {
241
+ this.uiSpinner = this.element
242
+ .attr( "autocomplete", "off" )
243
+ .wrap( "<span>" )
244
+ .parent()
245
+
246
+ // Add buttons
247
+ .append(
248
+ "<a></a><a></a>"
249
+ );
250
+ },
251
+
252
+ _draw: function() {
253
+ this._enhance();
254
+
255
+ this._addClass( this.uiSpinner, "ui-spinner", "ui-widget ui-widget-content" );
256
+ this._addClass( "ui-spinner-input" );
257
+
258
+ this.element.attr( "role", "spinbutton" );
259
+
260
+ // Button bindings
261
+ this.buttons = this.uiSpinner.children( "a" )
262
+ .attr( "tabIndex", -1 )
263
+ .attr( "aria-hidden", true )
264
+ .button( {
265
+ classes: {
266
+ "ui-button": ""
267
+ }
268
+ } );
269
+
270
+ // TODO: Right now button does not support classes this is already updated in button PR
271
+ this._removeClass( this.buttons, "ui-corner-all" );
272
+
273
+ this._addClass( this.buttons.first(), "ui-spinner-button ui-spinner-up" );
274
+ this._addClass( this.buttons.last(), "ui-spinner-button ui-spinner-down" );
275
+ this.buttons.first().button( {
276
+ "icon": this.options.icons.up,
277
+ "showLabel": false
278
+ } );
279
+ this.buttons.last().button( {
280
+ "icon": this.options.icons.down,
281
+ "showLabel": false
282
+ } );
283
+
284
+ // IE 6 doesn't understand height: 50% for the buttons
285
+ // unless the wrapper has an explicit height
286
+ if ( this.buttons.height() > Math.ceil( this.uiSpinner.height() * 0.5 ) &&
287
+ this.uiSpinner.height() > 0 ) {
288
+ this.uiSpinner.height( this.uiSpinner.height() );
289
+ }
290
+ },
291
+
292
+ _keydown: function( event ) {
293
+ var options = this.options,
294
+ keyCode = $.ui.keyCode;
295
+
296
+ switch ( event.keyCode ) {
297
+ case keyCode.UP:
298
+ this._repeat( null, 1, event );
299
+ return true;
300
+ case keyCode.DOWN:
301
+ this._repeat( null, -1, event );
302
+ return true;
303
+ case keyCode.PAGE_UP:
304
+ this._repeat( null, options.page, event );
305
+ return true;
306
+ case keyCode.PAGE_DOWN:
307
+ this._repeat( null, -options.page, event );
308
+ return true;
309
+ }
310
+
311
+ return false;
312
+ },
313
+
314
+ _start: function( event ) {
315
+ if ( !this.spinning && this._trigger( "start", event ) === false ) {
316
+ return false;
317
+ }
318
+
319
+ if ( !this.counter ) {
320
+ this.counter = 1;
321
+ }
322
+ this.spinning = true;
323
+ return true;
324
+ },
325
+
326
+ _repeat: function( i, steps, event ) {
327
+ i = i || 500;
328
+
329
+ clearTimeout( this.timer );
330
+ this.timer = this._delay( function() {
331
+ this._repeat( 40, steps, event );
332
+ }, i );
333
+
334
+ this._spin( steps * this.options.step, event );
335
+ },
336
+
337
+ _spin: function( step, event ) {
338
+ var value = this.value() || 0;
339
+
340
+ if ( !this.counter ) {
341
+ this.counter = 1;
342
+ }
343
+
344
+ value = this._adjustValue( value + step * this._increment( this.counter ) );
345
+
346
+ if ( !this.spinning || this._trigger( "spin", event, { value: value } ) !== false ) {
347
+ this._value( value );
348
+ this.counter++;
349
+ }
350
+ },
351
+
352
+ _increment: function( i ) {
353
+ var incremental = this.options.incremental;
354
+
355
+ if ( incremental ) {
356
+ return typeof incremental === "function" ?
357
+ incremental( i ) :
358
+ Math.floor( i * i * i / 50000 - i * i / 500 + 17 * i / 200 + 1 );
359
+ }
360
+
361
+ return 1;
362
+ },
363
+
364
+ _precision: function() {
365
+ var precision = this._precisionOf( this.options.step );
366
+ if ( this.options.min !== null ) {
367
+ precision = Math.max( precision, this._precisionOf( this.options.min ) );
368
+ }
369
+ return precision;
370
+ },
371
+
372
+ _precisionOf: function( num ) {
373
+ var str = num.toString(),
374
+ decimal = str.indexOf( "." );
375
+ return decimal === -1 ? 0 : str.length - decimal - 1;
376
+ },
377
+
378
+ _adjustValue: function( value ) {
379
+ var base, aboveMin,
380
+ options = this.options;
381
+
382
+ // Make sure we're at a valid step
383
+ // - find out where we are relative to the base (min or 0)
384
+ base = options.min !== null ? options.min : 0;
385
+ aboveMin = value - base;
386
+
387
+ // - round to the nearest step
388
+ aboveMin = Math.round( aboveMin / options.step ) * options.step;
389
+
390
+ // - rounding is based on 0, so adjust back to our base
391
+ value = base + aboveMin;
392
+
393
+ // Fix precision from bad JS floating point math
394
+ value = parseFloat( value.toFixed( this._precision() ) );
395
+
396
+ // Clamp the value
397
+ if ( options.max !== null && value > options.max ) {
398
+ return options.max;
399
+ }
400
+ if ( options.min !== null && value < options.min ) {
401
+ return options.min;
402
+ }
403
+
404
+ return value;
405
+ },
406
+
407
+ _stop: function( event ) {
408
+ if ( !this.spinning ) {
409
+ return;
410
+ }
411
+
412
+ clearTimeout( this.timer );
413
+ clearTimeout( this.mousewheelTimer );
414
+ this.counter = 0;
415
+ this.spinning = false;
416
+ this._trigger( "stop", event );
417
+ },
418
+
419
+ _setOption: function( key, value ) {
420
+ var prevValue, first, last;
421
+
422
+ if ( key === "culture" || key === "numberFormat" ) {
423
+ prevValue = this._parse( this.element.val() );
424
+ this.options[ key ] = value;
425
+ this.element.val( this._format( prevValue ) );
426
+ return;
427
+ }
428
+
429
+ if ( key === "max" || key === "min" || key === "step" ) {
430
+ if ( typeof value === "string" ) {
431
+ value = this._parse( value );
432
+ }
433
+ }
434
+ if ( key === "icons" ) {
435
+ first = this.buttons.first().find( ".ui-icon" );
436
+ this._removeClass( first, null, this.options.icons.up );
437
+ this._addClass( first, null, value.up );
438
+ last = this.buttons.last().find( ".ui-icon" );
439
+ this._removeClass( last, null, this.options.icons.down );
440
+ this._addClass( last, null, value.down );
441
+ }
442
+
443
+ this._super( key, value );
444
+ },
445
+
446
+ _setOptionDisabled: function( value ) {
447
+ this._super( value );
448
+
449
+ this._toggleClass( this.uiSpinner, null, "ui-state-disabled", !!value );
450
+ this.element.prop( "disabled", !!value );
451
+ this.buttons.button( value ? "disable" : "enable" );
452
+ },
453
+
454
+ _setOptions: spinnerModifier( function( options ) {
455
+ this._super( options );
456
+ } ),
457
+
458
+ _parse: function( val ) {
459
+ if ( typeof val === "string" && val !== "" ) {
460
+ val = window.Globalize && this.options.numberFormat ?
461
+ Globalize.parseFloat( val, 10, this.options.culture ) : +val;
462
+ }
463
+ return val === "" || isNaN( val ) ? null : val;
464
+ },
465
+
466
+ _format: function( value ) {
467
+ if ( value === "" ) {
468
+ return "";
469
+ }
470
+ return window.Globalize && this.options.numberFormat ?
471
+ Globalize.format( value, this.options.numberFormat, this.options.culture ) :
472
+ value;
473
+ },
474
+
475
+ _refresh: function() {
476
+ this.element.attr( {
477
+ "aria-valuemin": this.options.min,
478
+ "aria-valuemax": this.options.max,
479
+
480
+ // TODO: what should we do with values that can't be parsed?
481
+ "aria-valuenow": this._parse( this.element.val() )
482
+ } );
483
+ },
484
+
485
+ isValid: function() {
486
+ var value = this.value();
487
+
488
+ // Null is invalid
489
+ if ( value === null ) {
490
+ return false;
491
+ }
492
+
493
+ // If value gets adjusted, it's invalid
494
+ return value === this._adjustValue( value );
495
+ },
496
+
497
+ // Update the value without triggering change
498
+ _value: function( value, allowAny ) {
499
+ var parsed;
500
+ if ( value !== "" ) {
501
+ parsed = this._parse( value );
502
+ if ( parsed !== null ) {
503
+ if ( !allowAny ) {
504
+ parsed = this._adjustValue( parsed );
505
+ }
506
+ value = this._format( parsed );
507
+ }
508
+ }
509
+ this.element.val( value );
510
+ this._refresh();
511
+ },
512
+
513
+ _destroy: function() {
514
+ this.element
515
+ .prop( "disabled", false )
516
+ .removeAttr( "autocomplete role aria-valuemin aria-valuemax aria-valuenow" );
517
+
518
+ this.uiSpinner.replaceWith( this.element );
519
+ },
520
+
521
+ stepUp: spinnerModifier( function( steps ) {
522
+ this._stepUp( steps );
523
+ } ),
524
+ _stepUp: function( steps ) {
525
+ if ( this._start() ) {
526
+ this._spin( ( steps || 1 ) * this.options.step );
527
+ this._stop();
528
+ }
529
+ },
530
+
531
+ stepDown: spinnerModifier( function( steps ) {
532
+ this._stepDown( steps );
533
+ } ),
534
+ _stepDown: function( steps ) {
535
+ if ( this._start() ) {
536
+ this._spin( ( steps || 1 ) * -this.options.step );
537
+ this._stop();
538
+ }
539
+ },
540
+
541
+ pageUp: spinnerModifier( function( pages ) {
542
+ this._stepUp( ( pages || 1 ) * this.options.page );
543
+ } ),
544
+
545
+ pageDown: spinnerModifier( function( pages ) {
546
+ this._stepDown( ( pages || 1 ) * this.options.page );
547
+ } ),
548
+
549
+ value: function( newVal ) {
550
+ if ( !arguments.length ) {
551
+ return this._parse( this.element.val() );
552
+ }
553
+ spinnerModifier( this._value ).call( this, newVal );
554
+ },
555
+
556
+ widget: function() {
557
+ return this.uiSpinner;
558
+ }
559
+ } );
560
+
561
+ // DEPRECATED
562
+ // TODO: switch return back to widget declaration at top of file when this is removed
563
+ if ( $.uiBackCompat !== false ) {
564
+
565
+ // Backcompat for spinner html extension points
566
+ $.widget( "ui.spinner", $.ui.spinner, {
567
+ _enhance: function() {
568
+ this.uiSpinner = this.element
569
+ .attr( "autocomplete", "off" )
570
+ .wrap( this._uiSpinnerHtml() )
571
+ .parent()
572
+
573
+ // Add buttons
574
+ .append( this._buttonHtml() );
575
+ },
576
+ _uiSpinnerHtml: function() {
577
+ return "<span>";
578
+ },
579
+
580
+ _buttonHtml: function() {
581
+ return "<a></a><a></a>";
582
+ }
583
+ } );
584
+ }
585
+
586
+ return $.ui.spinner;
587
+
588
+ } );