(function() { var ALERTS_CONTAINER_ID, Alert; ALERTS_CONTAINER_ID = 'pa-page-alerts-box'; /* * @class Alert */ Alert = function() { return this; }; Alert.DEFAULTS = { type: 'warning', close_btn: true, classes: false, namespace: 'pa_page_alerts', animate: true, auto_close: false }; Alert.TYPES_HASH = { warning: '', danger: 'alert-danger', success: 'alert-success', info: 'alert-info' }; /* * Initialize plugin. */ Alert.prototype.init = function() { var self; self = this; return $('#main-wrapper').on('click.pa.alerts', '#' + ALERTS_CONTAINER_ID + ' .close', function() { self.close($(this).parents('.alert')); return false; }); }; /* * Add new alert. * * @param {String} html * @param {Object} options */ Alert.prototype.add = function(html, options) { var $alert, $alerts, $box, height, padding_bottom, padding_top; options = $.extend({}, Alert.DEFAULTS, options || {}); $alert = $('
').html(html); if (options.classes) { $alert.addClass(options.classes); } if (options.close_btn) { $alert.prepend($('