jquery-ui-middleman 4.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (153) 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 +115 -0
  7. data/License.txt +2 -0
  8. data/README.md +226 -0
  9. data/Rakefile +221 -0
  10. data/VERSIONS.md +27 -0
  11. data/app/assets/images/jquery-ui/animated-overlay.gif +0 -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-bg_flat_75_ffffff_40x100.png +0 -0
  14. data/app/assets/images/jquery-ui/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  15. data/app/assets/images/jquery-ui/ui-bg_glass_65_ffffff_1x400.png +0 -0
  16. data/app/assets/images/jquery-ui/ui-bg_glass_75_dadada_1x400.png +0 -0
  17. data/app/assets/images/jquery-ui/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  18. data/app/assets/images/jquery-ui/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  19. data/app/assets/images/jquery-ui/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  20. data/app/assets/images/jquery-ui/ui-icons_222222_256x240.png +0 -0
  21. data/app/assets/images/jquery-ui/ui-icons_2e83ff_256x240.png +0 -0
  22. data/app/assets/images/jquery-ui/ui-icons_454545_256x240.png +0 -0
  23. data/app/assets/images/jquery-ui/ui-icons_888888_256x240.png +0 -0
  24. data/app/assets/images/jquery-ui/ui-icons_cd0a0a_256x240.png +0 -0
  25. data/app/assets/javascripts/jquery.ui.accordion.js +575 -0
  26. data/app/assets/javascripts/jquery.ui.all.js +34 -0
  27. data/app/assets/javascripts/jquery.ui.autocomplete.js +615 -0
  28. data/app/assets/javascripts/jquery.ui.button.js +422 -0
  29. data/app/assets/javascripts/jquery.ui.core.js +320 -0
  30. data/app/assets/javascripts/jquery.ui.datepicker-af.js +23 -0
  31. data/app/assets/javascripts/jquery.ui.datepicker-ar-DZ.js +23 -0
  32. data/app/assets/javascripts/jquery.ui.datepicker-ar.js +23 -0
  33. data/app/assets/javascripts/jquery.ui.datepicker-az.js +23 -0
  34. data/app/assets/javascripts/jquery.ui.datepicker-be.js +23 -0
  35. data/app/assets/javascripts/jquery.ui.datepicker-bg.js +24 -0
  36. data/app/assets/javascripts/jquery.ui.datepicker-bs.js +23 -0
  37. data/app/assets/javascripts/jquery.ui.datepicker-ca.js +23 -0
  38. data/app/assets/javascripts/jquery.ui.datepicker-cs.js +23 -0
  39. data/app/assets/javascripts/jquery.ui.datepicker-cy-GB.js +23 -0
  40. data/app/assets/javascripts/jquery.ui.datepicker-da.js +23 -0
  41. data/app/assets/javascripts/jquery.ui.datepicker-de.js +23 -0
  42. data/app/assets/javascripts/jquery.ui.datepicker-el.js +23 -0
  43. data/app/assets/javascripts/jquery.ui.datepicker-en-AU.js +23 -0
  44. data/app/assets/javascripts/jquery.ui.datepicker-en-GB.js +23 -0
  45. data/app/assets/javascripts/jquery.ui.datepicker-en-NZ.js +23 -0
  46. data/app/assets/javascripts/jquery.ui.datepicker-eo.js +23 -0
  47. data/app/assets/javascripts/jquery.ui.datepicker-es.js +23 -0
  48. data/app/assets/javascripts/jquery.ui.datepicker-et.js +23 -0
  49. data/app/assets/javascripts/jquery.ui.datepicker-eu.js +23 -0
  50. data/app/assets/javascripts/jquery.ui.datepicker-fa.js +59 -0
  51. data/app/assets/javascripts/jquery.ui.datepicker-fi.js +23 -0
  52. data/app/assets/javascripts/jquery.ui.datepicker-fo.js +23 -0
  53. data/app/assets/javascripts/jquery.ui.datepicker-fr-CA.js +23 -0
  54. data/app/assets/javascripts/jquery.ui.datepicker-fr-CH.js +23 -0
  55. data/app/assets/javascripts/jquery.ui.datepicker-fr.js +25 -0
  56. data/app/assets/javascripts/jquery.ui.datepicker-gl.js +23 -0
  57. data/app/assets/javascripts/jquery.ui.datepicker-he.js +23 -0
  58. data/app/assets/javascripts/jquery.ui.datepicker-hi.js +23 -0
  59. data/app/assets/javascripts/jquery.ui.datepicker-hr.js +23 -0
  60. data/app/assets/javascripts/jquery.ui.datepicker-hu.js +23 -0
  61. data/app/assets/javascripts/jquery.ui.datepicker-hy.js +23 -0
  62. data/app/assets/javascripts/jquery.ui.datepicker-id.js +23 -0
  63. data/app/assets/javascripts/jquery.ui.datepicker-is.js +23 -0
  64. data/app/assets/javascripts/jquery.ui.datepicker-it.js +23 -0
  65. data/app/assets/javascripts/jquery.ui.datepicker-ja.js +23 -0
  66. data/app/assets/javascripts/jquery.ui.datepicker-ka.js +21 -0
  67. data/app/assets/javascripts/jquery.ui.datepicker-kk.js +23 -0
  68. data/app/assets/javascripts/jquery.ui.datepicker-km.js +23 -0
  69. data/app/assets/javascripts/jquery.ui.datepicker-ko.js +23 -0
  70. data/app/assets/javascripts/jquery.ui.datepicker-ky.js +24 -0
  71. data/app/assets/javascripts/jquery.ui.datepicker-lb.js +23 -0
  72. data/app/assets/javascripts/jquery.ui.datepicker-lt.js +23 -0
  73. data/app/assets/javascripts/jquery.ui.datepicker-lv.js +23 -0
  74. data/app/assets/javascripts/jquery.ui.datepicker-mk.js +23 -0
  75. data/app/assets/javascripts/jquery.ui.datepicker-ml.js +23 -0
  76. data/app/assets/javascripts/jquery.ui.datepicker-ms.js +23 -0
  77. data/app/assets/javascripts/jquery.ui.datepicker-nb.js +22 -0
  78. data/app/assets/javascripts/jquery.ui.datepicker-nl-BE.js +23 -0
  79. data/app/assets/javascripts/jquery.ui.datepicker-nl.js +23 -0
  80. data/app/assets/javascripts/jquery.ui.datepicker-nn.js +22 -0
  81. data/app/assets/javascripts/jquery.ui.datepicker-no.js +23 -0
  82. data/app/assets/javascripts/jquery.ui.datepicker-pl.js +23 -0
  83. data/app/assets/javascripts/jquery.ui.datepicker-pt-BR.js +23 -0
  84. data/app/assets/javascripts/jquery.ui.datepicker-pt.js +22 -0
  85. data/app/assets/javascripts/jquery.ui.datepicker-rm.js +21 -0
  86. data/app/assets/javascripts/jquery.ui.datepicker-ro.js +26 -0
  87. data/app/assets/javascripts/jquery.ui.datepicker-ru.js +23 -0
  88. data/app/assets/javascripts/jquery.ui.datepicker-sk.js +23 -0
  89. data/app/assets/javascripts/jquery.ui.datepicker-sl.js +24 -0
  90. data/app/assets/javascripts/jquery.ui.datepicker-sq.js +23 -0
  91. data/app/assets/javascripts/jquery.ui.datepicker-sr-SR.js +23 -0
  92. data/app/assets/javascripts/jquery.ui.datepicker-sr.js +23 -0
  93. data/app/assets/javascripts/jquery.ui.datepicker-sv.js +23 -0
  94. data/app/assets/javascripts/jquery.ui.datepicker-ta.js +23 -0
  95. data/app/assets/javascripts/jquery.ui.datepicker-th.js +23 -0
  96. data/app/assets/javascripts/jquery.ui.datepicker-tj.js +23 -0
  97. data/app/assets/javascripts/jquery.ui.datepicker-tr.js +23 -0
  98. data/app/assets/javascripts/jquery.ui.datepicker-uk.js +24 -0
  99. data/app/assets/javascripts/jquery.ui.datepicker-vi.js +23 -0
  100. data/app/assets/javascripts/jquery.ui.datepicker-zh-CN.js +23 -0
  101. data/app/assets/javascripts/jquery.ui.datepicker-zh-HK.js +23 -0
  102. data/app/assets/javascripts/jquery.ui.datepicker-zh-TW.js +23 -0
  103. data/app/assets/javascripts/jquery.ui.datepicker.js +2040 -0
  104. data/app/assets/javascripts/jquery.ui.dialog.js +815 -0
  105. data/app/assets/javascripts/jquery.ui.draggable.js +962 -0
  106. data/app/assets/javascripts/jquery.ui.droppable.js +377 -0
  107. data/app/assets/javascripts/jquery.ui.effect-blind.js +84 -0
  108. data/app/assets/javascripts/jquery.ui.effect-bounce.js +115 -0
  109. data/app/assets/javascripts/jquery.ui.effect-clip.js +69 -0
  110. data/app/assets/javascripts/jquery.ui.effect-drop.js +67 -0
  111. data/app/assets/javascripts/jquery.ui.effect-explode.js +99 -0
  112. data/app/assets/javascripts/jquery.ui.effect-fade.js +32 -0
  113. data/app/assets/javascripts/jquery.ui.effect-fold.js +78 -0
  114. data/app/assets/javascripts/jquery.ui.effect-highlight.js +52 -0
  115. data/app/assets/javascripts/jquery.ui.effect-pulsate.js +65 -0
  116. data/app/assets/javascripts/jquery.ui.effect-scale.js +320 -0
  117. data/app/assets/javascripts/jquery.ui.effect-shake.js +76 -0
  118. data/app/assets/javascripts/jquery.ui.effect-slide.js +66 -0
  119. data/app/assets/javascripts/jquery.ui.effect-transfer.js +49 -0
  120. data/app/assets/javascripts/jquery.ui.effect.all.js +14 -0
  121. data/app/assets/javascripts/jquery.ui.effect.js +1289 -0
  122. data/app/assets/javascripts/jquery.ui.menu.js +625 -0
  123. data/app/assets/javascripts/jquery.ui.mouse.js +172 -0
  124. data/app/assets/javascripts/jquery.ui.position.js +497 -0
  125. data/app/assets/javascripts/jquery.ui.progressbar.js +148 -0
  126. data/app/assets/javascripts/jquery.ui.resizable.js +972 -0
  127. data/app/assets/javascripts/jquery.ui.selectable.js +281 -0
  128. data/app/assets/javascripts/jquery.ui.slider.js +676 -0
  129. data/app/assets/javascripts/jquery.ui.sortable.js +1289 -0
  130. data/app/assets/javascripts/jquery.ui.spinner.js +497 -0
  131. data/app/assets/javascripts/jquery.ui.tabs.js +849 -0
  132. data/app/assets/javascripts/jquery.ui.tooltip.js +406 -0
  133. data/app/assets/javascripts/jquery.ui.widget.js +521 -0
  134. data/app/assets/stylesheets/jquery.ui.accordion.css.erb +42 -0
  135. data/app/assets/stylesheets/jquery.ui.all.css.erb +14 -0
  136. data/app/assets/stylesheets/jquery.ui.autocomplete.css.erb +21 -0
  137. data/app/assets/stylesheets/jquery.ui.base.css.erb +27 -0
  138. data/app/assets/stylesheets/jquery.ui.button.css.erb +118 -0
  139. data/app/assets/stylesheets/jquery.ui.core.css.erb +93 -0
  140. data/app/assets/stylesheets/jquery.ui.datepicker.css.erb +182 -0
  141. data/app/assets/stylesheets/jquery.ui.dialog.css.erb +75 -0
  142. data/app/assets/stylesheets/jquery.ui.menu.css.erb +83 -0
  143. data/app/assets/stylesheets/jquery.ui.progressbar.css.erb +32 -0
  144. data/app/assets/stylesheets/jquery.ui.resizable.css.erb +82 -0
  145. data/app/assets/stylesheets/jquery.ui.selectable.css.erb +19 -0
  146. data/app/assets/stylesheets/jquery.ui.slider.css.erb +77 -0
  147. data/app/assets/stylesheets/jquery.ui.spinner.css.erb +70 -0
  148. data/app/assets/stylesheets/jquery.ui.tabs.css.erb +56 -0
  149. data/app/assets/stylesheets/jquery.ui.theme.css.erb +409 -0
  150. data/app/assets/stylesheets/jquery.ui.tooltip.css.erb +23 -0
  151. data/lib/jquery-ui-middleman.rb +1 -0
  152. data/lib/jquery/ui/version.rb +6 -0
  153. metadata +209 -0
