Sha256: 8f382da4bede937d18721b51f9d43d8c536e634881575acb96c3fb17531403fb

Contents?: true

Size: 1.17 KB

Versions: 59

Compression:

Stored size: 1.17 KB

Contents

(function($) {
  
  datePickerOpts = {
    dateFormat: 'yy-mm-dd',
    partialDateFormats: ['yy-mm', 'yy'],
    allowShortYear: false,
    ignoreTrailingCharacters: false
  }
  
  validateDate = function(event) {
    try {
        $.datepicker.parseDate(
          $.data(event.target, 'datepicker'),
          event.target.value)
        $(event.target).removeClass('error')
      } catch(err) {
        // Wait to highlight error until user is done typing
        if(event.type != 'keyup')
          $(event.target).addClass('error')
    }
  }
  
  $(document).ready(function() {
    $('.datepicker').datepicker(datePickerOpts).change(validateDate).keyup(validateDate)
  })


	// Monkey patch for fluidinfusion: There is a conflict between fluid.setCaretToEnd's attempt to move cursor
	// into view in Firefox by generating junk keystrokes, and datepicker's filtering of keystrokes. This fixes it
	// by disabling that behavior when a text field has a datepicker.
	var setCaretToEnd_unpatched = fluid.setCaretToEnd;
  fluid.setCaretToEnd = function (control, value) {
		if(!$.data(control, 'datepicker'))
			setCaretToEnd_unpatched(control, value)
		else
    	control.focus()
  }
  
})(jQuery)

Version data entries

59 entries across 59 versions & 2 rubygems

Version Path
hydra-file-access-5.4.1 app/assets/javascripts/hydra/mediashelf.datepicker.js
hydra-file-access-5.4.0.pre1 app/assets/javascripts/hydra/mediashelf.datepicker.js
hydra-file-access-5.3.0 app/assets/javascripts/hydra/mediashelf.datepicker.js
hydra-file-access-5.1.0 app/assets/javascripts/hydra/mediashelf.datepicker.js
hydra-file-access-5.0.1 app/assets/javascripts/hydra/mediashelf.datepicker.js
hydra-file-access-5.0.0 app/assets/javascripts/hydra/mediashelf.datepicker.js
hydra-file-access-5.0.0.rc1 app/assets/javascripts/hydra/mediashelf.datepicker.js
hydra-file-access-5.0.0.pre15 app/assets/javascripts/hydra/mediashelf.datepicker.js
hydra-file-access-5.0.0.pre14 app/assets/javascripts/hydra/mediashelf.datepicker.js
hydra-file-access-5.0.0.pre13 app/assets/javascripts/hydra/mediashelf.datepicker.js
hydra-file-access-5.0.0.pre12 app/assets/javascripts/hydra/mediashelf.datepicker.js
hydra-head-4.1.3 app/assets/javascripts/hydra/mediashelf.datepicker.js
hydra-file-access-5.0.0.pre11 app/assets/javascripts/hydra/mediashelf.datepicker.js
hydra-file-access-5.0.0.pre10 app/assets/javascripts/hydra/mediashelf.datepicker.js
hydra-head-4.1.2 app/assets/javascripts/hydra/mediashelf.datepicker.js
hydra-file-access-5.0.0.pre9 app/assets/javascripts/hydra/mediashelf.datepicker.js
hydra-file-access-5.0.0.pre8 app/assets/javascripts/hydra/mediashelf.datepicker.js
hydra-file-access-5.0.0.pre7 app/assets/javascripts/hydra/mediashelf.datepicker.js
hydra-file-access-5.0.0.pre6 app/assets/javascripts/hydra/mediashelf.datepicker.js
hydra-file-access-5.0.0.pre4 app/assets/javascripts/hydra/mediashelf.datepicker.js