aboutsummaryrefslogtreecommitdiffstats
path: root/view/js
diff options
context:
space:
mode:
Diffstat (limited to 'view/js')
-rw-r--r--view/js/main.js31
-rw-r--r--view/js/mod_cloud.js4
2 files changed, 30 insertions, 5 deletions
diff --git a/view/js/main.js b/view/js/main.js
index c9798dede..6fda3c8d0 100644
--- a/view/js/main.js
+++ b/view/js/main.js
@@ -1008,7 +1008,7 @@ function liveUpdate(notify_id) {
in_progress = false;
liveRecurse ++;
if(liveRecurse < 10) {
- liveUpdate();
+ liveUpdate(notify_id);
}
else {
console.log('Incomplete data. Too many attempts. Giving up.');
@@ -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,26 @@ function toggleAside() {
$('<div id="overlay"></div>').appendTo('body').one('click', function() { toggleAside(); });
}
}
+
+function toast(string, severity) {
+ let id = btoa(string);
+ let container = document.getElementById('toast-container');
+ let toast = document.getElementById(id);
+
+ if (!toast) {
+ toast = document.createElement('div');
+ toast.setAttribute('id', id);
+ 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', '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();
+}
diff --git a/view/js/mod_cloud.js b/view/js/mod_cloud.js
index e0f59beab..fc9219bff 100644
--- a/view/js/mod_cloud.js
+++ b/view/js/mod_cloud.js
@@ -73,7 +73,7 @@ $(document).ready(function () {
close_and_deactivate_all_panels();
$('body').css('cursor', 'wait');
- $.jGrowl(aStr.download_info, { sticky: false, theme: 'info', life: 10000 });
+ toast(aStr.download_info, 'info');
let data = [
{name: 'attach_path', value: window.location.pathname},
@@ -301,7 +301,7 @@ $(document).ready(function () {
close_and_deactivate_all_panels();
$('body').css('cursor', 'wait');
- $.jGrowl(aStr.download_info, { sticky: false, theme: 'info', life: 10000 });
+ toast(aStr.download_info, 'info');
post_data.push(
{name: 'attach_path', value: window.location.pathname},