Mercurial > hg > rc2
view plugins/jqueryui/js/jquery-ui-accessible-datepicker.min.js @ 8:bf99236cc5cd default tip
try to recover from upgrade fail
author | Charlie Root |
---|---|
date | Sat, 29 Dec 2018 07:07:34 -0500 |
parents | 4681f974d28b |
children |
line wrap: on
line source
/* jQuery UI Accessible Datepicker extension * (to be appended to jquery-ui-*.custom.min.js) * * @licstart The following is the entire license notice for the * JavaScript code in this page. * * Copyright 2014 Kolab Systems AG * * The JavaScript code in this page is free software: you can * redistribute it and/or modify it under the terms of the GNU * General Public License (GNU GPL) as published by the Free Software * Foundation, either version 3 of the License, or (at your option) * any later version. The code is distributed WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU GPL for more details. * * As additional permission under GNU GPL version 3 section 7, you * may distribute non-source (e.g., minimized or compacted) forms of * that code without the copy of the GNU GPL normally required by * section 4, provided you include this license notice and a URL * through which recipients can access the Corresponding Source. * * @licend The above is the entire license notice * for the JavaScript code in this page. */ (function(e,g){var d=e.datepicker._newInst;var b=e.datepicker._updateDatepicker;var a=e.datepicker._connectDatepicker;var f=e.datepicker._showDatepicker;var c=e.datepicker._hideDatepicker;e.extend(e.datepicker,{_newInst:function(l,k){var i=this,j=d.call(this,l,k);if(j.inline){j.dpDiv.on("keydown.datepicker",".ui-datepicker-calendar",function(n){if(e.inArray(n.keyCode,[13,33,34,35,36,37,38,39,40])==-1){return}n.stopPropagation();n.preventDefault();j._hasfocus=true;var m;switch(n.keyCode){case e.ui.keyCode.ENTER:if((m=e("."+i._dayOverClass,j.dpDiv).get(0)||e("."+i._currentClass,j.dpDiv).get(0))){i._selectDay(j.input,j.selectedMonth,j.selectedYear,m)}break;case e.ui.keyCode.PAGE_UP:i._adjustDate(j.input,-i._get(j,"stepMonths"),"M");break;case e.ui.keyCode.PAGE_DOWN:i._adjustDate(j.input,i._get(j,"stepMonths"),"M");break;default:return i._cursorKeydown(n,j)}}).attr("role","region").attr("aria-labelledby",j.id+"-dp-title")}else{var h=j.dpDiv.attr("id")||j.id+"-dp-widget";j.dpDiv.attr("id",h).attr("aria-hidden","true").attr("aria-labelledby",j.id+"-dp-title");e(j.input).attr("aria-haspopup","true").attr("aria-expanded","false").attr("aria-owns",h)}return j},_connectDatepicker:function(j,i){a.call(this,j,i);var h=this;e(j).unbind("keydown.datepicker-extended").bind("keydown.datepicker-extended",function(k){var l=1;switch(k.keyCode){case 109:case 173:case 189:l=-1;case 61:case 107:case 187:if(this.value.length<h._formatDate(i,i.selectedDay,i.selectedMonth,i.selectedYear).length){return true}h._adjustInstDate(i,l,"D");h._selectDateRC(j,h._formatDate(i,i.selectedDay,i.selectedMonth,i.selectedYear));return false;case e.ui.keyCode.UP:case e.ui.keyCode.DOWN:if(e.datepicker._lastInput!==j&&!e.datepicker._isDisabledDatepicker(j)){h._showDatepicker(k);k.stopPropagation();k.preventDefault();return false}default:if(!e.datepicker._isDisabledDatepicker(j)&&!k.ctrlKey&&!k.metaKey){return h._cursorKeydown(k,i)}}}).click(function(k){h._showDatepicker(k)}).attr("autocomplete","off")},_cursorKeydown:function(i,j){j._keyEvent=true;var h=j.dpDiv.hasClass("ui-datepicker-rtl");switch(i.keyCode){case e.ui.keyCode.LEFT:this._adjustDate(j.input,(h?+1:-1),"D");break;case e.ui.keyCode.RIGHT:this._adjustDate(j.input,(h?-1:+1),"D");break;case e.ui.keyCode.UP:this._adjustDate(j.input,-7,"D");break;case e.ui.keyCode.DOWN:this._adjustDate(j.input,+7,"D");break;case e.ui.keyCode.HOME:break;case e.ui.keyCode.END:break}return true},_showDatepicker:function(h){h=h.target||h;f.call(this,h);var i=e.datepicker._getInst(h);if(i&&e.datepicker._datepickerShowing){i.dpDiv.attr("aria-hidden","false");e(h).attr("aria-expanded","true")}},_hideDatepicker:function(h){c.call(this,h);var i=this._curInst;if(i&&!e.datepicker._datepickerShowing){i.dpDiv.attr("aria-hidden","true");e(i.input).attr("aria-expanded","false")}},_updateDatepicker:function(i){b.call(this,i);var h=e("."+this._dayOverClass,i.dpDiv).get(0)||e("."+this._currentClass,i.dpDiv).get(0);if(h){h=e(h);h.attr("id",i.id+"-day-"+h.text())}i.dpDiv.find(".ui-datepicker-calendar").attr("tabindex",i.inline?"0":"-1").attr("role","grid").attr("aria-readonly","true").attr("aria-activedescendant",h?h.attr("id"):"").find("td").attr("role","gridcell").attr("aria-selected","false").find("a").attr("tabindex","-1");e(".ui-datepicker-current-day",i.dpDiv).attr("aria-selected","true");i.dpDiv.find(".ui-datepicker-title").attr("id",i.id+"-dp-title");if(i._hasfocus){i.dpDiv.find(".ui-datepicker-calendar").focus();i._hasfocus=false}},_selectDateRC:function(k,h){var j=e(k),i=this._getInst(j[0]);h=(h!=null?h:this._formatDate(i));if(i.input){i.input.val(h)}this._updateAlternate(i);if(i.input){i.input.trigger("change")}if(i.inline){this._updateDatepicker(i)}}})}(jQuery));