@@ -0,0 +1,497 @@
1
+ //= require jquery.ui.core
2
+ //= require jquery.ui.widget
3
+ //= require jquery.ui.button
4
+
5
+ /*!
6
+ * jQuery UI Spinner 1.10.3
7
+ * http://jqueryui.com
8
+ *
9
+ * Copyright 2013 jQuery Foundation and other contributors
10
+ * Released under the MIT license.
11
+ * http://jquery.org/license
12
+ *
13
+ * http://api.jqueryui.com/spinner/
14
+ *
15
+ * Depends:
16
+ * jquery.ui.core.js
17
+ * jquery.ui.widget.js
18
+ * jquery.ui.button.js
19
+ */
20
+ (function( $ ) {
21
+
22
+ function modifier( fn ) {
23
+ return function() {
24
+ var previous = this.element.val();
25
+ fn.apply( this, arguments );
26
+ this._refresh();
27
+ if ( previous !== this.element.val() ) {
28
+ this._trigger( "change" );
29
+ }
30
+ };
31
+ }
32
+
33
+ $.widget( "ui.spinner", {
34
+ version: "1.10.3",
35
+ defaultElement: "<input>",
36
+ widgetEventPrefix: "spin",
37
+ options: {
38
+ culture: null,
39
+ icons: {
40
+ down: "ui-icon-triangle-1-s",
41
+ up: "ui-icon-triangle-1-n"
42
+ },
43
+ incremental: true,
44
+ max: null,
45
+ min: null,
46
+ numberFormat: null,
47
+ page: 10,
48
+ step: 1,
49
+
50
+ change: null,
51
+ spin: null,
52
+ start: null,
53
+ stop: null
54
+ },
55
+
56
+ _create: function() {
57
+ // handle string values that need to be parsed
58
+ this._setOption( "max", this.options.max );
59
+ this._setOption( "min", this.options.min );
60
+ this._setOption( "step", this.options.step );
61
+
62
+ // format the value, but don't constrain
63
+ this._value( this.element.val(), true );
64
+
65
+ this._draw();
66
+ this._on( this._events );
67
+ this._refresh();
68
+
69
+ // turning off autocomplete prevents the browser from remembering the
70
+ // value when navigating through history, so we re-enable autocomplete
71
+ // if the page is unloaded before the widget is destroyed. #7790
72
+ this._on( this.window, {
73
+ beforeunload: function() {
74
+ this.element.removeAttr( "autocomplete" );
75
+ }
76
+ });
77
+ },
78
+
79
+ _getCreateOptions: function() {
80
+ var options = {},
81
+ element = this.element;
82
+
83
+ $.each( [ "min", "max", "step" ], function( i, option ) {
84
+ var value = element.attr( option );
85
+ if ( value !== undefined && value.length ) {
86
+ options[ option ] = value;
87
+ }
88
+ });
89
+
90
+ return options;
91
+ },
92
+
93
+ _events: {
94
+ keydown: function( event ) {
95
+ if ( this._start( event ) && this._keydown( event ) ) {
96
+ event.preventDefault();
97
+ }
98
+ },
99
+ keyup: "_stop",
100
+ focus: function() {
101
+ this.previous = this.element.val();
102
+ },
103
+ blur: function( event ) {
104
+ if ( this.cancelBlur ) {
105
+ delete this.cancelBlur;
106
+ return;
107
+ }
108
+
109
+ this._stop();
110
+ this._refresh();
111
+ if ( this.previous !== this.element.val() ) {
112
+ this._trigger( "change", event );
113
+ }
114
+ },
115
+ mousewheel: function( event, delta ) {
116
+ if ( !delta ) {
117
+ return;
118
+ }
119
+ if ( !this.spinning && !this._start( event ) ) {
120
+ return false;
121
+ }
122
+
123
+ this._spin( (delta > 0 ? 1 : -1) * this.options.step, event );
124
+ clearTimeout( this.mousewheelTimer );
125
+ this.mousewheelTimer = this._delay(function() {
126
+ if ( this.spinning ) {
127
+ this._stop( event );
128
+ }
129
+ }, 100 );
130
+ event.preventDefault();
131
+ },
132
+ "mousedown .ui-spinner-button": function( event ) {
133
+ var previous;
134
+
135
+ // We never want the buttons to have focus; whenever the user is
136
+ // interacting with the spinner, the focus should be on the input.
137
+ // If the input is focused then this.previous is properly set from
138
+ // when the input first received focus. If the input is not focused
139
+ // then we need to set this.previous based on the value before spinning.
140
+ previous = this.element[0] === this.document[0].activeElement ?
141
+ this.previous : this.element.val();
142
+ function checkFocus() {
143
+ var isActive = this.element[0] === this.document[0].activeElement;
144
+ if ( !isActive ) {
145
+ this.element.focus();
146
+ this.previous = previous;
147
+ // support: IE
148
+ // IE sets focus asynchronously, so we need to check if focus
149
+ // moved off of the input because the user clicked on the button.
150
+ this._delay(function() {
151
+ this.previous = previous;
152
+ });
153
+ }
154
+ }
155
+
156
+ // ensure focus is on (or stays on) the text field
157
+ event.preventDefault();
158
+ checkFocus.call( this );
159
+
160
+ // support: IE
161
+ // IE doesn't prevent moving focus even with event.preventDefault()
162
+ // so we set a flag to know when we should ignore the blur event
163
+ // and check (again) if focus moved off of the input.
164
+ this.cancelBlur = true;
165
+ this._delay(function() {
166
+ delete this.cancelBlur;
167
+ checkFocus.call( this );
168
+ });
169
+
170
+ if ( this._start( event ) === false ) {
171
+ return;
172
+ }
173
+
174
+ this._repeat( null, $( event.currentTarget ).hasClass( "ui-spinner-up" ) ? 1 : -1, event );
175
+ },
176
+ "mouseup .ui-spinner-button": "_stop",
177
+ "mouseenter .ui-spinner-button": function( event ) {
178
+ // button will add ui-state-active if mouse was down while mouseleave and kept down
179
+ if ( !$( event.currentTarget ).hasClass( "ui-state-active" ) ) {
180
+ return;
181
+ }
182
+
183
+ if ( this._start( event ) === false ) {
184
+ return false;
185
+ }
186
+ this._repeat( null, $( event.currentTarget ).hasClass( "ui-spinner-up" ) ? 1 : -1, event );
187
+ },
188
+ // TODO: do we really want to consider this a stop?
189
+ // shouldn't we just stop the repeater and wait until mouseup before
190
+ // we trigger the stop event?
191
+ "mouseleave .ui-spinner-button": "_stop"
192
+ },
193
+
194
+ _draw: function() {
195
+ var uiSpinner = this.uiSpinner = this.element
196
+ .addClass( "ui-spinner-input" )
197
+ .attr( "autocomplete", "off" )
198
+ .wrap( this._uiSpinnerHtml() )
199
+ .parent()
200
+ // add buttons
201
+ .append( this._buttonHtml() );
202
+
203
+ this.element.attr( "role", "spinbutton" );
204
+
205
+ // button bindings
206
+ this.buttons = uiSpinner.find( ".ui-spinner-button" )
207
+ .attr( "tabIndex", -1 )
208
+ .button()
209
+ .removeClass( "ui-corner-all" );
210
+
211
+ // IE 6 doesn't understand height: 50% for the buttons
212
+ // unless the wrapper has an explicit height
213
+ if ( this.buttons.height() > Math.ceil( uiSpinner.height() * 0.5 ) &&
214
+ uiSpinner.height() > 0 ) {
215
+ uiSpinner.height( uiSpinner.height() );
216
+ }
217
+
218
+ // disable spinner if element was already disabled
219
+ if ( this.options.disabled ) {
220
+ this.disable();
221
+ }
222
+ },
223
+
224
+ _keydown: function( event ) {
225
+ var options = this.options,
226
+ keyCode = $.ui.keyCode;
227
+
228
+ switch ( event.keyCode ) {
229
+ case keyCode.UP:
230
+ this._repeat( null, 1, event );
231
+ return true;
232
+ case keyCode.DOWN:
233
+ this._repeat( null, -1, event );
234
+ return true;
235
+ case keyCode.PAGE_UP:
236
+ this._repeat( null, options.page, event );
237
+ return true;
238
+ case keyCode.PAGE_DOWN:
239
+ this._repeat( null, -options.page, event );
240
+ return true;
241
+ }
242
+
243
+ return false;
244
+ },
245
+
246
+ _uiSpinnerHtml: function() {
247
+ return "<span class='ui-spinner ui-widget ui-widget-content ui-corner-all'></span>";
248
+ },
249
+
250
+ _buttonHtml: function() {
251
+ return "" +
252
+ "<a class='ui-spinner-button ui-spinner-up ui-corner-tr'>" +
253
+ "<span class='ui-icon " + this.options.icons.up + "'>&#9650;</span>" +
254
+ "</a>" +
255
+ "<a class='ui-spinner-button ui-spinner-down ui-corner-br'>" +
256
+ "<span class='ui-icon " + this.options.icons.down + "'>&#9660;</span>" +
257
+ "</a>";
258
+ },
259
+
260
+ _start: function( event ) {
261
+ if ( !this.spinning && this._trigger( "start", event ) === false ) {
262
+ return false;
263
+ }
264
+
265
+ if ( !this.counter ) {
266
+ this.counter = 1;
267
+ }
268
+ this.spinning = true;
269
+ return true;
270
+ },
271
+
272
+ _repeat: function( i, steps, event ) {
273
+ i = i || 500;
274
+
275
+ clearTimeout( this.timer );
276
+ this.timer = this._delay(function() {
277
+ this._repeat( 40, steps, event );
278
+ }, i );
279
+
280
+ this._spin( steps * this.options.step, event );
281
+ },
282
+
283
+ _spin: function( step, event ) {
284
+ var value = this.value() || 0;
285
+
286
+ if ( !this.counter ) {
287
+ this.counter = 1;
288
+ }
289
+
290
+ value = this._adjustValue( value + step * this._increment( this.counter ) );
291
+
292
+ if ( !this.spinning || this._trigger( "spin", event, { value: value } ) !== false) {
293
+ this._value( value );
294
+ this.counter++;
295
+ }
296
+ },
297
+
298
+ _increment: function( i ) {
299
+ var incremental = this.options.incremental;
300
+
301
+ if ( incremental ) {
302
+ return $.isFunction( incremental ) ?
303
+ incremental( i ) :
304
+ Math.floor( i*i*i/50000 - i*i/500 + 17*i/200 + 1 );
305
+ }
306
+
307
+ return 1;
308
+ },
309
+
310
+ _precision: function() {
311
+ var precision = this._precisionOf( this.options.step );
312
+ if ( this.options.min !== null ) {
313
+ precision = Math.max( precision, this._precisionOf( this.options.min ) );
314
+ }
315
+ return precision;
316
+ },
317
+
318
+ _precisionOf: function( num ) {
319
+ var str = num.toString(),
320
+ decimal = str.indexOf( "." );
321
+ return decimal === -1 ? 0 : str.length - decimal - 1;
322
+ },
323
+
324
+ _adjustValue: function( value ) {
325
+ var base, aboveMin,
326
+ options = this.options;
327
+
328
+ // make sure we're at a valid step
329
+ // - find out where we are relative to the base (min or 0)
330
+ base = options.min !== null ? options.min : 0;
331
+ aboveMin = value - base;
332
+ // - round to the nearest step
333
+ aboveMin = Math.round(aboveMin / options.step) * options.step;
334
+ // - rounding is based on 0, so adjust back to our base
335
+ value = base + aboveMin;
336
+
337
+ // fix precision from bad JS floating point math
338
+ value = parseFloat( value.toFixed( this._precision() ) );
339
+
340
+ // clamp the value
341
+ if ( options.max !== null && value > options.max) {
342
+ return options.max;
343
+ }
344
+ if ( options.min !== null && value < options.min ) {
345
+ return options.min;
346
+ }
347
+
348
+ return value;
349
+ },
350
+
351
+ _stop: function( event ) {
352
+ if ( !this.spinning ) {
353
+ return;
354
+ }
355
+
356
+ clearTimeout( this.timer );
357
+ clearTimeout( this.mousewheelTimer );
358
+ this.counter = 0;
359
+ this.spinning = false;
360
+ this._trigger( "stop", event );
361
+ },
362
+
363
+ _setOption: function( key, value ) {
364
+ if ( key === "culture" || key === "numberFormat" ) {
365
+ var prevValue = this._parse( this.element.val() );
366
+ this.options[ key ] = value;
367
+ this.element.val( this._format( prevValue ) );
368
+ return;
369
+ }
370
+
371
+ if ( key === "max" || key === "min" || key === "step" ) {
372
+ if ( typeof value === "string" ) {
373
+ value = this._parse( value );
374
+ }
375
+ }
376
+ if ( key === "icons" ) {
377
+ this.buttons.first().find( ".ui-icon" )
378
+ .removeClass( this.options.icons.up )
379
+ .addClass( value.up );
380
+ this.buttons.last().find( ".ui-icon" )
381
+ .removeClass( this.options.icons.down )
382
+ .addClass( value.down );
383
+ }
384
+
385
+ this._super( key, value );
386
+
387
+ if ( key === "disabled" ) {
388
+ if ( value ) {
389
+ this.element.prop( "disabled", true );
390
+ this.buttons.button( "disable" );
391
+ } else {
392
+ this.element.prop( "disabled", false );
393
+ this.buttons.button( "enable" );
394
+ }
395
+ }
396
+ },
397
+
398
+ _setOptions: modifier(function( options ) {
399
+ this._super( options );
400
+ this._value( this.element.val() );
401
+ }),
402
+
403
+ _parse: function( val ) {
404
+ if ( typeof val === "string" && val !== "" ) {
405
+ val = window.Globalize && this.options.numberFormat ?
406
+ Globalize.parseFloat( val, 10, this.options.culture ) : +val;
407
+ }
408
+ return val === "" || isNaN( val ) ? null : val;
409
+ },
410
+
411
+ _format: function( value ) {
412
+ if ( value === "" ) {
413
+ return "";
414
+ }
415
+ return window.Globalize && this.options.numberFormat ?
416
+ Globalize.format( value, this.options.numberFormat, this.options.culture ) :
417
+ value;
418
+ },
419
+
420
+ _refresh: function() {
421
+ this.element.attr({
422
+ "aria-valuemin": this.options.min,
423
+ "aria-valuemax": this.options.max,
424
+ // TODO: what should we do with values that can't be parsed?
425
+ "aria-valuenow": this._parse( this.element.val() )
426
+ });
427
+ },
428
+
429
+ // update the value without triggering change
430
+ _value: function( value, allowAny ) {
431
+ var parsed;
432
+ if ( value !== "" ) {
433
+ parsed = this._parse( value );
434
+ if ( parsed !== null ) {
435
+ if ( !allowAny ) {
436
+ parsed = this._adjustValue( parsed );
437
+ }
438
+ value = this._format( parsed );
439
+ }
440
+ }
441
+ this.element.val( value );
442
+ this._refresh();
443
+ },
444
+
445
+ _destroy: function() {
446
+ this.element
447
+ .removeClass( "ui-spinner-input" )
448
+ .prop( "disabled", false )
449
+ .removeAttr( "autocomplete" )
450
+ .removeAttr( "role" )
451
+ .removeAttr( "aria-valuemin" )
452
+ .removeAttr( "aria-valuemax" )
453
+ .removeAttr( "aria-valuenow" );
454
+ this.uiSpinner.replaceWith( this.element );
455
+ },
456
+
457
+ stepUp: modifier(function( steps ) {
458
+ this._stepUp( steps );
459
+ }),
460
+ _stepUp: function( steps ) {
461
+ if ( this._start() ) {
462
+ this._spin( (steps || 1) * this.options.step );
463
+ this._stop();
464
+ }
465
+ },
466
+
467
+ stepDown: modifier(function( steps ) {
468
+ this._stepDown( steps );
469
+ }),
470
+ _stepDown: function( steps ) {
471
+ if ( this._start() ) {
472
+ this._spin( (steps || 1) * -this.options.step );
473
+ this._stop();
474
+ }
475
+ },
476
+
477
+ pageUp: modifier(function( pages ) {
478
+ this._stepUp( (pages || 1) * this.options.page );
479
+ }),
480
+
481
+ pageDown: modifier(function( pages ) {
482
+ this._stepDown( (pages || 1) * this.options.page );
483
+ }),
484
+
485
+ value: function( newVal ) {
486
+ if ( !arguments.length ) {
487
+ return this._parse( this.element.val() );
488
+ }
489
+ modifier( this._value ).call( this, newVal );
490
+ },
491
+
492
+ widget: function() {
493
+ return this.uiSpinner;
494
+ }
495
+ });
496
+
497
+ }( jQuery ) );