16 lines
No EOL
491 B
JavaScript
16 lines
No EOL
491 B
JavaScript
(function () {
|
|
var toast = document.querySelector(".tea-toast");
|
|
if (!toast) return;
|
|
var timer = null;
|
|
function spin(msg) {
|
|
toast.textContent = msg;
|
|
toast.classList.add("show");
|
|
if (timer) clearTimeout(timer);
|
|
timer = setTimeout(function () { toast.classList.remove("show"); }, 3200);
|
|
}
|
|
document.querySelectorAll("[data-tea]").forEach(function (b) {
|
|
b.addEventListener("click", function () {
|
|
spin(b.getAttribute("data-toast") || "");
|
|
});
|
|
});
|
|
})(); |