-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move toasts to toasts.js and add error toast
- Loading branch information
Showing
3 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
var toast_timeout; | ||
|
||
/* Show a regular grey toast */ | ||
function show_toast(message) { | ||
clearTimeout(toast_timeout); | ||
var td = document.getElementById("TOAST_MESSAGE"); | ||
td.innerHTML = message; | ||
td.className = "show"; | ||
toast_timeout = setTimeout(hide_toast, 3000); | ||
} | ||
|
||
/* Show a red toast for errors */ | ||
function show_error(message) { | ||
clearTimeout(toast_timeout); | ||
var td = document.getElementById("TOAST_MESSAGE"); | ||
td.innerHTML = message; | ||
td.className = "show error"; | ||
toast_timeout = setTimeout(hide_toast, 3000); | ||
} | ||
|
||
/* Used by show_toast, | ||
can also be invoked manually to hide the current toast */ | ||
function hide_toast() { | ||
var td = document.getElementById("TOAST_MESSAGE"); | ||
td.className = td.className.replace("show", "hide"); | ||
} |
02cba2a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also add refresh button in list