Skip to content

Commit

Permalink
Add nmDestroy function and all needed destroy function in filters fix #…
Browse files Browse the repository at this point in the history
  • Loading branch information
nyroDev committed Oct 21, 2012
1 parent d5da144 commit 3a2e1f0
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 0 deletions.
3 changes: 3 additions & 0 deletions js/jquery.nyroModal.filters.form.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ jQuery(function($, undefined) {
});

$.ajax(ajax);
},
destroy: function(nm) {
nm.opener.off('submit.nyroModal');
}
}
});
Expand Down
3 changes: 3 additions & 0 deletions js/jquery.nyroModal.filters.formFile.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ jQuery(function($, undefined) {
nm.store.formFileIframe = undefined;
delete(nm.store.formFileIframe);
}
},
destroy: function(nm) {
nm.opener.off('submit.nyroModal')
}
}
});
Expand Down
3 changes: 3 additions & 0 deletions js/jquery.nyroModal.filters.iframeForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ jQuery(function($, undefined) {
nm.store.iframeFormIframe = undefined;
delete(nm.store.iframeFormIframe);
}
},
destroy: function(nm) {
nm.opener.off('submit.nyroModal')
}
}
});
Expand Down
3 changes: 3 additions & 0 deletions js/jquery.nyroModal.filters.link.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ jQuery(function($, undefined) {
}
});
$.ajax(ajax);
},
destroy: function(nm) {
nm.opener.off('click.nyroModal');
}
}
});
Expand Down
20 changes: 20 additions & 0 deletions js/jquery.nyroModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,16 @@ jQuery(function($, undefined) {
});
});
},

// Public function for destroying a nyroModal instance, only for non open modal
destroy: function() {
if (this._open)
return false;
this._callFilters('destroy');
if (this.elts.all)
this.elts.all.remove();
return true;
},

// Init HTML elements
_initElts: function() {
Expand Down Expand Up @@ -553,6 +563,15 @@ jQuery(function($, undefined) {
: $.extend(true, {opener: me}, _nmObj, opts));
});
},
nmDestroy: function() {
return this.each(function() {
var me = $(this);
if (me.data('nmObj')) {
if (me.data('nmObj').destroy())
me.removeData('nmObj');
}
});
},
nmCall: function() {
return this.trigger('nyroModal');
},
Expand Down Expand Up @@ -847,6 +866,7 @@ jQuery(function($, undefined) {
nm: _internal.nyroModal,
nyroModal: _internal.nyroModal,
nmInit: _internal.nmInit,
nmDestroy: _internal.nmDestroy,
nmCall: _internal.nmCall
});

Expand Down

0 comments on commit 3a2e1f0

Please sign in to comment.