Add a new feature download all selected files for tinyfilemanager

This commit is contained in:
BoneDeath 2022-10-18 11:11:06 +07:00
parent 805308a013
commit 23c757447c

View file

@ -2174,6 +2174,8 @@ $tableTheme = (FM_THEME == "dark") ? "text-white bg-dark table-dark" : "bg-white
<a href="javascript:document.getElementById('a-tar').click();" class="btn btn-small btn-outline-primary btn-2"><i class="fa fa-file-archive-o"></i> <?php echo lng('Tar') ?> </a></li>
<li class="list-inline-item"><input type="submit" class="hidden" name="copy" id="a-copy" value="Copy">
<a href="javascript:document.getElementById('a-copy').click();" class="btn btn-small btn-outline-primary btn-2"><i class="fa fa-files-o"></i> <?php echo lng('Copy') ?> </a></li>
<li class="list-inline-item">
<span onclick="downloadSelected()" class="btn btn-small btn-outline-primary btn-2"><i class="fa fa-download"></i> Download </span></li>
</ul>
</div>
<div class="col-3 d-none d-sm-block"><a href="https://tinyfilemanager.github.io" target="_blank" class="float-right text-muted">Tiny File Manager <?php echo VERSION; ?></a></div>
@ -3828,6 +3830,32 @@ $isStickyNavBar = $sticky_navbar ? 'navbar-fixed' : 'navbar-normal';
<script>hljs.highlightAll(); var isHighlightingEnabled = true;</script>
<?php endif; ?>
<script>
//download selectedFiles
function downloadSelected() {
parent=$( "input:checked" ).closest("tr");
child=parent.find("a[title=Download]");
var a = child;
for (var i=0, iLen=a.length; i<iLen; i++) {
url = a[i].getAttribute("href");
akhir = url.substring(url.lastIndexOf('/')+1);
nama=akhir.substring(akhir.lastIndexOf('=')+1);
if ('download' in a[i]) {
a[i].download = nama;
}
if (a[i].click) {
a[i].click();
} else {
$(a[i]).click();
}
}
}
$(document).on('click', '[data-toggle="lightbox"]', function(event) {
event.preventDefault();
var reInitHighlight = function() { if(typeof isHighlightingEnabled !== "undefined" && isHighlightingEnabled) { setTimeout(function () { $('.ekko-lightbox-container pre code').each(function (i, e) { hljs.highlightBlock(e) }); }, 555); } };