diff --git a/cdoseaplay/static/index.html b/cdoseaplay/static/index.html index 50d4bfb..5194e7f 100644 --- a/cdoseaplay/static/index.html +++ b/cdoseaplay/static/index.html @@ -1 +1,9 @@ + diff --git a/cdoseaplay/static/subtitles.js b/cdoseaplay/static/subtitles.js index db3ef3c..d9b681d 100644 --- a/cdoseaplay/static/subtitles.js +++ b/cdoseaplay/static/subtitles.js @@ -12,24 +12,37 @@ app.render = function() { var html = '' - html += 'Current Time: ' + app.status.currentTime + '
' + //html += 'Current Time: ' + app.status.currentTime + '
' + // + var showNext = 0 + var update = false if (app.status.subtitles[app.status.current]) { app.status.subtitles[app.status.current].forEach(function(sub) { if (app.status.currentTime >= sub['in'] && app.status.currentTime < sub.out) { - html += '

' + sub['in'] + ' ' + sub.out + ': ' + sub.value + '' - } else { - html += '

' + sub['in'] + ' ' + sub.out + ': ' + sub.value + //html += '

' + sub['in'] + ' ' + sub.out + ': ' + sub.value + '' + html += '

' + sub.value + '' + showNext = 10 + update = true + } else if (showNext) { + //html += '

' + sub['in'] + ' ' + sub.out + ': ' + sub.value + html += '

' + sub.value + showNext -= 1 } }) } if (app.status.subtitles[app.status.next]) { - html += '

Next: ' app.status.subtitles[app.status.next].forEach(function(sub) { - html += '

' + sub['in'] + ' ' + sub.out + ': ' + sub.value + if (showNext) { + //html += '

' + sub['in'] + ' ' + sub.out + ': ' + sub.value + html += '

' + sub.value + showNext -= 1 + } }) } - document.body.innerHTML = html + if (update) { + document.body.innerHTML = html + } } app.connectWS = function() {