toast countdown bar

This commit is contained in:
ed 2024-10-04 19:29:54 +00:00
parent a99a3bc6d7
commit 0dfe1d5b35
3 changed files with 29 additions and 17 deletions

View file

@ -5696,10 +5696,7 @@ var thegrid = (function () {
swrite('gridln', r.ln); swrite('gridln', r.ln);
setTimeout(r.tippen, 20); setTimeout(r.tippen, 20);
} }
try { setcvar('--grid-ln', r.ln);
document.documentElement.style.setProperty('--grid-ln', r.ln);
}
catch (ex) { }
} }
setln(); setln();
@ -5709,10 +5706,7 @@ var thegrid = (function () {
swrite('gridsz', r.sz); swrite('gridsz', r.sz);
setTimeout(r.tippen, 20); setTimeout(r.tippen, 20);
} }
try { setcvar('--grid-sz', r.sz + 'em');
document.documentElement.style.setProperty('--grid-sz', r.sz + 'em');
}
catch (ex) { }
aligngriditems(); aligngriditems();
} }
setsz(); setsz();
@ -6775,10 +6769,7 @@ var filecolwidth = (function () {
return; return;
lastwidth = w; lastwidth = w;
try { setcvar('--file-td-w', w + 'em');
document.documentElement.style.setProperty('--file-td-w', w + 'em');
}
catch (ex) { }
} }
})(); })();
onresize100.add(filecolwidth, true); onresize100.add(filecolwidth, true);
@ -7022,10 +7013,7 @@ var treectl = (function () {
w = iw + 'em', w = iw + 'em',
w2 = (iw + 2) + 'em'; w2 = (iw + 2) + 'em';
try { setcvar('--nav-sz', w);
document.documentElement.style.setProperty('--nav-sz', w);
}
catch (ex) { }
ebi('tree').style.width = w; ebi('tree').style.width = w;
ebi('wrap').style.marginLeft = w2; ebi('wrap').style.marginLeft = w2;
onscroll(); onscroll();

View file

@ -69,6 +69,19 @@ html {
top: 2em; top: 2em;
bottom: unset; bottom: unset;
} }
#toastt {
position: absolute;
height: 1px;
top: 1px;
right: 1%;
width: 99%;
background: var(--fg-max);
animation: toastt var(--tmtime) steps(var(--tmstep)) forwards;
transform-origin: right;
}
@keyframes toastt {
to {transform: scaleX(0)}
}
#toast a { #toast a {
color: inherit; color: inherit;
text-shadow: inherit; text-shadow: inherit;

View file

@ -535,6 +535,14 @@ function clgot(el, cls) {
} }
function setcvar(k, v) {
try {
document.documentElement.style.setProperty(k, v);
}
catch (e) { }
}
var ANIM = true; var ANIM = true;
try { try {
var mq = window.matchMedia('(prefers-reduced-motion: reduce)'); var mq = window.matchMedia('(prefers-reduced-motion: reduce)');
@ -1525,7 +1533,10 @@ var toast = (function () {
if (txt.indexOf('<body>') + 1) if (txt.indexOf('<body>') + 1)
txt = txt.slice(0, txt.indexOf('<')) + ' [...]'; txt = txt.slice(0, txt.indexOf('<')) + ' [...]';
obj.innerHTML = '<a href="#" id="toastc">x</a><div id="toastb">' + lf2br(txt) + '</div>'; setcvar('--tmtime', sec + 's');
setcvar('--tmstep', sec * 15);
obj.innerHTML = '<div id="toastt"></div><a href="#" id="toastc">x</a><div id="toastb">' + lf2br(txt) + '</div>';
obj.className = cl; obj.className = cl;
sec += obj.offsetWidth; sec += obj.offsetWidth;
obj.className += ' vis'; obj.className += ' vis';