()
| 469 | |
| 470 | // get the selection |
| 471 | function get() { |
| 472 | textarea.focus(); |
| 473 | |
| 474 | scrollPosition = textarea.scrollTop; |
| 475 | if (document.selection) { |
| 476 | selection = document.selection.createRange().text; |
| 477 | if (browser.msie) { // ie |
| 478 | var range = document.selection.createRange(), rangeCopy = range.duplicate(); |
| 479 | rangeCopy.moveToElementText(textarea); |
| 480 | caretPosition = -1; |
| 481 | while(rangeCopy.inRange(range)) { |
| 482 | rangeCopy.moveStart('character'); |
| 483 | caretPosition ++; |
| 484 | } |
| 485 | } else { // opera |
| 486 | caretPosition = textarea.selectionStart; |
| 487 | } |
| 488 | } else { // gecko & webkit |
| 489 | caretPosition = textarea.selectionStart; |
| 490 | |
| 491 | selection = textarea.value.substring(caretPosition, textarea.selectionEnd); |
| 492 | } |
| 493 | return selection; |
| 494 | } |
| 495 | |
| 496 | // open preview window |
| 497 | function preview() { |
no outgoing calls
no test coverage detected