diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2018-04-25 17:06:45 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2018-04-25 17:06:45 +0200 |
| commit | 4a99effeb025e6ed6f1a2667a533894aa1fe2f46 (patch) | |
| tree | 0eaa4d68865af4c3e1643035f8529f5bb9203a61 /public/assets/js/vendor/util.js | |
| parent | 0645d1ada0ad41cc9e53b1b3f452ecc35b35ab12 (diff) | |
focusing on mail
Diffstat (limited to 'public/assets/js/vendor/util.js')
| -rw-r--r-- | public/assets/js/vendor/util.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/public/assets/js/vendor/util.js b/public/assets/js/vendor/util.js index bcaa2d2..43ca81b 100644 --- a/public/assets/js/vendor/util.js +++ b/public/assets/js/vendor/util.js @@ -140,6 +140,26 @@ function range(m,n,s){ return a } +// manipulate text selection in an element +function setSelectionRange(input, selectionStart, selectionEnd) { + if (input.setSelectionRange) { + input.focus(); + input.setSelectionRange(selectionStart, selectionEnd); + } + else if (input.createTextRange) { + var range = input.createTextRange(); + range.collapse(true); + range.moveEnd('character', selectionEnd); + range.moveStart('character', selectionStart); + range.select(); + } +} + +// place cursor at a specific point (usually the beginning) +function setCaretToPos (input, pos) { + setSelectionRange(input, pos, pos); +} + var guid_syllables = "iz az ez or iv ex baz el lo lum ot un no".split(" ") var guid_n = 0 function guid(n){ |
