ec09403c485af4115be1b9b92540b8738291e6cc
[moodle.git] / lib / amd / build / modal_backdrop.min.js
1 define ("core/modal_backdrop",["jquery","core/templates","core/notification","core/fullscreen"],function(a,b,c,d){var e={ROOT:"[data-region=\"modal-backdrop\"]"},f=function(b){this.root=a(b);this.isAttached=!1;if(!this.root.is(e.ROOT)){c.exception({message:"Element is not a modal backdrop"})}};f.prototype.getRoot=function(){return this.root};f.prototype.getAttachmentPoint=function(){return a(d.getElement()||document.body)};f.prototype.attachToDOM=function(){this.getAttachmentPoint().append(this.root);if(this.isAttached){return}this.isAttached=!0};f.prototype.setZIndex=function(a){this.root.css("z-index",a)};f.prototype.isVisible=function(){return this.root.hasClass("show")};f.prototype.hasTransitions=function(){return this.getRoot().hasClass("fade")};f.prototype.show=function(){if(this.isVisible()){return}this.attachToDOM();this.root.removeClass("hide").addClass("show")};f.prototype.hide=function(){if(!this.isVisible()){return}if(this.hasTransitions()){this.getRoot().one("transitionend webkitTransitionEnd oTransitionEnd",function(){this.getRoot().removeClass("show").addClass("hide")}.bind(this))}else{this.getRoot().removeClass("show").addClass("hide")}a(document.body).append(this.getRoot())};f.prototype.destroy=function(){this.root.remove()};return f});
2 //# sourceMappingURL=modal_backdrop.min.js.map