2 $.datepicker._newInst_orig = $.datepicker._newInst;
3 $.datepicker._newInst = function(target, inline) {
4 var data = this._newInst_orig(target, inline);
6 // Escape single quotes to avoid incorrect quoting in onclick handlers
7 // when other datepicker code interpolates inst.id. They'll already be
8 // escaped by the original _newInst for handing to jQuery's CSS
10 data.id = data.id.replace(/'/g, "\\'");
15 $.datepicker._checkOffset_orig = $.datepicker._checkOffset;
16 $.datepicker._checkOffset = function(inst, offset, isFixed) {
17 // copied from the original
18 var dpHeight = inst.dpDiv.outerHeight();
19 var inputHeight = inst.input ? inst.input.outerHeight() : 0;
20 var viewHeight = document.documentElement.clientHeight + $(document).scrollTop();
22 // save the original offset rather than the new offset because the
23 // original function modifies the passed arg as a side-effect
24 var old_offset = { top: offset.top, left: offset.left };
25 offset = $.datepicker._checkOffset_orig(inst, offset, isFixed);
27 // Negate any up or down positioning by adding instead of subtracting
28 offset.top += Math.min(old_offset.top, (old_offset.top + dpHeight > viewHeight && viewHeight > dpHeight) ?
29 Math.abs(dpHeight + inputHeight) : 0);
35 $.timepicker._newInst_orig = $.timepicker._newInst;
36 $.timepicker._newInst = function($input, o) {
37 var tp_inst = $.timepicker._newInst_orig($input, o);
38 tp_inst._defaults.onClose = function(dateText, dp_inst) {
39 if ($.isFunction(o.onClose))
40 o.onClose.call($input[0], dateText, dp_inst, tp_inst);