Skip to:
Content

BuddyPress.org

Ticket #5206: 5206.01.patch

File 5206.01.patch, 5.2 KB (added by r-a-y, 13 years ago)
  • bp-templates/bp-legacy/js/buddypress.js

    jq(document).ready( function() {  
    732732        /* All pagination links run through this function */
    733733        jq('#buddypress').on( 'click', function(event) {
    734734                var target = jq(event.target);
     735                var caller = null;
    735736
    736737                if ( target.hasClass('button') )
    737738                        return true;
    jq(document).ready( function() {  
    749750                        var css_id = el.attr('id').split( '-' );
    750751                        var object = css_id[0];
    751752                        var search_terms = false;
     753                        var pagination_id = jq(target).closest('.pagination-links').attr('id');
    752754
    753755                        if ( jq('div.dir-search input').length )
    754756                                search_terms = jq('.dir-search input').val();
    jq(document).ready( function() {  
    759761                                var page_number = Number( jq('.pagination span.current').html() ) - 1;
    760762                        else
    761763                                var page_number = Number( jq(target).html() );
     764                       
     765                        if ( pagination_id.indexOf( 'pag-bottom' ) !== -1 ) {
     766                                var caller = 'pag-bottom';
     767                        }
    762768
    763                         bp_filter_request( object, jq.cookie('bp-' + object + '-filter'), jq.cookie('bp-' + object + '-scope'), 'div.' + object, search_terms, page_number, jq.cookie('bp-' + object + '-extras') );
     769                        bp_filter_request( object, jq.cookie('bp-' + object + '-filter'), jq.cookie('bp-' + object + '-scope'), 'div.' + object, search_terms, page_number, jq.cookie('bp-' + object + '-extras'), caller );
    764770
    765771                        return false;
    766772                }
    function bp_init_objects(objects) {  
    13631369}
    13641370
    13651371/* Filter the current content list (groups/members/blogs/topics) */
    1366 function bp_filter_request( object, filter, scope, target, search_terms, page, extras ) {
     1372function bp_filter_request( object, filter, scope, target, search_terms, page, extras, caller ) {
    13671373        if ( 'activity' == object )
    13681374                return false;
    13691375
    function bp_filter_request( object, filter, scope, target, search_terms, page, e  
    14101416        },
    14111417        function(response)
    14121418        {
    1413                 jq(target).fadeOut( 100, function() {
    1414                         jq(this).html(response);
    1415                         jq(this).fadeIn(100);
    1416                 });
     1419                /* animate to top if called from bottom pagination */
     1420                if ( caller == 'pag-bottom' ) {
     1421                        var top = jq('#subnav').parent();
     1422                        jq('html,body').animate({scrollTop: top.offset().top}, 'slow', function() {
     1423                                jq(target).fadeOut( 100, function() {
     1424                                        jq(this).html(response);
     1425                                        jq(this).fadeIn(100);
     1426                                });
     1427                        });     
     1428
     1429                } else {
     1430                        jq(target).fadeOut( 100, function() {
     1431                                jq(this).html(response);
     1432                                jq(this).fadeIn(100);
     1433                        });
     1434                }
     1435
    14171436                jq('.item-list-tabs li.selected').removeClass('loading');
    14181437        });
    14191438}
  • bp-themes/bp-default/_inc/global.js

    jq(document).ready( function() {  
    718718        /* All pagination links run through this function */
    719719        jq('div#content').click( function(event) {
    720720                var target = jq(event.target);
     721                var caller = null;
    721722
    722723                if ( target.hasClass('button') )
    723724                        return true;
    jq(document).ready( function() {  
    735736                        var css_id = el.attr('id').split( '-' );
    736737                        var object = css_id[0];
    737738                        var search_terms = false;
     739                        var pagination_id = jq(target).closest('.pagination-links').attr('id');
    738740
    739741                        if ( jq('div.dir-search input').length )
    740742                                search_terms = jq('.dir-search input').val();
    jq(document).ready( function() {  
    745747                                var page_number = Number( jq('.pagination span.current').html() ) - 1;
    746748                        else
    747749                                var page_number = Number( jq(target).html() );
     750                       
     751                        if ( pagination_id.indexOf( 'pag-bottom' ) !== -1 ) {
     752                                var caller = 'pag-bottom';
     753                        }
    748754
    749                         bp_filter_request( object, jq.cookie('bp-' + object + '-filter'), jq.cookie('bp-' + object + '-scope'), 'div.' + object, search_terms, page_number, jq.cookie('bp-' + object + '-extras') );
     755                        bp_filter_request( object, jq.cookie('bp-' + object + '-filter'), jq.cookie('bp-' + object + '-scope'), 'div.' + object, search_terms, page_number, jq.cookie('bp-' + object + '-extras'), caller );
    750756
    751757                        return false;
    752758                }
    function bp_init_objects(objects) {  
    13421348}
    13431349
    13441350/* Filter the current content list (groups/members/blogs/topics) */
    1345 function bp_filter_request( object, filter, scope, target, search_terms, page, extras ) {
     1351function bp_filter_request( object, filter, scope, target, search_terms, page, extras, caller ) {
    13461352        if ( 'activity' == object )
    13471353                return false;
    13481354
    function bp_filter_request( object, filter, scope, target, search_terms, page, e  
    13891395        },
    13901396        function(response)
    13911397        {
    1392                 jq(target).fadeOut( 100, function() {
    1393                         jq(this).html(response);
    1394                         jq(this).fadeIn(100);
    1395                 });
     1398                /* animate to top if called from bottom pagination */
     1399                if ( caller == 'pag-bottom' ) {
     1400                        var top = jq('#subnav').parent();
     1401                        jq('html,body').animate({scrollTop: top.offset().top}, 'slow', function() {
     1402                                jq(target).fadeOut( 100, function() {
     1403                                        jq(this).html(response);
     1404                                        jq(this).fadeIn(100);
     1405                                });
     1406                        });     
     1407
     1408                } else {
     1409                        jq(target).fadeOut( 100, function() {
     1410                                jq(this).html(response);
     1411                                jq(this).fadeIn(100);
     1412                        });
     1413                }
     1414
    13961415                jq('.item-list-tabs li.selected').removeClass('loading');
    13971416        });
    13981417}