Skip to:
Content

BuddyPress.org

Changeset 10446


Ignore:
Timestamp:
01/12/2016 04:04:52 PM (9 years ago)
Author:
boonebgorges
Message:

Undeprecate Messages autocomplete scripts and styles.

These assets were deprecated in [8559], with the intention of rewriting the
functionality using BP_Suggestions. Until that rewrite happens, let's bring
them back from the dead.

Fixes #6740.

Location:
trunk/src
Files:
2 added
2 deleted
3 edited
2 copied

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/deprecated/2.1.php

    r10108 r10446  
    1717 */
    1818function bp_core_register_deprecated_scripts() {
    19     $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
    20     $url = buddypress()->plugin_url . 'bp-core/deprecated/js/';
    21 
    22     $scripts = apply_filters( 'bp_core_register_deprecated_scripts', array(
    23 
    24         // Messages
    25         'bp-jquery-autocomplete'    => array(
    26             'file'          => "{$url}autocomplete/jquery.autocomplete{$min}.js",
    27             'dependencies' => array( 'jquery' ),
    28         ),
    29 
    30         'bp-jquery-autocomplete-fb' => array(
    31             'file'         => "{$url}autocomplete/jquery.autocompletefb{$min}.js",
    32             'dependencies' => array( 'jquery' ),
    33         ),
    34 
    35         'bp-jquery-bgiframe' => array(
    36             'file'         => "{$url}autocomplete/jquery.bgiframe{$min}.js",
    37             'dependencies' => array( 'jquery' ),
    38         ),
    39 
    40         'bp-jquery-dimensions' => array(
    41             'file'         => "{$url}autocomplete/jquery.dimensions{$min}.js",
    42             'dependencies' => array( 'jquery' ),
    43         ),
    44     ) );
    45 
    46     foreach ( $scripts as $id => $script ) {
    47         wp_register_script( $id, $script['file'], $script['dependencies'], bp_get_version(), true );
    48     }
    49 }
    50 add_action( 'bp_enqueue_scripts', 'bp_core_register_deprecated_scripts', 1 );
     19    // Scripts undeprecated as of 2.5.0.
     20}
    5121
    5222/**
     
    5626 */
    5727function bp_core_register_deprecated_styles() {
    58     $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
    59     $url = buddypress()->plugin_url . 'bp-core/deprecated/css/';
    60 
    61     $styles = apply_filters( 'bp_core_register_deprecated_styles', array(
    62         // Messages
    63         'bp-messages-autocomplete' => array(
    64             'file'         => "{$url}autocomplete/jquery.autocompletefb{$min}.css",
    65             'dependencies' => array(),
    66         )
    67     ) );
    68 
    69     foreach ( $styles as $id => $style ) {
    70         wp_register_style( $id, $style['file'], $style['dependencies'], bp_get_version() );
    71 
    72         wp_style_add_data( $id, 'rtl', true );
    73         if ( $min ) {
    74             wp_style_add_data( $id, 'suffix', $min );
    75         }
    76     }
    77 }
    78 add_action( 'bp_enqueue_scripts', 'bp_core_register_deprecated_styles', 1 );
     28    // Scripts undeprecated as of 2.5.0.
     29}
    7930
    8031/** BuddyBar *****************************************************************/
  • trunk/src/bp-messages/bp-messages-cssjs.php

    r10417 r10446  
    2020        add_action( 'wp_head', 'messages_autocomplete_init_jsblock' );
    2121
    22         wp_enqueue_script( 'bp-jquery-autocomplete' );
    23         wp_enqueue_script( 'bp-jquery-autocomplete-fb' );
    24         wp_enqueue_script( 'bp-jquery-bgiframe' );
    25         wp_enqueue_script( 'bp-jquery-dimensions' );
     22        $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
     23        $url = buddypress()->plugin_url . 'bp-messages/js/';
     24
     25        wp_enqueue_script( 'bp-jquery-autocomplete', "{$url}autocomplete/jquery.autocomplete{$min}.js", array( 'jquery' ), bp_get_version() );
     26        wp_enqueue_script( 'bp-jquery-autocomplete-fb', "{$url}autocomplete/jquery.autocompletefb{$min}.js", array( 'jquery' ), bp_get_version() );
     27        wp_enqueue_script( 'bp-jquery-bgiframe', "{$url}autocomplete/jquery.bgiframe{$min}.js", array( 'jquery' ), bp_get_version() );
     28        wp_enqueue_script( 'bp-jquery-dimensions', "{$url}autocomplete/jquery.dimensions{$min}.js", array( 'jquery' ), bp_get_version() );
    2629    }
    2730}
     
    3538function messages_add_autocomplete_css() {
    3639    if ( bp_is_messages_component() && bp_is_current_action( 'compose' ) ) {
    37         wp_enqueue_style( 'bp-messages-autocomplete' );
     40        $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
     41        $url = buddypress()->plugin_url . 'bp-messages/css/';
     42
     43        wp_register_style( 'bp-messages-autocomplete', "{$url}autocomplete/jquery.autocompletfb{$min}.css", array(), bp_get_version() );
     44
     45        wp_style_add_data( 'bp-messages-autocomplete', 'rtl', true );
     46        if ( $min ) {
     47            wp_style_add_data( 'bp-messages-autocomplete', 'suffix', $min );
     48        }
     49
    3850        wp_print_styles();
    3951    }
  • trunk/src/bp-messages/js/autocomplete/jquery.autocompletefb.js

    r9819 r10446  
    1414 *   http://www.gnu.org/licenses/gpl.html
    1515 */
    16 
    1716jQuery.fn.autoCompletefb = function(options)
    1817{
     
    5352        var d = String(d).split(' (');
    5453        var un = d[1].substr(0, d[1].length-1);
    55        
     54
    5655        /* Don't add the same user multiple times */
    57         if( 0 === jQuery(settings.inputClass).siblings('#un-' + un).length ) {     
     56        if( 0 === jQuery(settings.inputClass).siblings('#un-' + un).length ) {
    5857            var ln = '#link-' + un;
    5958            var l = jQuery(ln).attr('href');
    6059            var v = '<li class="'+f+'" id="un-'+un+'"><span><a href="'+l+'">'+d[0]+'</a></span> <span class="p">X</span></li>';
    61            
     60
    6261            var x = jQuery(settings.inputClass,tmp).before(v);
    6362            jQuery('#send-to-usernames').addClass(un);
    64                
     63
    6564            jQuery('.p',x[0].previousSibling).click(function(){
    6665                acfb.removeFind(this);
    6766            });
    68         } 
    69            
     67        }
     68
    7069        jQuery(settings.inputClass,tmp).val('');
    7170
Note: See TracChangeset for help on using the changeset viewer.