Files
galaxy/static/scripts/layout/modal.js
T

3 lines
2.5 KiB
JavaScript

define("layout/modal",["exports","jquery"],function(t,o){"use strict";function e(){s.hide()}Object.defineProperty(t,"__esModule",{value:!0});var i=function(t){return t&&t.__esModule?t:{default:t}}(o).default,d=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(d.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 d=t.body;"progress"==d&&(d=i("<div class='progress progress-striped active'><div class='progress-bar' style='width: 100%'></div></div>")),this.$body.html(d)},show:function(t,o){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()/1.5),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;i(function(){s=new d({overlay:i("#top-modal"),dialog:i("#top-modal-dialog"),backdrop:i("#top-modal-backdrop")})}),t.default={Modal:d,hide_modal:e,show_modal:function(t,o,e,i,d){s.setContent({title:t,body:o,buttons:e,extra_buttons:i}),s.show({backdrop:!0},d)},show_message:function(t,o,e,i,d){s.setContent({title:t,body:o,buttons:e,extra_buttons:i}),s.show({backdrop:!1},d)},show_in_overlay:function(t){var o=t.width||"600",d=t.height||"400",a=t.scroll||"auto";i("#overlay-background").bind("click.overlay",function(){e(),i("#overlay-background").unbind("click.overlay")}),s.setContent({closeButton:!0,title:"&nbsp;",body:i("<div style='margin: -5px;'><iframe style='margin: 0; padding: 0;' src='"+t.url+"' width='"+o+"' height='"+d+"' scrolling='"+a+"' frameborder='0'></iframe></div>")}),s.show({backdrop:!0})}}});
//# sourceMappingURL=../../maps/layout/modal.js.map