()
| 386 | |
| 387 | // get the selection |
| 388 | function get() { |
| 389 | textarea.focus(); |
| 390 | |
| 391 | scrollPosition = textarea.scrollTop; |
| 392 | if (document.selection) { |
| 393 | selection = document.selection.createRange().text; |
| 394 | if ($.browser.msie) { // ie |
| 395 | var range = document.selection.createRange(), rangeCopy = range.duplicate(); |
| 396 | rangeCopy.moveToElementText(textarea); |
| 397 | caretPosition = -1; |
| 398 | while(rangeCopy.inRange(range)) { // fix most of the ie bugs with linefeeds... |
| 399 | rangeCopy.moveStart('character'); |
| 400 | caretPosition ++; |
| 401 | } |
| 402 | } else { // opera |
| 403 | caretPosition = textarea.selectionStart; |
| 404 | } |
| 405 | } else { // gecko |
| 406 | caretPosition = textarea.selectionStart; |
| 407 | selection = $$.val().substring(caretPosition, textarea.selectionEnd); |
| 408 | } |
| 409 | return selection; |
| 410 | } |
| 411 | |
| 412 | // open preview window |
| 413 | function preview() { |
no outgoing calls
no test coverage detected