16
16
//>>css.structure: ../themes/base/spinner.css
17
17
//>>css.theme: ../themes/base/theme.css
18
18
19
- ( function ( factory ) {
19
+ ( function ( factory ) {
20
20
if ( typeof define === "function" && define . amd ) {
21
21
22
22
// AMD. Register as an anonymous module.
23
- define ( [
23
+ define ( [
24
24
"jquery" ,
25
25
"./core" ,
26
26
"./widget" ,
31
31
// Browser globals
32
32
factory ( jQuery ) ;
33
33
}
34
- } ( function ( $ ) {
34
+ } ( function ( $ ) {
35
35
36
36
function spinner_modifier ( fn ) {
37
37
return function ( ) {
@@ -96,7 +96,7 @@ return $.widget( "ui.spinner", {
96
96
beforeunload : function ( ) {
97
97
this . element . removeAttr ( "autocomplete" ) ;
98
98
}
99
- } ) ;
99
+ } ) ;
100
100
} ,
101
101
102
102
_getCreateOptions : function ( ) {
@@ -108,7 +108,7 @@ return $.widget( "ui.spinner", {
108
108
if ( value !== undefined && value . length ) {
109
109
options [ option ] = value ;
110
110
}
111
- } ) ;
111
+ } ) ;
112
112
113
113
return options ;
114
114
} ,
@@ -143,9 +143,9 @@ return $.widget( "ui.spinner", {
143
143
return false ;
144
144
}
145
145
146
- this . _spin ( ( delta > 0 ? 1 : - 1 ) * this . options . step , event ) ;
146
+ this . _spin ( ( delta > 0 ? 1 : - 1 ) * this . options . step , event ) ;
147
147
clearTimeout ( this . mousewheelTimer ) ;
148
- this . mousewheelTimer = this . _delay ( function ( ) {
148
+ this . mousewheelTimer = this . _delay ( function ( ) {
149
149
if ( this . spinning ) {
150
150
this . _stop ( event ) ;
151
151
}
@@ -160,19 +160,19 @@ return $.widget( "ui.spinner", {
160
160
// If the input is focused then this.previous is properly set from
161
161
// when the input first received focus. If the input is not focused
162
162
// then we need to set this.previous based on the value before spinning.
163
- previous = this . element [ 0 ] === $ . ui . safeActiveElement ( this . document [ 0 ] ) ?
163
+ previous = this . element [ 0 ] === $ . ui . safeActiveElement ( this . document [ 0 ] ) ?
164
164
this . previous : this . element . val ( ) ;
165
165
function checkFocus ( ) {
166
- var isActive = this . element [ 0 ] === $ . ui . safeActiveElement ( this . document [ 0 ] ) ;
166
+ var isActive = this . element [ 0 ] === $ . ui . safeActiveElement ( this . document [ 0 ] ) ;
167
167
if ( ! isActive ) {
168
168
this . element . focus ( ) ;
169
169
this . previous = previous ;
170
170
// support: IE
171
171
// IE sets focus asynchronously, so we need to check if focus
172
172
// moved off of the input because the user clicked on the button.
173
- this . _delay ( function ( ) {
173
+ this . _delay ( function ( ) {
174
174
this . previous = previous ;
175
- } ) ;
175
+ } ) ;
176
176
}
177
177
}
178
178
@@ -185,10 +185,10 @@ return $.widget( "ui.spinner", {
185
185
// so we set a flag to know when we should ignore the blur event
186
186
// and check (again) if focus moved off of the input.
187
187
this . cancelBlur = true ;
188
- this . _delay ( function ( ) {
188
+ this . _delay ( function ( ) {
189
189
delete this . cancelBlur ;
190
190
checkFocus . call ( this ) ;
191
- } ) ;
191
+ } ) ;
192
192
193
193
if ( this . _start ( event ) === false ) {
194
194
return ;
@@ -307,7 +307,7 @@ return $.widget( "ui.spinner", {
307
307
i = i || 500 ;
308
308
309
309
clearTimeout ( this . timer ) ;
310
- this . timer = this . _delay ( function ( ) {
310
+ this . timer = this . _delay ( function ( ) {
311
311
this . _repeat ( 40 , steps , event ) ;
312
312
} , i ) ;
313
313
@@ -323,7 +323,7 @@ return $.widget( "ui.spinner", {
323
323
324
324
value = this . _adjustValue ( value + step * this . _increment ( this . counter ) ) ;
325
325
326
- if ( ! this . spinning || this . _trigger ( "spin" , event , { value : value } ) !== false ) {
326
+ if ( ! this . spinning || this . _trigger ( "spin" , event , { value : value } ) !== false ) {
327
327
this . _value ( value ) ;
328
328
this . counter ++ ;
329
329
}
@@ -364,15 +364,15 @@ return $.widget( "ui.spinner", {
364
364
base = options . min !== null ? options . min : 0 ;
365
365
aboveMin = value - base ;
366
366
// - round to the nearest step
367
- aboveMin = Math . round ( aboveMin / options . step ) * options . step ;
367
+ aboveMin = Math . round ( aboveMin / options . step ) * options . step ;
368
368
// - rounding is based on 0, so adjust back to our base
369
369
value = base + aboveMin ;
370
370
371
371
// fix precision from bad JS floating point math
372
372
value = parseFloat ( value . toFixed ( this . _precision ( ) ) ) ;
373
373
374
374
// clamp the value
375
- if ( options . max !== null && value > options . max ) {
375
+ if ( options . max !== null && value > options . max ) {
376
376
return options . max ;
377
377
}
378
378
if ( options . min !== null && value < options . min ) {
@@ -427,9 +427,9 @@ return $.widget( "ui.spinner", {
427
427
}
428
428
} ,
429
429
430
- _setOptions : spinner_modifier ( function ( options ) {
430
+ _setOptions : spinner_modifier ( function ( options ) {
431
431
this . _super ( options ) ;
432
- } ) ,
432
+ } ) ,
433
433
434
434
_parse : function ( val ) {
435
435
if ( typeof val === "string" && val !== "" ) {
@@ -449,12 +449,12 @@ return $.widget( "ui.spinner", {
449
449
} ,
450
450
451
451
_refresh : function ( ) {
452
- this . element . attr ( {
452
+ this . element . attr ( {
453
453
"aria-valuemin" : this . options . min ,
454
454
"aria-valuemax" : this . options . max ,
455
455
// TODO: what should we do with values that can't be parsed?
456
456
"aria-valuenow" : this . _parse ( this . element . val ( ) )
457
- } ) ;
457
+ } ) ;
458
458
} ,
459
459
460
460
isValid : function ( ) {
@@ -497,33 +497,33 @@ return $.widget( "ui.spinner", {
497
497
this . uiSpinner . replaceWith ( this . element ) ;
498
498
} ,
499
499
500
- stepUp : spinner_modifier ( function ( steps ) {
500
+ stepUp : spinner_modifier ( function ( steps ) {
501
501
this . _stepUp ( steps ) ;
502
- } ) ,
502
+ } ) ,
503
503
_stepUp : function ( steps ) {
504
504
if ( this . _start ( ) ) {
505
- this . _spin ( ( steps || 1 ) * this . options . step ) ;
505
+ this . _spin ( ( steps || 1 ) * this . options . step ) ;
506
506
this . _stop ( ) ;
507
507
}
508
508
} ,
509
509
510
- stepDown : spinner_modifier ( function ( steps ) {
510
+ stepDown : spinner_modifier ( function ( steps ) {
511
511
this . _stepDown ( steps ) ;
512
- } ) ,
512
+ } ) ,
513
513
_stepDown : function ( steps ) {
514
514
if ( this . _start ( ) ) {
515
- this . _spin ( ( steps || 1 ) * - this . options . step ) ;
515
+ this . _spin ( ( steps || 1 ) * - this . options . step ) ;
516
516
this . _stop ( ) ;
517
517
}
518
518
} ,
519
519
520
- pageUp : spinner_modifier ( function ( pages ) {
521
- this . _stepUp ( ( pages || 1 ) * this . options . page ) ;
522
- } ) ,
520
+ pageUp : spinner_modifier ( function ( pages ) {
521
+ this . _stepUp ( ( pages || 1 ) * this . options . page ) ;
522
+ } ) ,
523
523
524
- pageDown : spinner_modifier ( function ( pages ) {
525
- this . _stepDown ( ( pages || 1 ) * this . options . page ) ;
526
- } ) ,
524
+ pageDown : spinner_modifier ( function ( pages ) {
525
+ this . _stepDown ( ( pages || 1 ) * this . options . page ) ;
526
+ } ) ,
527
527
528
528
value : function ( newVal ) {
529
529
if ( ! arguments . length ) {
@@ -535,6 +535,6 @@ return $.widget( "ui.spinner", {
535
535
widget : function ( ) {
536
536
return this . uiSpinner ;
537
537
}
538
- } ) ;
538
+ } ) ;
539
539
540
- } ) ) ;
540
+ } ) ) ;
0 commit comments