use global replace

This commit is contained in:
j 2009-11-09 00:32:02 +01:00
parent 98a3d6c408
commit 61078d3c16
2 changed files with 2 additions and 2 deletions

View File

@ -75,7 +75,7 @@ if no data-srt is provided, the contents of the div is parsed as srt.
<p> <p>
<video src="http://footage.stealthisfilm.com/stream/Robert%20Darnton%20-%20Two%20Information%20Systems%20at%20War%2C%20in%2018th%20Century%20France.ogg" id="video" autplay controls></video> <video src="http://footage.stealthisfilm.com/stream/Robert%20Darnton%20-%20Two%20Information%20Systems%20at%20War%2C%20in%2018th%20Century%20France.ogg" id="video" autplay controls></video>
</p> </p>
<div class="srt" data-video="video" data-srt="sample.srt">content</div> <div class="srt" data-video="video" data-srt="sample.srt"></div>
</div> </div>

View File

@ -34,7 +34,7 @@ $(document).ready(function() {
var videoId = subtitleElement.attr('data-video'); var videoId = subtitleElement.attr('data-video');
var srt = subtitleElement.text(); var srt = subtitleElement.text();
subtitleElement.text(''); subtitleElement.text('');
srt = srt.replace('\r\n|\r|\n', '\n') srt = srt.replace(/\r\n|\r|\n/g, '\n')
var subtitles = {}; var subtitles = {};
srt = strip(srt); srt = strip(srt);