space
This commit is contained in:
parent
dd9892020c
commit
a3c1081964
2 changed files with 323 additions and 333 deletions
|
@ -6,7 +6,6 @@ var filePath = false;
|
||||||
var videoListener;
|
var videoListener;
|
||||||
var seekBar;
|
var seekBar;
|
||||||
var globalUser;
|
var globalUser;
|
||||||
var srtFilePath = undefined;
|
|
||||||
var videoPath = undefined;
|
var videoPath = undefined;
|
||||||
var videoHash = undefined;
|
var videoHash = undefined;
|
||||||
|
|
||||||
|
@ -152,7 +151,6 @@ Ox.load({
|
||||||
saveTxt();
|
saveTxt();
|
||||||
videoPath = undefined;
|
videoPath = undefined;
|
||||||
videoHash = undefined;
|
videoHash = undefined;
|
||||||
srtFilePath = undefined;
|
|
||||||
textArea.elem.val('');
|
textArea.elem.val('');
|
||||||
var path = data.files[0].name;
|
var path = data.files[0].name;
|
||||||
if ($.inArray(getFileNameExt(path.toLowerCase()), [
|
if ($.inArray(getFileNameExt(path.toLowerCase()), [
|
||||||
|
@ -349,12 +347,5 @@ End Preview functions
|
||||||
|
|
||||||
|
|
||||||
$(window).unload(function() {
|
$(window).unload(function() {
|
||||||
console.log('unload');
|
|
||||||
if (typeof filePath != 'undefined' && typeof srtFilePath != 'undefined') {
|
|
||||||
globalUser.set_prefs({
|
|
||||||
'recentVideo': $('#video').attr("src").replace("file://", ""),
|
|
||||||
'recentSrt': srtFilePath
|
|
||||||
});
|
|
||||||
}
|
|
||||||
saveTxt();
|
saveTxt();
|
||||||
});
|
});
|
||||||
|
|
|
@ -6,12 +6,12 @@ var storage = window.localStorage;
|
||||||
var TextArea = function(elem) {
|
var TextArea = function(elem) {
|
||||||
this.elem = $('#' + elem);
|
this.elem = $('#' + elem);
|
||||||
var that = this;
|
var that = this;
|
||||||
// this.elem = new Ox.Input({'type': 'textarea', 'id': 'textArea'}).attr("id", elem).appendTo('#txtWrapper');
|
//this.elem = new Ox.Input({'type': 'textarea', 'id': 'textArea'}).attr("id", elem).appendTo('#txtWrapper');
|
||||||
this.hasFocus = false;
|
this.hasFocus = false;
|
||||||
this.width = this.elem.width();
|
this.width = this.elem.width();
|
||||||
this.spans = [];
|
this.spans = [];
|
||||||
this.init()
|
this.init()
|
||||||
}
|
}
|
||||||
|
|
||||||
TextArea.prototype.init = function() {
|
TextArea.prototype.init = function() {
|
||||||
var that = this;
|
var that = this;
|
||||||
|
@ -28,7 +28,7 @@ TextArea.prototype.init = function() {
|
||||||
Video.set(tc);
|
Video.set(tc);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//returns tc in ms if cursor is at a time-code, else returns false
|
//returns tc in ms if cursor is at a time-code, else returns false
|
||||||
|
@ -44,7 +44,7 @@ TextArea.prototype.isTc = function() {
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//inserts current timecode at cursor position
|
//inserts current timecode at cursor position
|
||||||
TextArea.prototype.insertTc = function(tcNpt) {
|
TextArea.prototype.insertTc = function(tcNpt) {
|
||||||
|
@ -63,7 +63,7 @@ TextArea.prototype.insertTc = function(tcNpt) {
|
||||||
eDom.selectionStart = pos + tcNpt.length + 2;
|
eDom.selectionStart = pos + tcNpt.length + 2;
|
||||||
eDom.selectionEnd = pos + tcNpt.length + 2;
|
eDom.selectionEnd = pos + tcNpt.length + 2;
|
||||||
eDom.scrollTop = scrollTop + 15;
|
eDom.scrollTop = scrollTop + 15;
|
||||||
}
|
}
|
||||||
|
|
||||||
//gets the word at character pos (int) [in val (str)]
|
//gets the word at character pos (int) [in val (str)]
|
||||||
TextArea.prototype.getWord = function(pos, val) {
|
TextArea.prototype.getWord = function(pos, val) {
|
||||||
|
@ -93,12 +93,12 @@ TextArea.prototype.getWord = function(pos, val) {
|
||||||
var lastLetter = j;
|
var lastLetter = j;
|
||||||
var word = val.substring(firstLetter, lastLetter);
|
var word = val.substring(firstLetter, lastLetter);
|
||||||
return word;
|
return word;
|
||||||
}
|
}
|
||||||
|
|
||||||
function cleanNewlines(str) {
|
function cleanNewlines(str) {
|
||||||
var s = str.replace(/\r\n|\r|\n/g, '\n');
|
var s = str.replace(/\r\n|\r|\n/g, '\n');
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
//takes an srt as param, loads into txtarea
|
//takes an srt as param, loads into txtarea
|
||||||
TextArea.prototype.fromSrt = function(txt) {
|
TextArea.prototype.fromSrt = function(txt) {
|
||||||
|
@ -160,7 +160,7 @@ TextArea.prototype.fromSrt = function(txt) {
|
||||||
|
|
||||||
function strip(s) {
|
function strip(s) {
|
||||||
return s.replace(/^\s+|\s+$/g,"");
|
return s.replace(/^\s+|\s+$/g,"");
|
||||||
}
|
}
|
||||||
|
|
||||||
function toSeconds(t) {
|
function toSeconds(t) {
|
||||||
var s = 0.0;
|
var s = 0.0;
|
||||||
|
@ -171,8 +171,7 @@ function toSeconds(t) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function spansToSrt(arr, fmt, start_no) {
|
function spansToSrt(arr, fmt, start_no) {
|
||||||
if (typeof start_no == 'undefined') {
|
if (typeof start_no == 'undefined') {
|
||||||
|
@ -206,7 +205,7 @@ function spansToSrt(arr, fmt, start_no) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return srt;
|
return srt;
|
||||||
}
|
}
|
||||||
|
|
||||||
//returns textarea formatted to .srt
|
//returns textarea formatted to .srt
|
||||||
TextArea.prototype.toSrt = function(fmt) {
|
TextArea.prototype.toSrt = function(fmt) {
|
||||||
|
@ -242,13 +241,13 @@ TextArea.prototype.toSrt = function(fmt) {
|
||||||
}
|
}
|
||||||
this.spans = spans;
|
this.spans = spans;
|
||||||
var srt = spansToSrt(spans, fmt);
|
var srt = spansToSrt(spans, fmt);
|
||||||
// console.log(srt);
|
//console.log(srt);
|
||||||
return Ox.encodeUTF8(srt);
|
return Ox.encodeUTF8(srt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TextArea.prototype.addTime = function(ms, start_no) {
|
TextArea.prototype.addTime = function(ms, start_no) {
|
||||||
// console.log(ms);
|
//console.log(ms);
|
||||||
this.toSrt();
|
this.toSrt();
|
||||||
var s = [];
|
var s = [];
|
||||||
var spans = this.spans;
|
var spans = this.spans;
|
||||||
|
@ -290,14 +289,14 @@ var Span = function(tcIn, tcOut, text, index) {
|
||||||
this.tcOutMs = npt2ms(tcOut);
|
this.tcOutMs = npt2ms(tcOut);
|
||||||
this.text = text;
|
this.text = text;
|
||||||
this.tcInMs = npt2ms(tcIn);
|
this.tcInMs = npt2ms(tcIn);
|
||||||
}
|
}
|
||||||
|
|
||||||
var SeekBar = function(elem) {
|
var SeekBar = function(elem) {
|
||||||
this.elem = $('#' + elem);
|
this.elem = $('#' + elem);
|
||||||
this.pointerId = "seekPointer";
|
this.pointerId = "seekPointer";
|
||||||
this.width = this.elem.width();
|
this.width = this.elem.width();
|
||||||
this.init()
|
this.init()
|
||||||
}
|
}
|
||||||
|
|
||||||
SeekBar.prototype.init = function() {
|
SeekBar.prototype.init = function() {
|
||||||
var that = this;
|
var that = this;
|
||||||
|
@ -319,25 +318,25 @@ SeekBar.prototype.init = function() {
|
||||||
});
|
});
|
||||||
that.elem.append(e);
|
that.elem.append(e);
|
||||||
this.pointerElem = e;
|
this.pointerElem = e;
|
||||||
}
|
}
|
||||||
|
|
||||||
//gets current time-code (int) of seekbar position
|
//gets current time-code (int) of seekbar position
|
||||||
SeekBar.prototype.get = function() {
|
SeekBar.prototype.get = function() {
|
||||||
var cssPos = parseInt(this.pointerElem.css("left"));
|
var cssPos = parseInt(this.pointerElem.css("left"));
|
||||||
var pos = parseInt((cssPos / this.width) * (Video.player.duration * 1000));
|
var pos = parseInt((cssPos / this.width) * (Video.player.duration * 1000));
|
||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
//sets seek bar css pos according to current time-code
|
//sets seek bar css pos according to current time-code
|
||||||
SeekBar.prototype.set = function(ms) {
|
SeekBar.prototype.set = function(ms) {
|
||||||
var cssPos = parseInt(((ms / 1000) / Video.player.duration) * this.width);
|
var cssPos = parseInt(((ms / 1000) / Video.player.duration) * this.width);
|
||||||
this.elem.css("left", cssPos + "px");
|
this.elem.css("left", cssPos + "px");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
var KeyboardController = function() {
|
var KeyboardController = function() {
|
||||||
this.
|
this.
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var User = function() {
|
var User = function() {
|
||||||
|
|
Loading…
Reference in a new issue