diff options
author | Christopher Smith <chris@jalakai.co.uk> | 2014-03-12 18:39:11 +0000 |
---|---|---|
committer | Christopher Smith <chris@jalakai.co.uk> | 2014-03-12 18:39:11 +0000 |
commit | 4e60057c8ccbee18b94a64208311f9bbb338eec6 (patch) | |
tree | 08d79159aa78693c27f54ecebc3105034dfc5933 /lib/scripts/textselection.js | |
parent | 57a6f99d09d3662a8a2ad72e312aa6f53bcc2d01 (diff) | |
parent | 069942acdaa5ba825bc3f92c7093b5071789f1ca (diff) | |
download | rpg-4e60057c8ccbee18b94a64208311f9bbb338eec6.tar.gz rpg-4e60057c8ccbee18b94a64208311f9bbb338eec6.tar.bz2 |
Merge branch 'master' into tablethead
Diffstat (limited to 'lib/scripts/textselection.js')
-rw-r--r-- | lib/scripts/textselection.js | 26 |
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}); } |