mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 09:02:15 -06:00
add hotkey Y to download current song / vid / pic
This commit is contained in:
parent
256c7f1789
commit
c9b7ec72d8
|
@ -284,6 +284,8 @@ window.baguetteBox = (function () {
|
||||||
tglsel();
|
tglsel();
|
||||||
else if (k == "KeyR")
|
else if (k == "KeyR")
|
||||||
rotn(e.shiftKey ? -1 : 1);
|
rotn(e.shiftKey ? -1 : 1);
|
||||||
|
else if (k == "KeyY")
|
||||||
|
dlpic();
|
||||||
}
|
}
|
||||||
|
|
||||||
function anim() {
|
function anim() {
|
||||||
|
@ -342,19 +344,29 @@ window.baguetteBox = (function () {
|
||||||
tt.show.bind(this)();
|
tt.show.bind(this)();
|
||||||
}
|
}
|
||||||
|
|
||||||
function tglsel() {
|
function findfile() {
|
||||||
var thumb = currentGallery[currentIndex].imageElement,
|
var thumb = currentGallery[currentIndex].imageElement,
|
||||||
name = vsplit(thumb.href)[1].split('?')[0],
|
name = vsplit(thumb.href)[1].split('?')[0],
|
||||||
files = msel.getall();
|
files = msel.getall();
|
||||||
|
|
||||||
for (var a = 0; a < files.length; a++)
|
for (var a = 0; a < files.length; a++)
|
||||||
if (vsplit(files[a].vp)[1] == name)
|
if (vsplit(files[a].vp)[1] == name)
|
||||||
clmod(ebi(files[a].id).closest('tr'), 'sel', 't');
|
return [name, a, files, ebi(files[a].id)];
|
||||||
|
}
|
||||||
|
|
||||||
|
function tglsel() {
|
||||||
|
var o = findfile()[3];
|
||||||
|
clmod(o.closest('tr'), 'sel', 't');
|
||||||
msel.selui();
|
msel.selui();
|
||||||
selbg();
|
selbg();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function dlpic() {
|
||||||
|
var url = findfile()[3].href;
|
||||||
|
url += (url.indexOf('?') < 0 ? '?' : '&') + 'cache';
|
||||||
|
dl_file(url);
|
||||||
|
}
|
||||||
|
|
||||||
function selbg() {
|
function selbg() {
|
||||||
var img = vidimg(),
|
var img = vidimg(),
|
||||||
thumb = currentGallery[currentIndex].imageElement,
|
thumb = currentGallery[currentIndex].imageElement,
|
||||||
|
|
|
@ -1700,6 +1700,14 @@ function prev_song(e) {
|
||||||
|
|
||||||
return song_skip(-1);
|
return song_skip(-1);
|
||||||
}
|
}
|
||||||
|
function dl_song() {
|
||||||
|
if (!mp || !mp.au)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var url = mp.tracks[mp.au.tid];
|
||||||
|
url += (url.indexOf('?') < 0 ? '?' : '&') + 'cache=987';
|
||||||
|
dl_file(url);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function playpause(e) {
|
function playpause(e) {
|
||||||
|
@ -3943,6 +3951,9 @@ document.onkeydown = function (e) {
|
||||||
if (n !== 0)
|
if (n !== 0)
|
||||||
return seek_au_rel(n) || true;
|
return seek_au_rel(n) || true;
|
||||||
|
|
||||||
|
if (k == 'KeyY')
|
||||||
|
return dl_song();
|
||||||
|
|
||||||
n = k == 'KeyI' ? -1 : k == 'KeyK' ? 1 : 0;
|
n = k == 'KeyI' ? -1 : k == 'KeyK' ? 1 : 0;
|
||||||
if (n !== 0)
|
if (n !== 0)
|
||||||
return tree_neigh(n);
|
return tree_neigh(n);
|
||||||
|
|
|
@ -815,6 +815,14 @@ function sethash(hv) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function dl_file(url) {
|
||||||
|
console.log('DL [%s]', url);
|
||||||
|
var o = mknod('a');
|
||||||
|
o.setAttribute('href', url);
|
||||||
|
o.setAttribute('download', '');
|
||||||
|
o.click();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
var timer = (function () {
|
var timer = (function () {
|
||||||
var r = {};
|
var r = {};
|
||||||
|
|
Loading…
Reference in a new issue