replace all \r\n with \n
This commit is contained in:
parent
35f74aa1ed
commit
ccb867d121
|
@ -88,10 +88,15 @@ TextArea.prototype.getWord = function(pos, val) {
|
||||||
return word;
|
return word;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function cleanNewlines(str) {
|
||||||
|
var s = str.replace('\r\n|\r|\n', '\n');
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
//takes an srt as param, loads into txtarea
|
//takes an srt as param, loads into txtarea
|
||||||
TextArea.prototype.fromSrt = function(srt) {
|
TextArea.prototype.fromSrt = function(srt) {
|
||||||
var spans = [];
|
var spans = [];
|
||||||
srt = srt.replace('\r\n|\r|\n', '\n')
|
srt = cleanNewlines(srt);
|
||||||
srt = strip(srt);
|
srt = strip(srt);
|
||||||
var srt_ = srt.split('\n\n');
|
var srt_ = srt.split('\n\n');
|
||||||
for(s in srt_) {
|
for(s in srt_) {
|
||||||
|
@ -184,7 +189,7 @@ function spansToSrt(arr, fmt, start_no) {
|
||||||
//returns textarea formatted to .srt
|
//returns textarea formatted to .srt
|
||||||
TextArea.prototype.toSrt = function(fmt) {
|
TextArea.prototype.toSrt = function(fmt) {
|
||||||
if (!fmt) var fmt = 'srt';
|
if (!fmt) var fmt = 'srt';
|
||||||
var text = this.elem.val();
|
var text = cleanNewlines(this.elem.val());
|
||||||
var lines = [];
|
var lines = [];
|
||||||
lines = text.split("\n");
|
lines = text.split("\n");
|
||||||
var i=0;
|
var i=0;
|
||||||
|
|
|
@ -187,6 +187,7 @@ function saveEncore() {
|
||||||
Shortcuts: <br /><br />
|
Shortcuts: <br /><br />
|
||||||
Esc: Pause / Unpause <br />
|
Esc: Pause / Unpause <br />
|
||||||
Insert: Insert time-code<br />
|
Insert: Insert time-code<br />
|
||||||
|
PageUp / PageDown: Volume Up / Down<br />
|
||||||
Double-click in Textarea: insert time-code <br />
|
Double-click in Textarea: insert time-code <br />
|
||||||
Double-click on video: insert time-code<br />
|
Double-click on video: insert time-code<br />
|
||||||
Double-click on time-code in textarea: Seek video to time-code. <br />
|
Double-click on time-code in textarea: Seek video to time-code. <br />
|
||||||
|
|
Loading…
Reference in New Issue
Block a user