summaryrefslogtreecommitdiffstats
path: root/static/functions/global.js
diff options
context:
space:
mode:
authorGit <git@what.cd>2013-07-14 08:00:49 +0000
committerGit <git@what.cd>2013-07-14 08:00:49 +0000
commit4b99416cdf5b1075132a528697af74762dfcde90 (patch)
tree66fb13f98e892eaeb18d5be55cbaadd9f22f5d92 /static/functions/global.js
parent8f5fb0f429201a83016accefc974cfa539748e24 (diff)
downloadGazelle-4b99416cdf5b1075132a528697af74762dfcde90.zip
Gazelle-4b99416cdf5b1075132a528697af74762dfcde90.tar.gz
Gazelle-4b99416cdf5b1075132a528697af74762dfcde90.tar.bz2
Empty commit
Diffstat (limited to 'static/functions/global.js')
-rw-r--r--static/functions/global.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/static/functions/global.js b/static/functions/global.js
index 09fe436..a691f28 100644
--- a/static/functions/global.js
+++ b/static/functions/global.js
@@ -126,3 +126,19 @@ function remove_selection(index) {
function Stats(stat) {
ajax.get("ajax.php?action=stats&stat=" + stat);
}
+
+// Thank you http://stackoverflow.com/questions/4578398/selecting-all-text-within-a-div-on-a-single-left-click-with-javascript
+function select_all(el) {
+ if (typeof window.getSelection != "undefined" && typeof document.createRange != "undefined") {
+ var range = document.createRange();
+ range.selectNodeContents(el);
+ var sel = window.getSelection();
+ sel.removeAllRanges();
+ sel.addRange(range);
+ } else if (typeof document.selection != "undefined" && typeof document.body.createTextRange != "undefined") {
+ var textRange = document.body.createTextRange();
+ textRange.moveToElementText(el);
+ textRange.select();
+ }
+}
+