Skip to content

Node.js based forum software built for the modern web

fixed issue where an updated alert didn't contain changes to the clickfn, closes #2798

Julian Lama2c6f5878282
diff --git a/public/src/modules/alerts.js b/public/src/modules/alerts.js
index 4db3a1d9ab..15f592720e 100644
--- a/public/src/modules/alerts.js
+++ b/public/src/modules/alerts.js
@@ -77,6 +77,19 @@ define('alerts', function() {
alert.children().fadeIn(100);
alert.html(translatedHTML);
});
+
+ // Handle changes in the clickfn
+ alert.off('click').removeClass('pointer');
+ if (typeof params.clickfn === 'function') {
+ alert
+ .addClass('pointer')
+ .on('click', function (e) {
+ if(!$(e.target).is('.close')) {
+ params.clickfn();
+ }
+ fadeOut(alert);
+ });
+ }
}
function fadeOut(alert) {