oxspeed/js/speedtrans.js

84 lines
2.7 KiB
JavaScript

// vim: et:ts=4:sw=4:sts=4:ft=javascript
'use strict';
(function() {
Ox.load({
UI: {
// theme: 'modern' //FIXME: get theme through localStorage
}
}, loadSpeedtrans);
function loadSpeedtrans(browserSupported) {
console.log("loaded speedtrans");
if (!browserSupported) { alert("your browser is not supported"); return; }
window.pandora = {
'load': function() {
// console.log(data);
Ox.extend(pandora, {
$ui: {
body: $('body'),
document: $(document),
window: $(window).resize(function() {
pandora.resizeWindow();
})
},
storage: Ox.localStorage("speedtrans"),
ui: {},
site: {},
state: {},
user: {}
});
pandora.resizeWindow = function() {
pandora.$ui.textArea.options({
'width': pandora.$ui.textPanel.width() - 20,
'height': pandora.$ui.textPanel.height() - 40
});
};
var prefix = "js/";
var files = ['appPanel', 'mainMenu', 'mainPanel', 'videoPanel', 'annotationsPanel', 'videoPlayer', 'openRemoteDialog', 'openSRTDialog', 'newSRTDialog', 'selectAnnotationType', 'helpPanel', 'textPanel', 'textArea', 'textToolBar', 'utils'];
var prefix = "js/ui/";
var filesToLoad = Ox.map(files, function(v) {
return prefix + v + ".js";
});
//console.log(filesToLoad);
Ox.getFile(filesToLoad, function() {
console.log("got filed");
initSpeedtrans();
});
}
};
pandora.load();
}
function initSpeedtrans(data) {
console.log("init speedtrans");
var $loadButton = Ox.FileInput({
maxFiles: 1,
width: 512
})
.bindEvent("change", function(data) {
console.log(data);
var file = data.value[0];
this.remove();
pandora.$ui.appPanel.appendTo(pandora.$ui.body);
pandora.utils.loadLocalFile(file);
pandora.resizeWindow();
}).appendTo(pandora.$ui.body);
pandora.$ui.appPanel = pandora.ui.appPanel() //.appendTo(pandora.$ui.body);
pandora.$ui.openRemoteDialog = pandora.ui.openRemoteDialog();
pandora.$ui.openSRTDialog = pandora.ui.openSRTDialog();
pandora.resizeWindow();
//console.log("am here");
}
})();