Changeset 30959


Ignore:
Timestamp:
02/13/15 09:46:19 (4 years ago)
Author:
mistic100
Message:

Merged revision(s) 30958 from trunk:
bug 3190: Datetime picker, can't change year on Chrome & IE11

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.7/admin/themes/default/js/datepicker.js

    r30957 r30959  
    3131    } 
    3232    else { 
    33       var pos = getCursor($('.ui-datepicker-year')[0]); 
    34  
    3533      inst['selectedYear'] = inst['drawYear'] = val; 
    3634 
     
    3937 
    4038      $('.ui-datepicker-year').focus(); 
    41  
    42       setCursor($('.ui-datepicker-year')[0], pos); 
    4339    } 
    4440  } 
     
    171167}; 
    172168 
    173  
    174 // functions for custom year input 
    175 function setCursor(node,pos){ 
    176   var node = (typeof node == "string" || node instanceof String) ? document.getElementById(node) : node; 
    177  
    178   if (!node) { 
    179     return false; 
    180   } 
    181   else if(node.createTextRange) { 
    182     var textRange = node.createTextRange(); 
    183     textRange.collapse(true); 
    184     textRange.moveEnd(pos); 
    185     textRange.moveStart(pos); 
    186     textRange.select(); 
    187     return true; 
    188   } 
    189   else if(node.setSelectionRange) { 
    190     node.setSelectionRange(pos,pos); 
    191     return true; 
    192   } 
    193  
    194   return false; 
    195 } 
    196  
    197 function getCursor(input) { 
    198     // Internet Explorer Caret Position (TextArea) 
    199     if (document.selection && document.selection.createRange) { 
    200       var range = document.selection.createRange(); 
    201       var bookmark = range.getBookmark(); 
    202       return bookmark.charCodeAt(2) - 2; 
    203     } 
    204     else { 
    205       // Firefox Caret Position (TextArea) 
    206       if (input.setSelectionRange) 
    207        return input.selectionStart; 
    208     } 
    209  
    210     return 0; 
    211 } 
    212  
    213169function debounce(func, wait, immediate) { 
    214170  var timeout; 
Note: See TracChangeset for help on using the changeset viewer.