File indexing completed on 2024-05-19 06:00:27

0001 /*
0002  *  jQuery fullscreen popup - v0.0.1
0003  *  Simple fullscreen popup plugin
0004  *  https://github.com/nurislamov/jquery-fullscreen-popup
0005  *
0006  *  Made by Timur Nurislamov
0007  *  Under MIT License
0008  */
0009 (function(){var a=function(a,b){return function(){return a.apply(b,arguments)}};!function(b){var c,d,e;return e="fullScreenPopup",d={bgColor:"#fff",inlineStyles:!0,lockDocumentScroll:!0,mainWrapperClass:"fsp-wrapper",contentWrapperClass:"fsp-content",closePopupClass:"fsp-close",animationSpeed:200},c=function(){function c(c,f){this.element=c,this.closePopup=a(this.closePopup,this),this.init=a(this.init,this),this.options=b.extend({},d,f),this._defaults=d,this._name=e,this.element=b(this.element),this.body=b("body"),this.element.on("click",this.init)}return c.prototype.init=function(a){return a.preventDefault(),this.getTarget(),this.getTargetSizes(),this.createWrappers(),this.wrapTarget(),this.options.lockDocumentScroll&&this.lockDocumentScroll(),this.render(),this.bindEvents()},c.prototype.getTarget=function(){return this.target=b(this.element.attr("href")||this.element.data("popup")),this.targetParent=this.target.parent()},c.prototype.getTargetSizes=function(){return this.targetSizes={width:this.target.width(),height:this.target.height()}},c.prototype.wrapTarget=function(){return this.target=this.detachFromDom(this.target),this.target.appendTo(this.contentWrapper)},c.prototype.render=function(){return this.target.show(),this.attachToDom(this.mainWrapper,"body"),this.popupCentered(),this.mainWrapper.fadeIn(this.options.animationSpeed)},c.prototype.detachFromDom=function(a){return a.detach()},c.prototype.attachToDom=function(a,b){return a.appendTo(b)},c.prototype.bindEvents=function(){return this.close.on("click",this.closePopup)},c.prototype.createWrappers=function(){return this.mainWrapper=b("<div/>",{"class":""+this.options.mainWrapperClass,style:this.options.inlineStyles?"background: "+this.options.bgColor+"; position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 9999; overflow-y: auto; overflow-x: hidden; display: none":void 0}),this.contentWrapper=b("<div/>",{"class":""+this.options.contentWrapperClass,style:"width: "+this.targetSizes.width+"px; height: "+this.targetSizes.height+"px;  position: absolute; top: 50%; left: 50%; margin-left: -"+this.targetSizes.width/2+"px; margin-top: -"+this.targetSizes.height/2+"px"}).appendTo(this.mainWrapper),this.close=b("<a/>",{href:"#",html:"&times;","class":""+this.options.closePopupClass,style:this.options.inlineStyles?"position: absolute; right: 2em; top: 2em;":void 0}).appendTo(this.mainWrapper)},c.prototype.popupCentered=function(){},c.prototype.closePopup=function(a){var b;return a.preventDefault(),b=this,this.mainWrapper.fadeOut(this.options.animationSpeed,function(){return b.options.lockDocumentScroll&&b.unlockDocumentScroll(),b.target=b.detachFromDom(b.target),b.target.hide(),b.attachToDom(b.target,b.targetParent),b.deleteWrappers()})},c.prototype.deleteWrappers=function(){return this.mainWrapper.remove()},c.prototype.lockDocumentScroll=function(){return this.body.css({overflow:"hidden"})},c.prototype.unlockDocumentScroll=function(){return this.body.css({overflow:"visible"})},c}(),b.fn[e]=function(a){return this.each(function(){return b.data(this,"plugin_"+e)?void 0:b.data(this,"plugin_"+e,new c(this,a))})}}(jQuery)}).call(this);