diff options
| author | Jules Laplace <jules@okfoc.us> | 2014-11-07 13:22:36 -0500 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2014-11-07 13:22:47 -0500 |
| commit | 5a35d057453f82aad1097f1a90e9bdd341018a17 (patch) | |
| tree | 11d0b801c62d84213ef358ec42c51b0638a89662 /public/assets/javascripts/util.js | |
| parent | e6cac4737904750a80173ba8e7745d2b41370bd6 (diff) | |
embed modal
Diffstat (limited to 'public/assets/javascripts/util.js')
| -rw-r--r-- | public/assets/javascripts/util.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/public/assets/javascripts/util.js b/public/assets/javascripts/util.js index 2fa994a..1749836 100644 --- a/public/assets/javascripts/util.js +++ b/public/assets/javascripts/util.js @@ -239,4 +239,17 @@ if (!Function.prototype.bind) { }()); +function selectElementContents(el) { + if (window.getSelection && document.createRange) { + var sel = window.getSelection(); + var range = document.createRange(); + range.selectNodeContents(el); + sel.removeAllRanges(); + sel.addRange(range); + } else if (document.selection && document.body.createTextRange) { + var textRange = document.body.createTextRange(); + textRange.moveToElementText(el); + textRange.select(); + } +} |
