oxspeed/js/ui/mainMenu.js
2013-03-05 17:20:51 +05:30

69 lines
2.3 KiB
JavaScript

pandora.ui.mainMenu = function() {
var that = Ox.MainMenu({
extras: [],
id: 'mainMenu',
menus: [
{
'id': 'speedtransMenu',
'title': 'Speedtrans',
'items': [
{ id: 'TestMenu1', title: 'Test Menu Item'},
{ id: 'TestMenu2', title: 'Test Menu Itemm'}
]
},
{
'id': 'fileMenu',
'title': 'File',
'items': [
{ id: 'openLocalFileMenu', title: 'Open Local File', 'file': {
'maxFiles': 1
}
},
{ id: 'openRemoteFileMenu', title: 'Open online pan.do/ra file'},
{ id: 'openSRT', title: 'Load SRT file'},
{ id: 'saveFileMenu', title: 'Save File', keyboard: 'shift control s'}
]
}
]
})
.bindKeyboard()
.bindEvent({
click: function(data) {
// Ox.print(data);
var selected = data.id;
if (data.id == 'saveFileMenu') {
pandora.$ui.textArea.speedtrans.save();
// speedtrans.saveFile();
} else if (data.id == 'openLocalFileMenu') {
var file = data.files[0];
Ox.oshash(file, function(oshash) {
console.log(oshash);
var url = window.URL.createObjectURL(file);
var options = {
'type': 'local',
'url': url,
'name': oshash
}
pandora.$ui.textArea.speedtrans.load(options);
});
//console.log(data.files[0]);
} else if (data.id == 'openRemoteFileMenu') {
pandora.$ui.openRemoteDialog.open();
} else if (data.id == 'openSRT') {
pandora.$ui.openSRTDialog.open();
} else if (data.id == 'TestMenu1') {
alert("clicked TestMenu1");
}
},
key_control_shift_s: function() {
pandora.$ui.textArea.speedtrans.save();
}
});
return that;
}