Add Download button

This commit is contained in:
df 2021-04-16 10:29:27 +00:00
parent 4845a4b0cf
commit c8f51adfaa
1 changed files with 21 additions and 6 deletions

View File

@ -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');
});