mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 17:12:13 -06:00
embed sort-order in gallery/media URLs
so anyone who clicks the link sees the files in the same order
This commit is contained in:
parent
c8104b6e78
commit
0f257c9308
|
@ -2185,6 +2185,29 @@ if (window.og_fn) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
var args = ('' + hash0).split(/,sort/g);
|
||||||
|
if (args.length < 2)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var ret = [];
|
||||||
|
for (var a = 1; a < args.length; a++) {
|
||||||
|
var t = '', n = 1, z = args[a].split(',')[0];
|
||||||
|
if (z.startsWith('-')) {
|
||||||
|
z = z.slice(1);
|
||||||
|
n = -1;
|
||||||
|
}
|
||||||
|
if (z == "sz" || z.indexOf('/.') + 1)
|
||||||
|
t = "int";
|
||||||
|
ret.push([z, n, t]);
|
||||||
|
}
|
||||||
|
var cmp = jread('fsort', []);
|
||||||
|
if (JSON.stringify(ret.slice(0, 2) !=
|
||||||
|
JSON.stringify(cmp.slice(0, 2))))
|
||||||
|
jwrite('fsort', ret);
|
||||||
|
})();
|
||||||
|
|
||||||
|
|
||||||
var mpl = (function () {
|
var mpl = (function () {
|
||||||
var have_mctl = 'mediaSession' in navigator && window.MediaMetadata;
|
var have_mctl = 'mediaSession' in navigator && window.MediaMetadata;
|
||||||
|
|
||||||
|
@ -3942,7 +3965,7 @@ function play(tid, is_ev, seek) {
|
||||||
var o = ebi(oid);
|
var o = ebi(oid);
|
||||||
o.setAttribute('id', 'thx_js');
|
o.setAttribute('id', 'thx_js');
|
||||||
if (mpl.aplay)
|
if (mpl.aplay)
|
||||||
sethash(oid);
|
sethash(oid + getsort());
|
||||||
o.setAttribute('id', oid);
|
o.setAttribute('id', oid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4251,6 +4274,19 @@ function read_dsort(txt) {
|
||||||
read_dsort(dsort);
|
read_dsort(dsort);
|
||||||
|
|
||||||
|
|
||||||
|
function getsort() {
|
||||||
|
var ret = '',
|
||||||
|
sopts = jread('fsort');
|
||||||
|
|
||||||
|
sopts = sopts && sopts.length ? sopts : dsort;
|
||||||
|
|
||||||
|
for (var a = 0; a < Math.min(2, sopts.length); a++)
|
||||||
|
ret += ',sort' + (sopts[a][1] < 0 ? '-' : '') + sopts[a][0];
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function sortfiles(nodes) {
|
function sortfiles(nodes) {
|
||||||
if (!nodes.length)
|
if (!nodes.length)
|
||||||
return nodes;
|
return nodes;
|
||||||
|
@ -4278,6 +4314,8 @@ function sortfiles(nodes) {
|
||||||
if (!name)
|
if (!name)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
name = name.toLowerCase();
|
||||||
|
|
||||||
if (name == 'ts')
|
if (name == 'ts')
|
||||||
typ = 'int';
|
typ = 'int';
|
||||||
|
|
||||||
|
@ -6205,7 +6243,7 @@ var thegrid = (function () {
|
||||||
esc(uricom_dec(h.split('/').pop())) + '</a>';
|
esc(uricom_dec(h.split('/').pop())) + '</a>';
|
||||||
},
|
},
|
||||||
onChange: function (i) {
|
onChange: function (i) {
|
||||||
sethash('g' + r.bbox[i].imageElement.getAttribute('ref'));
|
sethash('g' + r.bbox[i].imageElement.getAttribute('ref') + getsort());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
r.bbox = br[0][0];
|
r.bbox = br[0][0];
|
||||||
|
|
Loading…
Reference in a new issue