check if video is done while in a view that might benefit from it: info or video view

This commit is contained in:
j 2014-04-11 18:32:17 +00:00
parent 7cd152b1d5
commit d6b5fa6993
2 changed files with 44 additions and 1 deletions

View file

@ -52,7 +52,7 @@ pandora.ui.item = function() {
+'{1} view.', [result.data.title, Ox._(pandora.user.ui.itemView)])
)
);
pandora.updateStatus(pandora.user.ui.item);
} else if (pandora.user.ui.itemView == 'info') {
pandora.$ui.contentPanel.replaceElement(1,
@ -63,6 +63,7 @@ pandora.ui.item = function() {
}
})
);
!result.data.rendered && pandora.updateStatus(pandora.user.ui.item);
} else if (pandora.user.ui.itemView == 'documents') {

View file

@ -2279,6 +2279,48 @@ pandora.updateItemContext = function() {
}
};
pandora.updateStatus = function(item) {
var ui = pandora.user.ui;
item = item || ui.item;
if (pandora.$ui.updateStatus && pandora.$ui.updateStatus[item]) {
return;
}
pandora.$ui.updateStatus = pandora.$ui.updateStatus || {};
pandora.$ui.updateStatus[item] = setTimeout(function() {
if(isActive()) {
Ox.Request.clearCache();
pandora.api.get({
id: item,
keys: ['rendered']
}, function(result) {
delete pandora.$ui.updateStatus[item];
if (isActive()) {
if (result.data.rendered) {
Ox.Request.clearCache();
if (pandora.isVideoView()) {
pandora.$ui.mainPanel.replaceElement(1,
pandora.$ui.rightPanel = pandora.ui.rightPanel());
} else if(pandora.$ui.item) {
pandora.updateItemContext();
pandora.$ui.item.reload();
}
} else {
pandora.updateStatus(item);
}
}
});
} else {
delete pandora.$ui.updateStatus[item];
}
}, 10000);
function isActive() {
return ui.item == item && [
'info', 'player', 'editor', 'timeline'
].indexOf(ui.itemView) > -1;
}
};
pandora.wait = function(taskId, callback, timeout) {
var task = {};
timeout = timeout || 5000;