aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/lib/scripts/textselection.js
diff options
context:
space:
mode:
authorAdrian Lang <mail@adrianlang.de>2011-09-09 22:26:16 +0200
committerAdrian Lang <mail@adrianlang.de>2011-09-13 12:03:43 +0200
commit5e7a292691951a0fa0a18f06c8b9bcfb509a032d (patch)
tree5a844f42ea262883faaf5047544799e4ceb10941 /lib/scripts/textselection.js
parentc62a5f5846e3477044ebc93e96f98b878d3e7a59 (diff)
downloaddokuwiki-5e7a292691951a0fa0a18f06c8b9bcfb509a032d.tar.gz
dokuwiki-5e7a292691951a0fa0a18f06c8b9bcfb509a032d.zip
Various JavaScript improvements, JSLint, jQuery
Diffstat (limited to 'lib/scripts/textselection.js')
-rw-r--r--lib/scripts/textselection.js7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/scripts/textselection.js b/lib/scripts/textselection.js
index 742338785..bd80e9341 100644
--- a/lib/scripts/textselection.js
+++ b/lib/scripts/textselection.js
@@ -22,8 +22,7 @@ function selection_class(){
};
this.getText = function(){
- if(!this.obj) return '';
- return this.obj.value.substring(this.start,this.end);
+ return (!this.obj) ? '' : this.obj.value.substring(this.start,this.end);
};
}
@@ -188,7 +187,7 @@ function pasteText(selection,text,opts){
* @author Andreas Gohr <andi@splitbrain.org>
*/
function insertTags(textAreaID, tagOpen, tagClose, sampleText){
- var txtarea = $(textAreaID);
+ var txtarea = jQuery('#' + textAreaID)[0];
var selection = getSelection(txtarea);
var text = selection.getText();
@@ -227,7 +226,7 @@ function insertTags(textAreaID, tagOpen, tagClose, sampleText){
* @author Andreas Gohr <andi@splitbrain.org>
*/
function insertAtCarret(textAreaID, text){
- var txtarea = $(textAreaID);
+ var txtarea = jQuery('#' + textAreaID)[0];
var selection = getSelection(txtarea);
pasteText(selection,text,{nosel: true});
}