Skip to:
Content

BuddyPress.org

Changeset 12833


Ignore:
Timestamp:
01/11/2021 04:32:53 PM (4 years ago)
Author:
boonebgorges
Message:

Remove calls to deprecated jQuery methods.

Props imath.
Fixes #8422.

Location:
trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-activity/js/mentions.js

    r12711 r12833  
    2121     */
    2222    $.fn.bp_mentions = function( options ) {
    23         if ( $.isArray( options ) ) {
     23        if ( Array.isArray( options ) ) {
    2424            options = { data: options };
    2525        }
  • trunk/src/bp-templates/bp-legacy/js/buddypress.js

    r12805 r12833  
    5050
    5151    /* Textarea focus */
    52     $whats_new.focus( function(){
     52    $whats_new.on( 'focus', function() {
    5353        jq( '#whats-new-options' ).slideDown();
    5454
     
    8181            }
    8282        }
    83     });
     83    } );
    8484
    8585    /* For the "What's New" form, do the following on focusout. */
     
    125125                } else {
    126126                    // Checkboxes/dropdown list can have multiple selected value
    127                     if ( ! jq.isArray( inputs[ input.name ] ) ) {
     127                    if ( ! Array.isArray( inputs[ input.name ] ) ) {
    128128                        inputs[ input.name ] = new Array( inputs[ input.name ], input.value );
    129129                    } else {
     
    276276
    277277    /* Activity filter select */
    278     jq('#activity-filter-select select').change( function() {
     278    jq( '#activity-filter-select select' ).on( 'change', function() {
    279279        var selected_tab = jq( 'div.activity-type-tabs li.selected' ),
    280280            filter = jq(this).val(),
     
    290290
    291291        return false;
    292     });
     292    } );
    293293
    294294    /* Stream event delegation */
     
    801801
    802802    /* Escape Key Press for cancelling comment forms */
    803     jq(document).keydown( function(e) {
     803    jq(document).on( 'keydown', function(e) {
    804804        e = e || window.event;
    805805        if (e.target) {
     
    899899
    900900    /* When the filter select box is changed re-query */
    901     jq('li.filter select').change( function() {
     901    jq( 'li.filter select' ).on( 'change', function() {
    902902        var el,
    903903            css_id, object, scope, filter, search_terms, template,
     
    945945
    946946        return false;
    947     });
     947    } );
    948948
    949949    /* All pagination links run through this function */
     
    11651165    } );
    11661166
    1167     jq('#profile-edit-form input:not(:submit), #profile-edit-form textarea, #profile-edit-form select, #signup_form input:not(:submit), #signup_form textarea, #signup_form select').change( function() {
     1167    jq( '#profile-edit-form input:not(:submit), #profile-edit-form textarea, #profile-edit-form select, #signup_form input:not(:submit), #signup_form textarea, #signup_form select' ).on( 'change', function() {
    11681168        var shouldconfirm = true;
    11691169
     
    11771177            }
    11781178        };
    1179     });
     1179    } );
    11801180
    11811181    /** Friendship Requests **************************************/
     
    14201420
    14211421    /* AJAX send reply functionality */
    1422     jq('#send_reply_button').click(
     1422    jq( '#send_reply_button' ).on( 'click',
    14231423        function() {
    14241424            var order = jq('#messages_order').val() || 'ASC',
     
    14921492
    14931493    /* Selecting/Deselecting all messages */
    1494     jq('#select-all-messages').click(function(event) {
    1495         if( this.checked ) {
    1496             jq('.message-check').each(function() {
     1494    jq( '#select-all-messages' ).on( 'click', function() {
     1495        if ( this.checked ) {
     1496            jq( '.message-check' ).each( function() {
    14971497                this.checked = true;
    1498             });
     1498            } );
    14991499        } else {
    1500             jq('.message-check').each(function() {
     1500            jq( '.message-check' ).each( function() {
    15011501                this.checked = false;
    1502             });
    1503         }
    1504     });
     1502            } );
     1503        }
     1504    } );
    15051505
    15061506    /* Make sure a 'Bulk Action' is selected before submitting the messages bulk action form */
     
    15911591
    15921592    /* Selecting/Deselecting all notifications */
    1593     jq('#select-all-notifications').click(function(event) {
    1594         if( this.checked ) {
    1595             jq('.notification-check').each(function() {
     1593    jq( '#select-all-notifications' ).on( 'click', function() {
     1594        if ( this.checked ) {
     1595            jq( '.notification-check' ).each( function() {
    15961596                this.checked = true;
    1597             });
     1597            } );
    15981598        } else {
    1599             jq('.notification-check').each(function() {
     1599            jq( '.notification-check' ).each( function() {
    16001600                this.checked = false;
    1601             });
    1602         }
    1603     });
     1601            } );
     1602        }
     1603    } );
    16041604
    16051605    /* Make sure a 'Bulk Action' is selected before submitting the form */
     
    16351635
    16361636    /* Toolbar & wp_list_pages JavaScript IE6 hover class */
    1637     jq('#wp-admin-bar ul.main-nav li, #nav li').mouseover( function() {
     1637    jq('#wp-admin-bar ul.main-nav li, #nav li').on( 'mouseover', function() {
    16381638        jq(this).addClass('sfhover');
    16391639    });
    16401640
    1641     jq('#wp-admin-bar ul.main-nav li, #nav li').mouseout( function() {
     1641    jq('#wp-admin-bar ul.main-nav li, #nav li').on( 'mouseout', function() {
    16421642        jq(this).removeClass('sfhover');
    16431643    });
  • trunk/src/bp-xprofile/admin/js/admin.js

    r12829 r12833  
    172172    }
    173173
    174     titleprompt.click(function(){
     174    titleprompt.on( 'click', function(){
    175175        jQuery(this).addClass('screen-reader-text');
    176176        title.focus();
    177177    });
    178178
    179     title.blur(function(){
     179    title.on( 'blur', function(){
    180180        if ( '' === this.value ) {
    181181            titleprompt.removeClass('screen-reader-text');
    182182        }
    183     }).focus(function(){
     183    }).on( 'focus', function(){
    184184        titleprompt.addClass('screen-reader-text');
    185     }).keydown(function(e){
     185    }).on( 'keydown', function(e){
    186186        titleprompt.addClass('screen-reader-text');
    187187        jQuery(this).unbind(e);
     
    192192
    193193    // Set focus in Field Title, if we're on the right page.
    194     jQuery( '#bp-xprofile-add-field #title' ).focus();
     194    jQuery( '#bp-xprofile-add-field #title' ).trigger( 'focus' );
    195195
    196196    // Set up the notice that shows when no member types are selected for a field.
     
    215215
    216216    // Set up the sort order change actions.
    217     jQuery( '[id^="sort_order_"]' ).change(function() {
     217    jQuery( '[id^="sort_order_"]' ).on( 'change', function() {
    218218        if ( jQuery( this ).val() !== 'custom' ) {
    219219            destroySortableFieldOptions();
     
    221221            enableSortableFieldOptions( jQuery('#fieldtype :selected').val() );
    222222        }
    223     });
     223    } );
    224224
    225225    // Show object if JS is enabled.
     
    277277    var $date_format_custom_value = jQuery( '#date-format-custom-value' );
    278278    var $date_format_sample = jQuery( '#date-format-custom-sample' );
    279     $date_format.click( function( e ) {
     279    $date_format.on( 'click', function( e ) {
    280280        switch ( e.target.value ) {
    281281            case 'elapsed' :
     
    296296    // Clicking into the custom date format field should select the Custom radio button.
    297297    var $date_format_custom = jQuery( '#date-format-custom' );
    298     $date_format_custom_value.focus( function() {
     298    $date_format_custom_value.on( 'focus', function() {
    299299        $date_format_custom.prop( 'checked', 'checked' );
    300300    } );
     
    302302    // Validate custom date field.
    303303    var $date_format_spinner = jQuery( '#date-format-custom-spinner' );
    304     $date_format_custom_value.change( function( e ) {
     304    $date_format_custom_value.on( 'change', function( e ) {
    305305        $date_format_spinner.addClass( 'is-active' );
    306306        jQuery.post( ajaxurl, {
Note: See TracChangeset for help on using the changeset viewer.