(title, message, type = 'info')
| 76 | } |
| 77 | } |
| 78 | function showToast(title, message, type = 'info') { |
| 79 | const toast = document.getElementById('toast'); |
| 80 | const toastBody = document.getElementById('toast-body'); |
| 81 | if (toastBody && toast) { |
| 82 | toastBody.textContent = message; |
| 83 | // Remove existing classes and add new type class |
| 84 | toast.className = 'toast'; |
| 85 | if (type === 'success') { |
| 86 | toast.classList.add('text-bg-success'); |
| 87 | } |
| 88 | else if (type === 'error') { |
| 89 | toast.classList.add('text-bg-danger'); |
| 90 | } |
| 91 | else if (type === 'warning') { |
| 92 | toast.classList.add('text-bg-orange'); |
| 93 | } |
| 94 | else { |
| 95 | toast.classList.add('text-bg-info'); |
| 96 | } |
| 97 | const bsToast = new bootstrap.Toast(toast, { |
| 98 | autohide: true, |
| 99 | delay: 3000 |
| 100 | }); |
| 101 | bsToast.show(); |
| 102 | } |
| 103 | } |
| 104 | function changeButtonAction(element, buttonID, attribute) { |
| 105 | var value = element.options[element.selectedIndex].value; |
| 106 | document.getElementById(buttonID).setAttribute(attribute, value); |
no test coverage detected