Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #3605 Replace deprecated jQuery methods #3606

Merged
merged 4 commits into from
Feb 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion assets/js/wpr-admin.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/js/wpr-admin.js.map

Large diffs are not rendered by default.

29 changes: 14 additions & 15 deletions assets/js/wpr-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,50 +62,49 @@ function ModalWpr(aElem) {
this.titleText = this.title.text();

// Open
this.opener.click(function() {
this.opener.on( 'click', function() {
refThis.open();
return false;
});

// Close
this.closer.click(function() {
this.closer.on( 'click', function() {
refThis.close();
return false;
});

aElem.bind('keyup', function(){
if(event.keyCode == 27){ // ECHAP
$(document).on('keyup', function(e){
if( aElem.length > 0 && 27 === e.keyCode ){ // ECHAP
refThis.close();
return false;
}
});

// Back
this.return.click(function() {
this.return.on( 'click', function() {
refThis.returnToQuestion();
return false;
});

// Click on radio
this.radio.change(function(){
this.radio.on( 'change', function() {
refThis.change($(this));
});

// Write text
this.textFields.keyup(function() {
this.textFields.on( "keyup", function() {
refThis.hiddenDetails.val($(this).val());
if(refThis.hiddenDetails.val() != ''){
if( '' !== refThis.hiddenDetails.val() ){
refThis.button.removeClass('wpr-isDisabled');
refThis.button.removeAttr("disabled");
refThis.button.prop("disabled", false);
}
else{
refThis.button.addClass('wpr-isDisabled');
refThis.button.attr("disabled", true);
refThis.button.prop("disabled", true);
}
});
}


/*
* Change modal state
*/
Expand All @@ -122,7 +121,7 @@ ModalWpr.prototype.change = function(aElem) {
$('.wpr-Modal-fieldHidden').removeClass('wpr-isOpen');
$('.wpr-Modal-hidden').removeClass('wpr-isOpen');
this.button.removeClass('wpr-isDisabled');
this.button.removeAttr("disabled");
this.button.prop("disabled", false);

switch(id){
case 'reason-temporary':
Expand All @@ -148,7 +147,7 @@ ModalWpr.prototype.change = function(aElem) {
field.addClass('wpr-isOpen');
field.find('input, textarea').focus();
refThis.button.addClass('wpr-isDisabled');
refThis.button.attr("disabled", true);
refThis.button.prop("disabled", true);
break;
}
};
Expand All @@ -170,9 +169,9 @@ ModalWpr.prototype.returnToQuestion = function() {
this.hiddenReason.val('');
this.hiddenDetails.val('');

this.radio.attr('checked', false);
this.radio.prop('checked', false);
this.button.addClass('wpr-isDisabled');
this.button.attr("disabled", true);
this.button.prop("disabled", true);

};

Expand Down
2 changes: 1 addition & 1 deletion src/js/global/ajax.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ $(document).ready(function(){

e.preventDefault();
_isRefreshing = true;
button.blur();
button.trigger( 'blur' );
button.addClass('wpr-isLoading');
expire.removeClass('wpr-isValid wpr-isInvalid');

Expand Down
6 changes: 3 additions & 3 deletions src/js/global/fields.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ $(document).ready(function(){
}

// Display/Hide childern fields on checkbox change.
$( '.wpr-isParent input[type=checkbox]' ).change( function() {
$( '.wpr-isParent input[type=checkbox]' ).on('change', function() {
wprShowChildren($(this));
});

Expand Down Expand Up @@ -109,7 +109,7 @@ $(document).ready(function(){
wprShowChildren($(this));
});

$warningParent.change(function() {
$warningParent.on('change', function() {
wprShowWarning($(this));
});

Expand All @@ -132,7 +132,7 @@ $(document).ready(function(){
var $warningButton = $warningField.find('.wpr-button');

// Validate the warning
$warningButton.click(function(){
$warningButton.on('click', function(){
$thisCheckbox.prop('checked', true);
$warningField.removeClass('wpr-isOpen');
$children.addClass('wpr-isOpen');
Expand Down
18 changes: 9 additions & 9 deletions src/js/global/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ $(document).ready(function(){
var $notice = $('.wpr-notice');
var $noticeClose = $('.wpr-notice-close');

$noticeClose.click(function() {
$noticeClose.on('click', function() {
wprCloseDashboardNotice();
return false;
});
Expand Down Expand Up @@ -41,7 +41,7 @@ $(document).ready(function(){
var $checkbox = $button.closest( '.wpr-fieldsContainer-fieldset' ).find( '.wpr-radio :checkbox' );
var $menuItem = $( '[href="' + $button.attr( 'href' ) + '"].wpr-menuItem' );

$checkbox.change( function() {
$checkbox.on('change', function() {
if ( $checkbox.is( ':checked' ) ) {
$menuItem.css( 'display', 'block' );
$button.css( 'display', 'inline-block' );
Expand All @@ -67,19 +67,19 @@ $(document).ready(function(){
$wprAnalyticsOpenPopin = $('.wpr-js-popin')
;

$wprAnalyticsOpenPopin.click(function(e) {
$wprAnalyticsOpenPopin.on('click', function(e) {
e.preventDefault();
wprOpenAnalytics();
return false;
});

$wprAnalyticsClosePopin.click(function(e) {
$wprAnalyticsClosePopin.on('click', function(e) {
e.preventDefault();
wprCloseAnalytics();
return false;
});

$wprAnalyticsPopinButton.click(function(e) {
$wprAnalyticsPopinButton.on('click', function(e) {
e.preventDefault();
wprActivateAnalytics();
return false;
Expand Down Expand Up @@ -117,13 +117,13 @@ $(document).ready(function(){
$wprUpgradeClosePopin = $('.wpr-Popin-Upgrade-close'),
$wprUpgradeOpenPopin = $('.wpr-popin-upgrade-toggle');

$wprUpgradeOpenPopin.click(function(e) {
$wprUpgradeOpenPopin.on('click', function(e) {
e.preventDefault();
wprOpenUpgradePopin();
return false;
});

$wprUpgradeClosePopin.click(function() {
$wprUpgradeClosePopin.on('click', function() {
wprCloseUpgradePopin();
return false;
});
Expand Down Expand Up @@ -154,7 +154,7 @@ $(document).ready(function(){
var $wprSidebar = $( '.wpr-Sidebar' );
var $wprButtonTips = $('.wpr-js-tips');

$wprButtonTips.change(function() {
$wprButtonTips.on('change', function() {
wprDetectTips($(this));
});

Expand Down Expand Up @@ -184,7 +184,7 @@ $(document).ready(function(){
var $adblock = $('.wpr-adblock');
var $adblockClose = $('.wpr-adblock-close');

$adblockClose.click(function() {
$adblockClose.on('click', function() {
wprCloseAdblockNotice();
return false;
});
Expand Down
6 changes: 0 additions & 6 deletions src/js/lib/jquery.min.js

This file was deleted.