// source --> https://realty.tm.crimea.ua/wp-content/plugins/buddypress/bp-templates/bp-legacy/js/buddypress.min.js?ver=4.1.0
function bp_get_directory_preference(e,t){var i={filter:"",scope:"",extras:""};if(!directoryPreferences.hasOwnProperty(e)){var a={};for(var s in i)i.hasOwnProperty(s)&&(a[s]=i[s]);directoryPreferences[e]=a}return BP_DTheme.store_filter_settings&&(directoryPreferences[e][t]=jq.cookie("bp-"+e+"-"+t)),directoryPreferences[e][t]}function bp_set_directory_preference(e,t,i){var a={filter:"",scope:"",extras:""};if(!directoryPreferences.hasOwnProperty(e)){var s={};for(var r in a)a.hasOwnProperty(r)&&(s[r]=a[r]);directoryPreferences[e]=s}BP_DTheme.store_filter_settings&&jq.cookie("bp-"+e+"-"+t,i,{path:"/",secure:"https:"===window.location.protocol}),directoryPreferences[e][t]=i}function bp_init_activity(){var e=bp_get_directory_preference("activity","scope"),t=bp_get_directory_preference("activity","filter");void 0!==t&&jq("#activity-filter-select").length&&jq('#activity-filter-select select option[value="'+t+'"]').prop("selected",!0),void 0!==e&&jq(".activity-type-tabs").length&&(jq(".activity-type-tabs li").each(function(){jq(this).removeClass("selected")}),jq("#activity-"+e+", .item-list-tabs li.current").addClass("selected"))}function bp_init_objects(e){jq(e).each(function(t){var i=bp_get_directory_preference(e[t],"scope"),a=bp_get_directory_preference(e[t],"filter");void 0!==a&&jq("#"+e[t]+"-order-select select").length&&jq("#"+e[t]+'-order-select select option[value="'+a+'"]').prop("selected",!0),void 0!==i&&jq("div."+e[t]).length&&(jq(".item-list-tabs li").each(function(){jq(this).removeClass("selected")}),jq("#"+e[t]+"-"+i+", #object-nav li.current").addClass("selected"))})}function bp_filter_request(e,t,i,a,s,r,n,o,c){if("activity"===e)return!1;null===i&&(i="all"),bp_set_directory_preference(e,"scope",i),bp_set_directory_preference(e,"filter",t),bp_set_directory_preference(e,"extras",n),jq(".item-list-tabs li").each(function(){jq(this).removeClass("selected")}),jq("#"+e+"-"+i+", #object-nav li.current").addClass("selected"),jq(".item-list-tabs li.selected").addClass("loading"),jq('.item-list-tabs select option[value="'+t+'"]').prop("selected",!0),"friends"!==e&&"group_members"!==e||(e="members"),bp_ajax_request&&bp_ajax_request.abort(),bp_ajax_request=jq.post(ajaxurl,{action:e+"_filter",cookie:bp_get_cookies(),object:e,filter:t,search_terms:s,scope:i,page:r,extras:n,template:c},function(e){if("pag-bottom"===o&&jq("#subnav").length){var t=jq("#subnav").parent();jq("html,body").animate({scrollTop:t.offset().top},"slow",function(){jq(a).fadeOut(100,function(){jq(this).html(e),jq(this).fadeIn(100)})})}else jq(a).fadeOut(100,function(){jq(this).html(e),jq(this).fadeIn(100)});jq(".item-list-tabs li.selected").removeClass("loading")})}function bp_activity_request(e,t){bp_set_directory_preference("activity","scope",e),bp_set_directory_preference("activity","filter",t),jq(".item-list-tabs li").each(function(){jq(this).removeClass("selected loading")}),jq("#activity-"+e+", .item-list-tabs li.current").addClass("selected"),jq("#object-nav.item-list-tabs li.selected, div.activity-type-tabs li.selected").addClass("loading"),jq('#activity-filter-select select option[value="'+t+'"]').prop("selected",!0),jq(".widget_bp_activity_widget h2 span.ajax-loader").show(),bp_ajax_request&&bp_ajax_request.abort();var i={"bp-activity-filter":bp_get_directory_preference("activity","filter"),"bp-activity-scope":bp_get_directory_preference("activity","scope")},a=encodeURIComponent(jq.param(i));bp_ajax_request=jq.post(ajaxurl,{action:"activity_widget_filter",cookie:a,_wpnonce_activity_filter:jq("#_wpnonce_activity_filter").val(),scope:e,filter:t},function(e){jq(".widget_bp_activity_widget h2 span.ajax-loader").hide(),jq("div.activity").fadeOut(100,function(){jq(this).html(e.contents),jq(this).fadeIn(100),bp_legacy_theme_hide_comments()}),void 0!==e.feed_url&&jq(".directory #subnav li.feed a, .home-page #subnav li.feed a").attr("href",e.feed_url),jq(".item-list-tabs li.selected").removeClass("loading")},"json")}function bp_legacy_theme_hide_comments(){var e,t,i,a=jq("div.activity-comments");if(!a.length)return!1;a.each(function(){jq(this).children("ul").children("li").length<5||(comments_div=jq(this),e=comments_div.parents("#activity-stream > li"),t=jq(this).children("ul").children("li"),i=" ",jq("#"+e.attr("id")+" li").length&&(i=jq("#"+e.attr("id")+" li").length),t.each(function(a){a'+BP_DTheme.show_x_comments.replace("%d",i)+""))}))})}function checkAll(){var e,t=document.getElementsByTagName("input");for(e=0;e0&&(object=jq("#whats-new-post-object").val()),e=jq.extend({action:"post_update",cookie:bp_get_cookies(),_wpnonce_post_update:jq("#_wpnonce_post_update").val(),content:content,object:object,item_id:item_id,since:t,_bp_as_nonce:jq("#_bp_as_nonce").val()||""},s),jq.post(ajaxurl,e,function(e){if(a.find("*").each(function(){(jq.nodeName(this,"textarea")||jq.nodeName(this,"input"))&&jq(this).prop("disabled",!1)}),e[0]+e[1]==="-1")a.prepend(e.substr(2,e.length)),jq("#"+a.attr("id")+" div.error").hide().fadeIn(200);else{if(0===jq("ul.activity-list").length&&(jq("div.error").slideUp(100).remove(),jq("#message").slideUp(100).remove(),jq("div.activity").append('')),firstrow.hasClass("load-newest")&&firstrow.remove(),jq("#activity-stream").prepend(e),t||jq("#activity-stream li:first").addClass("new-update just-posted"),0!==jq("#latest-update").length){var i=jq("#activity-stream li.new-update .activity-content .activity-inner p").html(),s=jq("#activity-stream li.new-update .activity-content .activity-header p a.view").attr("href"),r="";""!==jq("#activity-stream li.new-update .activity-content .activity-inner p").text()&&(r=i+" "),r+=''+BP_DTheme.view+"",jq("#latest-update").slideUp(300,function(){jq("#latest-update").html(r),jq("#latest-update").slideDown(300)})}jq("li.new-update").hide().slideDown(300),jq("li.new-update").removeClass("new-update"),jq("#whats-new").val(""),a.get(0).reset(),newest_activities="",activity_last_recorded=0}jq("#whats-new-options").slideUp(),jq("#whats-new-form textarea").animate({height:"2.2em"}),jq("#aw-whats-new-submit").prop("disabled",!0).removeClass("loading"),jq("#whats-new-content").removeClass("active")}),!1}),jq("div.activity-type-tabs").on("click",function(e){var t,i,a=jq(e.target).parent();if("STRONG"===e.target.nodeName||"SPAN"===e.target.nodeName)a=a.parent();else if("A"!==e.target.nodeName)return!1;return t=a.attr("id").substr(9,a.attr("id").length),i=jq("#activity-filter-select select").val(),"mentions"===t&&jq("#"+a.attr("id")+" a strong").remove(),bp_activity_request(t,i),!1}),jq("#activity-filter-select select").change(function(){var e,t=jq("div.activity-type-tabs li.selected"),i=jq(this).val();return e=t.length?t.attr("id").substr(9,t.attr("id").length):null,bp_activity_request(e,i),!1}),jq("div.activity").on("click",function(t){var i,a,s,r,n,o,c,l,d,p,u=jq(t.target);return u.hasClass("fav")||u.hasClass("unfav")?!u.hasClass("loading")&&(i=u.hasClass("fav")?"fav":"unfav",a=u.closest(".activity-item"),s=a.attr("id").substr(9,a.attr("id").length),c=bp_get_query_var("_wpnonce",u.attr("href")),u.addClass("loading"),jq.post(ajaxurl,{action:"activity_mark_"+i,cookie:bp_get_cookies(),id:s,nonce:c},function(e){u.removeClass("loading"),u.fadeOut(200,function(){jq(this).html(e),jq(this).attr("title","fav"===i?BP_DTheme.remove_fav:BP_DTheme.mark_as_fav),jq(this).fadeIn(200)}),"fav"===i?(jq(".item-list-tabs #activity-favs-personal-li").length||(jq(".item-list-tabs #activity-favorites").length||jq(".item-list-tabs ul #activity-mentions").before('- '+BP_DTheme.my_favs+" 0
"),jq(".item-list-tabs ul #activity-favorites span").html(Number(jq(".item-list-tabs ul #activity-favorites span").html())+1)),u.removeClass("fav"),u.addClass("unfav")):(u.removeClass("unfav"),u.addClass("fav"),jq(".item-list-tabs ul #activity-favorites span").html(Number(jq(".item-list-tabs ul #activity-favorites span").html())-1),Number(jq(".item-list-tabs ul #activity-favorites span").html())||(jq(".item-list-tabs ul #activity-favorites").hasClass("selected")&&bp_activity_request(null,null),jq(".item-list-tabs ul #activity-favorites").remove())),"activity-favorites"===jq(".item-list-tabs li.selected").attr("id")&&u.closest(".activity-item").slideUp(100)}),!1):u.hasClass("delete-activity")?(r=u.parents("div.activity ul li"),n=r.attr("id").substr(9,r.attr("id").length),o=u.attr("href"),c=o.split("_wpnonce="),l=r.prop("class").match(/date-recorded-([0-9]+)/),c=c[1],u.addClass("loading"),jq.post(ajaxurl,{action:"delete_activity",cookie:bp_get_cookies(),id:n,_wpnonce:c},function(e){e[0]+e[1]==="-1"?(r.prepend(e.substr(2,e.length)),r.children("#message").hide().fadeIn(300)):(r.slideUp(300),l&&activity_last_recorded===l[1]&&(newest_activities="",activity_last_recorded=0))}),!1):u.hasClass("spam-activity")?(r=u.parents("div.activity ul li"),l=r.prop("class").match(/date-recorded-([0-9]+)/),u.addClass("loading"),jq.post(ajaxurl,{action:"bp_spam_activity",cookie:encodeURIComponent(document.cookie),id:r.attr("id").substr(9,r.attr("id").length),_wpnonce:u.attr("href").split("_wpnonce=")[1]},function(e){e[0]+e[1]==="-1"?(r.prepend(e.substr(2,e.length)),r.children("#message").hide().fadeIn(300)):(r.slideUp(300),l&&activity_last_recorded===l[1]&&(newest_activities="",activity_last_recorded=0))}),!1):u.parent().hasClass("load-more")?(bp_ajax_request&&bp_ajax_request.abort(),jq("#buddypress li.load-more").addClass("loading"),d=e+1,p=[],jq(".activity-list li.just-posted").each(function(){p.push(jq(this).attr("id").replace("activity-",""))}),load_more_args={action:"activity_get_older_updates",cookie:bp_get_cookies(),page:d,exclude_just_posted:p.join(",")},load_more_search=bp_get_querystring("s"),load_more_search&&(load_more_args.search_terms=load_more_search),bp_ajax_request=jq.post(ajaxurl,load_more_args,function(t){jq("#buddypress li.load-more").removeClass("loading"),e=d,jq("#buddypress ul.activity-list").append(t.contents),u.parent().hide()},"json"),!1):void(u.parent().hasClass("load-newest")&&(t.preventDefault(),u.parent().hide(),activity_html=jq.parseHTML(newest_activities),jq.each(activity_html,function(e,t){"LI"===t.nodeName&&jq(t).hasClass("just-posted")&&jq("#"+jq(t).attr("id")).length&&jq("#"+jq(t).attr("id")).remove()}),jq("#buddypress ul.activity-list").prepend(newest_activities),newest_activities=""))}),jq("div.activity").on("click",".activity-read-more a",function(e){var t,i,a=jq(e.target),s=a.parent().attr("id").split("-"),r=s[3],n=s[0];return t="acomment"===n?"acomment-content":"activity-inner",i=jq("#"+n+"-"+r+" ."+t+":first"),jq(a).addClass("loading"),jq.post(ajaxurl,{action:"get_single_activity_content",activity_id:r},function(e){jq(i).slideUp(300).html(e).slideDown(300)}),!1}),jq("form.ac-form").hide(),jq(".activity-comments").length&&bp_legacy_theme_hide_comments(),jq("div.activity").on("click",function(e){var t,i,a,s,r,n,o,c,l,d,p,u,m,h,_,v=jq(e.target);return v.hasClass("acomment-reply")||v.parent().hasClass("acomment-reply")?(v.parent().hasClass("acomment-reply")&&(v=v.parent()),t=v.attr("id"),i=t.split("-"),a=i[2],s=v.attr("href").substr(10,v.attr("href").length),(r=jq("#ac-form-"+a)).css("display","none"),r.removeClass("root"),jq(".ac-form").hide(),r.children("div").each(function(){jq(this).hasClass("error")&&jq(this).hide()}),"comment"!==i[1]?jq("#acomment-"+s).append(r):jq("#activity-"+a+" .activity-comments").append(r),r.parent().hasClass("activity-comments")&&r.addClass("root"),r.slideDown(200),jq.scrollTo(r,500,{offset:-100,easing:"swing"}),jq("#ac-form-"+i[2]+" textarea").focus(),!1):"ac_form_submit"===v.attr("name")?(r=v.parents("form"),n=r.parent(),o=r.attr("id").split("-"),c=n.hasClass("activity-comments")?o[2]:n.attr("id").split("-")[1],content=jq("#"+r.attr("id")+" textarea"),jq("#"+r.attr("id")+" div.error").hide(),v.addClass("loading").prop("disabled",!0),content.addClass("loading").prop("disabled",!0),l={action:"new_activity_comment",cookie:bp_get_cookies(),_wpnonce_new_activity_comment:jq("#_wpnonce_new_activity_comment").val(),comment_id:c,form_id:o[2],content:content.val()},(d=jq("#_bp_as_nonce_"+c).val())&&(l["_bp_as_nonce_"+c]=d),jq.post(ajaxurl,l,function(e){if(v.removeClass("loading"),content.removeClass("loading"),e[0]+e[1]==="-1")r.append(jq(e.substr(2,e.length)).hide().fadeIn(200));else{var t=r.parent();r.fadeOut(200,function(){0===t.children("ul").length&&(t.hasClass("activity-comments")?t.prepend(""):t.append(""));var i=jq.trim(e);t.children("ul").append(jq(i).hide().fadeIn(200)),r.children("textarea").val(""),t.parent().addClass("has-comments")}),jq("#"+r.attr("id")+" textarea").val(""),u=Number(jq("#activity-"+o[2]+" a.acomment-reply span").html())+1,jq("#activity-"+o[2]+" a.acomment-reply span").html(u),(p=t.parents(".activity-comments").find(".show-all a"))&&p.html(BP_DTheme.show_x_comments.replace("%d",u))}jq(v).prop("disabled",!1),jq(content).prop("disabled",!1)}),!1):v.hasClass("acomment-delete")?(m=v.attr("href"),h=v.parent().parent(),r=h.parents("div.activity-comments").children("form"),_=m.split("_wpnonce="),_=_[1],c=m.split("cid="),c=c[1].split("&"),c=c[0],v.addClass("loading"),jq(".activity-comments ul .error").remove(),h.parents(".activity-comments").append(r),jq.post(ajaxurl,{action:"delete_activity_comment",cookie:bp_get_cookies(),_wpnonce:_,id:c},function(e){if(e[0]+e[1]==="-1")h.prepend(jq(e.substr(2,e.length)).hide().fadeIn(200));else{var t,i,a,s=jq("#"+h.attr("id")+" ul").children("li"),r=0;jq(s).each(function(){jq(this).is(":hidden")||r++}),h.fadeOut(200,function(){h.remove()}),i=(t=jq("#"+h.parents("#activity-stream > li").attr("id")+" a.acomment-reply span")).html()-(1+r),t.html(i),(a=h.parents(".activity-comments").find(".show-all a"))&&a.html(BP_DTheme.show_x_comments.replace("%d",i)),0===i&&jq(h.parents("#activity-stream > li")).removeClass("has-comments")}}),!1):v.hasClass("spam-activity-comment")?(m=v.attr("href"),h=v.parent().parent(),v.addClass("loading"),jq(".activity-comments ul div.error").remove(),h.parents(".activity-comments").append(h.parents(".activity-comments").children("form")),jq.post(ajaxurl,{action:"bp_spam_activity_comment",cookie:encodeURIComponent(document.cookie),_wpnonce:m.split("_wpnonce=")[1],id:m.split("cid=")[1].split("&")[0]},function(e){if(e[0]+e[1]==="-1")h.prepend(jq(e.substr(2,e.length)).hide().fadeIn(200));else{var t,i=jq("#"+h.attr("id")+" ul").children("li"),a=0;jq(i).each(function(){jq(this).is(":hidden")||a++}),h.fadeOut(200),t=h.parents("#activity-stream > li"),jq("#"+t.attr("id")+" a.acomment-reply span").html(jq("#"+t.attr("id")+" a.acomment-reply span").html()-(1+a))}}),!1):v.parent().hasClass("show-all")?(v.parent().addClass("loading"),setTimeout(function(){v.parent().parent().children("li").fadeIn(200,function(){v.parent().remove()})},600),!1):v.hasClass("ac-reply-cancel")?(jq(v).closest(".ac-form").slideUp(200),!1):void 0}),jq(document).keydown(function(e){(e=e||window.event).target?element=e.target:e.srcElement&&(element=e.srcElement),3===element.nodeType&&(element=element.parentNode),!0!==e.ctrlKey&&!0!==e.altKey&&!0!==e.metaKey&&27===(e.keyCode?e.keyCode:e.which)&&"TEXTAREA"===element.tagName&&jq(element).hasClass("ac-input")&&jq(element).parent().parent().parent().slideUp(200)}),jq(".dir-search, .groups-members-search").on("click",function(e){if(!jq(this).hasClass("no-ajax")){var t,i,a,s=jq(e.target);if("submit"===s.attr("type")){t=jq(".item-list-tabs li.selected").attr("id").split("-")[0],i=null,a=s.parent().find("#"+t+"_search").val(),"groups-members-search"===e.currentTarget.className&&(t="group_members",i="groups/single/members");var r=bp_get_directory_preference(t,"scope");return bp_filter_request(t,bp_get_directory_preference(t,"filter"),r,"div."+t,a,1,bp_get_directory_preference(t,"extras"),null,i),!1}}}),jq("div.item-list-tabs").on("click",function(e){if(jq("body").hasClass("type")&&jq("body").hasClass("directory")&&jq(this).addClass("no-ajax"),!jq(this).hasClass("no-ajax")&&!jq(e.target).hasClass("no-ajax")){var t,i,a,s="SPAN"===e.target.nodeName?e.target.parentNode:e.target,r=jq(s).parent();return"LI"!==r[0].nodeName||r.hasClass("last")?void 0:(t=r.attr("id").split("-"),"activity"!==(i=t[0])&&(a=t[1],bp_filter_request(i,jq("#"+i+"-order-select select").val(),a,"div."+i,jq("#"+i+"_search").val(),1,bp_get_directory_preference(i,"extras")),!1))}}),jq("li.filter select").change(function(){var e,t,i,a,s,r,n;return t=(e=jq(jq(".item-list-tabs li.selected").length?".item-list-tabs li.selected":this).attr("id").split("-"))[0],i=e[1],a=jq(this).val(),s=!1,r=null,jq(".dir-search input").length&&(s=jq(".dir-search input").val()),(n=jq(".groups-members-search input")).length&&(s=n.val(),t="members",i="groups"),"members"===t&&"groups"===i&&(t="group_members",r="groups/single/members"),"friends"===t&&(t="members"),bp_filter_request(t,a,i,"div."+t,s,1,bp_get_directory_preference(t,"extras"),null,r),!1}),jq("#buddypress").on("click",function(e){var t,i,a,s,r,n,o,c,l=jq(e.target);if(l.hasClass("button"))return!0;if(l.parent().parent().hasClass("pagination")&&!l.parent().parent().hasClass("no-ajax")){if(l.hasClass("dots")||l.hasClass("current"))return!1;i=(t=jq(jq(".item-list-tabs li.selected").length?".item-list-tabs li.selected":"li.filter select").attr("id").split("-"))[0],a=!1,s=jq(l).closest(".pagination-links").attr("id"),r=null,jq("div.dir-search input").length&&(a=!(a=jq(".dir-search input")).val()&&bp_get_querystring(a.attr("name"))?jq(".dir-search input").prop("placeholder"):a.val()),n=jq(l).hasClass("next")||jq(l).hasClass("prev")?jq(".pagination span.current").html():jq(l).html(),n=Number(n.replace(/\D/g,"")),jq(l).hasClass("next")?n++:jq(l).hasClass("prev")&&n--,(o=jq(".groups-members-search input")).length&&(a=o.val(),i="members"),"members"===i&&"groups"===t[1]&&(i="group_members",r="groups/single/members"),"admin"===i&&jq("body").hasClass("membership-requests")&&(i="requests"),c=-1!==s.indexOf("pag-bottom")?"pag-bottom":null;var d=bp_get_directory_preference(i,"scope");return bp_filter_request(i,bp_get_directory_preference(i,"filter"),d,"div."+i,a,n,bp_get_directory_preference(i,"extras"),c,r),!1}}),jq("#send-invite-form").on("click","#invite-list input",function(){var e,t,i=jq("#send-invite-form > .invite").length;jq(".ajax-loader").toggle(),i&&jq(this).parents("ul").find("input").prop("disabled",!0),e=jq(this).val(),t=!0===jq(this).prop("checked")?"invite":"uninvite",i||jq(".item-list-tabs li.selected").addClass("loading"),jq.post(ajaxurl,{action:"groups_invite_user",friend_action:t,cookie:bp_get_cookies(),_wpnonce:jq("#_wpnonce_invite_uninvite_user").val(),friend_id:e,group_id:jq("#group_id").val()},function(a){jq("#message")&&jq("#message").hide(),i?bp_filter_request("invite","bp-invite-filter","bp-invite-scope","div.invite",!1,1,"","",""):(jq(".ajax-loader").toggle(),"invite"===t?jq("#friend-list").append(a):"uninvite"===t&&jq("#friend-list li#uid-"+e).remove(),jq(".item-list-tabs li.selected").removeClass("loading"))})}),jq("#send-invite-form").on("click","a.remove",function(){var e=jq("#send-invite-form > .invite").length,t=jq(this).attr("id");return jq(".ajax-loader").toggle(),t=t.split("-"),t=t[1],jq.post(ajaxurl,{action:"groups_invite_user",friend_action:"uninvite",cookie:bp_get_cookies(),_wpnonce:jq("#_wpnonce_invite_uninvite_user").val(),friend_id:t,group_id:jq("#group_id").val()},function(i){e?bp_filter_request("invite","bp-invite-filter","bp-invite-scope","div.invite",!1,1,"","",""):(jq(".ajax-loader").toggle(),jq("#friend-list #uid-"+t).remove(),jq("#invite-list #f-"+t).prop("checked",!1))}),!1}),jq(".visibility-toggle-link").on("click",function(e){e.preventDefault(),jq(this).attr("aria-expanded","true").parent().hide().addClass("field-visibility-settings-hide").siblings(".field-visibility-settings").show().addClass("field-visibility-settings-open")}),jq(".field-visibility-settings-close").on("click",function(e){e.preventDefault(),jq(".visibility-toggle-link").attr("aria-expanded","false");var t=jq(this).parent(),i=t.find("input:checked").parent().text();t.hide().removeClass("field-visibility-settings-open").siblings(".field-visibility-settings-toggle").children(".current-visibility-level").text(i).end().show().removeClass("field-visibility-settings-hide")}),jq("#profile-edit-form input:not(:submit), #profile-edit-form textarea, #profile-edit-form select, #signup_form input:not(:submit), #signup_form textarea, #signup_form select").change(function(){var e=!0;jq("#profile-edit-form input:submit, #signup_form input:submit").on("click",function(){e=!1}),window.onbeforeunload=function(t){if(e)return BP_DTheme.unsaved_changes}}),jq("#friend-list a.accept, #friend-list a.reject").on("click",function(){var e,t=jq(this),i=jq(this).parents("#friend-list li"),a=jq(this).parents("li div.action"),s=i.attr("id").substr(11,i.attr("id").length),r=t.attr("href").split("_wpnonce=")[1];return!jq(this).hasClass("accepted")&&!jq(this).hasClass("rejected")&&(jq(this).hasClass("accept")?(e="accept_friendship",a.children("a.reject").css("visibility","hidden")):(e="reject_friendship",a.children("a.accept").css("visibility","hidden")),t.addClass("loading"),jq.post(ajaxurl,{action:e,cookie:bp_get_cookies(),id:s,_wpnonce:r},function(e){t.removeClass("loading"),e[0]+e[1]==="-1"?(i.prepend(e.substr(2,e.length)),i.children("#message").hide().fadeIn(200)):t.fadeOut(100,function(){jq(this).hasClass("accept")?(a.children("a.reject").hide(),jq(this).html(BP_DTheme.accepted).contents().unwrap()):(a.children("a.accept").hide(),jq(this).html(BP_DTheme.rejected).contents().unwrap())})}),!1)}),jq("#members-dir-list, #members-group-list, #item-header").on("click",".friendship-button a",function(){jq(this).parent().addClass("loading");var e=jq(this).attr("id"),t=jq(this).attr("href"),i=jq(this);return e=e.split("-"),e=e[1],t=t.split("?_wpnonce="),t=t[1].split("&"),t=t[0],jq.post(ajaxurl,{action:"addremove_friend",cookie:bp_get_cookies(),fid:e,_wpnonce:t},function(e){var t=i.attr("rel");parentdiv=i.parent(),"add"===t?jq(parentdiv).fadeOut(200,function(){parentdiv.removeClass("add_friend"),parentdiv.removeClass("loading"),parentdiv.addClass("pending_friend"),parentdiv.fadeIn(200).html(e)}):"remove"===t&&jq(parentdiv).fadeOut(200,function(){parentdiv.removeClass("remove_friend"),parentdiv.removeClass("loading"),parentdiv.addClass("add"),parentdiv.fadeIn(200).html(e)})}),!1}),jq("#buddypress").on("click",".group-button .leave-group",function(){if(!1===confirm(BP_DTheme.leave_group_confirm))return!1}),jq("#groups-dir-list").on("click",".group-button a",function(){var e=jq(this).parent().attr("id"),t=jq(this).attr("href"),i=jq(this);return e=e.split("-"),e=e[1],t=t.split("?_wpnonce="),t=t[1].split("&"),t=t[0],(!i.hasClass("leave-group")||!1!==confirm(BP_DTheme.leave_group_confirm))&&(jq.post(ajaxurl,{action:"joinleave_group",cookie:bp_get_cookies(),gid:e,_wpnonce:t},function(e){var t=i.parent();jq("body.directory").length?jq(t).fadeOut(200,function(){t.fadeIn(200).html(e);var a=jq("#groups-personal span"),s=1;i.hasClass("leave-group")?(t.hasClass("hidden")&&t.closest("li").slideUp(200),s=0):i.hasClass("request-membership")&&(s=!1),a.length&&!1!==s&&(s?a.text(1+(a.text()>>0)):a.text((a.text()>>0)-1))}):window.location.reload()}),!1)}),jq("#groups-list li.hidden").each(function(){"none"===jq(this).css("display")&&jq(this).css("cssText","display: list-item !important")}),jq("#buddypress").on("click",".pending",function(){return!1}),jq("body").hasClass("register")){var s=jq("#signup_with_blog");s.prop("checked")||jq("#blog-details").toggle(),s.change(function(){jq("#blog-details").toggle()})}jq(".message-search").on("click",function(e){if(!jq(this).hasClass("no-ajax")){var t,i=jq(e.target);if("submit"===i.attr("type")||"button"===i.attr("type")){var a=bp_get_directory_preference(t="messages","scope"),s=bp_get_directory_preference(t,"filter"),r=bp_get_directory_preference(t,"extras");return bp_filter_request(t,s,a,"div."+t,jq("#messages_search").val(),1,r),!1}}}),jq("#send_reply_button").click(function(){var e=jq("#messages_order").val()||"ASC",t=jq("#message-recipients").offset(),i=jq("#send_reply_button");return jq(i).addClass("loading").prop("disabled",!0),jq.post(ajaxurl,{action:"messages_send_reply",cookie:bp_get_cookies(),_wpnonce:jq("#send_message_nonce").val(),content:jq("#message_content").val(),send_to:jq("#send_to").val(),subject:jq("#subject").val(),thread_id:jq("#thread_id").val()},function(a){a[0]+a[1]==="-1"?jq("#send-reply").prepend(a.substr(2,a.length)):(jq("#send-reply #message").remove(),jq("#message_content").val(""),"ASC"===e?jq("#send-reply").before(a):(jq("#message-recipients").after(a),jq(window).scrollTop(t.top)),jq(".new-message").hide().slideDown(200,function(){jq(".new-message").removeClass("new-message")})),jq(i).removeClass("loading").prop("disabled",!1)}),!1}),jq("body.messages #item-body div.messages").on("change","#message-type-select",function(){var e=this.value,t=jq('td input[type="checkbox"]'),i="checked";switch(t.each(function(e){t[e].checked=""}),e){case"unread":t=jq('tr.unread td input[type="checkbox"]');break;case"read":t=jq('tr.read td input[type="checkbox"]');break;case"":i=""}t.each(function(e){t[e].checked=i})}),jq("#select-all-messages").click(function(e){this.checked?jq(".message-check").each(function(){this.checked=!0}):jq(".message-check").each(function(){this.checked=!1})}),jq("#messages-bulk-manage").attr("disabled","disabled"),jq("#messages-select").on("change",function(){jq("#messages-bulk-manage").attr("disabled",jq(this).val().length<=0)}),starAction=function(){var e=jq(this);return jq.post(ajaxurl,{action:"messages_star",message_id:e.data("message-id"),star_status:e.data("star-status"),nonce:e.data("star-nonce"),bulk:e.data("star-bulk")},function(t){1===parseInt(t,10)&&("unstar"===e.data("star-status")?(e.data("star-status","star"),e.removeClass("message-action-unstar").addClass("message-action-star"),e.find(".bp-screen-reader-text").text(BP_PM_Star.strings.text_star),1===BP_PM_Star.is_single_thread?e.attr("data-bp-tooltip",BP_PM_Star.strings.title_star):e.attr("data-bp-tooltip",BP_PM_Star.strings.title_star_thread)):(e.data("star-status","unstar"),e.removeClass("message-action-star").addClass("message-action-unstar"),e.find(".bp-screen-reader-text").text(BP_PM_Star.strings.text_unstar),1===BP_PM_Star.is_single_thread?e.attr("data-bp-tooltip",BP_PM_Star.strings.title_unstar):e.attr("data-bp-tooltip",BP_PM_Star.strings.title_unstar_thread)))}),!1},jq("#message-threads").on("click","td.thread-star a",starAction),jq("#message-thread").on("click",".message-star-actions a",starAction),jq("#message-threads td.bulk-select-check :checkbox").on("change",function(){var e=jq(this),t=e.closest("tr").find(".thread-star a");e.prop("checked")?"unstar"===t.data("star-status")?BP_PM_Star.star_counter++:BP_PM_Star.unstar_counter++:"unstar"===t.data("star-status")?BP_PM_Star.star_counter--:BP_PM_Star.unstar_counter--,BP_PM_Star.star_counter>0&&0===parseInt(BP_PM_Star.unstar_counter,10)?jq('option[value="star"]').hide():jq('option[value="star"]').show(),BP_PM_Star.unstar_counter>0&&0===parseInt(BP_PM_Star.star_counter,10)?jq('option[value="unstar"]').hide():jq('option[value="unstar"]').show()}),jq("#select-all-notifications").click(function(e){this.checked?jq(".notification-check").each(function(){this.checked=!0}):jq(".notification-check").each(function(){this.checked=!1})}),jq("#notification-bulk-manage").attr("disabled","disabled"),jq("#notification-select").on("change",function(){jq("#notification-bulk-manage").attr("disabled",jq(this).val().length<=0)}),jq("#close-notice").on("click",function(){return jq(this).addClass("loading"),jq("#sidebar div.error").remove(),jq.post(ajaxurl,{action:"messages_close_notice",notice_id:jq(".notice").attr("rel").substr(2,jq(".notice").attr("rel").length),nonce:jq("#close-notice-nonce").val()},function(e){jq("#close-notice").removeClass("loading"),e[0]+e[1]==="-1"?(jq(".notice").prepend(e.substr(2,e.length)),jq("#sidebar div.error").hide().fadeIn(200)):jq(".notice").slideUp(100)}),!1}),jq("#wp-admin-bar ul.main-nav li, #nav li").mouseover(function(){jq(this).addClass("sfhover")}),jq("#wp-admin-bar ul.main-nav li, #nav li").mouseout(function(){jq(this).removeClass("sfhover")}),jq("#wp-admin-bar-logout, a.logout").on("click",function(){jq.removeCookie("bp-activity-scope",{path:"/",secure:"https:"===window.location.protocol}),jq.removeCookie("bp-activity-filter",{path:"/",secure:"https:"===window.location.protocol}),jq.removeCookie("bp-activity-oldestpage",{path:"/",secure:"https:"===window.location.protocol});var e=["members","groups","blogs","forums"];jq(e).each(function(t){jq.removeCookie("bp-"+e[t]+"-scope",{path:"/",secure:"https:"===window.location.protocol}),jq.removeCookie("bp-"+e[t]+"-filter",{path:"/",secure:"https:"===window.location.protocol}),jq.removeCookie("bp-"+e[t]+"-extras",{path:"/",secure:"https:"===window.location.protocol})})}),jq("body").hasClass("no-js")&&jq("body").attr("class",jq("body").attr("class").replace(/no-js/,"js")),"undefined"!=typeof wp&&void 0!==wp.heartbeat&&void 0!==BP_DTheme.pulse&&(wp.heartbeat.interval(Number(BP_DTheme.pulse)),jq.fn.extend({"heartbeat-send":function(){return this.bind("heartbeat-send.buddypress")}}));var r=0;jq(document).on("heartbeat-send.buddypress",function(e,t){r=0,jq("#buddypress ul.activity-list li").first().prop("id")&&(timestamp=jq("#buddypress ul.activity-list li").first().prop("class").match(/date-recorded-([0-9]+)/),timestamp&&(r=timestamp[1])),(0===activity_last_recorded||Number(r)>activity_last_recorded)&&(activity_last_recorded=Number(r)),t.bp_activity_last_recorded=activity_last_recorded,last_recorded_search=bp_get_querystring("s"),last_recorded_search&&(t.bp_activity_last_recorded_search_terms=last_recorded_search)}),jq(document).on("heartbeat-tick",function(e,t){t.bp_activity_newest_activities&&(newest_activities=t.bp_activity_newest_activities.activities+newest_activities,activity_last_recorded=Number(t.bp_activity_newest_activities.last_recorded),jq("#buddypress ul.activity-list li").first().hasClass("load-newest")||jq("#buddypress ul.activity-list").prepend('- '+BP_DTheme.newest+"
"))})});