fix: hooks for alert animate, no more fadein/fadeout for reconnect alert

v1.18.x
Julian Lam 4 years ago
parent d511216c82
commit d9e2029074

@ -1,7 +1,7 @@
'use strict';
define('alerts', ['translator', 'components'], function (translator, components) {
define('alerts', ['translator', 'components', 'hooks'], function (translator, components, hooks) {
var module = {};
module.alert = function (params) {
@ -52,7 +52,7 @@ define('alerts', ['translator', 'components'], function (translator, components)
});
}
$(window).trigger('action:alert.new', { alert: alert, params: params });
hooks.fire('action:alert.new', { alert, params });
});
}
@ -74,7 +74,7 @@ define('alerts', ['translator', 'components'], function (translator, components)
translator.translate(alert.html(), function (translatedHTML) {
alert.children().fadeIn(100);
alert.html(translatedHTML);
$(window).trigger('action:alert.update', { alert: alert, params: params });
hooks.fire('action:alert.update', { alert, params });
});
// Handle changes in the clickfn
@ -118,6 +118,7 @@ define('alerts', ['translator', 'components'], function (translator, components)
alert.css('transition-property', '');
alert.css('transition', 'width ' + (timeout + 450) + 'ms linear, background-color ' + (timeout + 450) + 'ms ease-in');
alert.addClass('animate');
hooks.fire('action:alert.animate', { alert, params });
}, 50);
// Handle mouseenter/mouseleave

@ -124,11 +124,11 @@ socket = window.socket;
if (reconnecting) {
var reconnectEl = $('#reconnect');
var reconnectAlert = $('#reconnect-alert');
var reconnectAlert = document.getElementById('reconnect-alert');
reconnectEl.tooltip('destroy');
reconnectEl.html('<i class="fa fa-check text-success"></i>');
reconnectAlert.fadeOut(500);
reconnectAlert.classList.add('hide');
reconnecting = false;
reJoinCurrentRoom();
@ -180,11 +180,11 @@ socket = window.socket;
function onReconnecting() {
reconnecting = true;
var reconnectEl = $('#reconnect');
var reconnectAlert = $('#reconnect-alert');
var reconnectAlert = document.getElementById('reconnect-alert');
if (!reconnectEl.hasClass('active')) {
reconnectEl.html('<i class="fa fa-spinner fa-spin"></i>');
reconnectAlert.fadeIn(500).removeClass('hide');
reconnectAlert.classList.remove('hide');
}
reconnectEl.addClass('active').removeClass('hide').tooltip({

Loading…
Cancel
Save