diff --git a/src/js/messager.js b/src/js/messager.js index 0db99147ca41947aff32965016eb44b7f2cae226..965b31fb9051958658ed0a7711eff72b5991f8e1 100644 --- a/src/js/messager.js +++ b/src/js/messager.js @@ -6,11 +6,11 @@ * ======================================================================== */ -(function($, window) { +(function($, window, undefined) { 'use strict'; var id = 0; - var template = ''; + var template = ''; var defaultOptions = { type: 'default', placement: 'top', @@ -19,6 +19,10 @@ // clear: false, icon: null, close: true, + // actions: [{icon, name, action, title}], + // contentClass: null, + // cssClass: null, + // onAction: function, fade: true, scale: true }; @@ -31,16 +35,63 @@ that.message = (options.icon ? ' ' : '') + message; that.$ = $(template.format(options)).toggleClass('fade', options.fade).toggleClass('scale', options.scale).attr('id', 'messager-' + that.id); - if(!options.close) { - that.$.find('.close').remove(); - } else { - that.$.on('click', '.close', function() { - that.hide(); + + if(options.cssClass) that.$.addClass(options.cssClass); + + var hasCloseAction = false; + var $actions = that.$.find('.messager-actions'); + var appendAction = function(action) { + var $btn = $('