Skip to content

Commit 41078a5

Browse files
committed
Add footer support
How can you walk without feet?
1 parent eb93af9 commit 41078a5

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

simpletoast.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*/
44
(() => {
55
if (window !== window.top) return;
6-
const version = buildVersion(1, 9, 0);
6+
const version = buildVersion(1, 10, 0);
77
if (window.SimpleToast) {
88
if (SimpleToast.version) {
99
if (SimpleToast.version >= version.number) return;
@@ -40,6 +40,10 @@
4040
textShadow: '#3498db 1px 2px 1px',
4141
background: '#2980b9',
4242
},
43+
footer: {
44+
display: 'block',
45+
fontSize: '10px',
46+
},
4347
button: {
4448
height: '20px',
4549
margin: '-3px 0 0 3px',
@@ -128,7 +132,7 @@
128132
exists: () => false,
129133
close: noop,
130134
};
131-
function Toast({title, text, className, css = {}, buttons, timeout, onClose} = {}) {
135+
function Toast({title, text, footer, className, css = {}, buttons, timeout, onClose} = {}) {
132136
if (typeof arguments[0] === 'string') {
133137
text = arguments[0];
134138
}
@@ -154,6 +158,13 @@
154158
const body = document.createElement('span');
155159
body.textContent = text;
156160
el.appendChild(body);
161+
if (footer) {
162+
const fel = el.appendChild(document.createElement('span'));
163+
applyCSS(fel, style.footer);
164+
applyCSS(fel, css.footer);
165+
fel.textContent = footer;
166+
}
167+
157168
let closeType = 'unknown';
158169
const toast = {
159170
setText: (newText) => {

0 commit comments

Comments
 (0)