You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

8 lines
2.2 KiB

2 years ago
  1. /*!
  2. * Simple collapse/spoilers system
  3. * Version : 1.0
  4. * Emmanuel B. (www.emmanuelbeziat.com)
  5. * https://github.com/EmmanuelBeziat/jquery-spoilers
  6. **/
  7. !function(t,e,n,o){"use strict";function l(e,n){this.element=e,this._name=i,this._defaults=t.fn[i].defaults,this.options=t.extend({},this._defaults,n),this.init()}var i="awesomodals";t.extend(l.prototype,{init:function(){this.buildCache(),this.bindEvents(),this.debug("[init] "+this._name,"info")},destroy:function(){this.unbindEvents(),this.$element.removeData()},buildCache:function(){this.$element=t(this.element),this.$modal=null},bindEvents:function(){var e=this;e.$element.on("click."+e._name,e.options.selectorOpen,function(n){e.modalOpen.call(e,t(this))}).on("click."+e._name,e.options.selectorClose,function(n){e.modalClose.call(e,t(this))}).on("click."+e._name,e.options.itemOverlay,function(n){e.options.optionOverlayActive&&e.modalClose.call(e,t(this))})},unbindEvents:function(){this.$element.off("."+this._name)},modalOpen:function(e){this.debug("[action] Open modal call"),this.debug("Modal ID: "+e.attr("data-modal")),event.preventDefault();var n=t(e.attr("data-modal"));n.addClass(this.options.classActive),this.$modal=n,this.callbackOpen()},modalClose:function(){this.debug("[action] Close modal call"),this.$modal.removeClass(this.options.classActive),this.$modal=null,this.callbackClose()},callbackOpen:function(){var t=this.options.onModalOpened;this.debug("[callback] On Modal Opened"),"function"==typeof t&&t.call(this.element)},callbackClose:function(){var t=this.options.onModalClosed;this.debug("[callback] On Modal Closed"),"function"==typeof t&&t.call(this.element)},debug:function(t,e){if(this.options.debug)switch(e){case"warn":console.warn(t);break;case"info":console.info(t);break;case"error":console.error(t);break;default:console.log(t)}}}),t.fn[i]=function(e){return this.each(function(){t.data(this,"plugin_"+i)||t.data(this,"plugin_"+i,new l(this,e))}),this},t.fn[i].defaults={debug:!1,selectorOpen:"[data-modal-init]",selectorClose:"[data-modal-close]",selectorModal:"[data-modal-item]",itemOverlay:".dialog-overlay",classActive:"dialog--active",optionOverlayActive:!0,onModalOpened:null,onModalClosed:null}}(jQuery,window,document);
  8. //# sourceMappingURL=../dist/jquery-awesomodals.min.js.map