Skip to content

Commit

Permalink
Use on and off function instead of bind and unbind (jQuery 1.7)
Browse files Browse the repository at this point in the history
  • Loading branch information
nyroDev committed Jan 19, 2012
1 parent 29ef228 commit d3a2648
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion js/jquery.nyroModal.filters.form.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jQuery(function($, undefined) {
},
init: function(nm) {
nm.loadFilter = 'form';
nm.opener.unbind('submit.nyroModal').bind('submit.nyroModal', function(e) {
nm.opener.off('submit.nyroModal').on('submit.nyroModal', function(e) {
e.preventDefault();
nm.opener.trigger('nyroModal');
});
Expand Down
6 changes: 3 additions & 3 deletions js/jquery.nyroModal.filters.formFile.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jQuery(function($, undefined) {
init: function(nm) {
nm.loadFilter = 'formFile';
nm.store.formFileLoading = false;
nm.opener.unbind('submit.nyroModal').bind('submit.nyroModal', function(e) {
nm.opener.off('submit.nyroModal').on('submit.nyroModal', function(e) {
if (!nm.store.formFileIframe) {
e.preventDefault();
nm.opener.trigger('nyroModal');
Expand Down Expand Up @@ -55,7 +55,7 @@ jQuery(function($, undefined) {
if (nm.store.formFileLoading) {
nm.store.formFileLoading = false;
var content = nm.store.formFileIframe
.unbind('load error')
.off('load error')
.contents().find('body').not('script[src]');
if (content && content.html() && content.html().length) {
rmFormFileElts();
Expand All @@ -66,7 +66,7 @@ jQuery(function($, undefined) {
fct = function() {
nbTry++;
var content = nm.store.formFileIframe
.unbind('load error')
.off('load error')
.contents().find('body').not('script[src]');
if (content && content.html() && content.html().length) {
nm._setCont(content.html(), nm.store.form.sel);
Expand Down
4 changes: 2 additions & 2 deletions js/jquery.nyroModal.filters.gallery.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jQuery(function($, undefined) {
href: '#'
})
.addClass('nyroModalPrev')
.bind('click', function(e) {
.on('click', function(e) {
e.preventDefault();
nm._callFilters('galleryPrev');
})
Expand All @@ -75,7 +75,7 @@ jQuery(function($, undefined) {
href: '#'
})
.addClass('nyroModalNext')
.bind('click', function(e) {
.on('click', function(e) {
e.preventDefault();
nm._callFilters('galleryNext');
})
Expand Down
2 changes: 1 addition & 1 deletion js/jquery.nyroModal.filters.iframeForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jQuery(function($, undefined) {
nm.loadFilter = 'iframeForm';
nm.store.iframeFormLoading = false;
nm.store.iframeFormOrgTarget = nm.opener.attr('target');
nm.opener.unbind('submit.nyroModal').bind('submit.nyroModal', function(e) {
nm.opener.off('submit.nyroModal').on('submit.nyroModal', function(e) {
if (!nm.store.iframeFormIframe) {
e.preventDefault();
nm.opener.trigger('nyroModal');
Expand Down
2 changes: 1 addition & 1 deletion js/jquery.nyroModal.filters.link.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jQuery(function($, undefined) {
},
init: function(nm) {
nm.loadFilter = 'link';
nm.opener.unbind('click.nyroModal').bind('click.nyroModal', function(e) {
nm.opener.off('click.nyroModal').on('click.nyroModal', function(e) {
e.preventDefault();
nm.opener.trigger('nyroModal');
});
Expand Down
12 changes: 6 additions & 6 deletions js/jquery.nyroModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ jQuery(function($, undefined) {
if (_internal.firstInit) {
_internal._container = $('<div />').appendTo($b);
$w.smartresize($.proxy(_internal._resize, _internal));
$d.bind('keydown.nyroModal', $.proxy(_internal._keyHandler, _internal));
$d.on('keydown.nyroModal', $.proxy(_internal._keyHandler, _internal));
_internal._calculateFullSize();
_internal.firstInit = false;
}
Expand Down Expand Up @@ -587,8 +587,8 @@ jQuery(function($, undefined) {
nm._callFilters('initFilters');
nm._callFilters('init');
nm.opener
.unbind('nyroModal.nyroModal nmClose.nyroModal nmResize.nyroModal')
.bind({
.off('nyroModal.nyroModal nmClose.nyroModal nmResize.nyroModal')
.on({
'nyroModal.nyroModal': function(e) { nm.open(); return false;},
'nmClose.nyroModal': function() { nm.close(); return false;},
'nmResize.nyroModal': function() { nm.resize(); return false;}
Expand Down Expand Up @@ -791,7 +791,7 @@ jQuery(function($, undefined) {
initElts: function(nm) {
nm.elts.bg.addClass('nyroModalBg');
if (nm.closeOnClick)
nm.elts.bg.unbind('click.nyroModal').bind('click.nyroModal', function(e) {
nm.elts.bg.off('click.nyroModal').on('click.nyroModal', function(e) {
e.preventDefault();
nm.close();
});
Expand All @@ -810,7 +810,7 @@ jQuery(function($, undefined) {
var cur = $(this);
cur.nyroModal(nm.getForNewLinks(cur), true);
}).end()
.find('.nyroModalClose').bind('click.nyroModal', function(e) {
.find('.nyroModalClose').on('click.nyroModal', function(e) {
e.preventDefault();
nm.close();
});
Expand Down Expand Up @@ -880,7 +880,7 @@ jQuery(function($, undefined) {
};
};
// smartresize
jQuery.fn[sr] = function(fn){ return fn ? this.bind('resize', debounce(fn)) : this.trigger(sr); };
jQuery.fn[sr] = function(fn){ return fn ? this.on('resize', debounce(fn)) : this.trigger(sr); };

})(jQuery,'smartresize');
// ucFirst
Expand Down

0 comments on commit d3a2648

Please sign in to comment.