ui: url-options to set grid/thumbs on/off

This commit is contained in:
ed 2024-10-30 19:24:00 +00:00
parent efd8a32ed6
commit 5718caa957
3 changed files with 22 additions and 1 deletions

View file

@ -577,6 +577,7 @@ click the `🌲` or pressing the `B` hotkey to toggle between breadcrumbs path (
press `g` or `田` to toggle grid-view instead of the file listing and `t` toggles icons / thumbnails press `g` or `田` to toggle grid-view instead of the file listing and `t` toggles icons / thumbnails
* can be made default globally with `--grid` or per-volume with volflag `grid` * can be made default globally with `--grid` or per-volume with volflag `grid`
* enable by adding `?imgs` to a link, or disable with `?imgs=0`
![copyparty-thumbs-fs8](https://user-images.githubusercontent.com/241032/129636211-abd20fa2-a953-4366-9423-1c88ebb96ba9.png) ![copyparty-thumbs-fs8](https://user-images.githubusercontent.com/241032/129636211-abd20fa2-a953-4366-9423-1c88ebb96ba9.png)

View file

@ -2118,8 +2118,9 @@ function set_files_html(html) {
// actx breaks background album playback on ios // actx breaks background album playback on ios
var ACtx = !IPHONE && (window.AudioContext || window.webkitAudioContext), var ACtx = !IPHONE && (window.AudioContext || window.webkitAudioContext),
ACB = sread('au_cbv') || 1, ACB = sread('au_cbv') || 1,
noih = /[?&]v\b/.exec('' + location),
hash0 = location.hash, hash0 = location.hash,
sloc0 = '' + location,
noih = /[?&]v\b/.exec(sloc0),
ldks = [], ldks = [],
dks = {}, dks = {},
dk, mp; dk, mp;
@ -6047,6 +6048,19 @@ var thegrid = (function () {
toast.warn(10, L.ul_btnlk); toast.warn(10, L.ul_btnlk);
}; };
if (/[?&]grid\b/.exec(sloc0))
swrite('griden', /[?&]grid=0\b/.exec(sloc0) ? 0 : 1)
if (/[?&]thumb\b/.exec(sloc0))
swrite('thumbs', /[?&]thumb=0\b/.exec(sloc0) ? 0 : 1)
if (/[?&]imgs\b/.exec(sloc0)) {
var n = /[?&]imgs=0\b/.exec(sloc0) ? 0 : 1;
swrite('griden', n);
if (n)
swrite('thumbs', 1);
}
bcfg_bind(r, 'thumbs', 'thumbs', true, r.setdirty); bcfg_bind(r, 'thumbs', 'thumbs', true, r.setdirty);
bcfg_bind(r, 'ihop', 'ihop', true); bcfg_bind(r, 'ihop', 'ihop', true);
bcfg_bind(r, 'vau', 'gridvau', false); bcfg_bind(r, 'vau', 'gridvau', false);

View file

@ -208,6 +208,12 @@ upload modifiers:
| method | params | result | | method | params | result |
|--|--|--| |--|--|--|
| GET | `?pw=x` | logout | | GET | `?pw=x` | logout |
| GET | `?grid` | ui: show grid-view |
| GET | `?imgs` | ui: show grid-view with thumbnails |
| GET | `?grid=0` | ui: show list-view |
| GET | `?imgs=0` | ui: show list-view |
| GET | `?thumb` | ui, grid-mode: show thumbnails |
| GET | `?thumb=0` | ui, grid-mode: show icons |
# event hooks # event hooks