Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Timepicker: removing a console.log - adding a second timepicker to th…

…e visual test
  • Loading branch information...
commit c1a15ffc1a7299a0313581b75debd2902102c224 1 parent c7fce88
@gnarf gnarf authored
Showing with 19 additions and 16 deletions.
  1. +3 −0  tests/visual/timepicker/timepicker.html
  2. +16 −16 ui/jquery.ui.timepicker.js
View
3  tests/visual/timepicker/timepicker.html
@@ -14,6 +14,7 @@
<script>
$(function() {
$("#timepicker").timepicker();
+ $("#timepicker2").timepicker();
});
</script>
<style>
@@ -27,6 +28,8 @@
<form>
<label>Timepicker</label>
<input id="timepicker">
+ <label>Timepicker - With Initial Value</label>
+ <input id="timepicker2" value="12:00:00 pm">
</form>
</body>
</html>
View
32 ui/jquery.ui.timepicker.js
@@ -32,22 +32,6 @@ $.widget( "ui.timepicker", {
},
_create: function() {
- this.element.spinner();
- this.spinner = this.element.data( "spinner" );
- $.extend( this.spinner, {
- _parse: $.proxy( this, "_spinnerParse" ),
- _value: $.proxy( this, "_spinnerValue" ),
- _trimValue: function( value ) {
- console.log( "trimming", value );
- if ( value < this.options.min ) {
- return this.options.max;
- }
- if ( value > this.options.max ) {
- return this.options.min;
- }
- return value;
- }
- });
this.element.mask({
mask: "hh:mm:ss pp",
clearEmpty: false,
@@ -76,6 +60,21 @@ $.widget( "ui.timepicker", {
}
});
this.mask = this.element.data( "mask" );
+ this.element.spinner();
+ this.spinner = this.element.data( "spinner" );
+ $.extend( this.spinner, {
+ _parse: $.proxy( this, "_spinnerParse" ),
+ _value: $.proxy( this, "_spinnerValue" ),
+ _trimValue: function( value ) {
+ if ( value < this.options.min ) {
+ return this.options.max;
+ }
+ if ( value > this.options.max ) {
+ return this.options.min;
+ }
+ return value;
+ }
+ });
this._setField( 0 );
this._bind( this._events );
},
@@ -118,6 +117,7 @@ $.widget( "ui.timepicker", {
val = parseInt( val, 10 ) ? "pm" : "am";
}
bufferObject.value = bufferObject.valid( val );
+ console.log( "setting", val, this.currentField, bufferObject );
this.mask._paint();
this.spinner._refresh();
this.mask._caret( this.currentField * 3, this.currentField * 3 + 2 );
Please sign in to comment.
Something went wrong with that request. Please try again.