From ccb867d121fe75c6ff973321ff45a6abb750fc2c Mon Sep 17 00:00:00 2001 From: sanj Date: Tue, 23 Feb 2010 22:43:51 +0530 Subject: [PATCH] replace all \r\n with \n --- chrome/content/classes.js | 9 +++++++-- chrome/content/transcribe.html | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/chrome/content/classes.js b/chrome/content/classes.js index 37e360f..632568d 100755 --- a/chrome/content/classes.js +++ b/chrome/content/classes.js @@ -88,10 +88,15 @@ TextArea.prototype.getWord = function(pos, val) { return word; } +function cleanNewlines(str) { + var s = str.replace('\r\n|\r|\n', '\n'); + return s; + } + //takes an srt as param, loads into txtarea TextArea.prototype.fromSrt = function(srt) { var spans = []; - srt = srt.replace('\r\n|\r|\n', '\n') + srt = cleanNewlines(srt); srt = strip(srt); var srt_ = srt.split('\n\n'); for(s in srt_) { @@ -184,7 +189,7 @@ function spansToSrt(arr, fmt, start_no) { //returns textarea formatted to .srt TextArea.prototype.toSrt = function(fmt) { if (!fmt) var fmt = 'srt'; - var text = this.elem.val(); + var text = cleanNewlines(this.elem.val()); var lines = []; lines = text.split("\n"); var i=0; diff --git a/chrome/content/transcribe.html b/chrome/content/transcribe.html index a99aa57..8838ce4 100755 --- a/chrome/content/transcribe.html +++ b/chrome/content/transcribe.html @@ -187,6 +187,7 @@ function saveEncore() { Shortcuts:

Esc: Pause / Unpause
Insert: Insert time-code
+ PageUp / PageDown: Volume Up / Down
Double-click in Textarea: insert time-code
Double-click on video: insert time-code
Double-click on time-code in textarea: Seek video to time-code.