will_pickdate 0.9.6 → 0.9.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
| @@ -483,8 +483,8 @@ | |
| 483 483 | 
             
                    i.val(i.val() == "AM" ? "PM" : "AM");
         | 
| 484 484 | 
             
                  }
         | 
| 485 485 | 
             
                },
         | 
| 486 | 
            -
             | 
| 487 | 
            -
                keyWrapper: function(f, event) {
         | 
| 486 | 
            +
                
         | 
| 487 | 
            +
                keyWrapper: function(f, ampm, event) {
         | 
| 488 488 | 
             
                  dy = 0;
         | 
| 489 489 | 
             
                  if(event.which == 38) {
         | 
| 490 490 | 
             
                    //up arrow
         | 
| @@ -492,10 +492,14 @@ | |
| 492 492 | 
             
                  } else if (event.which == 40) {
         | 
| 493 493 | 
             
                    //down arrow
         | 
| 494 494 | 
             
                    dy = -1;
         | 
| 495 | 
            -
                  } else if (48 <= event.which && event.which <= 57) {
         | 
| 496 | 
            -
                    aux = event.target.value + String.fromCharCode(event.which)
         | 
| 497 | 
            -
                    event.target.value = (aux).substr(Math.max(aux.length - 2, 0),2)
         | 
| 498 | 
            -
                  } else if ( | 
| 495 | 
            +
                  } else if (!ampm && 48 <= event.which && event.which <= 57) {
         | 
| 496 | 
            +
                    aux = event.target.value + String.fromCharCode(event.which);
         | 
| 497 | 
            +
                    event.target.value = (aux).substr(Math.max(aux.length - 2, 0),2);
         | 
| 498 | 
            +
                  } else if (ampm && event.which == 65) {
         | 
| 499 | 
            +
                    event.target.value = 'AM';
         | 
| 500 | 
            +
                  } else if (ampm && event.which == 80) {
         | 
| 501 | 
            +
                    event.target.value = 'PM';
         | 
| 502 | 
            +
                  } else if (event.which == 9 || (!ampm && (event.which == 46 || event.which == 8))) {
         | 
| 499 503 | 
             
                    //allow tab to skip to next
         | 
| 500 504 | 
             
                    //allow delete and backspace to have normal behaviour
         | 
| 501 505 | 
             
                    return;   
         | 
| @@ -521,12 +525,12 @@ | |
| 521 525 | 
             
                            this.working_date.getHours() :
         | 
| 522 526 | 
             
                              (this.working_date.getHours() > 12 ? this.working_date.getHours() - 12 :
         | 
| 523 527 | 
             
                                this.working_date.getHours())) + '"/>')
         | 
| 524 | 
            -
                    .on('keydown', $.proxy(this.keyWrapper, this, this.hourShifter))
         | 
| 528 | 
            +
                    .on('keydown', $.proxy(this.keyWrapper, this, this.hourShifter, false))
         | 
| 525 529 | 
             
                    .mousewheel($.proxy(this.hourShifter, this)));
         | 
| 526 530 |  | 
| 527 531 | 
             
                  container.append($('<input type="text" class="minutes"' + (this.options.militaryTime ? ' style="left:110px"' : '') + ' maxlength="2" value="' +
         | 
| 528 532 | 
             
                          this.leadZero(this.working_date.getMinutes()) + '"/>')
         | 
| 529 | 
            -
                    .on('keydown', $.proxy(this.keyWrapper, this, this.minuteShifter))
         | 
| 533 | 
            +
                    .on('keydown', $.proxy(this.keyWrapper, this, this.minuteShifter, false))
         | 
| 530 534 | 
             
                    .mousewheel($.proxy(this.minuteShifter, this)));
         | 
| 531 535 |  | 
| 532 536 | 
             
                  container.append($('<div class="separator"' + (this.options.militaryTime ? ' style="left:91px"' : '') + '>:</div>'));
         | 
| @@ -534,7 +538,7 @@ | |
| 534 538 | 
             
                  if(!this.options.militaryTime) {
         | 
| 535 539 | 
             
                    container.append($('<input type="text" class="ampm" maxlength="2" value="' +
         | 
| 536 540 | 
             
                      (this.working_date.getHours() >= 12 ? "PM" : "AM") + '"/>')
         | 
| 537 | 
            -
                      .on('keydown', $.proxy(this.keyWrapper, this, this.ampmShifter))
         | 
| 541 | 
            +
                      .on('keydown', $.proxy(this.keyWrapper, this, this.ampmShifter, true))
         | 
| 538 542 | 
             
                      .mousewheel($.proxy(this.ampmShifter)));
         | 
| 539 543 | 
             
                  }
         | 
| 540 544 |  | 
| @@ -552,6 +556,7 @@ | |
| 552 556 | 
             
                        minutes: parseInt(this.picker.find('.minutes').val(), 10)
         | 
| 553 557 | 
             
                      }));
         | 
| 554 558 | 
             
                  }, this)));
         | 
| 559 | 
            +
                  container.append('<p class="helper"><small>Tip: you can also use ↑, ↓ and the mouse wheel to shift values</small></p>');
         | 
| 555 560 | 
             
                },
         | 
| 556 561 |  | 
| 557 562 | 
             
                renderMonth: function() {
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: will_pickdate
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.9. | 
| 4 | 
            +
              version: 0.9.7
         | 
| 5 5 | 
             
              prerelease: 
         | 
| 6 6 | 
             
            platform: ruby
         | 
| 7 7 | 
             
            authors:
         | 
| @@ -9,7 +9,7 @@ authors: | |
| 9 9 | 
             
            autorequire: 
         | 
| 10 10 | 
             
            bindir: bin
         | 
| 11 11 | 
             
            cert_chain: []
         | 
| 12 | 
            -
            date: 2013-05- | 
| 12 | 
            +
            date: 2013-05-14 00:00:00.000000000 Z
         | 
| 13 13 | 
             
            dependencies:
         | 
| 14 14 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 15 | 
             
              name: rake
         |