PageSourceSearch

https://www.joserodriguez.info/wp-content/themes/custom-community/_inc/global.js?ver=4.2.39

js joserodriguez.info collected 2026-10-02 06:13:40 UTC 71,833 bytes, 1,971 lines download raw bytes

1// AJAX Functions
2var jq = jQuery;
3
4// Global variable to prevent multiple AJAX requests
5var bp_ajax_request = null;
6
7jq(document).ready( function() {
8    /**** Page Load Actions *******************************************************/
9
10    /* Hide Forums Post Form */
11    if ( '-1' == window.location.search.indexOf('new') && jq('div.forums').length )
12        jq('#new-topic-post').hide();
13    else
14        jq('#new-topic-post').show();
15
16    /* Activity filter and scope set */
17    bp_init_activity();
18
19    /* Object filter and scope set. */
20    var objects = [ 'members', 'groups', 'blogs', 'forums' ];
21    bp_init_objects( objects );
22
23    /* @mention Compose Scrolling */
24    if ( jq.query.get('r') && jq('textarea#whats-new').length ) {
25        jq('#whats-new-options').animate({
26            height:'40px'
27        });
28        jq("form#whats-new-form textarea").animate({
29            height:'50px'
30        });
31        jq.scrollTo( jq('textarea#whats-new'), 500, {
32            offset:-125, 
33            easing:'easeOutQuad'
34        } );
35        jq('textarea#whats-new').focus();
36    }
37
38    /**** Activity Posting ********************************************************/
39
40    /* Textarea focus */
41    jq('#whats-new').focus( function(){
42        jq("#whats-new-options").animate({
43            height:'40px'
44        });
45        jq("form#whats-new-form textarea").animate({
46            height:'50px'
47        });
48        jq("#aw-whats-new-submit").prop("disabled", false);
49    });
50
51    /* New posts */
52    jq("input#aw-whats-new-submit").click( function() {
53        var button = jq(this);
54        var form = button.parent().parent().parent().parent();
55
56        form.children().each( function() {
57            if ( jq.nodeName(this, "textarea") || jq.nodeName(this, "input") )
58                jq(this).prop( 'disabled', true );
59        });
60
61        /* Remove any errors */
62        jq('div.error').remove();
63        button.addClass('loading');
64        button.prop('disabled', true);
65
66        /* Default POST values */
67        var object = '';
68        var item_id = jq("#whats-new-post-in").val();
69        var content = jq("textarea#whats-new").val();
70
71        /* Set object for non-profile posts */
72        if ( item_id > 0 ) {
73            object = jq("#whats-new-post-object").val();
74        }
75
76        jq.post( ajaxurl, {
77            action: 'post_update',
78            'cookie': encodeURIComponent(document.cookie),
79            '_wpnonce_post_update': jq("input#_wpnonce_post_update").val(),
80            'content': content,
81            'object': object,
82            'item_id': item_id,
83            '_bp_as_nonce': jq('#_bp_as_nonce').val() || ''
84        },
85        function(response) {
86
87            form.children().each( function() {
88                if ( jq.nodeName(this, "textarea") || jq.nodeName(this, "input") ) {
89                    jq(this).prop( 'disabled', false );
90                }
91            });
92
93            /* Check for errors and append if found. */
94            if ( response[0] + response[1] == '-1' ) {
95                form.prepend( response.substr( 2, response.length ) );
96                jq( 'form#' + form.attr('id') + ' div.error').hide().fadeIn( 200 );
97            } else {
98                if ( 0 == jq("ul.activity-list").length ) {
99                    jq("div.error").slideUp(100).remove();
100                    jq("div#message").slideUp(100).remove();
101                    jq("div.activity").append( '<ul id="activity-stream" class="activity-list item-list">' );
102                }
103
104                jq("ul#activity-stream").prepend(response);
105                jq("ul#activity-stream li:first").addClass('new-update');
106
107                if ( 0 != jq("#latest-update").length ) {
108                    var l = jq("ul#activity-stream li.new-update .activity-content .activity-inner p").html();
109                    var v = jq("ul#activity-stream li.new-update .activity-content .activity-header p a.view").attr('href');
110
111                    var ltext = jq("ul#activity-stream li.new-update .activity-content .activity-inner p").text();
112
113                    var u = '';
114                    if ( ltext != '' )
115                        u = l + ' ';
116
117                    u += '<a href="' + v + '" rel="nofollow">' + BP_DTheme.view + '</a>';
118
119                    jq("#latest-update").slideUp(300,function(){
120                        jq("#latest-update").html( u );
121                        jq("#latest-update").slideDown(300);
122                    });
123                }
124
125                jq("li.new-update").hide().slideDown( 300 );
126                jq("li.new-update").removeClass( 'new-update' );
127                jq("textarea#whats-new").val('');
128            }
129
130            jq("#whats-new-options").animate({
131                height:'0px'
132            });
133            jq("form#whats-new-form textarea").animate({
134                height:'20px'
135            });
136            jq("#aw-whats-new-submit").prop("disabled", true).removeClass('loading');
137        });
138
139        return false;
140    });
141
142    /* List tabs event delegation */
143    jq('div.activity-type-tabs').click( function(event) {
144        var target = jq(event.target).parent();
145
146        if ( event.target.nodeName == 'STRONG' || event.target.nodeName == 'SPAN' )
147            target = target.parent();
148        else if ( event.target.nodeName != 'A' )
149            return false;
150
151        /* Reset the page */
152        jq.cookie( 'bp-activity-oldestpage', 1, {
153            path: '/'
154        } );
155
156        /* Activity Stream Tabs */
157        var scope = target.attr('id').substr( 9, target.attr('id').length );
158        var filter = jq("#activity-filter-select select").val();
159
160        if ( scope == 'mentions' )
161            jq( 'li#' + target.attr('id') + ' a strong' ).remove();
162
163        bp_activity_request(scope, filter);
164
165        return false;
166    });
167
168    /* Activity filter select */
169    jq('#activity-filter-select select').change( function() {
170        var selected_tab = jq( 'div.activity-type-tabs li.selected' );
171
172        if ( !selected_tab.length )
173            var scope = null;
174        else
175            var scope = selected_tab.attr('id').substr( 9, selected_tab.attr('id').length );
176
177        var filter = jq(this).val();
178
179        bp_activity_request(scope, filter);
180        return false;
181    });
182
183    /* Stream event delegation */
184    jq('div.activity').click( function(event) {
185        var target = jq(event.target);
186
187        /* Favoriting activity stream items */
188        if ( target.hasClass('fav') || target.hasClass('unfav') ) {
189            var type = target.hasClass('fav') ? 'fav' : 'unfav';
190            var parent = target.closest('.activity-item');
191            var parent_id = parent.attr('id').substr( 9, parent.attr('id').length );
192
193            target.addClass('loading');
194
195            jq.post( ajaxurl, {
196                action: 'activity_mark_' + type,
197                'cookie': encodeURIComponent(document.cookie),
198                'id': parent_id
199            },
200            function(response) {
201                target.removeClass('loading');
202
203                target.fadeOut( 100, function() {
204                    jq(this).html(response);
205                    jq(this).attr('title', 'fav' == type ? BP_DTheme.remove_fav : BP_DTheme.mark_as_fav);
206                    jq(this).fadeIn(100);
207                });
208
209                if ( 'fav' == type ) {
210                    if ( !jq('.item-list-tabs li#activity-favorites').length )
211                        jq('.item-list-tabs ul li#activity-mentions').before( '<li id="activity-favorites"><a href="#">' + BP_DTheme.my_favs + ' <span>0</span></a></li>');
212
213                    target.removeClass('fav');
214                    target.addClass('unfav');
215
216                    jq('.item-list-tabs ul li#activity-favorites span').html( Number( jq('.item-list-tabs ul li#activity-favorites span').html() ) + 1 );
217                } else {
218                    target.removeClass('unfav');
219                    target.addClass('fav');
220
221                    jq('.item-list-tabs ul li#activity-favorites span').html( Number( jq('.item-list-tabs ul li#activity-favorites span').html() ) - 1 );
222
223                    if ( !Number( jq('.item-list-tabs ul li#activity-favorites span').html() ) ) {
224                        if ( jq('.item-list-tabs ul li#activity-favorites').hasClass('selected') )
225                            bp_activity_request( null, null );
226
227                        jq('.item-list-tabs ul li#activity-favorites').remove();
228                    }
229                }
230
231                if ( 'activity-favorites' == jq( '.item-list-tabs li.selected').attr('id') )
232                    target.parent().parent().parent().slideUp(100);
233            });
234
235            return false;
236        }
237
238        /* Delete activity stream items */
239        if ( target.hasClass('delete-activity') ) {
240            var li        = target.parents('div.activity ul li');
241            var id        = li.attr('id').substr( 9, li.attr('id').length );
242            var link_href = target.attr('href');
243            var nonce     = link_href.split('_wpnonce=');
244
245            nonce = nonce[1];
246
247            target.addClass('loading');
248
249            jq.post( ajaxurl, {
250                action: 'delete_activity',
251                'cookie': encodeURIComponent(document.cookie),
252                'id': id,
253                '_wpnonce': nonce
254            },
255            function(response) {
256
257                if ( response[0] + response[1] == '-1' ) {
258                    li.prepend( response.substr( 2, response.length ) );
259                    li.children('div#message').hide().fadeIn(300);
260                } else {
261                    li.slideUp(300);
262                }
263            });
264
265            return false;
266        }
267
268        // Spam activity stream items
269        if ( target.hasClass( 'spam-activity' ) ) {
270            var li = target.parents( 'div.activity ul li' );
271            target.addClass( 'loading' );
272
273            jq.post( ajaxurl, {
274                action: 'bp_spam_activity',
275                'cookie': encodeURIComponent( document.cookie ),
276                'id': li.attr( 'id' ).substr( 9, li.attr( 'id' ).length ),
277                '_wpnonce': target.attr( 'href' ).split( '_wpnonce=' )[1]
278            },
279
280            function(response) {
281                if ( response[0] + response[1] === '-1' ) {
282                    li.prepend( response.substr( 2, response.length ) );
283                    li.children( 'div#message' ).hide().fadeIn(300);
284                } else {
285                    li.slideUp( 300 );
286                }
287            });
288
289            return false;
290        }
291
292        /* Load more updates at the end of the page */
293        if ( target.parent().hasClass('load-more') ) {
294            jq("#content li.load-more").addClass('loading');
295
296            if ( null == jq.cookie('bp-activity-oldestpage') )
297                jq.cookie('bp-activity-oldestpage', 1, {
298                    path: '/'
299                } );
300
301            var oldest_page = ( jq.cookie('bp-activity-oldestpage') * 1 ) + 1;
302
303            jq.post( ajaxurl, {
304                action: 'activity_get_older_updates',
305                'cookie': encodeURIComponent(document.cookie),
306                'page': oldest_page
307            },
308            function(response)
309            {
310                jq("#content li.load-more").removeClass('loading');
311                jq.cookie( 'bp-activity-oldestpage', oldest_page, {
312                    path: '/'
313                } );
314                jq("#content ul.activity-list").append(response.contents);
315
316                target.parent().hide();
317            }, 'json' );
318
319            return false;
320        }
321    });
322
323    // Activity "Read More" links
324    jq('.activity-read-more a').live('click', function(event) {
325        var target = jq(event.target);
326        var link_id = target.parent().attr('id').split('-');
327        var a_id = link_id[3];
328        var type = link_id[0]; /* activity or acomment */
329
330        var inner_class = type == 'acomment' ? 'acomment-content' : 'activity-inner';
331        var a_inner = jq('li#' + type + '-' + a_id + ' .' + inner_class + ':first' );
332        jq(target).addClass('loading');
333
334        jq.post( ajaxurl, {
335            action: 'get_single_activity_content',
336            'activity_id': a_id
337        },
338        function(response) {
339            jq(a_inner).slideUp(300).html(response).slideDown(300);
340        });
341
342        return false;
343    });
344
345    /**** Activity Comments *******************************************************/
346
347    /* Hide all activity comment forms */
348    jq('form.ac-form').hide();
349
350    /* Hide excess comments */
351    if ( jq('.activity-comments').length )
352        bp_dtheme_hide_comments();
353
354    /* Activity list event delegation */
355    jq('div.activity').click( function(event) {
356        var target = jq(event.target);
357
358        /* Comment / comment reply links */
359        if ( target.hasClass('acomment-reply') || target.parent().hasClass('acomment-reply') ) {
360            if ( target.parent().hasClass('acomment-reply') )
361                target = target.parent();
362
363            var id = target.attr('id');
364            ids = id.split('-');
365
366            var a_id = ids[2]
367            var c_id = target.attr('href').substr( 10, target.attr('href').length );
368            var form = jq( '#ac-form-' + a_id );
369
370            form.css( 'display', 'none' );
371            form.removeClass('root');
372            jq('.ac-form').hide();
373
374            /* Hide any error messages */
375            form.children('div').each( function() {
376                if ( jq(this).hasClass( 'error' ) )
377                    jq(this).hide();
378            });
379
380            if ( ids[1] != 'comment' ) {
381                jq('.activity-comments li#acomment-' + c_id).append( form );
382            } else {
383                jq('li#activity-' + a_id + ' .activity-comments').append( form );
384            }
385
386            if ( form.parent().hasClass( 'activity-comments' ) )
387                form.addClass('root');
388
389            form.slideDown( 200 );
390            jq.scrollTo( form, 500, {
391                offset:-100, 
392                easing:'easeOutQuad'
393            } );
394            jq('#ac-form-' + ids[2] + ' textarea').focus();
395
396            return false;
397        }
398
399        /* Activity comment posting */
400        if ( target.attr('name') == 'ac_form_submit' ) {
401            var form        = target.parent().parent();
402            var form_parent = form.parent();
403            var form_id     = form.attr('id').split('-');
404
405            if ( !form_parent.hasClass('activity-comments') ) {
406                var tmp_id = form_parent.attr('id').split('-');
407                var comment_id = tmp_id[1];
408            } else {
409                var comment_id = form_id[2];
410            }
411
412            /* Hide any error messages */
413            jq( 'form#' + form.attr('id') + ' div.error').hide();
414            target.addClass('loading').prop('disabled', true);
415
416            var ajaxdata = {
417                action: 'new_activity_comment',
418                'cookie': encodeURIComponent(document.cookie),
419                '_wpnonce_new_activity_comment': jq("input#_wpnonce_new_activity_comment").val(),
420                'comment_id': comment_id,
421                'form_id': form_id[2],
422                'content': jq('form#' + form.attr('id') + ' textarea').val()
423            };
424
425            // Akismet
426            var ak_nonce = jq('#_bp_as_nonce_' + comment_id).val();
427            if ( ak_nonce ) {
428                ajaxdata['_bp_as_nonce_' + comment_id] = ak_nonce;
429            }
430
431            jq.post( ajaxurl, ajaxdata,
432                function(response)
433                {
434                    target.removeClass('loading');
435
436                    /* Check for errors and append if found. */
437                    if ( response[0] + response[1] == '-1' ) {
438                        form.append( response.substr( 2, response.length ) ).hide().fadeIn( 200 );
439                    } else {
440                        form.fadeOut( 200,
441                            function() {
442                                if ( 0 == form.parent().children('ul').length ) {
443                                    if ( form.parent().hasClass('activity-comments') )
444                                        form.parent().prepend('<ul></ul>');
445                                    else
446                                        form.parent().append('<ul></ul>');
447                                }
448
449                                form.parent().children('ul').append(response).hide().fadeIn( 200 );
450                                form.children('textarea').val('');
451                                form.parent().parent().addClass('has-comments');
452                            }
453                            );
454                        jq( 'form#' + form.attr('id') + ' textarea').val('');
455
456                        /* Increase the "Reply (X)" button count */
457                        jq('li#activity-' + form_id[2] + ' a.acomment-reply span').html( Number( jq('li#activity-' + form_id[2] + ' a.acomment-reply span').html() ) + 1 );
458                    }
459
460                    jq(target).prop("disabled", false);
461                });
462
463            return false;
464        }
465
466        /* Deleting an activity comment */
467        if ( target.hasClass('acomment-delete') ) {
468            var link_href = target.attr('href');
469            var comment_li = target.parent().parent();
470            var form = comment_li.parents('div.activity-comments').children('form');
471
472            var nonce = link_href.split('_wpnonce=');
473            nonce = nonce[1];
474
475            var comment_id = link_href.split('cid=');
476            comment_id = comment_id[1].split('&');
477            comment_id = comment_id[0];
478
479            target.addClass('loading');
480
481            /* Remove any error messages */
482            jq('.activity-comments ul .error').remove();
483
484            /* Reset the form position */
485            comment_li.parents('.activity-comments').append(form);
486
487            jq.post( ajaxurl, {
488                action: 'delete_activity_comment',
489                'cookie': encodeURIComponent(document.cookie),
490                '_wpnonce': nonce,
491                'id': comment_id
492            },
493            function(response)
494            {
495                /* Check for errors and append if found. */
496                if ( response[0] + response[1] == '-1' ) {
497                    comment_li.prepend( response.substr( 2, response.length ) ).hide().fadeIn( 200 );
498                } else {
499                    var children = jq( 'li#' + comment_li.attr('id') + ' ul' ).children('li');
500                    var child_count = 0;
501                    jq(children).each( function() {
502                        if ( !jq(this).is(':hidden') )
503                            child_count++;
504                    });
505                    comment_li.fadeOut(200);
506
507                    /* Decrease the "Reply (X)" button count */
508                    var count_span = jq('li#' + comment_li.parents('ul#activity-stream > li').attr('id') + ' a.acomment-reply span');
509                    var new_count = count_span.html() - ( 1 + child_count );
510                    count_span.html(new_count);
511
512                    /* If that was the last comment for the item, remove the has-comments class to clean up the styling */
513                    if ( 0 == new_count ) {
514                        jq(comment_li.parents('ul#activity-stream > li')).removeClass('has-comments');
515                    }
516                }
517            });
518
519            return false;
520        }
521
522        // Spam an activity stream comment
523        if ( target.hasClass( 'spam-activity-comment' ) ) {
524            var link_href  = target.attr( 'href' );
525            var comment_li = target.parent().parent();
526
527            target.addClass('loading');
528
529            // Remove any error messages
530            jq( '.activity-comments ul div.error' ).remove();
531
532            // Reset the form position
533            comment_li.parents( '.activity-comments' ).append( comment_li.parents( '.activity-comments' ).children( 'form' ) );
534
535            jq.post( ajaxurl, {
536                action: 'bp_spam_activity_comment',
537                'cookie': encodeURIComponent( document.cookie ),
538                '_wpnonce': link_href.split( '_wpnonce=' )[1],
539                'id': link_href.split( 'cid=' )[1].split( '&' )[0]
540            },
541
542            function ( response ) {
543                // Check for errors and append if found.
544                if ( response[0] + response[1] == '-1' ) {
545                    comment_li.prepend( response.substr( 2, response.length ) ).hide().fadeIn( 200 );
546
547                } else {
548                    var children = jq( 'li#' + comment_li.attr( 'id' ) + ' ul' ).children( 'li' );
549                    var child_count = 0;
550                    jq(children).each( function() {
551                        if ( !jq( this ).is( ':hidden' ) ) {
552                            child_count++;
553                        }
554                    });
555                    comment_li.fadeOut( 200 );
556
557                    // Decrease the "Reply (X)" button count
558                    var parent_li = comment_li.parents( 'ul#activity-stream > li' );
559                    jq( 'li#' + parent_li.attr( 'id' ) + ' a.acomment-reply span' ).html( jq( 'li#' + parent_li.attr( 'id' ) + ' a.acomment-reply span' ).html() - ( 1 + child_count ) );
560                }
561            });
562
563            return false;
564        }
565
566        /* Showing hidden comments - pause for half a second */
567        if ( target.parent().hasClass('show-all') ) {
568            target.parent().addClass('loading');
569
570            setTimeout( function() {
571                target.parent().parent().children('li').fadeIn(200, function() {
572                    target.parent().remove();
573                });
574            }, 600 );
575
576            return false;
577        }
578    });
579
580    /* Escape Key Press for cancelling comment forms */
581    jq(document).keydown( function(e) {
582        e = e || window.event;
583        if (e.target)
584            element = e.target;
585        else if (e.srcElement)
586            element = e.srcElement;
587
588        if( element.nodeType == 3)
589            element = element.parentNode;
590
591        if( e.ctrlKey == true || e.altKey == true || e.metaKey == true )
592            return;
593
594        var keyCode = (e.keyCode) ? e.keyCode : e.which;
595
596        if ( keyCode == 27 ) {
597            if (element.tagName == 'TEXTAREA') {
598                if ( jq(element).hasClass('ac-input') )
599                    jq(element).parent().parent().parent().slideUp( 200 );
600            }
601        }
602    });
603
604    /**** Directory Search ****************************************************/
605
606    /* The search form on all directory pages */
607    jq('.dir-search').click( function(event) {
608        if ( jq(this).hasClass('no-ajax') )
609            return;
610
611        var target = jq(event.target);
612
613        if ( target.attr('type') == 'submit' ) {
614            var css_id = jq('.item-list-tabs li.selected').attr('id').split( '-' );
615            var object = css_id[0];
616
617            bp_filter_request( object, jq.cookie('bp-' + object + '-filter'), jq.cookie('bp-' + object + '-scope') , 'div.' + object, target.parent().children('label').children('input').val(), 1, jq.cookie('bp-' + object + '-extras') );
618
619            return false;
620        }
621    });
622
623    /**** Tabs and Filters ****************************************************/
624
625    /* When a navigation tab is clicked - e.g. | All Groups | My Groups | */
626    jq('div.item-list-tabs').click( function(event) {
627        if ( jq(this).hasClass('no-ajax') )
628            return;
629
630        var target = jq(event.target).parent();
631
632        if ( 'LI' == event.target.parentNode.nodeName && !target.hasClass('last') && !target.hasClass('no-ajax')) {
633            var css_id = target.attr('id').split( '-' );
634            var object = css_id[0];
635
636            if ( 'activity' == object )
637                return false;
638
639            var scope = css_id[1];
640            var filter = jq("#" + object + "-order-select select").val();
641            var search_terms = jq("#" + object + "_search").val();
642
643            bp_filter_request( object, filter, scope, 'div.' + object, search_terms, 1, jq.cookie('bp-' + object + '-extras') );
644
645            return false;
646        }
647    });
648
649    /* When the filter select box is changed re-query */
650    jq('li.filter select').change( function() {
651        if ( jq('div.item-list-tabs li.selected').not('#nav-forum-groups-li').length )
652            var el = jq('div.item-list-tabs li.selected');
653        else
654            var el = jq(this);
655
656        var css_id = el.attr('id').split('-');
657        var object = css_id[0];
658        var scope = css_id[1];
659        var filter = jq(this).val();
660        var search_terms = false;
661
662        if ( jq('div.dir-search input').length )
663            search_terms = jq('div.dir-search input').val();
664
665        if ( 'friends' == object )
666            object = 'members';
667        
668        bp_filter_request( object, filter, scope, 'div.' + object, search_terms, 1, jq.cookie('bp-' + object + '-extras') );
669
670        return false;
671    });
672
673    /* Displaymode (list or grid) */
674    jq('li.displaymode select').change( function() {
675        if ( jq('div.item-list-tabs li.selected').length )
676            var el = jq('div.item-list-tabs li.selected');
677        else
678            var el = jq(this);
679
680        var page_number = 1;
681        var css_id = el.attr('id').split('-');
682        var object = css_id[0];
683        var scope = css_id[1];
684        var displaymode = jq(this).val();
685        var search_terms = false;
686
687        if ( jq('div.dir-search input').length )
688            search_terms = jq('div.dir-search input').val();
689
690        if ( 'friends' == object )
691            object = 'members';
692
693        if ( jq('div.pagination span.current').length )
694            page_number = new Number( jq('div.pagination span.current').html() );
695
696        bp_displaymode_request( object, displaymode, scope, 'div.' + object, search_terms, page_number, jq.cookie('bp-' + object + '-extras') );
697
698        return false;
699    });
700
701    /* All pagination links run through this function */
702    jq('div#content').click( function(event) {
703        var target = jq(event.target);
704
705        if ( target.hasClass('button') )
706            return true;
707
708        if ( target.parent().parent().hasClass('pagination') && !target.parent().parent().hasClass('no-ajax') ) {
709            if ( target.hasClass('dots') || target.hasClass('current') )
710                return false;
711
712            if ( jq('div.item-list-tabs li.selected').length )
713                var el = jq('div.item-list-tabs li.selected');
714            else
715                var el = jq('li.filter select');
716
717            var page_number = 1;
718            var css_id = el.attr('id').split( '-' );
719            var object = css_id[0];
720            var search_terms = false;
721
722            if ( jq('div.dir-search input').length )
723                search_terms = jq('div.dir-search input').val();
724
725            if ( jq(target).hasClass('next') )
726                var page_number = Number( jq('div.pagination span.current').html() ) + 1;
727            else if ( jq(target).hasClass('prev') )
728                var page_number = Number( jq('div.pagination span.current').html() ) - 1;
729            else
730                var page_number = Number( jq(target).html() );
731
732            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') );
733
734            return false;
735        }
736
737    });
738    
739    /**** New Forum Directory Post **************************************/
740
741    /* Hit the "New Topic" button on the forums directory page */
742    jq('a.show-hide-new').click( function() {
743        if ( !jq('div#new-topic-post').length )
744            return true;
745
746        if ( jq('div#new-topic-post').is(":visible") )
747            jq('div#new-topic-post').slideUp(200);
748        else
749            jq('#new-topic-post').slideDown(200, function() {
750                jq('#topic_title').focus();
751            } );
752
753        return false;
754    });
755
756    /* Cancel the posting of a new forum topic */
757    jq('input#submit_topic_cancel').click( function() {
758        if ( !jq('div#new-topic-post').length )
759            return false;
760
761        jq('div#new-topic-post').slideUp(200);
762        return false;
763    });
764
765    /* Clicking a forum tag */
766    jq('div#forum-directory-tags a').click( function() {
767        bp_filter_request( 'forums', 'tags', jq.cookie('bp-forums-scope'), 'div.forums', jq(this).html().replace( /&nbsp;/g, '-' ), 1, jq.cookie('bp-forums-extras') );
768        return false;
769    });
770
771    /** Invite Friends Interface ****************************************/
772
773    /* Select a user from the list of friends and add them to the invite list */
774    jq("div#invite-list input").click( function() {
775        jq('.ajax-loader').toggle();
776
777        var friend_id = jq(this).val();
778
779        if ( jq(this).prop('checked') == true )
780            var friend_action = 'invite';
781        else
782            var friend_action = 'uninvite';
783
784        jq('div.item-list-tabs li.selected').addClass('loading');
785
786        jq.post( ajaxurl, {
787            action: 'groups_invite_user',
788            'friend_action': friend_action,
789            'cookie': encodeURIComponent(document.cookie),
790            '_wpnonce': jq("input#_wpnonce_invite_uninvite_user").val(),
791            'friend_id': friend_id,
792            'group_id': jq("input#group_id").val()
793        },
794        function(response)
795        {
796            if ( jq("#message") )
797                jq("#message").hide();
798
799            jq('.ajax-loader').toggle();
800
801            if ( friend_action == 'invite' ) {
802                jq('#friend-list').append(response);
803            } else if ( friend_action == 'uninvite' ) {
804                jq('#friend-list li#uid-' + friend_id).remove();
805            }
806
807            jq('div.item-list-tabs li.selected').removeClass('loading');
808        });
809    });
810
811    /* Remove a user from the list of users to invite to a group */
812    jq("#friend-list li a.remove").live('click', function() {
813        jq('.ajax-loader').toggle();
814
815        var friend_id = jq(this).attr('id');
816        friend_id = friend_id.split('-');
817        friend_id = friend_id[1];
818
819        jq.post( ajaxurl, {
820            action: 'groups_invite_user',
821            'friend_action': 'uninvite',
822            'cookie': encodeURIComponent(document.cookie),
823            '_wpnonce': jq("input#_wpnonce_invite_uninvite_user").val(),
824            'friend_id': friend_id,
825            'group_id': jq("input#group_id").val()
826        },
827        function(response)
828        {
829            jq('.ajax-loader').toggle();
830            jq('#friend-list li#uid-' + friend_id).remove();
831            jq('#invite-list input#f-' + friend_id).prop('checked', false);
832        });
833
834        return false;
835    });
836
837    /** Profile Visibility Settings *********************************/
838    jq('.field-visibility-settings').hide();
839    jq('.visibility-toggle-link').on( 'click', function() {
840        var toggle_div = jq(this).parent();
841		
842        jq(toggle_div).fadeOut( 600, function(){
843            jq(toggle_div).siblings('.field-visibility-settings').slideDown(400);
844        });
845		
846        return false;
847    } );
848
849    jq('.field-visibility-settings-close').on( 'click', function() {
850        var settings_div = jq(this).parent();
851		
852        jq(settings_div).slideUp( 400, function(){
853            jq(settings_div).siblings('.field-visibility-settings-toggle').fadeIn(800);
854        });
855		
856        return false;
857    } );
858
859
860    /** Friendship Requests **************************************/
861
862    /* Accept and Reject friendship request buttons */
863    jq("ul#friend-list a.accept, ul#friend-list a.reject").click( function() {
864        var button = jq(this);
865        var li = jq(this).parents('ul#friend-list li');
866        var action_div = jq(this).parents('li div.action');
867
868        var id = li.attr('id').substr( 11, li.attr('id').length );
869        var link_href = button.attr('href');
870
871        var nonce = link_href.split('_wpnonce=');
872        nonce = nonce[1];
873
874        if ( jq(this).hasClass('accepted') || jq(this).hasClass('rejected') )
875            return false;
876
877        if ( jq(this).hasClass('accept') ) {
878            var action = 'accept_friendship';
879            action_div.children('a.reject').css( 'visibility', 'hidden' );
880        } else {
881            var action = 'reject_friendship';
882            action_div.children('a.accept').css( 'visibility', 'hidden' );
883        }
884
885        button.addClass('loading');
886
887        jq.post( ajaxurl, {
888            action: action,
889            'cookie': encodeURIComponent(document.cookie),
890            'id': id,
891            '_wpnonce': nonce
892        },
893        function(response) {
894            button.removeClass('loading');
895
896            if ( response[0] + response[1] == '-1' ) {
897                li.prepend( response.substr( 2, response.length ) );
898                li.children('div#message').hide().fadeIn(200);
899            } else {
900                button.fadeOut( 100, function() {
901                    if ( jq(this).hasClass('accept') ) {
902                        action_div.children('a.reject').hide();
903                        jq(this).html( BP_DTheme.accepted ).fadeIn(50);
904                        jq(this).addClass('accepted');
905                    } else {
906                        action_div.children('a.accept').hide();
907                        jq(this).html( BP_DTheme.rejected ).fadeIn(50);
908                        jq(this).addClass('rejected');
909                    }
910                });
911            }
912        });
913
914        return false;
915    });
916
917    /* Add / Remove friendship buttons */
918    jq("div.friendship-button a").live('click', function() {
919        jq(this).parent().addClass('loading');
920        var fid = jq(this).attr('id');
921        fid = fid.split('-');
922        fid = fid[1];
923
924        var nonce = jq(this).attr('href');
925        nonce = nonce.split('?_wpnonce=');
926        nonce = nonce[1].split('&');
927        nonce = nonce[0];
928
929        var thelink = jq(this);
930
931        jq.post( ajaxurl, {
932            action: 'addremove_friend',
933            'cookie': encodeURIComponent(document.cookie),
934            'fid': fid,
935            '_wpnonce': nonce
936        },
937        function(response)
938        {
939            var action = thelink.attr('rel');
940            var parentdiv = thelink.parent();
941
942            if ( action == 'add' ) {
943                jq(parentdiv).fadeOut(200,
944                    function() {
945                        parentdiv.removeClass('add_friend');
946                        parentdiv.removeClass('loading');
947                        parentdiv.addClass('pending');
948                        parentdiv.fadeIn(200).html(response);
949                    }
950                    );
951
952            } else if ( action == 'remove' ) {
953                jq(parentdiv).fadeOut(200,
954                    function() {
955                        parentdiv.removeClass('remove_friend');
956                        parentdiv.removeClass('loading');
957                        parentdiv.addClass('add');
958                        parentdiv.fadeIn(200).html(response);
959                    }
960                    );
961            }
962        });
963        return false;
964    } );
965
966    /** Group Join / Leave Buttons **************************************/
967
968    jq("div.group-button a").live('click', function() {
969        var gid = jq(this).parent().attr('id');
970        gid = gid.split('-');
971        gid = gid[1];
972
973        var nonce = jq(this).attr('href');
974        nonce = nonce.split('?_wpnonce=');
975        nonce = nonce[1].split('&');
976        nonce = nonce[0];
977
978        var thelink = jq(this);
979
980        jq.post( ajaxurl, {
981            action: 'joinleave_group',
982            'cookie': encodeURIComponent(document.cookie),
983            'gid': gid,
984            '_wpnonce': nonce
985        },
986        function(response)
987        {
988            var parentdiv = thelink.parent();
989
990            if ( !jq('body.directory').length )
991                location.href = location.href;
992            else {
993                jq(parentdiv).fadeOut(200,
994                    function() {
995                        parentdiv.fadeIn(200).html(response);
996                    }
997                    );
998            }
999        });
1000        return false;
1001    } );
1002
1003    /** Button disabling ************************************************/
1004
1005    jq('div.pending').click(function() {
1006        return false;
1007    });
1008
1009    /** Private Messaging ******************************************/
1010
1011    /** Message search*/
1012    jq('.message-search').click( function(event) {
1013        if ( jq(this).hasClass('no-ajax') )
1014            return;
1015
1016        var target = jq(event.target);
1017
1018        if ( target.attr('type') == 'submit' ) {
1019            //var css_id = jq('.item-list-tabs li.selected').attr('id').split( '-' );
1020            var object = 'messages';
1021
1022            bp_filter_request( object, jq.cookie('bp-' + object + '-filter'), jq.cookie('bp-' + object + '-scope') , 'div.' + object, target.parent().children('label').children('input').val(), 1, jq.cookie('bp-' + object + '-extras') );
1023
1024            return false;
1025        }
1026    });
1027
1028    /* AJAX send reply functionality */
1029    jq("input#send_reply_button").click(
1030        function() {
1031            var order = jq('#messages_order').val() || 'ASC',
1032            offset = jq('#message-recipients').offset();
1033
1034            var button = jq("input#send_reply_button");
1035            jq(button).addClass('loading');
1036
1037            jq.post( ajaxurl, {
1038                action: 'messages_send_reply',
1039                'cookie': encodeURIComponent(document.cookie),
1040                '_wpnonce': jq("input#send_message_nonce").val(),
1041
1042                'content': jq("#message_content").val(),
1043                'send_to': jq("input#send_to").val(),
1044                'subject': jq("input#subject").val(),
1045                'thread_id': jq("input#thread_id").val()
1046            },
1047            function(response)
1048            {
1049                if ( response[0] + response[1] == "-1" ) {
1050                    jq('form#send-reply').prepend( response.substr( 2, response.length ) );
1051                } else {
1052                    jq('form#send-reply div#message').remove();
1053                    jq("#message_content").val('');
1054
1055                    if ( 'ASC' == order ) {
1056                        jq('form#send-reply').before( response );
1057                    } else {
1058                        jq('#message-recipients').after( response );
1059                        jq(window).scrollTop(offset.top);
1060                    }
1061
1062                    jq("div.new-message").hide().slideDown( 200, function() {
1063                        jq('div.new-message').removeClass('new-message');
1064                    });
1065                }
1066                jq(button).removeClass('loading');
1067            });
1068
1069            return false;
1070        }
1071        );
1072
1073    /* Marking private messages as read and unread */
1074    jq("a#mark_as_read, a#mark_as_unread").click(function() {
1075        var checkboxes_tosend = '';
1076        var checkboxes = jq("#message-threads tr td input[type='checkbox']");
1077
1078        if ( 'mark_as_unread' == jq(this).attr('id') ) {
1079            var currentClass = 'read'
1080            var newClass = 'unread'
1081            var unreadCount = 1;
1082            var inboxCount = 0;
1083            var unreadCountDisplay = 'inline';
1084            var action = 'messages_markunread';
1085        } else {
1086            var currentClass = 'unread'
1087            var newClass = 'read'
1088            var unreadCount = 0;
1089            var inboxCount = 1;
1090            var unreadCountDisplay = 'none';
1091            var action = 'messages_markread';
1092        }
1093
1094        checkboxes.each( function(i) {
1095            if(jq(this).is(':checked')) {
1096                if ( jq('tr#m-' + jq(this).attr('value')).hasClass(currentClass) ) {
1097                    checkboxes_tosend += jq(this).attr('value');
1098                    jq('tr#m-' + jq(this).attr('value')).removeClass(currentClass);
1099                    jq('tr#m-' + jq(this).attr('value')).addClass(newClass);
1100                    var thread_count = jq('tr#m-' + jq(this).attr('value') + ' td span.unread-count').html();
1101
1102                    jq('tr#m-' + jq(this).attr('value') + ' td span.unread-count').html(unreadCount);
1103                    jq('tr#m-' + jq(this).attr('value') + ' td span.unread-count').css('display', unreadCountDisplay);
1104
1105                    var inboxcount = jq('tr.unread').length;
1106
1107                    jq('a#user-messages span').html( inboxcount );
1108
1109                    if ( i != checkboxes.length - 1 ) {
1110                        checkboxes_tosend += ','
1111                    }
1112                }
1113            }
1114        });
1115        jq.post( ajaxurl, {
1116            action: action,
1117            'thread_ids': checkboxes_tosend
1118        });
1119        return false;
1120    });
1121
1122    /* Selecting unread and read messages in inbox */
1123    jq("select#message-type-select").change(
1124        function() {
1125            var selection = jq("select#message-type-select").val();
1126            var checkboxes = jq("td input[type='checkbox']");
1127            checkboxes.each( function(i) {
1128                checkboxes[i].checked = "";
1129            });
1130
1131            switch(selection) {
1132                case 'unread':
1133                    var checkboxes = jq("tr.unread td input[type='checkbox']");
1134                    break;
1135                case 'read':
1136                    var checkboxes = jq("tr.read td input[type='checkbox']");
1137                    break;
1138            }
1139            if ( selection != '' ) {
1140                checkboxes.each( function(i) {
1141                    checkboxes[i].checked = "checked";
1142                });
1143            } else {
1144                checkboxes.each( function(i) {
1145                    checkboxes[i].checked = "";
1146                });
1147            }
1148        }
1149        );
1150
1151    /* Bulk delete messages */
1152    jq("a#delete_inbox_messages, a#delete_sentbox_messages").click( function() {
1153        checkboxes_tosend = '';
1154        checkboxes = jq("#message-threads tr td input[type='checkbox']");
1155
1156        jq('div#message').remove();
1157        jq(this).addClass('loading');
1158
1159        jq(checkboxes).each( function(i) {
1160            if( jq(this).is(':checked') )
1161                checkboxes_tosend += jq(this).attr('value') + ',';
1162        });
1163
1164        if ( '' == checkboxes_tosend ) {
1165            jq(this).removeClass('loading');
1166            return false;
1167        }
1168
1169        jq.post( ajaxurl, {
1170            action: 'messages_delete',
1171            'thread_ids': checkboxes_tosend
1172        }, function(response) {
1173            if ( response[0] + response[1] == "-1" ) {
1174                jq('#message-threads').prepend( response.substr( 2, response.length ) );
1175            } else {
1176                jq('#message-threads').before( '<div id="message" class="updated"><p>' + response + '</p></div>' );
1177
1178                jq(checkboxes).each( function(i) {
1179                    if( jq(this).is(':checked') )
1180                        jq(this).parent().parent().fadeOut(150);
1181                });
1182            }
1183
1184            jq('div#message').hide().slideDown(150);
1185            jq("a#delete_inbox_messages, a#delete_sentbox_messages").removeClass('loading');
1186        });
1187        return false;
1188    });
1189
1190    /* Close site wide notices in the sidebar */
1191    jq("a#close-notice").click( function() {
1192        jq(this).addClass('loading');
1193        jq('div#sidebar div.error').remove();
1194
1195        jq.post( ajaxurl, {
1196            action: 'messages_close_notice',
1197            'notice_id': jq('.notice').attr('rel').substr( 2, jq('.notice').attr('rel').length )
1198        },
1199        function(response) {
1200            jq("a#close-notice").removeClass('loading');
1201
1202            if ( response[0] + response[1] == '-1' ) {
1203                jq('.notice').prepend( response.substr( 2, response.length ) );
1204                jq( 'div#sidebar div.error').hide().fadeIn( 200 );
1205            } else {
1206                jq('.notice').slideUp( 100 );
1207            }
1208        });
1209        return false;
1210    });
1211
1212    /* Admin Bar & wp_list_pages Javascript IE6 hover class */
1213    jq("#wp-admin-bar ul.main-nav li, #nav li").mouseover( function() {
1214        jq(this).addClass('sfhover');
1215    });
1216
1217    jq("#wp-admin-bar ul.main-nav li, #nav li").mouseout( function() {
1218        jq(this).removeClass('sfhover');
1219    });
1220
1221    /* Clear BP cookies on logout */
1222    jq('a.logout').click( function() {
1223        jq.cookie('bp-activity-scope', null, {
1224            path: '/'
1225        });
1226        jq.cookie('bp-activity-filter', null, {
1227            path: '/'
1228        });
1229        jq.cookie('bp-activity-oldestpage', null, {
1230            path: '/'
1231        });
1232
1233        var objects = [ 'members', 'groups', 'blogs', 'forums' ];
1234        jq(objects).each( function(i) {
1235            jq.cookie('bp-' + objects[i] + '-scope', null, {
1236                path: '/'
1237            } );
1238            jq.cookie('bp-' + objects[i] + '-filter', null, {
1239                path: '/'
1240            } );
1241            jq.cookie('bp-' + objects[i] + '-extras', null, {
1242                path: '/'
1243            } );
1244        });
1245    });
1246    
1247    
1248    /* Scroll a lot of menu items in BuddyPress sub nav menu  ------start*/
1249    
1250    
1251    if(screen.width > 1024){
1252        var selector_nav_wrap = '.item-list-tabs[role="navigation"]:not("#subnav"), .item-list-tabs#object-nav';
1253        jq(window).load(function(){
1254            
1255            jq(selector_nav_wrap).filter(':eq(1)').remove()
1256            jq(selector_nav_wrap).prepend('<button class="prev">&lt;</button><button class="next">&gt;</button>').find('ul').wrap('<div class="bp-nav-wrap">');
1257
1258                // Enable or leave the keys
1259                jq(selector_nav_wrap).each(function(){
1260                    if(jq('li:last',this).width()+jq('li:last',this).offset().left-jq('li:first',this).offset().left>jq('.item-list-tabs').width()){
1261                        // enable the buttons
1262                        jq('button',this).css('display','inline');
1263                        jq('button.prev',this).css('display','none');
1264                    }
1265                });
1266        });
1267	
1268	
1269        jq(selector_nav_wrap).on('click', '.next', function(){
1270            //Remove the exist selector
1271            //Set the width to the widest of either
1272            var $div =jq('div',this.parentNode)
1273            ,maxoffset = jq('li:last',$div).width()+jq('li:last',$div).offset().left - jq('li:first',$div).offset().left - $div.width()
1274            ,offset = Math.abs(parseInt( jq('ul',$div).css('marginLeft') ))
1275            ,diff = $div.width();
1276
1277            if( offset >= maxoffset )
1278                return;
1279            else if ( offset + diff >= maxoffset ){
1280                diff = maxoffset - offset + 20;
1281                // Hide this
1282                jq(this).css('display','none');
1283            }
1284            // enable the other
1285            jq('.prev', this.parentNode).css('display','block');		
1286		
1287            jq("ul", jq(this).parent() ).animate({
1288                marginLeft: "-=" + diff
1289            },400, 'swing');
1290        });
1291	
1292        jq(selector_nav_wrap).on('click', '.prev', function(){
1293
1294            var offset = Math.abs(parseInt( jq('ul',this.parentNode).css('marginLeft') ));
1295            var diff = jq('div',this.parentNode).width();
1296            if( offset <= 0 )
1297                return;
1298            else if ( offset - diff <= 0 ){
1299                jq(this).css('display','none');		
1300                diff = offset;
1301            }
1302            jq('.next', this.parentNode).css('display','block');
1303
1304            jq("ul",jq(this).parent()).animate({
1305                marginLeft: '+='+diff
1306            },400, 'swing');
1307        });
1308    }
1309    /* Scroll a lot of menu items in BuddyPress sub nav menu  ------end*/
1310    
1311    jq('.allow-dirrect-links').click( function(){
1312        window.location = jq(this).attr('data-url');
1313    });
1314    
1315    //add class to plugins pages
1316    jq('#content').not('.span8').addClass('span8 added-by-plugins');
1317    
1318    jq('#container #container').removeAttr('id');
1319    
1320});
1321
1322/* Setup activity scope and filter based on the current cookie settings. */
1323function bp_init_activity() {
1324    /* Reset the page */
1325    jq.cookie( 'bp-activity-oldestpage', 1, {
1326        path: '/'
1327    } );
1328
1329    if ( null != jq.cookie('bp-activity-filter') && jq('#activity-filter-select').length )
1330        jq('#activity-filter-select select option[value="' + jq.cookie('bp-activity-filter') + '"]').prop( 'selected', true );
1331
1332    /* Activity Tab Set */
1333    if ( null != jq.cookie('bp-activity-scope') && jq('div.activity-type-tabs').length ) {
1334        jq('div.activity-type-tabs li').each( function() {
1335            jq(this).removeClass('selected');
1336        });
1337        jq('li#activity-' + jq.cookie('bp-activity-scope') + ', div.item-list-tabs li.current').addClass('selected');
1338    }
1339}
1340
1341/* Setup object scope and filter based on the current cookie settings for the object. */
1342function bp_init_objects(objects) {
1343    jq(objects).each( function(i) {
1344        if ( null != jq.cookie('bp-' + objects[i] + '-filter') && jq('li#' + objects[i] + '-order-select select').length ){
1345            jq('li#' + objects[i] + '-order-select select option[value="' + jq.cookie('bp-' + objects[i] + '-filter') + '"]').prop( 'selected', true );
1346        }
1347        //setup displaymode select position
1348        if ( null != jq.cookie('bp-' + objects[i] + '-displaymode') && jq('li#' + objects[i] + '-displaymode-select select').length ){
1349            jq('li#' + objects[i] + '-displaymode-select select option[value="' + jq.cookie('bp-' + objects[i] + '-displaymode') + '"]').prop( 'selected', true );
1350        }
1351
1352        if ( null != jq.cookie('bp-' + objects[i] + '-scope') && jq('div.' + objects[i]).length ) {
1353            jq('div.item-list-tabs li').removeClass('selected');
1354            var set_seleted_class_object = jq('div.item-list-tabs li#' + objects[i] + '-' + jq.cookie('bp-' + objects[i] + '-scope') + ', div.item-list-tabs#object-nav li.current')
1355            if(set_seleted_class_object.size() > 0){
1356                set_seleted_class_object.addClass('selected');
1357            } else {
1358                jq('div.item-list-tabs li#' + objects[i] + '-all, div.item-list-tabs#object-nav li.current').addClass('selected');
1359            }
1360        }
1361    });
1362}
1363
1364/* Filter the current content list (groups/members/blogs/topics) */
1365function bp_filter_request( object, filter, scope, target, search_terms, page, extras ) {
1366    if ( 'activity' == object )
1367        return false;
1368
1369    if ( jq.query.get('s') && !search_terms )
1370        search_terms = jq.query.get('s');
1371
1372    if ( null == scope )
1373        scope = 'all';
1374
1375    /* Save the settings we want to remain persistent to a cookie */
1376    jq.cookie( 'bp-' + object + '-scope', scope, {
1377        path: '/'
1378    } );
1379    jq.cookie( 'bp-' + object + '-filter', filter, {
1380        path: '/'
1381    } );
1382    jq.cookie( 'bp-' + object + '-extras', extras, {
1383        path: '/'
1384    } );
1385//    console.log(object, filter, scope, target, search_terms, page, extras)
1386    /* Set the correct selected nav and filter */
1387    jq('div.item-list-tabs li').removeClass('selected');
1388    
1389    var current_tab = jq('div.item-list-tabs li#' + object + '-' + scope + ', div.item-list-tabs#object-nav li.current');
1390    
1391    if(current_tab.size() > 0){
1392        current_tab.addClass('selected');
1393    } else {
1394        jq('div.item-list-tabs li#' + object + '-all').addClass('selected');
1395    }
1396    jq('div.item-list-tabs li.selected').addClass('loading');
1397    jq('div.item-list-tabs select option[value="' + filter + '"]').prop( 'selected', true );
1398
1399    if ( 'friends' == object )
1400        object = 'members';
1401
1402    if ( bp_ajax_request )
1403        bp_ajax_request.abort();
1404
1405    bp_ajax_request = jq.post( ajaxurl, {
1406        action: object + '_filter',
1407        'cookie': encodeURIComponent(document.cookie),
1408        'object': object,
1409        'filter': filter,
1410        'search_terms': search_terms,
1411        'scope': scope,
1412        'page': page,
1413        'extras': extras
1414    },
1415    function(response)
1416    {
1417        jq(target).fadeOut( 100, function() {
1418            jq(this).html(response);
1419            jq(this).fadeIn(100);
1420        });
1421        jq('div.item-list-tabs li.loading').removeClass('loading').addClass('selected');
1422    });
1423}
1424
1425/* Displaymode the current content list or grid (groups/members/group members/member frends) */
1426function bp_displaymode_request( object, displaymode, scope, target, search_terms, page, extras ) {
1427    if ( 'activity' == object )
1428        return false;
1429
1430    if ( jq.query.get('s') && !search_terms )
1431        search_terms = jq.query.get('s');
1432
1433    if ( null == scope )
1434        scope = 'all';
1435
1436    /* Save the settings we want to remain persistent to a cookie */
1437    jq.cookie( 'bp-' + object + '-scope', scope, {
1438        path: '/'
1439    } );
1440    jq.cookie( 'bp-' + object + '-displaymode', displaymode, {
1441        path: '/'
1442    } );
1443    jq.cookie( 'bp-' + object + '-extras', extras, {
1444        path: '/'
1445    } );
1446
1447    /* Set the correct selected nav and displymode */
1448    jq('div.item-list-tabs li').removeClass('selected');
1449    jq('div.item-list-tabs li#' + object + '-' + scope + ', div.item-list-tabs#object-nav li.current').addClass('selected');
1450    jq('div.item-list-tabs li.selected').addClass('loading');
1451    jq('div.item-list-tabs select option[value="' + displaymode + '"]').prop( 'selected', true );
1452
1453    if ( 'friends' == object )
1454        object = 'members';
1455
1456    if ( bp_ajax_request )
1457        bp_ajax_request.abort();
1458    bp_ajax_request = jq.post( ajaxurl, {
1459        action: object + '_displaymode',
1460        'cookie': encodeURIComponent(document.cookie),
1461        'object': object,
1462        'displaymode': displaymode,
1463        'search_terms': search_terms,
1464        'scope': scope,
1465        'page': page,
1466        'extras': extras
1467    },
1468    function(response, textStatus, jqXHR)
1469    {
1470        jq(target).fadeOut( 100, function() {
1471            jq(this).html(response);
1472            jq(this).fadeIn(100);
1473        });
1474        jq('div.item-list-tabs li.selected').removeClass('loading').addClass('selected');
1475    });
1476}
1477
1478/* Activity Loop Requesting */
1479function bp_activity_request(scope, filter) {
1480    /* Save the type and filter to a session cookie */
1481    jq.cookie( 'bp-activity-scope', scope, {
1482        path: '/'
1483    } );
1484    jq.cookie( 'bp-activity-filter', filter, {
1485        path: '/'
1486    } );
1487    jq.cookie( 'bp-activity-oldestpage', 1, {
1488        path: '/'
1489    } );
1490
1491    /* Remove selected and loading classes from tabs */
1492    jq('div.item-list-tabs li').each( function() {
1493        jq(this).removeClass('selected loading');
1494    });
1495    /* Set the correct selected nav and filter */
1496    jq('li#activity-' + scope + ', div.item-list-tabs li.current').addClass('selected');
1497    jq('div#object-nav.item-list-tabs li.selected, div.activity-type-tabs li.selected').addClass('loading');
1498    jq('#activity-filter-select select option[value="' + filter + '"]').prop( 'selected', true );
1499
1500    /* Reload the activity stream based on the selection */
1501    jq('.widget_bp_activity_widget h2 span.ajax-loader').show();
1502
1503    if ( bp_ajax_request )
1504        bp_ajax_request.abort();
1505
1506    bp_ajax_request = jq.post( ajaxurl, {
1507        action: 'activity_widget_filter',
1508        'cookie': encodeURIComponent(document.cookie),
1509        '_wpnonce_activity_filter': jq("input#_wpnonce_activity_filter").val(),
1510        'scope': scope,
1511        'filter': filter
1512    },
1513    function(response)
1514    {
1515        jq('.widget_bp_activity_widget h2 span.ajax-loader').hide();
1516
1517        jq('div.activity').fadeOut( 100, function() {
1518            jq(this).html(response.contents);
1519            jq(this).fadeIn(100);
1520
1521            /* Selectively hide comments */
1522            bp_dtheme_hide_comments();
1523        });
1524
1525        /* Update the feed link */
1526        if ( null != response.feed_url )
1527            jq('.directory div#subnav li.feed a, .home-page div#subnav li.feed a').attr('href', response.feed_url);
1528
1529        jq('div.item-list-tabs li.selected').removeClass('loading');
1530
1531    }, 'json' );
1532}
1533
1534/* Hide long lists of activity comments, only show the latest five root comments. */
1535function bp_dtheme_hide_comments() {
1536    var comments_divs = jq('div.activity-comments');
1537
1538    if ( !comments_divs.length )
1539        return false;
1540
1541    comments_divs.each( function() {
1542        if ( jq(this).children('ul').children('li').length < 5 ) return;
1543
1544        var comments_div = jq(this);
1545        var parent_li = comments_div.parents('ul#activity-stream > li');
1546        var comment_lis = jq(this).children('ul').children('li');
1547        var comment_count = ' ';
1548
1549        if ( jq('li#' + parent_li.attr('id') + ' a.acomment-reply span').length )
1550            var comment_count = jq('li#' + parent_li.attr('id') + ' a.acomment-reply span').html();
1551
1552        comment_lis.each( function(i) {
1553            /* Show the latest 5 root comments */
1554            if ( i < comment_lis.length - 5 ) {
1555                jq(this).addClass('hidden');
1556                jq(this).toggle();
1557
1558                if ( !i )
1559                    jq(this).before( '<li class="show-all"><a href="#' + parent_li.attr('id') + '/show-all/" title="' + BP_DTheme.show_all_comments + '">' + BP_DTheme.show_all + ' ' + comment_count + ' ' + BP_DTheme.comments + '</a></li>' );
1560            }
1561        });
1562
1563    });
1564}
1565
1566/* Helper Functions */
1567
1568function checkAll() {
1569    var checkboxes = document.getElementsByTagName("input");
1570    for(var i=0; i<checkboxes.length; i++) {
1571        if(checkboxes[i].type == "checkbox") {
1572            if($("check_all").checked == "") {
1573                checkboxes[i].checked = "";
1574            }
1575            else {
1576                checkboxes[i].checked = "checked";
1577            }
1578        }
1579    }
1580}
1581
1582function clear(container) {
1583    if( !document.getElementById(container) ) return;
1584
1585    var container = document.getElementById(container);
1586
1587    if ( radioButtons = container.getElementsByTagName('INPUT') ) {
1588        for(var i=0; i<radioButtons.length; i++) {
1589            radioButtons[i].checked = '';
1590        }
1591    }
1592
1593    if ( options = container.getElementsByTagName('OPTION') ) {
1594        for(var i=0; i<options.length; i++) {
1595            options[i].selected = false;
1596        }
1597    }
1598
1599    return;
1600}
1601
1602/* ScrollTo plugin - just inline and minified */
1603;
1604(function(d){
1605    var k=d.scrollTo=function(a,i,e){
1606        d(window).scrollTo(a,i,e)
1607        };
1608        
1609    k.defaults={
1610        axis:'xy',
1611        duration:parseFloat(d.fn.jquery)>=1.3?0:1
1612        };
1613        
1614    k.window=function(a){
1615        return d(window)._scrollable()
1616        };
1617        
1618    d.fn._scrollable=function(){
1619        return this.map(function(){
1620            var a=this,i=!a.nodeName||d.inArray(a.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;
1621            if(!i)return a;
1622            var e=(a.contentWindow||a).document||a.ownerDocument||a;
1623            return d.browser.safari||e.compatMode=='BackCompat'?e.body:e.documentElement
1624            })
1625        };
1626        
1627    d.fn.scrollTo=function(n,j,b){
1628        if(typeof j=='object'){
1629            b=j;
1630            j=0
1631            }
1632            if(typeof b=='function')b={
1633            onAfter:b
1634        };
1635        
1636        if(n=='max')n=9e9;
1637        b=d.extend({},k.defaults,b);
1638        j=j||b.speed||b.duration;
1639        b.queue=b.queue&&b.axis.length>1;
1640        if(b.queue)j/=2;
1641        b.offset=p(b.offset);
1642        b.over=p(b.over);
1643        return this._scrollable().each(function(){
1644            var q=this,r=d(q),f=n,s,g={},u=r.is('html,body');
1645            switch(typeof f){
1646                case'number':case'string':
1647                    if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(f)){
1648                    f=p(f);
1649                    break
1650                }
1651                f=d(f,this);
1652                case'object':
1653                    if(f.is||f.style)s=(f=d(f)).offset()
1654                    }
1655                    d.each(b.axis.split(''),function(a,i){
1656                var e=i=='x'?'Left':'Top',h=e.toLowerCase(),c='scroll'+e,l=q[c],m=k.max(q,i);
1657                if(s){
1658                    g[c]=s[h]+(u?0:l-r.offset()[h]);
1659                    if(b.margin){
1660                        g[c]-=parseInt(f.css('margin'+e))||0;
1661                        g[c]-=parseInt(f.css('border'+e+'Width'))||0
1662                        }
1663                        g[c]+=b.offset[h]||0;
1664                    if(b.over[h])g[c]+=f[i=='x'?'width':'height']()*b.over[h]
1665                        }else{
1666                    var o=f[h];
1667                    g[c]=o.slice&&o.slice(-1)=='%'?parseFloat(o)/100*m:o
1668                    }
1669                    if(/^\d+$/.test(g[c]))g[c]=g[c]<=0?0:Math.min(g[c],m);
1670                if(!a&&b.queue){
1671                    if(l!=g[c])t(b.onAfterFirst);
1672                    delete g[c]
1673                }
1674            });
1675        t(b.onAfter);
1676            function t(a){
1677            r.animate(g,j,b.easing,a&&function(){
1678                a.call(this,n,b)
1679                })
1680            }
1681        }).end()
1682    };
1683    
1684k.max=function(a,i){
1685    var e=i=='x'?'Width':'Height',h='scroll'+e;
1686    if(!d(a).is('html,body'))return a[h]-d(a)[e.toLowerCase()]();
1687    var c='client'+e,l=a.ownerDocument.documentElement,m=a.ownerDocument.body;
1688    return Math.max(l[h],m[h])-Math.min(l[c],m[c])
1689    };
1690    
1691function p(a){
1692    return typeof a=='object'?a:{
1693        top:a,
1694        left:a
1695    }
1696}
1697})(jQuery);
1698
1699/* jQuery Easing Plugin, v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/ */
1700jQuery.easing.jswing=jQuery.easing.swing;
1701jQuery.extend(jQuery.easing,{
1702    def:"easeOutQuad",
1703    swing:function(e,f,a,h,g){
1704        return jQuery.easing[jQuery.easing.def](e,f,a,h,g)
1705        },
1706    easeInQuad:function(e,f,a,h,g){
1707        return h*(f/=g)*f+a
1708        },
1709    easeOutQuad:function(e,f,a,h,g){
1710        return -h*(f/=g)*(f-2)+a
1711        },
1712    easeInOutQuad:function(e,f,a,h,g){
1713        if((f/=g/2)<1){
1714            return h/2*f*f+a
1715            }
1716            return -h/2*((--f)*(f-2)-1)+a
1717        },
1718    easeInCubic:function(e,f,a,h,g){
1719        return h*(f/=g)*f*f+a
1720        },
1721    easeOutCubic:function(e,f,a,h,g){
1722        return h*((f=f/g-1)*f*f+1)+a
1723        },
1724    easeInOutCubic:function(e,f,a,h,g){
1725        if((f/=g/2)<1){
1726            return h/2*f*f*f+a
1727            }
1728            return h/2*((f-=2)*f*f+2)+a
1729        },
1730    easeInQuart:function(e,f,a,h,g){
1731        return h*(f/=g)*f*f*f+a
1732        },
1733    easeOutQuart:function(e,f,a,h,g){
1734        return -h*((f=f/g-1)*f*f*f-1)+a
1735        },
1736    easeInOutQuart:function(e,f,a,h,g){
1737        if((f/=g/2)<1){
1738            return h/2*f*f*f*f+a
1739            }
1740            return -h/2*((f-=2)*f*f*f-2)+a
1741        },
1742    easeInQuint:function(e,f,a,h,g){
1743        return h*(f/=g)*f*f*f*f+a
1744        },
1745    easeOutQuint:function(e,f,a,h,g){
1746        return h*((f=f/g-1)*f*f*f*f+1)+a
1747        },
1748    easeInOutQuint:function(e,f,a,h,g){
1749        if((f/=g/2)<1){
1750            return h/2*f*f*f*f*f+a
1751            }
1752            return h/2*((f-=2)*f*f*f*f+2)+a
1753        },
1754    easeInSine:function(e,f,a,h,g){
1755        return -h*Math.cos(f/g*(Math.PI/2))+h+a
1756        },
1757    easeOutSine:function(e,f,a,h,g){
1758        return h*Math.sin(f/g*(Math.PI/2))+a
1759        },
1760    easeInOutSine:function(e,f,a,h,g){
1761        return -h/2*(Math.cos(Math.PI*f/g)-1)+a
1762        },
1763    easeInExpo:function(e,f,a,h,g){
1764        return(f==0)?a:h*Math.pow(2,10*(f/g-1))+a
1765        },
1766    easeOutExpo:function(e,f,a,h,g){
1767        return(f==g)?a+h:h*(-Math.pow(2,-10*f/g)+1)+a
1768        },
1769    easeInOutExpo:function(e,f,a,h,g){
1770        if(f==0){
1771            return a
1772            }
1773            if(f==g){
1774            return a+h
1775            }
1776            if((f/=g/2)<1){
1777            return h/2*Math.pow(2,10*(f-1))+a
1778            }
1779            return h/2*(-Math.pow(2,-10*--f)+2)+a
1780        },
1781    easeInCirc:function(e,f,a,h,g){
1782        return -h*(Math.sqrt(1-(f/=g)*f)-1)+a
1783        },
1784    easeOutCirc:function(e,f,a,h,g){
1785        return h*Math.sqrt(1-(f=f/g-1)*f)+a
1786        },
1787    easeInOutCirc:function(e,f,a,h,g){
1788        if((f/=g/2)<1){
1789            return -h/2*(Math.sqrt(1-f*f)-1)+a
1790            }
1791            return h/2*(Math.sqrt(1-(f-=2)*f)+1)+a
1792        },
1793    easeInElastic:function(f,h,e,l,k){
1794        var i=1.70158;
1795        var j=0;
1796        var g=l;
1797        if(h==0){
1798            return e
1799            }
1800            if((h/=k)==1){
1801            return e+l
1802            }
1803            if(!j){
1804            j=k*0.3
1805            }
1806            if(g<Math.abs(l)){
1807            g=l;
1808            var i=j/4
1809            }else{
1810            var i=j/(2*Math.PI)*Math.asin(l/g)
1811            }
1812            return -(g*Math.pow(2,10*(h-=1))*Math.sin((h*k-i)*(2*Math.PI)/j))+e
1813        },
1814    easeOutElastic:function(f,h,e,l,k){
1815        var i=1.70158;
1816        var j=0;
1817        var g=l;
1818        if(h==0){
1819            return e
1820            }
1821            if((h/=k)==1){
1822            return e+l
1823            }
1824            if(!j){
1825            j=k*0.3
1826            }
1827            if(g<Math.abs(l)){
1828            g=l;
1829            var i=j/4
1830            }else{
1831            var i=j/(2*Math.PI)*Math.asin(l/g)
1832            }
1833            return g*Math.pow(2,-10*h)*Math.sin((h*k-i)*(2*Math.PI)/j)+l+e
1834        },
1835    easeInOutElastic:function(f,h,e,l,k){
1836        var i=1.70158;
1837        var j=0;
1838        var g=l;
1839        if(h==0){
1840            return e
1841            }
1842            if((h/=k/2)==2){
1843            return e+l
1844            }
1845            if(!j){
1846            j=k*(0.3*1.5)
1847            }
1848            if(g<Math.abs(l)){
1849            g=l;
1850            var i=j/4
1851            }else{
1852            var i=j/(2*Math.PI)*Math.asin(l/g)
1853            }
1854            if(h<1){
1855            return -0.5*(g*Math.pow(2,10*(h-=1))*Math.sin((h*k-i)*(2*Math.PI)/j))+e
1856            }
1857            return g*Math.pow(2,-10*(h-=1))*Math.sin((h*k-i)*(2*Math.PI)/j)*0.5+l+e
1858        },
1859    easeInBack:function(e,f,a,i,h,g){
1860        if(g==undefined){
1861            g=1.70158
1862            }
1863            return i*(f/=h)*f*((g+1)*f-g)+a
1864        },
1865    easeOutBack:function(e,f,a,i,h,g){
1866        if(g==undefined){
1867            g=1.70158
1868            }
1869            return i*((f=f/h-1)*f*((g+1)*f+g)+1)+a
1870        },
1871    easeInOutBack:function(e,f,a,i,h,g){
1872        if(g==undefined){
1873            g=1.70158
1874            }
1875            if((f/=h/2)<1){
1876            return i/2*(f*f*(((g*=(1.525))+1)*f-g))+a
1877            }
1878            return i/2*((f-=2)*f*(((g*=(1.525))+1)*f+g)+2)+a
1879        },
1880    easeInBounce:function(e,f,a,h,g){
1881        return h-jQuery.easing.easeOutBounce(e,g-f,0,h,g)+a
1882        },
1883    easeOutBounce:function(e,f,a,h,g){
1884        if((f/=g)<(1/2.75)){
1885            return h*(7.5625*f*f)+a
1886            }else{
1887            if(f<(2/2.75)){
1888                return h*(7.5625*(f-=(1.5/2.75))*f+0.75)+a
1889                }else{
1890                if(f<(2.5/2.75)){
1891                    return h*(7.5625*(f-=(2.25/2.75))*f+0.9375)+a
1892                    }else{
1893                    return h*(7.5625*(f-=(2.625/2.75))*f+0.984375)+a
1894                    }
1895                }
1896        }
1897},
1898easeInOutBounce:function(e,f,a,h,g){
1899    if(f<g/2){
1900        return jQuery.easing.easeInBounce(e,f*2,0,h,g)*0.5+a
1901        }
1902        return jQuery.easing.easeOutBounce(e,f*2-g,0,h,g)*0.5+h*0.5+a
1903    }
1904});
1905
1906/* jQuery Cookie plugin */
1907jQuery.cookie=function(name,value,options){
1908    if(typeof value!='undefined'){
1909        options=options||{};
1910        
1911        if(value===null){
1912            value='';
1913            options.expires=-1;
1914        }
1915        var expires='';
1916        if(options.expires&&(typeof options.expires=='number'||options.expires.toUTCString)){
1917            var date;
1918            if(typeof options.expires=='number'){
1919                date=new Date();
1920                date.setTime(date.getTime()+(options.expires*24*60*60*1000));
1921            }else{
1922                date=options.expires;
1923            }
1924            expires='; expires='+date.toUTCString();
1925        }
1926        var path=options.path?'; path='+(options.path):'';
1927        var domain=options.domain?'; domain='+(options.domain):'';
1928        var secure=options.secure?'; secure':'';
1929        document.cookie=[name,'=',encodeURIComponent(value),expires,path,domain,secure].join('');
1930    }else{
1931        var cookieValue=null;
1932        if(document.cookie&&document.cookie!=''){
1933            var cookies=document.cookie.split(';');
1934            for(var i=0;i<cookies.length;i++){
1935                var cookie=jQuery.trim(cookies[i]);
1936                if(cookie.substring(0,name.length+1)==(name+'=')){
1937                    cookieValue=decodeURIComponent(cookie.substring(name.length+1));
1938                    break;
1939                }
1940            }
1941            }
1942        return cookieValue;
1943}
1944};
1945
1946/* jQuery querystring plugin */
1947eval(function(p,a,c,k,e,d){
1948    e=function(c){
1949        return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))
1950        };
1951        
1952    if(!''.replace(/^/,String)){
1953        while(c--){
1954            d[e(c)]=k[c]||e(c)
1955            }
1956            k=[function(e){
1957            return d[e]
1958            }];
1959        e=function(){
1960            return'\\w+'
1961            };
1962            
1963        c=1
1964        };
1965    while(c--){
1966        if(k[c]){
1967            p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])
1968            }
1969        }
1970    return p
1971}('M 6(A){4 $11=A.11||\'&\';4 $V=A.V===r?r:j;4 $1p=A.1p===r?\'\':\'[]\';4 $13=A.13===r?r:j;4 $D=$13?A.D===j?"#":"?":"";4 $15=A.15===r?r:j;v.1o=M 6(){4 f=6(o,t){8 o!=1v&&o!==x&&(!!t?o.1t==t:j)};4 14=6(1m){4 m,1l=/\\[([^[]*)\\]/g,T=/^([^[]+)(\\[.*\\])?$/.1r(1m),k=T[1],e=[];19(m=1l.1r(T[2]))e.u(m[1]);8[k,e]};4 w=6(3,e,7){4 o,y=e.1b();b(I 3!=\'X\')3=x;b(y===""){b(!3)3=[];b(f(3,L)){3.u(e.h==0?7:w(x,e.z(0),7))}n b(f(3,1a)){4 i=0;19(3[i++]!=x);3[--i]=e.h==0?7:w(3[i],e.z(0),7)}n{3=[];3.u(e.h==0?7:w(x,e.z(0),7))}}n b(y&&y.T(/^\\s*[0-9]+\\s*$/)){4 H=1c(y,10);b(!3)3=[];3[H]=e.h==0?7:w(3[H],e.z(0),7)}n b(y){4 H=y.B(/^\\s*|\\s*$/g,"");b(!3)3={};b(f(3,L)){4 18={};1w(4 i=0;i<3.h;++i){18[i]=3[i]}3=18}3[H]=e.h==0?7:w(3[H],e.z(0),7)}n{8 7}8 3};4 C=6(a){4 p=d;p.l={};b(a.C){v.J(a.Z(),6(5,c){p.O(5,c)})}n{v.J(1u,6(){4 q=""+d;q=q.B(/^[?#]/,\'\');q=q.B(/[;&]$/,\'\');b($V)q=q.B(/[+]/g,\' \');v.J(q.Y(/[&;]/),6(){4 5=1e(d.Y(\'=\')[0]||"");4 c=1e(d.Y(\'=\')[1]||"");b(!5)8;b($15){b(/^[+-]?[0-9]+\\.[0-9]*$/.1d(c))c=1A(c);n b(/^[+-]?[0-9]+$/.1d(c))c=1c(c,10)}c=(!c&&c!==0)?j:c;b(c!==r&&c!==j&&I c!=\'1g\')c=c;p.O(5,c)})})}8 p};C.1H={C:j,1G:6(5,1f){4 7=d.Z(5);8 f(7,1f)},1h:6(5){b(!f(5))8 d.l;4 K=14(5),k=K[0],e=K[1];4 3=d.l[k];19(3!=x&&e.h!=0){3=3[e.1b()]}8 I 3==\'1g\'?3:3||""},Z:6(5){4 3=d.1h(5);b(f(3,1a))8 v.1E(j,{},3);n b(f(3,L))8 3.z(0);8 3},O:6(5,c){4 7=!f(c)?x:c;4 K=14(5),k=K[0],e=K[1];4 3=d.l[k];d.l[k]=w(3,e.z(0),7);8 d},w:6(5,c){8 d.N().O(5,c)},1s:6(5){8 d.O(5,x).17()},1z:6(5){8 d.N().1s(5)},1j:6(){4 p=d;v.J(p.l,6(5,7){1y p.l[5]});8 p},1F:6(Q){4 D=Q.B(/^.*?[#](.+?)(?:\\?.+)?$/,"$1");4 S=Q.B(/^.*?[?](.+?)(?:#.+)?$/,"$1");
19718 M C(Q.h==S.h?\'\':S,Q.h==D.h?\'\':D)},1x:6(){8 d.N().1j()},N:6(){8 M C(d)},17:6(){6 F(G){4 R=I G=="X"?f(G,L)?[]:{}:G;b(I G==\'X\'){6 1k(o,5,7){b(f(o,L))o.u(7);n o[5]=7}v.J(G,6(5,7){b(!f(7))8 j;1k(R,5,F(7))})}8 R}d.l=F(d.l);8 d},1B:6(){8 d.N().17()},1D:6(){4 i=0,U=[],W=[],p=d;4 16=6(E){E=E+"";b($V)E=E.B(/ /g,"+");8 1C(E)};4 1n=6(1i,5,7){b(!f(7)||7===r)8;4 o=[16(5)];b(7!==j){o.u("=");o.u(16(7))}1i.u(o.P(""))};4 F=6(R,k){4 12=6(5){8!k||k==""?[5].P(""):[k,"[",5,"]"].P("")};v.J(R,6(5,7){b(I 7==\'X\')F(7,12(5));n 1n(W,12(5),7)})};F(d.l);b(W.h>0)U.u($D);U.u(W.P($11));8 U.P("")}};8 M C(1q.S,1q.D)}}(v.1o||{});',62,106,'|||target|var|key|function|value|return|||if|val|this|tokens|is||length||true|base|keys||else||self||false|||push|jQuery|set|null|token|slice|settings|replace|queryObject|hash|str|build|orig|index|typeof|each|parsed|Array|new|copy|SET|join|url|obj|search|match|queryString|spaces|chunks|object|split|get||separator|newKey|prefix|parse|numbers|encode|COMPACT|temp|while|Object|shift|parseInt|test|decodeURIComponent|type|number|GET|arr|EMPTY|add|rx|path|addFields|query|suffix|location|exec|REMOVE|constructor|arguments|undefined|for|empty|delete|remove|parseFloat|compact|encodeURIComponent|toString|extend|load|has|prototype'.split('|'),0,{}))

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.