mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 17:12:13 -06:00
prevent vertical toast overflow
This commit is contained in:
parent
646557a43e
commit
d5892341b6
|
@ -52,7 +52,7 @@ html {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
padding: .3em 0;
|
padding: .3em 0;
|
||||||
margin: -.3em 0 0 0;
|
margin: -.3em 0 0 0;
|
||||||
line-height: 1.5em;
|
line-height: 1.3em;
|
||||||
color: #000;
|
color: #000;
|
||||||
border: none;
|
border: none;
|
||||||
outline: none;
|
outline: none;
|
||||||
|
@ -60,6 +60,15 @@ html {
|
||||||
border-radius: .5em 0 0 .5em;
|
border-radius: .5em 0 0 .5em;
|
||||||
transition: left .3s, width .3s, padding .3s, opacity .3s;
|
transition: left .3s, width .3s, padding .3s, opacity .3s;
|
||||||
}
|
}
|
||||||
|
#toastb {
|
||||||
|
max-height: 70vh;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
#toast.scroll #toastb {
|
||||||
|
overflow-y: scroll;
|
||||||
|
margin-right: -1.2em;
|
||||||
|
padding-right: .7em;
|
||||||
|
}
|
||||||
#toast pre {
|
#toast pre {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -744,6 +744,7 @@ function lf2br(txt) {
|
||||||
var toast = (function () {
|
var toast = (function () {
|
||||||
var r = {},
|
var r = {},
|
||||||
te = null,
|
te = null,
|
||||||
|
scrolling = false,
|
||||||
obj = mknod('div');
|
obj = mknod('div');
|
||||||
|
|
||||||
obj.setAttribute('id', 'toast');
|
obj.setAttribute('id', 'toast');
|
||||||
|
@ -751,8 +752,30 @@ var toast = (function () {
|
||||||
r.visible = false;
|
r.visible = false;
|
||||||
r.txt = null;
|
r.txt = null;
|
||||||
|
|
||||||
|
function scrollchk() {
|
||||||
|
if (scrolling)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var tb = ebi('toastb'),
|
||||||
|
vis = tb.offsetHeight,
|
||||||
|
all = tb.scrollHeight;
|
||||||
|
|
||||||
|
if (8 + vis >= all)
|
||||||
|
return;
|
||||||
|
|
||||||
|
clmod(obj, 'scroll', 1);
|
||||||
|
scrolling = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function unscroll() {
|
||||||
|
timer.rm(scrollchk);
|
||||||
|
clmod(obj, 'scroll');
|
||||||
|
scrolling = false;
|
||||||
|
}
|
||||||
|
|
||||||
r.hide = function (e) {
|
r.hide = function (e) {
|
||||||
ev(e);
|
ev(e);
|
||||||
|
unscroll();
|
||||||
clearTimeout(te);
|
clearTimeout(te);
|
||||||
clmod(obj, 'vis');
|
clmod(obj, 'vis');
|
||||||
r.visible = false;
|
r.visible = false;
|
||||||
|
@ -763,11 +786,12 @@ var toast = (function () {
|
||||||
if (ms)
|
if (ms)
|
||||||
te = setTimeout(r.hide, ms * 1000);
|
te = setTimeout(r.hide, ms * 1000);
|
||||||
|
|
||||||
obj.innerHTML = '<a href="#" id="toastc">x</a>' + lf2br(txt);
|
obj.innerHTML = '<a href="#" id="toastc">x</a><div id="toastb">' + lf2br(txt) + '</div>';
|
||||||
obj.className = cl;
|
obj.className = cl;
|
||||||
ms += obj.offsetWidth;
|
ms += obj.offsetWidth;
|
||||||
obj.className += ' vis';
|
obj.className += ' vis';
|
||||||
ebi('toastc').onclick = r.hide;
|
ebi('toastc').onclick = r.hide;
|
||||||
|
timer.add(scrollchk);
|
||||||
r.visible = true;
|
r.visible = true;
|
||||||
r.txt = txt;
|
r.txt = txt;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue