mirror of
https://github.com/9001/copyparty.git
synced 2025-08-18 01:22:13 -06:00
make gallery linkable
This commit is contained in:
parent
951fdb27ca
commit
feba4de1d6
|
@ -539,6 +539,7 @@ window.baguetteBox = (function () {
|
||||||
if (overlay.style.display === 'none')
|
if (overlay.style.display === 'none')
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
sethash('');
|
||||||
unbind(document, 'keydown', keyDownHandler);
|
unbind(document, 'keydown', keyDownHandler);
|
||||||
unbind(document, 'keyup', keyUpHandler);
|
unbind(document, 'keyup', keyUpHandler);
|
||||||
unbind(document, 'fullscreenchange', onFSC);
|
unbind(document, 'fullscreenchange', onFSC);
|
||||||
|
|
|
@ -153,6 +153,7 @@
|
||||||
document.documentElement.setAttribute("class", localStorage.theme || dtheme);
|
document.documentElement.setAttribute("class", localStorage.theme || dtheme);
|
||||||
</script>
|
</script>
|
||||||
<script src="/.cpr/util.js?_={{ ts }}"></script>
|
<script src="/.cpr/util.js?_={{ ts }}"></script>
|
||||||
|
<script src="/.cpr/baguettebox.js?_={{ ts }}"></script>
|
||||||
<script src="/.cpr/browser.js?_={{ ts }}"></script>
|
<script src="/.cpr/browser.js?_={{ ts }}"></script>
|
||||||
<script src="/.cpr/up2k.js?_={{ ts }}"></script>
|
<script src="/.cpr/up2k.js?_={{ ts }}"></script>
|
||||||
{%- if js %}
|
{%- if js %}
|
||||||
|
|
|
@ -58,7 +58,7 @@ ebi('op_up2k').innerHTML = (
|
||||||
' <td class="c"><br />parallel uploads:</td>\n' +
|
' <td class="c"><br />parallel uploads:</td>\n' +
|
||||||
' <td class="c" rowspan="2">\n' +
|
' <td class="c" rowspan="2">\n' +
|
||||||
' <input type="checkbox" id="multitask" />\n' +
|
' <input type="checkbox" id="multitask" />\n' +
|
||||||
' <label for="multitask" tt="continue hashing other files while uploading">🏃</label>\n' +
|
' <label for="multitask" tt="continue hashing other files while uploading$N$Nmaybe disable if your CPU or HDD is a bottleneck">🏃</label>\n' +
|
||||||
' </td>\n' +
|
' </td>\n' +
|
||||||
' <td class="c" rowspan="2">\n' +
|
' <td class="c" rowspan="2">\n' +
|
||||||
' <input type="checkbox" id="ask_up" />\n' +
|
' <input type="checkbox" id="ask_up" />\n' +
|
||||||
|
@ -74,7 +74,7 @@ ebi('op_up2k').innerHTML = (
|
||||||
' <tr>\n' +
|
' <tr>\n' +
|
||||||
' <td class="c">\n' +
|
' <td class="c">\n' +
|
||||||
' <a href="#" class="b" id="nthread_sub">–</a><input\n' +
|
' <a href="#" class="b" id="nthread_sub">–</a><input\n' +
|
||||||
' class="txtbox" id="nthread" value="2" tt="pause uploads by setting it to 0"/><a\n' +
|
' class="txtbox" id="nthread" value="2" tt="pause uploads by setting it to 0$N$Nincrease if your connection is slow / high latency$N$Nkeep it 1 on LAN or if the server HDD is a bottleneck"/><a\n' +
|
||||||
' href="#" class="b" id="nthread_add">+</a><br /> \n' +
|
' href="#" class="b" id="nthread_add">+</a><br /> \n' +
|
||||||
' </td>\n' +
|
' </td>\n' +
|
||||||
' </tr>\n' +
|
' </tr>\n' +
|
||||||
|
@ -1593,25 +1593,62 @@ function autoplay_blocked(seek) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function scan_hash(v) {
|
||||||
|
if (!v)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
var m = /^#([ag])(f-[0-9a-f]{8,16})(&.+)?/.exec(v + '');
|
||||||
|
if (!m)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
var mtype = m[1],
|
||||||
|
id = m[2],
|
||||||
|
ts = null;
|
||||||
|
|
||||||
|
if (m.length > 3) {
|
||||||
|
m = /^&[Tt=0]*([0-9]+[Mm:])?0*([0-9]+)[Ss]?$/.exec(m[3]);
|
||||||
|
if (m) {
|
||||||
|
ts = parseInt(m[1] || 0) * 60 + parseInt(m[2] || 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return [mtype, id, ts];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function eval_hash() {
|
function eval_hash() {
|
||||||
var v = hash0;
|
var v = hash0;
|
||||||
hash0 = null;
|
hash0 = null;
|
||||||
if (!v)
|
if (!v)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (v.indexOf('#af-') === 0) {
|
var media = scan_hash(v);
|
||||||
var id = v.slice(2).split('&');
|
if (media) {
|
||||||
if (id[0].length < 10)
|
var mtype = media[0],
|
||||||
|
id = media[1],
|
||||||
|
ts = media[2];
|
||||||
|
|
||||||
|
if (mtype == 'a') {
|
||||||
|
if (!ts)
|
||||||
|
return play(id);
|
||||||
|
|
||||||
|
return play(id, false, ts);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mtype == 'g') {
|
||||||
|
if (!thegrid.en)
|
||||||
|
ebi('griden').click();
|
||||||
|
|
||||||
|
var t = setInterval(function () {
|
||||||
|
if (!thegrid.bbox)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (id.length == 1)
|
clearInterval(t);
|
||||||
return play(id[0]);
|
var im = QS('#ggrid a[ref="' + id + '"]');
|
||||||
|
im.click();
|
||||||
var m = /^[Tt=0]*([0-9]+[Mm:])?0*([0-9]+)[Ss]?$/.exec(id[1]);
|
im.scrollIntoView();
|
||||||
if (!m)
|
}, 50);
|
||||||
return play(id[0]);
|
}
|
||||||
|
|
||||||
return play(id[0], false, parseInt(m[1] || 0) * 60 + parseInt(m[2] || 0));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (v.indexOf('#q=') === 0) {
|
if (v.indexOf('#q=') === 0) {
|
||||||
|
@ -2950,6 +2987,9 @@ var thegrid = (function () {
|
||||||
return '<a download href="' + h +
|
return '<a download href="' + h +
|
||||||
'">' + (idx + 1) + ' / ' + r.bbox.length + ' -- ' +
|
'">' + (idx + 1) + ' / ' + r.bbox.length + ' -- ' +
|
||||||
esc(uricom_dec(h.split('/').pop())[0]) + '</a>';
|
esc(uricom_dec(h.split('/').pop())[0]) + '</a>';
|
||||||
|
},
|
||||||
|
onChange: function (i) {
|
||||||
|
sethash('g' + r.bbox[i].imageElement.getAttribute('ref'));
|
||||||
}
|
}
|
||||||
})[0];
|
})[0];
|
||||||
};
|
};
|
||||||
|
@ -2963,10 +3003,6 @@ var thegrid = (function () {
|
||||||
});
|
});
|
||||||
ebi('wtgrid').onclick = ebi('griden').onclick;
|
ebi('wtgrid').onclick = ebi('griden').onclick;
|
||||||
|
|
||||||
setTimeout(function () {
|
|
||||||
import_js('/.cpr/baguettebox.js', r.bagit);
|
|
||||||
}, 1);
|
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
@ -4045,6 +4081,7 @@ var treectl = (function () {
|
||||||
html = html.join('\n');
|
html = html.join('\n');
|
||||||
set_files_html(html);
|
set_files_html(html);
|
||||||
|
|
||||||
|
function asdf() {
|
||||||
filecols.set_style();
|
filecols.set_style();
|
||||||
showfile.mktree();
|
showfile.mktree();
|
||||||
mukey.render();
|
mukey.render();
|
||||||
|
@ -4059,6 +4096,25 @@ var treectl = (function () {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var m = scan_hash(hash0),
|
||||||
|
url = null;
|
||||||
|
|
||||||
|
if (m) {
|
||||||
|
url = ebi(m[1]);
|
||||||
|
if (url) {
|
||||||
|
url = url.href;
|
||||||
|
var mt = m[0] == 'a' ? 'audio' : /\.(webm|mkv)($|\?)/i.exec(url) ? 'video' : 'image'
|
||||||
|
if (mt == 'image') {
|
||||||
|
url += url.indexOf('?') < 0 ? '?cache' : '&cache';
|
||||||
|
console.log(url);
|
||||||
|
new Image().src = url;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (url) setTimeout(asdf, 1); else asdf();
|
||||||
|
}
|
||||||
|
|
||||||
r.hydrate = function () {
|
r.hydrate = function () {
|
||||||
if (ls0 === null) {
|
if (ls0 === null) {
|
||||||
var xhr = new XMLHttpRequest();
|
var xhr = new XMLHttpRequest();
|
||||||
|
@ -4069,12 +4125,9 @@ var treectl = (function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
r.gentab(get_evpath(), ls0);
|
r.gentab(get_evpath(), ls0);
|
||||||
reload_browser();
|
|
||||||
pbar.onresize();
|
pbar.onresize();
|
||||||
vbar.onresize();
|
vbar.onresize();
|
||||||
mukey.render();
|
|
||||||
showfile.addlinks();
|
showfile.addlinks();
|
||||||
thegrid.setdirty();
|
|
||||||
setTimeout(eval_hash, 1);
|
setTimeout(eval_hash, 1);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -4173,14 +4226,16 @@ function apply_perms(newperms) {
|
||||||
perms = newperms || [];
|
perms = newperms || [];
|
||||||
|
|
||||||
var a = QS('#ops a[data-dest="up2k"]');
|
var a = QS('#ops a[data-dest="up2k"]');
|
||||||
|
var suf = 'multithreaded, and file timestamps are preserved, but it uses more CPU than the basic uploader';
|
||||||
if (have_up2k_idx) {
|
if (have_up2k_idx) {
|
||||||
a.removeAttribute('data-perm');
|
a.removeAttribute('data-perm');
|
||||||
a.setAttribute('tt', 'up2k: upload files (if you have write-access) or toggle into the search-mode to see if they exist somewhere on the server');
|
a.setAttribute('tt', 'up2k: upload files (if you have write-access) or toggle into the search-mode to see if they exist somewhere on the server$N$Nuploads are resumable, ' + suf);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
a.setAttribute('data-perm', 'write');
|
a.setAttribute('data-perm', 'write');
|
||||||
a.setAttribute('tt', 'up2k: upload files with resume support (close your browser and drop the same files in later)');
|
a.setAttribute('tt', 'up2k: upload files with resume support (close your browser and drop the same files in later)$N$N' + suf);
|
||||||
}
|
}
|
||||||
|
a.style.display = '';
|
||||||
tt.att(QS('#ops'));
|
tt.att(QS('#ops'));
|
||||||
|
|
||||||
var axs = [],
|
var axs = [],
|
||||||
|
|
Loading…
Reference in a new issue