mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
3 lines
2.6 KiB
JavaScript
3 lines
2.6 KiB
JavaScript
define([],function(){"use strict";define(["jquery"],function(t){function o(){s.hide()}var i=t,e=function(t){this.$overlay=t.overlay,this.$dialog=t.dialog,this.$header=this.$dialog.find(".modal-header"),this.$body=this.$dialog.find(".modal-body"),this.$footer=this.$dialog.find(".modal-footer"),this.$backdrop=t.backdrop,this.$header.find(".close").on("click",i.proxy(this.hide,this))};i.extend(e.prototype,{setContent:function(t){this.$header.hide(),t.title&&(this.$header.find(".title").html(t.title),this.$header.show()),t.closeButton?(this.$header.find(".close").show(),this.$header.show()):this.$header.find(".close").hide(),this.$footer.hide();var o=this.$footer.find(".buttons").html("");t.buttons&&(i.each(t.buttons,function(t,e){o.append(i("<button></button> ").text(t).click(e)).append(" ")}),this.$footer.show());var e=this.$footer.find(".extra_buttons").html("");t.extra_buttons&&(i.each(t.extra_buttons,function(t,o){e.append(i("<button></button>").text(t).click(o)).append(" ")}),this.$footer.show());var s=t.body;"progress"==s&&(s=i("<div class='progress progress-striped active'><div class='progress-bar' style='width: 100%'></div></div>")),this.$body.html(s)},show:function(t,o){this.$dialog.is(":visible")||(t.backdrop?this.$backdrop.addClass("in"):this.$backdrop.removeClass("in"),this.$overlay.show(),this.$dialog.show(),this.$overlay.addClass("in"),this.$body.css("min-width",this.$body.width()),this.$body.css("max-height",i(window).height()-this.$footer.outerHeight()-this.$header.outerHeight()-parseInt(this.$dialog.css("padding-top"),10)-parseInt(this.$dialog.css("padding-bottom"),10))),o&&o()},hide:function(){var t=this;t.$dialog.fadeOut(function(){t.$overlay.hide(),t.$backdrop.removeClass("in"),t.$body.children().remove(),t.$body.css("min-width",void 0)})}});var s;return i(function(){s=new e({overlay:i("#top-modal"),dialog:i("#top-modal-dialog"),backdrop:i("#top-modal-backdrop")})}),{Modal:e,hide_modal:o,show_modal:function(t,o,i,e,d){s.setContent({title:t,body:o,buttons:i,extra_buttons:e}),s.show({backdrop:!0},d)},show_message:function(t,o,i,e,d){s.setContent({title:t,body:o,buttons:i,extra_buttons:e}),s.show({backdrop:!1},d)},show_in_overlay:function(t){var e=t.width||"600",d=t.height||"400",a=t.scroll||"auto";i("#overlay-background").bind("click.overlay",function(){o(),i("#overlay-background").unbind("click.overlay")}),s.setContent({closeButton:!0,title:" ",body:i("<div style='margin: -5px;'><iframe style='margin: 0; padding: 0;' src='"+t.url+"' width='"+e+"' height='"+d+"' scrolling='"+a+"' frameborder='0'></iframe></div>")}),s.show({backdrop:!0})}}})});
|
|
//# sourceMappingURL=../../maps/layout/modal.js.map
|