forked from 0x2620/pandora
download frame, fixes #3163
This commit is contained in:
parent
019faffecf
commit
5a17f77f7a
2 changed files with 24 additions and 0 deletions
|
@ -163,6 +163,11 @@ pandora.ui.editor = function(data) {
|
|||
pandora.$ui[dialog] && pandora.$ui[dialog].remove();
|
||||
pandora.$ui[dialog] = pandora.ui[dialog](data).open();
|
||||
},
|
||||
downloadframe: function(data_) {
|
||||
var url = '/' + ui.item + '/' + Ox.max(pandora.site.video.resolutions) + 'p' + data_.position + '.jpg',
|
||||
name = data.title + ' - ' + Ox.formatDuration(data_.position) + '.jpg';
|
||||
pandora.saveURL(url, name)
|
||||
},
|
||||
downloadvideo: function() {
|
||||
pandora.ui.downloadVideoDialog({
|
||||
item: ui.item,
|
||||
|
|
|
@ -2577,6 +2577,25 @@ pandora.openURL = function(url) {
|
|||
}
|
||||
};
|
||||
|
||||
pandora.saveURL = function(url, name) {
|
||||
var link = document.createElement('a');
|
||||
if (typeof link.download === 'string') {
|
||||
link.href = url;
|
||||
link.setAttribute('download', name ? name : true);
|
||||
//Firefox requires the link to be in the body
|
||||
document.body.appendChild(link);
|
||||
|
||||
//simulate click
|
||||
link.click();
|
||||
|
||||
//remove the link when done
|
||||
document.body.removeChild(link);
|
||||
} else {
|
||||
window.open(url);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
pandora.signin = function(data) {
|
||||
// fixme: this is still voodoo
|
||||
pandora.user = Ox.extend(data.user, {
|
||||
|
|
Loading…
Reference in a new issue