diff options
author | Mario <mario@mariovavti.com> | 2024-05-02 13:00:45 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2024-05-02 13:00:45 +0000 |
commit | 058c7d6c13e4cb76efd001ca5be39769825587b0 (patch) | |
tree | 9ec6518429498f263adb3622cf75ed834b24e643 /view/js | |
parent | c6116e367a0f32fb95dfecf2d8c778ef97e7d76e (diff) | |
download | volse-hubzilla-058c7d6c13e4cb76efd001ca5be39769825587b0.tar.gz volse-hubzilla-058c7d6c13e4cb76efd001ca5be39769825587b0.tar.bz2 volse-hubzilla-058c7d6c13e4cb76efd001ca5be39769825587b0.zip |
start removing jgrowl
Diffstat (limited to 'view/js')
-rw-r--r-- | view/js/main.js | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/view/js/main.js b/view/js/main.js index c9798dede..f38d9db2d 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -1305,7 +1305,8 @@ function dropItem(url, object, b64mid) { $(object + ', #pinned-wrapper-' + id).remove(); $('body').css('cursor', 'auto'); - $.jGrowl(aStr.itemdel, { sticky: false, theme: 'info', life: 3000 }); + toast(aStr.itemdel, 'info') + //$.jGrowl(aStr.itemdel, { sticky: false, theme: 'info', life: 3000 }); if (typeof b64mid !== typeof undefined) { $('[data-b64mid=\'' + b64mid + '\']').fadeOut(function() { @@ -1408,7 +1409,8 @@ function submitPoll(id) { $.post('vote/' + id, $('#question-form-' + id).serialize(), function(data) { - $.jGrowl(data.message, { sticky: false, theme: ((data.success) ? 'info' : 'notice'), life: 10000 }); + toast(data.message, ((data.success) ? 'info' : 'danger')); + //$.jGrowl(data.message, { sticky: false, theme: ((data.success) ? 'info' : 'notice'), life: 10000 }); if(timer) clearTimeout(timer); timer = setTimeout(updateInit, 500); } @@ -1815,3 +1817,20 @@ function toggleAside() { $('<div id="overlay"></div>').appendTo('body').one('click', function() { toggleAside(); }); } } + +function toast(string, severity) { + let container = document.getElementById('toast-container'); + let toast = document.createElement('div'); + + toast.innerHTML = '<div class="d-flex"><div class="toast-body">' + string + '</div><button type="button" class="btn-close me-2 m-auto" data-bs-dismiss="toast" aria-label="Close"></button></div>'; + toast.classList.add('toast', 'p-2', 'm-3', 'bg-' + severity + '-subtle', 'text-' + severity + '-emphasis', 'border-' + severity,); + container.prepend(toast); + + let toastInstance = bootstrap.Toast.getOrCreateInstance(toast); + + if (severity === 'danger') { + toastInstance._config.autohide = false; + } + + toastInstance.show(); +} |