feat: Аккаунт › Вид - tab icons left, right or hidden, terminal font, compact file lists, the time column, animations; kept per user on the server. Uploads show a ring filling as they go
This commit is contained in:
1 parent
c003b51b4c
commit
5216aed237
10 files changed
+167
-3
No files matched your search
@@ -0,0 +1,27 @@
|
||||
// The look of the panel, as each user set it (Аккаунт › Вид): applied at
|
||||
// once on load from what the page came with, and again on every change.
|
||||
(function () {
|
||||
'use strict';
|
||||
let p = Object.assign({}, (window.APP && window.APP.prefs) || {});
|
||||
function apply() {
|
||||
const b = document.body;
|
||||
b.dataset.tabicons = p.tabIcons || 'left';
|
||||
b.classList.toggle('compact', !!p.compact);
|
||||
b.classList.toggle('no-ftime', p.fileTime === 'hide');
|
||||
b.classList.toggle('no-motion', p.motion === 'off');
|
||||
// Open terminals take the new size at once.
|
||||
if (window.Workspace) Workspace.panes().forEach(t => {
|
||||
if (t.term && t.term.options.fontSize !== termFont()) { t.term.options.fontSize = termFont(); t.fit(); }
|
||||
});
|
||||
}
|
||||
const termFont = () => p.termFont || (matchMedia('(pointer: coarse)').matches ? 13 : 14);
|
||||
async function set(k, v) {
|
||||
p[k] = v;
|
||||
apply();
|
||||
const r = await fetch('/api/panel/account/prefs', {method: 'POST', headers: {'Content-Type': 'application/json'},
|
||||
credentials: 'same-origin', body: JSON.stringify(p)}).then(x => x.json()).catch(() => ({ok: false}));
|
||||
return r.ok;
|
||||
}
|
||||
apply();
|
||||
window.Prefs = {get: () => Object.assign({}, p), set, apply, termFont};
|
||||
})();
|
||||
Reference in new issue
Block a user