summaryrefslogtreecommitdiff
path: root/public/assets/javascripts/util.js
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2014-11-07 13:22:36 -0500
committerJules Laplace <jules@okfoc.us>2014-11-07 13:22:47 -0500
commit5a35d057453f82aad1097f1a90e9bdd341018a17 (patch)
tree11d0b801c62d84213ef358ec42c51b0638a89662 /public/assets/javascripts/util.js
parente6cac4737904750a80173ba8e7745d2b41370bd6 (diff)
embed modal
Diffstat (limited to 'public/assets/javascripts/util.js')
-rw-r--r--public/assets/javascripts/util.js13
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();
+ }
+}