- Timestamp:
- Feb 13, 2015, 9:45:28 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/themes/default/js/datepicker.js
r30956 r30958 31 31 } 32 32 else { 33 var pos = getCursor($('.ui-datepicker-year')[0]);34 35 33 inst['selectedYear'] = inst['drawYear'] = val; 36 34 … … 39 37 40 38 $('.ui-datepicker-year').focus(); 41 42 setCursor($('.ui-datepicker-year')[0], pos);43 39 } 44 40 } … … 171 167 }; 172 168 173 174 // functions for custom year input175 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 213 169 function debounce(func, wait, immediate) { 214 170 var timeout;
Note: See TracChangeset
for help on using the changeset viewer.