1 /*! |
1 /*! |
2 * jQuery UI Spinner 1.13.1 |
2 * jQuery UI Spinner 1.13.3 |
3 * http://jqueryui.com |
3 * https://jqueryui.com |
4 * |
4 * |
5 * Copyright jQuery Foundation and other contributors |
5 * Copyright OpenJS Foundation and other contributors |
6 * Released under the MIT license. |
6 * Released under the MIT license. |
7 * http://jquery.org/license |
7 * https://jquery.org/license |
8 */ |
8 */ |
9 |
9 |
10 //>>label: Spinner |
10 //>>label: Spinner |
11 //>>group: Widgets |
11 //>>group: Widgets |
12 //>>description: Displays buttons to easily input numbers via the keyboard or mouse. |
12 //>>description: Displays buttons to easily input numbers via the keyboard or mouse. |
13 //>>docs: http://api.jqueryui.com/spinner/ |
13 //>>docs: https://api.jqueryui.com/spinner/ |
14 //>>demos: http://jqueryui.com/spinner/ |
14 //>>demos: https://jqueryui.com/spinner/ |
15 //>>css.structure: ../../themes/base/core.css |
15 //>>css.structure: ../../themes/base/core.css |
16 //>>css.structure: ../../themes/base/spinner.css |
16 //>>css.structure: ../../themes/base/spinner.css |
17 //>>css.theme: ../../themes/base/theme.css |
17 //>>css.theme: ../../themes/base/theme.css |
18 |
18 |
19 ( function( factory ) { |
19 ( function( factory ) { |
45 } |
48 } |
46 }; |
49 }; |
47 } |
50 } |
48 |
51 |
49 $.widget( "ui.spinner", { |
52 $.widget( "ui.spinner", { |
50 version: "1.13.1", |
53 version: "1.13.3", |
51 defaultElement: "<input>", |
54 defaultElement: "<input>", |
52 widgetEventPrefix: "spin", |
55 widgetEventPrefix: "spin", |
53 options: { |
56 options: { |
54 classes: { |
57 classes: { |
55 "ui-spinner": "ui-corner-all", |
58 "ui-spinner": "ui-corner-all", |
273 } ); |
276 } ); |
274 |
277 |
275 // IE 6 doesn't understand height: 50% for the buttons |
278 // IE 6 doesn't understand height: 50% for the buttons |
276 // unless the wrapper has an explicit height |
279 // unless the wrapper has an explicit height |
277 if ( this.buttons.height() > Math.ceil( this.uiSpinner.height() * 0.5 ) && |
280 if ( this.buttons.height() > Math.ceil( this.uiSpinner.height() * 0.5 ) && |
278 this.uiSpinner.height() > 0 ) { |
281 this.uiSpinner.height() > 0 ) { |
279 this.uiSpinner.height( this.uiSpinner.height() ); |
282 this.uiSpinner.height( this.uiSpinner.height() ); |
280 } |
283 } |
281 }, |
284 }, |
282 |
285 |
283 _keydown: function( event ) { |
286 _keydown: function( event ) { |
284 var options = this.options, |
287 var options = this.options, |
285 keyCode = $.ui.keyCode; |
288 keyCode = $.ui.keyCode; |
286 |
289 |
287 switch ( event.keyCode ) { |
290 switch ( event.keyCode ) { |
288 case keyCode.UP: |
291 case keyCode.UP: |
289 this._repeat( null, 1, event ); |
292 this._repeat( null, 1, event ); |
290 return true; |
293 return true; |
291 case keyCode.DOWN: |
294 case keyCode.DOWN: |
292 this._repeat( null, -1, event ); |
295 this._repeat( null, -1, event ); |
293 return true; |
296 return true; |
294 case keyCode.PAGE_UP: |
297 case keyCode.PAGE_UP: |
295 this._repeat( null, options.page, event ); |
298 this._repeat( null, options.page, event ); |
296 return true; |
299 return true; |
297 case keyCode.PAGE_DOWN: |
300 case keyCode.PAGE_DOWN: |
298 this._repeat( null, -options.page, event ); |
301 this._repeat( null, -options.page, event ); |
299 return true; |
302 return true; |
300 } |
303 } |
301 |
304 |
302 return false; |
305 return false; |
303 }, |
306 }, |
304 |
307 |
559 this.uiSpinner = this.element |
562 this.uiSpinner = this.element |
560 .attr( "autocomplete", "off" ) |
563 .attr( "autocomplete", "off" ) |
561 .wrap( this._uiSpinnerHtml() ) |
564 .wrap( this._uiSpinnerHtml() ) |
562 .parent() |
565 .parent() |
563 |
566 |
564 // Add buttons |
567 // Add buttons |
565 .append( this._buttonHtml() ); |
568 .append( this._buttonHtml() ); |
566 }, |
569 }, |
567 _uiSpinnerHtml: function() { |
570 _uiSpinnerHtml: function() { |
568 return "<span>"; |
571 return "<span>"; |
569 }, |
572 }, |
570 |
573 |