(function ($) { $.wysiwyg.dialog.register("default", function () { var that = this; this._$dialog = null; this.init = function() { var abstractDialog = this, content = this.options.content; if(typeof content == 'object') { if(typeof content.html == 'function') { content = content.html(); } else if(typeof content.toString == 'function') { content = content.toString(); } } that._$dialog = $('
'); var $topbar = $('
'+this.options.title+'
'); var $link = $('X'); $link.click(function () { abstractDialog.close(); // this is important it makes sure that is close from the abstract $.wysiwyg.dialog instace, not just locally }); $topbar.find('.wysiwyg-dialog-close-wrapper').prepend($link); var $dcontent = $('
'+content+'
'); that._$dialog.append($topbar).append($dcontent); that._$dialog.hide(); $("body").append(that._$dialog); return that._$dialog; }; this.show = function () { that._$dialog.show(); return that._$dialog; } this.hide = function () { that._$dialog.hide(); return that._$dialog; }; this.destroy = function() { that._$dialog.remove(); return that._$dialog; }; }); })(jQuery);