Skip to content

Commit

Permalink
Fix: Deprecated .bind()
Browse files Browse the repository at this point in the history
  • Loading branch information
Dernerd committed Dec 24, 2023
1 parent 8b1935f commit 0179c02
Show file tree
Hide file tree
Showing 18 changed files with 131 additions and 130 deletions.
2 changes: 1 addition & 1 deletion includes/admin/class-mp-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ function mp_open_pointer(id, target, content) {
},
show: function (event, pointer_target) {
pointer_target.pointer.css({'position': 'fixed'});
pointer_target.pointer.find('.close').bind('click.pointer', function (e) {
pointer_target.pointer.find('.close').on('click.pointer', function (e) {
e.preventDefault();
pointer_target.element.pointer('close');
});
Expand Down
2 changes: 1 addition & 1 deletion includes/admin/ui/js/admin-product.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ jQuery(document).ready(function($) {
if (variation_tags !== "") {
$(this).parent().find('.mp-variation-add-all').show();
var variation_tags_array = variation_tags.split(',');
$variation_tags_textarea.textext()[0].input().bind('getSuggestions', function(e, data) {
$variation_tags_textarea.textext()[0].input().on('getSuggestions', function(e, data) {
var textext = $(e.target).textext()[0],
query = (data ? data.query : '') || '',
existing_tags = textext.tags()._formData,
Expand Down
10 changes: 5 additions & 5 deletions includes/admin/ui/js/jquery-textext/src/js/textext.core.js
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@

function bind( event, handler )
{
target.bind( event, function()
target.on( event, function()
{
// apply handler to our PLUGIN object, not the target
return handler.apply( self, arguments );
Expand Down Expand Up @@ -861,7 +861,7 @@
/**
* Binds an event handler to the input box that user interacts with.
*
* @signature TextExt.bind(event, handler)
* @signature TextExt.on(event, handler)
*
* @param event {String} Event name.
* @param handler {Function} Event handler.
Expand All @@ -872,7 +872,7 @@
*/
p.bind = function( event, handler )
{
this.input().bind( event, handler );
this.input().on( event, handler );
};

/**
Expand Down Expand Up @@ -1452,7 +1452,7 @@
/**
* Shortcut to the core's `bind()` method. Binds specified handler to the event.
*
* @signature TextExtPlugin.bind(event, handler)
* @signature TextExtPlugin.on(event, handler)
*
* @param event {String} Event name.
* @param handler {Function} Event handler.
Expand All @@ -1463,7 +1463,7 @@
*/
p.bind = function( event, handler )
{
this.core().bind( event, handler );
this.core().on( event, handler );
};

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@

self._arrow = arrow = $(self.opts(OPT_HTML_ARROW));
self.core().wrapElement().append(arrow);
arrow.bind('click', function(e) { self.onArrowClick(e); });
arrow.on('click', function(e) { self.onArrowClick(e); });
};

//--------------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@

self._clear = clear = $(self.opts(OPT_HTML_CLEAR));
self.core().wrapElement().append(clear);
clear.bind('click', function(e) { self.onClearClick(e); });
clear.on('click', function(e) { self.onClearClick(e); });
};

//--------------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
* Tags plugin triggers the `isTagAllowed` event before adding each tag to the tag list. Other plugins have
* an opportunity to interrupt this by setting `result` of the second argument to `false`. For example:
*
* $('textarea').textext({...}).bind('isTagAllowed', function(e, data)
* $('textarea').textext({...}).on('isTagAllowed', function(e, data)
* {
* if(data.tag === 'foo')
* data.result = false;
Expand All @@ -132,7 +132,7 @@
* Tags plugin triggers the `tagClick` event when user clicks on one of the tags. This allows to process
* the click and potentially change the value of the tag (for example in case of user feedback).
*
* $('textarea').textext({...}).bind('tagClick', function(e, tag, value, callback)
* $('textarea').textext({...}).on('tagClick', function(e, tag, value, callback)
* {
* var newValue = window.prompt('New value', value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function print_scripts() {
that.val(hex);

}
}).bind('keyup', function(){
}).on('keyup', function(){
$(this).ColorPickerSetColor(this.value);
});
})
Expand Down
38 changes: 19 additions & 19 deletions includes/psource-metaboxes/ui/colorpicker/js/colorpicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@
val: parseInt(field.val(), 10),
preview: $(this).parent().parent().data('colorpicker').onPreview
};
$(document).bind('mouseup', current, upIncrement);
$(document).bind('mousemove', current, moveIncrement);
$(document).on('mouseup', current, upIncrement);
$(document).on('mousemove', current, moveIncrement);
},
moveIncrement = function (ev) {
ev.data.field.val(Math.max(0, Math.min(ev.data.max, parseInt(ev.data.val + ev.pageY - ev.data.y, 10))));
Expand All @@ -137,8 +137,8 @@
y: $(this).offset().top
};
current.preview = current.cal.data('colorpicker').onPreview;
$(document).bind('mouseup', current, upHue);
$(document).bind('mousemove', current, moveHue);
$(document).on('mouseup', current, upHue);
$(document).on('mousemove', current, moveHue);
},
moveHue = function (ev) {
change.apply(
Expand All @@ -164,8 +164,8 @@
pos: $(this).offset()
};
current.preview = current.cal.data('colorpicker').onPreview;
$(document).bind('mouseup', current, upSelector);
$(document).bind('mousemove', current, moveSelector);
$(document).on('mouseup', current, upSelector);
$(document).on('mousemove', current, moveSelector);
},
moveSelector = function (ev) {
change.apply(
Expand Down Expand Up @@ -218,7 +218,7 @@
if (cal.data('colorpicker').onShow.apply(this, [cal.get(0)]) != false) {
cal.show();
}
$(document).bind('mousedown', {cal: cal}, hide);
$(document).on('mousedown', {cal: cal}, hide);
return false;
},
hide = function (ev) {
Expand Down Expand Up @@ -397,25 +397,25 @@
}
options.fields = cal
.find('input')
.bind('keyup', keyDown)
.bind('change', change)
.bind('blur', blur)
.bind('focus', focus);
.on('keyup', keyDown)
.on('change', change)
.on('blur', blur)
.on('focus', focus);
cal
.find('span').bind('mousedown', downIncrement).end()
.find('>div.colorpicker_current_color').bind('click', restoreOriginal);
options.selector = cal.find('div.colorpicker_color').bind('mousedown', downSelector);
.find('span').on('mousedown', downIncrement).end()
.find('>div.colorpicker_current_color').on('click', restoreOriginal);
options.selector = cal.find('div.colorpicker_color').on('mousedown', downSelector);
options.selectorIndic = options.selector.find('div div');
options.el = this;
options.hue = cal.find('div.colorpicker_hue div');
cal.find('div.colorpicker_hue').bind('mousedown', downHue);
cal.find('div.colorpicker_hue').on('mousedown', downHue);
options.newColor = cal.find('div.colorpicker_new_color');
options.currentColor = cal.find('div.colorpicker_current_color');
cal.data('colorpicker', options);
cal.find('div.colorpicker_submit')
.bind('mouseenter', enterSubmit)
.bind('mouseleave', leaveSubmit)
.bind('click', clickSubmit);
.on('mouseenter', enterSubmit)
.on('mouseleave', leaveSubmit)
.on('click', clickSubmit);
fillRGBFields(options.color, cal.get(0));
fillHSBFields(options.color, cal.get(0));
fillHexFields(options.color, cal.get(0));
Expand All @@ -429,7 +429,7 @@
display: 'block'
});
} else {
$(this).bind(options.eventName, show);
$(this).on(options.eventName, show);
}
}
});
Expand Down
2 changes: 1 addition & 1 deletion includes/psource-metaboxes/ui/colorpicker/js/jquery.js
Original file line number Diff line number Diff line change
Expand Up @@ -7630,7 +7630,7 @@ function Animation( elem, properties, options ) {
if ( result ) {
if ( isFunction( result.stop ) ) {
jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
result.stop.bind( result );
result.stop.on( result );
}
return result;
}
Expand Down
6 changes: 3 additions & 3 deletions includes/psource-metaboxes/ui/colorpicker/js/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
var initLayout = function() {
var hash = window.location.hash.replace('#', '');
var currentTab = $('ul.navigationTabs a')
.bind('click', showTab)
.on('click', showTab)
.filter('a[rel=' + hash + ']');
if (currentTab.length == 0) {
currentTab = $('ul.navigationTabs a:first');
Expand All @@ -18,7 +18,7 @@
});
$('#colorpickerHolder2>div').css('position', 'absolute');
var widt = false;
$('#colorSelector2').bind('click', function() {
$('#colorSelector2').on('click', function() {
$('#colorpickerHolder2').stop().animate({height: widt ? 0 : 173}, 500);
widt = !widt;
});
Expand All @@ -31,7 +31,7 @@
$(this).ColorPickerSetColor(this.value);
}
})
.bind('keyup', function(){
.on('keyup', function(){
$(this).ColorPickerSetColor(this.value);
});
$('#colorSelector').ColorPicker({
Expand Down
Loading

0 comments on commit 0179c02

Please sign in to comment.