diff --git a/cms/static/js/base.js b/cms/static/js/base.js index 3186f7592b..bb3fe88510 100644 --- a/cms/static/js/base.js +++ b/cms/static/js/base.js @@ -48,17 +48,9 @@ $(document).ready(function () { (e).preventDefault(); }); - // alerts - manual close - $('.action-alert-close, .alert.has-actions .nav-actions a').click(function(e) { - (e).preventDefault(); - $(this).closest('.wrapper-alert').removeClass('is-shown'); - }); - - // notifications - manual & action-based close - $('.action-notification-close').click(function(e) { - (e).preventDefault(); - $(this).closest('.wrapper-notification').removeClass('is-shown').addClass('is-hiding'); - }); + // alerts/notifications - manual close + $('.action-alert-close, .alert.has-actions .nav-actions a').bind('click', hideAlert); + $('.action-notification-close').bind('click', hideNotification); // nav - dropdown related $body.click(function (e) { @@ -550,6 +542,17 @@ function removeDateSetter(e) { $block.find('.time').val(''); } + +function hideNotification(e) { + (e).preventDefault(); + $(this).closest('.wrapper-notification').removeClass('is-shown').addClass('is-hiding'); +} + +function hideAlert(e) { + (e).preventDefault(); + $(this).closest('.wrapper-alert').removeClass('is-shown'); +} + function showToastMessage(message, $button, lifespan) { var $toast = $('
'); var $closeBtn = $('×');