mirror of
https://github.com/sigmasternchen/MyTube
synced 2025-03-15 12:58:54 +00:00
24 lines
No EOL
738 B
JavaScript
24 lines
No EOL
738 B
JavaScript
(function () {
|
|
let toastCounter = 0;
|
|
|
|
const toastTime = 3000;
|
|
|
|
window.toast = function (str) {
|
|
let id = "toast" + toastCounter++;
|
|
let element = document.createElement("div");
|
|
element.id = id;
|
|
element.className = "customToast customToastStart";
|
|
element.innerText = str;
|
|
|
|
document.body.appendChild(element);
|
|
window.setTimeout(function () {
|
|
element.className = "customToast customToastMain";
|
|
}, 0);
|
|
window.setTimeout(function () {
|
|
element.className = "customToast customToastStop";
|
|
}, toastTime);
|
|
window.setTimeout(function () {
|
|
document.body.removeChild(element);
|
|
}, toastTime + 1000)
|
|
}
|
|
})(); |