[buddypress-trac] [BuddyPress] #4500: Ajax loading doesn't refresh JS onload

buddypress-trac at lists.automattic.com buddypress-trac at lists.automattic.com
Fri Aug 31 20:39:03 UTC 2012


#4500: Ajax loading doesn't refresh JS onload
--------------------------+-----------------------------
 Reporter:  sgr33n        |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Theme         |    Version:
 Severity:  normal        |   Keywords:
--------------------------+-----------------------------
 Hi,

 It's a bit difficoult to explain this without an example.
 So... when BP loads activity streams, do some initialization operations,
 such hide long lists of activity comments, only show the latest five root
 comments... maybe the theme coder want to add other stuff... anyway...
 when you do things like ajax loading of more elements (at the bottom of
 the page) or change tab (favorites i.e.) the initialization doesn't
 happen, so you will see in example all comments of an event (maybe also
 1000 or more) and things like that. This maybe happen also if the coder
 would add other jquery stuff like tipsy or scrollpane, autoresize etc.
 etc.

 Maybe would be useful to add a function bp_reinit() where you can put all
 that functions you need to launch at startup.

 In my case i found 2 events where to add it:

 after:


 {{{
                 /* Update the feed link */
                 if ( null != response.feed_url )
                         jq('.directory #subnav li.feed a, .home-page
 #subnav li.feed a').attr('href', response.feed_url);

                 jq('.item-list-tabs li.selected').removeClass('loading');
                 '''sgrbp_reinit(500);'''
 }}}

 after:

 {{{
                                 jq("#content li.load-
 more").removeClass('loading');
                                 jq.cookie( 'bp-activity-oldestpage',
 oldest_page, {
                                         path: '/'
                                 } );
                                 jq("#content ul.activity-
 list").append(response.contents);

                                 target.parent().hide();
                                 '''sgrbp_reinit();'''
 }}}

 And this is the function:

 {{{

 function sgrbp_init() {
         bp_dtheme_hide_comments()
 }
 function sgrbp_reinit(timeout) {
         setTimeout(function(){sgrbp_init()},timeout);
 }
 }}}

 Bye :)

-- 
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/4500>
BuddyPress <http://buddypress.org/>
BuddyPress


More information about the buddypress-trac mailing list