summaryrefslogtreecommitdiff
path: root/lib/scripts/textselection.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/scripts/textselection.js')
-rw-r--r--lib/scripts/textselection.js26
1 files changed, 13 insertions, 13 deletions
diff --git a/lib/scripts/textselection.js b/lib/scripts/textselection.js
index 26b4196f2..818d5d950 100644
--- a/lib/scripts/textselection.js
+++ b/lib/scripts/textselection.js
@@ -5,7 +5,7 @@
/**
* selection prototype
*
- * Object that capsulates the selection in a textarea. Returned by getSelection.
+ * Object that capsulates the selection in a textarea. Returned by DWgetSelection.
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
@@ -34,7 +34,7 @@ function selection_class(){
* @link http://linebyline.blogspot.com/2006/11/textarea-cursor-position-in-internet.html
* @returns object - a selection object
*/
-function getSelection(textArea) {
+function DWgetSelection(textArea) {
var sel = new selection_class();
sel.obj = textArea;
@@ -119,14 +119,14 @@ function getSelection(textArea) {
/**
* Set the selection
*
- * You need to get a selection object via getSelection() first, then modify the
+ * You need to get a selection object via DWgetSelection() first, then modify the
* start and end properties and pass it back to this function.
*
* @link http://groups.drupal.org/node/1210
* @author Andreas Gohr <andi@splitbrain.org>
- * @param object selection - a selection object as returned by getSelection()
+ * @param {selection_class} selection a selection object as returned by DWgetSelection()
*/
-function setSelection(selection){
+function DWsetSelection(selection){
if(document.getSelection){ // FF
// what a pleasure in FF ;)
selection.obj.setSelectionRange(selection.start,selection.end);
@@ -144,11 +144,11 @@ function setSelection(selection){
* selection
*
* @author Andreas Gohr <andi@splitbrain.org>
- * @param string text - the new text to be pasted
- * @param objct selecttion - selection object returned by getSelection
- * @param int opts.startofs - number of charcters at the start to skip from new selection
- * @param int opts.endofs - number of characters at the end to skip from new selection
- * @param bool opts.nosel - set true if new text should not be selected
+ * @param {string} text the new text to be pasted
+ * @param {selection_class} selection selection object returned by DWgetSelection
+ * @param {int} opts.startofs number of charcters at the start to skip from new selection
+ * @param {int} opts.endofs number of characters at the end to skip from new selection
+ * @param {boolean} opts.nosel set true if new text should not be selected
*/
function pasteText(selection,text,opts){
if(!opts) opts = {};
@@ -173,7 +173,7 @@ function pasteText(selection,text,opts){
// no selection wanted? set cursor to end position
if(opts.nosel) selection.start = selection.end;
- setSelection(selection);
+ DWsetSelection(selection);
}
@@ -188,7 +188,7 @@ function pasteText(selection,text,opts){
function insertTags(textAreaID, tagOpen, tagClose, sampleText){
var txtarea = jQuery('#' + textAreaID)[0];
- var selection = getSelection(txtarea);
+ var selection = DWgetSelection(txtarea);
var text = selection.getText();
var opts;
@@ -226,6 +226,6 @@ function insertTags(textAreaID, tagOpen, tagClose, sampleText){
*/
function insertAtCarret(textAreaID, text){
var txtarea = jQuery('#' + textAreaID)[0];
- var selection = getSelection(txtarea);
+ var selection = DWgetSelection(txtarea);
pasteText(selection,text,{nosel: true});
}