(text)
| 539 | } |
| 540 | // Split the text into sentences so the speech synthesis can start speaking as soon as possible |
| 541 | function Helper_SplitIntoSentences(text) { |
| 542 | var sentences = []; |
| 543 | var currentSentence = ""; |
| 544 | |
| 545 | for(var i=0; i<text.length; i++) { |
| 546 | // |
| 547 | var currentChar = text[i]; |
| 548 | |
| 549 | // Add character to current sentence |
| 550 | currentSentence += currentChar; |
| 551 | |
| 552 | // is the current character a delimiter? if so, add current part to array and clear |
| 553 | if ( |
| 554 | // Latin punctuation |
| 555 | currentChar == ',' |
| 556 | || currentChar == ':' |
| 557 | || currentChar == '.' |
| 558 | || currentChar == '!' |
| 559 | || currentChar == '?' |
| 560 | || currentChar == ';' |
| 561 | || currentChar == '…' |
| 562 | // Chinese/japanese punctuation |
| 563 | || currentChar == '、' |
| 564 | || currentChar == ',' |
| 565 | || currentChar == '。' |
| 566 | || currentChar == '.' |
| 567 | || currentChar == '!' |
| 568 | || currentChar == '?' |
| 569 | || currentChar == ';' |
| 570 | || currentChar == ':' |
| 571 | ) { |
| 572 | if (currentSentence.trim() != "") sentences.push(currentSentence.trim()); |
| 573 | currentSentence = ""; |
| 574 | } |
| 575 | } |
| 576 | return sentences; |
| 577 | } |
| 578 | |
| 579 | function copyToClipboard(text, btn) { |
| 580 | window.clearTimeout(window.__cpTimeout); |
no outgoing calls
no test coverage detected