/** * @author: chenfeng_lian * after included jQuery */ ;var PAF = window.PAF || {}; PAF.plugins = PAF.plugins||{}; (function($){ PAF.plugins.ErrorMsg = function(options){ this.opts = $.extend(true, PAF.plugins.ErrorMsg.defaults, options); this.mask = null; this.$el = null; this.el = null; this.init(); }; PAF.plugins.ErrorMsg.prototype = { init : function() { var Confirm = this; var opts = this.opts; var sHtml = '<div class="errorLayout">'+this.opts.sHtml+'</div>'; $('body').append(sHtml); Confirm.$el = $('.errorLayout'); Confirm.setMask(); $('#close, #confirm').on('click', { scope : Confirm }, Confirm.fnConfirmIng); }, fn : function() { }, fnConfirmIng : function(e) { var Confirm = e.data.scope; Confirm.opts.callbacks.fnConfirmIng && Confirm.opts.callbacks.fnConfirmIng(); Confirm.mask.remove(); Confirm.destroy(); return false; }, destroy : function() { this.$el.remove(); }, setMask : function() { var Confirm = this; this.mask = $('<div class="mask"></div>').appendTo( Confirm.opts.parent).css({ height : $(document).height(), width : $(Confirm.opts.parent).width() }); } }; PAF.plugins.ErrorMsg.defaults = { 'parent' : 'body', 'sHtml': '', callbacks: { fnConfirmIng: function(){window.console && console.log('fnConfirmIng');} } }; return PAF.plugins.ErrorMsg ; }(jQuery));