oxspeed/js/ui/selectAnnotationType.js

65 lines
2.0 KiB
JavaScript

pandora.ui.selectAnnotationType = function() {
// var annot_types = [
// {
// 'id': 'transcript',
// 'title': 'Transcript'
// },
// {
// 'id': 'description',
// 'title': 'Description'
// },
// {
// 'id': 'other',
// 'title': 'Other...'
// }
// ];
var that = Ox.Input({
//'items': annot_types,
'label': 'Type',
'placeholder': 'type annotation type',
labelWidth: 256,
width: 512,
//'max': 1,
//'min': 1,
'value': 'untitled',
}).bindEvent("blur", function(e) {
//alert("changed annot type");
//console.log(e);
var videoKey = pandora.$ui.textArea.storage;
var storageData = pandora.storage(videoKey);
var currentName = pandora.$ui.textArea.currentTrack;
console.log(currentName);
//console.log(storage);
var newName = this.value();
console.log(newName);
if (currentName == newName) return;
storageData[newName] = pandora.$ui.textArea.value();
delete(storageData[currentName]);
pandora.storage(videoKey, storageData);
pandora.$ui.textArea.currentTrack = newName;
//delete(storage[currentName]);
pandora.$ui.annotationsPanel.removeLayer(currentName);
pandora.$ui.annotationsPanel.addLayer({
'id': newName,
'title': newName,
'items': pandora.$ui.textArea.speedtrans.toSrt("layers", storageData[newName])
});
//var storage = pandora.storage
// var typ = this.value();
// var textArea = pandora.$ui.textArea;
// var val = pandora.storage(textArea.storage);
// if (val[typ]) {
// var txt = val[typ];
// } else {
// var txt = val[typ] = '';
// pandora.storage(textArea.storage, val);
// }
// textArea.value(txt);
});
return that;
};