}
} else {
mr.notifications.showNotification(notification, millisecondsDelay);
}
});
$(‘[data-notification-link]:not(.notification)’).on(‘click’, function() {
var notificationID = $(this).attr(‘data-notification-link’);
var notification = $(‘body’).find(‘.notification[data-notification-link="’ + notificationID + ‘"]’);
notification.removeClass(‘notification–dismissed’);
notification.addClass(‘notification–reveal’);
return false;
});
$(‘.notification-close’).on(‘click’, function() {
var closeButton = $(this);
// Pass the closeNotification function a reference to the close button
mr.notifications.closeNotification(closeButton);
if (closeButton.attr(‘href’) === ‘#’) {
return false;
}
});
};
mr.notifications.documentReady = documentReady;
mr.notifications.showNotification = function(notification, millisecondsDelay) {
var delay = (typeof millisecondsDelay !== typeof undefined) ? (1 * millisecondsDelay) : 0;
setTimeout(function() {
notification.addClass(‘notification–reveal’);
}, delay);
};
mr.notifications.closeNotification = function(notification) {
var $notification = $(notification);
notification = $notification.is(‘.notification-close’) ?
$notification.closest(‘.notification’) :
$(‘body’).find(‘.notification[data-notification-link="’ + notification + ‘"]’);
notification.addClass(‘notification–dismissed’);
// If this notification requires to be closed permanently using a cookie, set the cookie now.
if (typeof notification.attr(‘data-cookie’) !== typeof undefined) {
mr.cookies.setItem(notification.attr(‘data-cookie’), “true”, Infinity);
}
};
mr.components.documentReady.push(documentReady);
return mr;
}(mr, jQuery, window, document));