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

View file

@ -69,6 +69,19 @@ html {
top: 2em;
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 {
color: 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;
try {
var mq = window.matchMedia('(prefers-reduced-motion: reduce)');
@ -1525,7 +1533,10 @@ var toast = (function () {
if (txt.indexOf('<body>') + 1)
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;
sec += obj.offsetWidth;
obj.className += ' vis';