Add Download button
This commit is contained in:
parent
4845a4b0cf
commit
c8f51adfaa
@ -10,7 +10,7 @@ var plugins = {
|
||||
dmenu_prepare: {}
|
||||
};
|
||||
|
||||
// pattern matches directory path prefix
|
||||
// pattern matches directory path prefix and suffix
|
||||
var pathre = /.*\/|\.[^.]*$/g;
|
||||
|
||||
// IDs of size, img elements for folders use RFC4648 s5 encoding of name
|
||||
@ -808,6 +808,15 @@ var $dialog = $('#dialogue').dialog({
|
||||
'<img src="/img/spin.gif">Retrieving data...'); }
|
||||
});
|
||||
|
||||
/* insert button-like Download link before Play */
|
||||
$('#play').before(function(i){
|
||||
var dl = document.createElement('a');
|
||||
dl.setAttribute('class', this.className);
|
||||
dl.id = this.id + 'DL';
|
||||
dl.innerHTML = 'Download';
|
||||
return dl;
|
||||
});
|
||||
|
||||
function doplay(it)
|
||||
{
|
||||
var file = $dialog.attr('file');
|
||||
@ -864,12 +873,18 @@ $('a.bf').click(function(e) {
|
||||
type: type
|
||||
});
|
||||
|
||||
$dialog.attr('file', file);
|
||||
$dialog.attr('type', type);
|
||||
if (type == 'ts') {
|
||||
if (opt.attr('odencd') != 0) {
|
||||
/* encrypted: link to be enabled once populated */
|
||||
$('#playDL').disable();
|
||||
/* ... but if no DLNA never Play */
|
||||
if (opt.attr('dlna') != 1) $('#play').disable();
|
||||
}
|
||||
} else {
|
||||
/* generic: enable Play once media file is parsed */
|
||||
$('#play').disable();
|
||||
}
|
||||
|
||||
if (!(type == 'ts' &&
|
||||
(opt.attr('odencd') == 0 || opt.attr('dlna') == 1)))
|
||||
$('#play').button('disable');
|
||||
$dialog.dialog('open');
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user