From d7280a1b27ebbe29c7850144bd3610ffed5a6ceb Mon Sep 17 00:00:00 2001 From: Amin Charoliya Date: Thu, 9 May 2024 17:00:20 +0530 Subject: [PATCH 1/4] [PROD-7208] Fix Prevent GIF picker from hiding when user clicks on search input --- src/bp-templates/bp-nouveau/js/buddypress-activity.js | 3 ++- src/bp-templates/bp-nouveau/js/buddypress-activity.min.js | 2 +- src/bp-templates/bp-nouveau/js/buddypress-media.js | 3 +++ src/bp-templates/bp-nouveau/js/buddypress-media.min.js | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/bp-templates/bp-nouveau/js/buddypress-activity.js b/src/bp-templates/bp-nouveau/js/buddypress-activity.js index f121d67861..ada36519f6 100644 --- a/src/bp-templates/bp-nouveau/js/buddypress-activity.js +++ b/src/bp-templates/bp-nouveau/js/buddypress-activity.js @@ -141,7 +141,8 @@ window.bp = window.bp || {}; if ( $( '#activity-modal:visible' ).length > 0 && 0 === $( '#bp-nouveau-activity-form-placeholder:visible' ).length && - ! $( event.target ).closest( '#activity-modal' ).length + ! $( event.target ).closest( '#activity-modal' ).length && + ! $( event.target ).closest( '.gif-media-search-dropdown-standalone' ).length ) { this.closeActivity( event ); this.activitySyncOnModalClose( event, activityId ); diff --git a/src/bp-templates/bp-nouveau/js/buddypress-activity.min.js b/src/bp-templates/bp-nouveau/js/buddypress-activity.min.js index 6496b7cc8b..b61713a294 100644 --- a/src/bp-templates/bp-nouveau/js/buddypress-activity.min.js +++ b/src/bp-templates/bp-nouveau/js/buddypress-activity.min.js @@ -1 +1 @@ -window.bp=window.bp||{},function(q){"undefined"!=typeof BP_Nouveau&&(bp.Nouveau=bp.Nouveau||{},bp.Models=bp.Models||{},bp.Models.ACReply=Backbone.Model.extend({defaults:{gif_data:{}}}),bp.Nouveau.Activity={start:function(){this.setupGlobals(),this.addListeners()},setupGlobals:function(){this.just_posted=[],this.current_page=1,this.mentions_count=Number(q(bp.Nouveau.objectNavParent+' [data-bp-scope="mentions"]').find("a span").html())||0,this.heartbeat_data={newest:"",highlights:{},last_recorded:0,first_recorded:0,document_title:q(document).prop("title")},void 0!==window.Dropzone&&void 0!==BP_Nouveau.media&&(window.Dropzone.autoDiscover=!1,this.dropzone_options={url:BP_Nouveau.ajaxurl,timeout:108e5,dictFileTooBig:BP_Nouveau.media.dictFileTooBig,dictDefaultMessage:BP_Nouveau.media.dropzone_media_message,acceptedFiles:"image/*",autoProcessQueue:!0,addRemoveLinks:!0,uploadMultiple:!1,maxFiles:void 0!==BP_Nouveau.media.maxFiles?BP_Nouveau.media.maxFiles:10,maxFilesize:void 0!==BP_Nouveau.media.max_upload_size?BP_Nouveau.media.max_upload_size:2,dictMaxFilesExceeded:BP_Nouveau.media.media_dict_file_exceeded,dictCancelUploadConfirmation:BP_Nouveau.media.dictCancelUploadConfirmation,maxThumbnailFilesize:void 0!==BP_Nouveau.media.max_upload_size?BP_Nouveau.media.max_upload_size:2},void 0!==BP_Nouveau.media.dropzone_options&&Object.assign(this.dropzone_options,BP_Nouveau.media.dropzone_options)),this.dropzone_obj=null,this.dropzone_media=[],this.dropzone_document_obj=null,this.dropzone_document=[],this.dropzone_video_obj=null,this.dropzone_video=[],this.models=[],this.InitiatedCommentForms=[],this.activityHasUpdates=!1,this.currentActivityId=null,this.activityPinHasUpdates=!1},addListeners:function(){q("body").hasClass("activity-singular")||q("#buddypress").on("bp_heartbeat_send",this.heartbeatSend.bind(this)),q("#buddypress").on("bp_heartbeat_tick",this.heartbeatTick.bind(this)),q('#buddypress [data-bp-list="activity"]').on("click","li.load-newest, li.load-more",this.injectActivities.bind(this)),q("#buddypress").on("bp_ajax_request",'[data-bp-list="activity"]',this.scopeLoaded.bind(this)),q("#activity-stream").on("click",".acomments-view-more",this.showActivity),q("body").on("click",".bb-close-action-popup",this.closeActivity),q(document).on("activityModalOpened",function(e,t){var a=t.activityId;q(document).on("click",function(e){0li.bb-edit-privacy a",bp.Nouveau,this.activityPrivacyRedirect.bind(this)),q('#buddypress [data-bp-list="activity"], #activity-modal').on("click",".activity-privacy>li:not(.bb-edit-privacy)",bp.Nouveau,this.activityPrivacyChange.bind(this)),q('#buddypress [data-bp-list="activity"], #bb-media-model-container .activity-list, #activity-modal').on("click","span.privacy",bp.Nouveau,this.togglePrivacyDropdown.bind(this)),q("#bb-media-model-container .activity-list").on("click",".activity-item",bp.Nouveau,this.activityActions.bind(this)),q(".bb-activity-model-wrapper").on("click",".ac-form-placeholder",bp.Nouveau,this.activityRootComment.bind(this)),q(document).keydown(this.commentFormAction),q(document).click(this.togglePopupDropdown),q('#buddypress [data-bp-list="activity"], #bb-media-model-container .activity-list, #activity-modal .activity-list, .bb-modal-activity-footer').on("click",".ac-reply-media-button",this.openCommentsMediaUploader.bind(this)),q('#buddypress [data-bp-list="activity"], #bb-media-model-container .activity-list, #activity-modal .activity-list, .bb-modal-activity-footer').on("click",".ac-reply-document-button",this.openCommentsDocumentUploader.bind(this)),q('#buddypress [data-bp-list="activity"], #bb-media-model-container .activity-list, #activity-modal .activity-list, .bb-modal-activity-footer').on("click",".ac-reply-video-button",this.openCommentsVideoUploader.bind(this)),q('#buddypress [data-bp-list="activity"], #bb-media-model-container .activity-list, #activity-modal .activity-list, .bb-modal-activity-footer').on("click",".ac-reply-gif-button",this.openGifPicker.bind(this)),q(document).on("click",this.toggleActivityOption.bind(this)),q(document).on("click",".activity-state-popup_overlay",bp.Nouveau,this.closeActivityState.bind(this)),q(document).on("click",".activity-state-popup .activity-state-popup_tab_panel a",this.ReactionStatePopupTab),_.isUndefined(BP_Nouveau.activity.params.autoload)||q(window).scroll(this.loadMoreActivities),q(".bb-activity-model-wrapper, .bb-media-model-wrapper").on("click",".acomments-view-more",this.viewMoreComments.bind(this)),q(document).on("click","#activity-stream .activity-comments .view-more-comments, #activity-stream .activity-state-comments > .comments-count",function(e){e.preventDefault(),q(this).parents("li.activity-item").find(".activity-comments > ul > li.acomments-view-more, .activity-comments > .activity-actions > ul > li.acomments-view-more").trigger("click")}),q("#activity-modal > .bb-modal-activity-body").on("scroll",this.autoloadMoreComments.bind(this)),q("#activity-modal > .bb-modal-activity-body").on("scroll",this.discardGifEmojiPicker.bind(this)),q(".bb-activity-model-wrapper .bb-model-close-button").on("click",this.activitySyncOnModalClose.bind(this)),void 0!==BP_Nouveau.is_send_ajax_request&&"1"===BP_Nouveau.is_send_ajax_request?q("#buddypress").on("bp_ajax_request",'[data-bp-list="activity"]',function(){setTimeout(function(){q(".ac-form.not-initialized").each(function(){var e=q(this),t=e.find(".ac-textarea");bp.Nouveau.Activity.toggleMultiMediaOptions(e,t)})},1e3)}):setTimeout(function(){q(".ac-form.not-initialized").each(function(){var e=q(this),t=e.find(".ac-textarea");bp.Nouveau.Activity.toggleMultiMediaOptions(e,t)})},1e3)},heartbeatSend:function(e,t){this.heartbeat_data.first_recorded=q("#buddypress [data-bp-list] [data-bp-activity-id]:not(.bb-pinned)").first().data("bp-timestamp")||0;var a=q("#buddypress [data-bp-list] [data-bp-activity-id]").first().data("bp-timestamp")||0;a>this.heartbeat_data.first_recorded&&(this.heartbeat_data.first_recorded=a),(0===this.heartbeat_data.last_recorded||this.heartbeat_data.first_recorded>this.heartbeat_data.last_recorded)&&(this.heartbeat_data.last_recorded=this.heartbeat_data.first_recorded),t.bp_activity_last_recorded=this.heartbeat_data.last_recorded,q("#buddypress .dir-search input[type=search]").length&&(t.bp_activity_last_recorded_search_terms=q("#buddypress .dir-search input[type=search]").val()),q.extend(t,{bp_heartbeat:bp.Nouveau.getStorage("bp-activity")})},heartbeatTick:function(e,t){var a,i,o=bp.Nouveau.objects,d=bp.Nouveau.getStorage("bp-activity","scope"),s=this;void 0!==t&&t.bp_activity_newest_activities&&(this.heartbeat_data.newest=q.trim(t.bp_activity_newest_activities.activities)+this.heartbeat_data.newest,this.heartbeat_data.last_recorded=Number(t.bp_activity_newest_activities.last_recorded),i=q(this.heartbeat_data.newest).filter(".activity-item"),a=Number(i.length),o.push("mentions"),"all"===d?(q.each(i,function(e,a){a=q(a),q.each(o,function(e,t){-1!==q.inArray("bp-my-"+t,a.get(0).classList)&&(void 0===s.heartbeat_data.highlights[t]?s.heartbeat_data.highlights[t]=[a.data("bp-activity-id")]:-1===q.inArray(a.data("bp-activity-id"),s.heartbeat_data.highlights[t])&&s.heartbeat_data.highlights[t].push(a.data("bp-activity-id")))})}),t=new RegExp("bp-my-("+o.join("|")+")","g"),this.heartbeat_data.newest=this.heartbeat_data.newest.replace(t,""),q(bp.Nouveau.objectNavParent+' [data-bp-scope="all"]').find("a span").html(a)):(this.heartbeat_data.highlights[d]=[],q.each(i,function(e,t){s.heartbeat_data.highlights[d].push(q(t).data("bp-activity-id"))})),q.each(o,function(e,t){var a;void 0!==s.heartbeat_data.highlights[t]&&s.heartbeat_data.highlights[t].length&&(a=0,"mentions"===t&&(a=s.mentions_count),q(bp.Nouveau.objectNavParent+' [data-bp-scope="'+t+'"]').find("a span").html(Number(s.heartbeat_data.highlights[t].length)+a))}),o.pop(),q(document).prop("title","("+a+") "+this.heartbeat_data.document_title),q('#buddypress [data-bp-list="activity"] li').first().hasClass("load-newest")?(i=q('#buddypress [data-bp-list="activity"] .load-newest a').html(),q('#buddypress [data-bp-list="activity"] .load-newest a').html(i.replace(/([0-9]+)/,a))):q('#buddypress [data-bp-list="activity"] ul.activity-list').prepend('
  • '+BP_Nouveau.newest+" ("+a+")
  • "),q('#buddypress [data-bp-list="activity"] li.load-newest').trigger("click"),q('#buddypress [data-bp-list="activity"]').trigger("bp_heartbeat_pending",this.heartbeat_data),void 0!==bp.Nouveau&&bp.Nouveau.reportPopUp())},injectActivities:function(e){var t,a,i,o,d=bp.Nouveau.getStorage("bp-activity"),s=d.scope||null,d=d.filter||null;q(e.currentTarget).hasClass("load-newest")?(e.preventDefault(),q(e.currentTarget).remove(),i=q.parseHTML(this.heartbeat_data.newest),q.each(i,function(e,t){"LI"===t.nodeName&&q(t).hasClass("just-posted")&&q("#"+q(t).prop("id")).length&&q("#"+q(t).prop("id")).remove()}),(0<(i=q(e.delegateTarget).find(".activity-list .activity-item").first()).length&&i.hasClass("bb-pinned")?q(i).after(this.heartbeat_data.newest):q(e.delegateTarget).find(".activity-list").prepend(this.heartbeat_data.newest)).find("li.activity-item").each(bp.Nouveau.hideSingleUrl).trigger("bp_heartbeat_prepend",this.heartbeat_data),this.heartbeat_data.newest="","all"===s&&q(bp.Nouveau.objectNavParent+' [data-bp-scope="all"]').find("a span").html(""),"mentions"===s&&(bp.Nouveau.ajax({action:"activity_clear_new_mentions"},"activity"),this.mentions_count=0),q(bp.Nouveau.objectNavParent+' [data-bp-scope="'+s+'"]').find("a span").html(""),void 0!==this.heartbeat_data.highlights[s]&&(this.heartbeat_data.highlights[s]=[]),setTimeout(function(){q(e.delegateTarget).find("[data-bp-activity-id]").removeClass("newest_"+s+"_activity")},3e3),q(document).prop("title",this.heartbeat_data.document_title),jQuery(window).scroll()):q(e.currentTarget).hasClass("load-more")&&(t=+Number(this.current_page)+1,a=this,i="",e.preventDefault(),(o=q(e.currentTarget)).find("a").first().addClass("loading"),this.just_posted=[],q(e.delegateTarget).children(".just-posted").each(function(){a.just_posted.push(q(this).data("bp-activity-id"))}),q("#buddypress .dir-search input[type=search]").length&&(i=q("#buddypress .dir-search input[type=search]").val()),bp.Nouveau.objectRequest({object:"activity",scope:s,filter:d,search_terms:i,page:t,method:"append",exclude_just_posted:this.just_posted.join(","),target:"#buddypress [data-bp-list] ul.bp-list"}).done(function(e){!0===e.success&&(o.remove(),a.current_page=t,jQuery(window).scroll())})),q(".activity-item.bb-closed-comments").find(".edit-activity, .acomment-edit").parents(".generic-button").hide()},hideComments:function(e){var a,i,o,e=q(e.target).find(".activity-comments");e.length&&e.each(function(e,t){o=q(t).children("ul").not(".conflict-activity-ul-li-comment"),(i=q(o).find("li").not(q(".document-action-class, .media-action-class, .video-action-class"))).length&&(q("body").hasClass("activity-singular")&&""!==window.location.hash&&q(window.location.hash).length&&0!==q(window.location.hash).closest(".activity-comments").length||(a=q(t).closest(".activity-item"),q("#acomment-comment-"+a.data("bp-activity-id")+" span.comment-count").html(),i.each(function(e,t){if(e"),window.location.hash&&"#"+q(t).attr("id")===window.location.hash)return q(t).parents("li.comment-item").show(),!1;q(t).addClass("bp-hidden").hide()}}),q(o).children(".bp-hidden").length===q(o).children("li").length-1&&q(o).find("li.show-all").length&&q(o).children("li:not(.show-all)").removeClass("bp-hidden").toggle()))})},showActivity:function(e){e.preventDefault();var t=q(e.currentTarget).parent(),a=t.data("parent_comment_id"),t=q(t).data("activity_id");q(document).trigger("activityModalOpened",{activityId:t}),q(e.currentTarget).parents(".activity-comments").find(".ac-form").each(function(){var e=q(this),t=q(this).closest(".activity-comments"),a=q(this).closest(".comment-item");e.find(".post-elements-buttons-item.post-emoji").removeClass("active").empty(""),bp.Nouveau.Activity.resetActivityCommentForm(e,"hardReset"),t.append(e),a.find(".acomment-display").removeClass("display-focus"),a.removeClass("comment-item-focus")}),bp.Nouveau.Activity.launchActivityPopup(t,a)},closeActivity:function(e){e.preventDefault();var t=q(e.target).closest(".bb-activity-model-wrapper"),a=t.find(".bb-modal-activity-footer"),i=t.find(".activity-item").data("bp-activity-id"),e=t.find("#ac-form-"+i);bp.Nouveau.Activity.reinitializeActivityCommentForm(e),_.isUndefined(BP_Nouveau.media)||_.isUndefined(BP_Nouveau.media.emoji)||bp.Nouveau.Activity.initializeEmojioneArea(!1,"",i),t.find("#activity-modal").removeClass("bb-closed-comments"),t.closest("body").removeClass("acomments-modal-open"),t.hide(),t.find("ul.activity-list").empty(),a.removeClass("active"),a.find("form.ac-form").remove()},scopeLoaded:function(e,a){this.current_page=1,"mentions"===a.scope&&void 0!==a.response.new_mentions?(q.each(a.response.new_mentions,function(e,t){q("#buddypress #activity-stream").find('[data-bp-activity-id="'+t+'"]').addClass("newest_mentions_activity")}),this.mentions_count=0):void 0!==this.heartbeat_data.highlights[a.scope]&&this.heartbeat_data.highlights[a.scope].length&&q.each(this.heartbeat_data.highlights[a.scope],function(e,t){q("#buddypress #activity-stream").find('[data-bp-activity-id="'+t+'"]').length&&q("#buddypress #activity-stream").find('[data-bp-activity-id="'+t+'"]').addClass("newest_"+a.scope+"_activity")}),this.heartbeat_data.newest="",q.each(q(bp.Nouveau.objectNavParent+" [data-bp-scope]").find("a span"),function(e,t){0===parseInt(q(t).html(),10)&&q(t).html("")}),void 0!==this.heartbeat_data.highlights[a.scope]&&(this.heartbeat_data.highlights[a.scope]=[]),q(document).prop("title",this.heartbeat_data.document_title),setTimeout(function(){q("#buddypress #activity-stream .activity-item").removeClass("newest_"+a.scope+"_activity")},3e3),void 0!==window.instgrm&&window.instgrm.Embeds.process(),void 0!==window.FB&&void 0!==window.FB.XFBML&&window.FB.XFBML.parse(),this.fixAtWhoActivity(),this.openEditActivityPopup(),this.navigateToSpecificComment(),setTimeout(function(){jQuery(window).scroll()},200)},openEditActivityPopup:function(){var e,t;!_.isUndefined(BP_Nouveau.activity.params.is_activity_edit)&&0 ul");if(e.data.redirect)return window.location.href=e.data.redirect;e.data.parent_activity_id&&e.data.activity&&q("body:not(.activity-singular) #buddypress #activity-stream ul.activity-list li#activity-"+e.data.parent_activity_id).replaceWith(e.data.activity),k&&(x=1,i=B.find(".acomments-view-more").data("child-count"),c.append(B.find("form")),q.each(B.find("li.comment-item"),function(){x+=1}),x+=void 0!==i?parseFloat(i):0,N=m.find("span.comments-count"),z=N.text().length?N.text().match(/\d+/)[0]:0,z=Number(z-x),p.length?(i=1 ul").html().trim()&&t.removeClass("has-child-comments")}),k||c.data("bp-timestamp")!==d.Activity.heartbeat_data.last_recorded||(d.Activity.heartbeat_data.newest="",d.Activity.heartbeat_data.last_recorded=0),q(document).trigger("bp_activity_ajax_delete_request",q.extend(A,{response:e})),q(document).trigger("bp_activity_ajax_delete_request_video",q.extend(A,{response:e})),bp.Nouveau.Activity.activityHasUpdates=!0,bp.Nouveau.Activity.currentActivityId=r}j.removeClass("active")})}if(l.closest("span").hasClass("activity-read-more")){var T=l.closest("div"),U=l.closest("span");if(C=null,q(T).hasClass("activity-inner")?C=r:q(T).hasClass("acomment-content")&&(C=l.closest("li").data("bp-activity-comment-id")),!C)return e;e.preventDefault(),q(U).addClass("loading"),d.ajax({action:"get_single_activity_content",id:C},"activity").done(function(e){"object"!=typeof e&&0/gi,"\n").replace(/<\/div>/gi,""),S={action:"new_activity_comment",_wpnonce_new_activity_comment:q("#_wpnonce_new_activity_comment").val(),comment_id:C,form_id:r,content:R};q("#_bp_as_nonce_"+r).val()&&(S["_bp_as_nonce_"+r]=q("#_bp_as_nonce_"+r).val()),this.dropzone_media.length&&(S.media=this.dropzone_media),this.dropzone_document.length&&(S.document=this.dropzone_document),this.dropzone_video.length&&(S.video=this.dropzone_video,_.isEmpty(S.content)&&(S.content="​")),_.isUndefined(this.models[r])||(n=this.models[r],S.gif_data=this.models[r].get("gif_data")),S.content=S.content.replace(/ /g," "),s.hasClass("acomment-edit")&&(S.edit_comment=!0);var H=0"):t.append("
      ")),H?s.closest("#activity-modal").find(".bb-modal-activity-body .activity-comments, .bb-modal-activity-body .activity-comments .activity-actions").children("ul").append(q(a)):t.children("ul").append(q(a).hide().fadeIn(200)),q(s).find(".ac-input").first().html(""),t.parent().addClass("has-comments"),t.parent().addClass("comments-loaded"),m.addClass("has-comments")),s.removeClass("acomment-edit");t=s.find(".ac-reply-content");if(0'+BP_Nouveau.activity.strings.commentPostError+""):(e=e.responseJSON&&e.responseJSON.message?e.responseJSON.message:e.statusText,s.find(".ac-reply-content").after('
      '+e+"
      "))})}if(l.hasClass("edit")&&l.hasClass("edit-activity")&&(e.preventDefault(),R=c.data("bp-activity"),S=""!==c.data("link-url")?c.data("link-url"):null,void 0!==R&&(bp.Nouveau.Activity.postForm.displayEditActivityForm(R,S),l.closest("li").hasClass("groups")?q("#bp-nouveau-activity-form").addClass("group-activity"):q("#bp-nouveau-activity-form").removeClass("group-activity"),void 0!==bp.Nouveau.Media&&void 0!==bp.Nouveau.Media.Theatre&&(bp.Nouveau.Media.Theatre.is_open_media||bp.Nouveau.Media.Theatre.is_open_document)&&(q(document).find(".bb-close-media-theatre").trigger("click"),q(document).find(".bb-close-document-theatre").trigger("click")))),u&&(l.hasClass("bb-open-media-theatre")||l.hasClass("bb-open-video-theatre")||l.hasClass("bb-open-document-theatre")||l.hasClass("document-detail-wrap-description-popup"))&&(e.preventDefault(),l.closest("#activity-modal").find(".bb-modal-activity-header .bb-close-action-popup").trigger("click")),l.hasClass("pin-activity")||l.hasClass("unpin-activity")){if(e.preventDefault(),!r)return e;l.closest(".activity-item").addClass("loading-pin");var O="pin";l.hasClass("unpin-activity")&&(O="unpin"),d.ajax({action:"activity_update_pinned_post",id:r,pin_action:O},"activity").done(function(e){var t,a,i,o,d,s,n;l.closest(".activity-item").removeClass("loading-pin"),void 0!==(e="object"!=typeof e?JSON.parse(e):e).data&&void 0!==e.data.feedback&&(t=l.closest("ul.activity-list"),n=u?l.closest(".buddypress-wrap").find("#activity-stream"):l.closest("#activity-stream"),e.success&&(a=bp.Nouveau.getStorage("bp-activity","scope"),o=i=!1,d="",l.closest("li.activity-item").hasClass("groups")&&(o=!0,d=(d=l.closest("li.activity-item").attr("class").match(/group-\d+/))[0].replace("group-","")),n.hasClass("single-user")?i=!1:(n.hasClass("activity")&&"all"===a&&!o||n.hasClass("single-group"))&&(i=!0),"pin"===O?(i&&t.find("li.activity-item").removeClass("bb-pinned"),s="li.activity-item:not(.groups)",o&&!n.hasClass("single-group")?s="li.activity-item.group-"+d:o&&n.hasClass("single-group")&&(s="li.activity-item"),t.find(s).each(function(){var e=q(this).find(".unpin-activity");e.removeClass("unpin-activity").addClass("pin-activity"),o?e.find("span").html(BP_Nouveau.activity.strings.pinGroupPost):e.find("span").html(BP_Nouveau.activity.strings.pinPost)}),i&&l.closest("li.activity-item").addClass("bb-pinned"),l.addClass("unpin-activity"),l.removeClass("pin-activity"),l.closest("li.activity-item").hasClass("groups")?l.find("span").html(BP_Nouveau.activity.strings.unpinGroupPost):l.find("span").html(BP_Nouveau.activity.strings.unpinPost)):"unpin"===O&&(l.closest("li.activity-item").removeClass("bb-pinned"),l.addClass("pin-activity"),l.removeClass("unpin-activity"),l.closest("li.activity-item").hasClass("groups")?l.find("span").html(BP_Nouveau.activity.strings.pinGroupPost):l.find("span").html(BP_Nouveau.activity.strings.pinPost)),"all"===a&&i&&(bp.Nouveau.Activity.heartbeat_data.last_recorded=0,bp.Nouveau.refreshActivities())),q(document).trigger("bb_trigger_toast_message",["","
      "+e.data.feedback+"
      ","success",null,!0]))}).fail(function(){l.closest(".activity-item").removeClass("loading-pin"),q(document).trigger("bb_trigger_toast_message",["","
      "+BP_Nouveau.activity.strings.pinPostError+"
      ","error",null,!0])})}if(l.hasClass("bb-icon-bell-slash")||l.hasClass("bb-icon-bell")){if(e.preventDefault(),!r)return e;l.closest(".activity-item").addClass("loading-mute");var Q="mute";l.hasClass("bb-icon-bell")&&(Q="unmute"),d.ajax({action:"toggle_activity_notification_status",id:r,notification_toggle_action:Q},"activity").done(function(e){l.closest(".activity-item").removeClass("loading-mute"),void 0!==(e="object"!=typeof e?JSON.parse(e):e).data&&void 0!==e.data.feedback&&(e.success&&("mute"===Q?(l.closest("li.activity-item").addClass("bb-muted"),l.removeClass("bb-icon-bell-slash"),l.addClass("bb-icon-bell"),l.attr("title",BP_Nouveau.activity.strings.unmuteNotification),l.find("span").html(BP_Nouveau.activity.strings.unmuteNotification)):"unmute"===Q&&(l.closest("li.activity-item").removeClass("bb-muted"),l.removeClass("bb-icon-bell"),l.addClass("bb-icon-bell-slash"),l.attr("title",BP_Nouveau.activity.strings.muteNotification),l.find("span").html(BP_Nouveau.activity.strings.muteNotification)),void 0!==bp.Nouveau.Activity.activityHasUpdates&&(bp.Nouveau.Activity.activityHasUpdates=!0)),q(document).trigger("bb_trigger_toast_message",["","
      "+e.data.feedback+"
      ","success",null,!0])),u&&(bp.Nouveau.Activity.activityPinHasUpdates=!0),bp.Nouveau.Activity.activityHasUpdates=!0,bp.Nouveau.Activity.currentActivityId=r}).fail(function(){l.closest(".activity-item").removeClass("loading-pin"),q(document).trigger("bb_trigger_toast_message",["","
      "+BP_Nouveau.activity.strings.pinPostError+"
      ","error",null,!0])})}if(l.hasClass("close-activity-comment")||l.hasClass("unclose-activity-comment")){if(e.preventDefault(),!r)return e;l.closest(".activity-item").addClass("loading-pin");var V="close_comments";l.hasClass("unclose-activity-comment")&&(V="unclose_comments"),d.ajax({action:"activity_update_close_comments",id:r,close_comments_action:V},"activity").done(function(e){var t;l.closest(".activity-item").removeClass("loading-pin"),void 0!==(e="object"!=typeof e?JSON.parse(e):e).data&&void 0!==e.data.feedback&&(e.success&&(t=q("#activity-stream > .activity-list").find("[data-bp-activity-id="+r+"]"),l.closest(".activity-item").find(".bb-activity-closed-comments-notice").remove(),"close_comments"===V?(l.closest("li.activity-item").addClass("bb-closed-comments"),0'+e.data.feedback+""),0'+e.data.feedback+""))):"unclose_comments"===V&&(l.closest("li.activity-item.bb-closed-comments").find(".edit-activity, .acomment-edit").parents(".generic-button").show(),l.closest("li.activity-item").removeClass("bb-closed-comments"),0"+e.data.feedback+"",e.success?"success":"error",null,!0]))}).fail(function(){l.closest(".activity-item").removeClass("loading-pin"),q(document).trigger("bb_trigger_toast_message",["","
      "+BP_Nouveau.activity.strings.closeCommentsError+"
      ","error",null,!0])})}},commentFormAction:function(e){var t,a;return(e=e||window.event).target?t=e.target:e.srcElement&&(t=e.srcElement),3===t.nodeType&&(t=t.parentNode),!0!==e.altKey&&!0!==e.metaKey&&"TEXTAREA"===t.tagName&&q(t).hasClass("ac-input")?void(27===(a=e.keyCode||e.which)&&!1===e.ctrlKey?"TEXTAREA"===t.tagName&&q(t).closest("form").slideUp(200):e.ctrlKey&&13===a&&q(t).val()&&q(t).closest("form").find("[type=submit]").first().trigger("click")):e},togglePopupDropdown:function(e){var t;return(e=e||window.event).target?t=e.target:e.srcElement&&(t=e.srcElement),3===t.nodeType&&(t=t.parentNode),!0===e.altKey||!0===e.metaKey||q(t).hasClass("privacy-wrap")||q(t).parent().hasClass("privacy-wrap")?e:void q("ul.activity-privacy").removeClass("bb-open")},loadMoreActivities:function(){var e,t=q(".load-more:visible").last(),a=q(window);t.closest(".activity-list").length&&t.get(0)&&!t.data("bp-autoloaded")&&(e=t.offset().top-50,a.scrollTop()+a.height()>e&&(t.data("bp-autoloaded",1),t.find("a").text(BP_Nouveau.activity.strings.loadingMore),t.find("a").trigger("click")))},destroyCommentMediaUploader:function(e){_.isNull(this.dropzone_obj)||(this.dropzone_obj.destroy(),q("#ac-reply-post-media-uploader-"+e).html(""),q("#ac-reply-post-media-uploader-1-"+e).html("")),this.dropzone_media=[],q("#ac-reply-post-media-uploader-"+e).removeClass("open").addClass("closed"),q("#ac-reply-media-button-"+e).removeClass("active")},destroyCommentDocumentUploader:function(e){_.isNull(this.dropzone_document_obj)||(this.dropzone_document_obj.destroy(),q("#ac-reply-post-document-uploader-"+e).html("")),this.dropzone_document=[],q("#ac-reply-post-document-uploader-"+e).removeClass("open").addClass("closed"),q("#ac-reply-document-button-"+e).removeClass("active")},destroyCommentVideoUploader:function(e){_.isNull(this.dropzone_video_obj)||(this.dropzone_video_obj.destroy(),q("#ac-reply-post-video-uploader-"+e).html("")),this.dropzone_video=[],q("#ac-reply-post-video-uploader-"+e).removeClass("open").addClass("closed"),q("#ac-reply-video-button-"+e).removeClass("active")},resetGifPicker:function(e){q("#ac-reply-gif-button-"+e).closest(".post-gif").find(".gif-media-search-dropdown").removeClass("open").empty(),q("#ac-reply-gif-button-"+e).removeClass("active"),q(".gif-media-search-dropdown-standalone").removeClass("open").empty(),_.isUndefined(this.models[e])||(this.models[e].set("gif_data",{}),q("#ac-reply-post-gif-"+e).find(".activity-attached-gif-container").removeAttr("style"))},openCommentsMediaUploader:function(e){var l=this,o=q(e.currentTarget),t=o.data("ac-id"),a=o.closest(".bp-ac-form-container").find("#ac-reply-post-media-uploader-"+t),i=0'+t+""),this.removeFile(e),a.removeClass("media-uploading"))}),l.dropzone_obj.on("removedfile",function(e){if(l.dropzone_media.length)for(var t in l.dropzone_media)if(e.upload.uuid==l.dropzone_media[t].uuid){void 0===l.dropzone_media[t].saved||l.dropzone_media[t].saved||bp.Nouveau.Media.removeAttachment(l.dropzone_media[t].id),l.dropzone_media.splice(t,1);break}var a,i;_.isNull(l.dropzone_obj)||_.isNull(l.dropzone_obj.files)||0!==l.dropzone_obj.files.length?o.closest(".ac-form").addClass("has-content"):(a=o.parents(".ac-reply-toolbar"),(i=o.closest(".ac-form")).removeClass("has-media"),a.find(".ac-reply-document-button")&&a.find(".ac-reply-document-button").parents(".post-elements-buttons-item").removeClass("disable"),a.find(".ac-reply-video-button")&&a.find(".ac-reply-video-button").parents(".post-elements-buttons-item").removeClass("disable"),a.find(".ac-reply-gif-button")&&a.find(".ac-reply-gif-button").parents(".post-elements-buttons-item").removeClass("disable"),a.find(".ac-reply-media-button")&&a.find(".ac-reply-media-button").parents(".post-elements-buttons-item").removeClass("no-click").find(".toolbar-button").removeClass("active"),q(l.dropzone_obj.element).removeClass("files-uploaded dz-progress-view").find(".dz-global-progress").remove(),l.validateCommentContent(i.find(".ac-textarea").children(".ac-input")))}),l.dropzone_obj.on("complete",function(){0===this.getUploadingFiles().length&&0===this.getQueuedFiles().length&&0'+t+""),this.removeFile(e),a.removeClass("media-uploading"))}),l.dropzone_document_obj.on("removedfile",function(e){if(l.dropzone_document.length)for(var t in l.dropzone_document)if(e.upload.uuid==l.dropzone_document[t].uuid){void 0===l.dropzone_document[t].saved||l.dropzone_document[t].saved||bp.Nouveau.Media.removeAttachment(l.dropzone_document[t].id),l.dropzone_document.splice(t,1);break}var a,i;_.isNull(l.dropzone_document_obj)||_.isNull(l.dropzone_document_obj.files)||0!==l.dropzone_document_obj.files.length?o.closest(".ac-form").addClass("has-content"):(a=o.parents(".ac-reply-toolbar"),(i=o.closest(".ac-form")).removeClass("has-media"),a.find(".ac-reply-media-button")&&a.find(".ac-reply-media-button").parents(".post-elements-buttons-item").removeClass("disable"),a.find(".ac-reply-video-button")&&a.find(".ac-reply-video-button").parents(".post-elements-buttons-item").removeClass("disable"),a.find(".ac-reply-gif-button")&&a.find(".ac-reply-gif-button").parents(".post-elements-buttons-item").removeClass("disable"),a.find(".ac-reply-document-button")&&a.find(".ac-reply-document-button").parents(".post-elements-buttons-item").removeClass("no-click").find(".toolbar-button").removeClass("active"),q(l.dropzone_document_obj.element).removeClass("files-uploaded dz-progress-view").find(".dz-global-progress").remove(),l.validateCommentContent(i.find(".ac-textarea").children(".ac-input")))}),l.dropzone_document_obj.on("complete",function(){0===this.getUploadingFiles().length&&0===this.getQueuedFiles().length&&0'),q(e.previewElement).closest(".dz-preview").addClass("dz-has-thumbnail")):bp.Nouveau.getVideoThumb&&bp.Nouveau.getVideoThumb(e,".dz-video-thumbnail")}),l.dropzone_video_obj.on("uploadprogress",function(){o.closest(".ac-form").addClass("media-uploading"),bp.Nouveau.dropZoneGlobalProgress&&bp.Nouveau.dropZoneGlobalProgress(this)}),l.dropzone_video_obj.on("success",function(e,t){if(100===e.upload.progress&&(q(e.previewElement).find(".dz-progress-ring circle")[0].style.strokeDashoffset=0,q(e.previewElement).find(".dz-progress-count").text("100% "+BP_Nouveau.video.i18n_strings.video_uploaded_text),q(e.previewElement).closest(".dz-preview").addClass("dz-complete")),t.data.id)return e.id=t.id,t.data.uuid=e.upload.uuid,t.data.menu_order=q(e.previewElement).closest(".dropzone").find(e.previewElement).index()-1,t.data.album_id=void 0!==BP_Nouveau.video&&void 0!==BP_Nouveau.video.album_id&&BP_Nouveau.video.album_id,t.data.group_id=void 0!==BP_Nouveau.video&&void 0!==BP_Nouveau.video.group_id&&BP_Nouveau.video.group_id,t.data.saved=!1,t.data.js_preview=q(e.previewElement).find(".dz-video-thumbnail img").attr("src"),l.dropzone_video.push(t.data),e.previewElement.classList.add("dz-success");var a,i,o,d,s,n=t.data.feedback;for(e.previewElement.classList.add("dz-error"),s=[],i=0,o=(d=e.previewElement.querySelectorAll("[data-dz-errormessage]")).length;i'+t+""),this.removeFile(e),a.removeClass("media-uploading"))}),l.dropzone_video_obj.on("removedfile",function(e){if(l.dropzone_video.length)for(var t in l.dropzone_video)if(e.upload.uuid==l.dropzone_video[t].uuid){void 0===l.dropzone_video[t].saved||l.dropzone_video[t].saved||bp.Nouveau.Media.removeAttachment(l.dropzone_video[t].id),l.dropzone_video.splice(t,1);break}var a,i;_.isNull(l.dropzone_video_obj)||_.isNull(l.dropzone_video_obj.files)||0!==l.dropzone_video_obj.files.length?o.closest(".ac-form").addClass("has-content"):(a=o.parents(".ac-reply-toolbar"),(i=o.closest(".ac-form")).removeClass("has-media"),a.find(".ac-reply-media-button")&&a.find(".ac-reply-media-button").parents(".post-elements-buttons-item").removeClass("disable"),a.find(".ac-reply-document-button")&&a.find(".ac-reply-document-button").parents(".post-elements-buttons-item").removeClass("disable"),a.find(".ac-reply-gif-button")&&a.find(".ac-reply-gif-button").parents(".post-elements-buttons-item").removeClass("disable"),a.find(".ac-reply-video-button")&&a.find(".ac-reply-video-button").parents(".post-elements-buttons-item").removeClass("no-click").find(".toolbar-button").removeClass("active"),q(l.dropzone_video_obj.element).removeClass("files-uploaded dz-progress-view").find(".dz-global-progress").remove(),l.validateCommentContent(i.find(".ac-textarea").children(".ac-input")))}),l.dropzone_video_obj.on("complete",function(){0===this.getUploadingFiles().length&&0===this.getQueuedFiles().length&&0/gi,"\n").replace(/<\/div>/gi,""))).replace(/ /g," ");""!==e.text().trim()||0<=t.indexOf("emojioneemoji")||e.closest("form").hasClass("acomment-edit")?e.closest("form").addClass("has-content"):e.closest("form").removeClass("has-content")},ReactionStatePopupTab:function(e){e.preventDefault(),q(this).closest(".activity-state-popup").find(".activity-state-popup_tab_panel li a").removeClass("active"),q(this).addClass("active"),q(this).closest(".activity-state-popup").find(".activity-state-popup_tab_content .activity-state-popup_tab_item").removeClass("active"),q(this).closest(".activity-state-popup").find("."+q(this).data("tab")).addClass("active")},closeActivityState:function(){q(".activity-state-popup").hide().removeClass("active")},listenCommentInput:function(e){var t,a;0/gi,"\n").replace(/<\/div>/gi,""));t=t.replace(/ /g," "),""!==jQuery(e.currentTarget).text().trim()||0<=t.indexOf("emojioneemoji")?jQuery(e.currentTarget).closest("form").addClass("has-content"):jQuery(e.currentTarget).closest("form").removeClass("has-content")}),q(t).closest("form").addClass("events-initiated"),this.InitiatedCommentForms.push(a)))},activityRootComment:function(e){var t=q(e.currentTarget).closest("#activity-modal"),a=t.find(".activity-item").data("bp-activity-id"),e=t.find("#ac-form-"+a);bp.Nouveau.Activity.resetActivityCommentForm(e,"hardReset"),t.find(".acomment-display").removeClass("display-focus"),t.find(".comment-item").removeClass("comment-item-focus"),t.find(".bb-modal-activity-footer").addClass("active").append(e),e.addClass("root"),e.find("#ac-input-"+a).focus(),bp.Nouveau.Activity.clearFeedbackNotice(e)},clearFeedbackNotice:function(e){e.find(".bp-ac-form-container").find(".bp-feedback").length&&e.find(".bp-ac-form-container").find(".bp-feedback").remove()},launchActivityPopup:function(e,t){var a=q("#activity-"+e),i=q(".bb-activity-model-wrapper"),o=a[0].outerHTML,d='[data-parent_comment_id="'+t+'"]',t=a.data("activity-popup-title");bp.Nouveau.Activity.activityHasUpdates=!1,bp.Nouveau.Activity.currentActivityId=null,bp.Nouveau.Activity.activityPinHasUpdates=!1,i.closest("body").addClass("acomments-modal-open"),i.show(),i.find("ul.activity-list").html(o),i.find(".bb-modal-activity-header h2").text(t),i.find(".bb-activity-video-elem").each(function(e,t){var o=q(t);o.find("video").each(function(e,t){var a=q(t),i=a.attr("id")+Math.floor(1e4*Math.random());a.attr("id",i);t=o.find(".video-action-wrap");a.insertAfter(t),o.find(".video-js").remove(),a.addClass("video-js"),videojs(i,{controls:!0,aspectRatio:"16:9",fluid:!0,playbackRates:[.5,1,1.5,2],fullscreenToggle:!1})})}),a.hasClass("bb-closed-comments")&&i.find("#activity-modal").addClass("bb-closed-comments");t=i.find("#ac-form-"+e);i.find(".acomment-display").removeClass("display-focus"),i.find(".comment-item").removeClass("comment-item-focus"),i.find(".bb-modal-activity-footer").addClass("active").append(t),t.removeClass("not-initialized").addClass("root"),t.find("#ac-input-"+e).focus(),bp.Nouveau.Activity.clearFeedbackNotice(t),t.removeClass("events-initiated");a=i.find(".bb-modal-activity-footer").find(".ac-input[contenteditable]");bp.Nouveau.Activity.listenCommentInput(a),i.find(".bb-activity-more-options-wrap .bb-activity-more-options-action, .bb-pin-action_button, .bb-mute-action_button").attr("data-balloon-pos","left"),i.find(".privacy-wrap").attr("data-bp-tooltip-pos","right"),i.find(d).children(".acomments-view-more").first().trigger("click"),_.isUndefined(BP_Nouveau.media)||_.isUndefined(BP_Nouveau.media.emoji)||bp.Nouveau.Activity.initializeEmojioneArea(!0,"#activity-modal ",e),void 0!==bp.Nouveau&&bp.Nouveau.reportPopUp(),bp.Nouveau.Activity.toggleMultiMediaOptions(t,"",".bb-modal-activity-footer")},viewMoreComments:function(e){e.preventDefault();var t=q(e.currentTarget).parent(),i=q(e.currentTarget),o=q(t).data("activity_id"),d=q(e.currentTarget).closest(".activity-comments"),s=q(e.currentTarget).closest(".activity-item"),n=q(t).data("parent_comment_id"),l="";i.addClass("loading").removeClass("acomments-view-more--hide"),d.addClass("active"),s.addClass("active"),i.html('
      ');var a={action:"activity_loadmore_comments",activity_id:o,parent_comment_id:n,offset:q(e.currentTarget).parents(".activity-comments").find('ul[data-parent_comment_id ="'+n+'"] > li.comment-item:not(.bb-recent-comment)').length,activity_type_is_blog:1"+e.data.message+"

      ").removeClass("acomments-view-more--hide"),d.removeClass("active"),s.removeClass("active")):void 0!==e.data&&void 0!==e.data.comments&&(t=q(".bb-internal-model .activity-comments").find("[data-activity_id='"+o+"'][data-parent_comment_id='"+n+"']"),a=q(q.parseHTML(e.data.comments)),0"+e.statusText+"

      ").removeClass("acomments-view-more--hide"),d.removeClass("active"),s.removeClass("active")})},autoloadMoreComments:function(){var e,t,a,i,o;0 ul > li.acomments-view-more:not(.loading), .bb-modal-activity-body .activity-comments .activity-actions > ul > li.acomments-view-more:not(.loading)"),o=q(".bb-activity-model-wrapper .bb-modal-activity-body"),i=q(".bb-activity-model-wrapper .bb-modal-activity-body").find(".activity-comments:not(.active)"),0a&&q(e).trigger("click").addClass("loading")),setTimeout(function(){jQuery(window).scroll()},200))},activitySyncOnModalClose:function(e,t){e.preventDefault();var e=(q(e.currentTarget).is(document)?q(".bb-activity-model-wrapper"):q(e.currentTarget).parents(".bb-activity-model-wrapper")).find("ul.activity-list > li").data("bp-activity-id"),e=void 0!==t?t:e,a=q("#activity-stream li.activity-item[data-bp-activity-id="+e+"]");0 .bb-modal-activity-body .activity-item").data("bp-activity-id");0/gi,"\n").replace(/<\/div>/gi,""));t=t.replace(/ /g," "),""!==e.text()||0<=t.indexOf("emojioneemoji")?e.closest("form").addClass("has-content"):e.closest("form").removeClass("has-content")},picker_show:function(){q(this.button[0]).closest(".post-emoji").addClass("active"),q(".emojionearea-theatre").removeClass("hide").addClass("show")},picker_hide:function(){q(this.button[0]).closest(".post-emoji").removeClass("active"),q(".emojionearea-theatre").removeClass("show").addClass("hide")}}})}},bp.Nouveau.Activity.start())}((bp,jQuery)); \ No newline at end of file +window.bp=window.bp||{},function(q){"undefined"!=typeof BP_Nouveau&&(bp.Nouveau=bp.Nouveau||{},bp.Models=bp.Models||{},bp.Models.ACReply=Backbone.Model.extend({defaults:{gif_data:{}}}),bp.Nouveau.Activity={start:function(){this.setupGlobals(),this.addListeners()},setupGlobals:function(){this.just_posted=[],this.current_page=1,this.mentions_count=Number(q(bp.Nouveau.objectNavParent+' [data-bp-scope="mentions"]').find("a span").html())||0,this.heartbeat_data={newest:"",highlights:{},last_recorded:0,first_recorded:0,document_title:q(document).prop("title")},void 0!==window.Dropzone&&void 0!==BP_Nouveau.media&&(window.Dropzone.autoDiscover=!1,this.dropzone_options={url:BP_Nouveau.ajaxurl,timeout:108e5,dictFileTooBig:BP_Nouveau.media.dictFileTooBig,dictDefaultMessage:BP_Nouveau.media.dropzone_media_message,acceptedFiles:"image/*",autoProcessQueue:!0,addRemoveLinks:!0,uploadMultiple:!1,maxFiles:void 0!==BP_Nouveau.media.maxFiles?BP_Nouveau.media.maxFiles:10,maxFilesize:void 0!==BP_Nouveau.media.max_upload_size?BP_Nouveau.media.max_upload_size:2,dictMaxFilesExceeded:BP_Nouveau.media.media_dict_file_exceeded,dictCancelUploadConfirmation:BP_Nouveau.media.dictCancelUploadConfirmation,maxThumbnailFilesize:void 0!==BP_Nouveau.media.max_upload_size?BP_Nouveau.media.max_upload_size:2},void 0!==BP_Nouveau.media.dropzone_options&&Object.assign(this.dropzone_options,BP_Nouveau.media.dropzone_options)),this.dropzone_obj=null,this.dropzone_media=[],this.dropzone_document_obj=null,this.dropzone_document=[],this.dropzone_video_obj=null,this.dropzone_video=[],this.models=[],this.InitiatedCommentForms=[],this.activityHasUpdates=!1,this.currentActivityId=null,this.activityPinHasUpdates=!1},addListeners:function(){q("body").hasClass("activity-singular")||q("#buddypress").on("bp_heartbeat_send",this.heartbeatSend.bind(this)),q("#buddypress").on("bp_heartbeat_tick",this.heartbeatTick.bind(this)),q('#buddypress [data-bp-list="activity"]').on("click","li.load-newest, li.load-more",this.injectActivities.bind(this)),q("#buddypress").on("bp_ajax_request",'[data-bp-list="activity"]',this.scopeLoaded.bind(this)),q("#activity-stream").on("click",".acomments-view-more",this.showActivity),q("body").on("click",".bb-close-action-popup",this.closeActivity),q(document).on("activityModalOpened",function(e,t){var a=t.activityId;q(document).on("click",function(e){0li.bb-edit-privacy a",bp.Nouveau,this.activityPrivacyRedirect.bind(this)),q('#buddypress [data-bp-list="activity"], #activity-modal').on("click",".activity-privacy>li:not(.bb-edit-privacy)",bp.Nouveau,this.activityPrivacyChange.bind(this)),q('#buddypress [data-bp-list="activity"], #bb-media-model-container .activity-list, #activity-modal').on("click","span.privacy",bp.Nouveau,this.togglePrivacyDropdown.bind(this)),q("#bb-media-model-container .activity-list").on("click",".activity-item",bp.Nouveau,this.activityActions.bind(this)),q(".bb-activity-model-wrapper").on("click",".ac-form-placeholder",bp.Nouveau,this.activityRootComment.bind(this)),q(document).keydown(this.commentFormAction),q(document).click(this.togglePopupDropdown),q('#buddypress [data-bp-list="activity"], #bb-media-model-container .activity-list, #activity-modal .activity-list, .bb-modal-activity-footer').on("click",".ac-reply-media-button",this.openCommentsMediaUploader.bind(this)),q('#buddypress [data-bp-list="activity"], #bb-media-model-container .activity-list, #activity-modal .activity-list, .bb-modal-activity-footer').on("click",".ac-reply-document-button",this.openCommentsDocumentUploader.bind(this)),q('#buddypress [data-bp-list="activity"], #bb-media-model-container .activity-list, #activity-modal .activity-list, .bb-modal-activity-footer').on("click",".ac-reply-video-button",this.openCommentsVideoUploader.bind(this)),q('#buddypress [data-bp-list="activity"], #bb-media-model-container .activity-list, #activity-modal .activity-list, .bb-modal-activity-footer').on("click",".ac-reply-gif-button",this.openGifPicker.bind(this)),q(document).on("click",this.toggleActivityOption.bind(this)),q(document).on("click",".activity-state-popup_overlay",bp.Nouveau,this.closeActivityState.bind(this)),q(document).on("click",".activity-state-popup .activity-state-popup_tab_panel a",this.ReactionStatePopupTab),_.isUndefined(BP_Nouveau.activity.params.autoload)||q(window).scroll(this.loadMoreActivities),q(".bb-activity-model-wrapper, .bb-media-model-wrapper").on("click",".acomments-view-more",this.viewMoreComments.bind(this)),q(document).on("click","#activity-stream .activity-comments .view-more-comments, #activity-stream .activity-state-comments > .comments-count",function(e){e.preventDefault(),q(this).parents("li.activity-item").find(".activity-comments > ul > li.acomments-view-more, .activity-comments > .activity-actions > ul > li.acomments-view-more").trigger("click")}),q("#activity-modal > .bb-modal-activity-body").on("scroll",this.autoloadMoreComments.bind(this)),q("#activity-modal > .bb-modal-activity-body").on("scroll",this.discardGifEmojiPicker.bind(this)),q(".bb-activity-model-wrapper .bb-model-close-button").on("click",this.activitySyncOnModalClose.bind(this)),void 0!==BP_Nouveau.is_send_ajax_request&&"1"===BP_Nouveau.is_send_ajax_request?q("#buddypress").on("bp_ajax_request",'[data-bp-list="activity"]',function(){setTimeout(function(){q(".ac-form.not-initialized").each(function(){var e=q(this),t=e.find(".ac-textarea");bp.Nouveau.Activity.toggleMultiMediaOptions(e,t)})},1e3)}):setTimeout(function(){q(".ac-form.not-initialized").each(function(){var e=q(this),t=e.find(".ac-textarea");bp.Nouveau.Activity.toggleMultiMediaOptions(e,t)})},1e3)},heartbeatSend:function(e,t){this.heartbeat_data.first_recorded=q("#buddypress [data-bp-list] [data-bp-activity-id]:not(.bb-pinned)").first().data("bp-timestamp")||0;var a=q("#buddypress [data-bp-list] [data-bp-activity-id]").first().data("bp-timestamp")||0;a>this.heartbeat_data.first_recorded&&(this.heartbeat_data.first_recorded=a),(0===this.heartbeat_data.last_recorded||this.heartbeat_data.first_recorded>this.heartbeat_data.last_recorded)&&(this.heartbeat_data.last_recorded=this.heartbeat_data.first_recorded),t.bp_activity_last_recorded=this.heartbeat_data.last_recorded,q("#buddypress .dir-search input[type=search]").length&&(t.bp_activity_last_recorded_search_terms=q("#buddypress .dir-search input[type=search]").val()),q.extend(t,{bp_heartbeat:bp.Nouveau.getStorage("bp-activity")})},heartbeatTick:function(e,t){var a,i,o=bp.Nouveau.objects,d=bp.Nouveau.getStorage("bp-activity","scope"),s=this;void 0!==t&&t.bp_activity_newest_activities&&(this.heartbeat_data.newest=q.trim(t.bp_activity_newest_activities.activities)+this.heartbeat_data.newest,this.heartbeat_data.last_recorded=Number(t.bp_activity_newest_activities.last_recorded),i=q(this.heartbeat_data.newest).filter(".activity-item"),a=Number(i.length),o.push("mentions"),"all"===d?(q.each(i,function(e,a){a=q(a),q.each(o,function(e,t){-1!==q.inArray("bp-my-"+t,a.get(0).classList)&&(void 0===s.heartbeat_data.highlights[t]?s.heartbeat_data.highlights[t]=[a.data("bp-activity-id")]:-1===q.inArray(a.data("bp-activity-id"),s.heartbeat_data.highlights[t])&&s.heartbeat_data.highlights[t].push(a.data("bp-activity-id")))})}),t=new RegExp("bp-my-("+o.join("|")+")","g"),this.heartbeat_data.newest=this.heartbeat_data.newest.replace(t,""),q(bp.Nouveau.objectNavParent+' [data-bp-scope="all"]').find("a span").html(a)):(this.heartbeat_data.highlights[d]=[],q.each(i,function(e,t){s.heartbeat_data.highlights[d].push(q(t).data("bp-activity-id"))})),q.each(o,function(e,t){var a;void 0!==s.heartbeat_data.highlights[t]&&s.heartbeat_data.highlights[t].length&&(a=0,"mentions"===t&&(a=s.mentions_count),q(bp.Nouveau.objectNavParent+' [data-bp-scope="'+t+'"]').find("a span").html(Number(s.heartbeat_data.highlights[t].length)+a))}),o.pop(),q(document).prop("title","("+a+") "+this.heartbeat_data.document_title),q('#buddypress [data-bp-list="activity"] li').first().hasClass("load-newest")?(i=q('#buddypress [data-bp-list="activity"] .load-newest a').html(),q('#buddypress [data-bp-list="activity"] .load-newest a').html(i.replace(/([0-9]+)/,a))):q('#buddypress [data-bp-list="activity"] ul.activity-list').prepend('
    • '+BP_Nouveau.newest+" ("+a+")
    • "),q('#buddypress [data-bp-list="activity"] li.load-newest').trigger("click"),q('#buddypress [data-bp-list="activity"]').trigger("bp_heartbeat_pending",this.heartbeat_data),void 0!==bp.Nouveau&&bp.Nouveau.reportPopUp())},injectActivities:function(e){var t,a,i,o,d=bp.Nouveau.getStorage("bp-activity"),s=d.scope||null,d=d.filter||null;q(e.currentTarget).hasClass("load-newest")?(e.preventDefault(),q(e.currentTarget).remove(),i=q.parseHTML(this.heartbeat_data.newest),q.each(i,function(e,t){"LI"===t.nodeName&&q(t).hasClass("just-posted")&&q("#"+q(t).prop("id")).length&&q("#"+q(t).prop("id")).remove()}),(0<(i=q(e.delegateTarget).find(".activity-list .activity-item").first()).length&&i.hasClass("bb-pinned")?q(i).after(this.heartbeat_data.newest):q(e.delegateTarget).find(".activity-list").prepend(this.heartbeat_data.newest)).find("li.activity-item").each(bp.Nouveau.hideSingleUrl).trigger("bp_heartbeat_prepend",this.heartbeat_data),this.heartbeat_data.newest="","all"===s&&q(bp.Nouveau.objectNavParent+' [data-bp-scope="all"]').find("a span").html(""),"mentions"===s&&(bp.Nouveau.ajax({action:"activity_clear_new_mentions"},"activity"),this.mentions_count=0),q(bp.Nouveau.objectNavParent+' [data-bp-scope="'+s+'"]').find("a span").html(""),void 0!==this.heartbeat_data.highlights[s]&&(this.heartbeat_data.highlights[s]=[]),setTimeout(function(){q(e.delegateTarget).find("[data-bp-activity-id]").removeClass("newest_"+s+"_activity")},3e3),q(document).prop("title",this.heartbeat_data.document_title),jQuery(window).scroll()):q(e.currentTarget).hasClass("load-more")&&(t=+Number(this.current_page)+1,a=this,i="",e.preventDefault(),(o=q(e.currentTarget)).find("a").first().addClass("loading"),this.just_posted=[],q(e.delegateTarget).children(".just-posted").each(function(){a.just_posted.push(q(this).data("bp-activity-id"))}),q("#buddypress .dir-search input[type=search]").length&&(i=q("#buddypress .dir-search input[type=search]").val()),bp.Nouveau.objectRequest({object:"activity",scope:s,filter:d,search_terms:i,page:t,method:"append",exclude_just_posted:this.just_posted.join(","),target:"#buddypress [data-bp-list] ul.bp-list"}).done(function(e){!0===e.success&&(o.remove(),a.current_page=t,jQuery(window).scroll())})),q(".activity-item.bb-closed-comments").find(".edit-activity, .acomment-edit").parents(".generic-button").hide()},hideComments:function(e){var a,i,o,e=q(e.target).find(".activity-comments");e.length&&e.each(function(e,t){o=q(t).children("ul").not(".conflict-activity-ul-li-comment"),(i=q(o).find("li").not(q(".document-action-class, .media-action-class, .video-action-class"))).length&&(q("body").hasClass("activity-singular")&&""!==window.location.hash&&q(window.location.hash).length&&0!==q(window.location.hash).closest(".activity-comments").length||(a=q(t).closest(".activity-item"),q("#acomment-comment-"+a.data("bp-activity-id")+" span.comment-count").html(),i.each(function(e,t){if(e"),window.location.hash&&"#"+q(t).attr("id")===window.location.hash)return q(t).parents("li.comment-item").show(),!1;q(t).addClass("bp-hidden").hide()}}),q(o).children(".bp-hidden").length===q(o).children("li").length-1&&q(o).find("li.show-all").length&&q(o).children("li:not(.show-all)").removeClass("bp-hidden").toggle()))})},showActivity:function(e){e.preventDefault();var t=q(e.currentTarget).parent(),a=t.data("parent_comment_id"),t=q(t).data("activity_id");q(document).trigger("activityModalOpened",{activityId:t}),q(e.currentTarget).parents(".activity-comments").find(".ac-form").each(function(){var e=q(this),t=q(this).closest(".activity-comments"),a=q(this).closest(".comment-item");e.find(".post-elements-buttons-item.post-emoji").removeClass("active").empty(""),bp.Nouveau.Activity.resetActivityCommentForm(e,"hardReset"),t.append(e),a.find(".acomment-display").removeClass("display-focus"),a.removeClass("comment-item-focus")}),bp.Nouveau.Activity.launchActivityPopup(t,a)},closeActivity:function(e){e.preventDefault();var t=q(e.target).closest(".bb-activity-model-wrapper"),a=t.find(".bb-modal-activity-footer"),i=t.find(".activity-item").data("bp-activity-id"),e=t.find("#ac-form-"+i);bp.Nouveau.Activity.reinitializeActivityCommentForm(e),_.isUndefined(BP_Nouveau.media)||_.isUndefined(BP_Nouveau.media.emoji)||bp.Nouveau.Activity.initializeEmojioneArea(!1,"",i),t.find("#activity-modal").removeClass("bb-closed-comments"),t.closest("body").removeClass("acomments-modal-open"),t.hide(),t.find("ul.activity-list").empty(),a.removeClass("active"),a.find("form.ac-form").remove()},scopeLoaded:function(e,a){this.current_page=1,"mentions"===a.scope&&void 0!==a.response.new_mentions?(q.each(a.response.new_mentions,function(e,t){q("#buddypress #activity-stream").find('[data-bp-activity-id="'+t+'"]').addClass("newest_mentions_activity")}),this.mentions_count=0):void 0!==this.heartbeat_data.highlights[a.scope]&&this.heartbeat_data.highlights[a.scope].length&&q.each(this.heartbeat_data.highlights[a.scope],function(e,t){q("#buddypress #activity-stream").find('[data-bp-activity-id="'+t+'"]').length&&q("#buddypress #activity-stream").find('[data-bp-activity-id="'+t+'"]').addClass("newest_"+a.scope+"_activity")}),this.heartbeat_data.newest="",q.each(q(bp.Nouveau.objectNavParent+" [data-bp-scope]").find("a span"),function(e,t){0===parseInt(q(t).html(),10)&&q(t).html("")}),void 0!==this.heartbeat_data.highlights[a.scope]&&(this.heartbeat_data.highlights[a.scope]=[]),q(document).prop("title",this.heartbeat_data.document_title),setTimeout(function(){q("#buddypress #activity-stream .activity-item").removeClass("newest_"+a.scope+"_activity")},3e3),void 0!==window.instgrm&&window.instgrm.Embeds.process(),void 0!==window.FB&&void 0!==window.FB.XFBML&&window.FB.XFBML.parse(),this.fixAtWhoActivity(),this.openEditActivityPopup(),this.navigateToSpecificComment(),setTimeout(function(){jQuery(window).scroll()},200)},openEditActivityPopup:function(){var e,t;!_.isUndefined(BP_Nouveau.activity.params.is_activity_edit)&&0 ul");if(e.data.redirect)return window.location.href=e.data.redirect;e.data.parent_activity_id&&e.data.activity&&q("body:not(.activity-singular) #buddypress #activity-stream ul.activity-list li#activity-"+e.data.parent_activity_id).replaceWith(e.data.activity),k&&(x=1,i=B.find(".acomments-view-more").data("child-count"),c.append(B.find("form")),q.each(B.find("li.comment-item"),function(){x+=1}),x+=void 0!==i?parseFloat(i):0,N=m.find("span.comments-count"),z=N.text().length?N.text().match(/\d+/)[0]:0,z=Number(z-x),p.length?(i=1 ul").html().trim()&&t.removeClass("has-child-comments")}),k||c.data("bp-timestamp")!==d.Activity.heartbeat_data.last_recorded||(d.Activity.heartbeat_data.newest="",d.Activity.heartbeat_data.last_recorded=0),q(document).trigger("bp_activity_ajax_delete_request",q.extend(A,{response:e})),q(document).trigger("bp_activity_ajax_delete_request_video",q.extend(A,{response:e})),bp.Nouveau.Activity.activityHasUpdates=!0,bp.Nouveau.Activity.currentActivityId=r}j.removeClass("active")})}if(l.closest("span").hasClass("activity-read-more")){var T=l.closest("div"),U=l.closest("span");if(C=null,q(T).hasClass("activity-inner")?C=r:q(T).hasClass("acomment-content")&&(C=l.closest("li").data("bp-activity-comment-id")),!C)return e;e.preventDefault(),q(U).addClass("loading"),d.ajax({action:"get_single_activity_content",id:C},"activity").done(function(e){"object"!=typeof e&&0/gi,"\n").replace(/<\/div>/gi,""),S={action:"new_activity_comment",_wpnonce_new_activity_comment:q("#_wpnonce_new_activity_comment").val(),comment_id:C,form_id:r,content:R};q("#_bp_as_nonce_"+r).val()&&(S["_bp_as_nonce_"+r]=q("#_bp_as_nonce_"+r).val()),this.dropzone_media.length&&(S.media=this.dropzone_media),this.dropzone_document.length&&(S.document=this.dropzone_document),this.dropzone_video.length&&(S.video=this.dropzone_video,_.isEmpty(S.content)&&(S.content="​")),_.isUndefined(this.models[r])||(n=this.models[r],S.gif_data=this.models[r].get("gif_data")),S.content=S.content.replace(/ /g," "),s.hasClass("acomment-edit")&&(S.edit_comment=!0);var H=0"):t.append("
        ")),H?s.closest("#activity-modal").find(".bb-modal-activity-body .activity-comments, .bb-modal-activity-body .activity-comments .activity-actions").children("ul").append(q(a)):t.children("ul").append(q(a).hide().fadeIn(200)),q(s).find(".ac-input").first().html(""),t.parent().addClass("has-comments"),t.parent().addClass("comments-loaded"),m.addClass("has-comments")),s.removeClass("acomment-edit");t=s.find(".ac-reply-content");if(0'+BP_Nouveau.activity.strings.commentPostError+""):(e=e.responseJSON&&e.responseJSON.message?e.responseJSON.message:e.statusText,s.find(".ac-reply-content").after('
        '+e+"
        "))})}if(l.hasClass("edit")&&l.hasClass("edit-activity")&&(e.preventDefault(),R=c.data("bp-activity"),S=""!==c.data("link-url")?c.data("link-url"):null,void 0!==R&&(bp.Nouveau.Activity.postForm.displayEditActivityForm(R,S),l.closest("li").hasClass("groups")?q("#bp-nouveau-activity-form").addClass("group-activity"):q("#bp-nouveau-activity-form").removeClass("group-activity"),void 0!==bp.Nouveau.Media&&void 0!==bp.Nouveau.Media.Theatre&&(bp.Nouveau.Media.Theatre.is_open_media||bp.Nouveau.Media.Theatre.is_open_document)&&(q(document).find(".bb-close-media-theatre").trigger("click"),q(document).find(".bb-close-document-theatre").trigger("click")))),u&&(l.hasClass("bb-open-media-theatre")||l.hasClass("bb-open-video-theatre")||l.hasClass("bb-open-document-theatre")||l.hasClass("document-detail-wrap-description-popup"))&&(e.preventDefault(),l.closest("#activity-modal").find(".bb-modal-activity-header .bb-close-action-popup").trigger("click")),l.hasClass("pin-activity")||l.hasClass("unpin-activity")){if(e.preventDefault(),!r)return e;l.closest(".activity-item").addClass("loading-pin");var O="pin";l.hasClass("unpin-activity")&&(O="unpin"),d.ajax({action:"activity_update_pinned_post",id:r,pin_action:O},"activity").done(function(e){var t,a,i,o,d,s,n;l.closest(".activity-item").removeClass("loading-pin"),void 0!==(e="object"!=typeof e?JSON.parse(e):e).data&&void 0!==e.data.feedback&&(t=l.closest("ul.activity-list"),n=u?l.closest(".buddypress-wrap").find("#activity-stream"):l.closest("#activity-stream"),e.success&&(a=bp.Nouveau.getStorage("bp-activity","scope"),o=i=!1,d="",l.closest("li.activity-item").hasClass("groups")&&(o=!0,d=(d=l.closest("li.activity-item").attr("class").match(/group-\d+/))[0].replace("group-","")),n.hasClass("single-user")?i=!1:(n.hasClass("activity")&&"all"===a&&!o||n.hasClass("single-group"))&&(i=!0),"pin"===O?(i&&t.find("li.activity-item").removeClass("bb-pinned"),s="li.activity-item:not(.groups)",o&&!n.hasClass("single-group")?s="li.activity-item.group-"+d:o&&n.hasClass("single-group")&&(s="li.activity-item"),t.find(s).each(function(){var e=q(this).find(".unpin-activity");e.removeClass("unpin-activity").addClass("pin-activity"),o?e.find("span").html(BP_Nouveau.activity.strings.pinGroupPost):e.find("span").html(BP_Nouveau.activity.strings.pinPost)}),i&&l.closest("li.activity-item").addClass("bb-pinned"),l.addClass("unpin-activity"),l.removeClass("pin-activity"),l.closest("li.activity-item").hasClass("groups")?l.find("span").html(BP_Nouveau.activity.strings.unpinGroupPost):l.find("span").html(BP_Nouveau.activity.strings.unpinPost)):"unpin"===O&&(l.closest("li.activity-item").removeClass("bb-pinned"),l.addClass("pin-activity"),l.removeClass("unpin-activity"),l.closest("li.activity-item").hasClass("groups")?l.find("span").html(BP_Nouveau.activity.strings.pinGroupPost):l.find("span").html(BP_Nouveau.activity.strings.pinPost)),"all"===a&&i&&(bp.Nouveau.Activity.heartbeat_data.last_recorded=0,bp.Nouveau.refreshActivities())),q(document).trigger("bb_trigger_toast_message",["","
        "+e.data.feedback+"
        ","success",null,!0]))}).fail(function(){l.closest(".activity-item").removeClass("loading-pin"),q(document).trigger("bb_trigger_toast_message",["","
        "+BP_Nouveau.activity.strings.pinPostError+"
        ","error",null,!0])})}if(l.hasClass("bb-icon-bell-slash")||l.hasClass("bb-icon-bell")){if(e.preventDefault(),!r)return e;l.closest(".activity-item").addClass("loading-mute");var Q="mute";l.hasClass("bb-icon-bell")&&(Q="unmute"),d.ajax({action:"toggle_activity_notification_status",id:r,notification_toggle_action:Q},"activity").done(function(e){l.closest(".activity-item").removeClass("loading-mute"),void 0!==(e="object"!=typeof e?JSON.parse(e):e).data&&void 0!==e.data.feedback&&(e.success&&("mute"===Q?(l.closest("li.activity-item").addClass("bb-muted"),l.removeClass("bb-icon-bell-slash"),l.addClass("bb-icon-bell"),l.attr("title",BP_Nouveau.activity.strings.unmuteNotification),l.find("span").html(BP_Nouveau.activity.strings.unmuteNotification)):"unmute"===Q&&(l.closest("li.activity-item").removeClass("bb-muted"),l.removeClass("bb-icon-bell"),l.addClass("bb-icon-bell-slash"),l.attr("title",BP_Nouveau.activity.strings.muteNotification),l.find("span").html(BP_Nouveau.activity.strings.muteNotification)),void 0!==bp.Nouveau.Activity.activityHasUpdates&&(bp.Nouveau.Activity.activityHasUpdates=!0)),q(document).trigger("bb_trigger_toast_message",["","
        "+e.data.feedback+"
        ","success",null,!0])),u&&(bp.Nouveau.Activity.activityPinHasUpdates=!0),bp.Nouveau.Activity.activityHasUpdates=!0,bp.Nouveau.Activity.currentActivityId=r}).fail(function(){l.closest(".activity-item").removeClass("loading-pin"),q(document).trigger("bb_trigger_toast_message",["","
        "+BP_Nouveau.activity.strings.pinPostError+"
        ","error",null,!0])})}if(l.hasClass("close-activity-comment")||l.hasClass("unclose-activity-comment")){if(e.preventDefault(),!r)return e;l.closest(".activity-item").addClass("loading-pin");var V="close_comments";l.hasClass("unclose-activity-comment")&&(V="unclose_comments"),d.ajax({action:"activity_update_close_comments",id:r,close_comments_action:V},"activity").done(function(e){var t;l.closest(".activity-item").removeClass("loading-pin"),void 0!==(e="object"!=typeof e?JSON.parse(e):e).data&&void 0!==e.data.feedback&&(e.success&&(t=q("#activity-stream > .activity-list").find("[data-bp-activity-id="+r+"]"),l.closest(".activity-item").find(".bb-activity-closed-comments-notice").remove(),"close_comments"===V?(l.closest("li.activity-item").addClass("bb-closed-comments"),0'+e.data.feedback+""),0'+e.data.feedback+""))):"unclose_comments"===V&&(l.closest("li.activity-item.bb-closed-comments").find(".edit-activity, .acomment-edit").parents(".generic-button").show(),l.closest("li.activity-item").removeClass("bb-closed-comments"),0"+e.data.feedback+"",e.success?"success":"error",null,!0]))}).fail(function(){l.closest(".activity-item").removeClass("loading-pin"),q(document).trigger("bb_trigger_toast_message",["","
        "+BP_Nouveau.activity.strings.closeCommentsError+"
        ","error",null,!0])})}},commentFormAction:function(e){var t,a;return(e=e||window.event).target?t=e.target:e.srcElement&&(t=e.srcElement),3===t.nodeType&&(t=t.parentNode),!0!==e.altKey&&!0!==e.metaKey&&"TEXTAREA"===t.tagName&&q(t).hasClass("ac-input")?void(27===(a=e.keyCode||e.which)&&!1===e.ctrlKey?"TEXTAREA"===t.tagName&&q(t).closest("form").slideUp(200):e.ctrlKey&&13===a&&q(t).val()&&q(t).closest("form").find("[type=submit]").first().trigger("click")):e},togglePopupDropdown:function(e){var t;return(e=e||window.event).target?t=e.target:e.srcElement&&(t=e.srcElement),3===t.nodeType&&(t=t.parentNode),!0===e.altKey||!0===e.metaKey||q(t).hasClass("privacy-wrap")||q(t).parent().hasClass("privacy-wrap")?e:void q("ul.activity-privacy").removeClass("bb-open")},loadMoreActivities:function(){var e,t=q(".load-more:visible").last(),a=q(window);t.closest(".activity-list").length&&t.get(0)&&!t.data("bp-autoloaded")&&(e=t.offset().top-50,a.scrollTop()+a.height()>e&&(t.data("bp-autoloaded",1),t.find("a").text(BP_Nouveau.activity.strings.loadingMore),t.find("a").trigger("click")))},destroyCommentMediaUploader:function(e){_.isNull(this.dropzone_obj)||(this.dropzone_obj.destroy(),q("#ac-reply-post-media-uploader-"+e).html(""),q("#ac-reply-post-media-uploader-1-"+e).html("")),this.dropzone_media=[],q("#ac-reply-post-media-uploader-"+e).removeClass("open").addClass("closed"),q("#ac-reply-media-button-"+e).removeClass("active")},destroyCommentDocumentUploader:function(e){_.isNull(this.dropzone_document_obj)||(this.dropzone_document_obj.destroy(),q("#ac-reply-post-document-uploader-"+e).html("")),this.dropzone_document=[],q("#ac-reply-post-document-uploader-"+e).removeClass("open").addClass("closed"),q("#ac-reply-document-button-"+e).removeClass("active")},destroyCommentVideoUploader:function(e){_.isNull(this.dropzone_video_obj)||(this.dropzone_video_obj.destroy(),q("#ac-reply-post-video-uploader-"+e).html("")),this.dropzone_video=[],q("#ac-reply-post-video-uploader-"+e).removeClass("open").addClass("closed"),q("#ac-reply-video-button-"+e).removeClass("active")},resetGifPicker:function(e){q("#ac-reply-gif-button-"+e).closest(".post-gif").find(".gif-media-search-dropdown").removeClass("open").empty(),q("#ac-reply-gif-button-"+e).removeClass("active"),q(".gif-media-search-dropdown-standalone").removeClass("open").empty(),_.isUndefined(this.models[e])||(this.models[e].set("gif_data",{}),q("#ac-reply-post-gif-"+e).find(".activity-attached-gif-container").removeAttr("style"))},openCommentsMediaUploader:function(e){var l=this,o=q(e.currentTarget),t=o.data("ac-id"),a=o.closest(".bp-ac-form-container").find("#ac-reply-post-media-uploader-"+t),i=0'+t+""),this.removeFile(e),a.removeClass("media-uploading"))}),l.dropzone_obj.on("removedfile",function(e){if(l.dropzone_media.length)for(var t in l.dropzone_media)if(e.upload.uuid==l.dropzone_media[t].uuid){void 0===l.dropzone_media[t].saved||l.dropzone_media[t].saved||bp.Nouveau.Media.removeAttachment(l.dropzone_media[t].id),l.dropzone_media.splice(t,1);break}var a,i;_.isNull(l.dropzone_obj)||_.isNull(l.dropzone_obj.files)||0!==l.dropzone_obj.files.length?o.closest(".ac-form").addClass("has-content"):(a=o.parents(".ac-reply-toolbar"),(i=o.closest(".ac-form")).removeClass("has-media"),a.find(".ac-reply-document-button")&&a.find(".ac-reply-document-button").parents(".post-elements-buttons-item").removeClass("disable"),a.find(".ac-reply-video-button")&&a.find(".ac-reply-video-button").parents(".post-elements-buttons-item").removeClass("disable"),a.find(".ac-reply-gif-button")&&a.find(".ac-reply-gif-button").parents(".post-elements-buttons-item").removeClass("disable"),a.find(".ac-reply-media-button")&&a.find(".ac-reply-media-button").parents(".post-elements-buttons-item").removeClass("no-click").find(".toolbar-button").removeClass("active"),q(l.dropzone_obj.element).removeClass("files-uploaded dz-progress-view").find(".dz-global-progress").remove(),l.validateCommentContent(i.find(".ac-textarea").children(".ac-input")))}),l.dropzone_obj.on("complete",function(){0===this.getUploadingFiles().length&&0===this.getQueuedFiles().length&&0'+t+""),this.removeFile(e),a.removeClass("media-uploading"))}),l.dropzone_document_obj.on("removedfile",function(e){if(l.dropzone_document.length)for(var t in l.dropzone_document)if(e.upload.uuid==l.dropzone_document[t].uuid){void 0===l.dropzone_document[t].saved||l.dropzone_document[t].saved||bp.Nouveau.Media.removeAttachment(l.dropzone_document[t].id),l.dropzone_document.splice(t,1);break}var a,i;_.isNull(l.dropzone_document_obj)||_.isNull(l.dropzone_document_obj.files)||0!==l.dropzone_document_obj.files.length?o.closest(".ac-form").addClass("has-content"):(a=o.parents(".ac-reply-toolbar"),(i=o.closest(".ac-form")).removeClass("has-media"),a.find(".ac-reply-media-button")&&a.find(".ac-reply-media-button").parents(".post-elements-buttons-item").removeClass("disable"),a.find(".ac-reply-video-button")&&a.find(".ac-reply-video-button").parents(".post-elements-buttons-item").removeClass("disable"),a.find(".ac-reply-gif-button")&&a.find(".ac-reply-gif-button").parents(".post-elements-buttons-item").removeClass("disable"),a.find(".ac-reply-document-button")&&a.find(".ac-reply-document-button").parents(".post-elements-buttons-item").removeClass("no-click").find(".toolbar-button").removeClass("active"),q(l.dropzone_document_obj.element).removeClass("files-uploaded dz-progress-view").find(".dz-global-progress").remove(),l.validateCommentContent(i.find(".ac-textarea").children(".ac-input")))}),l.dropzone_document_obj.on("complete",function(){0===this.getUploadingFiles().length&&0===this.getQueuedFiles().length&&0'),q(e.previewElement).closest(".dz-preview").addClass("dz-has-thumbnail")):bp.Nouveau.getVideoThumb&&bp.Nouveau.getVideoThumb(e,".dz-video-thumbnail")}),l.dropzone_video_obj.on("uploadprogress",function(){o.closest(".ac-form").addClass("media-uploading"),bp.Nouveau.dropZoneGlobalProgress&&bp.Nouveau.dropZoneGlobalProgress(this)}),l.dropzone_video_obj.on("success",function(e,t){if(100===e.upload.progress&&(q(e.previewElement).find(".dz-progress-ring circle")[0].style.strokeDashoffset=0,q(e.previewElement).find(".dz-progress-count").text("100% "+BP_Nouveau.video.i18n_strings.video_uploaded_text),q(e.previewElement).closest(".dz-preview").addClass("dz-complete")),t.data.id)return e.id=t.id,t.data.uuid=e.upload.uuid,t.data.menu_order=q(e.previewElement).closest(".dropzone").find(e.previewElement).index()-1,t.data.album_id=void 0!==BP_Nouveau.video&&void 0!==BP_Nouveau.video.album_id&&BP_Nouveau.video.album_id,t.data.group_id=void 0!==BP_Nouveau.video&&void 0!==BP_Nouveau.video.group_id&&BP_Nouveau.video.group_id,t.data.saved=!1,t.data.js_preview=q(e.previewElement).find(".dz-video-thumbnail img").attr("src"),l.dropzone_video.push(t.data),e.previewElement.classList.add("dz-success");var a,i,o,d,s,n=t.data.feedback;for(e.previewElement.classList.add("dz-error"),s=[],i=0,o=(d=e.previewElement.querySelectorAll("[data-dz-errormessage]")).length;i'+t+""),this.removeFile(e),a.removeClass("media-uploading"))}),l.dropzone_video_obj.on("removedfile",function(e){if(l.dropzone_video.length)for(var t in l.dropzone_video)if(e.upload.uuid==l.dropzone_video[t].uuid){void 0===l.dropzone_video[t].saved||l.dropzone_video[t].saved||bp.Nouveau.Media.removeAttachment(l.dropzone_video[t].id),l.dropzone_video.splice(t,1);break}var a,i;_.isNull(l.dropzone_video_obj)||_.isNull(l.dropzone_video_obj.files)||0!==l.dropzone_video_obj.files.length?o.closest(".ac-form").addClass("has-content"):(a=o.parents(".ac-reply-toolbar"),(i=o.closest(".ac-form")).removeClass("has-media"),a.find(".ac-reply-media-button")&&a.find(".ac-reply-media-button").parents(".post-elements-buttons-item").removeClass("disable"),a.find(".ac-reply-document-button")&&a.find(".ac-reply-document-button").parents(".post-elements-buttons-item").removeClass("disable"),a.find(".ac-reply-gif-button")&&a.find(".ac-reply-gif-button").parents(".post-elements-buttons-item").removeClass("disable"),a.find(".ac-reply-video-button")&&a.find(".ac-reply-video-button").parents(".post-elements-buttons-item").removeClass("no-click").find(".toolbar-button").removeClass("active"),q(l.dropzone_video_obj.element).removeClass("files-uploaded dz-progress-view").find(".dz-global-progress").remove(),l.validateCommentContent(i.find(".ac-textarea").children(".ac-input")))}),l.dropzone_video_obj.on("complete",function(){0===this.getUploadingFiles().length&&0===this.getQueuedFiles().length&&0/gi,"\n").replace(/<\/div>/gi,""))).replace(/ /g," ");""!==e.text().trim()||0<=t.indexOf("emojioneemoji")||e.closest("form").hasClass("acomment-edit")?e.closest("form").addClass("has-content"):e.closest("form").removeClass("has-content")},ReactionStatePopupTab:function(e){e.preventDefault(),q(this).closest(".activity-state-popup").find(".activity-state-popup_tab_panel li a").removeClass("active"),q(this).addClass("active"),q(this).closest(".activity-state-popup").find(".activity-state-popup_tab_content .activity-state-popup_tab_item").removeClass("active"),q(this).closest(".activity-state-popup").find("."+q(this).data("tab")).addClass("active")},closeActivityState:function(){q(".activity-state-popup").hide().removeClass("active")},listenCommentInput:function(e){var t,a;0/gi,"\n").replace(/<\/div>/gi,""));t=t.replace(/ /g," "),""!==jQuery(e.currentTarget).text().trim()||0<=t.indexOf("emojioneemoji")?jQuery(e.currentTarget).closest("form").addClass("has-content"):jQuery(e.currentTarget).closest("form").removeClass("has-content")}),q(t).closest("form").addClass("events-initiated"),this.InitiatedCommentForms.push(a)))},activityRootComment:function(e){var t=q(e.currentTarget).closest("#activity-modal"),a=t.find(".activity-item").data("bp-activity-id"),e=t.find("#ac-form-"+a);bp.Nouveau.Activity.resetActivityCommentForm(e,"hardReset"),t.find(".acomment-display").removeClass("display-focus"),t.find(".comment-item").removeClass("comment-item-focus"),t.find(".bb-modal-activity-footer").addClass("active").append(e),e.addClass("root"),e.find("#ac-input-"+a).focus(),bp.Nouveau.Activity.clearFeedbackNotice(e)},clearFeedbackNotice:function(e){e.find(".bp-ac-form-container").find(".bp-feedback").length&&e.find(".bp-ac-form-container").find(".bp-feedback").remove()},launchActivityPopup:function(e,t){var a=q("#activity-"+e),i=q(".bb-activity-model-wrapper"),o=a[0].outerHTML,d='[data-parent_comment_id="'+t+'"]',t=a.data("activity-popup-title");bp.Nouveau.Activity.activityHasUpdates=!1,bp.Nouveau.Activity.currentActivityId=null,bp.Nouveau.Activity.activityPinHasUpdates=!1,i.closest("body").addClass("acomments-modal-open"),i.show(),i.find("ul.activity-list").html(o),i.find(".bb-modal-activity-header h2").text(t),i.find(".bb-activity-video-elem").each(function(e,t){var o=q(t);o.find("video").each(function(e,t){var a=q(t),i=a.attr("id")+Math.floor(1e4*Math.random());a.attr("id",i);t=o.find(".video-action-wrap");a.insertAfter(t),o.find(".video-js").remove(),a.addClass("video-js"),videojs(i,{controls:!0,aspectRatio:"16:9",fluid:!0,playbackRates:[.5,1,1.5,2],fullscreenToggle:!1})})}),a.hasClass("bb-closed-comments")&&i.find("#activity-modal").addClass("bb-closed-comments");t=i.find("#ac-form-"+e);i.find(".acomment-display").removeClass("display-focus"),i.find(".comment-item").removeClass("comment-item-focus"),i.find(".bb-modal-activity-footer").addClass("active").append(t),t.removeClass("not-initialized").addClass("root"),t.find("#ac-input-"+e).focus(),bp.Nouveau.Activity.clearFeedbackNotice(t),t.removeClass("events-initiated");a=i.find(".bb-modal-activity-footer").find(".ac-input[contenteditable]");bp.Nouveau.Activity.listenCommentInput(a),i.find(".bb-activity-more-options-wrap .bb-activity-more-options-action, .bb-pin-action_button, .bb-mute-action_button").attr("data-balloon-pos","left"),i.find(".privacy-wrap").attr("data-bp-tooltip-pos","right"),i.find(d).children(".acomments-view-more").first().trigger("click"),_.isUndefined(BP_Nouveau.media)||_.isUndefined(BP_Nouveau.media.emoji)||bp.Nouveau.Activity.initializeEmojioneArea(!0,"#activity-modal ",e),void 0!==bp.Nouveau&&bp.Nouveau.reportPopUp(),bp.Nouveau.Activity.toggleMultiMediaOptions(t,"",".bb-modal-activity-footer")},viewMoreComments:function(e){e.preventDefault();var t=q(e.currentTarget).parent(),i=q(e.currentTarget),o=q(t).data("activity_id"),d=q(e.currentTarget).closest(".activity-comments"),s=q(e.currentTarget).closest(".activity-item"),n=q(t).data("parent_comment_id"),l="";i.addClass("loading").removeClass("acomments-view-more--hide"),d.addClass("active"),s.addClass("active"),i.html('
        ');var a={action:"activity_loadmore_comments",activity_id:o,parent_comment_id:n,offset:q(e.currentTarget).parents(".activity-comments").find('ul[data-parent_comment_id ="'+n+'"] > li.comment-item:not(.bb-recent-comment)').length,activity_type_is_blog:1"+e.data.message+"

        ").removeClass("acomments-view-more--hide"),d.removeClass("active"),s.removeClass("active")):void 0!==e.data&&void 0!==e.data.comments&&(t=q(".bb-internal-model .activity-comments").find("[data-activity_id='"+o+"'][data-parent_comment_id='"+n+"']"),a=q(q.parseHTML(e.data.comments)),0"+e.statusText+"

        ").removeClass("acomments-view-more--hide"),d.removeClass("active"),s.removeClass("active")})},autoloadMoreComments:function(){var e,t,a,i,o;0 ul > li.acomments-view-more:not(.loading), .bb-modal-activity-body .activity-comments .activity-actions > ul > li.acomments-view-more:not(.loading)"),o=q(".bb-activity-model-wrapper .bb-modal-activity-body"),i=q(".bb-activity-model-wrapper .bb-modal-activity-body").find(".activity-comments:not(.active)"),0a&&q(e).trigger("click").addClass("loading")),setTimeout(function(){jQuery(window).scroll()},200))},activitySyncOnModalClose:function(e,t){e.preventDefault();var e=(q(e.currentTarget).is(document)?q(".bb-activity-model-wrapper"):q(e.currentTarget).parents(".bb-activity-model-wrapper")).find("ul.activity-list > li").data("bp-activity-id"),e=void 0!==t?t:e,a=q("#activity-stream li.activity-item[data-bp-activity-id="+e+"]");0 .bb-modal-activity-body .activity-item").data("bp-activity-id");0/gi,"\n").replace(/<\/div>/gi,""));t=t.replace(/ /g," "),""!==e.text()||0<=t.indexOf("emojioneemoji")?e.closest("form").addClass("has-content"):e.closest("form").removeClass("has-content")},picker_show:function(){q(this.button[0]).closest(".post-emoji").addClass("active"),q(".emojionearea-theatre").removeClass("hide").addClass("show")},picker_hide:function(){q(this.button[0]).closest(".post-emoji").removeClass("active"),q(".emojionearea-theatre").removeClass("show").addClass("hide")}}})}},bp.Nouveau.Activity.start())}((bp,jQuery)); \ No newline at end of file diff --git a/src/bp-templates/bp-nouveau/js/buddypress-media.js b/src/bp-templates/bp-nouveau/js/buddypress-media.js index 7b514ec2ba..533cad6860 100644 --- a/src/bp-templates/bp-nouveau/js/buddypress-media.js +++ b/src/bp-templates/bp-nouveau/js/buddypress-media.js @@ -2112,6 +2112,9 @@ window.bp = window.bp || {}; if ( !_.isUndefined( BP_Nouveau.media ) && !_.isUndefined( BP_Nouveau.media.gif_api_key ) && !$targetEl.closest( '.post-gif' ).length ) { + if( $targetEl.closest( '.gif-media-search-dropdown' ).length ) { + return; + } target.find( 'form' ).find( '.gif-media-search-dropdown' ).removeClass( 'open' ); if ( $( '.gif-media-search-dropdown-standalone.open' ).length > 0 ) { target.find( '.gif-media-search-dropdown-standalone' ).removeClass( 'open' ); diff --git a/src/bp-templates/bp-nouveau/js/buddypress-media.min.js b/src/bp-templates/bp-nouveau/js/buddypress-media.min.js index f12f466703..96f0298f86 100644 --- a/src/bp-templates/bp-nouveau/js/buddypress-media.min.js +++ b/src/bp-templates/bp-nouveau/js/buddypress-media.min.js @@ -1 +1 @@ -window.bp=window.bp||{},function(p){"undefined"!=typeof BP_Nouveau&&(bp.Nouveau=bp.Nouveau||{},bp.Nouveau.Media={start:function(){this.setupGlobals(),this.addListeners()},setupGlobals:function(){var e=p("body");this.current_page=1,this.current_page_existing_media=1,this.current_page_albums=1,this.current_tab=!e.hasClass("single-topic")&&!e.hasClass("single-forum")&&"bp-dropzone-content",this.sort_by="",this.order_by="",this.currentTargetParent=BP_Nouveau.media.current_folder,this.moveToIdPopup=BP_Nouveau.media.move_to_id_popup,this.moveToTypePopup=BP_Nouveau.media.current_type,this.privacySelectorSelect="",this.privacySelectorSpan="",this.currentAlbum=BP_Nouveau.media.current_album,void 0!==window.Dropzone&&(window.Dropzone.autoDiscover=!1);e=document.getElementsByClassName("forum-post-document-template").length?document.getElementsByClassName("forum-post-document-template")[0].innerHTML:"";this.documentOptions={url:BP_Nouveau.ajaxurl,timeout:108e5,dictFileTooBig:BP_Nouveau.media.dictFileTooBig,acceptedFiles:BP_Nouveau.media.document_type,createImageThumbnails:!1,dictDefaultMessage:BP_Nouveau.media.dropzone_document_message,autoProcessQueue:!0,addRemoveLinks:!0,uploadMultiple:!1,maxFiles:void 0!==BP_Nouveau.document.maxFiles?BP_Nouveau.document.maxFiles:10,maxFilesize:void 0!==BP_Nouveau.document.max_upload_size?BP_Nouveau.document.max_upload_size:2,dictInvalidFileType:BP_Nouveau.document.dictInvalidFileType,dictMaxFilesExceeded:BP_Nouveau.media.document_dict_file_exceeded,previewTemplate:e,dictCancelUploadConfirmation:BP_Nouveau.media.dictCancelUploadConfirmation};var t,e=document.getElementsByClassName("forum-post-video-template").length?document.getElementsByClassName("forum-post-video-template")[0].innerHTML:"";this.videoOptions={url:BP_Nouveau.ajaxurl,timeout:108e5,dictFileTooBig:BP_Nouveau.video.dictFileTooBig,acceptedFiles:BP_Nouveau.video.video_type,createImageThumbnails:!1,dictDefaultMessage:BP_Nouveau.video.dropzone_video_message,autoProcessQueue:!0,addRemoveLinks:!0,uploadMultiple:!1,maxFiles:void 0!==BP_Nouveau.video.maxFiles?BP_Nouveau.video.maxFiles:10,maxFilesize:void 0!==BP_Nouveau.video.max_upload_size?BP_Nouveau.video.max_upload_size:2,dictInvalidFileType:BP_Nouveau.video.dictInvalidFileType,dictMaxFilesExceeded:BP_Nouveau.video.video_dict_file_exceeded,previewTemplate:e,dictCancelUploadConfirmation:BP_Nouveau.video.dictCancelUploadConfirmation},p("#bp-media-uploader").hasClass("bp-media-document-uploader")?(t=document.getElementsByClassName("forum-post-document-template").length?document.getElementsByClassName("forum-post-document-template")[0].innerHTML:"",this.options={url:BP_Nouveau.ajaxurl,timeout:108e5,dictFileTooBig:BP_Nouveau.media.dictFileTooBig,acceptedFiles:BP_Nouveau.media.document_type,createImageThumbnails:!1,dictDefaultMessage:BP_Nouveau.media.dropzone_document_message,autoProcessQueue:!0,addRemoveLinks:!0,uploadMultiple:!1,maxFiles:void 0!==BP_Nouveau.document.maxFiles?BP_Nouveau.document.maxFiles:10,maxFilesize:void 0!==BP_Nouveau.document.max_upload_size?BP_Nouveau.document.max_upload_size:2,dictInvalidFileType:bp_media_dropzone.dictInvalidFileType,dictMaxFilesExceeded:BP_Nouveau.media.document_dict_file_exceeded,previewTemplate:t,dictCancelUploadConfirmation:BP_Nouveau.media.dictCancelUploadConfirmation}):(t=document.getElementsByClassName("forum-post-media-template").length?document.getElementsByClassName("forum-post-media-template")[0].innerHTML:"",this.options={url:BP_Nouveau.ajaxurl,timeout:108e5,dictFileTooBig:BP_Nouveau.media.dictFileTooBig,dictDefaultMessage:BP_Nouveau.media.dropzone_media_message,acceptedFiles:"image/*",autoProcessQueue:!0,addRemoveLinks:!0,uploadMultiple:!1,maxFiles:void 0!==BP_Nouveau.media.maxFiles?BP_Nouveau.media.maxFiles:10,maxFilesize:void 0!==BP_Nouveau.media.max_upload_size?BP_Nouveau.media.max_upload_size:2,dictInvalidFileType:bp_media_dropzone.dictInvalidFileType,dictMaxFilesExceeded:BP_Nouveau.media.media_dict_file_exceeded,previewTemplate:t,dictCancelUploadConfirmation:BP_Nouveau.media.dictCancelUploadConfirmation,maxThumbnailFilesize:void 0!==BP_Nouveau.media.max_upload_size?BP_Nouveau.media.max_upload_size:2}),void 0!==BP_Nouveau.media.dropzone_options&&Object.assign(this.options,BP_Nouveau.media.dropzone_options),this.dropzone_obj=[],this.dropzone_media=[],this.album_id=void 0!==BP_Nouveau.media.album_id&&BP_Nouveau.media.album_id,this.current_folder=void 0!==BP_Nouveau.media.current_folder&&BP_Nouveau.media.current_folder,this.current_group_id=void 0!==BP_Nouveau.media.current_group_id&&BP_Nouveau.media.current_group_id,this.group_id=void 0!==BP_Nouveau.media.group_id&&BP_Nouveau.media.group_id,this.bbp_is_reply_edit=void 0!==window.BP_Forums_Nouveau&&void 0!==window.BP_Forums_Nouveau.media.bbp_is_reply_edit&&window.BP_Forums_Nouveau.media.bbp_is_reply_edit,this.bbp_is_topic_edit=void 0!==window.BP_Forums_Nouveau&&void 0!==window.BP_Forums_Nouveau.media.bbp_is_topic_edit&&window.BP_Forums_Nouveau.media.bbp_is_topic_edit,this.bbp_is_forum_edit=void 0!==window.BP_Forums_Nouveau&&void 0!==window.BP_Forums_Nouveau.media.bbp_is_forum_edit&&window.BP_Forums_Nouveau.media.bbp_is_forum_edit,this.bbp_reply_edit_media=void 0!==window.BP_Forums_Nouveau&&void 0!==window.BP_Forums_Nouveau.media.reply_edit_media?window.BP_Forums_Nouveau.media.reply_edit_media:[],this.bbp_reply_edit_document=void 0!==window.BP_Forums_Nouveau&&void 0!==window.BP_Forums_Nouveau.media.reply_edit_document?window.BP_Forums_Nouveau.media.reply_edit_document:[],this.bbp_reply_edit_video=void 0!==window.BP_Forums_Nouveau&&void 0!==window.BP_Forums_Nouveau.media.reply_edit_video?window.BP_Forums_Nouveau.media.reply_edit_video:[],this.bbp_topic_edit_media=void 0!==window.BP_Forums_Nouveau&&void 0!==window.BP_Forums_Nouveau.media.topic_edit_media?window.BP_Forums_Nouveau.media.topic_edit_media:[],this.bbp_topic_edit_video=void 0!==window.BP_Forums_Nouveau&&void 0!==window.BP_Forums_Nouveau.media.topic_edit_video?window.BP_Forums_Nouveau.media.topic_edit_video:[],this.bbp_topic_edit_document=void 0!==window.BP_Forums_Nouveau&&void 0!==window.BP_Forums_Nouveau.media.topic_edit_document?window.BP_Forums_Nouveau.media.topic_edit_document:[],this.bbp_forum_edit_media=void 0!==window.BP_Forums_Nouveau&&void 0!==window.BP_Forums_Nouveau.media.forum_edit_media?window.BP_Forums_Nouveau.media.forum_edit_media:[],this.bbp_forum_edit_document=void 0!==window.BP_Forums_Nouveau&&void 0!==window.BP_Forums_Nouveau.media.forum_edit_document?window.BP_Forums_Nouveau.media.forum_edit_document:[],this.bbp_forum_edit_video=void 0!==window.BP_Forums_Nouveau&&void 0!==window.BP_Forums_Nouveau.media.forum_edit_video?window.BP_Forums_Nouveau.media.forum_edit_video:[],this.bbp_reply_edit_gif_data=void 0!==window.BP_Forums_Nouveau&&void 0!==window.BP_Forums_Nouveau.media.reply_edit_gif_data?window.BP_Forums_Nouveau.media.reply_edit_gif_data:[],this.bbp_topic_edit_gif_data=void 0!==window.BP_Forums_Nouveau&&void 0!==window.BP_Forums_Nouveau.media.topic_edit_gif_data?window.BP_Forums_Nouveau.media.topic_edit_gif_data:[],this.bbp_forum_edit_gif_data=void 0!==window.BP_Forums_Nouveau&&void 0!==window.BP_Forums_Nouveau.media.forum_edit_gif_data?window.BP_Forums_Nouveau.media.forum_edit_gif_data:[],this.giphy=null,this.gif_offset=0,this.gif_q=null,this.gif_limit=20,this.gif_requests=[],this.gif_data=[],this.gif_container_key=!1,this.reply_topic_allow_delete_media=!1,this.reply_topic_display_post="edit",bp.Nouveau.Media.documentCodeMirror(),p(window).on("scroll resize",function(){bp.Nouveau.Media.documentCodeMirror()})},addListeners:function(){var e=p(".bp-nouveau"),t=p(".bp-existing-media-wrap");e.on("click","#bp-add-media",this.openUploader.bind(this)),e.on("click","#bp-add-document",this.openDocumentUploader.bind(this)),e.on("click","#bp-media-submit",this.submitMedia.bind(this)),e.on("click","#bp-media-document-submit",this.submitDocumentMedia.bind(this)),e.on("click","#bp-media-uploader-close",this.closeUploader.bind(this)),e.on("click","#bb-delete-media",this.deleteMedia.bind(this)),e.on("click","#bb-select-deselect-all-media",this.toggleSelectAllMedia.bind(this)),p('#buddypress [data-bp-list="media"]').on("bp_ajax_request",this.bp_ajax_media_request),e.on("click","#bb-create-album",this.openCreateAlbumModal.bind(this)),p(document).on("click","#bb-create-folder",this.openCreateFolderModal.bind(this)),p(document).on("click","#bb-create-folder-child",this.openCreateFolderChildModal.bind(this)),p(document).on("click","#bp-edit-folder-open",this.openEditFolderChildModal.bind(this)),p(document).on("click","#bp-media-create-album-submit",this.saveAlbum.bind(this)),p(document).on("click","#bp-media-create-folder-submit",this.saveFolder.bind(this)),p(document).on("click","#bp-media-create-child-folder-submit",this.saveChildFolder.bind(this)),e.on("click","#bp-media-create-album-close",this.closeCreateAlbumModal.bind(this)),p(document).on("click","#bp-media-create-folder-close",this.closeCreateFolderModal.bind(this)),p(document).on("click","#bp-media-edit-folder-close",this.closeEditFolderModal.bind(this)),p(document).on("click",".open-popup .errorPopup",this.closeErrorPopup.bind(this)),e.on("click","#bp-media-add-more",this.triggerDropzoneSelectFileDialog.bind(this)),p("#bp-media-uploader").on("click",".bp-media-upload-tab",this.changeUploadModalTab.bind(this)),p('.bp-nouveau [data-bp-list="media"]').on("click","li.load-more",this.injectMedias.bind(this)),p(".bp-nouveau #albums-dir-list").on("click","li.load-more",this.appendAlbums.bind(this)),t.on("click","li.load-more",this.appendMedia.bind(this)),e.on("change",'.bb-media-check-wrap [name="bb-media-select"]',this.addSelectedClassToWrapper.bind(this)),t.on("change",'.bb-media-check-wrap [name="bb-media-select"]',this.toggleSubmitMediaButton.bind(this)),e.on("click","#bp-edit-album-title",this.editAlbumTitle.bind(this)),p(document).on("click","#bp-edit-folder-title",this.editFolderTitle.bind(this)),e.on("click","#bp-cancel-edit-album-title",this.cancelEditAlbumTitle.bind(this)),e.on("click","#bp-save-album-title",this.saveAlbum.bind(this)),p(document).on("click","#bp-save-folder-title",this.saveFolder.bind(this)),e.on("change","#bp-media-single-album select#bb-album-privacy",this.saveAlbum.bind(this)),e.on("change","#media-stream select#bb-folder-privacy",this.savePrivacy.bind(this)),e.on("click","#bb-delete-album",this.deleteAlbum.bind(this)),p(document).on("click","#bb-delete-folder",this.deleteFolder.bind(this)),p(document).on("click","ul.document-nav li",this.resetPageDocumentDirectory.bind(this)),p(document).on("click","ul.document-nav li a",this.resetPageDocumentDirectory.bind(this)),p(document).on("click","#forums-media-button",this.openForumsUploader.bind(this)),p(document).on("click","#forums-document-button",this.openForumsDocumentUploader.bind(this)),p(document).on("click","#forums-video-button",this.openForumsVideoUploader.bind(this)),p(document).on("click","#forums-gif-button",this.toggleGifSelector.bind(this)),p(document).find("form #whats-new-toolbar, .forum form #whats-new-toolbar").on("keydown",".search-query-input",this.searchGif.bind(this)),p(document).on("click",".bbpress-forums-activity #whats-new-toolbar .found-media-item",this.selectGif.bind(this)),p(document).find("form #whats-new-toolbar, .forum form #whats-new-toolbar").on("click",".found-media-item",this.selectGif.bind(this)),p(document).find("form #whats-new-toolbar .gif-search-results, .forum form #whats-new-toolbar .gif-search-results").scroll(this.loadMoreGif.bind(this)),p(".buddypress.groups.messages").length||p(document).find("form #whats-new-toolbar, .forum form #whats-new-toolbar").on("click",".found-media-item",this.selectGif.bind(this)),p(document).find("form #whats-new-attachments .forums-attached-gif-container .gif-search-results, .forum form #whats-new-attachments .forums-attached-gif-container .gif-search-results").scroll(this.loadMoreGif.bind(this)),p(document).find("form #whats-new-attachments .forums-attached-gif-container, .forum form #whats-new-attachments .forums-attached-gif-container").on("click",".gif-image-remove",this.removeSelectedGif.bind(this)),p(document).on("click",".gif-image-container",this.playVideo.bind(this)),p(document).on("click",".directory.document .media-folder_action__anchor, .directory.document .media-folder_action__anchor li a, .bb-media-container .media-folder_action__anchor, .bb-media-container .media-folder_action__list li a",this.fileActionButton.bind(this)),p(document).on("click",".bb-activity-media-elem .copy_download_file_url a, .media-folder_action__list .copy_download_file_url a, .media .bb-photo-thumb .copy_download_file_url a",this.copyDownloadLink.bind(this)),p(document).on("click",".bb-activity-media-elem.media-activity .media-action-wrap .media-action_more, #media-stream.media .bb-photo-thumb .media-action-wrap .media-action_more, .bb-activity-media-elem.document-activity .document-action-wrap .document-action_more, .bb-activity-media-elem.document-activity .document-action-wrap .document-action_list li a",this.fileActivityActionButton.bind(this)),p(document).click(this.toggleFileActivityActionButton),p(document).on("click",".bb-activity-media-elem.document-activity .document-expand .document-expand-anchor, .bb-activity-media-elem.document-activity .document-action-wrap .document-action_collapse",this.toggleCodePreview.bind(this)),p(document).on("click",".activity .bp-document-move-activity, #media-stream .bp-document-move-activity",this.moveDocumentIntoFolder.bind(this)),p(document).on("click",'.bp-nouveau [data-bp-list="document"] .pager .dt-more-container.load-more',this.injectDocuments.bind(this)),p(document).on("click",'.bp-nouveau [data-bp-list="document"] .data-head',this.sortDocuments.bind(this)),p(document).on("click",".modal-container .bb-field-steps-actions",this.documentPopupNavigate.bind(this)),p(document).on("click",".bp-media-document-uploader .modal-container .bb-field-uploader-actions",this.uploadDocumentNavigate.bind(this)),p(document).on("click",".bp-media-photo-uploader .modal-container .bb-field-uploader-actions",this.uploadMediaNavigate.bind(this)),p(document).on("click",".modal-container #bp-media-edit-child-folder-submit",this.renameChildFolder.bind(this)),p(document).on("click",".activity .bp-media-move-activity, #media-stream .bp-media-move-activity",this.moveMediaIntoAlbum.bind(this));var i=p("#bb-media-model-container .activity-list, #media-stream");p('#buddypress .activity-list, #buddypress [data-bp-list="activity"], #bb-media-model-container .activity-list, #media-stream').on("click",".ac-document-move, .ac-folder-move",this.openDocumentMove.bind(this)),p('#buddypress .activity-list, #buddypress [data-bp-list="activity"], #bb-media-model-container .activity-list, #media-stream, .group-media #media-stream').on("click",".ac-media-move",this.openMediaMove.bind(this)),p('#buddypress .activity-list, #buddypress [data-bp-list="activity"], #bb-media-model-container .activity-list, #media-stream').on("click",".ac-document-close-button, .ac-folder-close-button",this.closeDocumentMove.bind(this)),p('#buddypress .activity-list, #buddypress [data-bp-list="activity"], #bb-media-model-container .activity-list, #media-stream').on("click",".ac-media-close-button",this.closeMediaMove.bind(this)),i.on("click",".ac-document-rename",this.renameDocument.bind(this)),i.on("click",".ac-document-privacy",this.editPrivacyDocument.bind(this)),i.on("keyup",".media-folder_name_edit",this.renameDocumentSubmit.bind(this)),i.on("click",".name_edit_cancel, .name_edit_save",this.renameDocumentSubmit.bind(this)),p(document).on("click",".document-file-delete",this.deleteDocument.bind(this)),p(document).on("click",".media-file-delete",this.deleteMedia.bind(this)),p(document).on("click",".bp-folder-move",this.folderMove.bind(this)),p(document).on("click",".bp-document-open-create-popup-folder",this.createFolderInPopup.bind(this)),p(document).on("click",".bp-media-open-create-popup-folder",this.createAlbumInPopup.bind(this)),p(document).on("click",".close-create-popup-folder",this.closeCreateFolderInPopup.bind(this)),p(document).on("click",".close-create-popup-album",this.closeCreateAlbumInPopup.bind(this)),p(document).on("click",".bp-document-create-popup-folder-submit",this.submitCreateFolderInPopup.bind(this)),p(document).on("click",".bp-media-create-popup-album-submit",this.submitCreateAlbumInPopup.bind(this));var a=p(".buddypress.groups.messages"),t=p(".buddypress.groups.messages form#send_group_message_form #whats-new-toolbar"),e=p(".buddypress.groups.messages form#send_group_message_form #whats-new-attachments .bp-group-messages-attached-gif-container .gif-search-results"),i=p(".buddypress.groups.messages form#send_group_message_form #whats-new-attachments .bp-group-messages-attached-gif-container");a.on("click","#bp-group-messages-media-button",this.openGroupMessagesUploader.bind(this)),a.on("click","#bp-group-messages-document-button",this.openGroupMessagesDocumentUploader.bind(this)),a.on("click","#bp-group-messages-video-button",this.openGroupMessagesVideoUploader.bind(this)),a.on("click","#bp-group-messages-gif-button",this.toggleGroupMessagesGifSelector.bind(this)),t.on("keyup",".search-query-input",this.searchGroupMessagesGif.bind(this)),t.on("click",".found-media-item",this.selectGroupMessagesGif.bind(this)),e.scroll(this.loadMoreGroupMessagesGif.bind(this)),p(".groups.messages form#send_group_message_form #whats-new-toolbar .bp-group-messages-attached-gif-container .gif-search-results").scroll(this.loadMoreGroupMessagesGif.bind(this)),i.on("click",".gif-image-remove",this.removeGroupMessagesSelectedGif.bind(this)),p(".bp-existing-media-wrap").on("scroll",this.loadExistingMedia.bind(this)),document.addEventListener("keyup",this.closePopup.bind(this)),document.addEventListener("keyup",this.submitPopup.bind(this)),p(window).bind("beforeunload",this.beforeunloadWindow.bind(this)),_.isUndefined(BP_Nouveau.media.gif_api_key)||(window.addEventListener("scroll",this.autoPlayGifVideos,!1),window.addEventListener("resize",this.autoPlayGifVideos,!1),document.addEventListener("keydown",_.bind(this.closePickersOnEsc,this)),p(document).on("click",_.bind(this.closePickersOnClick,this))),(this.bbp_is_reply_edit||this.bbp_is_topic_edit||this.bbp_is_forum_edit)&&(this.bbp_reply_edit_media.length||this.bbp_topic_edit_media.length||this.bbp_forum_edit_media.length)&&p("#forums-media-button").trigger("click"),(this.bbp_is_reply_edit||this.bbp_is_topic_edit||this.bbp_is_forum_edit)&&(this.bbp_reply_edit_document.length||this.bbp_topic_edit_document.length||this.bbp_forum_edit_document.length)&&p("#forums-document-button").trigger("click"),(this.bbp_is_reply_edit||this.bbp_is_topic_edit||this.bbp_is_forum_edit)&&(this.bbp_reply_edit_video.length||this.bbp_topic_edit_video.length||this.bbp_forum_edit_video.length)&&p("#forums-video-button").trigger("click"),(this.bbp_is_reply_edit||this.bbp_is_topic_edit||this.bbp_is_forum_edit)&&(Object.keys(this.bbp_reply_edit_gif_data).length||Object.keys(this.bbp_topic_edit_gif_data).length||Object.keys(this.bbp_forum_edit_gif_data).length)&&(this.editGifPreview(),(i=jQuery("#forums-gif-button").addClass("active").closest("form")).find("#forums-document-button")&&i.find("#forums-document-button").parents(".post-elements-buttons-item").addClass("disable"),i.find("#forums-media-button")&&i.find("#forums-media-button").parents(".post-elements-buttons-item").addClass("disable"),i.find("#forums-video-button")&&i.find("#forums-video-button").parents(".post-elements-buttons-item").addClass("disable")),"#openEditFolder"==window.location.hash&&p("#bp-media-edit-child-folder").length&&(history.pushState(null,null,window.location.href.split("#")[0]),p("#bp-media-edit-child-folder").show()),(this.bbp_is_reply_edit||this.bbp_is_topic_edit||this.bbp_is_forum_edit)&&(bp.Nouveau.Media.reply_topic_allow_delete_media=!0)},loadExistingMedia:function(){p(window).scroll()},resetPageDocumentDirectory:function(e){e.preventDefault(),this.current_page=1},submitCreateFolderInPopup:function(e){e.preventDefault();var i=p(e.currentTarget).closest(".open-popup"),a=p(i).find(".bp-document-create-popup-folder-submit"),t=i.find(".bb-folder-selected-id").val(),o=p.trim(p(e.currentTarget).closest(".modal-container").find(".popup-on-fly-create-folder-title").val()),d=p(e.currentTarget).closest(".modal-container").find(".popup-on-fly-create-folder-title"),s=/[\\/?%*:|"<>]+/g.exec(d.val()),s=Boolean(s);if(""===p.trim(d.val())||s)return d.addClass("error"),!1;d.removeClass("error"),this.currentTargetParent=t=""===t?0:t;var n=this.currentTargetParent,r=0,l="",c="",u=0;if("group"===this.moveToTypePopup?(l="grouponly",r=this.moveToIdPopup):(l=p(e.currentTarget).closest(".modal-container").find(".popup-on-fly-create-folder #bb-folder-privacy").val(),c=p(e.currentTarget).closest(".modal-container").find(".popup-on-fly-create-folder #bb-folder-privacy")),""===o)return alert(BP_Nouveau.media.create_folder_error_title),!1;a.addClass("loading"),setTimeout(function(){var e={action:"document_folder_save",_wpnonce:BP_Nouveau.nonces.media,title:o,privacy:l,parent:n,group_id:r};p.ajax({type:"POST",url:BP_Nouveau.ajaxurl,data:e,async:!1,success:function(e){var t;e.success&&(p(".document-data-table-head").length&&parseInt(n)===parseInt(BP_Nouveau.media.current_folder)&&(bp.Nouveau.inject("#media-stream div#media-folder-document-data-table",e.data.document,"prepend"),jQuery(window).scroll()),i.find(".location-folder-list-wrap .location-folder-list").remove(),i.find(".location-folder-list-wrap").append(e.data.tree_view),t="#"+p(i).attr("id"),bp.Nouveau.Media.folderLocationUI&&bp.Nouveau.Media.folderLocationUI(t,e.data.folder_id),u=e.data.folder_id,""===e.data.tree_view?(i.find(".location-folder-list-wrap").hide(),i.find(".location-folder-list-wrap-main span.no-folder-exists").show()):(i.find(".location-folder-list-wrap-main span.no-folder-exists").hide(),i.find(".location-folder-list-wrap").show()),i.find("ul.location-folder-list span#"+u).trigger("click"),i.find(".bb-model-footer").show(),i.find(".bb-model-footer, #bp-media-document-prev").show(),i.find(".bb-field-wrap-search").show(),i.find(".bp-document-open-create-popup-folder").show(),i.find(".location-folder-list-wrap-main").show(),i.find(".create-popup-folder-wrap").hide(),i.find(".bb-folder-selected-id").val(),i.find(".bb-folder-selected-id").val(u),i.find(".bb-model-header").children().show(),i.find(".bb-model-header p").hide(),d.val(""),""!==c&&c.val("public"),p(i).find(".breadcrumbs-append-ul-li .breadcrumb .item span:not(.hidden)").each(function(e){0p(i).find(".breadcrumbs-append-ul-li .breadcrumb").width()&&(p(i).find(".breadcrumbs-append-ul-li .breadcrumb .item span.hidden").append(p(i).find(".breadcrumbs-append-ul-li .breadcrumb .item span").eq(2)),p(i).find(".breadcrumbs-append-ul-li .breadcrumb .item .more_options").length||p('...').insertAfter(p(i).find(".breadcrumbs-append-ul-li .breadcrumb .item span").eq(0)))}),a.removeClass("loading"),setTimeout(function(){var e=i.find("ul.location-folder-list span#"+u);e.trigger("click");var t=p(i).find("#bb-document-privacy");0!==Number(e.data("id"))?(t.find("option").removeAttr("selected"),t.val(e.parent().data("privacy")),t.prop("disabled",!0)):(t.find("option").removeAttr("selected"),t.val("public"),t.prop("disabled",!1))},200))}}),this.currentTargetParent=u,i.find(".location-folder-list li.is_active").show().children("span, i").show().siblings("ul").hide(),i.find(".location-folder-list li.is_active").siblings("li").show().children("span, i").show().siblings("ul").hide(),i.find(".location-folder-list li span.selected").removeClass("selected"),i.find(".location-folder-list li.is_active").children("span").addClass("selected")},0)},submitCreateAlbumInPopup:function(e){e.preventDefault();var t=this,i=p(e.currentTarget).closest(".open-popup"),a=p(i).find(".bp-media-create-popup-album-submit"),o=i.find(".bb-album-selected-id").val();this.currentTargetParent=o=""===o?0:o;var d=this.currentTargetParent,s=0,n=p.trim(p(e.currentTarget).closest(".modal-container").find(".popup-on-fly-create-album-title").val()),r=p(e.currentTarget).closest(".modal-container").find(".popup-on-fly-create-album-title"),l="",c="",u=0;if("group"===this.moveToTypePopup?(l="grouponly",s=this.moveToIdPopup):(l=p(e.currentTarget).closest(".modal-container").find(".popup-on-fly-create-album #bb-album-privacy").val(),c=p(e.currentTarget).closest(".modal-container").find(".popup-on-fly-create-album #bb-album-privacy")),""===n)return alert(BP_Nouveau.media.create_album_error_title),!1;a.addClass("loading"),setTimeout(function(){var e={action:"media_album_save",_wpnonce:BP_Nouveau.nonces.media,title:n,privacy:l,parent:d,group_id:s};p.ajax({type:"POST",url:BP_Nouveau.ajaxurl,data:e,async:!1,success:function(e){e.success&&(i.find(".location-album-list-wrap .location-album-list").remove(),i.find(".location-album-list-wrap").append(e.data.tree_view),bp.Nouveau.Media.folderLocationUI&&bp.Nouveau.Media.folderLocationUI(i,e.data.album_id),u=e.data.album_id,""===e.data.tree_view?(i.find(".location-album-list-wrap").hide(),i.find(".location-album-list-wrap-main span.no-album-exists").show()):(i.find(".location-album-list-wrap-main span.no-album-exists").hide(),i.find(".location-album-list-wrap").show()),i.find("ul.location-album-list span#"+u).trigger("click"),i.find(".bb-model-footer").show(),i.find(".bb-field-wrap-search").show(),i.find(".bp-media-open-create-popup-album").show(),i.find(".location-album-list-wrap-main").show(),i.find(".create-popup-album-wrap").hide(),i.find(".bb-field-steps-2 #bp-media-prev").show(),i.find(".bb-album-selected-id").val(),i.find(".bb-album-selected-id").val(u),i.find(".bb-model-header").children().show(),i.find(".bb-model-header p").hide(),r.val(""),""!==c&&c.val("public"),p(i).find(".breadcrumbs-append-ul-li .breadcrumb .item span:not(.hidden)").each(function(e){0p(i).find(".breadcrumbs-append-ul-li .breadcrumb").width()&&(p(i).find(".breadcrumbs-append-ul-li .breadcrumb .item span.hidden").append(p(i).find(".breadcrumbs-append-ul-li .breadcrumb .item span").eq(2)),p(i).find(".breadcrumbs-append-ul-li .breadcrumb .item .more_options").length||p('...').insertAfter(p(i).find(".breadcrumbs-append-ul-li .breadcrumb .item span").eq(0)))}),t.updateAlbumNavCount(e.data.album_count)),a.removeClass("loading")}}),this.currentTargetParent=u,i.find(".location-album-list li.is_active").show().children("span, i").show().siblings("ul").hide(),i.find(".location-album-list li.is_active").siblings("li").show().children("span, i").show().siblings("ul").hide(),i.find(".location-album-list li span.selected").removeClass("selected"),i.find(".location-album-list li.is_active").children("span").addClass("selected")},0)},closeCreateFolderInPopup:function(e){e.preventDefault(),p(".modal-container .bb-model-footer").show(),p(".bb-field-wrap-search").show(),p(".bp-document-open-create-popup-folder").show(),p(".location-folder-list-wrap-main").show(),p("#bp-media-document-prev").show(),p(".create-popup-folder-wrap").hide(),p(e.currentTarget).closest(".has-folderlocationUI").find(".bb-model-header").children().show(),p(e.currentTarget).closest(".has-folderlocationUI").find(".bb-model-header p").hide()},closeCreateAlbumInPopup:function(e){e.preventDefault(),p(".modal-container .bb-model-footer").show(),p(".bb-field-wrap-search").show(),p(".bp-document-open-create-popup-folder").show(),p(".modal-container:visible .bp-video-open-create-popup-album").show(),p(".location-album-list-wrap-main").show(),p(".bb-field-steps-2 #bp-media-prev").show(),p(".bb-field-steps-2 #bp-video-next").show(),p(".create-popup-album-wrap").hide(),p(".bp-media-create-popup-album-submit.loading").removeClass("loading"),p(e.currentTarget).closest(".has-folderlocationUI").find(".bb-model-header").children().show(),p(e.currentTarget).closest(".has-folderlocationUI").find(".bb-model-header p").hide()},createFolderInPopup:function(e){e.preventDefault();var t=parseInt(p(document).find(".open-popup .bb-folder-selected-id").val()),i=p(document).find(".open-popup .bb-folder-create-from").val();0"+BP_Nouveau.media.create_folder+"

        "),p(".modal-container #bb-folder-privacy").addClass("new-folder-create-privacy"),p(document).find(".open-popup .error").hide()},createAlbumInPopup:function(e){e.preventDefault();var t=parseInt(p(document).find(".open-popup .bb-album-selected-id").val()),i=p(document).find(".open-popup .bb-album-create-from").val();0"+BP_Nouveau.media.create_album_title+"

        "),p(".modal-container #bb-folder-privacy").addClass("new-folder-create-privacy"),p(document).find(".open-popup .error").hide()},savePrivacy:function(e){var t,i,a,o=p(e.currentTarget);if(e.preventDefault(),o.hasClass("new-folder-create-privacy"))return!1;t=parseInt(o.data("item-id")),a=o.data("item-type"),i=o.val(),e=p(e.currentTarget).find("option:selected").text(),this.privacySelectorSelect.addClass("hide"),this.privacySelectorSpan.text(""),this.privacySelectorSpan.text(e),this.privacySelectorSpan.show(),0=t.scrollHeight&&!a.hasClass("loading")&&0=t.scrollHeight&&!p(e.target).closest(".bp-group-messages-attached-gif-container").hasClass("loading")&&0\n\t\n\t\t\n\t\n',e.data[t].saved=!1,this.gif_data.push(e.data[t]);p(".bp-group-messages-attached-gif-container").find(".gif-search-results-list").append(i)}void 0!==e.pagination&&void 0!==e.pagination.total_count&&(this.gif_total_count=e.pagination.total_count)},loadMoreGifResponse:function(e){var t=this,i=0;if(p('div.forums-attached-gif-container[data-key="'+t.gif_container_key+'"]').removeClass("loading"),void 0!==e.data&&e.data.length){for(var a="",i=0;i\n\t\n\t\t\n\t\n',e.data[i].saved=!1,t.gif_data[t.gif_container_key].data.push(e.data[i]);p('div.forums-attached-gif-container[data-key="'+t.gif_container_key+'"]').closest("form").find(".gif-search-results-list").append(a)}void 0!==e.pagination&&void 0!==e.pagination.total_count&&(t.gif_data[t.gif_container_key].total_count=e.pagination.total_count)},editGifPreview:function(){var e=this,t={};if(e.bbp_is_reply_edit&&Object.keys(e.bbp_reply_edit_gif_data).length?t=e.bbp_reply_edit_gif_data.gif_raw_data:e.bbp_is_topic_edit&&Object.keys(e.bbp_topic_edit_gif_data).length?t=e.bbp_topic_edit_gif_data.gif_raw_data:e.bbp_is_forum_edit&&Object.keys(e.bbp_forum_edit_gif_data).length&&(t=e.bbp_forum_edit_gif_data.gif_raw_data),void 0===t.images)return!1;e=p("#whats-new-attachments .forums-attached-gif-container");e[0].style.backgroundImage="url("+t.images.fixed_width.url+")",e[0].style.backgroundSize="contain",e[0].style.height=t.images.original.height+"px",e[0].style.width=t.images.original.width+"px",e.find(".gif-image-container img").attr("src",t.images.original.url),e.removeClass("closed"),p("#bbp_media_gif").length&&p("#bbp_media_gif").val(JSON.stringify(t))},selectGif:function(e){var t=this,i=0,a=p(e.currentTarget),o=a.closest("form").find(".forums-attached-gif-container");e.preventDefault(),o.closest("form").find(".gif-media-search-dropdown").removeClass("open");var d=o.data("key");if(void 0!==t.gif_data[d]&&void 0!==t.gif_data[d].data&&t.gif_data[d].data.length){for(i=0;i\n\t\n\t\t\n\t\n',e.data[o].saved=!1,a.gif_data.push(e.data[o]);p(i.target).closest(".bp-group-messages-attached-gif-container").find(".gif-search-results-list").append(t)}void 0!==e.pagination&&void 0!==e.pagination.total_count&&(a.gif_total_count=e.pagination.total_count),p(i.target).closest(".bp-group-messages-attached-gif-container").removeClass("loading")},function(){p(i.target).find(".gif-no-connection").addClass("show")});a.gif_requests.push(e),a.gif_offset=a.gif_offset+a.gif_limit},searchGifRequest:function(i){var a=this,o=0,d=p(i.target).closest("form").find(".forums-attached-gif-container");d.addClass("loading");var s=d.data("key");p(i.target).closest("form").find(".gif-no-results").removeClass("show"),p(i.target).closest("form").find(".gif-no-connection").removeClass("show"),a.clearGifRequests(s),a.gif_data[s].q=i.target.value,a.gif_data[s].offset=0;var e=a.giphy.search({q:a.gif_data[s].q,offset:a.gif_data[s].offset,fmt:"json",limit:a.gif_data[s].limit},function(e){if(void 0!==e.data.length&&0===e.data.length&&p(i.target).closest("form").find(".gif-no-results").addClass("show"),void 0!==e.meta.status&&200!==e.meta.status&&p(i.target).closest("form").find(".gif-no-connection").addClass("show"),void 0!==e.data&&e.data.length){var t="";for(o=0;o\n\t\n\t\t\n\t\n',e.data[o].saved=!1,a.gif_data[s].data.push(e.data[o]);p(i.target).closest(".gif-search-content").find(".gif-search-results-list").append(t)}void 0!==e.pagination&&void 0!==e.pagination.total_count&&(a.gif_data[s].total_count=e.pagination.total_count),d.removeClass("loading")},function(){p(i.target).closest("form").find(".gif-no-connection").addClass("show")});a.gif_data[s].requests.push(e),a.gif_data[s].offset=a.gif_data[s].offset+a.gif_data[s].limit},clearGifRequests:function(e){var t=this;if(void 0!==t.gif_data[e]&&void 0!==t.gif_data[e].requests){for(var i=0;i\n\t\n\t\t\n\t\n',e.data[s].saved=!1,o.gif_data[a].data.push(e.data[s]);d.closest("form").find(".gif-search-results-list").append(t)}void 0!==e.pagination&&void 0!==e.pagination.total_count&&(o.gif_data[a].total_count=e.pagination.total_count),i.removeClass("loading")}),o.gif_data[a].requests.push(e),o.gif_data[a].offset=o.gif_data[a].offset+o.gif_data[a].limit),t.toggleClass("open");t=d.parents("form").find("#whats-new-attachments .forums-attached-gif-container img");0\n\t\n\t\t\n\t\n',e.data[o].saved=!1,i.gif_data.push(e.data[o]);a.closest("form").find(".gif-search-results-list").append(t)}void 0!==e.pagination&&void 0!==e.pagination.total_count&&(i.gif_total_count=e.pagination.total_count),p(".gif-search-query").closest(".bp-group-messages-attached-gif-container").removeClass("loading")}),i.gif_requests.push(d),i.gif_offset=i.gif_offset+i.gif_limit);var d=a.parents("form").find("#whats-new-attachments .bp-group-messages-attached-gif-container img");0"),this.removeFile(e),o.closest("form").removeClass("media-uploading"))}),a.dropzone_obj[n].on("success",function(e,t){t.data.id?(e.id=t.id,t.data.uuid=e.upload.uuid,t.data.menu_order=p(e.previewElement).closest(".dropzone").find(e.previewElement).index()-1,t.data.album_id=a.album_id,t.data.group_id=a.group_id,t.data.saved=!1,a.dropzone_media[n].push(t.data),a.addMediaIdsToForumsForm(d)):(jQuery(".forum-media-error-popup").length||p("body").append('
        "),this.removeFile(e))}),a.dropzone_obj[n].on("removedfile",function(e){if(!0===bp.Nouveau.Media.reply_topic_allow_delete_media){if(a.dropzone_media[n].length)for(var t in a.dropzone_media[n])if(e.upload.uuid==a.dropzone_media[n][t].uuid){this.bbp_is_reply_edit||this.bbp_is_topic_edit||this.bbp_is_forum_edit||void 0===a.dropzone_media[n][t].saved||a.dropzone_media[n][t].saved||"edit"!==bp.Nouveau.Media.reply_topic_display_post||a.removeAttachment(a.dropzone_media[n][t].id),a.dropzone_media[n].splice(t,1),a.addMediaIdsToForumsForm(d);break}var i;_.isNull(a.dropzone_obj[n].files)||0!==a.dropzone_obj[n].files.length||((i=o.closest("form")).find("#forums-document-button")&&i.find("#forums-document-button").parents(".post-elements-buttons-item").removeClass("disable"),i.find("#forums-video-button")&&i.find("#forums-video-button").parents(".post-elements-buttons-item").removeClass("disable"),i.find("#forums-gif-button")&&i.find("#forums-gif-button").parents(".post-elements-buttons-item").removeClass("disable"),i.find("#forums-media-button")&&i.find("#forums-media-button").parents(".post-elements-buttons-item").removeClass("no-click"))}_.isNull(a.dropzone_obj[n].files)||0!==a.dropzone_obj[n].files.length||o.closest("form").removeClass("has-media")}),a.dropzone_obj[n].on("complete",function(){0===this.getUploadingFiles().length&&0===this.getQueuedFiles().length&&0"),this.removeFile(e))}),a.dropzone_obj.on("success",function(e,t){t.data.id?(e.id=t.id,t.data.uuid=e.upload.uuid,t.data.menu_order=p(e.previewElement).closest(".dropzone").find(e.previewElement).index()-1,t.data.album_id=a.album_id,t.data.group_id=a.group_id,t.data.saved=!1,a.dropzone_media.push(t.data),a.addMediaIdsToGroupMessagesForm()):(jQuery(".group-message-error-popup").length||p("body").append('
        "),this.removeFile(e))}),a.dropzone_obj.on("removedfile",function(e){if(a.dropzone_media.length)for(var t in a.dropzone_media)if(e.upload.uuid==a.dropzone_media[t].uuid){void 0===a.dropzone_media[t].saved||a.dropzone_media[t].saved||a.removeAttachment(a.dropzone_media[t].id),a.dropzone_media.splice(t,1),a.addMediaIdsToGroupMessagesForm();break}var i;_.isNull(a.dropzone_obj.files)||0!==a.dropzone_obj.files.length||((i=p("#send_group_message_form")).find("#bp-group-messages-document-button")&&i.find("#bp-group-messages-document-button").parents(".post-elements-buttons-item").removeClass("disable"),i.find("#bp-group-messages-video-button")&&i.find("#bp-group-messages-video-button").parents(".post-elements-buttons-item").removeClass("disable"),i.find("#bp-group-messages-gif-button")&&i.find("#bp-group-messages-gif-button").parents(".post-elements-buttons-item").removeClass("disable"),i.find("#bp-group-messages-media-button")&&i.find("#bp-group-messages-media-button").parents(".post-elements-buttons-item").removeClass("no-click"))}),t.removeClass("closed").addClass("open"),a.resetGroupMessagesGifComponent(),a.resetGroupMessagesDocumentComponent(),a.resetGroupMessagesVideoComponent()):a.resetGroupMessagesMediaComponent())},openGroupMessagesDocumentUploader:function(e){var l=this,t=p("div#bp-group-messages-post-document-uploader"),i=p(e.currentTarget);e.preventDefault(),i.toggleClass("active"),void 0!==window.Dropzone&&t.length&&(t.hasClass("closed")?(l.document_dropzone_obj=new Dropzone("div#bp-group-messages-post-document-uploader",l.documentOptions),l.document_dropzone_obj.on("addedfile",function(){}),l.document_dropzone_obj.on("sending",function(e,t,i){i.append("action","document_document_upload"),i.append("_wpnonce",BP_Nouveau.nonces.media);i=p("#send_group_message_form");i.find("#bp-group-messages-media-button")&&i.find("#bp-group-messages-media-button").parents(".post-elements-buttons-item").addClass("disable"),i.find("#bp-group-messages-video-button")&&i.find("#bp-group-messages-video-button").parents(".post-elements-buttons-item").addClass("disable"),i.find("#bp-group-messages-gif-button")&&i.find("#bp-group-messages-gif-button").parents(".post-elements-buttons-item").addClass("disable"),i.find("#bp-group-messages-document-button")&&i.find("#bp-group-messages-document-button").parents(".post-elements-buttons-item").addClass("no-click")}),l.document_dropzone_obj.on("uploadprogress",function(e){var t=p(e.previewElement).find(".dz-progress-ring circle")[0],i=2*t.r.baseVal.value*Math.PI;t.style.strokeDasharray=i+" "+i;i=(t.style.strokeDashoffset=i)-e.upload.progress.toFixed(0)/100*i;t.style.strokeDashoffset=i}),l.document_dropzone_obj.on("error",function(e,t){e.accepted?void 0!==t&&void 0!==t.data&&void 0!==t.data.feedback?p(e.previewElement).find(".dz-error-message span").text(t.data.feedback):"error"==e.status&&e.xhr&&0==e.xhr.status&&p(e.previewElement).find(".dz-error-message span").text(BP_Nouveau.media.connection_lost_error):(jQuery(".group-document-error-popup").length||p("body").append('
        "),this.removeFile(e))}),l.document_dropzone_obj.on("accept",function(e,t){0==e.size?t(BP_Nouveau.media.empty_document_type):t()}),l.document_dropzone_obj.on("success",function(e,t){if(!t.data.id){var i,a,o,d,s,n=t.data.feedback;for(e.previewElement.classList.add("dz-error"),s=[],a=0,o=(d=e.previewElement.querySelectorAll("[data-dz-errormessage]")).length;a"),this.removeFile(e))}),r.video_dropzone_obj.on("accept",function(e,t){0==e.size?t(BP_Nouveau.video.empty_video_type):t()}),r.video_dropzone_obj.on("addedfile",function(e){e.dataURL||bp.Nouveau.getVideoThumb&&bp.Nouveau.getVideoThumb(e,".dz-video-thumbnail")}),r.video_dropzone_obj.on("uploadprogress",function(e){var t=p(e.previewElement).find(".dz-progress-ring circle")[0],i=2*t.r.baseVal.value*Math.PI;t.style.strokeDasharray=i+" "+i;var a=i-e.upload.progress.toFixed(0)/100*i;e.upload.progress<=99?(p(e.previewElement).find(".dz-progress-count").text(e.upload.progress.toFixed(0)+"% "+BP_Nouveau.video.i18n_strings.video_uploaded_text),t.style.strokeDashoffset=a):100===e.upload.progress&&(t.style.strokeDashoffset=i-.99*i,p(e.previewElement).find(".dz-progress-count").text("99% "+BP_Nouveau.video.i18n_strings.video_uploaded_text))}),r.video_dropzone_obj.on("success",function(e,t){if(100===e.upload.progress&&(p(e.previewElement).find(".dz-progress-ring circle")[0].style.strokeDashoffset=0,p(e.previewElement).find(".dz-progress-count").text("100% "+BP_Nouveau.video.i18n_strings.video_uploaded_text),p(e.previewElement).closest(".dz-preview").addClass("dz-complete")),!t.data.id){var i,a,o,d,s,n=t.data.feedback;for(e.previewElement.classList.add("dz-error"),s=[],a=0,o=(d=e.previewElement.querySelectorAll("[data-dz-errormessage]")).length;a"),this.removeFile(e),a.closest("form").removeClass("media-uploading"))}),l.dropzone_obj[u].on("accept",function(e,t){0==e.size?t(BP_Nouveau.media.empty_document_type):t()}),l.dropzone_obj[u].on("success",function(e,t){if(!t.data.id){var i,a,o,d,s,n=t.data.feedback;for(e.previewElement.classList.add("dz-error"),s=[],a=0,o=(d=e.previewElement.querySelectorAll("[data-dz-errormessage]")).length;a"),this.removeFile(e),o.closest("form").removeClass("media-uploading"))}),r.dropzone_obj[c].on("accept",function(e,t){0==e.size?t(BP_Nouveau.video.empty_video_type):t()}),r.dropzone_obj[c].on("addedfile",function(e){e.dataURL&&e.dataThumb&&e.dataThumb.length?p(e.previewElement).find(".dz-video-thumbnail").prepend(''):bp.Nouveau.getVideoThumb&&bp.Nouveau.getVideoThumb(e,".dz-video-thumbnail")}),r.dropzone_obj[c].on("uploadprogress",function(e){o.closest("form").addClass("media-uploading");var t=p(e.previewElement).find(".dz-progress-ring circle")[0],i=2*t.r.baseVal.value*Math.PI;t.style.strokeDasharray=i+" "+i;var a=i-e.upload.progress.toFixed(0)/100*i;e.upload.progress<=99?(p(e.previewElement).find(".dz-progress-count").text(e.upload.progress.toFixed(0)+"% "+BP_Nouveau.video.i18n_strings.video_uploaded_text),t.style.strokeDashoffset=a):100===e.upload.progress&&(t.style.strokeDashoffset=i-.99*i,p(e.previewElement).find(".dz-progress-count").text("99% "+BP_Nouveau.video.i18n_strings.video_uploaded_text))}),r.dropzone_obj[c].on("success",function(e,t){if(100===e.upload.progress&&(p(e.previewElement).find(".dz-progress-ring circle")[0].style.strokeDashoffset=0,p(e.previewElement).find(".dz-progress-count").text("100% "+BP_Nouveau.video.i18n_strings.video_uploaded_text),p(e.previewElement).closest(".dz-preview").addClass("dz-complete")),!t.data.id){var i,a,o,d,s,n=t.data.feedback;for(e.previewElement.classList.add("dz-error"),s=[],a=0,o=(d=e.previewElement.querySelectorAll("[data-dz-errormessage]")).length;a'+p(this).text()+""),p(this).addClass("selected").parent().addClass("is_active").siblings().removeClass("is_active").children("span").removeClass("selected"),a==p(e.currentTarget).data("id")?p(e.currentTarget).closest(".bb-field-wrap").find(".bb-model-footer .bp-media-move").addClass("is-disabled"):p(e.currentTarget).closest(".bb-field-wrap").find(".bb-model-footer .bp-media-move").removeClass("is-disabled"),p(e.currentTarget).closest(".bb-field-wrap").find(".bb-model-footer .bp-media-move").hasClass("is-disabled")||(p(e.currentTarget).closest(".bb-field-wrap").find(".bb-album-selected-id").val(p(e.currentTarget).data("id")),t=p(e.currentTarget).closest("#bp-media-uploader").find("#bb-media-privacy"),0!==Number(p(e.currentTarget).data("id"))?(t.find("option").removeAttr("selected"),t.val(p(e.currentTarget).parent().data("privacy")),t.prop("disabled",!0)):(t.find("option").removeAttr("selected"),t.val("public"),t.prop("disabled",!1))))}),p(document).on("click",t+" .breadcrumb .item > span",function(e){var t,i;p(this).hasClass("is-disabled")||(p(e.currentTarget).closest(".bb-field-wrap").find(".bb-album-selected-id").val(0),p(e.currentTarget).closest(".bb-field-wrap").find(".location-album-list li span").removeClass("selected").parent().removeClass("is_active"),p(this).closest(".location-album-list-wrap").find(".breadcrumb .item span:last-child").hasClass("is-disabled")&&p(this).closest(".location-album-list-wrap").find(".breadcrumb .item span:last-child").remove(),a==p(e.currentTarget).data("id")?p(e.currentTarget).closest(".bb-field-wrap").find(".bb-model-footer .bp-media-move").addClass("is-disabled"):p(e.currentTarget).closest(".bb-field-wrap").find(".bb-model-footer .bp-media-move").removeClass("is-disabled"),t=p(e.currentTarget).closest("#bp-media-uploader").find("#bb-media-privacy"),i=p(e.currentTarget).closest("#bp-media-uploader").find(".location-album-list li.is_active").data("privacy"),0!==Number(p(e.currentTarget).closest(".bb-field-wrap").find(".bb-album-selected-id").val())?(t.find("option").removeAttr("selected"),t.val(void 0===i?"public":i),t.prop("disabled",!0)):(t.find("option").removeAttr("selected"),t.val("public"),t.prop("disabled",!1)))}),e=document.getElementsByClassName("uploader-post-media-template").length?document.getElementsByClassName("uploader-post-media-template")[0].innerHTML:"",i.options.previewTemplate=e,i.dropzone_obj=new Dropzone("div#media-uploader",i.options),i.dropzone_obj.on("sending",function(e,t,i){i.append("action","media_upload"),i.append("_wpnonce",BP_Nouveau.nonces.media)}),i.dropzone_obj.on("uploadprogress",function(e){var t=p(e.previewElement).find(".dz-progress-ring circle")[0],i=2*t.r.baseVal.value*Math.PI;t.style.strokeDasharray=i+" "+i;i=(t.style.strokeDashoffset=i)-e.upload.progress.toFixed(0)/100*i;t.style.strokeDashoffset=i}),i.dropzone_obj.on("addedfile",function(){setTimeout(function(){i.dropzone_obj.getAcceptedFiles().length&&p("#bp-media-uploader-modal-status-text").text(wp.i18n.sprintf(BP_Nouveau.media.i18n_strings.upload_status,i.dropzone_media.length,i.dropzone_obj.getAcceptedFiles().length)).show()},1e3)}),i.dropzone_obj.on("error",function(e,t){e.accepted?void 0!==t&&void 0!==t.data&&void 0!==t.data.feedback?p(e.previewElement).find(".dz-error-message span").text(t.data.feedback):"error"==e.status&&e.xhr&&0==e.xhr.status&&p(e.previewElement).find(".dz-error-message span").text(BP_Nouveau.media.connection_lost_error):(jQuery(".media-error-popup").length||p("body").append('
        "),this.removeFile(e))}),i.dropzone_obj.on("queuecomplete",function(){p("#bp-media-uploader-modal-title").text(BP_Nouveau.media.i18n_strings.upload)}),i.dropzone_obj.on("processing",function(){p("#bp-media-uploader-modal-title").text(BP_Nouveau.media.i18n_strings.uploading+"...")}),i.dropzone_obj.on("success",function(e,t){t.data.id?(e.id=t.id,t.data.uuid=e.upload.uuid,t.data.menu_order=i.dropzone_media.length,t.data.album_id=i.album_id,t.data.group_id=i.group_id,t.data.saved=!1,i.dropzone_media.push(t.data)):(jQuery(".media-error-popup").length||p("body").append('
        "),this.removeFile(e)),p(".bb-field-steps-1 #bp-media-photo-next, #bp-media-submit").show(),p(".modal-container").addClass("modal-container--alert"),p(".bb-field-steps-1").addClass("controls-added"),p("#bp-media-add-more").show(),p("#bp-media-uploader-modal-title").text(BP_Nouveau.media.i18n_strings.uploading+"..."),p("#bp-media-uploader-modal-status-text").text(wp.i18n.sprintf(BP_Nouveau.media.i18n_strings.upload_status,i.dropzone_media.length,i.dropzone_obj.getAcceptedFiles().length)).show()}),i.dropzone_obj.on("removedfile",function(e){if(i.dropzone_media.length)for(var t in i.dropzone_media)if(e.upload.uuid==i.dropzone_media[t].uuid){void 0===i.dropzone_media[t].saved||i.dropzone_media[t].saved||i.removeAttachment(i.dropzone_media[t].id),i.dropzone_media.splice(t,1);break}i.dropzone_obj.getAcceptedFiles().length?p("#bp-media-uploader-modal-status-text").text(wp.i18n.sprintf(BP_Nouveau.media.i18n_strings.upload_status,i.dropzone_media.length,i.dropzone_obj.getAcceptedFiles().length)).show():(p("#bp-media-uploader-modal-status-text").text(""),p("#bp-media-add-more, #bp-media-photo-next").hide(),p(".bb-field-steps-1").removeClass("controls-added"),p("#bp-media-submit").hide(),p(".modal-container").removeClass("modal-container--alert"))}))},openDocumentUploader:function(e){var a,t,l=this;e.preventDefault(),void 0!==window.Dropzone&&p("div#media-uploader").length&&(p("#bp-media-uploader").hasClass("bp-media-document-uploader")&&(this.currentTargetParent||(this.currentTargetParent=0)),p(e.currentTarget).closest("#bp-media-single-folder").length&&p("#bb-document-privacy").hide(),p(document).removeClass("open-popup"),p("#bp-media-uploader").show(),p("#bp-media-uploader").addClass("open-popup"),p("#bp-media-uploader.bp-media-document-uploader").find(".bb-field-steps.bb-field-steps-2").length&&(t="#bp-media-uploader.bp-media-document-uploader",0!==Number(p(t).find(".bb-folder-selected-id").data("value"))?(a=p(t).find(".bb-folder-selected-id").data("value"),p(t).find("#bb-document-privacy").prop("disabled",!0)):a=0,""!==this.moveToIdPopup&&p.ajax({url:BP_Nouveau.ajaxurl,type:"GET",data:{action:"document_get_folder_view",id:this.moveToIdPopup,type:this.moveToTypePopup},success:function(e){p(document).find(".bp-media-document-uploader .location-folder-list-wrap h4 span.where-to-move-profile-or-group-document").html(e.data.first_span_text),""===e.data.html?(p(document).find(".bp-media-document-uploader.open-popup .location-folder-list-wrap").hide(),p(document).find(".bp-media-document-uploader.open-popup .location-folder-list-wrap-main span.no-folder-exists").show()):(p(document).find(".bp-media-document-uploader.open-popup .location-folder-list-wrap-main span.no-folder-exists").hide(),p(document).find(".bp-media-document-uploader.open-popup .location-folder-list-wrap").show()),p(document).find(".bp-media-document-uploader .popup-on-fly-create-album .privacy-field-wrap-hide-show").show(),p(document).find(".bp-media-document-uploader .open-popup .bb-folder-create-from").val("profile"),p(t).find(".location-folder-list-wrap .location-folder-list").remove(),p(t).find(".location-folder-list-wrap").append(e.data.html),bp.Nouveau.Media.folderLocationUI&&bp.Nouveau.Media.folderLocationUI(t,a),p(t).find("ul.location-folder-list span#"+a).trigger("click"),p(t).find(".bb-folder-selected-id").val(a)}})),p(document).on("click",t+" .location-folder-list li span",function(e){var t;e.preventDefault(),p(this).parent().hasClass("is_active")||(0!=p(this).closest(".location-folder-list-wrap").find(".breadcrumb .item span:last-child").data("id")&&p(this).closest(".location-folder-list-wrap").find(".breadcrumb .item span:last-child").remove(),p(this).closest(".location-folder-list-wrap").find(".breadcrumb .item").append(''+p(this).text()+""),p(this).addClass("selected").parent().addClass("is_active").siblings().removeClass("is_active").children("span").removeClass("selected"),a==p(e.currentTarget).data("id")?p(e.currentTarget).closest(".bb-field-wrap").find(".bb-model-footer .bp-media-move").addClass("is-disabled"):p(e.currentTarget).closest(".bb-field-wrap").find(".bb-model-footer .bp-media-move").removeClass("is-disabled"),p(e.currentTarget).closest(".bb-field-wrap").find(".bb-model-footer .bp-media-move").hasClass("is-disabled")||(p(e.currentTarget).closest(".bb-field-wrap").find(".bb-folder-selected-id").val(p(e.currentTarget).data("id")),t=p(e.currentTarget).closest("#bp-media-uploader").find("#bb-document-privacy"),0!==Number(p(e.currentTarget).data("id"))?(t.find("option").removeAttr("selected"),t.val(p(e.currentTarget).parent().data("privacy")),t.prop("disabled",!0)):(t.find("option").removeAttr("selected"),t.val("public"),t.prop("disabled",!1))))}),p(document).on("click",t+" .breadcrumb .item > span",function(e){var t,i;p(this).hasClass("is-disabled")||(p(e.currentTarget).closest(".bb-field-wrap").find(".bb-folder-selected-id").val(p(e.currentTarget).data("id")),p(e.currentTarget).closest(".bb-field-wrap").find(".location-folder-list li span").removeClass("selected").parent().removeClass("is_active"),p(e.currentTarget).closest(".bb-field-wrap").find('.location-folder-list li[data-id="'+p(e.currentTarget).data("id")+'"]').addClass("is_active"),p(this).closest(".location-folder-list-wrap").find(".breadcrumb .item span:last-child").hasClass("is-disabled")&&p(this).closest(".location-folder-list-wrap").find(".breadcrumb .item span:last-child").remove(),a==p(e.currentTarget).data("id")?p(e.currentTarget).closest(".bb-field-wrap").find(".bb-model-footer .bp-media-move").addClass("is-disabled"):p(e.currentTarget).closest(".bb-field-wrap").find(".bb-model-footer .bp-media-move").removeClass("is-disabled"),t=p(e.currentTarget).closest("#bp-media-uploader").find("#bb-document-privacy"),i=p(e.currentTarget).closest("#bp-media-uploader").find(".location-folder-list li.is_active").data("privacy"),0!==Number(p(e.currentTarget).closest(".bb-field-wrap").find(".bb-folder-selected-id").val())?(t.find("option").removeAttr("selected"),t.val(void 0===i?"public":i),t.prop("disabled",!0)):(t.find("option").removeAttr("selected"),t.val("public"),t.prop("disabled",!1)))}),e=document.getElementsByClassName("uploader-post-document-template").length?document.getElementsByClassName("uploader-post-document-template")[0].innerHTML:"",l.options.previewTemplate=e,l.dropzone_obj=new Dropzone("div#media-uploader",l.options),l.dropzone_obj.on("sending",function(e,t,i){i.append("action","document_document_upload"),i.append("_wpnonce",BP_Nouveau.nonces.media)}),l.dropzone_obj.on("uploadprogress",function(e){var t=p(e.previewElement).find(".dz-progress-ring circle")[0],i=2*t.r.baseVal.value*Math.PI;t.style.strokeDasharray=i+" "+i;i=(t.style.strokeDashoffset=i)-e.upload.progress.toFixed(0)/100*i;t.style.strokeDashoffset=i}),l.dropzone_obj.on("addedfile",function(){setTimeout(function(){l.dropzone_obj.getAcceptedFiles().length&&p("#bp-media-uploader-modal-status-text").text(wp.i18n.sprintf(BP_Nouveau.media.i18n_strings.upload_status,l.dropzone_media.length,l.dropzone_obj.getAcceptedFiles().length)).show()},1e3)}),l.dropzone_obj.on("error",function(e,t){e.accepted?void 0!==t&&void 0!==t.data&&void 0!==t.data.feedback?p(e.previewElement).find(".dz-error-message span").text(t.data.feedback):"error"==e.status&&e.xhr&&0==e.xhr.status&&p(e.previewElement).find(".dz-error-message span").text(BP_Nouveau.media.connection_lost_error):(jQuery(".document-error-popup").length||p("body").append('
        "),this.removeFile(e))}),l.dropzone_obj.on("accept",function(e,t){0==e.size?t(BP_Nouveau.media.empty_document_type):t()}),l.dropzone_obj.on("queuecomplete",function(){p("#bp-media-uploader-modal-title").text(BP_Nouveau.media.i18n_strings.upload)}),l.dropzone_obj.on("processing",function(){p("#bp-media-uploader-modal-title").text(BP_Nouveau.media.i18n_strings.uploading+"...")}),l.dropzone_obj.on("success",function(e,t){if(!t.data.id){var i,a,o,d,s,n=t.data.feedback;for(e.previewElement.classList.add("dz-error"),s=[],a=0,o=(d=e.previewElement.querySelectorAll("[data-dz-errormessage]")).length;a .activity-content .bp-media-move-file",p(o).find(".bp-document-move").attr("id",p(e.currentTarget).closest(".document-activity").attr("data-id")),0
      • ');var d=t,s=this.moveToTypePopup;""!==this.moveToIdPopup&&p.ajax({url:BP_Nouveau.ajaxurl,type:"post",data:{action:"media_get_album_view",id:this.moveToIdPopup,type:this.moveToTypePopup},success:function(e){p(document).find(".location-album-list-wrap h4 span.where-to-move-profile-or-group-media").html(e.data.first_span_text),""===e.data.html?(p(document).find(".open-popup .location-album-list-wrap").hide(),p(document).find(".open-popup .location-album-list-wrap-main span.no-album-exists").show()):(p(document).find(".open-popup .location-album-list-wrap-main span.no-album-exists").hide(),p(document).find(".open-popup .location-album-list-wrap").show()),"group"===s?(p(document).find(".popup-on-fly-create-album .privacy-field-wrap-hide-show").hide(),p(document).find(".open-popup .bb-album-create-from").val("group")):(p(document).find(".popup-on-fly-create-album .privacy-field-wrap-hide-show").show(),p(document).find(".open-popup .bb-album-create-from").val("profile")),!1===e.data.create_album?(p(o+".open-popup").find(".bp-media-open-create-popup-folder").removeClass("create-album"),p(o+".open-popup").find(".bp-media-open-create-popup-folder").hide()):(p(o+".open-popup").find(".bp-media-open-create-popup-folder").addClass("create-album"),p(o+".open-popup").find(".bp-media-open-create-popup-folder").show()),p(o).find(".location-album-list-wrap .location-album-list").remove(),p(o).find(".location-album-list-wrap").append(e.data.html),p(o).find("ul.location-album-list span#"+d).trigger("click")}}),p(document).on("click",o+" .location-album-list li span",function(e){var t;e.preventDefault(),p(this).parent().hasClass("is_active")||(0!=p(this).closest(".location-album-list-wrap").find(".breadcrumb .item span:last-child").data("id")&&p(this).closest(".location-album-list-wrap").find(".breadcrumb .item span:last-child").remove(),p(this).closest(".location-album-list-wrap").find(".breadcrumb .item").append(''+p(this).text()+""),p(this).addClass("selected").parent().addClass("is_active").siblings().removeClass("is_active").children("span").removeClass("selected"),t=p(document).find('a.bb-open-media-theatre[data-id="'+i.find(".bp-media-move").attr("id")+'"]').data("album-id"),Number(t)==Number(p(e.currentTarget).data("id"))?p(e.currentTarget).closest(".bp-media-move-file").find(".bb-model-footer .bp-media-move").addClass("is-disabled"):p(e.currentTarget).closest(".bp-media-move-file").find(".bb-model-footer .bp-media-move").removeClass("is-disabled"),p(e.currentTarget).closest(".bp-media-move-file").find(".bb-model-footer .bp-media-move").hasClass("is-disabled")||p(e.currentTarget).closest(".bp-media-move-file").find(".bb-album-selected-id").val(p(e.currentTarget).data("id")))}),p(document).on("click",o+" .breadcrumb .item > span",function(e){p(this).hasClass("is-disabled")||(p(e.currentTarget).closest(".bp-media-move-file").find(".bb-album-selected-id").val(0),p(e.currentTarget).closest(".bp-media-move-file").find(".location-album-list li span").removeClass("selected").parent().removeClass("is_active"),p(this).closest(".location-album-list-wrap").find(".breadcrumb .item span:last-child").hasClass("is-disabled")&&p(this).closest(".location-album-list-wrap").find(".breadcrumb .item span:last-child").remove(),d==p(e.currentTarget).data("id")?p(e.currentTarget).closest(".bp-media-move-file").find(".bb-model-footer .bp-media-move").addClass("is-disabled"):p(e.currentTarget).closest(".bp-media-move-file").find(".bb-model-footer .bp-media-move").removeClass("is-disabled"))})},openDocumentMove:function(e){e.preventDefault();p(e.currentTarget).closest(".bb-activity-media-elem").find(".document-title").text();this.moveToIdPopup=p(e.currentTarget).attr("id"),this.moveToTypePopup=p(e.currentTarget).attr("data-type");var t=p(e.currentTarget).attr("data-action"),i=p(e.currentTarget).closest(".conflict-activity-ul-li-comment").closest("li.comment-item").length?"#"+p(e.currentTarget).closest(".conflict-activity-ul-li-comment").closest("li").attr("id")+".comment-item .bp-media-move-file":"#"+p(e.currentTarget).closest("li.activity-item").attr("id")+" > .activity-content .bp-media-move-file";p(i).find(".bp-document-move").attr("id",p(e.currentTarget).closest(".document-activity").attr("data-id")),this.currentTargetParent=p(e.currentTarget).closest(".bb-activity-media-elem").attr("data-parent-id"),0
      • '),"document"===t?p(i).find(".bb-model-header h4 .target_name").text(BP_Nouveau.media.move_to_file):p(i).find(".bb-model-header h4 .target_name").text(BP_Nouveau.media.move_to_folder),p(i).show(),p(i).addClass("open-popup"),"group"===this.moveToTypePopup?(p(document).find(".location-folder-list-wrap h4").show(),p(i).addClass("move-folder-popup-group")):(p(document).find(".location-folder-list-wrap h4").hide(),p(".move-folder-popup-group").removeClass("move-folder-popup-group"));var a=this.currentTargetParent,o=this.moveToTypePopup;""!==this.moveToIdPopup&&p.ajax({url:BP_Nouveau.ajaxurl,type:"GET",data:{action:"document_get_folder_view",id:this.moveToIdPopup,type:this.moveToTypePopup},success:function(e){p(document).find(".location-folder-list-wrap h4 span.where-to-move-profile-or-group-document").html(e.data.first_span_text),""===e.data.html?(p(document).find(".open-popup .location-folder-list-wrap").hide(),p(document).find(".open-popup .location-folder-list-wrap-main span.no-folder-exists").show()):(p(document).find(".open-popup .location-folder-list-wrap-main span.no-folder-exists").hide(),p(document).find(".open-popup .location-folder-list-wrap").show()),"group"===o?(p(document).find(".popup-on-fly-create-folder .privacy-field-wrap-hide-show").hide(),p(document).find(".open-popup .bb-folder-create-from").val("group")):(p(document).find(".popup-on-fly-create-folder .privacy-field-wrap-hide-show").show(),p(document).find(".open-popup .bb-folder-create-from").val("profile")),p(i).find(".location-folder-list-wrap .location-folder-list").remove(),p(i).find(".location-folder-list-wrap").append(e.data.html),bp.Nouveau.Media.folderLocationUI&&(bp.Nouveau.Media.folderLocationUI(i,a),p(i).find("ul.location-folder-list span#"+a).trigger("click"))}})},closeMediaMove:function(e){e.preventDefault(),0!=p(e.currentTarget).closest(".bp-media-move-file").find(".location-album-list-wrap .breadcrumb .item span:last-child").data("id")&&p(e.currentTarget).closest(".bp-media-move-file").find(".location-album-list-wrap .breadcrumb .item span:last-child").remove(),p(e.currentTarget).closest(".bp-media-move-file").hide()},closeDocumentMove:function(e){e.preventDefault();var t=jQuery(e.currentTarget).closest(".has-folderlocationUI");(p(e.currentTarget).hasClass("ac-document-close-button")?p(e.currentTarget).closest(".bp-media-move-file").hide().find(".bp-document-move"):p(e.currentTarget).closest(".bp-media-move-folder").hide().find(".bp-folder-move")).attr("id",""),t.find(".bp-document-move.loading").removeClass("loading"),this.clearFolderLocationUI(e)},renameDocument:function(e){var t=p(e.currentTarget).closest(".media-folder_items").find(".media-folder_name"),i=t.children("span").text();t.hide().siblings(".media-folder_name_edit_wrap").show().children(".media-folder_name_edit").val(i).focus().select(),e.preventDefault()},editPrivacyDocument:function(e){e.preventDefault(),p(e.currentTarget).closest("#media-folder-document-data-table").find(".media-folder_visibility .media-folder_details__bottom span").show().siblings("select").addClass("hide");var t=p(e.currentTarget).closest(".media-folder_items").find(".media-folder_visibility");t.find(".media-folder_details__bottom span").hide().siblings("select").removeClass("hide"),t.find(".media-folder_details__bottom span").hide().siblings("select").val(p(e.currentTarget).attr("data-privacy")),t.find(".media-folder_details__bottom #bb-folder-privacy").attr("data-privacy",p(e.currentTarget).attr("data-privacy")),this.privacySelectorSelect=t.find(".media-folder_details__bottom span").hide().siblings("select"),this.privacySelectorSpan=t.find(".media-folder_details__bottom span")},editPrivacyDocumentSubmit:function(e){e=p(e.currentTarget);"true"==e.attr("data-mouseup")?(e.attr("data-mouseup","false"),e.addClass("hide").siblings("span").show().text(e.find("option:selected").text())):e.attr("data-mouseup","true")},renameDocumentSubmit:function(t){var i=p(t.currentTarget).closest(".media-folder_items").find(".media-folder_name_edit"),a=p(t.currentTarget).closest(".media-folder_items").find(".media-folder_name > span"),o=p(t.currentTarget).closest(".media-folder_items").find(".media-folder_name"),e=p(t.currentTarget).closest(".media-folder_items").find(".media-folder_name > i.media-document-id").attr("data-item-id"),d=p(t.currentTarget).closest(".media-folder_items").find(".media-folder_name > i.media-document-attachment-id").attr("data-item-id"),s=p(t.currentTarget).closest(".media-folder_items").find(".media-folder_name > i.media-document-type").attr("data-item-id"),n=i.val().trim(),r="";p(t.currentTarget).closest(".ac-document-list").length?r=/[?\[\]=<>:;,'"&$#*()|~`!{}%+ \/]+/g:p(t.currentTarget).closest(".ac-folder-list").length&&(r=/[\\/?%*:|"<>]+/g);r=r.exec(n),r=Boolean(r);if(r?i.addClass("error"):i.removeClass("error"),p(t.currentTarget).closest(".ac-document-list").length&&(-1!=n.indexOf("\\\\")||r?i.addClass("error"):i.removeClass("error")),!p(t.currentTarget).hasClass("name_edit_cancel")&&27!=t.keyCode||(i.removeClass("error"),i.parent().hide().siblings(".media-folder_name").show()),p(t.currentTarget).hasClass("name_edit_save")||13==t.keyCode){if(r)return;i.parent().addClass("submitting").append(''),p.ajax({url:BP_Nouveau.ajaxurl,type:"post",data:{action:"document_update_file_name",document_id:e,attachment_document_id:d,document_type:s,name:n,_wpnonce:BP_Nouveau.nonces.media},success:function(e){e.success?void 0!==e.data.document&&0');e.parents("li").each(function(e,t){t=p(t).children("span").clone();i.prepend("",t)}),p(a).find(".breadcrumbs-append-ul-li .breadcrumb").html(i.prepend(''+BP_Nouveau.media.target_text+"")),p(a).find(".breadcrumbs-append-ul-li .breadcrumb .item span.hidden").length||p(a).find(".breadcrumbs-append-ul-li .breadcrumb").find(".item").append(''),p(a).find(".breadcrumbs-append-ul-li .breadcrumb .item span:not(.hidden)").each(function(e){0p(a).find(".breadcrumbs-append-ul-li .breadcrumb").width()&&(p(a).find(".breadcrumbs-append-ul-li .breadcrumb .item span.hidden").append(p(a).find(".breadcrumbs-append-ul-li .breadcrumb .item span").eq(2)),p(a).find(".breadcrumbs-append-ul-li .breadcrumb .item .more_options").length||p('...').insertAfter(p(a).find(".breadcrumbs-append-ul-li .breadcrumb .item span").eq(0)))}),p(this).hasClass("selected")&&!p(this).hasClass("disabled")?(p(this).closest(".location-folder-list-wrap-main").find(".bb-folder-destination").val(""),p(this).closest(".location-folder-list-wrap-main").find(".bb-folder-selected-id").val("0"),p(a).find(".location-folder-list li.is_active").length?p(a).find(".bb-folder-selected-id").val(p(a).find(".location-folder-list li.is_active").attr("data-id")):p(a).find(".bb-folder-selected-id").val("0")):(p(this).closest(".location-folder-list-wrap-main").find(".location-folder-list li span").removeClass("selected"),p(this).addClass("selected"),p(this).closest(".location-folder-list-wrap-main").find(".bb-folder-destination").val(p(this).text()),p(this).closest(".location-folder-list-wrap-main").find(".bb-folder-selected-id").val(p(this).parent().attr("data-id"))),p(this).closest(".location-folder-list-wrap").find(".location-folder-title").text(p(this).siblings("span").text()).siblings(".location-folder-back").css("display","inline-block"),p(this).siblings("ul").show().siblings("span, i").hide().parent().siblings().hide(),p(this).siblings("ul").children("li").show().children("span,i").show(),p(this).closest(".is_active").removeClass("is_active"),p(a).find("li.is_active").removeClass("is_active"),p(this).parent().addClass("is_active"),p(a).find(".bb-folder-selected-id").val(p(a).find(".location-folder-list li.is_active").attr("data-id")),p(a).find(".breadcrumbs-append-ul-li .breadcrumb .item span").each(function(){p(this).show()}),o===p(a).find(".breadcrumbs-append-ul-li .item > span:last-child").attr("data-id")&&(p(a).hasClass("bp-media-move-file")||p(a).hasClass("bp-media-move-folder"))?(p(a).find(".bp-document-move").addClass("is-disabled"),p(a).find(".bp-folder-move").addClass("is-disabled")):(p(a).find(".bp-document-move").removeClass("is-disabled"),p(a).find(".bp-folder-move").removeClass("is-disabled")),setTimeout(function(){var e=0,e=(p(a).find(".breadcrumbs-append-ul-li .item > span:last-child").hasClass("hidden")?p(a).find(".breadcrumbs-append-ul-li .item > span:last-child").prev():p(a).find(".breadcrumbs-append-ul-li .item > span:last-child")).attr("id");o===e&&(p(a).hasClass("bp-media-move-file")||p(a).hasClass("bp-media-move-folder"))?(p(a).find(".bp-document-move").addClass("is-disabled"),p(a).find(".bp-folder-move").addClass("is-disabled")):(p(a).find(".bp-document-move").removeClass("is-disabled"),p(a).find(".bp-folder-move").removeClass("is-disabled"))},100)}),p(document).on("click",a+" .breadcrumbs-append-ul-li .item span",function(e){var t,i;p(this).parent().hasClass("is-disabled")||p(this).hasClass("more_options")||(t=p(e.currentTarget).attr("data-id"),p(a).find(".location-folder-list-wrap").find(".location-folder-title").text(p(a).find(".location-folder-list li.is_active").closest(".has-ul").children("span").text()).siblings(".location-folder-back").css("display","inline-block"),p(a).find(".bb-folder-selected-id").val(t),p(a).find(".location-folder-list li").hide(),p(a).find(".location-folder-list li.is_active").removeClass("is_active"),p(a).find(".location-folder-list li > span.selected").removeClass("selected"),p(a).find('.location-folder-list li[data-id="'+t+'"]').addClass("is_active").children("span").addClass("selected"),p(a).find(".location-folder-list li.is_active").parents(".has-ul").show().children("ul").show().siblings("span,i").hide(),p(a).find(".location-folder-list li.is_active").children("ul").length&&!p(a).find(".location-folder-list li.is_active").children("ul").hasClass("no-folder-list")?setTimeout(function(){p(a).find(".location-folder-list li.is_active").show().children("ul").show().children("li").show().children("span,i").show().closest("ul").siblings("span, i").hide()},100):p(a).find(".location-folder-list li.is_active").hasClass("has-ul").length?p(a).find(".location-folder-list li.is_active").children("span,i").hide().parent().children("ul").show().children("li").show():setTimeout(function(){p(a).find(".location-folder-list li.is_active").show().children("span").show().parent().siblings("li").show().children("span,i").show()},10),"0"===t&&(p(a).find(".location-folder-list").children("li").show().children("span,i").show(),p(a).find(".location-folder-list-wrap").find(".location-folder-title").text(BP_Nouveau.media.target_text),p(a).find(".location-folder-back").hide()),p(e.currentTarget).nextAll().remove(),o===p(a).find(".breadcrumbs-append-ul-li .item > span:last-child").attr("data-id")&&(p(a).hasClass("bp-media-move-file")||p(a).hasClass("bp-media-move-folder"))?(p(a).find(".bp-document-move").addClass("is-disabled"),p(a).find(".bp-folder-move").addClass("is-disabled")):(p(a).find(".bp-document-move").removeClass("is-disabled"),p(a).find(".bp-folder-move").removeClass("is-disabled")),e=p(a).find(".location-folder-list .is_active > span"),i=p('
        '),e.parents("li").each(function(e,t){t=p(t).children("span").clone();i.prepend("",t)}),p(a).find(".breadcrumbs-append-ul-li .breadcrumb").html(i.prepend(''+BP_Nouveau.media.target_text+"")),0===p(a).find('.breadcrumbs-append-ul-li .breadcrumb .item > span[data-id="'+t+'"]').length&&p(a).find(".breadcrumbs-append-ul-li .breadcrumb .item").append(p(a).find('.location-folder-list li[data-id="'+t+'"]').children("span").clone()),p(a).find(".breadcrumbs-append-ul-li .breadcrumb .item span.hidden").length||p(a).find(".breadcrumbs-append-ul-li .breadcrumb").find(".item").append(''),p(a).find(".breadcrumbs-append-ul-li .breadcrumb .item span:not(.hidden)").each(function(e){0p(a).find(".breadcrumbs-append-ul-li .breadcrumb").width()&&(p(a).find(".breadcrumbs-append-ul-li .breadcrumb .item span.hidden").append(p(a).find(".breadcrumbs-append-ul-li .breadcrumb .item span").eq(2)),p(a).find(".breadcrumbs-append-ul-li .breadcrumb .item .more_options").length||p('...').insertAfter(p(a).find(".breadcrumbs-append-ul-li .breadcrumb .item span").eq(0)))}),p(a).find(".bb-folder-selected-id").val(t))})),p(a).find(".location-folder-list li").each(function(){p(this).children("ul").parent().addClass("has-ul").append('')}),p(a).hasClass("bp-media-move-folder")&&(p(a).find(".location-folder-list li>span").removeClass("is-disabled"),p(a).find('.location-folder-list li>span[id="'+p(a).find(".bp-folder-move").attr("id")+'"]').parent().addClass("is-disabled")),e=p(a).find(".bp-folder-move").attr("id"),0==p(a).find('.location-folder-list li[data-id="'+e+'"]').siblings().length&&p(a).find('.location-folder-list li[data-id="'+e+'"]').parent("ul").addClass("no-folder-list a"),o&&(p(a).find(".location-folder-list li").hide(),p(a).find(".location-folder-list li.is_active").removeClass("is_active"),p(a).find('.location-folder-list li[data-id="'+o+'"]').addClass("is_active"),p(a).find(".location-folder-list li.is_active").parents(".has-ul").show().children("ul").show().siblings("span,i").hide(),p(a).find(".location-folder-list li.is_active").children("ul").length&&!p(a).find(".location-folder-list li.is_active").children("ul").hasClass("no-folder-list")?setTimeout(function(){p(a).find(".location-folder-list li.is_active").show().children("ul").show().children("li").show().children("span,i").show().closest("ul").siblings("span, i").hide()},100):p(a).find(".location-folder-list li.is_active").hasClass("has-ul").length?p(a).find(".location-folder-list li.is_active").children("span,i").hide().parent().children("ul").show().children("li").show():setTimeout(function(){p(a).find(".location-folder-list li.is_active").show().children("span").show().parent().siblings("li").show().children("span,i").show()},10),p(a).find(".location-folder-list-wrap").find(".location-folder-title").text(p(a).find(".location-folder-list li.is_active").closest(".has-ul").children("span").text()).siblings(".location-folder-back").css("display","inline-block"),p(a).find(".bb-folder-selected-id").val(p(a).find(".location-folder-list li.is_active").attr("data-id")),p(a).find('.location-folder-list li[data-id="'+e+'"]').children().hide()),"0"===o&&(p(a).find(".location-folder-list").children("li").show(),p(a).find(".location-folder-list-wrap").find(".location-folder-title").text(BP_Nouveau.media.target_text),p(a).find(".location-folder-back").hide()),setTimeout(function(){var e=0,e=(p(a).find(".breadcrumbs-append-ul-li .item > span:last-child").hasClass("hidden")?p(a).find(".breadcrumbs-append-ul-li .item > span:last-child").prev():p(a).find(".breadcrumbs-append-ul-li .item > span:last-child")).attr("id");o===e&&(p(a).hasClass("bp-media-move-file")||p(a).hasClass("bp-media-move-folder"))?(p(a).find(".bp-document-move").addClass("is-disabled"),p(a).find(".bp-folder-move").addClass("is-disabled")):(p(a).find(".bp-document-move").removeClass("is-disabled"),p(a).find(".bp-folder-move").removeClass("is-disabled"))},100),e=p(a).find(".location-folder-list .is_active > span"),i=p('
        '),e.parents("li").each(function(e,t){t=p(t).children("span").clone();i.prepend("",t)}),p(a).find(".breadcrumbs-append-ul-li .breadcrumb").html(i.prepend(''+BP_Nouveau.media.target_text+"")))},clearFolderLocationUI:function(e){e=jQuery(e.currentTarget).closest(".has-folderlocationUI");0").addClass("media-list item-list bp-list bb-photo-list grid")),0").addClass("media-list item-list bp-list bb-photo-list grid")),0").addClass("display")),p("#media-stream div").attr("id","media-folder-document-data-table"),p(".bb-photos-actions").show()),p(".document-data-table-head").length?"yes"===BP_Nouveau.media.is_document_directory&&"groups"===bp.Nouveau.getStorage("bp-document").scope?(p(document).find("li#document-personal a").trigger("click"),p(document).find("li#document-personal").trigger("click")):r&&bp.Nouveau.inject("#media-stream div#media-folder-document-data-table",e.data.document,"prepend"):location.reload(!0),p("#bp-media-post-content").val("");for(var t=0;t]+/g.exec(e.val()),d=Boolean(d);if(""===p.trim(e.val())||d)return e.addClass("error"),!1;if(e.removeClass("error"),!a.group_id&&""===p.trim(o.val()))return o.addClass("error"),!1;o.removeClass("error"),i.prop("disabled",!0).addClass("loading");o={action:"document_folder_save",_wpnonce:BP_Nouveau.nonces.media,title:e.val().trim(),privacy:o.val(),album_id:a.current_folder,group_id:a.current_group_id};p(".bb-single-album-header .bp-feedback").remove(),p("#boss-media-create-album-popup .bp-feedback").remove(),p.ajax({type:"POST",url:BP_Nouveau.ajaxurl,data:o,success:function(e){setTimeout(function(){i.prop("disabled",!1)},500),e.success?(a.closeFolderUploader(t),p(".document-data-table-head").length?"yes"===BP_Nouveau.media.is_document_directory&&"groups"===bp.Nouveau.getStorage("bp-document").scope?(p(document).find("li#document-personal a").trigger("click"),p(document).find("li#document-personal").trigger("click")):(bp.Nouveau.inject("#media-stream div#media-folder-document-data-table",e.data.document,"prepend"),jQuery(window).scroll()):location.reload(!0)):alert(e.data.feedback.replace("'","'"))}})},saveChildFolder:function(t){var e=p(t.currentTarget),i=this,a=p("#bp-media-create-child-folder #bb-album-child-title");t.preventDefault();var o=/[\\/?%*:|"<>]+/g.exec(a.val()),o=Boolean(o);if(""===p.trim(a.val())||o)return a.addClass("error"),!1;a.removeClass("error"),e.prop("disabled",!0).addClass("loading");a={action:"document_child_folder_save",_wpnonce:BP_Nouveau.nonces.media,title:a.val(),folder_id:i.current_folder,group_id:i.current_group_id};p(".bb-single-album-header .bp-feedback").remove(),p("#boss-media-create-album-popup .bp-feedback").remove(),p.ajax({type:"POST",url:BP_Nouveau.ajaxurl,data:a,success:function(e){e.success?(i.closeChildFolderUploader(t),location.reload(!0)):alert(e.data.feedback.replace("'","'"))}})},renameChildFolder:function(e){e.preventDefault();var t=p(e.currentTarget),i=this,a=p("#bp-media-edit-child-folder #bb-album-child-title"),o=p("#bp-media-edit-child-folder #bb-folder-privacy"),d=this.currentTargetParent,e=/[\\/?%*:|"<>]+/g.exec(a.val()),e=Boolean(e);if(""===p.trim(a.val())||e)return a.addClass("error"),!1;a.removeClass("error"),t.prop("disabled",!0).addClass("loading");d={action:"document_edit_folder",_wpnonce:BP_Nouveau.nonces.media,title:a.val(),privacy:o.val(),id:d,group_id:i.current_group_id};p(".bb-single-album-header .bp-feedback").remove(),p("#boss-media-create-album-popup .bp-feedback").remove(),p.ajax({type:"POST",url:BP_Nouveau.ajaxurl,data:d,success:function(e){setTimeout(function(){t.prop("disabled",!1)},500),e.success?window.location.reload(!0):i.current_folder?p("#bp-media-single-album").prepend(e.data.feedback):p("#boss-media-create-album-popup .bb-model-header").after(e.data.feedback)}})},deleteAlbum:function(t){if(t.preventDefault(),!this.album_id)return!1;if(!confirm(BP_Nouveau.media.i18n_strings.album_delete_confirm))return!1;p(t.currentTarget).prop("disabled",!0);var e={action:"media_album_delete",_wpnonce:BP_Nouveau.nonces.media,album_id:this.album_id,group_id:this.group_id};p.ajax({type:"POST",url:BP_Nouveau.ajaxurl,data:e,success:function(e){e.success?window.location.href=e.data.redirect_url:(alert(BP_Nouveau.media.i18n_strings.album_delete_error),p(t.currentTarget).prop("disabled",!1))}})},deleteFolder:function(t){if(t.preventDefault(),!BP_Nouveau.media.current_folder)return!1;if(!confirm(BP_Nouveau.media.i18n_strings.folder_delete_confirm))return!1;p(t.currentTarget).prop("disabled",!0);var e={action:"document_folder_delete",_wpnonce:BP_Nouveau.nonces.media,folder_id:BP_Nouveau.media.current_folder,group_id:BP_Nouveau.media.current_group_id};p.ajax({type:"POST",url:BP_Nouveau.ajaxurl,data:e,success:function(e){e.success?window.location.href=e.data.redirect_url:(alert(BP_Nouveau.media.i18n_strings.folder_delete_error),p(t.currentTarget).prop("disabled",!1))}})},addMediaIdsToGroupMessagesForm:function(){p("#bp_group_messages_media").length&&p("#bp_group_messages_media").val(JSON.stringify(this.dropzone_media))},addDocumentIdsToGroupMessagesForm:function(){p("#bp_group_messages_document").length&&p("#bp_group_messages_document").val(JSON.stringify(this.dropzone_media))},addVideoIdsToGroupMessagesForm:function(){p("#bp_group_messages_video").length&&p("#bp_group_messages_video").val(JSON.stringify(this.dropzone_media))},injectMedias:function(t){var i,a,e=bp.Nouveau.getStorage("bp-media"),o=e.scope||null,d=e.filter||null;p(t.currentTarget).hasClass("load-more")&&(i=+Number(this.current_page)+1,a=this,e="",t.preventDefault(),p(t.currentTarget).find("a").first().addClass("loading"),p("#buddypress .dir-search input[type=search]").length&&(e=p("#buddypress .dir-search input[type=search]").val()),bp.Nouveau.objectRequest({object:"media",scope:o,filter:d,search_terms:e,page:i,method:"append",target:"#buddypress [data-bp-list] ul.bp-list"}).done(function(e){!0===e.success&&(p(t.currentTarget).remove(),a.current_page=i,jQuery(window).scroll())}))},injectDocuments:function(e){var t,i,a,o=bp.Nouveau.getStorage("bp-document"),d="",s="",n=o.scope||null,r=o.filter||null,l=p(e.currentTarget);l.hasClass("load-more")&&(t=+Number(this.current_page)+1,i=this,a="",e.preventDefault(),l.find("a").first().addClass("loading"),p("#buddypress .dir-search input[type=search]").length&&(a=p("#buddypress .dir-search input[type=search]").val()),s=this.order_by&&this.sort_by?(d=this.sort_by,this.order_by):void 0!==o.extras?(d=o.extras.sort,o.extras.orderby):(d="ASC","title"),bp.Nouveau.objectRequest({object:"document",scope:n,filter:r,search_terms:a,page:t,method:"append",target:"#buddypress [data-bp-list] div#media-folder-document-data-table",order_by:s,sort:d}).done(function(e){!0===e.success&&(l.parent(".pager").remove(),i.current_page=t,jQuery(window).scroll())}))},sortDocuments:function(e){var t=p(e.currentTarget),i=t.data("target"),a="",o="date_created";t.attr("class");switch(i){case"name":o="title";break;case"modified":o="date_modified";break;case"visibility":o="privacy";break;case"group":o="group_id"}t.hasClass("asce")?t.removeClass("asce"):t.addClass("asce");var d=t.hasClass("asce")?"DESC":"ASC",i=(bp.Nouveau.getStorage("bp-document"),{});i.orderby=o,i.sort=d,"group"!==o&&bp.Nouveau.setStorage("bp-document","extras",i);t=bp.Nouveau.getStorage("bp-document"),i=t.scope||null,t=t.filter||null;p(e.currentTarget);p("#buddypress .bp-dir-search-form input[type=search]").length&&(a=p("#buddypress .bp-dir-search-form input[type=search]").val()),this.sort_by=d,this.order_by=o,this.current_page=1,bp.Nouveau.objectRequest({object:"document",scope:i,filter:t,search_terms:a,page:1,order_by:o,sort:d,method:"reset",target:"#buddypress [data-bp-list]"}).done()},documentPopupNavigate:function(e){e.preventDefault();var t=p(e.currentTarget),i=t.closest(".bb-field-steps"),e=0==t.closest(".bp-document-listing").length?"#bb-album-child-title":"#bb-album-title";t.closest(".document-options").length&&(e="#bb-album-title"),t.hasClass("bb-field-steps-next")&&""==i.find(e).val().trim()?i.find(e).addClass("error"):(i.find(e).removeClass("error"),i.slideUp(200).siblings(".bb-field-steps").slideDown(200))},uploadDocumentNavigate:function(e){e.preventDefault();var e=p(e.currentTarget),t=p(e).closest("#bp-media-uploader");p(e).hasClass("bb-field-uploader-next")?(t.find(".bb-field-steps-1").slideUp(200).siblings(".bb-field-steps").slideDown(200),t.find("#bp-media-document-submit, #bp-media-document-prev, .bp-document-open-create-popup-folder, #bb-document-privacy").show(),0!==Number(p(t).find(".bb-folder-selected-id"))&&p(t).find(".location-folder-list li.is_active").length&&p(t).find(".location-folder-list").scrollTop(p(t).find(".location-folder-list li.is_active").offset().top-p(t).find(".location-folder-list").offset().top),p(t).find(".breadcrumbs-append-ul-li .breadcrumb .item span:not(.hidden)").each(function(e){0p(t).find(".breadcrumbs-append-ul-li .breadcrumb").width()&&(p(t).find(".breadcrumbs-append-ul-li .breadcrumb .item span.hidden").append(p(t).find(".breadcrumbs-append-ul-li .breadcrumb .item span").eq(2)),p(t).find(".breadcrumbs-append-ul-li .breadcrumb .item .more_options").length||p('...').insertAfter(p(t).find(".breadcrumbs-append-ul-li .breadcrumb .item span").eq(0)))})):(p(e).hide(),t.find("#bp-media-document-prev, .bp-document-open-create-popup-folder").hide(),t.find(".bb-field-steps-2").slideUp(200).siblings(".bb-field-steps").slideDown(200),t.closest("#bp-media-single-folder").length&&p("#bb-document-privacy").hide())},uploadMediaNavigate:function(e){e.preventDefault();var t=p(e.currentTarget),e=p(t).closest(".bp-media-photo-uploader");p(t).hasClass("bb-field-uploader-next")?(e.find(".bb-field-steps-1").slideUp(200).siblings(".bb-field-steps").slideDown(200),e.find("#bp-media-submit, #bp-media-prev, .bp-media-open-create-popup-folder.create-album").show(),e.find("#bb-media-privacy").show(),0!==Number(p(e).find(".bb-album-selected-id"))&&p(e).find(".location-album-list li.is_active").length&&p(e).find(".location-album-list").scrollTop(p(e).find(".location-album-list li.is_active").offset().top-p(e).find(".location-album-list").offset().top)):(p(t).hide(),e.find("#bp-media-prev, .bp-media-open-create-popup-folder").hide(),e.find(".bb-field-steps-2").slideUp(200).siblings(".bb-field-steps").slideDown(200),e.closest("#bp-media-single-album").length&&p("#bb-media-privacy").hide())},appendMedia:function(t){var i,a,e=bp.Nouveau.getStorage("bp-media"),o=e.scope||null,d=e.filter||null;p(t.currentTarget).hasClass("load-more")&&(i=+Number(this.current_page_existing_media)+1,a=this,e="",t.preventDefault(),p(t.currentTarget).find("a").first().addClass("loading"),p("#buddypress .dir-search input[type=search]").length&&(e=p("#buddypress .dir-search input[type=search]").val()),bp.Nouveau.objectRequest({object:"media",scope:o,filter:d,search_terms:e,page:i,method:"append",caller:"bp-existing-media",target:".bp-existing-media-wrap ul.bp-list"}).done(function(e){!0===e.success&&(p(t.currentTarget).remove(),a.current_page_existing_media=i,jQuery(window).scroll())}))},appendAlbums:function(t){var i=+Number(this.current_page_albums)+1,a=this;t.preventDefault(),p(t.currentTarget).find("a").first().addClass("loading");var e={action:"media_albums_loader",_wpnonce:BP_Nouveau.nonces.media,page:i};p.ajax({type:"POST",url:BP_Nouveau.ajaxurl,data:e,success:function(e){!0===e.success&&(p(t.currentTarget).remove(),p("#albums-dir-list ul.bb-albums-list").fadeOut(100,function(){p("#albums-dir-list ul.bb-albums-list").append(e.data.albums),p(this).fadeIn(100)}),a.current_page_albums=i)}})},toggleSubmitMediaButton:function(){var e=p("#bp-media-submit"),t=p("#bp-media-add-more");"bp-dropzone-content"===this.current_tab?this.dropzone_obj.getAcceptedFiles().length?(e.show(),t.show()):(e.hide(),t.hide()):"bp-existing-media-content"===this.current_tab&&(p('.bp-existing-media-wrap .bb-media-check-wrap [name="bb-media-select"]:checked').length?e.show():e.hide(),t.hide())},playVideo:function(e){e.preventDefault();var t=p(e.currentTarget).find("video").get(0),e=p(e.currentTarget).find(".gif-play-button");1==t.paused?(t.play(),e.hide()):(t.pause(),e.show())},autoPlayGifVideos:function(){p(".gif-player").each(function(){var e=p(this).find("video").get(0),t=p(this).find(".gif-play-button");p(this).is(":in-viewport")?(e.play(),t.hide()):(e.pause(),t.show())})},fileActionButton:function(e){p(e.currentTarget).parent().hasClass("download_file")||p(e.currentTarget).parent().hasClass("copy_download_file_url")||p(e.currentTarget).parent().hasClass("redirect-activity-privacy-change")||(e.preventDefault(),p(e.currentTarget).closest(".media-folder_items").toggleClass("is-visible").siblings(".media-folder_items").removeClass("is-visible"))},copyDownloadLink:function(e){e.preventDefault();var t=e.currentTarget,e="document_copy_link";p("body").append('');var i=p(t).text();return p(t).text(BP_Nouveau.media.copy_to_clip_board_text),p("#"+e).val(p(t).attr("href")),p("#"+e).select(),document.execCommand("copy"),setTimeout(function(){p(t).text(i)},2e3),!1},fileActivityActionButton:function(e){e.preventDefault(),p(e.currentTarget).parent().hasClass("copy_download_file_url")||(p(e.currentTarget).closest(".bb-activity-media-elem").toggleClass("is-visible").siblings().removeClass("is-visible").closest(".activity-item").siblings().find(".bb-activity-media-elem").removeClass("is-visible"),p(e.currentTarget).closest(".bb-activity-media-elem").length<1&&p(e.currentTarget).closest(".bb-photo-thumb").toggleClass("is-visible").parent().siblings().find(".bb-photo-thumb").removeClass("is-visible").removeClass("is-visible"),"a"!=e.currentTarget.tagName.toLowerCase()||p(e.currentTarget).hasClass("document-action_more")||p(e.currentTarget).hasClass("media-action_more")||(p(e.currentTarget).closest(".bb-activity-media-elem").removeClass("is-visible"),p(e.currentTarget).closest(".bb-photo-thumb").removeClass("is-visible")))},toggleFileActivityActionButton:function(e){var t;return(e=e||window.event).target?t=e.target:e.srcElement&&(t=e.srcElement),3===t.nodeType&&(t=t.parentNode),!0===e.altKey||!0===e.metaKey||p(t).hasClass("document-action_more")||p(t).parent().hasClass("document-action_more")||p(t).hasClass("media-folder_action__anchor")||p(t).parent().hasClass("media-folder_action__anchor")||p(t).hasClass("media-action_more")||p(t).parent().hasClass("media-action_more")||p(t).hasClass("video-action_more")||p(t).parent().hasClass("video-action_more")?e:(p(".bb-activity-media-elem.is-visible").removeClass("is-visible"),p(".media-folder_items.is-visible").removeClass("is-visible"),p(".bb-photo-thumb.is-visible").removeClass("is-visible"),p(".bb-item-thumb.is-visible").removeClass("is-visible"),p(".bb-activity-video-elem.is-visible").removeClass("is-visible"),void p(".video-action-wrap.item-action-wrap.is-visible").removeClass("is-visible"))},toggleCodePreview:function(e){e.preventDefault(),p(e.currentTarget).closest(".document-activity").toggleClass("code-full-view")},documentCodeMirror:function(){p(".document-text:not(.loaded)").each(function(){var e=p(this),t=e.attr("data-extension"),i=e.attr("data-extension");"html"!=t&&"htm"!=t||(i="text/html"),"js"==t?CodeMirror(e[0],{value:e.find(".document-text-file-data-hidden").val(),lineNumbers:!0,theme:"default",readOnly:!0,lineWrapping:!0}):CodeMirror(e[0],{value:e.find(".document-text-file-data-hidden").val(),mode:i,lineNumbers:!0,theme:"default",readOnly:!0,lineWrapping:!0}),e.addClass("loaded"),150'+e+""))}},bp.Nouveau.Media.Theatre={start:function(){this.setupGlobals(),this.addListeners()},setupGlobals:function(){this.medias=[],this.documents=[],this.current_media=!1,this.current_document=!1,this.current_index=0,this.current_document_index=0,this.is_open_media=!1,this.is_open_document=!1,this.nextLink=p(".bb-next-media"),this.nextDocumentLink=p(".bb-next-document"),this.previousDocumentLink=p(".bb-prev-document"),this.previousLink=p(".bb-prev-media"),this.activity_ajax=!1,this.group_id=void 0!==BP_Nouveau.media.group_id&&BP_Nouveau.media.group_id,this.manage_media=void 0!==BP_Nouveau.media.can_manage_media&&BP_Nouveau.media.can_manage_media,this.manage_document=void 0!==BP_Nouveau.media.can_manage_document&&BP_Nouveau.media.can_manage_document},addListeners:function(){p(document).on("click",".bb-open-media-theatre",this.openTheatre.bind(this)),p(document).on("click",".bb-open-document-theatre",this.openDocumentTheatre.bind(this)),p(document).on("click",".document-detail-wrap-description-popup",this.openDocumentTheatre.bind(this)),p(document).on("click",".bb-close-media-theatre",this.closeTheatre.bind(this)),p(document).on("click",".bb-close-document-theatre",this.closeDocumentTheatre.bind(this)),p(document).on("click",".bb-prev-media",this.previous.bind(this)),p(document).on("click",".bb-next-media",this.next.bind(this)),p(document).on("click",".bb-prev-document",this.previousDocument.bind(this)),p(document).on("click",".bb-next-document",this.nextDocument.bind(this)),p(document).on("bp_activity_ajax_delete_request",this.activityDeleted.bind(this)),p(document).on("click","#bb-media-model-container .media-privacy>li",this.mediaPrivacyChange.bind(this)),p(document).on("click","#bb-media-model-container .document-privacy>li",this.documentPrivacyChange.bind(this)),p(document).on("click","#bb-media-model-container .bb-media-section span.privacy",bp.Nouveau,this.togglePrivacyDropdown.bind(this)),p(document).on("click","#bb-media-model-container .bb-document-section span.privacy",bp.Nouveau,this.toggleDocumentPrivacyDropdown.bind(this)),p(document).on("click",".bp-add-media-activity-description",this.openMediaActivityDescription.bind(this)),p(document).on("click","#bp-activity-description-new-reset",this.closeMediaActivityDescription.bind(this)),p(document).on("keyup",".bp-edit-media-activity-description #add-activity-description",this.MediaActivityDescriptionUpdate.bind(this)),p(document).on("click","#bp-activity-description-new-submit",this.submitMediaActivityDescription.bind(this)),p(document).click(this.togglePopupDropdown),document.addEventListener("keyup",this.checkPressedKeyDocuments.bind(this)),document.addEventListener("keyup",this.checkPressedKey.bind(this))},checkPressedKey:function(e){var t=this;if(e=e||window.event,!t.is_open_media)return!1;var i=p(e.target).hasClass("ac-input")||"add-activity-description"===p(e.target).attr("id");switch(e.keyCode){case 27:t.closeTheatre(e);break;case 37:if(void 0===t.medias[t.current_index-1]||i)return!1;t.previous(e);break;case 39:if(void 0===t.medias[t.current_index+1]||i)return!1;t.next(e)}},checkPressedKeyDocuments:function(e){e=e||window.event;var t=this;if(!t.is_open_document)return!1;var i=p(e.target).hasClass("ac-input")||"add-activity-description"===p(e.target).attr("id");switch(e.keyCode){case 27:t.closeDocumentTheatre(e);break;case 37:if(void 0===t.documents[t.current_document_index-1]||i)return!1;t.previousDocument(e);break;case 39:if(void 0===t.documents[t.current_document_index+1]||i)return!1;t.nextDocument(e)}},openTheatre:function(e){e.preventDefault();var t=p(e.currentTarget),i=this;if(t.closest("#bp-existing-media-content").length)return!1;i.setupGlobals(),i.setMedias(t),e=t.data("id"),t.data("activity-id"),i.setCurrentMedia(e),i.showMedia(),i.navigationCommands(),i.getParentActivityHtml(t),i.getMediasDescription(),p(".bb-media-model-wrapper.document").hide();t=document.getElementById(p(".bb-media-model-wrapper.video video").attr("id"));t&&t.pause(),p(".bb-media-model-wrapper.video").hide(),p(".bb-media-model-wrapper.media").show(),i.is_open_media=!0},getParentActivityHtml:function(e){var t=p("#hidden_parent_id").val(),e=e.closest(".bb-media-model-wrapper").find("#bb-media-model-container .activity-list li.activity-item").data("bp-activity-id");parseInt(t)===parseInt(e)&&(e=p('#bb-media-model-container [data-bp-activity-id="'+t+'"]'),p('[data-bp-activity-id="'+t+'"] > .activity-state').html(p(e).find(".activity-state").html()),p('[data-bp-activity-id="'+t+'"] > .activity-meta').html(p(e).find(".activity-meta").html()),p('[data-bp-activity-id="'+t+'"] > .activity-comments').html(p(e).find(".activity-comments").html())),p("#hidden_parent_id").length&&p("#hidden_parent_id").remove()},getMediasDescription:function(){var e=this;p(".bb-media-info-section .activity-list").addClass("loading").html(''),0!=e.activity_ajax&&e.activity_ajax.abort();var t=p('[data-bp-activity-id="'+e.current_media.activity_id+'"] .activity-comments');t.length&&(t=t.find("#ac-form-"+e.current_media.activity_id),e.current_media.parent_activity_comments=!0,t.remove()),!0===e.current_media.parent_activity_comments&&p(".bb-media-model-wrapper:last").after(''),e.activity_ajax=p.ajax({type:"POST",url:BP_Nouveau.ajaxurl,data:{action:"media_get_media_description",id:e.current_media.id,attachment_id:e.current_media.attachment_id,nonce:BP_Nouveau.nonces.media},success:function(e){e.success?(p(".bb-media-info-section:visible .activity-list").removeClass("loading").html(e.data.description),p(".bb-media-info-section:visible").show(),p(window).scroll(),setTimeout(function(){bp.Nouveau.reportPopUp(),bp.Nouveau.reportedPopup()},10)):p(".bb-media-info-section.media").hide()}})},openDocumentTheatre:function(e){e.preventDefault();var t,i=p(e.currentTarget),a=this;if(i.closest("#bp-existing-document-content").length)return!1;i.closest(".document.document-theatre").length&&a.closeDocumentTheatre(e),t=i.data("id"),a.setupGlobals(),a.setDocuments(i),a.setCurrentDocument(t),a.showDocument(),a.navigationDocumentCommands(),a.getParentActivityHtml(i),a.getDocumentsDescription(),-1!==p.inArray(a.current_document.extension,BP_Nouveau.document.mp3_preview_extension.split(","))&&p(e.currentTarget).closest(".bb-activity-media-elem.document-activity").length&&p(e.currentTarget).closest(".bb-activity-media-elem.document-activity").find(".document-audio-wrap").length&&p(e.currentTarget).closest(".bb-activity-media-elem.document-activity").find(".document-audio-wrap audio")[0].pause(),p(".bb-media-model-wrapper.media").hide(),p(".bb-media-model-wrapper.document").show();e=document.getElementById(p(".bb-media-model-wrapper.video video").attr("id"));e&&(e.pause(),e.src=""),p(".bb-media-model-wrapper.video").hide(),a.is_open_document=!0},resetRemoveActivityCommentsData:function(){var e,t=this,i=!1,a=!1,o=!1,d=!1,s=!1,n=!1;t.current_media.parent_activity_comments&&((i=(d=p('.bb-media-model-wrapper.media [data-bp-activity-id="'+t.current_media.activity_id+'"]')).find(".activity-comments")).length&&(e=i.find("#ac-form-"+t.current_media.activity_id),this.purgeEditActivityForm(e),e.find("#ac-input-"+t.current_media.activity_id).html(""),e.removeClass("has-content has-gif has-media").addClass("root"),i.append(e),e.find(".post-elements-buttons-item.post-emoji").removeClass("active").empty(""),this.resetActivityMedia(t.current_media.activity_id),i.find(".acomment-display").removeClass("display-focus"),i.find(".comment-item").removeClass("comment-item-focus"),s=i.html(),n=i.attr("class"),i.remove(),(i=p('[data-bp-activity-id="'+t.current_media.activity_id+'"] .activity-comments')).length&&(i.attr("class",n),0===i.find("#ac-form-"+t.current_media.activity_id).length&&(i.append(e),i.children("form").removeClass("events-initiated").addClass("not-initialized")))),(o=d.find(".activity-state")).length&&(s=o.html(),n=o.attr("class"),o.remove(),(o=p('[data-bp-activity-id="'+t.current_media.activity_id+'"] .activity-state')).length&&(o.html(s),o.attr("class",n))),(a=d.find(".activity-meta")).length&&(s=a.html(),n=a.attr("class"),a.remove(),(a=p('[data-bp-activity-id="'+t.current_media.activity_id+'"] > .activity-meta')).length&&(a.html(s),a.attr("class",n))),d.remove()),t.current_document.parent_activity_comments&&((i=(d=p('.bb-media-model-wrapper.document [data-bp-activity-id="'+t.current_document.activity_id+'"]')).find(".activity-comments")).length&&(e=i.find("#ac-form-"+t.current_document.activity_id),this.purgeEditActivityForm(e),e.find("#ac-input-"+t.current_document.activity_id).html(""),e.removeClass("has-content has-gif has-media").addClass("root"),i.append(e),e.find(".post-elements-buttons-item.post-emoji").removeClass("active").empty(""),this.resetActivityMedia(t.current_document.activity_id),i.find(".acomment-display").removeClass("display-focus"),i.find(".comment-item").removeClass("comment-item-focus"),s=i.html(),n=i.attr("class"),i.remove(),(i=p('[data-bp-activity-id="'+t.current_document.activity_id+'"] .activity-comments')).length&&(i.attr("class",n),0===i.find("#ac-form-"+t.current_document.activity_id).length&&(i.append(e),i.children("form").removeClass("events-initiated").addClass("not-initialized")),i.find(".document-text.loaded").removeClass("loaded").find(".CodeMirror").remove(),jQuery(window).scroll())),(o=d.find(".activity-state")).length&&(s=o.html(),n=o.attr("class"),o.remove(),(o=p('[data-bp-activity-id="'+t.current_document.activity_id+'"] .activity-state')).length&&(o.html(s),o.attr("class",n))),(a=d.find(".activity-meta")).length&&(s=a.html(),n=a.attr("class"),a.remove(),(a=p('[data-bp-activity-id="'+t.current_document.activity_id+'"] > .activity-meta')).length&&(a.html(s),a.attr("class",n))),d.remove()),bp.Nouveau.reportPopUp(),bp.Nouveau.reportActions()},closeTheatre:function(e){e.preventDefault();e=p(e.currentTarget);if(p(e).closest(".bb-media-model-wrapper").hasClass("video-theatre"))return!1;p(".bb-media-model-wrapper.media .bb-media-section").find("img").attr("src",""),p(".bb-media-model-wrapper.video .bb-media-section").find("video").length&&videojs(p(".bb-media-model-wrapper.video .bb-media-section").find("video").attr("id")).reset(),p(".bb-media-model-wrapper").hide(),this.is_open_media=!1,this.resetRemoveActivityCommentsData(),this.current_media=!1,this.getParentActivityHtml(e)},closeDocumentTheatre:function(e){e.preventDefault();var t=p(document).find(".document-theatre");t.find(".bb-media-section").removeClass("bb-media-no-preview").find(".document-preview").html(""),p(".bb-media-info-section.document").show(),t.hide(),this.is_open_document=!1,this.resetRemoveActivityCommentsData(),this.current_document=!1,this.getParentActivityHtml(p(e.currentTarget))},setMedias:function(e){var t=p(".bb-open-media-theatre"),i=0;if(void 0!==(t=p("body").hasClass("activity")?p(e).closest(".bb-activity-media-wrap").find(".bb-open-media-theatre"):t))for(this.medias=[],i=0;i'),a.find(".bb-document-section").removeClass("bb-media-no-preview"),a.find(".bb-document-section .document-preview").html(""),a.find(".bb-document-section .document-preview").html("

        "+t+'

        '),a.find(".bb-document-section .document-preview .document-text").attr("data-extension",o),a.find(".bb-document-section .document-preview .document-text textarea").html(d),setTimeout(function(){bp.Nouveau.Media.documentCodeMirror()},1e3)):-1!==p.inArray(e.current_document.extension,BP_Nouveau.document.mp3_preview_extension.split(","))?(a.find(".bb-document-section .document-preview").html(''),a.find(".bb-document-section").removeClass("bb-media-no-preview"),a.find(".bb-document-section .document-preview").html(""),a.find(".bb-document-section .document-preview").html('

        '+t+'

        ')):-1!==p.inArray("."+e.current_document.extension,BP_Nouveau.video.video_type.split(","))?(a.find(".bb-document-section").addClass("bb-video-preview"),a.find(".bb-document-section .document-preview").html(''),a.find(".bb-document-section").removeClass("bb-media-no-preview"),a.find(".bb-document-section .document-preview").html(""),"mov"===e.current_document.extension||"m4v"===e.current_document.extension?a.find(".bb-document-section .document-preview").html(''):a.find(".bb-document-section .document-preview").html(''),p(window).scroll()):e.current_document.full_preview?(a.find(".bb-document-section").removeClass("bb-media-no-preview"),a.find(".bb-document-section .document-preview").html(""),a.find(".bb-document-section .document-preview").html("

        "+t+'

        ')):(a.find(".bb-document-section").addClass("bb-media-no-preview"),a.find(".bb-document-section .document-preview").html(""),a.find(".bb-document-section .document-preview").html('

        '+t+"

        "));i=p(".bb-document-section .bb-document-privacy-wrap");i.length&&(i.show(),i.parent().show(),i.find("ul.document-privacy li").removeClass("selected"),i.find(".bp-tooltip").attr("data-bp-tooltip",""),(t=i.find("ul.document-privacy").find("li[data-value="+e.current_document.privacy+"]")).addClass("selected"),i.find(".bp-tooltip").attr("data-bp-tooltip",t.text()),i.find(".privacy").removeClass("public").removeClass("loggedin").removeClass("onlyme").removeClass("friends").addClass(e.current_document.privacy),(void 0!==BP_Nouveau.activity&&void 0!==e.current_document.activity_id&&0!=e.current_document.activity_id||e.group_id||e.current_document.is_forum||e.current_document.group_id||e.current_document.album_id||!e.can_manage_document||!e.current_document.can_edit||e.current_document.is_message)&&i.parent().hide()),e.navigationDocumentCommands()},next:function(e){e.preventDefault();e=this;e.resetRemoveActivityCommentsData(),void 0!==e.medias[e.current_index+1]?(e.current_index=e.current_index+1,e.current_media.activity_id,e.current_media=e.medias[e.current_index],e.showMedia(),e.getMediasDescription()):e.nextLink.hide()},previous:function(e){e.preventDefault();e=this;e.resetRemoveActivityCommentsData(),void 0!==e.medias[e.current_index-1]?(e.current_index=e.current_index-1,e.current_media.activity_id,e.current_media=e.medias[e.current_index],e.showMedia(),e.getMediasDescription()):e.previousLink.hide()},nextDocument:function(e){e.preventDefault();e=this;e.resetRemoveActivityCommentsData(),void 0!==e.documents[e.current_document_index+1]?(e.current_document_index=e.current_document_index+1,e.current_document.activity_id,e.current_document=e.documents[e.current_document_index],e.showDocument(),e.getDocumentsDescription()):e.nextDocumentLink.hide()},previousDocument:function(e){e.preventDefault();e=this;e.resetRemoveActivityCommentsData(),void 0!==e.documents[e.current_document_index-1]?(e.current_document_index=e.current_document_index-1,e.current_document.activity_id,e.current_document=e.documents[e.current_document_index],e.showDocument(),e.getDocumentsDescription()):e.previousDocumentLink.hide()},navigationCommands:function(){var e=this;0==e.current_index&&e.current_index!=e.medias.length-1?(e.previousLink.hide(),e.nextLink.show()):0==e.current_index&&e.current_index==e.medias.length-1?(e.previousLink.hide(),e.nextLink.hide()):e.current_index==e.medias.length-1?(e.previousLink.show(),e.nextLink.hide()):(e.previousLink.show(),e.nextLink.show())},navigationDocumentCommands:function(){var e=this;0==e.current_document_index&&e.current_document_index!=e.documents.length-1?(e.previousDocumentLink.hide(),e.nextDocumentLink.show()):0==e.current_document_index&&e.current_document_index==e.documents.length-1?(e.previousDocumentLink.hide(),e.nextDocumentLink.hide()):e.current_document_index==e.documents.length-1?(e.previousDocumentLink.show(),e.nextDocumentLink.hide()):(e.previousDocumentLink.show(),e.nextDocumentLink.show())},getActivity:function(){var e=this;p(".bb-media-info-section .activity-list").addClass("loading").html(''),void 0!==BP_Nouveau.activity&&e.current_media&&void 0!==e.current_media.activity_id&&0!=e.current_media.activity_id&&!e.current_media.is_forum?(0!=e.activity_ajax&&e.activity_ajax.abort(),p('[data-bp-activity-id="'+e.current_media.activity_id+'"] .activity-comments').length&&(e.current_media.parent_activity_comments=!0),!0===e.current_media.parent_activity_comments&&p(".bb-media-model-wrapper:last").after(''),e.activity_ajax=p.ajax({type:"POST",url:BP_Nouveau.ajaxurl,data:{action:"media_get_activity",id:e.current_media.activity_id,group_id:_.isUndefined(e.current_media.group_id)?0:e.current_media.group_id,nonce:BP_Nouveau.nonces.media},success:function(e){e.success&&(p(".bb-media-info-section:visible .activity-list").removeClass("loading").html(e.data.activity),p(".bb-media-info-section:visible").show(),jQuery(window).scroll(),setTimeout(function(){bp.Nouveau.reportPopUp(),bp.Nouveau.reportedPopup()},10))}})):p(".bb-media-info-section.media").hide()},getDocumentsActivity:function(){var e=this;p(".bb-media-info-section .activity-list").addClass("loading").html(''),void 0!==BP_Nouveau.activity&&e.current_document&&void 0!==e.current_document.activity_id&&0!=e.current_document.activity_id&&!e.current_document.is_forum?(0!=e.activity_ajax&&e.activity_ajax.abort(),p('[data-bp-activity-id="'+e.current_document.activity_id+'"] .activity-comments').length&&(e.current_document.parent_activity_comments=!0),!0===e.current_document.parent_activity_comments&&p(".bb-media-model-wrapper:last").after(''),e.activity_ajax=p.ajax({type:"POST",url:BP_Nouveau.ajaxurl,data:{action:"document_get_activity",id:e.current_document.activity_id,group_id:_.isUndefined(e.current_document.group_id)?0:e.current_document.group_id,nonce:BP_Nouveau.nonces.media},success:function(e){e.success&&(p(".bb-media-info-section:visible .activity-list").removeClass("loading").html(e.data.activity),p(".bb-media-info-section:visible").show(),jQuery(window).scroll(),setTimeout(function(){bp.Nouveau.reportPopUp(),bp.Nouveau.reportedPopup()},10))}})):p(".bb-media-info-section.document").hide()},getDocumentsDescription:function(){var e=this;p(".bb-media-info-section .activity-list").addClass("loading").html(''),0!=e.activity_ajax&&e.activity_ajax.abort();var t=p('[data-bp-activity-id="'+e.current_document.activity_id+'"] .activity-comments');t.length&&(t=t.find("#ac-form-"+e.current_document.activity_id),e.current_document.parent_activity_comments=!0,t.remove()),!0===e.current_document.parent_activity_comments&&p(".bb-media-model-wrapper:last").after(''),e.activity_ajax=p.ajax({type:"POST",url:BP_Nouveau.ajaxurl,data:{action:"document_get_document_description",id:e.current_document.id,attachment_id:e.current_document.attachment_id,nonce:BP_Nouveau.nonces.media},success:function(e){e.success?(p(".bb-media-info-section:visible .activity-list").removeClass("loading").html(e.data.description),p(".bb-media-info-section:visible").show(),p(window).scroll(),setTimeout(function(){bp.Nouveau.reportPopUp(),bp.Nouveau.reportedPopup()},10)):p(".bb-media-info-section.document").hide()}})},activityDeleted:function(e,t){var i=this,a=0;if(i.is_open_media&&void 0!==t&&"delete_activity"===t.action&&i.current_media.activity_id==t.id){var o=p(document).find('[data-bp-list="media"] .bb-open-media-theatre[data-id="'+i.current_media.id+'"]'),d=o.parents("ul");for(o.closest("li").remove(),0===d.find("li:not(.load-more)").length&&(0]+/g.exec(d.val()),s=Boolean(s);if(""===p.trim(d.val())||s)return d.addClass("error"),!1;d.removeClass("error"),this.currentTargetParent=t=""===t?0:t;var n=this.currentTargetParent,r=0,l="",c="",u=0;if("group"===this.moveToTypePopup?(l="grouponly",r=this.moveToIdPopup):(l=p(e.currentTarget).closest(".modal-container").find(".popup-on-fly-create-folder #bb-folder-privacy").val(),c=p(e.currentTarget).closest(".modal-container").find(".popup-on-fly-create-folder #bb-folder-privacy")),""===o)return alert(BP_Nouveau.media.create_folder_error_title),!1;a.addClass("loading"),setTimeout(function(){var e={action:"document_folder_save",_wpnonce:BP_Nouveau.nonces.media,title:o,privacy:l,parent:n,group_id:r};p.ajax({type:"POST",url:BP_Nouveau.ajaxurl,data:e,async:!1,success:function(e){var t;e.success&&(p(".document-data-table-head").length&&parseInt(n)===parseInt(BP_Nouveau.media.current_folder)&&(bp.Nouveau.inject("#media-stream div#media-folder-document-data-table",e.data.document,"prepend"),jQuery(window).scroll()),i.find(".location-folder-list-wrap .location-folder-list").remove(),i.find(".location-folder-list-wrap").append(e.data.tree_view),t="#"+p(i).attr("id"),bp.Nouveau.Media.folderLocationUI&&bp.Nouveau.Media.folderLocationUI(t,e.data.folder_id),u=e.data.folder_id,""===e.data.tree_view?(i.find(".location-folder-list-wrap").hide(),i.find(".location-folder-list-wrap-main span.no-folder-exists").show()):(i.find(".location-folder-list-wrap-main span.no-folder-exists").hide(),i.find(".location-folder-list-wrap").show()),i.find("ul.location-folder-list span#"+u).trigger("click"),i.find(".bb-model-footer").show(),i.find(".bb-model-footer, #bp-media-document-prev").show(),i.find(".bb-field-wrap-search").show(),i.find(".bp-document-open-create-popup-folder").show(),i.find(".location-folder-list-wrap-main").show(),i.find(".create-popup-folder-wrap").hide(),i.find(".bb-folder-selected-id").val(),i.find(".bb-folder-selected-id").val(u),i.find(".bb-model-header").children().show(),i.find(".bb-model-header p").hide(),d.val(""),""!==c&&c.val("public"),p(i).find(".breadcrumbs-append-ul-li .breadcrumb .item span:not(.hidden)").each(function(e){0p(i).find(".breadcrumbs-append-ul-li .breadcrumb").width()&&(p(i).find(".breadcrumbs-append-ul-li .breadcrumb .item span.hidden").append(p(i).find(".breadcrumbs-append-ul-li .breadcrumb .item span").eq(2)),p(i).find(".breadcrumbs-append-ul-li .breadcrumb .item .more_options").length||p('...').insertAfter(p(i).find(".breadcrumbs-append-ul-li .breadcrumb .item span").eq(0)))}),a.removeClass("loading"),setTimeout(function(){var e=i.find("ul.location-folder-list span#"+u);e.trigger("click");var t=p(i).find("#bb-document-privacy");0!==Number(e.data("id"))?(t.find("option").removeAttr("selected"),t.val(e.parent().data("privacy")),t.prop("disabled",!0)):(t.find("option").removeAttr("selected"),t.val("public"),t.prop("disabled",!1))},200))}}),this.currentTargetParent=u,i.find(".location-folder-list li.is_active").show().children("span, i").show().siblings("ul").hide(),i.find(".location-folder-list li.is_active").siblings("li").show().children("span, i").show().siblings("ul").hide(),i.find(".location-folder-list li span.selected").removeClass("selected"),i.find(".location-folder-list li.is_active").children("span").addClass("selected")},0)},submitCreateAlbumInPopup:function(e){e.preventDefault();var t=this,i=p(e.currentTarget).closest(".open-popup"),a=p(i).find(".bp-media-create-popup-album-submit"),o=i.find(".bb-album-selected-id").val();this.currentTargetParent=o=""===o?0:o;var d=this.currentTargetParent,s=0,n=p.trim(p(e.currentTarget).closest(".modal-container").find(".popup-on-fly-create-album-title").val()),r=p(e.currentTarget).closest(".modal-container").find(".popup-on-fly-create-album-title"),l="",c="",u=0;if("group"===this.moveToTypePopup?(l="grouponly",s=this.moveToIdPopup):(l=p(e.currentTarget).closest(".modal-container").find(".popup-on-fly-create-album #bb-album-privacy").val(),c=p(e.currentTarget).closest(".modal-container").find(".popup-on-fly-create-album #bb-album-privacy")),""===n)return alert(BP_Nouveau.media.create_album_error_title),!1;a.addClass("loading"),setTimeout(function(){var e={action:"media_album_save",_wpnonce:BP_Nouveau.nonces.media,title:n,privacy:l,parent:d,group_id:s};p.ajax({type:"POST",url:BP_Nouveau.ajaxurl,data:e,async:!1,success:function(e){e.success&&(i.find(".location-album-list-wrap .location-album-list").remove(),i.find(".location-album-list-wrap").append(e.data.tree_view),bp.Nouveau.Media.folderLocationUI&&bp.Nouveau.Media.folderLocationUI(i,e.data.album_id),u=e.data.album_id,""===e.data.tree_view?(i.find(".location-album-list-wrap").hide(),i.find(".location-album-list-wrap-main span.no-album-exists").show()):(i.find(".location-album-list-wrap-main span.no-album-exists").hide(),i.find(".location-album-list-wrap").show()),i.find("ul.location-album-list span#"+u).trigger("click"),i.find(".bb-model-footer").show(),i.find(".bb-field-wrap-search").show(),i.find(".bp-media-open-create-popup-album").show(),i.find(".location-album-list-wrap-main").show(),i.find(".create-popup-album-wrap").hide(),i.find(".bb-field-steps-2 #bp-media-prev").show(),i.find(".bb-album-selected-id").val(),i.find(".bb-album-selected-id").val(u),i.find(".bb-model-header").children().show(),i.find(".bb-model-header p").hide(),r.val(""),""!==c&&c.val("public"),p(i).find(".breadcrumbs-append-ul-li .breadcrumb .item span:not(.hidden)").each(function(e){0p(i).find(".breadcrumbs-append-ul-li .breadcrumb").width()&&(p(i).find(".breadcrumbs-append-ul-li .breadcrumb .item span.hidden").append(p(i).find(".breadcrumbs-append-ul-li .breadcrumb .item span").eq(2)),p(i).find(".breadcrumbs-append-ul-li .breadcrumb .item .more_options").length||p('...').insertAfter(p(i).find(".breadcrumbs-append-ul-li .breadcrumb .item span").eq(0)))}),t.updateAlbumNavCount(e.data.album_count)),a.removeClass("loading")}}),this.currentTargetParent=u,i.find(".location-album-list li.is_active").show().children("span, i").show().siblings("ul").hide(),i.find(".location-album-list li.is_active").siblings("li").show().children("span, i").show().siblings("ul").hide(),i.find(".location-album-list li span.selected").removeClass("selected"),i.find(".location-album-list li.is_active").children("span").addClass("selected")},0)},closeCreateFolderInPopup:function(e){e.preventDefault(),p(".modal-container .bb-model-footer").show(),p(".bb-field-wrap-search").show(),p(".bp-document-open-create-popup-folder").show(),p(".location-folder-list-wrap-main").show(),p("#bp-media-document-prev").show(),p(".create-popup-folder-wrap").hide(),p(e.currentTarget).closest(".has-folderlocationUI").find(".bb-model-header").children().show(),p(e.currentTarget).closest(".has-folderlocationUI").find(".bb-model-header p").hide()},closeCreateAlbumInPopup:function(e){e.preventDefault(),p(".modal-container .bb-model-footer").show(),p(".bb-field-wrap-search").show(),p(".bp-document-open-create-popup-folder").show(),p(".modal-container:visible .bp-video-open-create-popup-album").show(),p(".location-album-list-wrap-main").show(),p(".bb-field-steps-2 #bp-media-prev").show(),p(".bb-field-steps-2 #bp-video-next").show(),p(".create-popup-album-wrap").hide(),p(".bp-media-create-popup-album-submit.loading").removeClass("loading"),p(e.currentTarget).closest(".has-folderlocationUI").find(".bb-model-header").children().show(),p(e.currentTarget).closest(".has-folderlocationUI").find(".bb-model-header p").hide()},createFolderInPopup:function(e){e.preventDefault();var t=parseInt(p(document).find(".open-popup .bb-folder-selected-id").val()),i=p(document).find(".open-popup .bb-folder-create-from").val();0"+BP_Nouveau.media.create_folder+"

        "),p(".modal-container #bb-folder-privacy").addClass("new-folder-create-privacy"),p(document).find(".open-popup .error").hide()},createAlbumInPopup:function(e){e.preventDefault();var t=parseInt(p(document).find(".open-popup .bb-album-selected-id").val()),i=p(document).find(".open-popup .bb-album-create-from").val();0"+BP_Nouveau.media.create_album_title+"

        "),p(".modal-container #bb-folder-privacy").addClass("new-folder-create-privacy"),p(document).find(".open-popup .error").hide()},savePrivacy:function(e){var t,i,a,o=p(e.currentTarget);if(e.preventDefault(),o.hasClass("new-folder-create-privacy"))return!1;t=parseInt(o.data("item-id")),a=o.data("item-type"),i=o.val(),e=p(e.currentTarget).find("option:selected").text(),this.privacySelectorSelect.addClass("hide"),this.privacySelectorSpan.text(""),this.privacySelectorSpan.text(e),this.privacySelectorSpan.show(),0=t.scrollHeight&&!a.hasClass("loading")&&0=t.scrollHeight&&!p(e.target).closest(".bp-group-messages-attached-gif-container").hasClass("loading")&&0\n\t\n\t\t\n\t\n',e.data[t].saved=!1,this.gif_data.push(e.data[t]);p(".bp-group-messages-attached-gif-container").find(".gif-search-results-list").append(i)}void 0!==e.pagination&&void 0!==e.pagination.total_count&&(this.gif_total_count=e.pagination.total_count)},loadMoreGifResponse:function(e){var t=this,i=0;if(p('div.forums-attached-gif-container[data-key="'+t.gif_container_key+'"]').removeClass("loading"),void 0!==e.data&&e.data.length){for(var a="",i=0;i\n\t\n\t\t\n\t\n',e.data[i].saved=!1,t.gif_data[t.gif_container_key].data.push(e.data[i]);p('div.forums-attached-gif-container[data-key="'+t.gif_container_key+'"]').closest("form").find(".gif-search-results-list").append(a)}void 0!==e.pagination&&void 0!==e.pagination.total_count&&(t.gif_data[t.gif_container_key].total_count=e.pagination.total_count)},editGifPreview:function(){var e=this,t={};if(e.bbp_is_reply_edit&&Object.keys(e.bbp_reply_edit_gif_data).length?t=e.bbp_reply_edit_gif_data.gif_raw_data:e.bbp_is_topic_edit&&Object.keys(e.bbp_topic_edit_gif_data).length?t=e.bbp_topic_edit_gif_data.gif_raw_data:e.bbp_is_forum_edit&&Object.keys(e.bbp_forum_edit_gif_data).length&&(t=e.bbp_forum_edit_gif_data.gif_raw_data),void 0===t.images)return!1;e=p("#whats-new-attachments .forums-attached-gif-container");e[0].style.backgroundImage="url("+t.images.fixed_width.url+")",e[0].style.backgroundSize="contain",e[0].style.height=t.images.original.height+"px",e[0].style.width=t.images.original.width+"px",e.find(".gif-image-container img").attr("src",t.images.original.url),e.removeClass("closed"),p("#bbp_media_gif").length&&p("#bbp_media_gif").val(JSON.stringify(t))},selectGif:function(e){var t=this,i=0,a=p(e.currentTarget),o=a.closest("form").find(".forums-attached-gif-container");e.preventDefault(),o.closest("form").find(".gif-media-search-dropdown").removeClass("open");var d=o.data("key");if(void 0!==t.gif_data[d]&&void 0!==t.gif_data[d].data&&t.gif_data[d].data.length){for(i=0;i\n\t\n\t\t\n\t\n',e.data[o].saved=!1,a.gif_data.push(e.data[o]);p(i.target).closest(".bp-group-messages-attached-gif-container").find(".gif-search-results-list").append(t)}void 0!==e.pagination&&void 0!==e.pagination.total_count&&(a.gif_total_count=e.pagination.total_count),p(i.target).closest(".bp-group-messages-attached-gif-container").removeClass("loading")},function(){p(i.target).find(".gif-no-connection").addClass("show")});a.gif_requests.push(e),a.gif_offset=a.gif_offset+a.gif_limit},searchGifRequest:function(i){var a=this,o=0,d=p(i.target).closest("form").find(".forums-attached-gif-container");d.addClass("loading");var s=d.data("key");p(i.target).closest("form").find(".gif-no-results").removeClass("show"),p(i.target).closest("form").find(".gif-no-connection").removeClass("show"),a.clearGifRequests(s),a.gif_data[s].q=i.target.value,a.gif_data[s].offset=0;var e=a.giphy.search({q:a.gif_data[s].q,offset:a.gif_data[s].offset,fmt:"json",limit:a.gif_data[s].limit},function(e){if(void 0!==e.data.length&&0===e.data.length&&p(i.target).closest("form").find(".gif-no-results").addClass("show"),void 0!==e.meta.status&&200!==e.meta.status&&p(i.target).closest("form").find(".gif-no-connection").addClass("show"),void 0!==e.data&&e.data.length){var t="";for(o=0;o\n\t\n\t\t\n\t\n',e.data[o].saved=!1,a.gif_data[s].data.push(e.data[o]);p(i.target).closest(".gif-search-content").find(".gif-search-results-list").append(t)}void 0!==e.pagination&&void 0!==e.pagination.total_count&&(a.gif_data[s].total_count=e.pagination.total_count),d.removeClass("loading")},function(){p(i.target).closest("form").find(".gif-no-connection").addClass("show")});a.gif_data[s].requests.push(e),a.gif_data[s].offset=a.gif_data[s].offset+a.gif_data[s].limit},clearGifRequests:function(e){var t=this;if(void 0!==t.gif_data[e]&&void 0!==t.gif_data[e].requests){for(var i=0;i\n\t\n\t\t\n\t\n',e.data[s].saved=!1,o.gif_data[a].data.push(e.data[s]);d.closest("form").find(".gif-search-results-list").append(t)}void 0!==e.pagination&&void 0!==e.pagination.total_count&&(o.gif_data[a].total_count=e.pagination.total_count),i.removeClass("loading")}),o.gif_data[a].requests.push(e),o.gif_data[a].offset=o.gif_data[a].offset+o.gif_data[a].limit),t.toggleClass("open");t=d.parents("form").find("#whats-new-attachments .forums-attached-gif-container img");0\n\t\n\t\t\n\t\n',e.data[o].saved=!1,i.gif_data.push(e.data[o]);a.closest("form").find(".gif-search-results-list").append(t)}void 0!==e.pagination&&void 0!==e.pagination.total_count&&(i.gif_total_count=e.pagination.total_count),p(".gif-search-query").closest(".bp-group-messages-attached-gif-container").removeClass("loading")}),i.gif_requests.push(d),i.gif_offset=i.gif_offset+i.gif_limit);var d=a.parents("form").find("#whats-new-attachments .bp-group-messages-attached-gif-container img");0"),this.removeFile(e),o.closest("form").removeClass("media-uploading"))}),a.dropzone_obj[n].on("success",function(e,t){t.data.id?(e.id=t.id,t.data.uuid=e.upload.uuid,t.data.menu_order=p(e.previewElement).closest(".dropzone").find(e.previewElement).index()-1,t.data.album_id=a.album_id,t.data.group_id=a.group_id,t.data.saved=!1,a.dropzone_media[n].push(t.data),a.addMediaIdsToForumsForm(d)):(jQuery(".forum-media-error-popup").length||p("body").append('
        "),this.removeFile(e))}),a.dropzone_obj[n].on("removedfile",function(e){if(!0===bp.Nouveau.Media.reply_topic_allow_delete_media){if(a.dropzone_media[n].length)for(var t in a.dropzone_media[n])if(e.upload.uuid==a.dropzone_media[n][t].uuid){this.bbp_is_reply_edit||this.bbp_is_topic_edit||this.bbp_is_forum_edit||void 0===a.dropzone_media[n][t].saved||a.dropzone_media[n][t].saved||"edit"!==bp.Nouveau.Media.reply_topic_display_post||a.removeAttachment(a.dropzone_media[n][t].id),a.dropzone_media[n].splice(t,1),a.addMediaIdsToForumsForm(d);break}var i;_.isNull(a.dropzone_obj[n].files)||0!==a.dropzone_obj[n].files.length||((i=o.closest("form")).find("#forums-document-button")&&i.find("#forums-document-button").parents(".post-elements-buttons-item").removeClass("disable"),i.find("#forums-video-button")&&i.find("#forums-video-button").parents(".post-elements-buttons-item").removeClass("disable"),i.find("#forums-gif-button")&&i.find("#forums-gif-button").parents(".post-elements-buttons-item").removeClass("disable"),i.find("#forums-media-button")&&i.find("#forums-media-button").parents(".post-elements-buttons-item").removeClass("no-click"))}_.isNull(a.dropzone_obj[n].files)||0!==a.dropzone_obj[n].files.length||o.closest("form").removeClass("has-media")}),a.dropzone_obj[n].on("complete",function(){0===this.getUploadingFiles().length&&0===this.getQueuedFiles().length&&0"),this.removeFile(e))}),a.dropzone_obj.on("success",function(e,t){t.data.id?(e.id=t.id,t.data.uuid=e.upload.uuid,t.data.menu_order=p(e.previewElement).closest(".dropzone").find(e.previewElement).index()-1,t.data.album_id=a.album_id,t.data.group_id=a.group_id,t.data.saved=!1,a.dropzone_media.push(t.data),a.addMediaIdsToGroupMessagesForm()):(jQuery(".group-message-error-popup").length||p("body").append('
        "),this.removeFile(e))}),a.dropzone_obj.on("removedfile",function(e){if(a.dropzone_media.length)for(var t in a.dropzone_media)if(e.upload.uuid==a.dropzone_media[t].uuid){void 0===a.dropzone_media[t].saved||a.dropzone_media[t].saved||a.removeAttachment(a.dropzone_media[t].id),a.dropzone_media.splice(t,1),a.addMediaIdsToGroupMessagesForm();break}var i;_.isNull(a.dropzone_obj.files)||0!==a.dropzone_obj.files.length||((i=p("#send_group_message_form")).find("#bp-group-messages-document-button")&&i.find("#bp-group-messages-document-button").parents(".post-elements-buttons-item").removeClass("disable"),i.find("#bp-group-messages-video-button")&&i.find("#bp-group-messages-video-button").parents(".post-elements-buttons-item").removeClass("disable"),i.find("#bp-group-messages-gif-button")&&i.find("#bp-group-messages-gif-button").parents(".post-elements-buttons-item").removeClass("disable"),i.find("#bp-group-messages-media-button")&&i.find("#bp-group-messages-media-button").parents(".post-elements-buttons-item").removeClass("no-click"))}),t.removeClass("closed").addClass("open"),a.resetGroupMessagesGifComponent(),a.resetGroupMessagesDocumentComponent(),a.resetGroupMessagesVideoComponent()):a.resetGroupMessagesMediaComponent())},openGroupMessagesDocumentUploader:function(e){var l=this,t=p("div#bp-group-messages-post-document-uploader"),i=p(e.currentTarget);e.preventDefault(),i.toggleClass("active"),void 0!==window.Dropzone&&t.length&&(t.hasClass("closed")?(l.document_dropzone_obj=new Dropzone("div#bp-group-messages-post-document-uploader",l.documentOptions),l.document_dropzone_obj.on("addedfile",function(){}),l.document_dropzone_obj.on("sending",function(e,t,i){i.append("action","document_document_upload"),i.append("_wpnonce",BP_Nouveau.nonces.media);i=p("#send_group_message_form");i.find("#bp-group-messages-media-button")&&i.find("#bp-group-messages-media-button").parents(".post-elements-buttons-item").addClass("disable"),i.find("#bp-group-messages-video-button")&&i.find("#bp-group-messages-video-button").parents(".post-elements-buttons-item").addClass("disable"),i.find("#bp-group-messages-gif-button")&&i.find("#bp-group-messages-gif-button").parents(".post-elements-buttons-item").addClass("disable"),i.find("#bp-group-messages-document-button")&&i.find("#bp-group-messages-document-button").parents(".post-elements-buttons-item").addClass("no-click")}),l.document_dropzone_obj.on("uploadprogress",function(e){var t=p(e.previewElement).find(".dz-progress-ring circle")[0],i=2*t.r.baseVal.value*Math.PI;t.style.strokeDasharray=i+" "+i;i=(t.style.strokeDashoffset=i)-e.upload.progress.toFixed(0)/100*i;t.style.strokeDashoffset=i}),l.document_dropzone_obj.on("error",function(e,t){e.accepted?void 0!==t&&void 0!==t.data&&void 0!==t.data.feedback?p(e.previewElement).find(".dz-error-message span").text(t.data.feedback):"error"==e.status&&e.xhr&&0==e.xhr.status&&p(e.previewElement).find(".dz-error-message span").text(BP_Nouveau.media.connection_lost_error):(jQuery(".group-document-error-popup").length||p("body").append('
        "),this.removeFile(e))}),l.document_dropzone_obj.on("accept",function(e,t){0==e.size?t(BP_Nouveau.media.empty_document_type):t()}),l.document_dropzone_obj.on("success",function(e,t){if(!t.data.id){var i,a,o,d,s,n=t.data.feedback;for(e.previewElement.classList.add("dz-error"),s=[],a=0,o=(d=e.previewElement.querySelectorAll("[data-dz-errormessage]")).length;a"),this.removeFile(e))}),r.video_dropzone_obj.on("accept",function(e,t){0==e.size?t(BP_Nouveau.video.empty_video_type):t()}),r.video_dropzone_obj.on("addedfile",function(e){e.dataURL||bp.Nouveau.getVideoThumb&&bp.Nouveau.getVideoThumb(e,".dz-video-thumbnail")}),r.video_dropzone_obj.on("uploadprogress",function(e){var t=p(e.previewElement).find(".dz-progress-ring circle")[0],i=2*t.r.baseVal.value*Math.PI;t.style.strokeDasharray=i+" "+i;var a=i-e.upload.progress.toFixed(0)/100*i;e.upload.progress<=99?(p(e.previewElement).find(".dz-progress-count").text(e.upload.progress.toFixed(0)+"% "+BP_Nouveau.video.i18n_strings.video_uploaded_text),t.style.strokeDashoffset=a):100===e.upload.progress&&(t.style.strokeDashoffset=i-.99*i,p(e.previewElement).find(".dz-progress-count").text("99% "+BP_Nouveau.video.i18n_strings.video_uploaded_text))}),r.video_dropzone_obj.on("success",function(e,t){if(100===e.upload.progress&&(p(e.previewElement).find(".dz-progress-ring circle")[0].style.strokeDashoffset=0,p(e.previewElement).find(".dz-progress-count").text("100% "+BP_Nouveau.video.i18n_strings.video_uploaded_text),p(e.previewElement).closest(".dz-preview").addClass("dz-complete")),!t.data.id){var i,a,o,d,s,n=t.data.feedback;for(e.previewElement.classList.add("dz-error"),s=[],a=0,o=(d=e.previewElement.querySelectorAll("[data-dz-errormessage]")).length;a"),this.removeFile(e),a.closest("form").removeClass("media-uploading"))}),l.dropzone_obj[u].on("accept",function(e,t){0==e.size?t(BP_Nouveau.media.empty_document_type):t()}),l.dropzone_obj[u].on("success",function(e,t){if(!t.data.id){var i,a,o,d,s,n=t.data.feedback;for(e.previewElement.classList.add("dz-error"),s=[],a=0,o=(d=e.previewElement.querySelectorAll("[data-dz-errormessage]")).length;a"),this.removeFile(e),o.closest("form").removeClass("media-uploading"))}),r.dropzone_obj[c].on("accept",function(e,t){0==e.size?t(BP_Nouveau.video.empty_video_type):t()}),r.dropzone_obj[c].on("addedfile",function(e){e.dataURL&&e.dataThumb&&e.dataThumb.length?p(e.previewElement).find(".dz-video-thumbnail").prepend(''):bp.Nouveau.getVideoThumb&&bp.Nouveau.getVideoThumb(e,".dz-video-thumbnail")}),r.dropzone_obj[c].on("uploadprogress",function(e){o.closest("form").addClass("media-uploading");var t=p(e.previewElement).find(".dz-progress-ring circle")[0],i=2*t.r.baseVal.value*Math.PI;t.style.strokeDasharray=i+" "+i;var a=i-e.upload.progress.toFixed(0)/100*i;e.upload.progress<=99?(p(e.previewElement).find(".dz-progress-count").text(e.upload.progress.toFixed(0)+"% "+BP_Nouveau.video.i18n_strings.video_uploaded_text),t.style.strokeDashoffset=a):100===e.upload.progress&&(t.style.strokeDashoffset=i-.99*i,p(e.previewElement).find(".dz-progress-count").text("99% "+BP_Nouveau.video.i18n_strings.video_uploaded_text))}),r.dropzone_obj[c].on("success",function(e,t){if(100===e.upload.progress&&(p(e.previewElement).find(".dz-progress-ring circle")[0].style.strokeDashoffset=0,p(e.previewElement).find(".dz-progress-count").text("100% "+BP_Nouveau.video.i18n_strings.video_uploaded_text),p(e.previewElement).closest(".dz-preview").addClass("dz-complete")),!t.data.id){var i,a,o,d,s,n=t.data.feedback;for(e.previewElement.classList.add("dz-error"),s=[],a=0,o=(d=e.previewElement.querySelectorAll("[data-dz-errormessage]")).length;a'+p(this).text()+""),p(this).addClass("selected").parent().addClass("is_active").siblings().removeClass("is_active").children("span").removeClass("selected"),a==p(e.currentTarget).data("id")?p(e.currentTarget).closest(".bb-field-wrap").find(".bb-model-footer .bp-media-move").addClass("is-disabled"):p(e.currentTarget).closest(".bb-field-wrap").find(".bb-model-footer .bp-media-move").removeClass("is-disabled"),p(e.currentTarget).closest(".bb-field-wrap").find(".bb-model-footer .bp-media-move").hasClass("is-disabled")||(p(e.currentTarget).closest(".bb-field-wrap").find(".bb-album-selected-id").val(p(e.currentTarget).data("id")),t=p(e.currentTarget).closest("#bp-media-uploader").find("#bb-media-privacy"),0!==Number(p(e.currentTarget).data("id"))?(t.find("option").removeAttr("selected"),t.val(p(e.currentTarget).parent().data("privacy")),t.prop("disabled",!0)):(t.find("option").removeAttr("selected"),t.val("public"),t.prop("disabled",!1))))}),p(document).on("click",t+" .breadcrumb .item > span",function(e){var t,i;p(this).hasClass("is-disabled")||(p(e.currentTarget).closest(".bb-field-wrap").find(".bb-album-selected-id").val(0),p(e.currentTarget).closest(".bb-field-wrap").find(".location-album-list li span").removeClass("selected").parent().removeClass("is_active"),p(this).closest(".location-album-list-wrap").find(".breadcrumb .item span:last-child").hasClass("is-disabled")&&p(this).closest(".location-album-list-wrap").find(".breadcrumb .item span:last-child").remove(),a==p(e.currentTarget).data("id")?p(e.currentTarget).closest(".bb-field-wrap").find(".bb-model-footer .bp-media-move").addClass("is-disabled"):p(e.currentTarget).closest(".bb-field-wrap").find(".bb-model-footer .bp-media-move").removeClass("is-disabled"),t=p(e.currentTarget).closest("#bp-media-uploader").find("#bb-media-privacy"),i=p(e.currentTarget).closest("#bp-media-uploader").find(".location-album-list li.is_active").data("privacy"),0!==Number(p(e.currentTarget).closest(".bb-field-wrap").find(".bb-album-selected-id").val())?(t.find("option").removeAttr("selected"),t.val(void 0===i?"public":i),t.prop("disabled",!0)):(t.find("option").removeAttr("selected"),t.val("public"),t.prop("disabled",!1)))}),e=document.getElementsByClassName("uploader-post-media-template").length?document.getElementsByClassName("uploader-post-media-template")[0].innerHTML:"",i.options.previewTemplate=e,i.dropzone_obj=new Dropzone("div#media-uploader",i.options),i.dropzone_obj.on("sending",function(e,t,i){i.append("action","media_upload"),i.append("_wpnonce",BP_Nouveau.nonces.media)}),i.dropzone_obj.on("uploadprogress",function(e){var t=p(e.previewElement).find(".dz-progress-ring circle")[0],i=2*t.r.baseVal.value*Math.PI;t.style.strokeDasharray=i+" "+i;i=(t.style.strokeDashoffset=i)-e.upload.progress.toFixed(0)/100*i;t.style.strokeDashoffset=i}),i.dropzone_obj.on("addedfile",function(){setTimeout(function(){i.dropzone_obj.getAcceptedFiles().length&&p("#bp-media-uploader-modal-status-text").text(wp.i18n.sprintf(BP_Nouveau.media.i18n_strings.upload_status,i.dropzone_media.length,i.dropzone_obj.getAcceptedFiles().length)).show()},1e3)}),i.dropzone_obj.on("error",function(e,t){e.accepted?void 0!==t&&void 0!==t.data&&void 0!==t.data.feedback?p(e.previewElement).find(".dz-error-message span").text(t.data.feedback):"error"==e.status&&e.xhr&&0==e.xhr.status&&p(e.previewElement).find(".dz-error-message span").text(BP_Nouveau.media.connection_lost_error):(jQuery(".media-error-popup").length||p("body").append('
        "),this.removeFile(e))}),i.dropzone_obj.on("queuecomplete",function(){p("#bp-media-uploader-modal-title").text(BP_Nouveau.media.i18n_strings.upload)}),i.dropzone_obj.on("processing",function(){p("#bp-media-uploader-modal-title").text(BP_Nouveau.media.i18n_strings.uploading+"...")}),i.dropzone_obj.on("success",function(e,t){t.data.id?(e.id=t.id,t.data.uuid=e.upload.uuid,t.data.menu_order=i.dropzone_media.length,t.data.album_id=i.album_id,t.data.group_id=i.group_id,t.data.saved=!1,i.dropzone_media.push(t.data)):(jQuery(".media-error-popup").length||p("body").append('
        "),this.removeFile(e)),p(".bb-field-steps-1 #bp-media-photo-next, #bp-media-submit").show(),p(".modal-container").addClass("modal-container--alert"),p(".bb-field-steps-1").addClass("controls-added"),p("#bp-media-add-more").show(),p("#bp-media-uploader-modal-title").text(BP_Nouveau.media.i18n_strings.uploading+"..."),p("#bp-media-uploader-modal-status-text").text(wp.i18n.sprintf(BP_Nouveau.media.i18n_strings.upload_status,i.dropzone_media.length,i.dropzone_obj.getAcceptedFiles().length)).show()}),i.dropzone_obj.on("removedfile",function(e){if(i.dropzone_media.length)for(var t in i.dropzone_media)if(e.upload.uuid==i.dropzone_media[t].uuid){void 0===i.dropzone_media[t].saved||i.dropzone_media[t].saved||i.removeAttachment(i.dropzone_media[t].id),i.dropzone_media.splice(t,1);break}i.dropzone_obj.getAcceptedFiles().length?p("#bp-media-uploader-modal-status-text").text(wp.i18n.sprintf(BP_Nouveau.media.i18n_strings.upload_status,i.dropzone_media.length,i.dropzone_obj.getAcceptedFiles().length)).show():(p("#bp-media-uploader-modal-status-text").text(""),p("#bp-media-add-more, #bp-media-photo-next").hide(),p(".bb-field-steps-1").removeClass("controls-added"),p("#bp-media-submit").hide(),p(".modal-container").removeClass("modal-container--alert"))}))},openDocumentUploader:function(e){var a,t,l=this;e.preventDefault(),void 0!==window.Dropzone&&p("div#media-uploader").length&&(p("#bp-media-uploader").hasClass("bp-media-document-uploader")&&(this.currentTargetParent||(this.currentTargetParent=0)),p(e.currentTarget).closest("#bp-media-single-folder").length&&p("#bb-document-privacy").hide(),p(document).removeClass("open-popup"),p("#bp-media-uploader").show(),p("#bp-media-uploader").addClass("open-popup"),p("#bp-media-uploader.bp-media-document-uploader").find(".bb-field-steps.bb-field-steps-2").length&&(t="#bp-media-uploader.bp-media-document-uploader",0!==Number(p(t).find(".bb-folder-selected-id").data("value"))?(a=p(t).find(".bb-folder-selected-id").data("value"),p(t).find("#bb-document-privacy").prop("disabled",!0)):a=0,""!==this.moveToIdPopup&&p.ajax({url:BP_Nouveau.ajaxurl,type:"GET",data:{action:"document_get_folder_view",id:this.moveToIdPopup,type:this.moveToTypePopup},success:function(e){p(document).find(".bp-media-document-uploader .location-folder-list-wrap h4 span.where-to-move-profile-or-group-document").html(e.data.first_span_text),""===e.data.html?(p(document).find(".bp-media-document-uploader.open-popup .location-folder-list-wrap").hide(),p(document).find(".bp-media-document-uploader.open-popup .location-folder-list-wrap-main span.no-folder-exists").show()):(p(document).find(".bp-media-document-uploader.open-popup .location-folder-list-wrap-main span.no-folder-exists").hide(),p(document).find(".bp-media-document-uploader.open-popup .location-folder-list-wrap").show()),p(document).find(".bp-media-document-uploader .popup-on-fly-create-album .privacy-field-wrap-hide-show").show(),p(document).find(".bp-media-document-uploader .open-popup .bb-folder-create-from").val("profile"),p(t).find(".location-folder-list-wrap .location-folder-list").remove(),p(t).find(".location-folder-list-wrap").append(e.data.html),bp.Nouveau.Media.folderLocationUI&&bp.Nouveau.Media.folderLocationUI(t,a),p(t).find("ul.location-folder-list span#"+a).trigger("click"),p(t).find(".bb-folder-selected-id").val(a)}})),p(document).on("click",t+" .location-folder-list li span",function(e){var t;e.preventDefault(),p(this).parent().hasClass("is_active")||(0!=p(this).closest(".location-folder-list-wrap").find(".breadcrumb .item span:last-child").data("id")&&p(this).closest(".location-folder-list-wrap").find(".breadcrumb .item span:last-child").remove(),p(this).closest(".location-folder-list-wrap").find(".breadcrumb .item").append(''+p(this).text()+""),p(this).addClass("selected").parent().addClass("is_active").siblings().removeClass("is_active").children("span").removeClass("selected"),a==p(e.currentTarget).data("id")?p(e.currentTarget).closest(".bb-field-wrap").find(".bb-model-footer .bp-media-move").addClass("is-disabled"):p(e.currentTarget).closest(".bb-field-wrap").find(".bb-model-footer .bp-media-move").removeClass("is-disabled"),p(e.currentTarget).closest(".bb-field-wrap").find(".bb-model-footer .bp-media-move").hasClass("is-disabled")||(p(e.currentTarget).closest(".bb-field-wrap").find(".bb-folder-selected-id").val(p(e.currentTarget).data("id")),t=p(e.currentTarget).closest("#bp-media-uploader").find("#bb-document-privacy"),0!==Number(p(e.currentTarget).data("id"))?(t.find("option").removeAttr("selected"),t.val(p(e.currentTarget).parent().data("privacy")),t.prop("disabled",!0)):(t.find("option").removeAttr("selected"),t.val("public"),t.prop("disabled",!1))))}),p(document).on("click",t+" .breadcrumb .item > span",function(e){var t,i;p(this).hasClass("is-disabled")||(p(e.currentTarget).closest(".bb-field-wrap").find(".bb-folder-selected-id").val(p(e.currentTarget).data("id")),p(e.currentTarget).closest(".bb-field-wrap").find(".location-folder-list li span").removeClass("selected").parent().removeClass("is_active"),p(e.currentTarget).closest(".bb-field-wrap").find('.location-folder-list li[data-id="'+p(e.currentTarget).data("id")+'"]').addClass("is_active"),p(this).closest(".location-folder-list-wrap").find(".breadcrumb .item span:last-child").hasClass("is-disabled")&&p(this).closest(".location-folder-list-wrap").find(".breadcrumb .item span:last-child").remove(),a==p(e.currentTarget).data("id")?p(e.currentTarget).closest(".bb-field-wrap").find(".bb-model-footer .bp-media-move").addClass("is-disabled"):p(e.currentTarget).closest(".bb-field-wrap").find(".bb-model-footer .bp-media-move").removeClass("is-disabled"),t=p(e.currentTarget).closest("#bp-media-uploader").find("#bb-document-privacy"),i=p(e.currentTarget).closest("#bp-media-uploader").find(".location-folder-list li.is_active").data("privacy"),0!==Number(p(e.currentTarget).closest(".bb-field-wrap").find(".bb-folder-selected-id").val())?(t.find("option").removeAttr("selected"),t.val(void 0===i?"public":i),t.prop("disabled",!0)):(t.find("option").removeAttr("selected"),t.val("public"),t.prop("disabled",!1)))}),e=document.getElementsByClassName("uploader-post-document-template").length?document.getElementsByClassName("uploader-post-document-template")[0].innerHTML:"",l.options.previewTemplate=e,l.dropzone_obj=new Dropzone("div#media-uploader",l.options),l.dropzone_obj.on("sending",function(e,t,i){i.append("action","document_document_upload"),i.append("_wpnonce",BP_Nouveau.nonces.media)}),l.dropzone_obj.on("uploadprogress",function(e){var t=p(e.previewElement).find(".dz-progress-ring circle")[0],i=2*t.r.baseVal.value*Math.PI;t.style.strokeDasharray=i+" "+i;i=(t.style.strokeDashoffset=i)-e.upload.progress.toFixed(0)/100*i;t.style.strokeDashoffset=i}),l.dropzone_obj.on("addedfile",function(){setTimeout(function(){l.dropzone_obj.getAcceptedFiles().length&&p("#bp-media-uploader-modal-status-text").text(wp.i18n.sprintf(BP_Nouveau.media.i18n_strings.upload_status,l.dropzone_media.length,l.dropzone_obj.getAcceptedFiles().length)).show()},1e3)}),l.dropzone_obj.on("error",function(e,t){e.accepted?void 0!==t&&void 0!==t.data&&void 0!==t.data.feedback?p(e.previewElement).find(".dz-error-message span").text(t.data.feedback):"error"==e.status&&e.xhr&&0==e.xhr.status&&p(e.previewElement).find(".dz-error-message span").text(BP_Nouveau.media.connection_lost_error):(jQuery(".document-error-popup").length||p("body").append('
        "),this.removeFile(e))}),l.dropzone_obj.on("accept",function(e,t){0==e.size?t(BP_Nouveau.media.empty_document_type):t()}),l.dropzone_obj.on("queuecomplete",function(){p("#bp-media-uploader-modal-title").text(BP_Nouveau.media.i18n_strings.upload)}),l.dropzone_obj.on("processing",function(){p("#bp-media-uploader-modal-title").text(BP_Nouveau.media.i18n_strings.uploading+"...")}),l.dropzone_obj.on("success",function(e,t){if(!t.data.id){var i,a,o,d,s,n=t.data.feedback;for(e.previewElement.classList.add("dz-error"),s=[],a=0,o=(d=e.previewElement.querySelectorAll("[data-dz-errormessage]")).length;a .activity-content .bp-media-move-file",p(o).find(".bp-document-move").attr("id",p(e.currentTarget).closest(".document-activity").attr("data-id")),0
      • ');var d=t,s=this.moveToTypePopup;""!==this.moveToIdPopup&&p.ajax({url:BP_Nouveau.ajaxurl,type:"post",data:{action:"media_get_album_view",id:this.moveToIdPopup,type:this.moveToTypePopup},success:function(e){p(document).find(".location-album-list-wrap h4 span.where-to-move-profile-or-group-media").html(e.data.first_span_text),""===e.data.html?(p(document).find(".open-popup .location-album-list-wrap").hide(),p(document).find(".open-popup .location-album-list-wrap-main span.no-album-exists").show()):(p(document).find(".open-popup .location-album-list-wrap-main span.no-album-exists").hide(),p(document).find(".open-popup .location-album-list-wrap").show()),"group"===s?(p(document).find(".popup-on-fly-create-album .privacy-field-wrap-hide-show").hide(),p(document).find(".open-popup .bb-album-create-from").val("group")):(p(document).find(".popup-on-fly-create-album .privacy-field-wrap-hide-show").show(),p(document).find(".open-popup .bb-album-create-from").val("profile")),!1===e.data.create_album?(p(o+".open-popup").find(".bp-media-open-create-popup-folder").removeClass("create-album"),p(o+".open-popup").find(".bp-media-open-create-popup-folder").hide()):(p(o+".open-popup").find(".bp-media-open-create-popup-folder").addClass("create-album"),p(o+".open-popup").find(".bp-media-open-create-popup-folder").show()),p(o).find(".location-album-list-wrap .location-album-list").remove(),p(o).find(".location-album-list-wrap").append(e.data.html),p(o).find("ul.location-album-list span#"+d).trigger("click")}}),p(document).on("click",o+" .location-album-list li span",function(e){var t;e.preventDefault(),p(this).parent().hasClass("is_active")||(0!=p(this).closest(".location-album-list-wrap").find(".breadcrumb .item span:last-child").data("id")&&p(this).closest(".location-album-list-wrap").find(".breadcrumb .item span:last-child").remove(),p(this).closest(".location-album-list-wrap").find(".breadcrumb .item").append(''+p(this).text()+""),p(this).addClass("selected").parent().addClass("is_active").siblings().removeClass("is_active").children("span").removeClass("selected"),t=p(document).find('a.bb-open-media-theatre[data-id="'+i.find(".bp-media-move").attr("id")+'"]').data("album-id"),Number(t)==Number(p(e.currentTarget).data("id"))?p(e.currentTarget).closest(".bp-media-move-file").find(".bb-model-footer .bp-media-move").addClass("is-disabled"):p(e.currentTarget).closest(".bp-media-move-file").find(".bb-model-footer .bp-media-move").removeClass("is-disabled"),p(e.currentTarget).closest(".bp-media-move-file").find(".bb-model-footer .bp-media-move").hasClass("is-disabled")||p(e.currentTarget).closest(".bp-media-move-file").find(".bb-album-selected-id").val(p(e.currentTarget).data("id")))}),p(document).on("click",o+" .breadcrumb .item > span",function(e){p(this).hasClass("is-disabled")||(p(e.currentTarget).closest(".bp-media-move-file").find(".bb-album-selected-id").val(0),p(e.currentTarget).closest(".bp-media-move-file").find(".location-album-list li span").removeClass("selected").parent().removeClass("is_active"),p(this).closest(".location-album-list-wrap").find(".breadcrumb .item span:last-child").hasClass("is-disabled")&&p(this).closest(".location-album-list-wrap").find(".breadcrumb .item span:last-child").remove(),d==p(e.currentTarget).data("id")?p(e.currentTarget).closest(".bp-media-move-file").find(".bb-model-footer .bp-media-move").addClass("is-disabled"):p(e.currentTarget).closest(".bp-media-move-file").find(".bb-model-footer .bp-media-move").removeClass("is-disabled"))})},openDocumentMove:function(e){e.preventDefault();p(e.currentTarget).closest(".bb-activity-media-elem").find(".document-title").text();this.moveToIdPopup=p(e.currentTarget).attr("id"),this.moveToTypePopup=p(e.currentTarget).attr("data-type");var t=p(e.currentTarget).attr("data-action"),i=p(e.currentTarget).closest(".conflict-activity-ul-li-comment").closest("li.comment-item").length?"#"+p(e.currentTarget).closest(".conflict-activity-ul-li-comment").closest("li").attr("id")+".comment-item .bp-media-move-file":"#"+p(e.currentTarget).closest("li.activity-item").attr("id")+" > .activity-content .bp-media-move-file";p(i).find(".bp-document-move").attr("id",p(e.currentTarget).closest(".document-activity").attr("data-id")),this.currentTargetParent=p(e.currentTarget).closest(".bb-activity-media-elem").attr("data-parent-id"),0
      • '),"document"===t?p(i).find(".bb-model-header h4 .target_name").text(BP_Nouveau.media.move_to_file):p(i).find(".bb-model-header h4 .target_name").text(BP_Nouveau.media.move_to_folder),p(i).show(),p(i).addClass("open-popup"),"group"===this.moveToTypePopup?(p(document).find(".location-folder-list-wrap h4").show(),p(i).addClass("move-folder-popup-group")):(p(document).find(".location-folder-list-wrap h4").hide(),p(".move-folder-popup-group").removeClass("move-folder-popup-group"));var a=this.currentTargetParent,o=this.moveToTypePopup;""!==this.moveToIdPopup&&p.ajax({url:BP_Nouveau.ajaxurl,type:"GET",data:{action:"document_get_folder_view",id:this.moveToIdPopup,type:this.moveToTypePopup},success:function(e){p(document).find(".location-folder-list-wrap h4 span.where-to-move-profile-or-group-document").html(e.data.first_span_text),""===e.data.html?(p(document).find(".open-popup .location-folder-list-wrap").hide(),p(document).find(".open-popup .location-folder-list-wrap-main span.no-folder-exists").show()):(p(document).find(".open-popup .location-folder-list-wrap-main span.no-folder-exists").hide(),p(document).find(".open-popup .location-folder-list-wrap").show()),"group"===o?(p(document).find(".popup-on-fly-create-folder .privacy-field-wrap-hide-show").hide(),p(document).find(".open-popup .bb-folder-create-from").val("group")):(p(document).find(".popup-on-fly-create-folder .privacy-field-wrap-hide-show").show(),p(document).find(".open-popup .bb-folder-create-from").val("profile")),p(i).find(".location-folder-list-wrap .location-folder-list").remove(),p(i).find(".location-folder-list-wrap").append(e.data.html),bp.Nouveau.Media.folderLocationUI&&(bp.Nouveau.Media.folderLocationUI(i,a),p(i).find("ul.location-folder-list span#"+a).trigger("click"))}})},closeMediaMove:function(e){e.preventDefault(),0!=p(e.currentTarget).closest(".bp-media-move-file").find(".location-album-list-wrap .breadcrumb .item span:last-child").data("id")&&p(e.currentTarget).closest(".bp-media-move-file").find(".location-album-list-wrap .breadcrumb .item span:last-child").remove(),p(e.currentTarget).closest(".bp-media-move-file").hide()},closeDocumentMove:function(e){e.preventDefault();var t=jQuery(e.currentTarget).closest(".has-folderlocationUI");(p(e.currentTarget).hasClass("ac-document-close-button")?p(e.currentTarget).closest(".bp-media-move-file").hide().find(".bp-document-move"):p(e.currentTarget).closest(".bp-media-move-folder").hide().find(".bp-folder-move")).attr("id",""),t.find(".bp-document-move.loading").removeClass("loading"),this.clearFolderLocationUI(e)},renameDocument:function(e){var t=p(e.currentTarget).closest(".media-folder_items").find(".media-folder_name"),i=t.children("span").text();t.hide().siblings(".media-folder_name_edit_wrap").show().children(".media-folder_name_edit").val(i).focus().select(),e.preventDefault()},editPrivacyDocument:function(e){e.preventDefault(),p(e.currentTarget).closest("#media-folder-document-data-table").find(".media-folder_visibility .media-folder_details__bottom span").show().siblings("select").addClass("hide");var t=p(e.currentTarget).closest(".media-folder_items").find(".media-folder_visibility");t.find(".media-folder_details__bottom span").hide().siblings("select").removeClass("hide"),t.find(".media-folder_details__bottom span").hide().siblings("select").val(p(e.currentTarget).attr("data-privacy")),t.find(".media-folder_details__bottom #bb-folder-privacy").attr("data-privacy",p(e.currentTarget).attr("data-privacy")),this.privacySelectorSelect=t.find(".media-folder_details__bottom span").hide().siblings("select"),this.privacySelectorSpan=t.find(".media-folder_details__bottom span")},editPrivacyDocumentSubmit:function(e){e=p(e.currentTarget);"true"==e.attr("data-mouseup")?(e.attr("data-mouseup","false"),e.addClass("hide").siblings("span").show().text(e.find("option:selected").text())):e.attr("data-mouseup","true")},renameDocumentSubmit:function(t){var i=p(t.currentTarget).closest(".media-folder_items").find(".media-folder_name_edit"),a=p(t.currentTarget).closest(".media-folder_items").find(".media-folder_name > span"),o=p(t.currentTarget).closest(".media-folder_items").find(".media-folder_name"),e=p(t.currentTarget).closest(".media-folder_items").find(".media-folder_name > i.media-document-id").attr("data-item-id"),d=p(t.currentTarget).closest(".media-folder_items").find(".media-folder_name > i.media-document-attachment-id").attr("data-item-id"),s=p(t.currentTarget).closest(".media-folder_items").find(".media-folder_name > i.media-document-type").attr("data-item-id"),n=i.val().trim(),r="";p(t.currentTarget).closest(".ac-document-list").length?r=/[?\[\]=<>:;,'"&$#*()|~`!{}%+ \/]+/g:p(t.currentTarget).closest(".ac-folder-list").length&&(r=/[\\/?%*:|"<>]+/g);r=r.exec(n),r=Boolean(r);if(r?i.addClass("error"):i.removeClass("error"),p(t.currentTarget).closest(".ac-document-list").length&&(-1!=n.indexOf("\\\\")||r?i.addClass("error"):i.removeClass("error")),!p(t.currentTarget).hasClass("name_edit_cancel")&&27!=t.keyCode||(i.removeClass("error"),i.parent().hide().siblings(".media-folder_name").show()),p(t.currentTarget).hasClass("name_edit_save")||13==t.keyCode){if(r)return;i.parent().addClass("submitting").append(''),p.ajax({url:BP_Nouveau.ajaxurl,type:"post",data:{action:"document_update_file_name",document_id:e,attachment_document_id:d,document_type:s,name:n,_wpnonce:BP_Nouveau.nonces.media},success:function(e){e.success?void 0!==e.data.document&&0');e.parents("li").each(function(e,t){t=p(t).children("span").clone();i.prepend("",t)}),p(a).find(".breadcrumbs-append-ul-li .breadcrumb").html(i.prepend(''+BP_Nouveau.media.target_text+"")),p(a).find(".breadcrumbs-append-ul-li .breadcrumb .item span.hidden").length||p(a).find(".breadcrumbs-append-ul-li .breadcrumb").find(".item").append(''),p(a).find(".breadcrumbs-append-ul-li .breadcrumb .item span:not(.hidden)").each(function(e){0p(a).find(".breadcrumbs-append-ul-li .breadcrumb").width()&&(p(a).find(".breadcrumbs-append-ul-li .breadcrumb .item span.hidden").append(p(a).find(".breadcrumbs-append-ul-li .breadcrumb .item span").eq(2)),p(a).find(".breadcrumbs-append-ul-li .breadcrumb .item .more_options").length||p('...').insertAfter(p(a).find(".breadcrumbs-append-ul-li .breadcrumb .item span").eq(0)))}),p(this).hasClass("selected")&&!p(this).hasClass("disabled")?(p(this).closest(".location-folder-list-wrap-main").find(".bb-folder-destination").val(""),p(this).closest(".location-folder-list-wrap-main").find(".bb-folder-selected-id").val("0"),p(a).find(".location-folder-list li.is_active").length?p(a).find(".bb-folder-selected-id").val(p(a).find(".location-folder-list li.is_active").attr("data-id")):p(a).find(".bb-folder-selected-id").val("0")):(p(this).closest(".location-folder-list-wrap-main").find(".location-folder-list li span").removeClass("selected"),p(this).addClass("selected"),p(this).closest(".location-folder-list-wrap-main").find(".bb-folder-destination").val(p(this).text()),p(this).closest(".location-folder-list-wrap-main").find(".bb-folder-selected-id").val(p(this).parent().attr("data-id"))),p(this).closest(".location-folder-list-wrap").find(".location-folder-title").text(p(this).siblings("span").text()).siblings(".location-folder-back").css("display","inline-block"),p(this).siblings("ul").show().siblings("span, i").hide().parent().siblings().hide(),p(this).siblings("ul").children("li").show().children("span,i").show(),p(this).closest(".is_active").removeClass("is_active"),p(a).find("li.is_active").removeClass("is_active"),p(this).parent().addClass("is_active"),p(a).find(".bb-folder-selected-id").val(p(a).find(".location-folder-list li.is_active").attr("data-id")),p(a).find(".breadcrumbs-append-ul-li .breadcrumb .item span").each(function(){p(this).show()}),o===p(a).find(".breadcrumbs-append-ul-li .item > span:last-child").attr("data-id")&&(p(a).hasClass("bp-media-move-file")||p(a).hasClass("bp-media-move-folder"))?(p(a).find(".bp-document-move").addClass("is-disabled"),p(a).find(".bp-folder-move").addClass("is-disabled")):(p(a).find(".bp-document-move").removeClass("is-disabled"),p(a).find(".bp-folder-move").removeClass("is-disabled")),setTimeout(function(){var e=0,e=(p(a).find(".breadcrumbs-append-ul-li .item > span:last-child").hasClass("hidden")?p(a).find(".breadcrumbs-append-ul-li .item > span:last-child").prev():p(a).find(".breadcrumbs-append-ul-li .item > span:last-child")).attr("id");o===e&&(p(a).hasClass("bp-media-move-file")||p(a).hasClass("bp-media-move-folder"))?(p(a).find(".bp-document-move").addClass("is-disabled"),p(a).find(".bp-folder-move").addClass("is-disabled")):(p(a).find(".bp-document-move").removeClass("is-disabled"),p(a).find(".bp-folder-move").removeClass("is-disabled"))},100)}),p(document).on("click",a+" .breadcrumbs-append-ul-li .item span",function(e){var t,i;p(this).parent().hasClass("is-disabled")||p(this).hasClass("more_options")||(t=p(e.currentTarget).attr("data-id"),p(a).find(".location-folder-list-wrap").find(".location-folder-title").text(p(a).find(".location-folder-list li.is_active").closest(".has-ul").children("span").text()).siblings(".location-folder-back").css("display","inline-block"),p(a).find(".bb-folder-selected-id").val(t),p(a).find(".location-folder-list li").hide(),p(a).find(".location-folder-list li.is_active").removeClass("is_active"),p(a).find(".location-folder-list li > span.selected").removeClass("selected"),p(a).find('.location-folder-list li[data-id="'+t+'"]').addClass("is_active").children("span").addClass("selected"),p(a).find(".location-folder-list li.is_active").parents(".has-ul").show().children("ul").show().siblings("span,i").hide(),p(a).find(".location-folder-list li.is_active").children("ul").length&&!p(a).find(".location-folder-list li.is_active").children("ul").hasClass("no-folder-list")?setTimeout(function(){p(a).find(".location-folder-list li.is_active").show().children("ul").show().children("li").show().children("span,i").show().closest("ul").siblings("span, i").hide()},100):p(a).find(".location-folder-list li.is_active").hasClass("has-ul").length?p(a).find(".location-folder-list li.is_active").children("span,i").hide().parent().children("ul").show().children("li").show():setTimeout(function(){p(a).find(".location-folder-list li.is_active").show().children("span").show().parent().siblings("li").show().children("span,i").show()},10),"0"===t&&(p(a).find(".location-folder-list").children("li").show().children("span,i").show(),p(a).find(".location-folder-list-wrap").find(".location-folder-title").text(BP_Nouveau.media.target_text),p(a).find(".location-folder-back").hide()),p(e.currentTarget).nextAll().remove(),o===p(a).find(".breadcrumbs-append-ul-li .item > span:last-child").attr("data-id")&&(p(a).hasClass("bp-media-move-file")||p(a).hasClass("bp-media-move-folder"))?(p(a).find(".bp-document-move").addClass("is-disabled"),p(a).find(".bp-folder-move").addClass("is-disabled")):(p(a).find(".bp-document-move").removeClass("is-disabled"),p(a).find(".bp-folder-move").removeClass("is-disabled")),e=p(a).find(".location-folder-list .is_active > span"),i=p('
        '),e.parents("li").each(function(e,t){t=p(t).children("span").clone();i.prepend("",t)}),p(a).find(".breadcrumbs-append-ul-li .breadcrumb").html(i.prepend(''+BP_Nouveau.media.target_text+"")),0===p(a).find('.breadcrumbs-append-ul-li .breadcrumb .item > span[data-id="'+t+'"]').length&&p(a).find(".breadcrumbs-append-ul-li .breadcrumb .item").append(p(a).find('.location-folder-list li[data-id="'+t+'"]').children("span").clone()),p(a).find(".breadcrumbs-append-ul-li .breadcrumb .item span.hidden").length||p(a).find(".breadcrumbs-append-ul-li .breadcrumb").find(".item").append(''),p(a).find(".breadcrumbs-append-ul-li .breadcrumb .item span:not(.hidden)").each(function(e){0p(a).find(".breadcrumbs-append-ul-li .breadcrumb").width()&&(p(a).find(".breadcrumbs-append-ul-li .breadcrumb .item span.hidden").append(p(a).find(".breadcrumbs-append-ul-li .breadcrumb .item span").eq(2)),p(a).find(".breadcrumbs-append-ul-li .breadcrumb .item .more_options").length||p('...').insertAfter(p(a).find(".breadcrumbs-append-ul-li .breadcrumb .item span").eq(0)))}),p(a).find(".bb-folder-selected-id").val(t))})),p(a).find(".location-folder-list li").each(function(){p(this).children("ul").parent().addClass("has-ul").append('')}),p(a).hasClass("bp-media-move-folder")&&(p(a).find(".location-folder-list li>span").removeClass("is-disabled"),p(a).find('.location-folder-list li>span[id="'+p(a).find(".bp-folder-move").attr("id")+'"]').parent().addClass("is-disabled")),e=p(a).find(".bp-folder-move").attr("id"),0==p(a).find('.location-folder-list li[data-id="'+e+'"]').siblings().length&&p(a).find('.location-folder-list li[data-id="'+e+'"]').parent("ul").addClass("no-folder-list a"),o&&(p(a).find(".location-folder-list li").hide(),p(a).find(".location-folder-list li.is_active").removeClass("is_active"),p(a).find('.location-folder-list li[data-id="'+o+'"]').addClass("is_active"),p(a).find(".location-folder-list li.is_active").parents(".has-ul").show().children("ul").show().siblings("span,i").hide(),p(a).find(".location-folder-list li.is_active").children("ul").length&&!p(a).find(".location-folder-list li.is_active").children("ul").hasClass("no-folder-list")?setTimeout(function(){p(a).find(".location-folder-list li.is_active").show().children("ul").show().children("li").show().children("span,i").show().closest("ul").siblings("span, i").hide()},100):p(a).find(".location-folder-list li.is_active").hasClass("has-ul").length?p(a).find(".location-folder-list li.is_active").children("span,i").hide().parent().children("ul").show().children("li").show():setTimeout(function(){p(a).find(".location-folder-list li.is_active").show().children("span").show().parent().siblings("li").show().children("span,i").show()},10),p(a).find(".location-folder-list-wrap").find(".location-folder-title").text(p(a).find(".location-folder-list li.is_active").closest(".has-ul").children("span").text()).siblings(".location-folder-back").css("display","inline-block"),p(a).find(".bb-folder-selected-id").val(p(a).find(".location-folder-list li.is_active").attr("data-id")),p(a).find('.location-folder-list li[data-id="'+e+'"]').children().hide()),"0"===o&&(p(a).find(".location-folder-list").children("li").show(),p(a).find(".location-folder-list-wrap").find(".location-folder-title").text(BP_Nouveau.media.target_text),p(a).find(".location-folder-back").hide()),setTimeout(function(){var e=0,e=(p(a).find(".breadcrumbs-append-ul-li .item > span:last-child").hasClass("hidden")?p(a).find(".breadcrumbs-append-ul-li .item > span:last-child").prev():p(a).find(".breadcrumbs-append-ul-li .item > span:last-child")).attr("id");o===e&&(p(a).hasClass("bp-media-move-file")||p(a).hasClass("bp-media-move-folder"))?(p(a).find(".bp-document-move").addClass("is-disabled"),p(a).find(".bp-folder-move").addClass("is-disabled")):(p(a).find(".bp-document-move").removeClass("is-disabled"),p(a).find(".bp-folder-move").removeClass("is-disabled"))},100),e=p(a).find(".location-folder-list .is_active > span"),i=p('
        '),e.parents("li").each(function(e,t){t=p(t).children("span").clone();i.prepend("",t)}),p(a).find(".breadcrumbs-append-ul-li .breadcrumb").html(i.prepend(''+BP_Nouveau.media.target_text+"")))},clearFolderLocationUI:function(e){e=jQuery(e.currentTarget).closest(".has-folderlocationUI");0").addClass("media-list item-list bp-list bb-photo-list grid")),0").addClass("media-list item-list bp-list bb-photo-list grid")),0").addClass("display")),p("#media-stream div").attr("id","media-folder-document-data-table"),p(".bb-photos-actions").show()),p(".document-data-table-head").length?"yes"===BP_Nouveau.media.is_document_directory&&"groups"===bp.Nouveau.getStorage("bp-document").scope?(p(document).find("li#document-personal a").trigger("click"),p(document).find("li#document-personal").trigger("click")):r&&bp.Nouveau.inject("#media-stream div#media-folder-document-data-table",e.data.document,"prepend"):location.reload(!0),p("#bp-media-post-content").val("");for(var t=0;t]+/g.exec(e.val()),d=Boolean(d);if(""===p.trim(e.val())||d)return e.addClass("error"),!1;if(e.removeClass("error"),!a.group_id&&""===p.trim(o.val()))return o.addClass("error"),!1;o.removeClass("error"),i.prop("disabled",!0).addClass("loading");o={action:"document_folder_save",_wpnonce:BP_Nouveau.nonces.media,title:e.val().trim(),privacy:o.val(),album_id:a.current_folder,group_id:a.current_group_id};p(".bb-single-album-header .bp-feedback").remove(),p("#boss-media-create-album-popup .bp-feedback").remove(),p.ajax({type:"POST",url:BP_Nouveau.ajaxurl,data:o,success:function(e){setTimeout(function(){i.prop("disabled",!1)},500),e.success?(a.closeFolderUploader(t),p(".document-data-table-head").length?"yes"===BP_Nouveau.media.is_document_directory&&"groups"===bp.Nouveau.getStorage("bp-document").scope?(p(document).find("li#document-personal a").trigger("click"),p(document).find("li#document-personal").trigger("click")):(bp.Nouveau.inject("#media-stream div#media-folder-document-data-table",e.data.document,"prepend"),jQuery(window).scroll()):location.reload(!0)):alert(e.data.feedback.replace("'","'"))}})},saveChildFolder:function(t){var e=p(t.currentTarget),i=this,a=p("#bp-media-create-child-folder #bb-album-child-title");t.preventDefault();var o=/[\\/?%*:|"<>]+/g.exec(a.val()),o=Boolean(o);if(""===p.trim(a.val())||o)return a.addClass("error"),!1;a.removeClass("error"),e.prop("disabled",!0).addClass("loading");a={action:"document_child_folder_save",_wpnonce:BP_Nouveau.nonces.media,title:a.val(),folder_id:i.current_folder,group_id:i.current_group_id};p(".bb-single-album-header .bp-feedback").remove(),p("#boss-media-create-album-popup .bp-feedback").remove(),p.ajax({type:"POST",url:BP_Nouveau.ajaxurl,data:a,success:function(e){e.success?(i.closeChildFolderUploader(t),location.reload(!0)):alert(e.data.feedback.replace("'","'"))}})},renameChildFolder:function(e){e.preventDefault();var t=p(e.currentTarget),i=this,a=p("#bp-media-edit-child-folder #bb-album-child-title"),o=p("#bp-media-edit-child-folder #bb-folder-privacy"),d=this.currentTargetParent,e=/[\\/?%*:|"<>]+/g.exec(a.val()),e=Boolean(e);if(""===p.trim(a.val())||e)return a.addClass("error"),!1;a.removeClass("error"),t.prop("disabled",!0).addClass("loading");d={action:"document_edit_folder",_wpnonce:BP_Nouveau.nonces.media,title:a.val(),privacy:o.val(),id:d,group_id:i.current_group_id};p(".bb-single-album-header .bp-feedback").remove(),p("#boss-media-create-album-popup .bp-feedback").remove(),p.ajax({type:"POST",url:BP_Nouveau.ajaxurl,data:d,success:function(e){setTimeout(function(){t.prop("disabled",!1)},500),e.success?window.location.reload(!0):i.current_folder?p("#bp-media-single-album").prepend(e.data.feedback):p("#boss-media-create-album-popup .bb-model-header").after(e.data.feedback)}})},deleteAlbum:function(t){if(t.preventDefault(),!this.album_id)return!1;if(!confirm(BP_Nouveau.media.i18n_strings.album_delete_confirm))return!1;p(t.currentTarget).prop("disabled",!0);var e={action:"media_album_delete",_wpnonce:BP_Nouveau.nonces.media,album_id:this.album_id,group_id:this.group_id};p.ajax({type:"POST",url:BP_Nouveau.ajaxurl,data:e,success:function(e){e.success?window.location.href=e.data.redirect_url:(alert(BP_Nouveau.media.i18n_strings.album_delete_error),p(t.currentTarget).prop("disabled",!1))}})},deleteFolder:function(t){if(t.preventDefault(),!BP_Nouveau.media.current_folder)return!1;if(!confirm(BP_Nouveau.media.i18n_strings.folder_delete_confirm))return!1;p(t.currentTarget).prop("disabled",!0);var e={action:"document_folder_delete",_wpnonce:BP_Nouveau.nonces.media,folder_id:BP_Nouveau.media.current_folder,group_id:BP_Nouveau.media.current_group_id};p.ajax({type:"POST",url:BP_Nouveau.ajaxurl,data:e,success:function(e){e.success?window.location.href=e.data.redirect_url:(alert(BP_Nouveau.media.i18n_strings.folder_delete_error),p(t.currentTarget).prop("disabled",!1))}})},addMediaIdsToGroupMessagesForm:function(){p("#bp_group_messages_media").length&&p("#bp_group_messages_media").val(JSON.stringify(this.dropzone_media))},addDocumentIdsToGroupMessagesForm:function(){p("#bp_group_messages_document").length&&p("#bp_group_messages_document").val(JSON.stringify(this.dropzone_media))},addVideoIdsToGroupMessagesForm:function(){p("#bp_group_messages_video").length&&p("#bp_group_messages_video").val(JSON.stringify(this.dropzone_media))},injectMedias:function(t){var i,a,e=bp.Nouveau.getStorage("bp-media"),o=e.scope||null,d=e.filter||null;p(t.currentTarget).hasClass("load-more")&&(i=+Number(this.current_page)+1,a=this,e="",t.preventDefault(),p(t.currentTarget).find("a").first().addClass("loading"),p("#buddypress .dir-search input[type=search]").length&&(e=p("#buddypress .dir-search input[type=search]").val()),bp.Nouveau.objectRequest({object:"media",scope:o,filter:d,search_terms:e,page:i,method:"append",target:"#buddypress [data-bp-list] ul.bp-list"}).done(function(e){!0===e.success&&(p(t.currentTarget).remove(),a.current_page=i,jQuery(window).scroll())}))},injectDocuments:function(e){var t,i,a,o=bp.Nouveau.getStorage("bp-document"),d="",s="",n=o.scope||null,r=o.filter||null,l=p(e.currentTarget);l.hasClass("load-more")&&(t=+Number(this.current_page)+1,i=this,a="",e.preventDefault(),l.find("a").first().addClass("loading"),p("#buddypress .dir-search input[type=search]").length&&(a=p("#buddypress .dir-search input[type=search]").val()),s=this.order_by&&this.sort_by?(d=this.sort_by,this.order_by):void 0!==o.extras?(d=o.extras.sort,o.extras.orderby):(d="ASC","title"),bp.Nouveau.objectRequest({object:"document",scope:n,filter:r,search_terms:a,page:t,method:"append",target:"#buddypress [data-bp-list] div#media-folder-document-data-table",order_by:s,sort:d}).done(function(e){!0===e.success&&(l.parent(".pager").remove(),i.current_page=t,jQuery(window).scroll())}))},sortDocuments:function(e){var t=p(e.currentTarget),i=t.data("target"),a="",o="date_created";t.attr("class");switch(i){case"name":o="title";break;case"modified":o="date_modified";break;case"visibility":o="privacy";break;case"group":o="group_id"}t.hasClass("asce")?t.removeClass("asce"):t.addClass("asce");var d=t.hasClass("asce")?"DESC":"ASC",i=(bp.Nouveau.getStorage("bp-document"),{});i.orderby=o,i.sort=d,"group"!==o&&bp.Nouveau.setStorage("bp-document","extras",i);t=bp.Nouveau.getStorage("bp-document"),i=t.scope||null,t=t.filter||null;p(e.currentTarget);p("#buddypress .bp-dir-search-form input[type=search]").length&&(a=p("#buddypress .bp-dir-search-form input[type=search]").val()),this.sort_by=d,this.order_by=o,this.current_page=1,bp.Nouveau.objectRequest({object:"document",scope:i,filter:t,search_terms:a,page:1,order_by:o,sort:d,method:"reset",target:"#buddypress [data-bp-list]"}).done()},documentPopupNavigate:function(e){e.preventDefault();var t=p(e.currentTarget),i=t.closest(".bb-field-steps"),e=0==t.closest(".bp-document-listing").length?"#bb-album-child-title":"#bb-album-title";t.closest(".document-options").length&&(e="#bb-album-title"),t.hasClass("bb-field-steps-next")&&""==i.find(e).val().trim()?i.find(e).addClass("error"):(i.find(e).removeClass("error"),i.slideUp(200).siblings(".bb-field-steps").slideDown(200))},uploadDocumentNavigate:function(e){e.preventDefault();var e=p(e.currentTarget),t=p(e).closest("#bp-media-uploader");p(e).hasClass("bb-field-uploader-next")?(t.find(".bb-field-steps-1").slideUp(200).siblings(".bb-field-steps").slideDown(200),t.find("#bp-media-document-submit, #bp-media-document-prev, .bp-document-open-create-popup-folder, #bb-document-privacy").show(),0!==Number(p(t).find(".bb-folder-selected-id"))&&p(t).find(".location-folder-list li.is_active").length&&p(t).find(".location-folder-list").scrollTop(p(t).find(".location-folder-list li.is_active").offset().top-p(t).find(".location-folder-list").offset().top),p(t).find(".breadcrumbs-append-ul-li .breadcrumb .item span:not(.hidden)").each(function(e){0p(t).find(".breadcrumbs-append-ul-li .breadcrumb").width()&&(p(t).find(".breadcrumbs-append-ul-li .breadcrumb .item span.hidden").append(p(t).find(".breadcrumbs-append-ul-li .breadcrumb .item span").eq(2)),p(t).find(".breadcrumbs-append-ul-li .breadcrumb .item .more_options").length||p('...').insertAfter(p(t).find(".breadcrumbs-append-ul-li .breadcrumb .item span").eq(0)))})):(p(e).hide(),t.find("#bp-media-document-prev, .bp-document-open-create-popup-folder").hide(),t.find(".bb-field-steps-2").slideUp(200).siblings(".bb-field-steps").slideDown(200),t.closest("#bp-media-single-folder").length&&p("#bb-document-privacy").hide())},uploadMediaNavigate:function(e){e.preventDefault();var t=p(e.currentTarget),e=p(t).closest(".bp-media-photo-uploader");p(t).hasClass("bb-field-uploader-next")?(e.find(".bb-field-steps-1").slideUp(200).siblings(".bb-field-steps").slideDown(200),e.find("#bp-media-submit, #bp-media-prev, .bp-media-open-create-popup-folder.create-album").show(),e.find("#bb-media-privacy").show(),0!==Number(p(e).find(".bb-album-selected-id"))&&p(e).find(".location-album-list li.is_active").length&&p(e).find(".location-album-list").scrollTop(p(e).find(".location-album-list li.is_active").offset().top-p(e).find(".location-album-list").offset().top)):(p(t).hide(),e.find("#bp-media-prev, .bp-media-open-create-popup-folder").hide(),e.find(".bb-field-steps-2").slideUp(200).siblings(".bb-field-steps").slideDown(200),e.closest("#bp-media-single-album").length&&p("#bb-media-privacy").hide())},appendMedia:function(t){var i,a,e=bp.Nouveau.getStorage("bp-media"),o=e.scope||null,d=e.filter||null;p(t.currentTarget).hasClass("load-more")&&(i=+Number(this.current_page_existing_media)+1,a=this,e="",t.preventDefault(),p(t.currentTarget).find("a").first().addClass("loading"),p("#buddypress .dir-search input[type=search]").length&&(e=p("#buddypress .dir-search input[type=search]").val()),bp.Nouveau.objectRequest({object:"media",scope:o,filter:d,search_terms:e,page:i,method:"append",caller:"bp-existing-media",target:".bp-existing-media-wrap ul.bp-list"}).done(function(e){!0===e.success&&(p(t.currentTarget).remove(),a.current_page_existing_media=i,jQuery(window).scroll())}))},appendAlbums:function(t){var i=+Number(this.current_page_albums)+1,a=this;t.preventDefault(),p(t.currentTarget).find("a").first().addClass("loading");var e={action:"media_albums_loader",_wpnonce:BP_Nouveau.nonces.media,page:i};p.ajax({type:"POST",url:BP_Nouveau.ajaxurl,data:e,success:function(e){!0===e.success&&(p(t.currentTarget).remove(),p("#albums-dir-list ul.bb-albums-list").fadeOut(100,function(){p("#albums-dir-list ul.bb-albums-list").append(e.data.albums),p(this).fadeIn(100)}),a.current_page_albums=i)}})},toggleSubmitMediaButton:function(){var e=p("#bp-media-submit"),t=p("#bp-media-add-more");"bp-dropzone-content"===this.current_tab?this.dropzone_obj.getAcceptedFiles().length?(e.show(),t.show()):(e.hide(),t.hide()):"bp-existing-media-content"===this.current_tab&&(p('.bp-existing-media-wrap .bb-media-check-wrap [name="bb-media-select"]:checked').length?e.show():e.hide(),t.hide())},playVideo:function(e){e.preventDefault();var t=p(e.currentTarget).find("video").get(0),e=p(e.currentTarget).find(".gif-play-button");1==t.paused?(t.play(),e.hide()):(t.pause(),e.show())},autoPlayGifVideos:function(){p(".gif-player").each(function(){var e=p(this).find("video").get(0),t=p(this).find(".gif-play-button");p(this).is(":in-viewport")?(e.play(),t.hide()):(e.pause(),t.show())})},fileActionButton:function(e){p(e.currentTarget).parent().hasClass("download_file")||p(e.currentTarget).parent().hasClass("copy_download_file_url")||p(e.currentTarget).parent().hasClass("redirect-activity-privacy-change")||(e.preventDefault(),p(e.currentTarget).closest(".media-folder_items").toggleClass("is-visible").siblings(".media-folder_items").removeClass("is-visible"))},copyDownloadLink:function(e){e.preventDefault();var t=e.currentTarget,e="document_copy_link";p("body").append('');var i=p(t).text();return p(t).text(BP_Nouveau.media.copy_to_clip_board_text),p("#"+e).val(p(t).attr("href")),p("#"+e).select(),document.execCommand("copy"),setTimeout(function(){p(t).text(i)},2e3),!1},fileActivityActionButton:function(e){e.preventDefault(),p(e.currentTarget).parent().hasClass("copy_download_file_url")||(p(e.currentTarget).closest(".bb-activity-media-elem").toggleClass("is-visible").siblings().removeClass("is-visible").closest(".activity-item").siblings().find(".bb-activity-media-elem").removeClass("is-visible"),p(e.currentTarget).closest(".bb-activity-media-elem").length<1&&p(e.currentTarget).closest(".bb-photo-thumb").toggleClass("is-visible").parent().siblings().find(".bb-photo-thumb").removeClass("is-visible").removeClass("is-visible"),"a"!=e.currentTarget.tagName.toLowerCase()||p(e.currentTarget).hasClass("document-action_more")||p(e.currentTarget).hasClass("media-action_more")||(p(e.currentTarget).closest(".bb-activity-media-elem").removeClass("is-visible"),p(e.currentTarget).closest(".bb-photo-thumb").removeClass("is-visible")))},toggleFileActivityActionButton:function(e){var t;return(e=e||window.event).target?t=e.target:e.srcElement&&(t=e.srcElement),3===t.nodeType&&(t=t.parentNode),!0===e.altKey||!0===e.metaKey||p(t).hasClass("document-action_more")||p(t).parent().hasClass("document-action_more")||p(t).hasClass("media-folder_action__anchor")||p(t).parent().hasClass("media-folder_action__anchor")||p(t).hasClass("media-action_more")||p(t).parent().hasClass("media-action_more")||p(t).hasClass("video-action_more")||p(t).parent().hasClass("video-action_more")?e:(p(".bb-activity-media-elem.is-visible").removeClass("is-visible"),p(".media-folder_items.is-visible").removeClass("is-visible"),p(".bb-photo-thumb.is-visible").removeClass("is-visible"),p(".bb-item-thumb.is-visible").removeClass("is-visible"),p(".bb-activity-video-elem.is-visible").removeClass("is-visible"),void p(".video-action-wrap.item-action-wrap.is-visible").removeClass("is-visible"))},toggleCodePreview:function(e){e.preventDefault(),p(e.currentTarget).closest(".document-activity").toggleClass("code-full-view")},documentCodeMirror:function(){p(".document-text:not(.loaded)").each(function(){var e=p(this),t=e.attr("data-extension"),i=e.attr("data-extension");"html"!=t&&"htm"!=t||(i="text/html"),"js"==t?CodeMirror(e[0],{value:e.find(".document-text-file-data-hidden").val(),lineNumbers:!0,theme:"default",readOnly:!0,lineWrapping:!0}):CodeMirror(e[0],{value:e.find(".document-text-file-data-hidden").val(),mode:i,lineNumbers:!0,theme:"default",readOnly:!0,lineWrapping:!0}),e.addClass("loaded"),150'+e+""))}},bp.Nouveau.Media.Theatre={start:function(){this.setupGlobals(),this.addListeners()},setupGlobals:function(){this.medias=[],this.documents=[],this.current_media=!1,this.current_document=!1,this.current_index=0,this.current_document_index=0,this.is_open_media=!1,this.is_open_document=!1,this.nextLink=p(".bb-next-media"),this.nextDocumentLink=p(".bb-next-document"),this.previousDocumentLink=p(".bb-prev-document"),this.previousLink=p(".bb-prev-media"),this.activity_ajax=!1,this.group_id=void 0!==BP_Nouveau.media.group_id&&BP_Nouveau.media.group_id,this.manage_media=void 0!==BP_Nouveau.media.can_manage_media&&BP_Nouveau.media.can_manage_media,this.manage_document=void 0!==BP_Nouveau.media.can_manage_document&&BP_Nouveau.media.can_manage_document},addListeners:function(){p(document).on("click",".bb-open-media-theatre",this.openTheatre.bind(this)),p(document).on("click",".bb-open-document-theatre",this.openDocumentTheatre.bind(this)),p(document).on("click",".document-detail-wrap-description-popup",this.openDocumentTheatre.bind(this)),p(document).on("click",".bb-close-media-theatre",this.closeTheatre.bind(this)),p(document).on("click",".bb-close-document-theatre",this.closeDocumentTheatre.bind(this)),p(document).on("click",".bb-prev-media",this.previous.bind(this)),p(document).on("click",".bb-next-media",this.next.bind(this)),p(document).on("click",".bb-prev-document",this.previousDocument.bind(this)),p(document).on("click",".bb-next-document",this.nextDocument.bind(this)),p(document).on("bp_activity_ajax_delete_request",this.activityDeleted.bind(this)),p(document).on("click","#bb-media-model-container .media-privacy>li",this.mediaPrivacyChange.bind(this)),p(document).on("click","#bb-media-model-container .document-privacy>li",this.documentPrivacyChange.bind(this)),p(document).on("click","#bb-media-model-container .bb-media-section span.privacy",bp.Nouveau,this.togglePrivacyDropdown.bind(this)),p(document).on("click","#bb-media-model-container .bb-document-section span.privacy",bp.Nouveau,this.toggleDocumentPrivacyDropdown.bind(this)),p(document).on("click",".bp-add-media-activity-description",this.openMediaActivityDescription.bind(this)),p(document).on("click","#bp-activity-description-new-reset",this.closeMediaActivityDescription.bind(this)),p(document).on("keyup",".bp-edit-media-activity-description #add-activity-description",this.MediaActivityDescriptionUpdate.bind(this)),p(document).on("click","#bp-activity-description-new-submit",this.submitMediaActivityDescription.bind(this)),p(document).click(this.togglePopupDropdown),document.addEventListener("keyup",this.checkPressedKeyDocuments.bind(this)),document.addEventListener("keyup",this.checkPressedKey.bind(this))},checkPressedKey:function(e){var t=this;if(e=e||window.event,!t.is_open_media)return!1;var i=p(e.target).hasClass("ac-input")||"add-activity-description"===p(e.target).attr("id");switch(e.keyCode){case 27:t.closeTheatre(e);break;case 37:if(void 0===t.medias[t.current_index-1]||i)return!1;t.previous(e);break;case 39:if(void 0===t.medias[t.current_index+1]||i)return!1;t.next(e)}},checkPressedKeyDocuments:function(e){e=e||window.event;var t=this;if(!t.is_open_document)return!1;var i=p(e.target).hasClass("ac-input")||"add-activity-description"===p(e.target).attr("id");switch(e.keyCode){case 27:t.closeDocumentTheatre(e);break;case 37:if(void 0===t.documents[t.current_document_index-1]||i)return!1;t.previousDocument(e);break;case 39:if(void 0===t.documents[t.current_document_index+1]||i)return!1;t.nextDocument(e)}},openTheatre:function(e){e.preventDefault();var t=p(e.currentTarget),i=this;if(t.closest("#bp-existing-media-content").length)return!1;i.setupGlobals(),i.setMedias(t),e=t.data("id"),t.data("activity-id"),i.setCurrentMedia(e),i.showMedia(),i.navigationCommands(),i.getParentActivityHtml(t),i.getMediasDescription(),p(".bb-media-model-wrapper.document").hide();t=document.getElementById(p(".bb-media-model-wrapper.video video").attr("id"));t&&t.pause(),p(".bb-media-model-wrapper.video").hide(),p(".bb-media-model-wrapper.media").show(),i.is_open_media=!0},getParentActivityHtml:function(e){var t=p("#hidden_parent_id").val(),e=e.closest(".bb-media-model-wrapper").find("#bb-media-model-container .activity-list li.activity-item").data("bp-activity-id");parseInt(t)===parseInt(e)&&(e=p('#bb-media-model-container [data-bp-activity-id="'+t+'"]'),p('[data-bp-activity-id="'+t+'"] > .activity-state').html(p(e).find(".activity-state").html()),p('[data-bp-activity-id="'+t+'"] > .activity-meta').html(p(e).find(".activity-meta").html()),p('[data-bp-activity-id="'+t+'"] > .activity-comments').html(p(e).find(".activity-comments").html())),p("#hidden_parent_id").length&&p("#hidden_parent_id").remove()},getMediasDescription:function(){var e=this;p(".bb-media-info-section .activity-list").addClass("loading").html(''),0!=e.activity_ajax&&e.activity_ajax.abort();var t=p('[data-bp-activity-id="'+e.current_media.activity_id+'"] .activity-comments');t.length&&(t=t.find("#ac-form-"+e.current_media.activity_id),e.current_media.parent_activity_comments=!0,t.remove()),!0===e.current_media.parent_activity_comments&&p(".bb-media-model-wrapper:last").after(''),e.activity_ajax=p.ajax({type:"POST",url:BP_Nouveau.ajaxurl,data:{action:"media_get_media_description",id:e.current_media.id,attachment_id:e.current_media.attachment_id,nonce:BP_Nouveau.nonces.media},success:function(e){e.success?(p(".bb-media-info-section:visible .activity-list").removeClass("loading").html(e.data.description),p(".bb-media-info-section:visible").show(),p(window).scroll(),setTimeout(function(){bp.Nouveau.reportPopUp(),bp.Nouveau.reportedPopup()},10)):p(".bb-media-info-section.media").hide()}})},openDocumentTheatre:function(e){e.preventDefault();var t,i=p(e.currentTarget),a=this;if(i.closest("#bp-existing-document-content").length)return!1;i.closest(".document.document-theatre").length&&a.closeDocumentTheatre(e),t=i.data("id"),a.setupGlobals(),a.setDocuments(i),a.setCurrentDocument(t),a.showDocument(),a.navigationDocumentCommands(),a.getParentActivityHtml(i),a.getDocumentsDescription(),-1!==p.inArray(a.current_document.extension,BP_Nouveau.document.mp3_preview_extension.split(","))&&p(e.currentTarget).closest(".bb-activity-media-elem.document-activity").length&&p(e.currentTarget).closest(".bb-activity-media-elem.document-activity").find(".document-audio-wrap").length&&p(e.currentTarget).closest(".bb-activity-media-elem.document-activity").find(".document-audio-wrap audio")[0].pause(),p(".bb-media-model-wrapper.media").hide(),p(".bb-media-model-wrapper.document").show();e=document.getElementById(p(".bb-media-model-wrapper.video video").attr("id"));e&&(e.pause(),e.src=""),p(".bb-media-model-wrapper.video").hide(),a.is_open_document=!0},resetRemoveActivityCommentsData:function(){var e,t=this,i=!1,a=!1,o=!1,d=!1,s=!1,n=!1;t.current_media.parent_activity_comments&&((i=(d=p('.bb-media-model-wrapper.media [data-bp-activity-id="'+t.current_media.activity_id+'"]')).find(".activity-comments")).length&&(e=i.find("#ac-form-"+t.current_media.activity_id),this.purgeEditActivityForm(e),e.find("#ac-input-"+t.current_media.activity_id).html(""),e.removeClass("has-content has-gif has-media").addClass("root"),i.append(e),e.find(".post-elements-buttons-item.post-emoji").removeClass("active").empty(""),this.resetActivityMedia(t.current_media.activity_id),i.find(".acomment-display").removeClass("display-focus"),i.find(".comment-item").removeClass("comment-item-focus"),s=i.html(),n=i.attr("class"),i.remove(),(i=p('[data-bp-activity-id="'+t.current_media.activity_id+'"] .activity-comments')).length&&(i.attr("class",n),0===i.find("#ac-form-"+t.current_media.activity_id).length&&(i.append(e),i.children("form").removeClass("events-initiated").addClass("not-initialized")))),(o=d.find(".activity-state")).length&&(s=o.html(),n=o.attr("class"),o.remove(),(o=p('[data-bp-activity-id="'+t.current_media.activity_id+'"] .activity-state')).length&&(o.html(s),o.attr("class",n))),(a=d.find(".activity-meta")).length&&(s=a.html(),n=a.attr("class"),a.remove(),(a=p('[data-bp-activity-id="'+t.current_media.activity_id+'"] > .activity-meta')).length&&(a.html(s),a.attr("class",n))),d.remove()),t.current_document.parent_activity_comments&&((i=(d=p('.bb-media-model-wrapper.document [data-bp-activity-id="'+t.current_document.activity_id+'"]')).find(".activity-comments")).length&&(e=i.find("#ac-form-"+t.current_document.activity_id),this.purgeEditActivityForm(e),e.find("#ac-input-"+t.current_document.activity_id).html(""),e.removeClass("has-content has-gif has-media").addClass("root"),i.append(e),e.find(".post-elements-buttons-item.post-emoji").removeClass("active").empty(""),this.resetActivityMedia(t.current_document.activity_id),i.find(".acomment-display").removeClass("display-focus"),i.find(".comment-item").removeClass("comment-item-focus"),s=i.html(),n=i.attr("class"),i.remove(),(i=p('[data-bp-activity-id="'+t.current_document.activity_id+'"] .activity-comments')).length&&(i.attr("class",n),0===i.find("#ac-form-"+t.current_document.activity_id).length&&(i.append(e),i.children("form").removeClass("events-initiated").addClass("not-initialized")),i.find(".document-text.loaded").removeClass("loaded").find(".CodeMirror").remove(),jQuery(window).scroll())),(o=d.find(".activity-state")).length&&(s=o.html(),n=o.attr("class"),o.remove(),(o=p('[data-bp-activity-id="'+t.current_document.activity_id+'"] .activity-state')).length&&(o.html(s),o.attr("class",n))),(a=d.find(".activity-meta")).length&&(s=a.html(),n=a.attr("class"),a.remove(),(a=p('[data-bp-activity-id="'+t.current_document.activity_id+'"] > .activity-meta')).length&&(a.html(s),a.attr("class",n))),d.remove()),bp.Nouveau.reportPopUp(),bp.Nouveau.reportActions()},closeTheatre:function(e){e.preventDefault();e=p(e.currentTarget);if(p(e).closest(".bb-media-model-wrapper").hasClass("video-theatre"))return!1;p(".bb-media-model-wrapper.media .bb-media-section").find("img").attr("src",""),p(".bb-media-model-wrapper.video .bb-media-section").find("video").length&&videojs(p(".bb-media-model-wrapper.video .bb-media-section").find("video").attr("id")).reset(),p(".bb-media-model-wrapper").hide(),this.is_open_media=!1,this.resetRemoveActivityCommentsData(),this.current_media=!1,this.getParentActivityHtml(e)},closeDocumentTheatre:function(e){e.preventDefault();var t=p(document).find(".document-theatre");t.find(".bb-media-section").removeClass("bb-media-no-preview").find(".document-preview").html(""),p(".bb-media-info-section.document").show(),t.hide(),this.is_open_document=!1,this.resetRemoveActivityCommentsData(),this.current_document=!1,this.getParentActivityHtml(p(e.currentTarget))},setMedias:function(e){var t=p(".bb-open-media-theatre"),i=0;if(void 0!==(t=p("body").hasClass("activity")?p(e).closest(".bb-activity-media-wrap").find(".bb-open-media-theatre"):t))for(this.medias=[],i=0;i'),a.find(".bb-document-section").removeClass("bb-media-no-preview"),a.find(".bb-document-section .document-preview").html(""),a.find(".bb-document-section .document-preview").html("

        "+t+'

        '),a.find(".bb-document-section .document-preview .document-text").attr("data-extension",o),a.find(".bb-document-section .document-preview .document-text textarea").html(d),setTimeout(function(){bp.Nouveau.Media.documentCodeMirror()},1e3)):-1!==p.inArray(e.current_document.extension,BP_Nouveau.document.mp3_preview_extension.split(","))?(a.find(".bb-document-section .document-preview").html(''),a.find(".bb-document-section").removeClass("bb-media-no-preview"),a.find(".bb-document-section .document-preview").html(""),a.find(".bb-document-section .document-preview").html('

        '+t+'

        ')):-1!==p.inArray("."+e.current_document.extension,BP_Nouveau.video.video_type.split(","))?(a.find(".bb-document-section").addClass("bb-video-preview"),a.find(".bb-document-section .document-preview").html(''),a.find(".bb-document-section").removeClass("bb-media-no-preview"),a.find(".bb-document-section .document-preview").html(""),"mov"===e.current_document.extension||"m4v"===e.current_document.extension?a.find(".bb-document-section .document-preview").html(''):a.find(".bb-document-section .document-preview").html(''),p(window).scroll()):e.current_document.full_preview?(a.find(".bb-document-section").removeClass("bb-media-no-preview"),a.find(".bb-document-section .document-preview").html(""),a.find(".bb-document-section .document-preview").html("

        "+t+'

        ')):(a.find(".bb-document-section").addClass("bb-media-no-preview"),a.find(".bb-document-section .document-preview").html(""),a.find(".bb-document-section .document-preview").html('

        '+t+"

        "));i=p(".bb-document-section .bb-document-privacy-wrap");i.length&&(i.show(),i.parent().show(),i.find("ul.document-privacy li").removeClass("selected"),i.find(".bp-tooltip").attr("data-bp-tooltip",""),(t=i.find("ul.document-privacy").find("li[data-value="+e.current_document.privacy+"]")).addClass("selected"),i.find(".bp-tooltip").attr("data-bp-tooltip",t.text()),i.find(".privacy").removeClass("public").removeClass("loggedin").removeClass("onlyme").removeClass("friends").addClass(e.current_document.privacy),(void 0!==BP_Nouveau.activity&&void 0!==e.current_document.activity_id&&0!=e.current_document.activity_id||e.group_id||e.current_document.is_forum||e.current_document.group_id||e.current_document.album_id||!e.can_manage_document||!e.current_document.can_edit||e.current_document.is_message)&&i.parent().hide()),e.navigationDocumentCommands()},next:function(e){e.preventDefault();e=this;e.resetRemoveActivityCommentsData(),void 0!==e.medias[e.current_index+1]?(e.current_index=e.current_index+1,e.current_media.activity_id,e.current_media=e.medias[e.current_index],e.showMedia(),e.getMediasDescription()):e.nextLink.hide()},previous:function(e){e.preventDefault();e=this;e.resetRemoveActivityCommentsData(),void 0!==e.medias[e.current_index-1]?(e.current_index=e.current_index-1,e.current_media.activity_id,e.current_media=e.medias[e.current_index],e.showMedia(),e.getMediasDescription()):e.previousLink.hide()},nextDocument:function(e){e.preventDefault();e=this;e.resetRemoveActivityCommentsData(),void 0!==e.documents[e.current_document_index+1]?(e.current_document_index=e.current_document_index+1,e.current_document.activity_id,e.current_document=e.documents[e.current_document_index],e.showDocument(),e.getDocumentsDescription()):e.nextDocumentLink.hide()},previousDocument:function(e){e.preventDefault();e=this;e.resetRemoveActivityCommentsData(),void 0!==e.documents[e.current_document_index-1]?(e.current_document_index=e.current_document_index-1,e.current_document.activity_id,e.current_document=e.documents[e.current_document_index],e.showDocument(),e.getDocumentsDescription()):e.previousDocumentLink.hide()},navigationCommands:function(){var e=this;0==e.current_index&&e.current_index!=e.medias.length-1?(e.previousLink.hide(),e.nextLink.show()):0==e.current_index&&e.current_index==e.medias.length-1?(e.previousLink.hide(),e.nextLink.hide()):e.current_index==e.medias.length-1?(e.previousLink.show(),e.nextLink.hide()):(e.previousLink.show(),e.nextLink.show())},navigationDocumentCommands:function(){var e=this;0==e.current_document_index&&e.current_document_index!=e.documents.length-1?(e.previousDocumentLink.hide(),e.nextDocumentLink.show()):0==e.current_document_index&&e.current_document_index==e.documents.length-1?(e.previousDocumentLink.hide(),e.nextDocumentLink.hide()):e.current_document_index==e.documents.length-1?(e.previousDocumentLink.show(),e.nextDocumentLink.hide()):(e.previousDocumentLink.show(),e.nextDocumentLink.show())},getActivity:function(){var e=this;p(".bb-media-info-section .activity-list").addClass("loading").html(''),void 0!==BP_Nouveau.activity&&e.current_media&&void 0!==e.current_media.activity_id&&0!=e.current_media.activity_id&&!e.current_media.is_forum?(0!=e.activity_ajax&&e.activity_ajax.abort(),p('[data-bp-activity-id="'+e.current_media.activity_id+'"] .activity-comments').length&&(e.current_media.parent_activity_comments=!0),!0===e.current_media.parent_activity_comments&&p(".bb-media-model-wrapper:last").after(''),e.activity_ajax=p.ajax({type:"POST",url:BP_Nouveau.ajaxurl,data:{action:"media_get_activity",id:e.current_media.activity_id,group_id:_.isUndefined(e.current_media.group_id)?0:e.current_media.group_id,nonce:BP_Nouveau.nonces.media},success:function(e){e.success&&(p(".bb-media-info-section:visible .activity-list").removeClass("loading").html(e.data.activity),p(".bb-media-info-section:visible").show(),jQuery(window).scroll(),setTimeout(function(){bp.Nouveau.reportPopUp(),bp.Nouveau.reportedPopup()},10))}})):p(".bb-media-info-section.media").hide()},getDocumentsActivity:function(){var e=this;p(".bb-media-info-section .activity-list").addClass("loading").html(''),void 0!==BP_Nouveau.activity&&e.current_document&&void 0!==e.current_document.activity_id&&0!=e.current_document.activity_id&&!e.current_document.is_forum?(0!=e.activity_ajax&&e.activity_ajax.abort(),p('[data-bp-activity-id="'+e.current_document.activity_id+'"] .activity-comments').length&&(e.current_document.parent_activity_comments=!0),!0===e.current_document.parent_activity_comments&&p(".bb-media-model-wrapper:last").after(''),e.activity_ajax=p.ajax({type:"POST",url:BP_Nouveau.ajaxurl,data:{action:"document_get_activity",id:e.current_document.activity_id,group_id:_.isUndefined(e.current_document.group_id)?0:e.current_document.group_id,nonce:BP_Nouveau.nonces.media},success:function(e){e.success&&(p(".bb-media-info-section:visible .activity-list").removeClass("loading").html(e.data.activity),p(".bb-media-info-section:visible").show(),jQuery(window).scroll(),setTimeout(function(){bp.Nouveau.reportPopUp(),bp.Nouveau.reportedPopup()},10))}})):p(".bb-media-info-section.document").hide()},getDocumentsDescription:function(){var e=this;p(".bb-media-info-section .activity-list").addClass("loading").html(''),0!=e.activity_ajax&&e.activity_ajax.abort();var t=p('[data-bp-activity-id="'+e.current_document.activity_id+'"] .activity-comments');t.length&&(t=t.find("#ac-form-"+e.current_document.activity_id),e.current_document.parent_activity_comments=!0,t.remove()),!0===e.current_document.parent_activity_comments&&p(".bb-media-model-wrapper:last").after(''),e.activity_ajax=p.ajax({type:"POST",url:BP_Nouveau.ajaxurl,data:{action:"document_get_document_description",id:e.current_document.id,attachment_id:e.current_document.attachment_id,nonce:BP_Nouveau.nonces.media},success:function(e){e.success?(p(".bb-media-info-section:visible .activity-list").removeClass("loading").html(e.data.description),p(".bb-media-info-section:visible").show(),p(window).scroll(),setTimeout(function(){bp.Nouveau.reportPopUp(),bp.Nouveau.reportedPopup()},10)):p(".bb-media-info-section.document").hide()}})},activityDeleted:function(e,t){var i=this,a=0;if(i.is_open_media&&void 0!==t&&"delete_activity"===t.action&&i.current_media.activity_id==t.id){var o=p(document).find('[data-bp-list="media"] .bb-open-media-theatre[data-id="'+i.current_media.id+'"]'),d=o.parents("ul");for(o.closest("li").remove(),0===d.find("li:not(.load-more)").length&&(0 Date: Sat, 11 May 2024 17:23:34 +0530 Subject: [PATCH 2/4] PROD-7208 - Fixed phpcbf --- src/bp-templates/bp-nouveau/js/buddypress-media.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bp-templates/bp-nouveau/js/buddypress-media.js b/src/bp-templates/bp-nouveau/js/buddypress-media.js index 533cad6860..bedb36a116 100644 --- a/src/bp-templates/bp-nouveau/js/buddypress-media.js +++ b/src/bp-templates/bp-nouveau/js/buddypress-media.js @@ -2112,7 +2112,7 @@ window.bp = window.bp || {}; if ( !_.isUndefined( BP_Nouveau.media ) && !_.isUndefined( BP_Nouveau.media.gif_api_key ) && !$targetEl.closest( '.post-gif' ).length ) { - if( $targetEl.closest( '.gif-media-search-dropdown' ).length ) { + if ( $targetEl.closest( '.gif-media-search-dropdown' ).length ) { return; } target.find( 'form' ).find( '.gif-media-search-dropdown' ).removeClass( 'open' ); From 5beb35e51fadaceb3183ac2ab531078dfdfd913e Mon Sep 17 00:00:00 2001 From: Amin Charoliya Date: Wed, 22 May 2024 16:52:31 +0530 Subject: [PATCH 3/4] [PROD-7208] Prevent emoji picker from closing when searching for emoji in activity modal --- src/bp-templates/bp-nouveau/js/buddypress-activity.js | 3 ++- src/bp-templates/bp-nouveau/js/buddypress-activity.min.js | 2 +- src/bp-templates/bp-nouveau/js/buddypress-nouveau.js | 3 ++- src/bp-templates/bp-nouveau/js/buddypress-nouveau.min.js | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/bp-templates/bp-nouveau/js/buddypress-activity.js b/src/bp-templates/bp-nouveau/js/buddypress-activity.js index ada36519f6..5f9595958b 100644 --- a/src/bp-templates/bp-nouveau/js/buddypress-activity.js +++ b/src/bp-templates/bp-nouveau/js/buddypress-activity.js @@ -142,7 +142,8 @@ window.bp = window.bp || {}; $( '#activity-modal:visible' ).length > 0 && 0 === $( '#bp-nouveau-activity-form-placeholder:visible' ).length && ! $( event.target ).closest( '#activity-modal' ).length && - ! $( event.target ).closest( '.gif-media-search-dropdown-standalone' ).length + ! $( event.target ).closest( '.gif-media-search-dropdown-standalone' ).length && + ! $( event.target ).closest( '.emojionearea-theatre' ).length ) { this.closeActivity( event ); this.activitySyncOnModalClose( event, activityId ); diff --git a/src/bp-templates/bp-nouveau/js/buddypress-activity.min.js b/src/bp-templates/bp-nouveau/js/buddypress-activity.min.js index b61713a294..4398efc528 100644 --- a/src/bp-templates/bp-nouveau/js/buddypress-activity.min.js +++ b/src/bp-templates/bp-nouveau/js/buddypress-activity.min.js @@ -1 +1 @@ -window.bp=window.bp||{},function(q){"undefined"!=typeof BP_Nouveau&&(bp.Nouveau=bp.Nouveau||{},bp.Models=bp.Models||{},bp.Models.ACReply=Backbone.Model.extend({defaults:{gif_data:{}}}),bp.Nouveau.Activity={start:function(){this.setupGlobals(),this.addListeners()},setupGlobals:function(){this.just_posted=[],this.current_page=1,this.mentions_count=Number(q(bp.Nouveau.objectNavParent+' [data-bp-scope="mentions"]').find("a span").html())||0,this.heartbeat_data={newest:"",highlights:{},last_recorded:0,first_recorded:0,document_title:q(document).prop("title")},void 0!==window.Dropzone&&void 0!==BP_Nouveau.media&&(window.Dropzone.autoDiscover=!1,this.dropzone_options={url:BP_Nouveau.ajaxurl,timeout:108e5,dictFileTooBig:BP_Nouveau.media.dictFileTooBig,dictDefaultMessage:BP_Nouveau.media.dropzone_media_message,acceptedFiles:"image/*",autoProcessQueue:!0,addRemoveLinks:!0,uploadMultiple:!1,maxFiles:void 0!==BP_Nouveau.media.maxFiles?BP_Nouveau.media.maxFiles:10,maxFilesize:void 0!==BP_Nouveau.media.max_upload_size?BP_Nouveau.media.max_upload_size:2,dictMaxFilesExceeded:BP_Nouveau.media.media_dict_file_exceeded,dictCancelUploadConfirmation:BP_Nouveau.media.dictCancelUploadConfirmation,maxThumbnailFilesize:void 0!==BP_Nouveau.media.max_upload_size?BP_Nouveau.media.max_upload_size:2},void 0!==BP_Nouveau.media.dropzone_options&&Object.assign(this.dropzone_options,BP_Nouveau.media.dropzone_options)),this.dropzone_obj=null,this.dropzone_media=[],this.dropzone_document_obj=null,this.dropzone_document=[],this.dropzone_video_obj=null,this.dropzone_video=[],this.models=[],this.InitiatedCommentForms=[],this.activityHasUpdates=!1,this.currentActivityId=null,this.activityPinHasUpdates=!1},addListeners:function(){q("body").hasClass("activity-singular")||q("#buddypress").on("bp_heartbeat_send",this.heartbeatSend.bind(this)),q("#buddypress").on("bp_heartbeat_tick",this.heartbeatTick.bind(this)),q('#buddypress [data-bp-list="activity"]').on("click","li.load-newest, li.load-more",this.injectActivities.bind(this)),q("#buddypress").on("bp_ajax_request",'[data-bp-list="activity"]',this.scopeLoaded.bind(this)),q("#activity-stream").on("click",".acomments-view-more",this.showActivity),q("body").on("click",".bb-close-action-popup",this.closeActivity),q(document).on("activityModalOpened",function(e,t){var a=t.activityId;q(document).on("click",function(e){0li.bb-edit-privacy a",bp.Nouveau,this.activityPrivacyRedirect.bind(this)),q('#buddypress [data-bp-list="activity"], #activity-modal').on("click",".activity-privacy>li:not(.bb-edit-privacy)",bp.Nouveau,this.activityPrivacyChange.bind(this)),q('#buddypress [data-bp-list="activity"], #bb-media-model-container .activity-list, #activity-modal').on("click","span.privacy",bp.Nouveau,this.togglePrivacyDropdown.bind(this)),q("#bb-media-model-container .activity-list").on("click",".activity-item",bp.Nouveau,this.activityActions.bind(this)),q(".bb-activity-model-wrapper").on("click",".ac-form-placeholder",bp.Nouveau,this.activityRootComment.bind(this)),q(document).keydown(this.commentFormAction),q(document).click(this.togglePopupDropdown),q('#buddypress [data-bp-list="activity"], #bb-media-model-container .activity-list, #activity-modal .activity-list, .bb-modal-activity-footer').on("click",".ac-reply-media-button",this.openCommentsMediaUploader.bind(this)),q('#buddypress [data-bp-list="activity"], #bb-media-model-container .activity-list, #activity-modal .activity-list, .bb-modal-activity-footer').on("click",".ac-reply-document-button",this.openCommentsDocumentUploader.bind(this)),q('#buddypress [data-bp-list="activity"], #bb-media-model-container .activity-list, #activity-modal .activity-list, .bb-modal-activity-footer').on("click",".ac-reply-video-button",this.openCommentsVideoUploader.bind(this)),q('#buddypress [data-bp-list="activity"], #bb-media-model-container .activity-list, #activity-modal .activity-list, .bb-modal-activity-footer').on("click",".ac-reply-gif-button",this.openGifPicker.bind(this)),q(document).on("click",this.toggleActivityOption.bind(this)),q(document).on("click",".activity-state-popup_overlay",bp.Nouveau,this.closeActivityState.bind(this)),q(document).on("click",".activity-state-popup .activity-state-popup_tab_panel a",this.ReactionStatePopupTab),_.isUndefined(BP_Nouveau.activity.params.autoload)||q(window).scroll(this.loadMoreActivities),q(".bb-activity-model-wrapper, .bb-media-model-wrapper").on("click",".acomments-view-more",this.viewMoreComments.bind(this)),q(document).on("click","#activity-stream .activity-comments .view-more-comments, #activity-stream .activity-state-comments > .comments-count",function(e){e.preventDefault(),q(this).parents("li.activity-item").find(".activity-comments > ul > li.acomments-view-more, .activity-comments > .activity-actions > ul > li.acomments-view-more").trigger("click")}),q("#activity-modal > .bb-modal-activity-body").on("scroll",this.autoloadMoreComments.bind(this)),q("#activity-modal > .bb-modal-activity-body").on("scroll",this.discardGifEmojiPicker.bind(this)),q(".bb-activity-model-wrapper .bb-model-close-button").on("click",this.activitySyncOnModalClose.bind(this)),void 0!==BP_Nouveau.is_send_ajax_request&&"1"===BP_Nouveau.is_send_ajax_request?q("#buddypress").on("bp_ajax_request",'[data-bp-list="activity"]',function(){setTimeout(function(){q(".ac-form.not-initialized").each(function(){var e=q(this),t=e.find(".ac-textarea");bp.Nouveau.Activity.toggleMultiMediaOptions(e,t)})},1e3)}):setTimeout(function(){q(".ac-form.not-initialized").each(function(){var e=q(this),t=e.find(".ac-textarea");bp.Nouveau.Activity.toggleMultiMediaOptions(e,t)})},1e3)},heartbeatSend:function(e,t){this.heartbeat_data.first_recorded=q("#buddypress [data-bp-list] [data-bp-activity-id]:not(.bb-pinned)").first().data("bp-timestamp")||0;var a=q("#buddypress [data-bp-list] [data-bp-activity-id]").first().data("bp-timestamp")||0;a>this.heartbeat_data.first_recorded&&(this.heartbeat_data.first_recorded=a),(0===this.heartbeat_data.last_recorded||this.heartbeat_data.first_recorded>this.heartbeat_data.last_recorded)&&(this.heartbeat_data.last_recorded=this.heartbeat_data.first_recorded),t.bp_activity_last_recorded=this.heartbeat_data.last_recorded,q("#buddypress .dir-search input[type=search]").length&&(t.bp_activity_last_recorded_search_terms=q("#buddypress .dir-search input[type=search]").val()),q.extend(t,{bp_heartbeat:bp.Nouveau.getStorage("bp-activity")})},heartbeatTick:function(e,t){var a,i,o=bp.Nouveau.objects,d=bp.Nouveau.getStorage("bp-activity","scope"),s=this;void 0!==t&&t.bp_activity_newest_activities&&(this.heartbeat_data.newest=q.trim(t.bp_activity_newest_activities.activities)+this.heartbeat_data.newest,this.heartbeat_data.last_recorded=Number(t.bp_activity_newest_activities.last_recorded),i=q(this.heartbeat_data.newest).filter(".activity-item"),a=Number(i.length),o.push("mentions"),"all"===d?(q.each(i,function(e,a){a=q(a),q.each(o,function(e,t){-1!==q.inArray("bp-my-"+t,a.get(0).classList)&&(void 0===s.heartbeat_data.highlights[t]?s.heartbeat_data.highlights[t]=[a.data("bp-activity-id")]:-1===q.inArray(a.data("bp-activity-id"),s.heartbeat_data.highlights[t])&&s.heartbeat_data.highlights[t].push(a.data("bp-activity-id")))})}),t=new RegExp("bp-my-("+o.join("|")+")","g"),this.heartbeat_data.newest=this.heartbeat_data.newest.replace(t,""),q(bp.Nouveau.objectNavParent+' [data-bp-scope="all"]').find("a span").html(a)):(this.heartbeat_data.highlights[d]=[],q.each(i,function(e,t){s.heartbeat_data.highlights[d].push(q(t).data("bp-activity-id"))})),q.each(o,function(e,t){var a;void 0!==s.heartbeat_data.highlights[t]&&s.heartbeat_data.highlights[t].length&&(a=0,"mentions"===t&&(a=s.mentions_count),q(bp.Nouveau.objectNavParent+' [data-bp-scope="'+t+'"]').find("a span").html(Number(s.heartbeat_data.highlights[t].length)+a))}),o.pop(),q(document).prop("title","("+a+") "+this.heartbeat_data.document_title),q('#buddypress [data-bp-list="activity"] li').first().hasClass("load-newest")?(i=q('#buddypress [data-bp-list="activity"] .load-newest a').html(),q('#buddypress [data-bp-list="activity"] .load-newest a').html(i.replace(/([0-9]+)/,a))):q('#buddypress [data-bp-list="activity"] ul.activity-list').prepend('
      • '+BP_Nouveau.newest+" ("+a+")
      • "),q('#buddypress [data-bp-list="activity"] li.load-newest').trigger("click"),q('#buddypress [data-bp-list="activity"]').trigger("bp_heartbeat_pending",this.heartbeat_data),void 0!==bp.Nouveau&&bp.Nouveau.reportPopUp())},injectActivities:function(e){var t,a,i,o,d=bp.Nouveau.getStorage("bp-activity"),s=d.scope||null,d=d.filter||null;q(e.currentTarget).hasClass("load-newest")?(e.preventDefault(),q(e.currentTarget).remove(),i=q.parseHTML(this.heartbeat_data.newest),q.each(i,function(e,t){"LI"===t.nodeName&&q(t).hasClass("just-posted")&&q("#"+q(t).prop("id")).length&&q("#"+q(t).prop("id")).remove()}),(0<(i=q(e.delegateTarget).find(".activity-list .activity-item").first()).length&&i.hasClass("bb-pinned")?q(i).after(this.heartbeat_data.newest):q(e.delegateTarget).find(".activity-list").prepend(this.heartbeat_data.newest)).find("li.activity-item").each(bp.Nouveau.hideSingleUrl).trigger("bp_heartbeat_prepend",this.heartbeat_data),this.heartbeat_data.newest="","all"===s&&q(bp.Nouveau.objectNavParent+' [data-bp-scope="all"]').find("a span").html(""),"mentions"===s&&(bp.Nouveau.ajax({action:"activity_clear_new_mentions"},"activity"),this.mentions_count=0),q(bp.Nouveau.objectNavParent+' [data-bp-scope="'+s+'"]').find("a span").html(""),void 0!==this.heartbeat_data.highlights[s]&&(this.heartbeat_data.highlights[s]=[]),setTimeout(function(){q(e.delegateTarget).find("[data-bp-activity-id]").removeClass("newest_"+s+"_activity")},3e3),q(document).prop("title",this.heartbeat_data.document_title),jQuery(window).scroll()):q(e.currentTarget).hasClass("load-more")&&(t=+Number(this.current_page)+1,a=this,i="",e.preventDefault(),(o=q(e.currentTarget)).find("a").first().addClass("loading"),this.just_posted=[],q(e.delegateTarget).children(".just-posted").each(function(){a.just_posted.push(q(this).data("bp-activity-id"))}),q("#buddypress .dir-search input[type=search]").length&&(i=q("#buddypress .dir-search input[type=search]").val()),bp.Nouveau.objectRequest({object:"activity",scope:s,filter:d,search_terms:i,page:t,method:"append",exclude_just_posted:this.just_posted.join(","),target:"#buddypress [data-bp-list] ul.bp-list"}).done(function(e){!0===e.success&&(o.remove(),a.current_page=t,jQuery(window).scroll())})),q(".activity-item.bb-closed-comments").find(".edit-activity, .acomment-edit").parents(".generic-button").hide()},hideComments:function(e){var a,i,o,e=q(e.target).find(".activity-comments");e.length&&e.each(function(e,t){o=q(t).children("ul").not(".conflict-activity-ul-li-comment"),(i=q(o).find("li").not(q(".document-action-class, .media-action-class, .video-action-class"))).length&&(q("body").hasClass("activity-singular")&&""!==window.location.hash&&q(window.location.hash).length&&0!==q(window.location.hash).closest(".activity-comments").length||(a=q(t).closest(".activity-item"),q("#acomment-comment-"+a.data("bp-activity-id")+" span.comment-count").html(),i.each(function(e,t){if(e"),window.location.hash&&"#"+q(t).attr("id")===window.location.hash)return q(t).parents("li.comment-item").show(),!1;q(t).addClass("bp-hidden").hide()}}),q(o).children(".bp-hidden").length===q(o).children("li").length-1&&q(o).find("li.show-all").length&&q(o).children("li:not(.show-all)").removeClass("bp-hidden").toggle()))})},showActivity:function(e){e.preventDefault();var t=q(e.currentTarget).parent(),a=t.data("parent_comment_id"),t=q(t).data("activity_id");q(document).trigger("activityModalOpened",{activityId:t}),q(e.currentTarget).parents(".activity-comments").find(".ac-form").each(function(){var e=q(this),t=q(this).closest(".activity-comments"),a=q(this).closest(".comment-item");e.find(".post-elements-buttons-item.post-emoji").removeClass("active").empty(""),bp.Nouveau.Activity.resetActivityCommentForm(e,"hardReset"),t.append(e),a.find(".acomment-display").removeClass("display-focus"),a.removeClass("comment-item-focus")}),bp.Nouveau.Activity.launchActivityPopup(t,a)},closeActivity:function(e){e.preventDefault();var t=q(e.target).closest(".bb-activity-model-wrapper"),a=t.find(".bb-modal-activity-footer"),i=t.find(".activity-item").data("bp-activity-id"),e=t.find("#ac-form-"+i);bp.Nouveau.Activity.reinitializeActivityCommentForm(e),_.isUndefined(BP_Nouveau.media)||_.isUndefined(BP_Nouveau.media.emoji)||bp.Nouveau.Activity.initializeEmojioneArea(!1,"",i),t.find("#activity-modal").removeClass("bb-closed-comments"),t.closest("body").removeClass("acomments-modal-open"),t.hide(),t.find("ul.activity-list").empty(),a.removeClass("active"),a.find("form.ac-form").remove()},scopeLoaded:function(e,a){this.current_page=1,"mentions"===a.scope&&void 0!==a.response.new_mentions?(q.each(a.response.new_mentions,function(e,t){q("#buddypress #activity-stream").find('[data-bp-activity-id="'+t+'"]').addClass("newest_mentions_activity")}),this.mentions_count=0):void 0!==this.heartbeat_data.highlights[a.scope]&&this.heartbeat_data.highlights[a.scope].length&&q.each(this.heartbeat_data.highlights[a.scope],function(e,t){q("#buddypress #activity-stream").find('[data-bp-activity-id="'+t+'"]').length&&q("#buddypress #activity-stream").find('[data-bp-activity-id="'+t+'"]').addClass("newest_"+a.scope+"_activity")}),this.heartbeat_data.newest="",q.each(q(bp.Nouveau.objectNavParent+" [data-bp-scope]").find("a span"),function(e,t){0===parseInt(q(t).html(),10)&&q(t).html("")}),void 0!==this.heartbeat_data.highlights[a.scope]&&(this.heartbeat_data.highlights[a.scope]=[]),q(document).prop("title",this.heartbeat_data.document_title),setTimeout(function(){q("#buddypress #activity-stream .activity-item").removeClass("newest_"+a.scope+"_activity")},3e3),void 0!==window.instgrm&&window.instgrm.Embeds.process(),void 0!==window.FB&&void 0!==window.FB.XFBML&&window.FB.XFBML.parse(),this.fixAtWhoActivity(),this.openEditActivityPopup(),this.navigateToSpecificComment(),setTimeout(function(){jQuery(window).scroll()},200)},openEditActivityPopup:function(){var e,t;!_.isUndefined(BP_Nouveau.activity.params.is_activity_edit)&&0 ul");if(e.data.redirect)return window.location.href=e.data.redirect;e.data.parent_activity_id&&e.data.activity&&q("body:not(.activity-singular) #buddypress #activity-stream ul.activity-list li#activity-"+e.data.parent_activity_id).replaceWith(e.data.activity),k&&(x=1,i=B.find(".acomments-view-more").data("child-count"),c.append(B.find("form")),q.each(B.find("li.comment-item"),function(){x+=1}),x+=void 0!==i?parseFloat(i):0,N=m.find("span.comments-count"),z=N.text().length?N.text().match(/\d+/)[0]:0,z=Number(z-x),p.length?(i=1 ul").html().trim()&&t.removeClass("has-child-comments")}),k||c.data("bp-timestamp")!==d.Activity.heartbeat_data.last_recorded||(d.Activity.heartbeat_data.newest="",d.Activity.heartbeat_data.last_recorded=0),q(document).trigger("bp_activity_ajax_delete_request",q.extend(A,{response:e})),q(document).trigger("bp_activity_ajax_delete_request_video",q.extend(A,{response:e})),bp.Nouveau.Activity.activityHasUpdates=!0,bp.Nouveau.Activity.currentActivityId=r}j.removeClass("active")})}if(l.closest("span").hasClass("activity-read-more")){var T=l.closest("div"),U=l.closest("span");if(C=null,q(T).hasClass("activity-inner")?C=r:q(T).hasClass("acomment-content")&&(C=l.closest("li").data("bp-activity-comment-id")),!C)return e;e.preventDefault(),q(U).addClass("loading"),d.ajax({action:"get_single_activity_content",id:C},"activity").done(function(e){"object"!=typeof e&&0/gi,"\n").replace(/<\/div>/gi,""),S={action:"new_activity_comment",_wpnonce_new_activity_comment:q("#_wpnonce_new_activity_comment").val(),comment_id:C,form_id:r,content:R};q("#_bp_as_nonce_"+r).val()&&(S["_bp_as_nonce_"+r]=q("#_bp_as_nonce_"+r).val()),this.dropzone_media.length&&(S.media=this.dropzone_media),this.dropzone_document.length&&(S.document=this.dropzone_document),this.dropzone_video.length&&(S.video=this.dropzone_video,_.isEmpty(S.content)&&(S.content="​")),_.isUndefined(this.models[r])||(n=this.models[r],S.gif_data=this.models[r].get("gif_data")),S.content=S.content.replace(/ /g," "),s.hasClass("acomment-edit")&&(S.edit_comment=!0);var H=0"):t.append("
          ")),H?s.closest("#activity-modal").find(".bb-modal-activity-body .activity-comments, .bb-modal-activity-body .activity-comments .activity-actions").children("ul").append(q(a)):t.children("ul").append(q(a).hide().fadeIn(200)),q(s).find(".ac-input").first().html(""),t.parent().addClass("has-comments"),t.parent().addClass("comments-loaded"),m.addClass("has-comments")),s.removeClass("acomment-edit");t=s.find(".ac-reply-content");if(0'+BP_Nouveau.activity.strings.commentPostError+""):(e=e.responseJSON&&e.responseJSON.message?e.responseJSON.message:e.statusText,s.find(".ac-reply-content").after('
          '+e+"
          "))})}if(l.hasClass("edit")&&l.hasClass("edit-activity")&&(e.preventDefault(),R=c.data("bp-activity"),S=""!==c.data("link-url")?c.data("link-url"):null,void 0!==R&&(bp.Nouveau.Activity.postForm.displayEditActivityForm(R,S),l.closest("li").hasClass("groups")?q("#bp-nouveau-activity-form").addClass("group-activity"):q("#bp-nouveau-activity-form").removeClass("group-activity"),void 0!==bp.Nouveau.Media&&void 0!==bp.Nouveau.Media.Theatre&&(bp.Nouveau.Media.Theatre.is_open_media||bp.Nouveau.Media.Theatre.is_open_document)&&(q(document).find(".bb-close-media-theatre").trigger("click"),q(document).find(".bb-close-document-theatre").trigger("click")))),u&&(l.hasClass("bb-open-media-theatre")||l.hasClass("bb-open-video-theatre")||l.hasClass("bb-open-document-theatre")||l.hasClass("document-detail-wrap-description-popup"))&&(e.preventDefault(),l.closest("#activity-modal").find(".bb-modal-activity-header .bb-close-action-popup").trigger("click")),l.hasClass("pin-activity")||l.hasClass("unpin-activity")){if(e.preventDefault(),!r)return e;l.closest(".activity-item").addClass("loading-pin");var O="pin";l.hasClass("unpin-activity")&&(O="unpin"),d.ajax({action:"activity_update_pinned_post",id:r,pin_action:O},"activity").done(function(e){var t,a,i,o,d,s,n;l.closest(".activity-item").removeClass("loading-pin"),void 0!==(e="object"!=typeof e?JSON.parse(e):e).data&&void 0!==e.data.feedback&&(t=l.closest("ul.activity-list"),n=u?l.closest(".buddypress-wrap").find("#activity-stream"):l.closest("#activity-stream"),e.success&&(a=bp.Nouveau.getStorage("bp-activity","scope"),o=i=!1,d="",l.closest("li.activity-item").hasClass("groups")&&(o=!0,d=(d=l.closest("li.activity-item").attr("class").match(/group-\d+/))[0].replace("group-","")),n.hasClass("single-user")?i=!1:(n.hasClass("activity")&&"all"===a&&!o||n.hasClass("single-group"))&&(i=!0),"pin"===O?(i&&t.find("li.activity-item").removeClass("bb-pinned"),s="li.activity-item:not(.groups)",o&&!n.hasClass("single-group")?s="li.activity-item.group-"+d:o&&n.hasClass("single-group")&&(s="li.activity-item"),t.find(s).each(function(){var e=q(this).find(".unpin-activity");e.removeClass("unpin-activity").addClass("pin-activity"),o?e.find("span").html(BP_Nouveau.activity.strings.pinGroupPost):e.find("span").html(BP_Nouveau.activity.strings.pinPost)}),i&&l.closest("li.activity-item").addClass("bb-pinned"),l.addClass("unpin-activity"),l.removeClass("pin-activity"),l.closest("li.activity-item").hasClass("groups")?l.find("span").html(BP_Nouveau.activity.strings.unpinGroupPost):l.find("span").html(BP_Nouveau.activity.strings.unpinPost)):"unpin"===O&&(l.closest("li.activity-item").removeClass("bb-pinned"),l.addClass("pin-activity"),l.removeClass("unpin-activity"),l.closest("li.activity-item").hasClass("groups")?l.find("span").html(BP_Nouveau.activity.strings.pinGroupPost):l.find("span").html(BP_Nouveau.activity.strings.pinPost)),"all"===a&&i&&(bp.Nouveau.Activity.heartbeat_data.last_recorded=0,bp.Nouveau.refreshActivities())),q(document).trigger("bb_trigger_toast_message",["","
          "+e.data.feedback+"
          ","success",null,!0]))}).fail(function(){l.closest(".activity-item").removeClass("loading-pin"),q(document).trigger("bb_trigger_toast_message",["","
          "+BP_Nouveau.activity.strings.pinPostError+"
          ","error",null,!0])})}if(l.hasClass("bb-icon-bell-slash")||l.hasClass("bb-icon-bell")){if(e.preventDefault(),!r)return e;l.closest(".activity-item").addClass("loading-mute");var Q="mute";l.hasClass("bb-icon-bell")&&(Q="unmute"),d.ajax({action:"toggle_activity_notification_status",id:r,notification_toggle_action:Q},"activity").done(function(e){l.closest(".activity-item").removeClass("loading-mute"),void 0!==(e="object"!=typeof e?JSON.parse(e):e).data&&void 0!==e.data.feedback&&(e.success&&("mute"===Q?(l.closest("li.activity-item").addClass("bb-muted"),l.removeClass("bb-icon-bell-slash"),l.addClass("bb-icon-bell"),l.attr("title",BP_Nouveau.activity.strings.unmuteNotification),l.find("span").html(BP_Nouveau.activity.strings.unmuteNotification)):"unmute"===Q&&(l.closest("li.activity-item").removeClass("bb-muted"),l.removeClass("bb-icon-bell"),l.addClass("bb-icon-bell-slash"),l.attr("title",BP_Nouveau.activity.strings.muteNotification),l.find("span").html(BP_Nouveau.activity.strings.muteNotification)),void 0!==bp.Nouveau.Activity.activityHasUpdates&&(bp.Nouveau.Activity.activityHasUpdates=!0)),q(document).trigger("bb_trigger_toast_message",["","
          "+e.data.feedback+"
          ","success",null,!0])),u&&(bp.Nouveau.Activity.activityPinHasUpdates=!0),bp.Nouveau.Activity.activityHasUpdates=!0,bp.Nouveau.Activity.currentActivityId=r}).fail(function(){l.closest(".activity-item").removeClass("loading-pin"),q(document).trigger("bb_trigger_toast_message",["","
          "+BP_Nouveau.activity.strings.pinPostError+"
          ","error",null,!0])})}if(l.hasClass("close-activity-comment")||l.hasClass("unclose-activity-comment")){if(e.preventDefault(),!r)return e;l.closest(".activity-item").addClass("loading-pin");var V="close_comments";l.hasClass("unclose-activity-comment")&&(V="unclose_comments"),d.ajax({action:"activity_update_close_comments",id:r,close_comments_action:V},"activity").done(function(e){var t;l.closest(".activity-item").removeClass("loading-pin"),void 0!==(e="object"!=typeof e?JSON.parse(e):e).data&&void 0!==e.data.feedback&&(e.success&&(t=q("#activity-stream > .activity-list").find("[data-bp-activity-id="+r+"]"),l.closest(".activity-item").find(".bb-activity-closed-comments-notice").remove(),"close_comments"===V?(l.closest("li.activity-item").addClass("bb-closed-comments"),0'+e.data.feedback+""),0'+e.data.feedback+""))):"unclose_comments"===V&&(l.closest("li.activity-item.bb-closed-comments").find(".edit-activity, .acomment-edit").parents(".generic-button").show(),l.closest("li.activity-item").removeClass("bb-closed-comments"),0"+e.data.feedback+"",e.success?"success":"error",null,!0]))}).fail(function(){l.closest(".activity-item").removeClass("loading-pin"),q(document).trigger("bb_trigger_toast_message",["","
          "+BP_Nouveau.activity.strings.closeCommentsError+"
          ","error",null,!0])})}},commentFormAction:function(e){var t,a;return(e=e||window.event).target?t=e.target:e.srcElement&&(t=e.srcElement),3===t.nodeType&&(t=t.parentNode),!0!==e.altKey&&!0!==e.metaKey&&"TEXTAREA"===t.tagName&&q(t).hasClass("ac-input")?void(27===(a=e.keyCode||e.which)&&!1===e.ctrlKey?"TEXTAREA"===t.tagName&&q(t).closest("form").slideUp(200):e.ctrlKey&&13===a&&q(t).val()&&q(t).closest("form").find("[type=submit]").first().trigger("click")):e},togglePopupDropdown:function(e){var t;return(e=e||window.event).target?t=e.target:e.srcElement&&(t=e.srcElement),3===t.nodeType&&(t=t.parentNode),!0===e.altKey||!0===e.metaKey||q(t).hasClass("privacy-wrap")||q(t).parent().hasClass("privacy-wrap")?e:void q("ul.activity-privacy").removeClass("bb-open")},loadMoreActivities:function(){var e,t=q(".load-more:visible").last(),a=q(window);t.closest(".activity-list").length&&t.get(0)&&!t.data("bp-autoloaded")&&(e=t.offset().top-50,a.scrollTop()+a.height()>e&&(t.data("bp-autoloaded",1),t.find("a").text(BP_Nouveau.activity.strings.loadingMore),t.find("a").trigger("click")))},destroyCommentMediaUploader:function(e){_.isNull(this.dropzone_obj)||(this.dropzone_obj.destroy(),q("#ac-reply-post-media-uploader-"+e).html(""),q("#ac-reply-post-media-uploader-1-"+e).html("")),this.dropzone_media=[],q("#ac-reply-post-media-uploader-"+e).removeClass("open").addClass("closed"),q("#ac-reply-media-button-"+e).removeClass("active")},destroyCommentDocumentUploader:function(e){_.isNull(this.dropzone_document_obj)||(this.dropzone_document_obj.destroy(),q("#ac-reply-post-document-uploader-"+e).html("")),this.dropzone_document=[],q("#ac-reply-post-document-uploader-"+e).removeClass("open").addClass("closed"),q("#ac-reply-document-button-"+e).removeClass("active")},destroyCommentVideoUploader:function(e){_.isNull(this.dropzone_video_obj)||(this.dropzone_video_obj.destroy(),q("#ac-reply-post-video-uploader-"+e).html("")),this.dropzone_video=[],q("#ac-reply-post-video-uploader-"+e).removeClass("open").addClass("closed"),q("#ac-reply-video-button-"+e).removeClass("active")},resetGifPicker:function(e){q("#ac-reply-gif-button-"+e).closest(".post-gif").find(".gif-media-search-dropdown").removeClass("open").empty(),q("#ac-reply-gif-button-"+e).removeClass("active"),q(".gif-media-search-dropdown-standalone").removeClass("open").empty(),_.isUndefined(this.models[e])||(this.models[e].set("gif_data",{}),q("#ac-reply-post-gif-"+e).find(".activity-attached-gif-container").removeAttr("style"))},openCommentsMediaUploader:function(e){var l=this,o=q(e.currentTarget),t=o.data("ac-id"),a=o.closest(".bp-ac-form-container").find("#ac-reply-post-media-uploader-"+t),i=0'+t+""),this.removeFile(e),a.removeClass("media-uploading"))}),l.dropzone_obj.on("removedfile",function(e){if(l.dropzone_media.length)for(var t in l.dropzone_media)if(e.upload.uuid==l.dropzone_media[t].uuid){void 0===l.dropzone_media[t].saved||l.dropzone_media[t].saved||bp.Nouveau.Media.removeAttachment(l.dropzone_media[t].id),l.dropzone_media.splice(t,1);break}var a,i;_.isNull(l.dropzone_obj)||_.isNull(l.dropzone_obj.files)||0!==l.dropzone_obj.files.length?o.closest(".ac-form").addClass("has-content"):(a=o.parents(".ac-reply-toolbar"),(i=o.closest(".ac-form")).removeClass("has-media"),a.find(".ac-reply-document-button")&&a.find(".ac-reply-document-button").parents(".post-elements-buttons-item").removeClass("disable"),a.find(".ac-reply-video-button")&&a.find(".ac-reply-video-button").parents(".post-elements-buttons-item").removeClass("disable"),a.find(".ac-reply-gif-button")&&a.find(".ac-reply-gif-button").parents(".post-elements-buttons-item").removeClass("disable"),a.find(".ac-reply-media-button")&&a.find(".ac-reply-media-button").parents(".post-elements-buttons-item").removeClass("no-click").find(".toolbar-button").removeClass("active"),q(l.dropzone_obj.element).removeClass("files-uploaded dz-progress-view").find(".dz-global-progress").remove(),l.validateCommentContent(i.find(".ac-textarea").children(".ac-input")))}),l.dropzone_obj.on("complete",function(){0===this.getUploadingFiles().length&&0===this.getQueuedFiles().length&&0'+t+""),this.removeFile(e),a.removeClass("media-uploading"))}),l.dropzone_document_obj.on("removedfile",function(e){if(l.dropzone_document.length)for(var t in l.dropzone_document)if(e.upload.uuid==l.dropzone_document[t].uuid){void 0===l.dropzone_document[t].saved||l.dropzone_document[t].saved||bp.Nouveau.Media.removeAttachment(l.dropzone_document[t].id),l.dropzone_document.splice(t,1);break}var a,i;_.isNull(l.dropzone_document_obj)||_.isNull(l.dropzone_document_obj.files)||0!==l.dropzone_document_obj.files.length?o.closest(".ac-form").addClass("has-content"):(a=o.parents(".ac-reply-toolbar"),(i=o.closest(".ac-form")).removeClass("has-media"),a.find(".ac-reply-media-button")&&a.find(".ac-reply-media-button").parents(".post-elements-buttons-item").removeClass("disable"),a.find(".ac-reply-video-button")&&a.find(".ac-reply-video-button").parents(".post-elements-buttons-item").removeClass("disable"),a.find(".ac-reply-gif-button")&&a.find(".ac-reply-gif-button").parents(".post-elements-buttons-item").removeClass("disable"),a.find(".ac-reply-document-button")&&a.find(".ac-reply-document-button").parents(".post-elements-buttons-item").removeClass("no-click").find(".toolbar-button").removeClass("active"),q(l.dropzone_document_obj.element).removeClass("files-uploaded dz-progress-view").find(".dz-global-progress").remove(),l.validateCommentContent(i.find(".ac-textarea").children(".ac-input")))}),l.dropzone_document_obj.on("complete",function(){0===this.getUploadingFiles().length&&0===this.getQueuedFiles().length&&0'),q(e.previewElement).closest(".dz-preview").addClass("dz-has-thumbnail")):bp.Nouveau.getVideoThumb&&bp.Nouveau.getVideoThumb(e,".dz-video-thumbnail")}),l.dropzone_video_obj.on("uploadprogress",function(){o.closest(".ac-form").addClass("media-uploading"),bp.Nouveau.dropZoneGlobalProgress&&bp.Nouveau.dropZoneGlobalProgress(this)}),l.dropzone_video_obj.on("success",function(e,t){if(100===e.upload.progress&&(q(e.previewElement).find(".dz-progress-ring circle")[0].style.strokeDashoffset=0,q(e.previewElement).find(".dz-progress-count").text("100% "+BP_Nouveau.video.i18n_strings.video_uploaded_text),q(e.previewElement).closest(".dz-preview").addClass("dz-complete")),t.data.id)return e.id=t.id,t.data.uuid=e.upload.uuid,t.data.menu_order=q(e.previewElement).closest(".dropzone").find(e.previewElement).index()-1,t.data.album_id=void 0!==BP_Nouveau.video&&void 0!==BP_Nouveau.video.album_id&&BP_Nouveau.video.album_id,t.data.group_id=void 0!==BP_Nouveau.video&&void 0!==BP_Nouveau.video.group_id&&BP_Nouveau.video.group_id,t.data.saved=!1,t.data.js_preview=q(e.previewElement).find(".dz-video-thumbnail img").attr("src"),l.dropzone_video.push(t.data),e.previewElement.classList.add("dz-success");var a,i,o,d,s,n=t.data.feedback;for(e.previewElement.classList.add("dz-error"),s=[],i=0,o=(d=e.previewElement.querySelectorAll("[data-dz-errormessage]")).length;i'+t+""),this.removeFile(e),a.removeClass("media-uploading"))}),l.dropzone_video_obj.on("removedfile",function(e){if(l.dropzone_video.length)for(var t in l.dropzone_video)if(e.upload.uuid==l.dropzone_video[t].uuid){void 0===l.dropzone_video[t].saved||l.dropzone_video[t].saved||bp.Nouveau.Media.removeAttachment(l.dropzone_video[t].id),l.dropzone_video.splice(t,1);break}var a,i;_.isNull(l.dropzone_video_obj)||_.isNull(l.dropzone_video_obj.files)||0!==l.dropzone_video_obj.files.length?o.closest(".ac-form").addClass("has-content"):(a=o.parents(".ac-reply-toolbar"),(i=o.closest(".ac-form")).removeClass("has-media"),a.find(".ac-reply-media-button")&&a.find(".ac-reply-media-button").parents(".post-elements-buttons-item").removeClass("disable"),a.find(".ac-reply-document-button")&&a.find(".ac-reply-document-button").parents(".post-elements-buttons-item").removeClass("disable"),a.find(".ac-reply-gif-button")&&a.find(".ac-reply-gif-button").parents(".post-elements-buttons-item").removeClass("disable"),a.find(".ac-reply-video-button")&&a.find(".ac-reply-video-button").parents(".post-elements-buttons-item").removeClass("no-click").find(".toolbar-button").removeClass("active"),q(l.dropzone_video_obj.element).removeClass("files-uploaded dz-progress-view").find(".dz-global-progress").remove(),l.validateCommentContent(i.find(".ac-textarea").children(".ac-input")))}),l.dropzone_video_obj.on("complete",function(){0===this.getUploadingFiles().length&&0===this.getQueuedFiles().length&&0/gi,"\n").replace(/<\/div>/gi,""))).replace(/ /g," ");""!==e.text().trim()||0<=t.indexOf("emojioneemoji")||e.closest("form").hasClass("acomment-edit")?e.closest("form").addClass("has-content"):e.closest("form").removeClass("has-content")},ReactionStatePopupTab:function(e){e.preventDefault(),q(this).closest(".activity-state-popup").find(".activity-state-popup_tab_panel li a").removeClass("active"),q(this).addClass("active"),q(this).closest(".activity-state-popup").find(".activity-state-popup_tab_content .activity-state-popup_tab_item").removeClass("active"),q(this).closest(".activity-state-popup").find("."+q(this).data("tab")).addClass("active")},closeActivityState:function(){q(".activity-state-popup").hide().removeClass("active")},listenCommentInput:function(e){var t,a;0/gi,"\n").replace(/<\/div>/gi,""));t=t.replace(/ /g," "),""!==jQuery(e.currentTarget).text().trim()||0<=t.indexOf("emojioneemoji")?jQuery(e.currentTarget).closest("form").addClass("has-content"):jQuery(e.currentTarget).closest("form").removeClass("has-content")}),q(t).closest("form").addClass("events-initiated"),this.InitiatedCommentForms.push(a)))},activityRootComment:function(e){var t=q(e.currentTarget).closest("#activity-modal"),a=t.find(".activity-item").data("bp-activity-id"),e=t.find("#ac-form-"+a);bp.Nouveau.Activity.resetActivityCommentForm(e,"hardReset"),t.find(".acomment-display").removeClass("display-focus"),t.find(".comment-item").removeClass("comment-item-focus"),t.find(".bb-modal-activity-footer").addClass("active").append(e),e.addClass("root"),e.find("#ac-input-"+a).focus(),bp.Nouveau.Activity.clearFeedbackNotice(e)},clearFeedbackNotice:function(e){e.find(".bp-ac-form-container").find(".bp-feedback").length&&e.find(".bp-ac-form-container").find(".bp-feedback").remove()},launchActivityPopup:function(e,t){var a=q("#activity-"+e),i=q(".bb-activity-model-wrapper"),o=a[0].outerHTML,d='[data-parent_comment_id="'+t+'"]',t=a.data("activity-popup-title");bp.Nouveau.Activity.activityHasUpdates=!1,bp.Nouveau.Activity.currentActivityId=null,bp.Nouveau.Activity.activityPinHasUpdates=!1,i.closest("body").addClass("acomments-modal-open"),i.show(),i.find("ul.activity-list").html(o),i.find(".bb-modal-activity-header h2").text(t),i.find(".bb-activity-video-elem").each(function(e,t){var o=q(t);o.find("video").each(function(e,t){var a=q(t),i=a.attr("id")+Math.floor(1e4*Math.random());a.attr("id",i);t=o.find(".video-action-wrap");a.insertAfter(t),o.find(".video-js").remove(),a.addClass("video-js"),videojs(i,{controls:!0,aspectRatio:"16:9",fluid:!0,playbackRates:[.5,1,1.5,2],fullscreenToggle:!1})})}),a.hasClass("bb-closed-comments")&&i.find("#activity-modal").addClass("bb-closed-comments");t=i.find("#ac-form-"+e);i.find(".acomment-display").removeClass("display-focus"),i.find(".comment-item").removeClass("comment-item-focus"),i.find(".bb-modal-activity-footer").addClass("active").append(t),t.removeClass("not-initialized").addClass("root"),t.find("#ac-input-"+e).focus(),bp.Nouveau.Activity.clearFeedbackNotice(t),t.removeClass("events-initiated");a=i.find(".bb-modal-activity-footer").find(".ac-input[contenteditable]");bp.Nouveau.Activity.listenCommentInput(a),i.find(".bb-activity-more-options-wrap .bb-activity-more-options-action, .bb-pin-action_button, .bb-mute-action_button").attr("data-balloon-pos","left"),i.find(".privacy-wrap").attr("data-bp-tooltip-pos","right"),i.find(d).children(".acomments-view-more").first().trigger("click"),_.isUndefined(BP_Nouveau.media)||_.isUndefined(BP_Nouveau.media.emoji)||bp.Nouveau.Activity.initializeEmojioneArea(!0,"#activity-modal ",e),void 0!==bp.Nouveau&&bp.Nouveau.reportPopUp(),bp.Nouveau.Activity.toggleMultiMediaOptions(t,"",".bb-modal-activity-footer")},viewMoreComments:function(e){e.preventDefault();var t=q(e.currentTarget).parent(),i=q(e.currentTarget),o=q(t).data("activity_id"),d=q(e.currentTarget).closest(".activity-comments"),s=q(e.currentTarget).closest(".activity-item"),n=q(t).data("parent_comment_id"),l="";i.addClass("loading").removeClass("acomments-view-more--hide"),d.addClass("active"),s.addClass("active"),i.html('
          ');var a={action:"activity_loadmore_comments",activity_id:o,parent_comment_id:n,offset:q(e.currentTarget).parents(".activity-comments").find('ul[data-parent_comment_id ="'+n+'"] > li.comment-item:not(.bb-recent-comment)').length,activity_type_is_blog:1"+e.data.message+"

          ").removeClass("acomments-view-more--hide"),d.removeClass("active"),s.removeClass("active")):void 0!==e.data&&void 0!==e.data.comments&&(t=q(".bb-internal-model .activity-comments").find("[data-activity_id='"+o+"'][data-parent_comment_id='"+n+"']"),a=q(q.parseHTML(e.data.comments)),0"+e.statusText+"

          ").removeClass("acomments-view-more--hide"),d.removeClass("active"),s.removeClass("active")})},autoloadMoreComments:function(){var e,t,a,i,o;0 ul > li.acomments-view-more:not(.loading), .bb-modal-activity-body .activity-comments .activity-actions > ul > li.acomments-view-more:not(.loading)"),o=q(".bb-activity-model-wrapper .bb-modal-activity-body"),i=q(".bb-activity-model-wrapper .bb-modal-activity-body").find(".activity-comments:not(.active)"),0a&&q(e).trigger("click").addClass("loading")),setTimeout(function(){jQuery(window).scroll()},200))},activitySyncOnModalClose:function(e,t){e.preventDefault();var e=(q(e.currentTarget).is(document)?q(".bb-activity-model-wrapper"):q(e.currentTarget).parents(".bb-activity-model-wrapper")).find("ul.activity-list > li").data("bp-activity-id"),e=void 0!==t?t:e,a=q("#activity-stream li.activity-item[data-bp-activity-id="+e+"]");0 .bb-modal-activity-body .activity-item").data("bp-activity-id");0/gi,"\n").replace(/<\/div>/gi,""));t=t.replace(/ /g," "),""!==e.text()||0<=t.indexOf("emojioneemoji")?e.closest("form").addClass("has-content"):e.closest("form").removeClass("has-content")},picker_show:function(){q(this.button[0]).closest(".post-emoji").addClass("active"),q(".emojionearea-theatre").removeClass("hide").addClass("show")},picker_hide:function(){q(this.button[0]).closest(".post-emoji").removeClass("active"),q(".emojionearea-theatre").removeClass("show").addClass("hide")}}})}},bp.Nouveau.Activity.start())}((bp,jQuery)); \ No newline at end of file +window.bp=window.bp||{},function(q){"undefined"!=typeof BP_Nouveau&&(bp.Nouveau=bp.Nouveau||{},bp.Models=bp.Models||{},bp.Models.ACReply=Backbone.Model.extend({defaults:{gif_data:{}}}),bp.Nouveau.Activity={start:function(){this.setupGlobals(),this.addListeners()},setupGlobals:function(){this.just_posted=[],this.current_page=1,this.mentions_count=Number(q(bp.Nouveau.objectNavParent+' [data-bp-scope="mentions"]').find("a span").html())||0,this.heartbeat_data={newest:"",highlights:{},last_recorded:0,first_recorded:0,document_title:q(document).prop("title")},void 0!==window.Dropzone&&void 0!==BP_Nouveau.media&&(window.Dropzone.autoDiscover=!1,this.dropzone_options={url:BP_Nouveau.ajaxurl,timeout:108e5,dictFileTooBig:BP_Nouveau.media.dictFileTooBig,dictDefaultMessage:BP_Nouveau.media.dropzone_media_message,acceptedFiles:"image/*",autoProcessQueue:!0,addRemoveLinks:!0,uploadMultiple:!1,maxFiles:void 0!==BP_Nouveau.media.maxFiles?BP_Nouveau.media.maxFiles:10,maxFilesize:void 0!==BP_Nouveau.media.max_upload_size?BP_Nouveau.media.max_upload_size:2,dictMaxFilesExceeded:BP_Nouveau.media.media_dict_file_exceeded,dictCancelUploadConfirmation:BP_Nouveau.media.dictCancelUploadConfirmation,maxThumbnailFilesize:void 0!==BP_Nouveau.media.max_upload_size?BP_Nouveau.media.max_upload_size:2},void 0!==BP_Nouveau.media.dropzone_options&&Object.assign(this.dropzone_options,BP_Nouveau.media.dropzone_options)),this.dropzone_obj=null,this.dropzone_media=[],this.dropzone_document_obj=null,this.dropzone_document=[],this.dropzone_video_obj=null,this.dropzone_video=[],this.models=[],this.InitiatedCommentForms=[],this.activityHasUpdates=!1,this.currentActivityId=null,this.activityPinHasUpdates=!1},addListeners:function(){q("body").hasClass("activity-singular")||q("#buddypress").on("bp_heartbeat_send",this.heartbeatSend.bind(this)),q("#buddypress").on("bp_heartbeat_tick",this.heartbeatTick.bind(this)),q('#buddypress [data-bp-list="activity"]').on("click","li.load-newest, li.load-more",this.injectActivities.bind(this)),q("#buddypress").on("bp_ajax_request",'[data-bp-list="activity"]',this.scopeLoaded.bind(this)),q("#activity-stream").on("click",".acomments-view-more",this.showActivity),q("body").on("click",".bb-close-action-popup",this.closeActivity),q(document).on("activityModalOpened",function(e,t){var a=t.activityId;q(document).on("click",function(e){0li.bb-edit-privacy a",bp.Nouveau,this.activityPrivacyRedirect.bind(this)),q('#buddypress [data-bp-list="activity"], #activity-modal').on("click",".activity-privacy>li:not(.bb-edit-privacy)",bp.Nouveau,this.activityPrivacyChange.bind(this)),q('#buddypress [data-bp-list="activity"], #bb-media-model-container .activity-list, #activity-modal').on("click","span.privacy",bp.Nouveau,this.togglePrivacyDropdown.bind(this)),q("#bb-media-model-container .activity-list").on("click",".activity-item",bp.Nouveau,this.activityActions.bind(this)),q(".bb-activity-model-wrapper").on("click",".ac-form-placeholder",bp.Nouveau,this.activityRootComment.bind(this)),q(document).keydown(this.commentFormAction),q(document).click(this.togglePopupDropdown),q('#buddypress [data-bp-list="activity"], #bb-media-model-container .activity-list, #activity-modal .activity-list, .bb-modal-activity-footer').on("click",".ac-reply-media-button",this.openCommentsMediaUploader.bind(this)),q('#buddypress [data-bp-list="activity"], #bb-media-model-container .activity-list, #activity-modal .activity-list, .bb-modal-activity-footer').on("click",".ac-reply-document-button",this.openCommentsDocumentUploader.bind(this)),q('#buddypress [data-bp-list="activity"], #bb-media-model-container .activity-list, #activity-modal .activity-list, .bb-modal-activity-footer').on("click",".ac-reply-video-button",this.openCommentsVideoUploader.bind(this)),q('#buddypress [data-bp-list="activity"], #bb-media-model-container .activity-list, #activity-modal .activity-list, .bb-modal-activity-footer').on("click",".ac-reply-gif-button",this.openGifPicker.bind(this)),q(document).on("click",this.toggleActivityOption.bind(this)),q(document).on("click",".activity-state-popup_overlay",bp.Nouveau,this.closeActivityState.bind(this)),q(document).on("click",".activity-state-popup .activity-state-popup_tab_panel a",this.ReactionStatePopupTab),_.isUndefined(BP_Nouveau.activity.params.autoload)||q(window).scroll(this.loadMoreActivities),q(".bb-activity-model-wrapper, .bb-media-model-wrapper").on("click",".acomments-view-more",this.viewMoreComments.bind(this)),q(document).on("click","#activity-stream .activity-comments .view-more-comments, #activity-stream .activity-state-comments > .comments-count",function(e){e.preventDefault(),q(this).parents("li.activity-item").find(".activity-comments > ul > li.acomments-view-more, .activity-comments > .activity-actions > ul > li.acomments-view-more").trigger("click")}),q("#activity-modal > .bb-modal-activity-body").on("scroll",this.autoloadMoreComments.bind(this)),q("#activity-modal > .bb-modal-activity-body").on("scroll",this.discardGifEmojiPicker.bind(this)),q(".bb-activity-model-wrapper .bb-model-close-button").on("click",this.activitySyncOnModalClose.bind(this)),void 0!==BP_Nouveau.is_send_ajax_request&&"1"===BP_Nouveau.is_send_ajax_request?q("#buddypress").on("bp_ajax_request",'[data-bp-list="activity"]',function(){setTimeout(function(){q(".ac-form.not-initialized").each(function(){var e=q(this),t=e.find(".ac-textarea");bp.Nouveau.Activity.toggleMultiMediaOptions(e,t)})},1e3)}):setTimeout(function(){q(".ac-form.not-initialized").each(function(){var e=q(this),t=e.find(".ac-textarea");bp.Nouveau.Activity.toggleMultiMediaOptions(e,t)})},1e3)},heartbeatSend:function(e,t){this.heartbeat_data.first_recorded=q("#buddypress [data-bp-list] [data-bp-activity-id]:not(.bb-pinned)").first().data("bp-timestamp")||0;var a=q("#buddypress [data-bp-list] [data-bp-activity-id]").first().data("bp-timestamp")||0;a>this.heartbeat_data.first_recorded&&(this.heartbeat_data.first_recorded=a),(0===this.heartbeat_data.last_recorded||this.heartbeat_data.first_recorded>this.heartbeat_data.last_recorded)&&(this.heartbeat_data.last_recorded=this.heartbeat_data.first_recorded),t.bp_activity_last_recorded=this.heartbeat_data.last_recorded,q("#buddypress .dir-search input[type=search]").length&&(t.bp_activity_last_recorded_search_terms=q("#buddypress .dir-search input[type=search]").val()),q.extend(t,{bp_heartbeat:bp.Nouveau.getStorage("bp-activity")})},heartbeatTick:function(e,t){var a,i,o=bp.Nouveau.objects,d=bp.Nouveau.getStorage("bp-activity","scope"),s=this;void 0!==t&&t.bp_activity_newest_activities&&(this.heartbeat_data.newest=q.trim(t.bp_activity_newest_activities.activities)+this.heartbeat_data.newest,this.heartbeat_data.last_recorded=Number(t.bp_activity_newest_activities.last_recorded),i=q(this.heartbeat_data.newest).filter(".activity-item"),a=Number(i.length),o.push("mentions"),"all"===d?(q.each(i,function(e,a){a=q(a),q.each(o,function(e,t){-1!==q.inArray("bp-my-"+t,a.get(0).classList)&&(void 0===s.heartbeat_data.highlights[t]?s.heartbeat_data.highlights[t]=[a.data("bp-activity-id")]:-1===q.inArray(a.data("bp-activity-id"),s.heartbeat_data.highlights[t])&&s.heartbeat_data.highlights[t].push(a.data("bp-activity-id")))})}),t=new RegExp("bp-my-("+o.join("|")+")","g"),this.heartbeat_data.newest=this.heartbeat_data.newest.replace(t,""),q(bp.Nouveau.objectNavParent+' [data-bp-scope="all"]').find("a span").html(a)):(this.heartbeat_data.highlights[d]=[],q.each(i,function(e,t){s.heartbeat_data.highlights[d].push(q(t).data("bp-activity-id"))})),q.each(o,function(e,t){var a;void 0!==s.heartbeat_data.highlights[t]&&s.heartbeat_data.highlights[t].length&&(a=0,"mentions"===t&&(a=s.mentions_count),q(bp.Nouveau.objectNavParent+' [data-bp-scope="'+t+'"]').find("a span").html(Number(s.heartbeat_data.highlights[t].length)+a))}),o.pop(),q(document).prop("title","("+a+") "+this.heartbeat_data.document_title),q('#buddypress [data-bp-list="activity"] li').first().hasClass("load-newest")?(i=q('#buddypress [data-bp-list="activity"] .load-newest a').html(),q('#buddypress [data-bp-list="activity"] .load-newest a').html(i.replace(/([0-9]+)/,a))):q('#buddypress [data-bp-list="activity"] ul.activity-list').prepend('
        • '+BP_Nouveau.newest+" ("+a+")
        • "),q('#buddypress [data-bp-list="activity"] li.load-newest').trigger("click"),q('#buddypress [data-bp-list="activity"]').trigger("bp_heartbeat_pending",this.heartbeat_data),void 0!==bp.Nouveau&&bp.Nouveau.reportPopUp())},injectActivities:function(e){var t,a,i,o,d=bp.Nouveau.getStorage("bp-activity"),s=d.scope||null,d=d.filter||null;q(e.currentTarget).hasClass("load-newest")?(e.preventDefault(),q(e.currentTarget).remove(),i=q.parseHTML(this.heartbeat_data.newest),q.each(i,function(e,t){"LI"===t.nodeName&&q(t).hasClass("just-posted")&&q("#"+q(t).prop("id")).length&&q("#"+q(t).prop("id")).remove()}),(0<(i=q(e.delegateTarget).find(".activity-list .activity-item").first()).length&&i.hasClass("bb-pinned")?q(i).after(this.heartbeat_data.newest):q(e.delegateTarget).find(".activity-list").prepend(this.heartbeat_data.newest)).find("li.activity-item").each(bp.Nouveau.hideSingleUrl).trigger("bp_heartbeat_prepend",this.heartbeat_data),this.heartbeat_data.newest="","all"===s&&q(bp.Nouveau.objectNavParent+' [data-bp-scope="all"]').find("a span").html(""),"mentions"===s&&(bp.Nouveau.ajax({action:"activity_clear_new_mentions"},"activity"),this.mentions_count=0),q(bp.Nouveau.objectNavParent+' [data-bp-scope="'+s+'"]').find("a span").html(""),void 0!==this.heartbeat_data.highlights[s]&&(this.heartbeat_data.highlights[s]=[]),setTimeout(function(){q(e.delegateTarget).find("[data-bp-activity-id]").removeClass("newest_"+s+"_activity")},3e3),q(document).prop("title",this.heartbeat_data.document_title),jQuery(window).scroll()):q(e.currentTarget).hasClass("load-more")&&(t=+Number(this.current_page)+1,a=this,i="",e.preventDefault(),(o=q(e.currentTarget)).find("a").first().addClass("loading"),this.just_posted=[],q(e.delegateTarget).children(".just-posted").each(function(){a.just_posted.push(q(this).data("bp-activity-id"))}),q("#buddypress .dir-search input[type=search]").length&&(i=q("#buddypress .dir-search input[type=search]").val()),bp.Nouveau.objectRequest({object:"activity",scope:s,filter:d,search_terms:i,page:t,method:"append",exclude_just_posted:this.just_posted.join(","),target:"#buddypress [data-bp-list] ul.bp-list"}).done(function(e){!0===e.success&&(o.remove(),a.current_page=t,jQuery(window).scroll())})),q(".activity-item.bb-closed-comments").find(".edit-activity, .acomment-edit").parents(".generic-button").hide()},hideComments:function(e){var a,i,o,e=q(e.target).find(".activity-comments");e.length&&e.each(function(e,t){o=q(t).children("ul").not(".conflict-activity-ul-li-comment"),(i=q(o).find("li").not(q(".document-action-class, .media-action-class, .video-action-class"))).length&&(q("body").hasClass("activity-singular")&&""!==window.location.hash&&q(window.location.hash).length&&0!==q(window.location.hash).closest(".activity-comments").length||(a=q(t).closest(".activity-item"),q("#acomment-comment-"+a.data("bp-activity-id")+" span.comment-count").html(),i.each(function(e,t){if(e"),window.location.hash&&"#"+q(t).attr("id")===window.location.hash)return q(t).parents("li.comment-item").show(),!1;q(t).addClass("bp-hidden").hide()}}),q(o).children(".bp-hidden").length===q(o).children("li").length-1&&q(o).find("li.show-all").length&&q(o).children("li:not(.show-all)").removeClass("bp-hidden").toggle()))})},showActivity:function(e){e.preventDefault();var t=q(e.currentTarget).parent(),a=t.data("parent_comment_id"),t=q(t).data("activity_id");q(document).trigger("activityModalOpened",{activityId:t}),q(e.currentTarget).parents(".activity-comments").find(".ac-form").each(function(){var e=q(this),t=q(this).closest(".activity-comments"),a=q(this).closest(".comment-item");e.find(".post-elements-buttons-item.post-emoji").removeClass("active").empty(""),bp.Nouveau.Activity.resetActivityCommentForm(e,"hardReset"),t.append(e),a.find(".acomment-display").removeClass("display-focus"),a.removeClass("comment-item-focus")}),bp.Nouveau.Activity.launchActivityPopup(t,a)},closeActivity:function(e){e.preventDefault();var t=q(e.target).closest(".bb-activity-model-wrapper"),a=t.find(".bb-modal-activity-footer"),i=t.find(".activity-item").data("bp-activity-id"),e=t.find("#ac-form-"+i);bp.Nouveau.Activity.reinitializeActivityCommentForm(e),_.isUndefined(BP_Nouveau.media)||_.isUndefined(BP_Nouveau.media.emoji)||bp.Nouveau.Activity.initializeEmojioneArea(!1,"",i),t.find("#activity-modal").removeClass("bb-closed-comments"),t.closest("body").removeClass("acomments-modal-open"),t.hide(),t.find("ul.activity-list").empty(),a.removeClass("active"),a.find("form.ac-form").remove()},scopeLoaded:function(e,a){this.current_page=1,"mentions"===a.scope&&void 0!==a.response.new_mentions?(q.each(a.response.new_mentions,function(e,t){q("#buddypress #activity-stream").find('[data-bp-activity-id="'+t+'"]').addClass("newest_mentions_activity")}),this.mentions_count=0):void 0!==this.heartbeat_data.highlights[a.scope]&&this.heartbeat_data.highlights[a.scope].length&&q.each(this.heartbeat_data.highlights[a.scope],function(e,t){q("#buddypress #activity-stream").find('[data-bp-activity-id="'+t+'"]').length&&q("#buddypress #activity-stream").find('[data-bp-activity-id="'+t+'"]').addClass("newest_"+a.scope+"_activity")}),this.heartbeat_data.newest="",q.each(q(bp.Nouveau.objectNavParent+" [data-bp-scope]").find("a span"),function(e,t){0===parseInt(q(t).html(),10)&&q(t).html("")}),void 0!==this.heartbeat_data.highlights[a.scope]&&(this.heartbeat_data.highlights[a.scope]=[]),q(document).prop("title",this.heartbeat_data.document_title),setTimeout(function(){q("#buddypress #activity-stream .activity-item").removeClass("newest_"+a.scope+"_activity")},3e3),void 0!==window.instgrm&&window.instgrm.Embeds.process(),void 0!==window.FB&&void 0!==window.FB.XFBML&&window.FB.XFBML.parse(),this.fixAtWhoActivity(),this.openEditActivityPopup(),this.navigateToSpecificComment(),setTimeout(function(){jQuery(window).scroll()},200)},openEditActivityPopup:function(){var e,t;!_.isUndefined(BP_Nouveau.activity.params.is_activity_edit)&&0 ul");if(e.data.redirect)return window.location.href=e.data.redirect;e.data.parent_activity_id&&e.data.activity&&q("body:not(.activity-singular) #buddypress #activity-stream ul.activity-list li#activity-"+e.data.parent_activity_id).replaceWith(e.data.activity),k&&(x=1,i=B.find(".acomments-view-more").data("child-count"),r.append(B.find("form")),q.each(B.find("li.comment-item"),function(){x+=1}),x+=void 0!==i?parseFloat(i):0,N=m.find("span.comments-count"),z=N.text().length?N.text().match(/\d+/)[0]:0,z=Number(z-x),p.length?(i=1 ul").html().trim()&&t.removeClass("has-child-comments")}),k||r.data("bp-timestamp")!==d.Activity.heartbeat_data.last_recorded||(d.Activity.heartbeat_data.newest="",d.Activity.heartbeat_data.last_recorded=0),q(document).trigger("bp_activity_ajax_delete_request",q.extend(A,{response:e})),q(document).trigger("bp_activity_ajax_delete_request_video",q.extend(A,{response:e})),bp.Nouveau.Activity.activityHasUpdates=!0,bp.Nouveau.Activity.currentActivityId=c}j.removeClass("active")})}if(l.closest("span").hasClass("activity-read-more")){var T=l.closest("div"),U=l.closest("span");if(C=null,q(T).hasClass("activity-inner")?C=c:q(T).hasClass("acomment-content")&&(C=l.closest("li").data("bp-activity-comment-id")),!C)return e;e.preventDefault(),q(U).addClass("loading"),d.ajax({action:"get_single_activity_content",id:C},"activity").done(function(e){"object"!=typeof e&&0/gi,"\n").replace(/<\/div>/gi,""),S={action:"new_activity_comment",_wpnonce_new_activity_comment:q("#_wpnonce_new_activity_comment").val(),comment_id:C,form_id:c,content:R};q("#_bp_as_nonce_"+c).val()&&(S["_bp_as_nonce_"+c]=q("#_bp_as_nonce_"+c).val()),this.dropzone_media.length&&(S.media=this.dropzone_media),this.dropzone_document.length&&(S.document=this.dropzone_document),this.dropzone_video.length&&(S.video=this.dropzone_video,_.isEmpty(S.content)&&(S.content="​")),_.isUndefined(this.models[c])||(n=this.models[c],S.gif_data=this.models[c].get("gif_data")),S.content=S.content.replace(/ /g," "),s.hasClass("acomment-edit")&&(S.edit_comment=!0);var H=0"):t.append("
            ")),H?s.closest("#activity-modal").find(".bb-modal-activity-body .activity-comments, .bb-modal-activity-body .activity-comments .activity-actions").children("ul").append(q(a)):t.children("ul").append(q(a).hide().fadeIn(200)),q(s).find(".ac-input").first().html(""),t.parent().addClass("has-comments"),t.parent().addClass("comments-loaded"),m.addClass("has-comments")),s.removeClass("acomment-edit");t=s.find(".ac-reply-content");if(0'+BP_Nouveau.activity.strings.commentPostError+""):(e=e.responseJSON&&e.responseJSON.message?e.responseJSON.message:e.statusText,s.find(".ac-reply-content").after('
            '+e+"
            "))})}if(l.hasClass("edit")&&l.hasClass("edit-activity")&&(e.preventDefault(),R=r.data("bp-activity"),S=""!==r.data("link-url")?r.data("link-url"):null,void 0!==R&&(bp.Nouveau.Activity.postForm.displayEditActivityForm(R,S),l.closest("li").hasClass("groups")?q("#bp-nouveau-activity-form").addClass("group-activity"):q("#bp-nouveau-activity-form").removeClass("group-activity"),void 0!==bp.Nouveau.Media&&void 0!==bp.Nouveau.Media.Theatre&&(bp.Nouveau.Media.Theatre.is_open_media||bp.Nouveau.Media.Theatre.is_open_document)&&(q(document).find(".bb-close-media-theatre").trigger("click"),q(document).find(".bb-close-document-theatre").trigger("click")))),u&&(l.hasClass("bb-open-media-theatre")||l.hasClass("bb-open-video-theatre")||l.hasClass("bb-open-document-theatre")||l.hasClass("document-detail-wrap-description-popup"))&&(e.preventDefault(),l.closest("#activity-modal").find(".bb-modal-activity-header .bb-close-action-popup").trigger("click")),l.hasClass("pin-activity")||l.hasClass("unpin-activity")){if(e.preventDefault(),!c)return e;l.closest(".activity-item").addClass("loading-pin");var O="pin";l.hasClass("unpin-activity")&&(O="unpin"),d.ajax({action:"activity_update_pinned_post",id:c,pin_action:O},"activity").done(function(e){var t,a,i,o,d,s,n;l.closest(".activity-item").removeClass("loading-pin"),void 0!==(e="object"!=typeof e?JSON.parse(e):e).data&&void 0!==e.data.feedback&&(t=l.closest("ul.activity-list"),n=u?l.closest(".buddypress-wrap").find("#activity-stream"):l.closest("#activity-stream"),e.success&&(a=bp.Nouveau.getStorage("bp-activity","scope"),o=i=!1,d="",l.closest("li.activity-item").hasClass("groups")&&(o=!0,d=(d=l.closest("li.activity-item").attr("class").match(/group-\d+/))[0].replace("group-","")),n.hasClass("single-user")?i=!1:(n.hasClass("activity")&&"all"===a&&!o||n.hasClass("single-group"))&&(i=!0),"pin"===O?(i&&t.find("li.activity-item").removeClass("bb-pinned"),s="li.activity-item:not(.groups)",o&&!n.hasClass("single-group")?s="li.activity-item.group-"+d:o&&n.hasClass("single-group")&&(s="li.activity-item"),t.find(s).each(function(){var e=q(this).find(".unpin-activity");e.removeClass("unpin-activity").addClass("pin-activity"),o?e.find("span").html(BP_Nouveau.activity.strings.pinGroupPost):e.find("span").html(BP_Nouveau.activity.strings.pinPost)}),i&&l.closest("li.activity-item").addClass("bb-pinned"),l.addClass("unpin-activity"),l.removeClass("pin-activity"),l.closest("li.activity-item").hasClass("groups")?l.find("span").html(BP_Nouveau.activity.strings.unpinGroupPost):l.find("span").html(BP_Nouveau.activity.strings.unpinPost)):"unpin"===O&&(l.closest("li.activity-item").removeClass("bb-pinned"),l.addClass("pin-activity"),l.removeClass("unpin-activity"),l.closest("li.activity-item").hasClass("groups")?l.find("span").html(BP_Nouveau.activity.strings.pinGroupPost):l.find("span").html(BP_Nouveau.activity.strings.pinPost)),"all"===a&&i&&(bp.Nouveau.Activity.heartbeat_data.last_recorded=0,bp.Nouveau.refreshActivities())),q(document).trigger("bb_trigger_toast_message",["","
            "+e.data.feedback+"
            ","success",null,!0]))}).fail(function(){l.closest(".activity-item").removeClass("loading-pin"),q(document).trigger("bb_trigger_toast_message",["","
            "+BP_Nouveau.activity.strings.pinPostError+"
            ","error",null,!0])})}if(l.hasClass("bb-icon-bell-slash")||l.hasClass("bb-icon-bell")){if(e.preventDefault(),!c)return e;l.closest(".activity-item").addClass("loading-mute");var Q="mute";l.hasClass("bb-icon-bell")&&(Q="unmute"),d.ajax({action:"toggle_activity_notification_status",id:c,notification_toggle_action:Q},"activity").done(function(e){l.closest(".activity-item").removeClass("loading-mute"),void 0!==(e="object"!=typeof e?JSON.parse(e):e).data&&void 0!==e.data.feedback&&(e.success&&("mute"===Q?(l.closest("li.activity-item").addClass("bb-muted"),l.removeClass("bb-icon-bell-slash"),l.addClass("bb-icon-bell"),l.attr("title",BP_Nouveau.activity.strings.unmuteNotification),l.find("span").html(BP_Nouveau.activity.strings.unmuteNotification)):"unmute"===Q&&(l.closest("li.activity-item").removeClass("bb-muted"),l.removeClass("bb-icon-bell"),l.addClass("bb-icon-bell-slash"),l.attr("title",BP_Nouveau.activity.strings.muteNotification),l.find("span").html(BP_Nouveau.activity.strings.muteNotification)),void 0!==bp.Nouveau.Activity.activityHasUpdates&&(bp.Nouveau.Activity.activityHasUpdates=!0)),q(document).trigger("bb_trigger_toast_message",["","
            "+e.data.feedback+"
            ","success",null,!0])),u&&(bp.Nouveau.Activity.activityPinHasUpdates=!0),bp.Nouveau.Activity.activityHasUpdates=!0,bp.Nouveau.Activity.currentActivityId=c}).fail(function(){l.closest(".activity-item").removeClass("loading-pin"),q(document).trigger("bb_trigger_toast_message",["","
            "+BP_Nouveau.activity.strings.pinPostError+"
            ","error",null,!0])})}if(l.hasClass("close-activity-comment")||l.hasClass("unclose-activity-comment")){if(e.preventDefault(),!c)return e;l.closest(".activity-item").addClass("loading-pin");var V="close_comments";l.hasClass("unclose-activity-comment")&&(V="unclose_comments"),d.ajax({action:"activity_update_close_comments",id:c,close_comments_action:V},"activity").done(function(e){var t;l.closest(".activity-item").removeClass("loading-pin"),void 0!==(e="object"!=typeof e?JSON.parse(e):e).data&&void 0!==e.data.feedback&&(e.success&&(t=q("#activity-stream > .activity-list").find("[data-bp-activity-id="+c+"]"),l.closest(".activity-item").find(".bb-activity-closed-comments-notice").remove(),"close_comments"===V?(l.closest("li.activity-item").addClass("bb-closed-comments"),0'+e.data.feedback+""),0'+e.data.feedback+""))):"unclose_comments"===V&&(l.closest("li.activity-item.bb-closed-comments").find(".edit-activity, .acomment-edit").parents(".generic-button").show(),l.closest("li.activity-item").removeClass("bb-closed-comments"),0"+e.data.feedback+"",e.success?"success":"error",null,!0]))}).fail(function(){l.closest(".activity-item").removeClass("loading-pin"),q(document).trigger("bb_trigger_toast_message",["","
            "+BP_Nouveau.activity.strings.closeCommentsError+"
            ","error",null,!0])})}},commentFormAction:function(e){var t,a;return(e=e||window.event).target?t=e.target:e.srcElement&&(t=e.srcElement),3===t.nodeType&&(t=t.parentNode),!0!==e.altKey&&!0!==e.metaKey&&"TEXTAREA"===t.tagName&&q(t).hasClass("ac-input")?void(27===(a=e.keyCode||e.which)&&!1===e.ctrlKey?"TEXTAREA"===t.tagName&&q(t).closest("form").slideUp(200):e.ctrlKey&&13===a&&q(t).val()&&q(t).closest("form").find("[type=submit]").first().trigger("click")):e},togglePopupDropdown:function(e){var t;return(e=e||window.event).target?t=e.target:e.srcElement&&(t=e.srcElement),3===t.nodeType&&(t=t.parentNode),!0===e.altKey||!0===e.metaKey||q(t).hasClass("privacy-wrap")||q(t).parent().hasClass("privacy-wrap")?e:void q("ul.activity-privacy").removeClass("bb-open")},loadMoreActivities:function(){var e,t=q(".load-more:visible").last(),a=q(window);t.closest(".activity-list").length&&t.get(0)&&!t.data("bp-autoloaded")&&(e=t.offset().top-50,a.scrollTop()+a.height()>e&&(t.data("bp-autoloaded",1),t.find("a").text(BP_Nouveau.activity.strings.loadingMore),t.find("a").trigger("click")))},destroyCommentMediaUploader:function(e){_.isNull(this.dropzone_obj)||(this.dropzone_obj.destroy(),q("#ac-reply-post-media-uploader-"+e).html(""),q("#ac-reply-post-media-uploader-1-"+e).html("")),this.dropzone_media=[],q("#ac-reply-post-media-uploader-"+e).removeClass("open").addClass("closed"),q("#ac-reply-media-button-"+e).removeClass("active")},destroyCommentDocumentUploader:function(e){_.isNull(this.dropzone_document_obj)||(this.dropzone_document_obj.destroy(),q("#ac-reply-post-document-uploader-"+e).html("")),this.dropzone_document=[],q("#ac-reply-post-document-uploader-"+e).removeClass("open").addClass("closed"),q("#ac-reply-document-button-"+e).removeClass("active")},destroyCommentVideoUploader:function(e){_.isNull(this.dropzone_video_obj)||(this.dropzone_video_obj.destroy(),q("#ac-reply-post-video-uploader-"+e).html("")),this.dropzone_video=[],q("#ac-reply-post-video-uploader-"+e).removeClass("open").addClass("closed"),q("#ac-reply-video-button-"+e).removeClass("active")},resetGifPicker:function(e){q("#ac-reply-gif-button-"+e).closest(".post-gif").find(".gif-media-search-dropdown").removeClass("open").empty(),q("#ac-reply-gif-button-"+e).removeClass("active"),q(".gif-media-search-dropdown-standalone").removeClass("open").empty(),_.isUndefined(this.models[e])||(this.models[e].set("gif_data",{}),q("#ac-reply-post-gif-"+e).find(".activity-attached-gif-container").removeAttr("style"))},openCommentsMediaUploader:function(e){var l=this,o=q(e.currentTarget),t=o.data("ac-id"),a=o.closest(".bp-ac-form-container").find("#ac-reply-post-media-uploader-"+t),i=0'+t+""),this.removeFile(e),a.removeClass("media-uploading"))}),l.dropzone_obj.on("removedfile",function(e){if(l.dropzone_media.length)for(var t in l.dropzone_media)if(e.upload.uuid==l.dropzone_media[t].uuid){void 0===l.dropzone_media[t].saved||l.dropzone_media[t].saved||bp.Nouveau.Media.removeAttachment(l.dropzone_media[t].id),l.dropzone_media.splice(t,1);break}var a,i;_.isNull(l.dropzone_obj)||_.isNull(l.dropzone_obj.files)||0!==l.dropzone_obj.files.length?o.closest(".ac-form").addClass("has-content"):(a=o.parents(".ac-reply-toolbar"),(i=o.closest(".ac-form")).removeClass("has-media"),a.find(".ac-reply-document-button")&&a.find(".ac-reply-document-button").parents(".post-elements-buttons-item").removeClass("disable"),a.find(".ac-reply-video-button")&&a.find(".ac-reply-video-button").parents(".post-elements-buttons-item").removeClass("disable"),a.find(".ac-reply-gif-button")&&a.find(".ac-reply-gif-button").parents(".post-elements-buttons-item").removeClass("disable"),a.find(".ac-reply-media-button")&&a.find(".ac-reply-media-button").parents(".post-elements-buttons-item").removeClass("no-click").find(".toolbar-button").removeClass("active"),q(l.dropzone_obj.element).removeClass("files-uploaded dz-progress-view").find(".dz-global-progress").remove(),l.validateCommentContent(i.find(".ac-textarea").children(".ac-input")))}),l.dropzone_obj.on("complete",function(){0===this.getUploadingFiles().length&&0===this.getQueuedFiles().length&&0'+t+""),this.removeFile(e),a.removeClass("media-uploading"))}),l.dropzone_document_obj.on("removedfile",function(e){if(l.dropzone_document.length)for(var t in l.dropzone_document)if(e.upload.uuid==l.dropzone_document[t].uuid){void 0===l.dropzone_document[t].saved||l.dropzone_document[t].saved||bp.Nouveau.Media.removeAttachment(l.dropzone_document[t].id),l.dropzone_document.splice(t,1);break}var a,i;_.isNull(l.dropzone_document_obj)||_.isNull(l.dropzone_document_obj.files)||0!==l.dropzone_document_obj.files.length?o.closest(".ac-form").addClass("has-content"):(a=o.parents(".ac-reply-toolbar"),(i=o.closest(".ac-form")).removeClass("has-media"),a.find(".ac-reply-media-button")&&a.find(".ac-reply-media-button").parents(".post-elements-buttons-item").removeClass("disable"),a.find(".ac-reply-video-button")&&a.find(".ac-reply-video-button").parents(".post-elements-buttons-item").removeClass("disable"),a.find(".ac-reply-gif-button")&&a.find(".ac-reply-gif-button").parents(".post-elements-buttons-item").removeClass("disable"),a.find(".ac-reply-document-button")&&a.find(".ac-reply-document-button").parents(".post-elements-buttons-item").removeClass("no-click").find(".toolbar-button").removeClass("active"),q(l.dropzone_document_obj.element).removeClass("files-uploaded dz-progress-view").find(".dz-global-progress").remove(),l.validateCommentContent(i.find(".ac-textarea").children(".ac-input")))}),l.dropzone_document_obj.on("complete",function(){0===this.getUploadingFiles().length&&0===this.getQueuedFiles().length&&0'),q(e.previewElement).closest(".dz-preview").addClass("dz-has-thumbnail")):bp.Nouveau.getVideoThumb&&bp.Nouveau.getVideoThumb(e,".dz-video-thumbnail")}),l.dropzone_video_obj.on("uploadprogress",function(){o.closest(".ac-form").addClass("media-uploading"),bp.Nouveau.dropZoneGlobalProgress&&bp.Nouveau.dropZoneGlobalProgress(this)}),l.dropzone_video_obj.on("success",function(e,t){if(100===e.upload.progress&&(q(e.previewElement).find(".dz-progress-ring circle")[0].style.strokeDashoffset=0,q(e.previewElement).find(".dz-progress-count").text("100% "+BP_Nouveau.video.i18n_strings.video_uploaded_text),q(e.previewElement).closest(".dz-preview").addClass("dz-complete")),t.data.id)return e.id=t.id,t.data.uuid=e.upload.uuid,t.data.menu_order=q(e.previewElement).closest(".dropzone").find(e.previewElement).index()-1,t.data.album_id=void 0!==BP_Nouveau.video&&void 0!==BP_Nouveau.video.album_id&&BP_Nouveau.video.album_id,t.data.group_id=void 0!==BP_Nouveau.video&&void 0!==BP_Nouveau.video.group_id&&BP_Nouveau.video.group_id,t.data.saved=!1,t.data.js_preview=q(e.previewElement).find(".dz-video-thumbnail img").attr("src"),l.dropzone_video.push(t.data),e.previewElement.classList.add("dz-success");var a,i,o,d,s,n=t.data.feedback;for(e.previewElement.classList.add("dz-error"),s=[],i=0,o=(d=e.previewElement.querySelectorAll("[data-dz-errormessage]")).length;i'+t+""),this.removeFile(e),a.removeClass("media-uploading"))}),l.dropzone_video_obj.on("removedfile",function(e){if(l.dropzone_video.length)for(var t in l.dropzone_video)if(e.upload.uuid==l.dropzone_video[t].uuid){void 0===l.dropzone_video[t].saved||l.dropzone_video[t].saved||bp.Nouveau.Media.removeAttachment(l.dropzone_video[t].id),l.dropzone_video.splice(t,1);break}var a,i;_.isNull(l.dropzone_video_obj)||_.isNull(l.dropzone_video_obj.files)||0!==l.dropzone_video_obj.files.length?o.closest(".ac-form").addClass("has-content"):(a=o.parents(".ac-reply-toolbar"),(i=o.closest(".ac-form")).removeClass("has-media"),a.find(".ac-reply-media-button")&&a.find(".ac-reply-media-button").parents(".post-elements-buttons-item").removeClass("disable"),a.find(".ac-reply-document-button")&&a.find(".ac-reply-document-button").parents(".post-elements-buttons-item").removeClass("disable"),a.find(".ac-reply-gif-button")&&a.find(".ac-reply-gif-button").parents(".post-elements-buttons-item").removeClass("disable"),a.find(".ac-reply-video-button")&&a.find(".ac-reply-video-button").parents(".post-elements-buttons-item").removeClass("no-click").find(".toolbar-button").removeClass("active"),q(l.dropzone_video_obj.element).removeClass("files-uploaded dz-progress-view").find(".dz-global-progress").remove(),l.validateCommentContent(i.find(".ac-textarea").children(".ac-input")))}),l.dropzone_video_obj.on("complete",function(){0===this.getUploadingFiles().length&&0===this.getQueuedFiles().length&&0/gi,"\n").replace(/<\/div>/gi,""))).replace(/ /g," ");""!==e.text().trim()||0<=t.indexOf("emojioneemoji")||e.closest("form").hasClass("acomment-edit")?e.closest("form").addClass("has-content"):e.closest("form").removeClass("has-content")},ReactionStatePopupTab:function(e){e.preventDefault(),q(this).closest(".activity-state-popup").find(".activity-state-popup_tab_panel li a").removeClass("active"),q(this).addClass("active"),q(this).closest(".activity-state-popup").find(".activity-state-popup_tab_content .activity-state-popup_tab_item").removeClass("active"),q(this).closest(".activity-state-popup").find("."+q(this).data("tab")).addClass("active")},closeActivityState:function(){q(".activity-state-popup").hide().removeClass("active")},listenCommentInput:function(e){var t,a;0/gi,"\n").replace(/<\/div>/gi,""));t=t.replace(/ /g," "),""!==jQuery(e.currentTarget).text().trim()||0<=t.indexOf("emojioneemoji")?jQuery(e.currentTarget).closest("form").addClass("has-content"):jQuery(e.currentTarget).closest("form").removeClass("has-content")}),q(t).closest("form").addClass("events-initiated"),this.InitiatedCommentForms.push(a)))},activityRootComment:function(e){var t=q(e.currentTarget).closest("#activity-modal"),a=t.find(".activity-item").data("bp-activity-id"),e=t.find("#ac-form-"+a);bp.Nouveau.Activity.resetActivityCommentForm(e,"hardReset"),t.find(".acomment-display").removeClass("display-focus"),t.find(".comment-item").removeClass("comment-item-focus"),t.find(".bb-modal-activity-footer").addClass("active").append(e),e.addClass("root"),e.find("#ac-input-"+a).focus(),bp.Nouveau.Activity.clearFeedbackNotice(e)},clearFeedbackNotice:function(e){e.find(".bp-ac-form-container").find(".bp-feedback").length&&e.find(".bp-ac-form-container").find(".bp-feedback").remove()},launchActivityPopup:function(e,t){var a=q("#activity-"+e),i=q(".bb-activity-model-wrapper"),o=a[0].outerHTML,d='[data-parent_comment_id="'+t+'"]',t=a.data("activity-popup-title");bp.Nouveau.Activity.activityHasUpdates=!1,bp.Nouveau.Activity.currentActivityId=null,bp.Nouveau.Activity.activityPinHasUpdates=!1,i.closest("body").addClass("acomments-modal-open"),i.show(),i.find("ul.activity-list").html(o),i.find(".bb-modal-activity-header h2").text(t),i.find(".bb-activity-video-elem").each(function(e,t){var o=q(t);o.find("video").each(function(e,t){var a=q(t),i=a.attr("id")+Math.floor(1e4*Math.random());a.attr("id",i);t=o.find(".video-action-wrap");a.insertAfter(t),o.find(".video-js").remove(),a.addClass("video-js"),videojs(i,{controls:!0,aspectRatio:"16:9",fluid:!0,playbackRates:[.5,1,1.5,2],fullscreenToggle:!1})})}),a.hasClass("bb-closed-comments")&&i.find("#activity-modal").addClass("bb-closed-comments");t=i.find("#ac-form-"+e);i.find(".acomment-display").removeClass("display-focus"),i.find(".comment-item").removeClass("comment-item-focus"),i.find(".bb-modal-activity-footer").addClass("active").append(t),t.removeClass("not-initialized").addClass("root"),t.find("#ac-input-"+e).focus(),bp.Nouveau.Activity.clearFeedbackNotice(t),t.removeClass("events-initiated");a=i.find(".bb-modal-activity-footer").find(".ac-input[contenteditable]");bp.Nouveau.Activity.listenCommentInput(a),i.find(".bb-activity-more-options-wrap .bb-activity-more-options-action, .bb-pin-action_button, .bb-mute-action_button").attr("data-balloon-pos","left"),i.find(".privacy-wrap").attr("data-bp-tooltip-pos","right"),i.find(d).children(".acomments-view-more").first().trigger("click"),_.isUndefined(BP_Nouveau.media)||_.isUndefined(BP_Nouveau.media.emoji)||bp.Nouveau.Activity.initializeEmojioneArea(!0,"#activity-modal ",e),void 0!==bp.Nouveau&&bp.Nouveau.reportPopUp(),bp.Nouveau.Activity.toggleMultiMediaOptions(t,"",".bb-modal-activity-footer")},viewMoreComments:function(e){e.preventDefault();var t=q(e.currentTarget).parent(),i=q(e.currentTarget),o=q(t).data("activity_id"),d=q(e.currentTarget).closest(".activity-comments"),s=q(e.currentTarget).closest(".activity-item"),n=q(t).data("parent_comment_id"),l="";i.addClass("loading").removeClass("acomments-view-more--hide"),d.addClass("active"),s.addClass("active"),i.html('
            ');var a={action:"activity_loadmore_comments",activity_id:o,parent_comment_id:n,offset:q(e.currentTarget).parents(".activity-comments").find('ul[data-parent_comment_id ="'+n+'"] > li.comment-item:not(.bb-recent-comment)').length,activity_type_is_blog:1"+e.data.message+"

            ").removeClass("acomments-view-more--hide"),d.removeClass("active"),s.removeClass("active")):void 0!==e.data&&void 0!==e.data.comments&&(t=q(".bb-internal-model .activity-comments").find("[data-activity_id='"+o+"'][data-parent_comment_id='"+n+"']"),a=q(q.parseHTML(e.data.comments)),0"+e.statusText+"

            ").removeClass("acomments-view-more--hide"),d.removeClass("active"),s.removeClass("active")})},autoloadMoreComments:function(){var e,t,a,i,o;0 ul > li.acomments-view-more:not(.loading), .bb-modal-activity-body .activity-comments .activity-actions > ul > li.acomments-view-more:not(.loading)"),o=q(".bb-activity-model-wrapper .bb-modal-activity-body"),i=q(".bb-activity-model-wrapper .bb-modal-activity-body").find(".activity-comments:not(.active)"),0a&&q(e).trigger("click").addClass("loading")),setTimeout(function(){jQuery(window).scroll()},200))},activitySyncOnModalClose:function(e,t){e.preventDefault();var e=(q(e.currentTarget).is(document)?q(".bb-activity-model-wrapper"):q(e.currentTarget).parents(".bb-activity-model-wrapper")).find("ul.activity-list > li").data("bp-activity-id"),e=void 0!==t?t:e,a=q("#activity-stream li.activity-item[data-bp-activity-id="+e+"]");0 .bb-modal-activity-body .activity-item").data("bp-activity-id");0/gi,"\n").replace(/<\/div>/gi,""));t=t.replace(/ /g," "),""!==e.text()||0<=t.indexOf("emojioneemoji")?e.closest("form").addClass("has-content"):e.closest("form").removeClass("has-content")},picker_show:function(){q(this.button[0]).closest(".post-emoji").addClass("active"),q(".emojionearea-theatre").removeClass("hide").addClass("show")},picker_hide:function(){q(this.button[0]).closest(".post-emoji").removeClass("active"),q(".emojionearea-theatre").removeClass("show").addClass("hide")}}})}},bp.Nouveau.Activity.start())}((bp,jQuery)); \ No newline at end of file diff --git a/src/bp-templates/bp-nouveau/js/buddypress-nouveau.js b/src/bp-templates/bp-nouveau/js/buddypress-nouveau.js index 51df5b0eca..cf2766605c 100644 --- a/src/bp-templates/bp-nouveau/js/buddypress-nouveau.js +++ b/src/bp-templates/bp-nouveau/js/buddypress-nouveau.js @@ -3060,7 +3060,8 @@ window.bp = window.bp || {}; if ( ! _.isUndefined( BP_Nouveau.media ) && ! _.isUndefined( BP_Nouveau.media.emoji ) && ! $targetEl.closest( '.post-emoji' ).length && - ! $targetEl.is( '.emojioneemoji,.emojibtn' ) ) { + ! $targetEl.is( '.emojioneemoji,.emojibtn' ) && + ! $targetEl.closest( '.emojionearea-theatre' ).length ) { $( '.post-emoji.active, .emojionearea-button.active' ).removeClass( 'active' ); if ( $( '.emojionearea-theatre.show' ).length > 0 ) { $( '.emojionearea-theatre' ).removeClass( 'show' ).addClass( 'hide' ); diff --git a/src/bp-templates/bp-nouveau/js/buddypress-nouveau.min.js b/src/bp-templates/bp-nouveau/js/buddypress-nouveau.min.js index bf50f99859..31af923724 100644 --- a/src/bp-templates/bp-nouveau/js/buddypress-nouveau.min.js +++ b/src/bp-templates/bp-nouveau/js/buddypress-nouveau.min.js @@ -1 +1 @@ -window.wp=window.wp||{},window.bp=window.bp||{},function(h){"undefined"!=typeof BP_Nouveau&&(bp.Nouveau={start:function(){this.setupGlobals(),this.prepareDocument(),this.initObjects(),this.setHeartBeat(),this.addListeners(),this.switchGridList(),this.sendInvitesRevokeAccess(),this.sentInvitesFormValidate(),this.registerPopUp(),this.loginPopUp(),this.reportPopUp(),this.reportActions(),this.reportedPopup(),this.togglePassword(),this.enableSubmitOnLegalAgreement(),this.profileNotificationSetting(),this.xProfileBlock(),"undefined"!=typeof BB_Nouveau_Presence&&this.userPresenceStatus();var r=this;h(document).on("bb_trigger_toast_message",function(e,t,i,a,n,o,s){r.bbToastMessage(t,i,a,n,o,s)}),bp.Nouveau.lazyLoad(".lazy"),h(window).on("scroll resize",function(){bp.Nouveau.lazyLoad(".lazy")})},bbToastMessage:function(e,t,i,a,n,o){var s,r,d,l,c,p,u;function b(){h(r).removeClass("pull-animation").addClass("close-item").delay(500).remove()}t&&""!=t.trim()&&(s="unique-"+Math.floor(1e6*Math.random()),r="."+s,d="",o=o&&"number"==typeof o?1e3*o:5e3,null!==a&&(d="has-url"),p=c=l="",p+='
            ',p+='
            ',e&&(p+=''+e+""),t&&(p+=''+t+""),p+="
            ",p+='
            ',p+=a?'':"",h((h(".bb-toast-messages-enable").length||(h(".bb-onscreen-notification-enable ul.notification-list").length?(u=h(".bb-onscreen-notification").hasClass("bb-position-left")?"left":"right",u=h('
              '),h(".bb-onscreen-notification").show(),h(u).insertBefore(".bb-onscreen-notification-enable ul.notification-list")):(u=h('
                '),h("body").append(u))),".bb-toast-messages-enable .toast-messages-list")).append('
              • '+p+"
              • "),n&&setInterval(function(){b()},o),h(r+" .actions .action-close").on("click",function(){b()}))},setupGlobals:function(){this.ajax_request=null,this.objects=h.map(BP_Nouveau.objects,function(e){return e}),this.objectNavParent=BP_Nouveau.object_nav_parent,this.heartbeat=wp.heartbeat||!1,this.querystring=this.getLinkParams()},prepareDocument:function(){var i;h("body").hasClass("no-js")&&h("body").removeClass("no-js").addClass("js"),BP_Nouveau.warnings&&"undefined"!=typeof console&&console.warn&&h.each(BP_Nouveau.warnings,function(e,t){console.warn(t)}),h(".buddypress_object_nav .widget-title").length&&(i=h(".buddypress_object_nav .widget-title").html(),h("body").find('*:contains("'+i+'")').each(function(e,t){h(t).hasClass("widget-title")||i!==h(t).html()||h(t).is("a")||h(t).remove()}))},getStorage:function(e,t){e=(e=sessionStorage.getItem(e))?JSON.parse(e):{};return void 0!==t?e[t]||!1:e},setStorage:function(e,t,i){var a=this.getStorage(e);return void 0===i&&void 0!==a[t]?delete a[t]:a[t]=i,sessionStorage.setItem(e,JSON.stringify(a)),null!==sessionStorage.getItem(e)},getLinkParams:function(e,t){e=e?-1!==e.indexOf("?")?"?"+e.split("?")[1]:"":document.location.search;if(!e)return null;e=e.replace(/(^\?)/,"").split("&").map(function(e){return this[(e=e.split("="))[0]]=e[1],this}.bind({}))[0];return t?e[t]:e},urlDecode:function(e,t){var i=t||{amp:"&",lt:"<",gt:">",quot:'"',"#039":"'"};return decodeURIComponent(e.replace(/\+/g," ")).replace(/&([^;]+);/g,function(e,t){return i[t]||""})},ajax:function(e,t,i){this.ajax_request&&void 0===i&&this.ajax_request.abort();e=h.extend({},bp.Nouveau.getStorage("bp-"+t),{nonce:BP_Nouveau.nonces[t]},e);return void 0!==BP_Nouveau.customizer_settings&&(e.customized=BP_Nouveau.customizer_settings),void 0!==BP_Nouveau.modbypass&&(e.modbypass=BP_Nouveau.modbypass),this.ajax_request=h.post(BP_Nouveau.ajaxurl,e,"json"),this.ajax_request},inject:function(e,t,i){h(e).length&&t&&(("append"===(i=i||"reset")?h(e).append(t):"prepend"===i?h(e).prepend(t):"after"===i?h(e).after(t):h(e).html(t)).find("li.activity-item").each(this.hideSingleUrl),"undefined"==typeof bp_mentions&&void 0===bp.mentions||(h(".bp-suggestions").bp_mentions(bp.mentions.users),h("#whats-new").on("inserted.atwho",function(){var e;window.getSelection&&document.createRange?(e=window.getSelection&&window.getSelection())&&0 p").removeAttr("br").removeAttr("a").text(),t="",i="",a="",n=0;if(0<=e.indexOf("http://")?(a=e.indexOf("http://"),n=1):0<=e.indexOf("https://")?(a=e.indexOf("https://"),n=1):0<=e.indexOf("www.")&&(a=e.indexOf("www"),n=1),1===n){for(var o=a;o p:first").hide()}},objectRequest:function(a){var e,n,o=this;if((a=h.extend({object:"",scope:null,filter:null,target:"#buddypress [data-bp-list]",search_terms:"",page:1,extras:null,caller:null,template:null,method:"reset"},a)).object&&a.target)return"activity"==a.object&&"#buddypress [data-bp-list] ul.bp-list"==a.target&&(a.target="#buddypress [data-bp-list] ul.bp-list:not(#bb-media-model-container ul.bp-list)"),["members","activity","media","document"].includes(a.object)&&!h(this.objectNavParent+' [data-bp-scope="'+a.scope+'"]').length&&(a.scope="all"),a.search_terms&&(a.search_terms=a.search_terms.replace(//g,">")),null!==a.scope&&this.setStorage("bp-"+a.object,"scope",a.scope),null!==a.filter&&this.setStorage("bp-"+a.object,"filter",a.filter),null!==a.extras&&this.setStorage("bp-"+a.object,"extras",a.extras),h(this.objectNavParent+" [data-bp-object]").each(function(){h(this).removeClass("selected loading")}),(h(this.objectNavParent+' [data-bp-scope="'+a.scope+'"]').length?h(this.objectNavParent+' [data-bp-scope="'+a.scope+'"], #object-nav li.current'):h(this.objectNavParent+" [data-bp-scope]:eq(0), #object-nav li.current")).addClass("selected loading"),0===h(this.objectNavParent+' [data-bp-scope="'+a.scope+'"]').length&&(e=["group_members"===a.object&&h("body").hasClass("group-members"),"activity"===a.object&&h("body.groups").hasClass("activity"),"document"===a.object&&h("body").hasClass("documents"),"manage_group_members"===a.object&&h("body").hasClass("manage-members"),"document"===a.object&&(h("body").hasClass("document")||h("body").hasClass("documents"))],n=[h(".groups .group-search.members-search"),h(".groups .group-search.activity-search"),h(".documents .bp-document-listing .bb-title"),h(".groups .group-search.search-wrapper"),h("#bp-media-single-folder .bb-title")],e.forEach(function(e,t){e&&n[t].addClass("loading")})),h('#buddypress [data-bp-filter="'+a.object+'"] option[value="'+a.filter+'"]').prop("selected",!0),"friends"===a.object||"group_members"===a.object||"manage_group_members"===a.object?(a.template=a.object,a.object="members"):"group_requests"===a.object?(a.object="groups",a.template="group_requests"):"group_subgroups"===a.object?(a.object="groups",a.template="group_subgroups"):"notifications"===a.object&&(a.object="members",a.template="member_notifications"),e=h.extend({action:a.object+"_filter"},a),this.ajax(e,a.object).done(function(e){if(!1!==e.success&&!_.isUndefined(e.data)){if(_.isUndefined(e.data.layout)||(h(".layout-view").removeClass("active"),h(".layout-"+e.data.layout+"-view").addClass("active")),!h("body.group-members.members.buddypress").length||_.isUndefined(e.data)||_.isUndefined(e.data.count)||h("body.group-members.members.buddypress ul li#members-groups-li").find("span").text(e.data.count),h(o.objectNavParent+' [data-bp-scope="'+a.scope+'"]').removeClass("loading"),h(o.objectNavParent+' [data-bp-scope="'+a.scope+'"]').find("span").text(""),0===h(o.objectNavParent+' [data-bp-scope="'+a.scope+'"]').length&&n.forEach(function(e){e.removeClass("loading")}),_.isUndefined(e.data)||_.isUndefined(e.data.count)||h(o.objectNavParent+' [data-bp-scope="'+a.scope+'"]').find("span").text(e.data.count),!_.isUndefined(e.data)&&!_.isUndefined(e.data.scopes))for(var t in e.data.scopes)h(o.objectNavParent+' [data-bp-scope="'+t+'"]').find("span").text(e.data.scopes[t]);var i;"reset"!==a.method?(o.inject(a.target,e.data.contents,a.method),h(a.target).trigger("bp_ajax_"+a.method,h.extend(a,{response:e.data}))):"pag-bottom"===a.caller?(i=null,i=h("#subnav").length?h("#subnav").parent():h(a.target),h("html,body").animate({scrollTop:i.offset().top},"slow",function(){h(a.target).fadeOut(100,function(){o.inject(this,e.data.contents,a.method),h(this).fadeIn(100),h(a.target).trigger("bp_ajax_request",h.extend(a,{response:e.data})),bp.Nouveau.lazyLoad&&setTimeout(function(){bp.Nouveau.lazyLoad(".lazy")},1e3)})})):h(a.target).fadeOut(100,function(){o.inject(this,e.data.contents,a.method),h(this).fadeIn(100),h(a.target).trigger("bp_ajax_request",h.extend(a,{response:e.data})),bp.Nouveau.lazyLoad&&setTimeout(function(){bp.Nouveau.lazyLoad(".lazy")},1e3)}),setTimeout(function(){o.reportPopUp(),o.reportedPopup(),h(".activity-item.bb-closed-comments").find(".edit-activity, .acomment-edit").parents(".generic-button").hide()},1e3)}})},initObjects:function(){var a,n=this,o={},s="all",r="",d=null,l=null;h.each(this.objects,function(e,t){var i;h('#buddypress [data-bp-list="'+t+'"][data-ajax="false"]').length||(a=n.getStorage("bp-"+t),void 0!==(i=window.location.hash.substr(1))&&"following"==i?s=i:void 0!==a.scope&&(s=a.scope),void 0!==a.extras&&"notifications"!==t&&(d=a.extras),h('#buddypress [data-bp-filter="'+t+'"]').length&&(void 0!==a.filter?(l=a.filter,h('#buddypress [data-bp-filter="'+t+'"] option[value="'+l+'"]').prop("selected",!0)):"-1"!==h('#buddypress [data-bp-filter="'+t+'"]').val()&&"0"!==h('#buddypress [data-bp-filter="'+t+'"]').val()&&(l=h('#buddypress [data-bp-filter="'+t+'"]').val())),h(this.objectNavParent+' [data-bp-object="'+t+'"]').length&&(h(this.objectNavParent+' [data-bp-object="'+t+'"]').each(function(){h(this).removeClass("selected")}),h(this.objectNavParent+' [data-bp-scope="'+t+'"], #object-nav li.current').addClass("selected")),null!==n.querystring&&(void 0!==n.querystring[t+"_search"]?r=decodeURI(n.querystring[t+"_search"]):void 0!==n.querystring.s&&(r=decodeURI(n.querystring.s)),r&&h('#buddypress [data-bp-search="'+t+'"] input[type=search]').val(r)),h('#buddypress [data-bp-list="'+t+'"]').length&&(o={object:t,scope:s,filter:l,search_terms:r,extras:d},h('#buddypress [data-bp-member-type-filter="'+t+'"]').length?o.member_type_id=h('#buddypress [data-bp-member-type-filter="'+t+'"]').val():h('#buddypress [data-bp-group-type-filter="'+t+'"]').length&&(o.group_type=h('#buddypress [data-bp-group-type-filter="'+t+'"]').val()),n.objectRequest(o)))})},setHeartBeat:function(){void 0!==BP_Nouveau.pulse&&this.heartbeat&&(this.heartbeat.interval(Number(BP_Nouveau.pulse)),h.fn.extend({"heartbeat-send":function(){return this.bind("heartbeat-send")}}),h.fn.extend({"heartbeat-tick":function(){return this.bind("heartbeat-tick")}}))},addListeners:function(){h("[data-bp-disable-input]").on("change",this.toggleDisabledInput),h(this.objectNavParent+" .bp-navs").on("click","a",this,this.scopeQuery),h(document).on("change","#buddypress [data-bp-filter]",this,this.filterQuery),h(document).on("change","#buddypress [data-bp-group-type-filter]",this,this.typeGroupFilterQuery),h(document).on("change","#buddypress [data-bp-member-type-filter]",this,this.typeMemberFilterQuery),h("#buddypress [data-bp-search]").on("submit","form",this,this.searchQuery),h("#buddypress [data-bp-search]").on("keyup","input[name=group_members_search]",this,_.throttle(this.searchQuery,900)),h("#buddypress [data-bp-search] form").on("search","input[type=search]",this.resetSearch),h("#buddypress [data-bp-list], #buddypress #item-header, #buddypress.bp-shortcode-wrap .dir-list, #buddypress .bp-messages-content").on("click","[data-bp-btn-action]",this,this.buttonAction),h("#buddypress [data-bp-list], #buddypress #item-header, #buddypress.bp-shortcode-wrap .dir-list, #buddypress .messages-screen").on("blur","[data-bp-btn-action]",this,this.buttonRevert),h("#buddypress [data-bp-list], #buddypress #item-header, #buddypress.bp-shortcode-wrap .dir-list, #buddypress .messages-screen").on("mouseover","[data-bp-btn-action]",this,this.buttonHover),h("#buddypress [data-bp-list], #buddypress #item-header, #buddypress.bp-shortcode-wrap .dir-list, #buddypress .messages-screen").on("mouseout","[data-bp-btn-action]",this,this.buttonHoverout),h("#buddypress [data-bp-list], #buddypress #item-header, #buddypress.bp-shortcode-wrap .dir-list, #buddypress .messages-screen").on("mouseover",".awaiting_response_friend",this,this.awaitingButtonHover),h("#buddypress [data-bp-list], #buddypress #item-header, #buddypress.bp-shortcode-wrap .dir-list, #buddypress .messages-screen").on("mouseout",".awaiting_response_friend",this,this.awaitingButtonHoverout),h(document).on("click","#buddypress .bb-leave-group-popup .bb-confirm-leave-group",this.leaveGroupAction),h(document).on("click","#buddypress .bb-leave-group-popup .bb-close-leave-group",this.leaveGroupClose),h(document).on("click","#buddypress .bb-remove-connection .bb-confirm-remove-connection",this.removeConnectionAction),h(document).on("click","#buddypress .bb-remove-connection .bb-close-remove-connection",this.removeConnectionClose),h(document).on("click","#buddypress table.invite-settings .field-actions .field-actions-remove, #buddypress table.invite-settings .field-actions-add",this,this.addRemoveInvite),h(document).on("click",".show-action-popup",this.showActionPopup),h(document).on("click","#message-threads .block-member",this.threadListBlockPopup),h(document).on("click","#message-threads .report-content",this.threadListReportPopup),h(document).on("click",".bb-close-action-popup, .action-popup-overlay",this.closeActionPopup),h(document).on("keyup",'.search-form-has-reset input[type="search"], .search-form-has-reset input#bbp_search',_.throttle(this.directorySearchInput,900)),h(document).on("click",".search-form-has-reset .search-form_reset",this.resetDirectorySearch),h(document).on("keyup",this,this.keyUp),h("[data-bp-close]").on("click",this,this.closeNotice),h("#buddypress [data-bp-list]").on("click","[data-bp-pagination] a",this,this.paginateAction),h(document).on("click",this.closePickersOnClick),document.addEventListener("keydown",this.closePickersOnEsc),h(document).on("click","#item-header a.position-change-cover-image, .header-cover-reposition-wrap a.cover-image-save, .header-cover-reposition-wrap a.cover-image-cancel",this.coverPhotoCropper),h(document).on("click","#cover-photo-alert .bb-model-close-button",this.coverPhotoCropperAlert),h(document).on("click",this.toggleMoreOption.bind(this)),h(document).on("heartbeat-send",this.bbHeartbeatSend.bind(this)),h(document).on("heartbeat-tick",this.bbHeartbeatTick.bind(this)),bp.Nouveau.notificationRemovedAction(),bp.Nouveau.removeAllNotification(),bp.Nouveau.setTitle(),h(document).on("click",".more-following .count-more",this.bbWidgetMoreFollowing),h(".bb-accordion .bb-accordion_trigger").on("click",this.toggleAccordion)},bbHeartbeatSend:function(e,t){t.onScreenNotifications=!0,h("#buddypress").trigger("bb_heartbeat_send",t)},bbHeartbeatTick:function(e,t){bp.Nouveau.bbInjectOnScreenNotifications(e,t)},bbInjectOnScreenNotifications:function(e,t){var i,a,n,o,s,r;"1"==h(".bb-onscreen-notification").data("enable")&&(void 0===t.on_screen_notifications&&""===t.on_screen_notifications||(i=h(".bb-onscreen-notification"),r=(a=i.find(".notification-list")).data("removed-items"),n=a.data("animated-items"),o=[],s=h(h.parseHTML("
                  "+t.on_screen_notifications+"
                ")),h.each(r,function(e,t){t=s.find("[data-notification-id="+t+"]");t.length&&t.closest(".read-item").remove()}),(r=s.find(".read-item")).each(function(e,t){var i=h(t).find(".actions .action-close").data("notification-id");"-1"==h.inArray(i,n)?(h(t).addClass("pull-animation"),n.push(i),o.push(i)):h(t).removeClass("pull-animation")}),o.length&&r.each(function(e,t){var i=h(t).find(".actions .action-close").data("notification-id");"-1"==h.inArray(i,o)&&(h(t).removeClass("recent-item"),(t=a.data("border-items")).push(i),a.attr("data-border-items",JSON.stringify(t)))}),a.attr("data-animated-items",JSON.stringify(n)),r.length&&(i.removeClass("close-all-items"),r.eq(2).nextAll().addClass("bb-more-item"),3 li").each(function(){h(this).removeClass("pull-animation").addClass("close-item").delay(500).remove()}),h(".toast-messages-list > li").each(function(){h(this).removeClass("pull-animation").addClass("close-item").delay(500).remove()}),t.removeClass("bb-more-than-3")})},setTitle:function(){var e=h("html head").find("title").text();h(".bb-onscreen-notification").attr("data-title-tag",e)},visibilityOnScreenClearButton:function(){var e=h(".bb-onscreen-notification");1 tbody > tr").each(function(){h(this).find('input[type="text"]').removeAttr("style"),h(this).find('input[type="email"]').removeAttr("style")}),h("body.send-invites #send-invite-form #member-invites-table > tbody > tr").each(function(){e=h.trim(h(this).find('input[type="text"]').val()),i=h(this).find("input").attr("id"),t=h.trim(h(this).find('input[type="email"]').val()),""===e&&""===t?0:""!==e&&""===t?(i=h(this).find('input[type="email"]').attr("id"),a.push(i)):""===e&&""!==t?(i=h(this).find('input[type="text"]').attr("id"),a.push(i)):l.test(t)?n.push(1):(i=h(this).find('input[type="email"]').attr("id"),a.push(i))}),h(".span_error").remove(),0!==a.length)return a.forEach(function(e){h("#"+e).attr("style","border:1px solid #ef3e46"),-1!==e.indexOf("email_")?h("#"+e).after(''+p+""):h("#"+e).after(''+c+"")}),h("html, body").animate({scrollTop:h("#item-body").offset().top},2e3),alert(u),!1;if(h("#email_0_email_error").length&&h("#email_0_email_error").remove(),0===n.length){o=h("#invitee_0_title").val(),s=h("#email_0_email").val();return""===o&&""===s?(h("#invitee_0_title").attr("style","border:1px solid #ef3e46"),h("#invitee_0_title").focus(),h("#email_0_email").attr("style","border:1px solid #ef3e46"),!1):(""!==o&&""===s?(h("#email_0_email").attr("style","border:1px solid #ef3e46"),h("#email_0_email").focus()):(l.test(s)||(h("#email_0_email").attr("style","border:1px solid #ef3e46"),h("#email_0_email").focus(),h("#email_0_email_error").remove(),h("#email_0_email").after(''+p+"")),alert(u)),!1)}})},sendInvitesRevokeAccess:function(){h("body.sent-invites #member-invites-table").length&&h("body.sent-invites #member-invites-table tr td span a.revoked-access").click(function(e){e.preventDefault();var t=h(this).attr("data-name"),i=h(this).attr("id"),e=h(this).attr("data-revoke-access");if(!confirm(t))return!1;h.ajax({url:e,type:"post",data:{item_id:i},success:function(){window.location.reload(!0)}})})},toggleDisabledInput:function(){var e=h(this).attr("data-bp-disable-input");h(e).prop("disabled",!0)&&!h(this).hasClass("enabled")?(h(this).addClass("enabled").removeClass("disabled"),h(e).prop("disabled",!1)):h(e).prop("disabled",!1)&&h(this).hasClass("enabled")&&(h(this).removeClass("enabled").addClass("disabled"),h(e).attr("disabled","disabled"))},keyUp:function(e){var t=e.data;27===e.keyCode&&t.buttonRevertAll()},scopeQuery:function(e){var t,i,a=e.data,n=h(e.currentTarget).parent(),o="",s=null,r={};if(n.hasClass("no-ajax")||h(e.currentTarget).hasClass("no-ajax")||!n.attr("data-bp-scope"))return e;if(t=n.data("bp-scope"),i=n.data("bp-object"),!t||!i)return e;e.preventDefault();var e=a.getStorage("bp-"+i);void 0!==e.extras&&"notifications"!==i&&(s=e.extras),e=h("#buddypress").find('[data-bp-filter="'+i+'"]').first().val(),h('#buddypress [data-bp-search="'+i+'"] input[type=search]').length&&(o=h('#buddypress [data-bp-search="'+i+'"] input[type=search]').val()),n.hasClass("dynamic")&&n.find("a span").html(""),r={object:i,scope:t,filter:e,search_terms:o,page:1,extras:s},h('#buddypress [data-bp-member-type-filter="'+i+'"]').length?r.member_type_id=h('#buddypress [data-bp-member-type-filter="'+i+'"]').val():h('#buddypress [data-bp-group-type-filter="'+i+'"]').length&&(r.group_type=h('#buddypress [data-bp-group-type-filter="'+i+'"]').val()),a.objectRequest(r)},filterQuery:function(e){var t=e.data,i=h(e.target).data("bp-filter"),a="all",n=h(e.target).val(),o="",s=!1;if(!i)return e;h(t.objectNavParent+" [data-bp-object].selected").length&&(a=h(t.objectNavParent+" [data-bp-object].selected").data("bp-scope")),h('#buddypress [data-bp-search="'+i+'"] input[type=search]').length&&(o=h('#buddypress [data-bp-search="'+i+'"] input[type=search]').val());e=t.getStorage("bp-"+(i="friends"===i?"members":i));void 0!==e.extras&&"notifications"!==i&&(s=e.extras),"members"===i?t.objectRequest({object:i,scope:a,filter:n,search_terms:o,page:1,extras:s,template:null,member_type_id:h('#buddypress [data-bp-member-type-filter="'+i+'"]').val()}):"groups"===i?t.objectRequest({object:i,scope:a,filter:n,search_terms:o,page:1,extras:s,template:null,group_type:h('#buddypress [data-bp-group-type-filter="'+i+'"]').val()}):t.objectRequest({object:i,scope:a,filter:n,search_terms:o,page:1,extras:s,template:null})},typeGroupFilterQuery:function(e){var t=e.data,i=h(e.target).data("bp-group-type-filter"),a="all",n=null,o=null,s="";if(!i)return e;void 0!==(e=t.getStorage("bp-"+i)).extras&&"notifications"!==i&&(o=e.extras),h('#buddypress [data-bp-filter="'+i+'"]').length&&(void 0!==e.filter?(n=e.filter,h('#buddypress [data-bp-filter="'+i+'"] option[value="'+n+'"]').prop("selected",!0)):"-1"!==h('#buddypress [data-bp-filter="'+i+'"]').val()&&"0"!==h('#buddypress [data-bp-filter="'+i+'"]').val()&&(n=h('#buddypress [data-bp-filter="'+i+'"]').val())),h(t.objectNavParent+" [data-bp-object].selected").length&&(a=h(t.objectNavParent+" [data-bp-object].selected").data("bp-scope")),h('#buddypress [data-bp-search="'+i+'"] input[type=search]').length&&(s=h('#buddypress [data-bp-search="'+i+'"] input[type=search]').val()),t.objectRequest({object:i,scope:a,filter:n,search_terms:s,page:1,template:null,extras:o,group_type:h('#buddypress [data-bp-group-type-filter="'+i+'"]').val()})},typeMemberFilterQuery:function(e){var t=e.data,i=h(e.target).data("bp-member-type-filter"),a="all",n=null,o=null,s="";if(!i)return e;void 0!==(e=t.getStorage("bp-"+(i="friends"===i?"members":i))).extras&&"notifications"!==i&&(o=e.extras),h('#buddypress [data-bp-filter="'+i+'"]').length&&(void 0!==e.filter?(n=e.filter,h('#buddypress [data-bp-filter="'+i+'"] option[value="'+n+'"]').prop("selected",!0)):"-1"!==h('#buddypress [data-bp-filter="'+i+'"]').val()&&"0"!==h('#buddypress [data-bp-filter="'+i+'"]').val()&&(n=h('#buddypress [data-bp-filter="'+i+'"]').val())),h(t.objectNavParent+" [data-bp-object].selected").length&&(a=h(t.objectNavParent+" [data-bp-object].selected").data("bp-scope")),h('#buddypress [data-bp-search="'+i+'"] input[type=search]').length&&(s=h('#buddypress [data-bp-search="'+i+'"] input[type=search]').val()),t.objectRequest({object:i,scope:a,filter:n,search_terms:s,page:1,template:null,extras:o,member_type_id:h('#buddypress [data-bp-member-type-filter="'+i+'"]').val()})},searchQuery:function(e){var t,i,a,n=e.data,o="all",s=!1;if(h(e.delegateTarget).hasClass("no-ajax")||void 0===h(e.delegateTarget).data("bp-search"))return e;e.preventDefault(),t=h(e.delegateTarget).data("bp-search"),i=h("#buddypress").find('[data-bp-filter="'+t+'"]').first().val(),a=h(e.delegateTarget).find("input[type=search]").first().val(),h(n.objectNavParent+" [data-bp-object]").length&&(o=h(n.objectNavParent+' [data-bp-object="'+t+'"].selected').data("bp-scope"));e=n.getStorage("bp-"+t);void 0!==e.extras&&"notifications"!==t&&(s=e.extras),n.objectRequest({object:t,scope:o,filter:i,search_terms:a,page:1,extras:s,template:null})},showSearchSubmit:function(e){h(e.delegateTarget).find("[type=submit]").addClass("bp-show"),h("[type=submit]").hasClass("bp-hide")&&h("[type=submit]").removeClass("bp-hide")},resetSearch:function(e){h(e.target).val()?h(e.delegateTarget).find("[type=submit]").show():h(e.delegateTarget).submit()},buttonAction:function(e){var a=e.data,n=h(e.currentTarget),o=n.data("bp-btn-action"),t=n.data("bp-nonce"),s=n.closest("[data-bp-item-id]"),i=s.data("bp-item-id"),r=n.closest(".list-wrap"),d=s.data("bp-item-component"),l="",c=s.data("bp-used-to-component");if(!o||!i||!d)return e;if(e.preventDefault(),n.hasClass("bp-toggle-action-button"))return h(document.body).hasClass("buddyboss-theme")&&void 0!==n.data("balloon")?n.attr("data-balloon",n.data("title")):n.text(n.data("title")),n.removeClass("bp-toggle-action-button"),n.addClass("bp-toggle-action-button-clicked"),!1;if(void 0!==n.data("only-admin"))return void 0!==BP_Nouveau.only_admin_notice&&window.alert(BP_Nouveau.only_admin_notice),!1;if("is_friend"!==o&&(void 0!==BP_Nouveau[o+"_confirm"]&&!1===window.confirm(BP_Nouveau[o+"_confirm"])||n.hasClass("pending")))return!1;var p=h(".bb-leave-group-popup"),u=h(n).data("bb-group-name"),b=h(n).data("bb-group-link");if("leave_group"===o&&"true"!==h(n).attr("data-popup-shown")){if(p.length){var m=p.find(".bb-leave-group-content"),e=!!s.hasClass("has-child");return m.html(e?BP_Nouveau.parent_group_leave_confirm:BP_Nouveau.group_leave_confirm),e||m.find(".bb-group-name").html(''+u+""),h("body").find('[data-current-anchor="true"]').removeClass("bp-toggle-action-button bp-toggle-action-button-hover").addClass("bp-toggle-action-button-clicked"),p.show(),h(n).attr("data-current-anchor","true"),h(n).attr("data-popup-shown","true"),!1}}else h("body").find('[data-popup-shown="true"]').attr("data-popup-shown","false"),h("body").find('[data-current-anchor="true"]').attr("data-current-anchor","false"),p.find(".bb-leave-group-content .bb-group-name").html(""),p.hide();b={};h(n).closest("#item-header").length?b=h("#item-header .bb-remove-connection"):h(n).closest('.members[data-bp-list="members"]').length?b=h('.members[data-bp-list="members"] .bb-remove-connection'):h(n).closest('.group_members[data-bp-list="group_members"]').length&&(b=h('.group_members[data-bp-list="group_members"] .bb-remove-connection'));u=h(n).data("bb-user-name"),p=h(n).data("bb-user-link");if("is_friend"===o&&"opened"!==h(n).attr("data-popup-shown")){if(b.length)return b.find(".bb-remove-connection-content .bb-user-name").html(''+u+""),h("body").find('[data-current-anchor="true"]').removeClass("bp-toggle-action-button bp-toggle-action-button-hover").addClass("bp-toggle-action-button-clicked"),b.show(),h(n).attr("data-current-anchor","true"),h(n).attr("data-popup-shown","opened"),!1}else h("body").find('[data-popup-shown="opened"]').attr("data-popup-shown","closed"),h("body").find('[data-current-anchor="true"]').attr("data-current-anchor","false"),b.length&&(b.find(".bb-remove-connection-content .bb-user-name").html(""),b.hide());l=t?a.getLinkParams(t,"_wpnonce"):void 0===n.prop("href")?a.getLinkParams(n.attr("href"),"_wpnonce"):a.getLinkParams(n.prop("href"),"_wpnonce"),u={is_friend:"remove_friend",not_friends:"add_friend",pending:"withdraw_friendship",accept_friendship:"accept_friendship",reject_friendship:"reject_friendship"};"members"===d&&void 0!==u[o]&&(o=u[o],d="friends");b={not_following:"follow",following:"unfollow"};"members"===d&&void 0!==b[o]&&(o=b[o],d="follow"),n.addClass("pending loading");t="";h(document.body).hasClass("directory")&&h(document.body).hasClass("members")||h(document.body).hasClass("group-members")?t="directory":h(document.body).hasClass("bp-user")&&(t="single");u="primary",b="single"===t?n.closest(".header-dropdown"):n.closest(".footer-button-wrap");void 0!==b.length&&0"+e.data.feedback+"","info",null,!0])}var t,i;return(h("#friends-personal-li").length&&(i=h("#friends-personal-li a span"),t=h("#friends-personal-li a"),(void 0!==e.data.is_user&&e.data.is_user&&void 0!==e.data.friend_count||void 0!==e.data.friend_count)&&("0"!==e.data.friend_count?i.length?h(i).html(e.data.friend_count):h(t).append(''+e.data.friend_count+""):h(i).hide())),void 0!==e.data.is_user&&e.data.is_user)?(n.parent().html(e.data.feedback),void s.fadeOut(1500)):void 0!==e.data.is_user&&!e.data.is_user&&void 0!==e.data.group_url&&e.data.group_url?window.location=e.data.group_url:(h(a.objectNavParent+' [data-bp-scope="personal"]').length&&(i=Number(h(a.objectNavParent+' [data-bp-scope="personal"] span').html())||0,-1!==h.inArray(o,["leave_group","remove_friend"])?--i:-1!==h.inArray(o,["join_group"])&&(i+=1),i<0&&(i=0),h(a.objectNavParent+' [data-bp-scope="personal"] span').html(i)),"follow"===d&&0"+e.data.feedback+"","error",null,!0])}).fail(function(){var e,t;["unsubscribe","subscribe"].includes(o)&&(25<(e=h(n).data("bb-group-name")).length&&(e=e.substring(0,25)+"..."),t="
                "+BP_Nouveau.subscriptions.error+""+e+".
                ","subscribe"===o&&(t="
                "+BP_Nouveau.subscriptions.subscribe_error+""+e+"
                "),jQuery(document).trigger("bb_trigger_toast_message",["",t,"error",null,!0])),n.removeClass("pending loading")})},buttonRevert:function(e){e=h(e.currentTarget);e.hasClass("bp-toggle-action-button-clicked")&&!e.hasClass("loading")&&(h(document.body).hasClass("buddyboss-theme")&&void 0!==e.data("balloon")?e.attr("data-balloon",e.data("title-displayed")):e.text(e.data("title-displayed")),e.removeClass("bp-toggle-action-button-clicked"),e.addClass("bp-toggle-action-button"))},buttonHover:function(e){var t=h(e.currentTarget),i=t.data("bp-btn-action"),a=t.closest("[data-bp-item-id]"),n=a.data("bp-item-id"),a=a.data("bp-item-component");return i&&n&&a?(e.preventDefault(),t.hasClass("bp-toggle-action-button")?(t.hasClass("group-subscription")&&void 0!==t.data("title")&&void 0!==t.data("title-displayed")&&0===t.data("title").replace(/<(.|\n)*?>/g,"").length&&0===t.data("title-displayed").replace(/<(.|\n)*?>/g,"").length||(h(document.body).hasClass("buddyboss-theme")&&void 0!==t.data("balloon")&&(t.hasClass("following")||t.attr("data-balloon",t.data("title").replace(/<(.|\n)*?>/g,"")),t.find("span").html(t.data("title"))),t.html(t.data("title"))),t.removeClass("bp-toggle-action-button"),t.addClass("bp-toggle-action-button-hover"),!1):void 0):e},buttonHoverout:function(e){e=h(e.currentTarget);if(e.hasClass("bp-toggle-action-button-hover")&&!e.hasClass("loading")){if(e.hasClass("group-subscription")&&void 0!==e.data("title")&&void 0!==e.data("title-displayed")&&0===e.data("title").replace(/<(.|\n)*?>/g,"").length&&0===e.data("title-displayed").replace(/<(.|\n)*?>/g,"").length)return e.removeClass("bp-toggle-action-button-hover"),e.addClass("bp-toggle-action-button"),!1;h(document.body).hasClass("buddyboss-theme")&&void 0!==e.data("balloon")&&(e.hasClass("following")||e.attr("data-balloon",e.data("title-displayed").replace(/<(.|\n)*?>/g,"")),e.find("span").html(e.data("title-displayed"))),e.html(e.data("title-displayed")),e.removeClass("bp-toggle-action-button-hover"),e.addClass("bp-toggle-action-button")}},awaitingButtonHover:function(e){var t=h(e.currentTarget);if(e.preventDefault(),t.hasClass("bp-toggle-action-button"))return h(document.body).hasClass("buddyboss-theme")&&void 0!==t.data("balloon")&&(t.hasClass("following")||t.attr("data-balloon",t.data("title").replace(/<(.|\n)*?>/g,"")),t.find("span").html(t.data("title"))),t.html(t.data("title")),t.removeClass("bp-toggle-action-button"),t.addClass("bp-toggle-action-button-hover"),!1},awaitingButtonHoverout:function(e){e=h(e.currentTarget);e.hasClass("bp-toggle-action-button-hover")&&!e.hasClass("loading")&&(h(document.body).hasClass("buddyboss-theme")&&void 0!==e.data("balloon")&&(e.hasClass("following")||e.attr("data-balloon",e.data("title-displayed").replace(/<(.|\n)*?>/g,"")),e.find("span").html(e.data("title-displayed"))),e.html(e.data("title-displayed")),e.removeClass("bp-toggle-action-button-hover"),e.addClass("bp-toggle-action-button"))},leaveGroupAction:function(e){e.preventDefault(),h("body").find('[data-current-anchor="true"]').removeClass("bp-toggle-action-button bp-toggle-action-button-hover").addClass("bp-toggle-action-button-clicked"),h("body").find('[data-current-anchor="true"]').trigger("click")},leaveGroupClose:function(e){e.preventDefault();e=h(e.currentTarget),e=h(e).closest(".bb-leave-group-popup");h("body").find('[data-current-anchor="true"]').attr("data-current-anchor","false"),h("body").find('[data-popup-shown="true"]').attr("data-popup-shown","false"),e.find(".bb-leave-group-content .bb-group-name").html(""),e.hide()},removeConnectionAction:function(e){e.preventDefault(),h("body").find('[data-current-anchor="true"]').removeClass("bp-toggle-action-button bp-toggle-action-button-hover").addClass("bp-toggle-action-button-clicked"),h("body").find('[data-current-anchor="true"]').trigger("click")},removeConnectionClose:function(e){e.preventDefault();e=h(e.currentTarget),e=h(e).closest(".bb-remove-connection");h("body").find('[data-current-anchor="true"]').attr("data-current-anchor","false"),h("body").find('[data-popup-shown="opened"]').attr("data-popup-shown","closed"),e.find(".bb-remove-connection-content .bb-user-name").html(""),e.hide()},buttonRevertAll:function(){h.each(h("#buddypress [data-bp-btn-action]"),function(){h(this).hasClass("bp-toggle-action-button-clicked")&&!h(this).hasClass("loading")&&(h(document.body).hasClass("buddyboss-theme")&&void 0!==h(this).data("balloon")?h(this).attr("data-balloon",h(this).data("title-displayed")):h(this).text(h(this).data("title-displayed")),h(this).removeClass("bp-toggle-action-button-clicked"),h(this).addClass("bp-toggle-action-button"),h(this).trigger("blur"))})},addRemoveInvite:function(e){var t=e.currentTarget,i=h(t).closest("tbody");if(h(t).hasClass("field-actions-remove")){if(!(1"+e+"").insertBefore(h(this).closest("tr")),20 input").attr("name","invitee["+e+"][]"),h(this).find(".field-name > input").attr("id","invitee_"+e+"_title"),h(this).find(".field-email > input").attr("name","email["+e+"][]"),h(this).find(".field-email > input").attr("id","email_"+e+"_email"),h(this).find(".field-member-type > select").attr("name","member-type["+e+"][]"),h(this).find(".field-member-type > select").attr("id","member_type_"+e+"_member_type")})},closeNotice:function(e){var t=h(e.currentTarget);e.preventDefault(),"clear"===t.data("bp-close")&&(void 0!==h.cookie("bp-message")&&h.removeCookie("bp-message"),void 0!==h.cookie("bp-message-type")&&h.removeCookie("bp-message-type")),t.closest(".bp-feedback").hasClass("bp-sitewide-notice")&&bp.Nouveau.ajax({action:"messages_dismiss_sitewide_notice"},"messages"),t.closest(".bp-feedback").remove()},paginateAction:function(e){var t,i=e.data,a=h(e.currentTarget),n=null,o=null,s=null,r=null,d=a.closest("[data-bp-pagination]").data("bp-pagination")||null;if(null===d)return e;e.preventDefault(),null!==(e=h(e.delegateTarget).data("bp-list")||null)&&(void 0!==(t=i.getStorage("bp-"+e)).scope&&(n=t.scope),void 0!==t.filter&&(o=t.filter),void 0!==t.extras&&(r=t.extras)),null!==e&&(void 0!==(t=i.getStorage("bp-"+e)).scope&&(n=t.scope),void 0!==t.filter&&(o=t.filter),void 0!==t.extras&&(r=t.extras));d={object:e,scope:n,filter:o,search_terms:s=h('#buddypress [data-bp-search="'+e+'"] input[type=search]').length?h('#buddypress [data-bp-search="'+e+'"] input[type=search]').val():s,extras:r,caller:a.closest("[data-bp-pagination]").hasClass("bottom")?"pag-bottom":"",page:i.getLinkParams(a.prop("href"),d)||1};h("#buddypress [data-bp-group-type-filter]").length&&(d.group_type=h("#buddypress [data-bp-group-type-filter]").val()),h("#buddypress [data-bp-member-type-filter]").length&&(d.member_type_id=h("#buddypress [data-bp-member-type-filter]").val()),i.objectRequest(d)},enableSubmitOnLegalAgreement:function(){h("body #buddypress #register-page #signup-form #legal_agreement").length&&(h("body #buddypress #register-page #signup-form .submit #signup_submit").prop("disabled",!0),h(document).on("change","body #buddypress #register-page #signup-form #legal_agreement",function(){h(this).prop("checked")?h("body #buddypress #register-page #signup-form .submit #signup_submit").prop("disabled",!1):h("body #buddypress #register-page #signup-form .submit #signup_submit").prop("disabled",!0)}))},registerPopUp:function(){h(".popup-modal-register").length&&h(".popup-modal-register").magnificPopup({type:"inline",preloader:!1,fixedBgPos:!0,fixedContentPos:!0}),h(".popup-modal-dismiss").length&&h(".popup-modal-dismiss").click(function(e){e.preventDefault(),h.magnificPopup.close()})},loginPopUp:function(){h(".popup-modal-login").length&&h(".popup-modal-login").magnificPopup({type:"inline",preloader:!1,fixedBgPos:!0,fixedContentPos:!0}),h(".popup-modal-dismiss").length&&h(".popup-modal-dismiss").click(function(e){e.preventDefault(),h.magnificPopup.close()})},threadListBlockPopup:function(e){e.preventDefault();var t=h(this).data("bp-content-id"),i=h(this).data("bp-content-type"),a=h(this).data("bp-nonce"),n=h(this).attr("href");void 0!==t&&void 0!==i&&void 0!==a&&(h(document).find(".bp-report-form-err").empty(),(e=h(n)).find(".bp-content-id").val(t),e.find(".bp-content-type").val(i),e.find(".bp-nonce").val(a)),0"),void e.preventDefault();t=h(e.currentTarget).closest("#header-cover-image").height(),i=h(e.currentTarget).closest("#header-cover-image").width(),a=Number(h(e.currentTarget).closest("#cover-image-container").find(".header-cover-img").css("top").replace("px","")),n=h(e.currentTarget).closest("#header-cover-image").width()/h(e.currentTarget).closest("#header-cover-image").find(".header-cover-reposition-wrap img")[0].width,l.closest("#cover-image-container").find(".header-cover-reposition-wrap").show(),(r=h(".header-cover-reposition-wrap img")).guillotine({width:i,height:t,eventOnChange:"guillotinechange",init:{scale:n,y:a&&h(e.currentTarget).closest("#header-cover-image").hasClass("has-position")?-a:d,w:i,h:t}}),r.on("guillotinechange",function(e,t){l.closest("#cover-image-container").find(".header-cover-img").attr("data-top",-t.y)})}else h(e.currentTarget).hasClass("cover-image-save")?(o=h(e.currentTarget),s=h(e.currentTarget).closest("#cover-image-container").find(".header-cover-img"),o.addClass("loading"),h.post(BP_Nouveau.ajaxurl,{action:"save_cover_position",position:s.attr("data-top")}).done(function(e){e.success&&e.data&&""!==e.data.content?(o.removeClass("loading"),o.closest("#cover-image-container").find(".header-cover-reposition-wrap").hide(),o.closest("#header-cover-image:not(.has-position)").addClass("has-position"),s.css({top:e.data.content+"px"})):(o.removeClass("loading"),o.closest("#cover-image-container").find(".header-cover-reposition-wrap").hide())}).fail(function(){o.removeClass("loading"),o.closest("#cover-image-container").find(".header-cover-reposition-wrap").hide()})):h(e.currentTarget).hasClass("cover-image-cancel")&&((r=h(".header-cover-reposition-wrap img")).guillotine({width:0,height:0,init:{scale:1,y:0,w:0,h:0}}),r.guillotine("remove"),h(e.currentTarget).closest("#cover-image-container").find(".header-cover-reposition-wrap").hide(),h(e.currentTarget).closest("#cover-image-container").find(".header-cover-img").attr("data-top",""));e.preventDefault()},coverPhotoCropperAlert:function(e){e.preventDefault(),h("#cover-photo-alert").remove()},toggleMoreOption:function(e){h(e.target).hasClass("bb_more_options_action")||h(e.target).parent().hasClass("bb_more_options_action")?(e.preventDefault(),h(e.target).closest(".bb_more_options").find(".bb_more_options_list").hasClass("is_visible")?h(".bb_more_options").find(".bb_more_options_list").removeClass("is_visible"):(h(".bb_more_options").find(".bb_more_options_list").removeClass("is_visible"),h(e.target).closest(".bb_more_options").find(".bb_more_options_list").addClass("is_visible"))):(h(".bb_more_options").find(".bb_more_options_list").removeClass("is_visible"),h(".optionsOpen").removeClass("optionsOpen"))},getVideoThumb:function(d,l){var e,i=new FileReader;i.onload=function(){var t,e=new Blob([i.result],{type:d.type}),n=URL.createObjectURL(e),o=document.createElement("video");o.src=n;var s=0,r=setInterval(function(){var e;05e4;if(i){var a=document.createElement("img");a.src=t;if(d.previewElement){if(h(d.previewElement).find(l).find("img").length)h(d.previewElement).find(l).find("img").attr("src",t);else h(d.previewElement).find(l).append(a);h(d.previewElement).closest(".dz-preview").addClass("dz-has-thumbnail")}else if(h(l).find("img").length)h(l).find("img").attr("src",t);else h(l).append(a);URL.revokeObjectURL(n)}else{if(s>=2){h(d.previewElement).closest(".dz-preview").addClass("dz-has-no-thumbnail");clearInterval(r)}s++}return i}()||(o.removeEventListener("timeupdate",e),o.pause())}),o.preload="metadata",o.src=n,o.muted=!0,o.playsInline=!0,null!=t&&(o.currentTime=Math.floor(t)),o.play(),clearInterval(r)),2<=s&&(h(d.previewElement).closest(".dz-preview").addClass("dz-has-no-thumbnail"),clearInterval(r)),s++},500)},d.dataURL?((e=new XMLHttpRequest).open("GET",d.dataURL,!0),e.responseType="blob",e.onload=function(){var e;200==this.status&&(e=this.response,i.readAsArrayBuffer(e))},e.send()):i.readAsArrayBuffer(d)},bbWidgetMoreFollowing:function(e){e=h(e.currentTarget).attr("href").split("#");if(1 li").each(function(){t+=h(this).outerWidth()}),t>e.width()-10?(e.data("childerWith",t),t>e.width()&&(0===e.find(".medium-editor-toolbar-actions .medium-editor-action-more").length&&e.find(".medium-editor-toolbar-actions").append('
                • '),e.find(".medium-editor-action-more").show(),t+=e.find(".medium-editor-toolbar-actions .medium-editor-action-more").outerWidth(),h(e.find(".medium-editor-action").get().reverse()).each(function(){h(this).hasClass("medium-editor-action-more-button")||t>e.width()&&(t-=h(this).outerWidth(),e.find(".medium-editor-action-more > ul").prepend(h(this).parent()))}))):e.find(".medium-editor-toolbar-actions .medium-editor-action-more").length&&(h(e.find(".medium-editor-action-more ul > li")).each(function(){t+35 li").length&&e.find(".medium-editor-action-more").hide()),h(e).find(".medium-editor-action-more-button").on("click",function(e){e.preventDefault(),h(this).parent(".medium-editor-action-more").toggleClass("active")}),h(e).find(".medium-editor-action-more ul .medium-editor-action").on("click",function(e){e.preventDefault(),h(this).closest(".medium-editor-action-more").toggleClass("active")}),h(window).one("resize",function(){e.removeClass("wrappingInitialised"),h(e).find(".medium-editor-action-more ul .medium-editor-action").unbind("click")}))},isURL:function(e){return/^(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,24}(:[0-9]{1,5})?(\/.*)?$/.test(h.trim(e))},closeActionPopup:function(e){e.preventDefault(),h(this).closest(".bb-action-popup").hide()},directorySearchInput:function(){var e,t;h(this).val()===h(this).data("last-value")||""===h(this).val()&&void 0===h(this).data("last-value")||(h(this).data("last-value",h(this).val()),t=(e=h(this).closest(".search-form-has-reset")).find(".search-form_reset"),0"),h(this).hasClass("disabled")||h(this).find("input:checked").length&&(a+=""===a?h(this).find('input[type="checkbox"] + label').text().trim():", "+h(this).find('input[type="checkbox"] + label').text().trim(),o++)}),o===h(this).find(e+':not(:first-child) input[type="checkbox"]').length?1==h(this).find(e+':not(:first-child) input[type="checkbox"]').length||(a=t):a=""===a?i:a,0===h(this).find(e+":first-child .bb-mobile-setting").length?h(this).find(e+":first-child").append('
                  '+a+"
                    "):h(this).find(e+":first-child .bb-mobile-setting .bb-mobile-setting-anchor").text(a),h(this).find(e+":first-child .bb-mobile-setting ul").html(""),h(this).find(e+":first-child .bb-mobile-setting ul").append(n)})},dropZoneGlobalProgress:function(i){0==h(i.element).find(".dz-global-progress").length&&(h(i.element).append('

                    '),h(i.element).addClass("dz-progress-view"),h(i.element).find(".dz-remove-all").click(function(){h.each(i.files,function(e,t){i.removeFile(t)})}));var e="",t=0,a=0;1==i.files.length?(h(i.element).addClass("dz-single-view"),e="Uploading "+i.files[0].name+"",t=i.files[0].upload.progress):(h(i.element).removeClass("dz-single-view"),a=0,h.each(i.files,function(e,t){a+=t.upload.progress}),t=a/i.files.length,e="Uploading "+i.files.length+" files"),h(i.element).find(".dz-global-progress .dz-progress").css("width",t+"%"),h(i.element).find(".dz-global-progress > p").html(e)},userPresenceStatus:function(){window.bb_is_user_active=!0;var e=1e3*parseInt(BB_Nouveau_Presence.idle_inactive_span);bp.Nouveau.userPresenceChecker(e),""!==BB_Nouveau_Presence.heartbeat_enabled&&parseInt(BB_Nouveau_Presence.presence_interval)<=60?(h(document).on("heartbeat-send",function(e,t){var i;void 0!==window.bb_is_user_active&&!0===window.bb_is_user_active&&(i=bp.Nouveau.getPageUserIDs(),t.presence_users=i.join(","))}),h(document).on("heartbeat-tick",function(e,t){t.users_presence&&bp.Nouveau.updateUsersPresence(t.users_presence)})):setInterval(function(){var e,t={};void 0!==window.bb_is_user_active&&!0===window.bb_is_user_active&&(t.ids=bp.Nouveau.getPageUserIDs()),void 0!==t.ids&&void 0!==t.ids.length&&0
                    '),n.currentPreviewParent=t.find(".bb-url-scrapper-container")),0
                    ").html(e)).find("a.bp-suggestions-mention").remove(),i.find('[rel="nofollow"]').remove(),0<=(e=0<=(e=i.html()).indexOf("/g,""):e).indexOf("http://")?o=this.getURL("http://",e):0<=e.indexOf("https://")?o=this.getURL("https://",e):0<=e.indexOf("www.")&&(o=this.getURL("www",e)),""===o&&""===s||(""!==o&&((e=document.createElement("a")).href=o,e=e.hostname,void 0!==BP_Nouveau.forums.params.excluded_hosts&&-1!==BP_Nouveau.forums.params.excluded_hosts.indexOf(e)&&(o="")),""!==o?this.loadURLPreview(o):s&&this.loadURLPreview(s)))},getURL:function(e,t){var i="",a=(t=t.replace(/ /g,"")).indexOf(e),n="";if(_.isUndefined(jQuery(h.parseHTML(t)).attr("href"))){for(var o=a;o"===t[o+1]||"<"===t[o]&&"b"===t[o+1]&&"r"===t[o+2]);o++)i+=t[o];"www"===e&&(i=(e="http://")+i)}else i=jQuery(t).attr("href");e=document.createElement("div");e.innerHTML=i;for(var s=e.getElementsByTagName("*");s[0];)s[0].parentNode.removeChild(s[0]);return n=0',p+='
                    ',e&&(p+=''+e+""),t&&(p+=''+t+""),p+="
                    ",p+='
                    ',p+=a?'':"",h((h(".bb-toast-messages-enable").length||(h(".bb-onscreen-notification-enable ul.notification-list").length?(u=h(".bb-onscreen-notification").hasClass("bb-position-left")?"left":"right",u=h('
                      '),h(".bb-onscreen-notification").show(),h(u).insertBefore(".bb-onscreen-notification-enable ul.notification-list")):(u=h('
                        '),h("body").append(u))),".bb-toast-messages-enable .toast-messages-list")).append('
                      • '+p+"
                      • "),n&&setInterval(function(){b()},o),h(r+" .actions .action-close").on("click",function(){b()}))},setupGlobals:function(){this.ajax_request=null,this.objects=h.map(BP_Nouveau.objects,function(e){return e}),this.objectNavParent=BP_Nouveau.object_nav_parent,this.heartbeat=wp.heartbeat||!1,this.querystring=this.getLinkParams()},prepareDocument:function(){var i;h("body").hasClass("no-js")&&h("body").removeClass("no-js").addClass("js"),BP_Nouveau.warnings&&"undefined"!=typeof console&&console.warn&&h.each(BP_Nouveau.warnings,function(e,t){console.warn(t)}),h(".buddypress_object_nav .widget-title").length&&(i=h(".buddypress_object_nav .widget-title").html(),h("body").find('*:contains("'+i+'")').each(function(e,t){h(t).hasClass("widget-title")||i!==h(t).html()||h(t).is("a")||h(t).remove()}))},getStorage:function(e,t){e=(e=sessionStorage.getItem(e))?JSON.parse(e):{};return void 0!==t?e[t]||!1:e},setStorage:function(e,t,i){var a=this.getStorage(e);return void 0===i&&void 0!==a[t]?delete a[t]:a[t]=i,sessionStorage.setItem(e,JSON.stringify(a)),null!==sessionStorage.getItem(e)},getLinkParams:function(e,t){e=e?-1!==e.indexOf("?")?"?"+e.split("?")[1]:"":document.location.search;if(!e)return null;e=e.replace(/(^\?)/,"").split("&").map(function(e){return this[(e=e.split("="))[0]]=e[1],this}.bind({}))[0];return t?e[t]:e},urlDecode:function(e,t){var i=t||{amp:"&",lt:"<",gt:">",quot:'"',"#039":"'"};return decodeURIComponent(e.replace(/\+/g," ")).replace(/&([^;]+);/g,function(e,t){return i[t]||""})},ajax:function(e,t,i){this.ajax_request&&void 0===i&&this.ajax_request.abort();e=h.extend({},bp.Nouveau.getStorage("bp-"+t),{nonce:BP_Nouveau.nonces[t]},e);return void 0!==BP_Nouveau.customizer_settings&&(e.customized=BP_Nouveau.customizer_settings),void 0!==BP_Nouveau.modbypass&&(e.modbypass=BP_Nouveau.modbypass),this.ajax_request=h.post(BP_Nouveau.ajaxurl,e,"json"),this.ajax_request},inject:function(e,t,i){h(e).length&&t&&(("append"===(i=i||"reset")?h(e).append(t):"prepend"===i?h(e).prepend(t):"after"===i?h(e).after(t):h(e).html(t)).find("li.activity-item").each(this.hideSingleUrl),"undefined"==typeof bp_mentions&&void 0===bp.mentions||(h(".bp-suggestions").bp_mentions(bp.mentions.users),h("#whats-new").on("inserted.atwho",function(){var e;window.getSelection&&document.createRange?(e=window.getSelection&&window.getSelection())&&0 p").removeAttr("br").removeAttr("a").text(),t="",i="",a="",n=0;if(0<=e.indexOf("http://")?(a=e.indexOf("http://"),n=1):0<=e.indexOf("https://")?(a=e.indexOf("https://"),n=1):0<=e.indexOf("www.")&&(a=e.indexOf("www"),n=1),1===n){for(var o=a;o p:first").hide()}},objectRequest:function(a){var e,n,o=this;if((a=h.extend({object:"",scope:null,filter:null,target:"#buddypress [data-bp-list]",search_terms:"",page:1,extras:null,caller:null,template:null,method:"reset"},a)).object&&a.target)return"activity"==a.object&&"#buddypress [data-bp-list] ul.bp-list"==a.target&&(a.target="#buddypress [data-bp-list] ul.bp-list:not(#bb-media-model-container ul.bp-list)"),["members","activity","media","document"].includes(a.object)&&!h(this.objectNavParent+' [data-bp-scope="'+a.scope+'"]').length&&(a.scope="all"),a.search_terms&&(a.search_terms=a.search_terms.replace(//g,">")),null!==a.scope&&this.setStorage("bp-"+a.object,"scope",a.scope),null!==a.filter&&this.setStorage("bp-"+a.object,"filter",a.filter),null!==a.extras&&this.setStorage("bp-"+a.object,"extras",a.extras),h(this.objectNavParent+" [data-bp-object]").each(function(){h(this).removeClass("selected loading")}),(h(this.objectNavParent+' [data-bp-scope="'+a.scope+'"]').length?h(this.objectNavParent+' [data-bp-scope="'+a.scope+'"], #object-nav li.current'):h(this.objectNavParent+" [data-bp-scope]:eq(0), #object-nav li.current")).addClass("selected loading"),0===h(this.objectNavParent+' [data-bp-scope="'+a.scope+'"]').length&&(e=["group_members"===a.object&&h("body").hasClass("group-members"),"activity"===a.object&&h("body.groups").hasClass("activity"),"document"===a.object&&h("body").hasClass("documents"),"manage_group_members"===a.object&&h("body").hasClass("manage-members"),"document"===a.object&&(h("body").hasClass("document")||h("body").hasClass("documents"))],n=[h(".groups .group-search.members-search"),h(".groups .group-search.activity-search"),h(".documents .bp-document-listing .bb-title"),h(".groups .group-search.search-wrapper"),h("#bp-media-single-folder .bb-title")],e.forEach(function(e,t){e&&n[t].addClass("loading")})),h('#buddypress [data-bp-filter="'+a.object+'"] option[value="'+a.filter+'"]').prop("selected",!0),"friends"===a.object||"group_members"===a.object||"manage_group_members"===a.object?(a.template=a.object,a.object="members"):"group_requests"===a.object?(a.object="groups",a.template="group_requests"):"group_subgroups"===a.object?(a.object="groups",a.template="group_subgroups"):"notifications"===a.object&&(a.object="members",a.template="member_notifications"),e=h.extend({action:a.object+"_filter"},a),this.ajax(e,a.object).done(function(e){if(!1!==e.success&&!_.isUndefined(e.data)){if(_.isUndefined(e.data.layout)||(h(".layout-view").removeClass("active"),h(".layout-"+e.data.layout+"-view").addClass("active")),!h("body.group-members.members.buddypress").length||_.isUndefined(e.data)||_.isUndefined(e.data.count)||h("body.group-members.members.buddypress ul li#members-groups-li").find("span").text(e.data.count),h(o.objectNavParent+' [data-bp-scope="'+a.scope+'"]').removeClass("loading"),h(o.objectNavParent+' [data-bp-scope="'+a.scope+'"]').find("span").text(""),0===h(o.objectNavParent+' [data-bp-scope="'+a.scope+'"]').length&&n.forEach(function(e){e.removeClass("loading")}),_.isUndefined(e.data)||_.isUndefined(e.data.count)||h(o.objectNavParent+' [data-bp-scope="'+a.scope+'"]').find("span").text(e.data.count),!_.isUndefined(e.data)&&!_.isUndefined(e.data.scopes))for(var t in e.data.scopes)h(o.objectNavParent+' [data-bp-scope="'+t+'"]').find("span").text(e.data.scopes[t]);var i;"reset"!==a.method?(o.inject(a.target,e.data.contents,a.method),h(a.target).trigger("bp_ajax_"+a.method,h.extend(a,{response:e.data}))):"pag-bottom"===a.caller?(i=null,i=h("#subnav").length?h("#subnav").parent():h(a.target),h("html,body").animate({scrollTop:i.offset().top},"slow",function(){h(a.target).fadeOut(100,function(){o.inject(this,e.data.contents,a.method),h(this).fadeIn(100),h(a.target).trigger("bp_ajax_request",h.extend(a,{response:e.data})),bp.Nouveau.lazyLoad&&setTimeout(function(){bp.Nouveau.lazyLoad(".lazy")},1e3)})})):h(a.target).fadeOut(100,function(){o.inject(this,e.data.contents,a.method),h(this).fadeIn(100),h(a.target).trigger("bp_ajax_request",h.extend(a,{response:e.data})),bp.Nouveau.lazyLoad&&setTimeout(function(){bp.Nouveau.lazyLoad(".lazy")},1e3)}),setTimeout(function(){o.reportPopUp(),o.reportedPopup(),h(".activity-item.bb-closed-comments").find(".edit-activity, .acomment-edit").parents(".generic-button").hide()},1e3)}})},initObjects:function(){var a,n=this,o={},s="all",r="",d=null,l=null;h.each(this.objects,function(e,t){var i;h('#buddypress [data-bp-list="'+t+'"][data-ajax="false"]').length||(a=n.getStorage("bp-"+t),void 0!==(i=window.location.hash.substr(1))&&"following"==i?s=i:void 0!==a.scope&&(s=a.scope),void 0!==a.extras&&"notifications"!==t&&(d=a.extras),h('#buddypress [data-bp-filter="'+t+'"]').length&&(void 0!==a.filter?(l=a.filter,h('#buddypress [data-bp-filter="'+t+'"] option[value="'+l+'"]').prop("selected",!0)):"-1"!==h('#buddypress [data-bp-filter="'+t+'"]').val()&&"0"!==h('#buddypress [data-bp-filter="'+t+'"]').val()&&(l=h('#buddypress [data-bp-filter="'+t+'"]').val())),h(this.objectNavParent+' [data-bp-object="'+t+'"]').length&&(h(this.objectNavParent+' [data-bp-object="'+t+'"]').each(function(){h(this).removeClass("selected")}),h(this.objectNavParent+' [data-bp-scope="'+t+'"], #object-nav li.current').addClass("selected")),null!==n.querystring&&(void 0!==n.querystring[t+"_search"]?r=decodeURI(n.querystring[t+"_search"]):void 0!==n.querystring.s&&(r=decodeURI(n.querystring.s)),r&&h('#buddypress [data-bp-search="'+t+'"] input[type=search]').val(r)),h('#buddypress [data-bp-list="'+t+'"]').length&&(o={object:t,scope:s,filter:l,search_terms:r,extras:d},h('#buddypress [data-bp-member-type-filter="'+t+'"]').length?o.member_type_id=h('#buddypress [data-bp-member-type-filter="'+t+'"]').val():h('#buddypress [data-bp-group-type-filter="'+t+'"]').length&&(o.group_type=h('#buddypress [data-bp-group-type-filter="'+t+'"]').val()),n.objectRequest(o)))})},setHeartBeat:function(){void 0!==BP_Nouveau.pulse&&this.heartbeat&&(this.heartbeat.interval(Number(BP_Nouveau.pulse)),h.fn.extend({"heartbeat-send":function(){return this.bind("heartbeat-send")}}),h.fn.extend({"heartbeat-tick":function(){return this.bind("heartbeat-tick")}}))},addListeners:function(){h("[data-bp-disable-input]").on("change",this.toggleDisabledInput),h(this.objectNavParent+" .bp-navs").on("click","a",this,this.scopeQuery),h(document).on("change","#buddypress [data-bp-filter]",this,this.filterQuery),h(document).on("change","#buddypress [data-bp-group-type-filter]",this,this.typeGroupFilterQuery),h(document).on("change","#buddypress [data-bp-member-type-filter]",this,this.typeMemberFilterQuery),h("#buddypress [data-bp-search]").on("submit","form",this,this.searchQuery),h("#buddypress [data-bp-search]").on("keyup","input[name=group_members_search]",this,_.throttle(this.searchQuery,900)),h("#buddypress [data-bp-search] form").on("search","input[type=search]",this.resetSearch),h("#buddypress [data-bp-list], #buddypress #item-header, #buddypress.bp-shortcode-wrap .dir-list, #buddypress .bp-messages-content").on("click","[data-bp-btn-action]",this,this.buttonAction),h("#buddypress [data-bp-list], #buddypress #item-header, #buddypress.bp-shortcode-wrap .dir-list, #buddypress .messages-screen").on("blur","[data-bp-btn-action]",this,this.buttonRevert),h("#buddypress [data-bp-list], #buddypress #item-header, #buddypress.bp-shortcode-wrap .dir-list, #buddypress .messages-screen").on("mouseover","[data-bp-btn-action]",this,this.buttonHover),h("#buddypress [data-bp-list], #buddypress #item-header, #buddypress.bp-shortcode-wrap .dir-list, #buddypress .messages-screen").on("mouseout","[data-bp-btn-action]",this,this.buttonHoverout),h("#buddypress [data-bp-list], #buddypress #item-header, #buddypress.bp-shortcode-wrap .dir-list, #buddypress .messages-screen").on("mouseover",".awaiting_response_friend",this,this.awaitingButtonHover),h("#buddypress [data-bp-list], #buddypress #item-header, #buddypress.bp-shortcode-wrap .dir-list, #buddypress .messages-screen").on("mouseout",".awaiting_response_friend",this,this.awaitingButtonHoverout),h(document).on("click","#buddypress .bb-leave-group-popup .bb-confirm-leave-group",this.leaveGroupAction),h(document).on("click","#buddypress .bb-leave-group-popup .bb-close-leave-group",this.leaveGroupClose),h(document).on("click","#buddypress .bb-remove-connection .bb-confirm-remove-connection",this.removeConnectionAction),h(document).on("click","#buddypress .bb-remove-connection .bb-close-remove-connection",this.removeConnectionClose),h(document).on("click","#buddypress table.invite-settings .field-actions .field-actions-remove, #buddypress table.invite-settings .field-actions-add",this,this.addRemoveInvite),h(document).on("click",".show-action-popup",this.showActionPopup),h(document).on("click","#message-threads .block-member",this.threadListBlockPopup),h(document).on("click","#message-threads .report-content",this.threadListReportPopup),h(document).on("click",".bb-close-action-popup, .action-popup-overlay",this.closeActionPopup),h(document).on("keyup",'.search-form-has-reset input[type="search"], .search-form-has-reset input#bbp_search',_.throttle(this.directorySearchInput,900)),h(document).on("click",".search-form-has-reset .search-form_reset",this.resetDirectorySearch),h(document).on("keyup",this,this.keyUp),h("[data-bp-close]").on("click",this,this.closeNotice),h("#buddypress [data-bp-list]").on("click","[data-bp-pagination] a",this,this.paginateAction),h(document).on("click",this.closePickersOnClick),document.addEventListener("keydown",this.closePickersOnEsc),h(document).on("click","#item-header a.position-change-cover-image, .header-cover-reposition-wrap a.cover-image-save, .header-cover-reposition-wrap a.cover-image-cancel",this.coverPhotoCropper),h(document).on("click","#cover-photo-alert .bb-model-close-button",this.coverPhotoCropperAlert),h(document).on("click",this.toggleMoreOption.bind(this)),h(document).on("heartbeat-send",this.bbHeartbeatSend.bind(this)),h(document).on("heartbeat-tick",this.bbHeartbeatTick.bind(this)),bp.Nouveau.notificationRemovedAction(),bp.Nouveau.removeAllNotification(),bp.Nouveau.setTitle(),h(document).on("click",".more-following .count-more",this.bbWidgetMoreFollowing),h(".bb-accordion .bb-accordion_trigger").on("click",this.toggleAccordion)},bbHeartbeatSend:function(e,t){t.onScreenNotifications=!0,h("#buddypress").trigger("bb_heartbeat_send",t)},bbHeartbeatTick:function(e,t){bp.Nouveau.bbInjectOnScreenNotifications(e,t)},bbInjectOnScreenNotifications:function(e,t){var i,a,n,o,s,r;"1"==h(".bb-onscreen-notification").data("enable")&&(void 0===t.on_screen_notifications&&""===t.on_screen_notifications||(i=h(".bb-onscreen-notification"),r=(a=i.find(".notification-list")).data("removed-items"),n=a.data("animated-items"),o=[],s=h(h.parseHTML("
                          "+t.on_screen_notifications+"
                        ")),h.each(r,function(e,t){t=s.find("[data-notification-id="+t+"]");t.length&&t.closest(".read-item").remove()}),(r=s.find(".read-item")).each(function(e,t){var i=h(t).find(".actions .action-close").data("notification-id");"-1"==h.inArray(i,n)?(h(t).addClass("pull-animation"),n.push(i),o.push(i)):h(t).removeClass("pull-animation")}),o.length&&r.each(function(e,t){var i=h(t).find(".actions .action-close").data("notification-id");"-1"==h.inArray(i,o)&&(h(t).removeClass("recent-item"),(t=a.data("border-items")).push(i),a.attr("data-border-items",JSON.stringify(t)))}),a.attr("data-animated-items",JSON.stringify(n)),r.length&&(i.removeClass("close-all-items"),r.eq(2).nextAll().addClass("bb-more-item"),3 li").each(function(){h(this).removeClass("pull-animation").addClass("close-item").delay(500).remove()}),h(".toast-messages-list > li").each(function(){h(this).removeClass("pull-animation").addClass("close-item").delay(500).remove()}),t.removeClass("bb-more-than-3")})},setTitle:function(){var e=h("html head").find("title").text();h(".bb-onscreen-notification").attr("data-title-tag",e)},visibilityOnScreenClearButton:function(){var e=h(".bb-onscreen-notification");1 tbody > tr").each(function(){h(this).find('input[type="text"]').removeAttr("style"),h(this).find('input[type="email"]').removeAttr("style")}),h("body.send-invites #send-invite-form #member-invites-table > tbody > tr").each(function(){e=h.trim(h(this).find('input[type="text"]').val()),i=h(this).find("input").attr("id"),t=h.trim(h(this).find('input[type="email"]').val()),""===e&&""===t?0:""!==e&&""===t?(i=h(this).find('input[type="email"]').attr("id"),a.push(i)):""===e&&""!==t?(i=h(this).find('input[type="text"]').attr("id"),a.push(i)):l.test(t)?n.push(1):(i=h(this).find('input[type="email"]').attr("id"),a.push(i))}),h(".span_error").remove(),0!==a.length)return a.forEach(function(e){h("#"+e).attr("style","border:1px solid #ef3e46"),-1!==e.indexOf("email_")?h("#"+e).after(''+p+""):h("#"+e).after(''+c+"")}),h("html, body").animate({scrollTop:h("#item-body").offset().top},2e3),alert(u),!1;if(h("#email_0_email_error").length&&h("#email_0_email_error").remove(),0===n.length){o=h("#invitee_0_title").val(),s=h("#email_0_email").val();return""===o&&""===s?(h("#invitee_0_title").attr("style","border:1px solid #ef3e46"),h("#invitee_0_title").focus(),h("#email_0_email").attr("style","border:1px solid #ef3e46"),!1):(""!==o&&""===s?(h("#email_0_email").attr("style","border:1px solid #ef3e46"),h("#email_0_email").focus()):(l.test(s)||(h("#email_0_email").attr("style","border:1px solid #ef3e46"),h("#email_0_email").focus(),h("#email_0_email_error").remove(),h("#email_0_email").after(''+p+"")),alert(u)),!1)}})},sendInvitesRevokeAccess:function(){h("body.sent-invites #member-invites-table").length&&h("body.sent-invites #member-invites-table tr td span a.revoked-access").click(function(e){e.preventDefault();var t=h(this).attr("data-name"),i=h(this).attr("id"),e=h(this).attr("data-revoke-access");if(!confirm(t))return!1;h.ajax({url:e,type:"post",data:{item_id:i},success:function(){window.location.reload(!0)}})})},toggleDisabledInput:function(){var e=h(this).attr("data-bp-disable-input");h(e).prop("disabled",!0)&&!h(this).hasClass("enabled")?(h(this).addClass("enabled").removeClass("disabled"),h(e).prop("disabled",!1)):h(e).prop("disabled",!1)&&h(this).hasClass("enabled")&&(h(this).removeClass("enabled").addClass("disabled"),h(e).attr("disabled","disabled"))},keyUp:function(e){var t=e.data;27===e.keyCode&&t.buttonRevertAll()},scopeQuery:function(e){var t,i,a=e.data,n=h(e.currentTarget).parent(),o="",s=null,r={};if(n.hasClass("no-ajax")||h(e.currentTarget).hasClass("no-ajax")||!n.attr("data-bp-scope"))return e;if(t=n.data("bp-scope"),i=n.data("bp-object"),!t||!i)return e;e.preventDefault();var e=a.getStorage("bp-"+i);void 0!==e.extras&&"notifications"!==i&&(s=e.extras),e=h("#buddypress").find('[data-bp-filter="'+i+'"]').first().val(),h('#buddypress [data-bp-search="'+i+'"] input[type=search]').length&&(o=h('#buddypress [data-bp-search="'+i+'"] input[type=search]').val()),n.hasClass("dynamic")&&n.find("a span").html(""),r={object:i,scope:t,filter:e,search_terms:o,page:1,extras:s},h('#buddypress [data-bp-member-type-filter="'+i+'"]').length?r.member_type_id=h('#buddypress [data-bp-member-type-filter="'+i+'"]').val():h('#buddypress [data-bp-group-type-filter="'+i+'"]').length&&(r.group_type=h('#buddypress [data-bp-group-type-filter="'+i+'"]').val()),a.objectRequest(r)},filterQuery:function(e){var t=e.data,i=h(e.target).data("bp-filter"),a="all",n=h(e.target).val(),o="",s=!1;if(!i)return e;h(t.objectNavParent+" [data-bp-object].selected").length&&(a=h(t.objectNavParent+" [data-bp-object].selected").data("bp-scope")),h('#buddypress [data-bp-search="'+i+'"] input[type=search]').length&&(o=h('#buddypress [data-bp-search="'+i+'"] input[type=search]').val());e=t.getStorage("bp-"+(i="friends"===i?"members":i));void 0!==e.extras&&"notifications"!==i&&(s=e.extras),"members"===i?t.objectRequest({object:i,scope:a,filter:n,search_terms:o,page:1,extras:s,template:null,member_type_id:h('#buddypress [data-bp-member-type-filter="'+i+'"]').val()}):"groups"===i?t.objectRequest({object:i,scope:a,filter:n,search_terms:o,page:1,extras:s,template:null,group_type:h('#buddypress [data-bp-group-type-filter="'+i+'"]').val()}):t.objectRequest({object:i,scope:a,filter:n,search_terms:o,page:1,extras:s,template:null})},typeGroupFilterQuery:function(e){var t=e.data,i=h(e.target).data("bp-group-type-filter"),a="all",n=null,o=null,s="";if(!i)return e;void 0!==(e=t.getStorage("bp-"+i)).extras&&"notifications"!==i&&(o=e.extras),h('#buddypress [data-bp-filter="'+i+'"]').length&&(void 0!==e.filter?(n=e.filter,h('#buddypress [data-bp-filter="'+i+'"] option[value="'+n+'"]').prop("selected",!0)):"-1"!==h('#buddypress [data-bp-filter="'+i+'"]').val()&&"0"!==h('#buddypress [data-bp-filter="'+i+'"]').val()&&(n=h('#buddypress [data-bp-filter="'+i+'"]').val())),h(t.objectNavParent+" [data-bp-object].selected").length&&(a=h(t.objectNavParent+" [data-bp-object].selected").data("bp-scope")),h('#buddypress [data-bp-search="'+i+'"] input[type=search]').length&&(s=h('#buddypress [data-bp-search="'+i+'"] input[type=search]').val()),t.objectRequest({object:i,scope:a,filter:n,search_terms:s,page:1,template:null,extras:o,group_type:h('#buddypress [data-bp-group-type-filter="'+i+'"]').val()})},typeMemberFilterQuery:function(e){var t=e.data,i=h(e.target).data("bp-member-type-filter"),a="all",n=null,o=null,s="";if(!i)return e;void 0!==(e=t.getStorage("bp-"+(i="friends"===i?"members":i))).extras&&"notifications"!==i&&(o=e.extras),h('#buddypress [data-bp-filter="'+i+'"]').length&&(void 0!==e.filter?(n=e.filter,h('#buddypress [data-bp-filter="'+i+'"] option[value="'+n+'"]').prop("selected",!0)):"-1"!==h('#buddypress [data-bp-filter="'+i+'"]').val()&&"0"!==h('#buddypress [data-bp-filter="'+i+'"]').val()&&(n=h('#buddypress [data-bp-filter="'+i+'"]').val())),h(t.objectNavParent+" [data-bp-object].selected").length&&(a=h(t.objectNavParent+" [data-bp-object].selected").data("bp-scope")),h('#buddypress [data-bp-search="'+i+'"] input[type=search]').length&&(s=h('#buddypress [data-bp-search="'+i+'"] input[type=search]').val()),t.objectRequest({object:i,scope:a,filter:n,search_terms:s,page:1,template:null,extras:o,member_type_id:h('#buddypress [data-bp-member-type-filter="'+i+'"]').val()})},searchQuery:function(e){var t,i,a,n=e.data,o="all",s=!1;if(h(e.delegateTarget).hasClass("no-ajax")||void 0===h(e.delegateTarget).data("bp-search"))return e;e.preventDefault(),t=h(e.delegateTarget).data("bp-search"),i=h("#buddypress").find('[data-bp-filter="'+t+'"]').first().val(),a=h(e.delegateTarget).find("input[type=search]").first().val(),h(n.objectNavParent+" [data-bp-object]").length&&(o=h(n.objectNavParent+' [data-bp-object="'+t+'"].selected').data("bp-scope"));e=n.getStorage("bp-"+t);void 0!==e.extras&&"notifications"!==t&&(s=e.extras),n.objectRequest({object:t,scope:o,filter:i,search_terms:a,page:1,extras:s,template:null})},showSearchSubmit:function(e){h(e.delegateTarget).find("[type=submit]").addClass("bp-show"),h("[type=submit]").hasClass("bp-hide")&&h("[type=submit]").removeClass("bp-hide")},resetSearch:function(e){h(e.target).val()?h(e.delegateTarget).find("[type=submit]").show():h(e.delegateTarget).submit()},buttonAction:function(e){var a=e.data,n=h(e.currentTarget),o=n.data("bp-btn-action"),t=n.data("bp-nonce"),s=n.closest("[data-bp-item-id]"),i=s.data("bp-item-id"),r=n.closest(".list-wrap"),d=s.data("bp-item-component"),l="",c=s.data("bp-used-to-component");if(!o||!i||!d)return e;if(e.preventDefault(),n.hasClass("bp-toggle-action-button"))return h(document.body).hasClass("buddyboss-theme")&&void 0!==n.data("balloon")?n.attr("data-balloon",n.data("title")):n.text(n.data("title")),n.removeClass("bp-toggle-action-button"),n.addClass("bp-toggle-action-button-clicked"),!1;if(void 0!==n.data("only-admin"))return void 0!==BP_Nouveau.only_admin_notice&&window.alert(BP_Nouveau.only_admin_notice),!1;if("is_friend"!==o&&(void 0!==BP_Nouveau[o+"_confirm"]&&!1===window.confirm(BP_Nouveau[o+"_confirm"])||n.hasClass("pending")))return!1;var p=h(".bb-leave-group-popup"),u=h(n).data("bb-group-name"),b=h(n).data("bb-group-link");if("leave_group"===o&&"true"!==h(n).attr("data-popup-shown")){if(p.length){var m=p.find(".bb-leave-group-content"),e=!!s.hasClass("has-child");return m.html(e?BP_Nouveau.parent_group_leave_confirm:BP_Nouveau.group_leave_confirm),e||m.find(".bb-group-name").html(''+u+""),h("body").find('[data-current-anchor="true"]').removeClass("bp-toggle-action-button bp-toggle-action-button-hover").addClass("bp-toggle-action-button-clicked"),p.show(),h(n).attr("data-current-anchor","true"),h(n).attr("data-popup-shown","true"),!1}}else h("body").find('[data-popup-shown="true"]').attr("data-popup-shown","false"),h("body").find('[data-current-anchor="true"]').attr("data-current-anchor","false"),p.find(".bb-leave-group-content .bb-group-name").html(""),p.hide();b={};h(n).closest("#item-header").length?b=h("#item-header .bb-remove-connection"):h(n).closest('.members[data-bp-list="members"]').length?b=h('.members[data-bp-list="members"] .bb-remove-connection'):h(n).closest('.group_members[data-bp-list="group_members"]').length&&(b=h('.group_members[data-bp-list="group_members"] .bb-remove-connection'));u=h(n).data("bb-user-name"),p=h(n).data("bb-user-link");if("is_friend"===o&&"opened"!==h(n).attr("data-popup-shown")){if(b.length)return b.find(".bb-remove-connection-content .bb-user-name").html(''+u+""),h("body").find('[data-current-anchor="true"]').removeClass("bp-toggle-action-button bp-toggle-action-button-hover").addClass("bp-toggle-action-button-clicked"),b.show(),h(n).attr("data-current-anchor","true"),h(n).attr("data-popup-shown","opened"),!1}else h("body").find('[data-popup-shown="opened"]').attr("data-popup-shown","closed"),h("body").find('[data-current-anchor="true"]').attr("data-current-anchor","false"),b.length&&(b.find(".bb-remove-connection-content .bb-user-name").html(""),b.hide());l=t?a.getLinkParams(t,"_wpnonce"):void 0===n.prop("href")?a.getLinkParams(n.attr("href"),"_wpnonce"):a.getLinkParams(n.prop("href"),"_wpnonce"),u={is_friend:"remove_friend",not_friends:"add_friend",pending:"withdraw_friendship",accept_friendship:"accept_friendship",reject_friendship:"reject_friendship"};"members"===d&&void 0!==u[o]&&(o=u[o],d="friends");b={not_following:"follow",following:"unfollow"};"members"===d&&void 0!==b[o]&&(o=b[o],d="follow"),n.addClass("pending loading");t="";h(document.body).hasClass("directory")&&h(document.body).hasClass("members")||h(document.body).hasClass("group-members")?t="directory":h(document.body).hasClass("bp-user")&&(t="single");u="primary",b="single"===t?n.closest(".header-dropdown"):n.closest(".footer-button-wrap");void 0!==b.length&&0"+e.data.feedback+"","info",null,!0])}var t,i;return(h("#friends-personal-li").length&&(i=h("#friends-personal-li a span"),t=h("#friends-personal-li a"),(void 0!==e.data.is_user&&e.data.is_user&&void 0!==e.data.friend_count||void 0!==e.data.friend_count)&&("0"!==e.data.friend_count?i.length?h(i).html(e.data.friend_count):h(t).append(''+e.data.friend_count+""):h(i).hide())),void 0!==e.data.is_user&&e.data.is_user)?(n.parent().html(e.data.feedback),void s.fadeOut(1500)):void 0!==e.data.is_user&&!e.data.is_user&&void 0!==e.data.group_url&&e.data.group_url?window.location=e.data.group_url:(h(a.objectNavParent+' [data-bp-scope="personal"]').length&&(i=Number(h(a.objectNavParent+' [data-bp-scope="personal"] span').html())||0,-1!==h.inArray(o,["leave_group","remove_friend"])?--i:-1!==h.inArray(o,["join_group"])&&(i+=1),i<0&&(i=0),h(a.objectNavParent+' [data-bp-scope="personal"] span').html(i)),"follow"===d&&0"+e.data.feedback+"","error",null,!0])}).fail(function(){var e,t;["unsubscribe","subscribe"].includes(o)&&(25<(e=h(n).data("bb-group-name")).length&&(e=e.substring(0,25)+"..."),t="
                        "+BP_Nouveau.subscriptions.error+""+e+".
                        ","subscribe"===o&&(t="
                        "+BP_Nouveau.subscriptions.subscribe_error+""+e+"
                        "),jQuery(document).trigger("bb_trigger_toast_message",["",t,"error",null,!0])),n.removeClass("pending loading")})},buttonRevert:function(e){e=h(e.currentTarget);e.hasClass("bp-toggle-action-button-clicked")&&!e.hasClass("loading")&&(h(document.body).hasClass("buddyboss-theme")&&void 0!==e.data("balloon")?e.attr("data-balloon",e.data("title-displayed")):e.text(e.data("title-displayed")),e.removeClass("bp-toggle-action-button-clicked"),e.addClass("bp-toggle-action-button"))},buttonHover:function(e){var t=h(e.currentTarget),i=t.data("bp-btn-action"),a=t.closest("[data-bp-item-id]"),n=a.data("bp-item-id"),a=a.data("bp-item-component");return i&&n&&a?(e.preventDefault(),t.hasClass("bp-toggle-action-button")?(t.hasClass("group-subscription")&&void 0!==t.data("title")&&void 0!==t.data("title-displayed")&&0===t.data("title").replace(/<(.|\n)*?>/g,"").length&&0===t.data("title-displayed").replace(/<(.|\n)*?>/g,"").length||(h(document.body).hasClass("buddyboss-theme")&&void 0!==t.data("balloon")&&(t.hasClass("following")||t.attr("data-balloon",t.data("title").replace(/<(.|\n)*?>/g,"")),t.find("span").html(t.data("title"))),t.html(t.data("title"))),t.removeClass("bp-toggle-action-button"),t.addClass("bp-toggle-action-button-hover"),!1):void 0):e},buttonHoverout:function(e){e=h(e.currentTarget);if(e.hasClass("bp-toggle-action-button-hover")&&!e.hasClass("loading")){if(e.hasClass("group-subscription")&&void 0!==e.data("title")&&void 0!==e.data("title-displayed")&&0===e.data("title").replace(/<(.|\n)*?>/g,"").length&&0===e.data("title-displayed").replace(/<(.|\n)*?>/g,"").length)return e.removeClass("bp-toggle-action-button-hover"),e.addClass("bp-toggle-action-button"),!1;h(document.body).hasClass("buddyboss-theme")&&void 0!==e.data("balloon")&&(e.hasClass("following")||e.attr("data-balloon",e.data("title-displayed").replace(/<(.|\n)*?>/g,"")),e.find("span").html(e.data("title-displayed"))),e.html(e.data("title-displayed")),e.removeClass("bp-toggle-action-button-hover"),e.addClass("bp-toggle-action-button")}},awaitingButtonHover:function(e){var t=h(e.currentTarget);if(e.preventDefault(),t.hasClass("bp-toggle-action-button"))return h(document.body).hasClass("buddyboss-theme")&&void 0!==t.data("balloon")&&(t.hasClass("following")||t.attr("data-balloon",t.data("title").replace(/<(.|\n)*?>/g,"")),t.find("span").html(t.data("title"))),t.html(t.data("title")),t.removeClass("bp-toggle-action-button"),t.addClass("bp-toggle-action-button-hover"),!1},awaitingButtonHoverout:function(e){e=h(e.currentTarget);e.hasClass("bp-toggle-action-button-hover")&&!e.hasClass("loading")&&(h(document.body).hasClass("buddyboss-theme")&&void 0!==e.data("balloon")&&(e.hasClass("following")||e.attr("data-balloon",e.data("title-displayed").replace(/<(.|\n)*?>/g,"")),e.find("span").html(e.data("title-displayed"))),e.html(e.data("title-displayed")),e.removeClass("bp-toggle-action-button-hover"),e.addClass("bp-toggle-action-button"))},leaveGroupAction:function(e){e.preventDefault(),h("body").find('[data-current-anchor="true"]').removeClass("bp-toggle-action-button bp-toggle-action-button-hover").addClass("bp-toggle-action-button-clicked"),h("body").find('[data-current-anchor="true"]').trigger("click")},leaveGroupClose:function(e){e.preventDefault();e=h(e.currentTarget),e=h(e).closest(".bb-leave-group-popup");h("body").find('[data-current-anchor="true"]').attr("data-current-anchor","false"),h("body").find('[data-popup-shown="true"]').attr("data-popup-shown","false"),e.find(".bb-leave-group-content .bb-group-name").html(""),e.hide()},removeConnectionAction:function(e){e.preventDefault(),h("body").find('[data-current-anchor="true"]').removeClass("bp-toggle-action-button bp-toggle-action-button-hover").addClass("bp-toggle-action-button-clicked"),h("body").find('[data-current-anchor="true"]').trigger("click")},removeConnectionClose:function(e){e.preventDefault();e=h(e.currentTarget),e=h(e).closest(".bb-remove-connection");h("body").find('[data-current-anchor="true"]').attr("data-current-anchor","false"),h("body").find('[data-popup-shown="opened"]').attr("data-popup-shown","closed"),e.find(".bb-remove-connection-content .bb-user-name").html(""),e.hide()},buttonRevertAll:function(){h.each(h("#buddypress [data-bp-btn-action]"),function(){h(this).hasClass("bp-toggle-action-button-clicked")&&!h(this).hasClass("loading")&&(h(document.body).hasClass("buddyboss-theme")&&void 0!==h(this).data("balloon")?h(this).attr("data-balloon",h(this).data("title-displayed")):h(this).text(h(this).data("title-displayed")),h(this).removeClass("bp-toggle-action-button-clicked"),h(this).addClass("bp-toggle-action-button"),h(this).trigger("blur"))})},addRemoveInvite:function(e){var t=e.currentTarget,i=h(t).closest("tbody");if(h(t).hasClass("field-actions-remove")){if(!(1"+e+"").insertBefore(h(this).closest("tr")),20 input").attr("name","invitee["+e+"][]"),h(this).find(".field-name > input").attr("id","invitee_"+e+"_title"),h(this).find(".field-email > input").attr("name","email["+e+"][]"),h(this).find(".field-email > input").attr("id","email_"+e+"_email"),h(this).find(".field-member-type > select").attr("name","member-type["+e+"][]"),h(this).find(".field-member-type > select").attr("id","member_type_"+e+"_member_type")})},closeNotice:function(e){var t=h(e.currentTarget);e.preventDefault(),"clear"===t.data("bp-close")&&(void 0!==h.cookie("bp-message")&&h.removeCookie("bp-message"),void 0!==h.cookie("bp-message-type")&&h.removeCookie("bp-message-type")),t.closest(".bp-feedback").hasClass("bp-sitewide-notice")&&bp.Nouveau.ajax({action:"messages_dismiss_sitewide_notice"},"messages"),t.closest(".bp-feedback").remove()},paginateAction:function(e){var t,i=e.data,a=h(e.currentTarget),n=null,o=null,s=null,r=null,d=a.closest("[data-bp-pagination]").data("bp-pagination")||null;if(null===d)return e;e.preventDefault(),null!==(e=h(e.delegateTarget).data("bp-list")||null)&&(void 0!==(t=i.getStorage("bp-"+e)).scope&&(n=t.scope),void 0!==t.filter&&(o=t.filter),void 0!==t.extras&&(r=t.extras)),null!==e&&(void 0!==(t=i.getStorage("bp-"+e)).scope&&(n=t.scope),void 0!==t.filter&&(o=t.filter),void 0!==t.extras&&(r=t.extras));d={object:e,scope:n,filter:o,search_terms:s=h('#buddypress [data-bp-search="'+e+'"] input[type=search]').length?h('#buddypress [data-bp-search="'+e+'"] input[type=search]').val():s,extras:r,caller:a.closest("[data-bp-pagination]").hasClass("bottom")?"pag-bottom":"",page:i.getLinkParams(a.prop("href"),d)||1};h("#buddypress [data-bp-group-type-filter]").length&&(d.group_type=h("#buddypress [data-bp-group-type-filter]").val()),h("#buddypress [data-bp-member-type-filter]").length&&(d.member_type_id=h("#buddypress [data-bp-member-type-filter]").val()),i.objectRequest(d)},enableSubmitOnLegalAgreement:function(){h("body #buddypress #register-page #signup-form #legal_agreement").length&&(h("body #buddypress #register-page #signup-form .submit #signup_submit").prop("disabled",!0),h(document).on("change","body #buddypress #register-page #signup-form #legal_agreement",function(){h(this).prop("checked")?h("body #buddypress #register-page #signup-form .submit #signup_submit").prop("disabled",!1):h("body #buddypress #register-page #signup-form .submit #signup_submit").prop("disabled",!0)}))},registerPopUp:function(){h(".popup-modal-register").length&&h(".popup-modal-register").magnificPopup({type:"inline",preloader:!1,fixedBgPos:!0,fixedContentPos:!0}),h(".popup-modal-dismiss").length&&h(".popup-modal-dismiss").click(function(e){e.preventDefault(),h.magnificPopup.close()})},loginPopUp:function(){h(".popup-modal-login").length&&h(".popup-modal-login").magnificPopup({type:"inline",preloader:!1,fixedBgPos:!0,fixedContentPos:!0}),h(".popup-modal-dismiss").length&&h(".popup-modal-dismiss").click(function(e){e.preventDefault(),h.magnificPopup.close()})},threadListBlockPopup:function(e){e.preventDefault();var t=h(this).data("bp-content-id"),i=h(this).data("bp-content-type"),a=h(this).data("bp-nonce"),n=h(this).attr("href");void 0!==t&&void 0!==i&&void 0!==a&&(h(document).find(".bp-report-form-err").empty(),(e=h(n)).find(".bp-content-id").val(t),e.find(".bp-content-type").val(i),e.find(".bp-nonce").val(a)),0"),void e.preventDefault();t=h(e.currentTarget).closest("#header-cover-image").height(),i=h(e.currentTarget).closest("#header-cover-image").width(),a=Number(h(e.currentTarget).closest("#cover-image-container").find(".header-cover-img").css("top").replace("px","")),n=h(e.currentTarget).closest("#header-cover-image").width()/h(e.currentTarget).closest("#header-cover-image").find(".header-cover-reposition-wrap img")[0].width,l.closest("#cover-image-container").find(".header-cover-reposition-wrap").show(),(r=h(".header-cover-reposition-wrap img")).guillotine({width:i,height:t,eventOnChange:"guillotinechange",init:{scale:n,y:a&&h(e.currentTarget).closest("#header-cover-image").hasClass("has-position")?-a:d,w:i,h:t}}),r.on("guillotinechange",function(e,t){l.closest("#cover-image-container").find(".header-cover-img").attr("data-top",-t.y)})}else h(e.currentTarget).hasClass("cover-image-save")?(o=h(e.currentTarget),s=h(e.currentTarget).closest("#cover-image-container").find(".header-cover-img"),o.addClass("loading"),h.post(BP_Nouveau.ajaxurl,{action:"save_cover_position",position:s.attr("data-top")}).done(function(e){e.success&&e.data&&""!==e.data.content?(o.removeClass("loading"),o.closest("#cover-image-container").find(".header-cover-reposition-wrap").hide(),o.closest("#header-cover-image:not(.has-position)").addClass("has-position"),s.css({top:e.data.content+"px"})):(o.removeClass("loading"),o.closest("#cover-image-container").find(".header-cover-reposition-wrap").hide())}).fail(function(){o.removeClass("loading"),o.closest("#cover-image-container").find(".header-cover-reposition-wrap").hide()})):h(e.currentTarget).hasClass("cover-image-cancel")&&((r=h(".header-cover-reposition-wrap img")).guillotine({width:0,height:0,init:{scale:1,y:0,w:0,h:0}}),r.guillotine("remove"),h(e.currentTarget).closest("#cover-image-container").find(".header-cover-reposition-wrap").hide(),h(e.currentTarget).closest("#cover-image-container").find(".header-cover-img").attr("data-top",""));e.preventDefault()},coverPhotoCropperAlert:function(e){e.preventDefault(),h("#cover-photo-alert").remove()},toggleMoreOption:function(e){h(e.target).hasClass("bb_more_options_action")||h(e.target).parent().hasClass("bb_more_options_action")?(e.preventDefault(),h(e.target).closest(".bb_more_options").find(".bb_more_options_list").hasClass("is_visible")?h(".bb_more_options").find(".bb_more_options_list").removeClass("is_visible"):(h(".bb_more_options").find(".bb_more_options_list").removeClass("is_visible"),h(e.target).closest(".bb_more_options").find(".bb_more_options_list").addClass("is_visible"))):(h(".bb_more_options").find(".bb_more_options_list").removeClass("is_visible"),h(".optionsOpen").removeClass("optionsOpen"))},getVideoThumb:function(d,l){var e,i=new FileReader;i.onload=function(){var t,e=new Blob([i.result],{type:d.type}),n=URL.createObjectURL(e),o=document.createElement("video");o.src=n;var s=0,r=setInterval(function(){var e;05e4;if(i){var a=document.createElement("img");a.src=t;if(d.previewElement){if(h(d.previewElement).find(l).find("img").length)h(d.previewElement).find(l).find("img").attr("src",t);else h(d.previewElement).find(l).append(a);h(d.previewElement).closest(".dz-preview").addClass("dz-has-thumbnail")}else if(h(l).find("img").length)h(l).find("img").attr("src",t);else h(l).append(a);URL.revokeObjectURL(n)}else{if(s>=2){h(d.previewElement).closest(".dz-preview").addClass("dz-has-no-thumbnail");clearInterval(r)}s++}return i}()||(o.removeEventListener("timeupdate",e),o.pause())}),o.preload="metadata",o.src=n,o.muted=!0,o.playsInline=!0,null!=t&&(o.currentTime=Math.floor(t)),o.play(),clearInterval(r)),2<=s&&(h(d.previewElement).closest(".dz-preview").addClass("dz-has-no-thumbnail"),clearInterval(r)),s++},500)},d.dataURL?((e=new XMLHttpRequest).open("GET",d.dataURL,!0),e.responseType="blob",e.onload=function(){var e;200==this.status&&(e=this.response,i.readAsArrayBuffer(e))},e.send()):i.readAsArrayBuffer(d)},bbWidgetMoreFollowing:function(e){e=h(e.currentTarget).attr("href").split("#");if(1 li").each(function(){t+=h(this).outerWidth()}),t>e.width()-10?(e.data("childerWith",t),t>e.width()&&(0===e.find(".medium-editor-toolbar-actions .medium-editor-action-more").length&&e.find(".medium-editor-toolbar-actions").append('
                        • '),e.find(".medium-editor-action-more").show(),t+=e.find(".medium-editor-toolbar-actions .medium-editor-action-more").outerWidth(),h(e.find(".medium-editor-action").get().reverse()).each(function(){h(this).hasClass("medium-editor-action-more-button")||t>e.width()&&(t-=h(this).outerWidth(),e.find(".medium-editor-action-more > ul").prepend(h(this).parent()))}))):e.find(".medium-editor-toolbar-actions .medium-editor-action-more").length&&(h(e.find(".medium-editor-action-more ul > li")).each(function(){t+35 li").length&&e.find(".medium-editor-action-more").hide()),h(e).find(".medium-editor-action-more-button").on("click",function(e){e.preventDefault(),h(this).parent(".medium-editor-action-more").toggleClass("active")}),h(e).find(".medium-editor-action-more ul .medium-editor-action").on("click",function(e){e.preventDefault(),h(this).closest(".medium-editor-action-more").toggleClass("active")}),h(window).one("resize",function(){e.removeClass("wrappingInitialised"),h(e).find(".medium-editor-action-more ul .medium-editor-action").unbind("click")}))},isURL:function(e){return/^(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,24}(:[0-9]{1,5})?(\/.*)?$/.test(h.trim(e))},closeActionPopup:function(e){e.preventDefault(),h(this).closest(".bb-action-popup").hide()},directorySearchInput:function(){var e,t;h(this).val()===h(this).data("last-value")||""===h(this).val()&&void 0===h(this).data("last-value")||(h(this).data("last-value",h(this).val()),t=(e=h(this).closest(".search-form-has-reset")).find(".search-form_reset"),0"),h(this).hasClass("disabled")||h(this).find("input:checked").length&&(a+=""===a?h(this).find('input[type="checkbox"] + label').text().trim():", "+h(this).find('input[type="checkbox"] + label').text().trim(),o++)}),o===h(this).find(e+':not(:first-child) input[type="checkbox"]').length?1==h(this).find(e+':not(:first-child) input[type="checkbox"]').length||(a=t):a=""===a?i:a,0===h(this).find(e+":first-child .bb-mobile-setting").length?h(this).find(e+":first-child").append('
                          '+a+"
                            "):h(this).find(e+":first-child .bb-mobile-setting .bb-mobile-setting-anchor").text(a),h(this).find(e+":first-child .bb-mobile-setting ul").html(""),h(this).find(e+":first-child .bb-mobile-setting ul").append(n)})},dropZoneGlobalProgress:function(i){0==h(i.element).find(".dz-global-progress").length&&(h(i.element).append('

                            '),h(i.element).addClass("dz-progress-view"),h(i.element).find(".dz-remove-all").click(function(){h.each(i.files,function(e,t){i.removeFile(t)})}));var e="",t=0,a=0;1==i.files.length?(h(i.element).addClass("dz-single-view"),e="Uploading "+i.files[0].name+"",t=i.files[0].upload.progress):(h(i.element).removeClass("dz-single-view"),a=0,h.each(i.files,function(e,t){a+=t.upload.progress}),t=a/i.files.length,e="Uploading "+i.files.length+" files"),h(i.element).find(".dz-global-progress .dz-progress").css("width",t+"%"),h(i.element).find(".dz-global-progress > p").html(e)},userPresenceStatus:function(){window.bb_is_user_active=!0;var e=1e3*parseInt(BB_Nouveau_Presence.idle_inactive_span);bp.Nouveau.userPresenceChecker(e),""!==BB_Nouveau_Presence.heartbeat_enabled&&parseInt(BB_Nouveau_Presence.presence_interval)<=60?(h(document).on("heartbeat-send",function(e,t){var i;void 0!==window.bb_is_user_active&&!0===window.bb_is_user_active&&(i=bp.Nouveau.getPageUserIDs(),t.presence_users=i.join(","))}),h(document).on("heartbeat-tick",function(e,t){t.users_presence&&bp.Nouveau.updateUsersPresence(t.users_presence)})):setInterval(function(){var e,t={};void 0!==window.bb_is_user_active&&!0===window.bb_is_user_active&&(t.ids=bp.Nouveau.getPageUserIDs()),void 0!==t.ids&&void 0!==t.ids.length&&0
                            '),n.currentPreviewParent=t.find(".bb-url-scrapper-container")),0
                            ").html(e)).find("a.bp-suggestions-mention").remove(),i.find('[rel="nofollow"]').remove(),0<=(e=0<=(e=i.html()).indexOf("/g,""):e).indexOf("http://")?o=this.getURL("http://",e):0<=e.indexOf("https://")?o=this.getURL("https://",e):0<=e.indexOf("www.")&&(o=this.getURL("www",e)),""===o&&""===s||(""!==o&&((e=document.createElement("a")).href=o,e=e.hostname,void 0!==BP_Nouveau.forums.params.excluded_hosts&&-1!==BP_Nouveau.forums.params.excluded_hosts.indexOf(e)&&(o="")),""!==o?this.loadURLPreview(o):s&&this.loadURLPreview(s)))},getURL:function(e,t){var i="",a=(t=t.replace(/ /g,"")).indexOf(e),n="";if(_.isUndefined(jQuery(h.parseHTML(t)).attr("href"))){for(var o=a;o"===t[o+1]||"<"===t[o]&&"b"===t[o+1]&&"r"===t[o+2]);o++)i+=t[o];"www"===e&&(i=(e="http://")+i)}else i=jQuery(t).attr("href");e=document.createElement("div");e.innerHTML=i;for(var s=e.getElementsByTagName("*");s[0];)s[0].parentNode.removeChild(s[0]);return n=0 Date: Thu, 23 May 2024 14:21:04 +0530 Subject: [PATCH 4/4] PROD-7208 - Grunt --- src/bp-templates/bp-nouveau/js/buddypress-activity.min.js | 2 +- src/bp-templates/bp-nouveau/js/buddypress-nouveau.min.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bp-templates/bp-nouveau/js/buddypress-activity.min.js b/src/bp-templates/bp-nouveau/js/buddypress-activity.min.js index b1565f6703..1660b08a78 100644 --- a/src/bp-templates/bp-nouveau/js/buddypress-activity.min.js +++ b/src/bp-templates/bp-nouveau/js/buddypress-activity.min.js @@ -1 +1 @@ -window.bp=window.bp||{},function(q){"undefined"!=typeof BP_Nouveau&&(bp.Nouveau=bp.Nouveau||{},bp.Models=bp.Models||{},bp.Models.ACReply=Backbone.Model.extend({defaults:{gif_data:{}}}),bp.Nouveau.Activity={start:function(){this.setupGlobals(),this.addListeners()},setupGlobals:function(){this.just_posted=[],this.current_page=1,this.mentions_count=Number(q(bp.Nouveau.objectNavParent+' [data-bp-scope="mentions"]').find("a span").html())||0,this.heartbeat_data={newest:"",highlights:{},last_recorded:0,first_recorded:0,document_title:q(document).prop("title")},void 0!==window.Dropzone&&void 0!==BP_Nouveau.media&&(window.Dropzone.autoDiscover=!1,this.dropzone_options={url:BP_Nouveau.ajaxurl,timeout:108e5,dictFileTooBig:BP_Nouveau.media.dictFileTooBig,dictDefaultMessage:BP_Nouveau.media.dropzone_media_message,acceptedFiles:"image/*",autoProcessQueue:!0,addRemoveLinks:!0,uploadMultiple:!1,maxFiles:void 0!==BP_Nouveau.media.maxFiles?BP_Nouveau.media.maxFiles:10,maxFilesize:void 0!==BP_Nouveau.media.max_upload_size?BP_Nouveau.media.max_upload_size:2,dictMaxFilesExceeded:BP_Nouveau.media.media_dict_file_exceeded,dictCancelUploadConfirmation:BP_Nouveau.media.dictCancelUploadConfirmation,maxThumbnailFilesize:void 0!==BP_Nouveau.media.max_upload_size?BP_Nouveau.media.max_upload_size:2},void 0!==BP_Nouveau.media.dropzone_options&&Object.assign(this.dropzone_options,BP_Nouveau.media.dropzone_options)),this.dropzone_obj=null,this.dropzone_media=[],this.dropzone_document_obj=null,this.dropzone_document=[],this.dropzone_video_obj=null,this.dropzone_video=[],this.models=[],this.InitiatedCommentForms=[],this.activityHasUpdates=!1,this.currentActivityId=null,this.activityPinHasUpdates=!1},addListeners:function(){q("body").hasClass("activity-singular")||q("#buddypress").on("bp_heartbeat_send",this.heartbeatSend.bind(this)),q("#buddypress").on("bp_heartbeat_tick",this.heartbeatTick.bind(this)),q('#buddypress [data-bp-list="activity"]:not( #bb-schedule-posts_modal [data-bp-list="activity"] )').on("click","li.load-newest, li.load-more",this.injectActivities.bind(this)),q("#buddypress").on("bp_ajax_request",'[data-bp-list="activity"]',this.scopeLoaded.bind(this)),q("#activity-stream").on("click",".acomments-view-more",this.showActivity),q("body").on("click",".bb-close-action-popup",this.closeActivity),q(document).on("activityModalOpened",function(e,t){var a=t.activityId;q(document).on("click",function(e){0li.bb-edit-privacy a",bp.Nouveau,this.activityPrivacyRedirect.bind(this)),q('#buddypress [data-bp-list="activity"], #activity-modal').on("click",".activity-privacy>li:not(.bb-edit-privacy)",bp.Nouveau,this.activityPrivacyChange.bind(this)),q('#buddypress [data-bp-list="activity"], #bb-media-model-container .activity-list, #activity-modal').on("click","span.privacy",bp.Nouveau,this.togglePrivacyDropdown.bind(this)),q("#bb-media-model-container .activity-list").on("click",".activity-item",bp.Nouveau,this.activityActions.bind(this)),q(".bb-activity-model-wrapper").on("click",".ac-form-placeholder",bp.Nouveau,this.activityRootComment.bind(this)),q(document).keydown(this.commentFormAction),q(document).click(this.togglePopupDropdown),q('#buddypress [data-bp-list="activity"], #bb-media-model-container .activity-list, #activity-modal .activity-list, .bb-modal-activity-footer').on("click",".ac-reply-media-button",this.openCommentsMediaUploader.bind(this)),q('#buddypress [data-bp-list="activity"], #bb-media-model-container .activity-list, #activity-modal .activity-list, .bb-modal-activity-footer').on("click",".ac-reply-document-button",this.openCommentsDocumentUploader.bind(this)),q('#buddypress [data-bp-list="activity"], #bb-media-model-container .activity-list, #activity-modal .activity-list, .bb-modal-activity-footer').on("click",".ac-reply-video-button",this.openCommentsVideoUploader.bind(this)),q('#buddypress [data-bp-list="activity"], #bb-media-model-container .activity-list, #activity-modal .activity-list, .bb-modal-activity-footer').on("click",".ac-reply-gif-button",this.openGifPicker.bind(this)),q(document).on("click",this.toggleActivityOption.bind(this)),q(document).on("click",".activity-state-popup_overlay",bp.Nouveau,this.closeActivityState.bind(this)),q(document).on("click",".activity-state-popup .activity-state-popup_tab_panel a",this.ReactionStatePopupTab),_.isUndefined(BP_Nouveau.activity.params.autoload)||q(window).scroll(this.loadMoreActivities),q(".bb-activity-model-wrapper, .bb-media-model-wrapper").on("click",".acomments-view-more",this.viewMoreComments.bind(this)),q(document).on("click","#activity-stream .activity-comments .view-more-comments, #activity-stream .activity-state-comments > .comments-count",function(e){e.preventDefault(),q(this).parents("li.activity-item").find(".activity-comments > ul > li.acomments-view-more, .activity-comments > .activity-actions > ul > li.acomments-view-more").trigger("click")}),q("#activity-modal > .bb-modal-activity-body").on("scroll",this.autoloadMoreComments.bind(this)),q("#activity-modal > .bb-modal-activity-body").on("scroll",this.discardGifEmojiPicker.bind(this)),q(".bb-activity-model-wrapper .bb-model-close-button").on("click",this.activitySyncOnModalClose.bind(this)),void 0!==BP_Nouveau.is_send_ajax_request&&"1"===BP_Nouveau.is_send_ajax_request?q("#buddypress").on("bp_ajax_request",'[data-bp-list="activity"]',function(){setTimeout(function(){q(".ac-form.not-initialized").each(function(){var e=q(this),t=e.find(".ac-textarea");bp.Nouveau.Activity.toggleMultiMediaOptions(e,t)})},1e3)}):setTimeout(function(){q(".ac-form.not-initialized").each(function(){var e=q(this),t=e.find(".ac-textarea");bp.Nouveau.Activity.toggleMultiMediaOptions(e,t)})},1e3)},heartbeatSend:function(e,t){this.heartbeat_data.first_recorded=q("#buddypress [data-bp-list] [data-bp-activity-id]:not(.bb-pinned)").first().data("bp-timestamp")||0;var a=q("#buddypress [data-bp-list] [data-bp-activity-id]").first().data("bp-timestamp")||0;a>this.heartbeat_data.first_recorded&&(this.heartbeat_data.first_recorded=a),(0===this.heartbeat_data.last_recorded||this.heartbeat_data.first_recorded>this.heartbeat_data.last_recorded)&&(this.heartbeat_data.last_recorded=this.heartbeat_data.first_recorded),t.bp_activity_last_recorded=this.heartbeat_data.last_recorded,q("#buddypress .dir-search input[type=search]").length&&(t.bp_activity_last_recorded_search_terms=q("#buddypress .dir-search input[type=search]").val()),q.extend(t,{bp_heartbeat:bp.Nouveau.getStorage("bp-activity")})},heartbeatTick:function(e,t){var a,i,o=bp.Nouveau.objects,d=bp.Nouveau.getStorage("bp-activity","scope"),s=this;void 0!==t&&t.bp_activity_newest_activities&&(this.heartbeat_data.newest=q.trim(t.bp_activity_newest_activities.activities)+this.heartbeat_data.newest,this.heartbeat_data.last_recorded=Number(t.bp_activity_newest_activities.last_recorded),i=q(this.heartbeat_data.newest).filter(".activity-item"),a=Number(i.length),o.push("mentions"),"all"===d?(q.each(i,function(e,a){a=q(a),q.each(o,function(e,t){-1!==q.inArray("bp-my-"+t,a.get(0).classList)&&(void 0===s.heartbeat_data.highlights[t]?s.heartbeat_data.highlights[t]=[a.data("bp-activity-id")]:-1===q.inArray(a.data("bp-activity-id"),s.heartbeat_data.highlights[t])&&s.heartbeat_data.highlights[t].push(a.data("bp-activity-id")))})}),t=new RegExp("bp-my-("+o.join("|")+")","g"),this.heartbeat_data.newest=this.heartbeat_data.newest.replace(t,""),q(bp.Nouveau.objectNavParent+' [data-bp-scope="all"]').find("a span").html(a)):(this.heartbeat_data.highlights[d]=[],q.each(i,function(e,t){s.heartbeat_data.highlights[d].push(q(t).data("bp-activity-id"))})),q.each(o,function(e,t){var a;void 0!==s.heartbeat_data.highlights[t]&&s.heartbeat_data.highlights[t].length&&(a=0,"mentions"===t&&(a=s.mentions_count),q(bp.Nouveau.objectNavParent+' [data-bp-scope="'+t+'"]').find("a span").html(Number(s.heartbeat_data.highlights[t].length)+a))}),o.pop(),q(document).prop("title","("+a+") "+this.heartbeat_data.document_title),q('#buddypress [data-bp-list="activity"]').first().hasClass("load-newest")?(i=q('#buddypress [data-bp-list="activity"] .load-newest a').html(),q('#buddypress [data-bp-list="activity"] .load-newest a').html(i.replace(/([0-9]+)/,a))):q('#buddypress [data-bp-list="activity"] ul.activity-list').prepend('
                          • '+BP_Nouveau.newest+" ("+a+")
                          • "),q('#buddypress [data-bp-list="activity"] li.load-newest').trigger("click"),q('#buddypress [data-bp-list="activity"]').trigger("bp_heartbeat_pending",this.heartbeat_data),void 0!==bp.Nouveau&&bp.Nouveau.reportPopUp())},injectActivities:function(e){var t,a,i,o,d=bp.Nouveau.getStorage("bp-activity"),s=d.scope||null,d=d.filter||null;q(e.currentTarget).hasClass("load-newest")?(e.preventDefault(),q(e.currentTarget).remove(),i=q.parseHTML(this.heartbeat_data.newest),q.each(i,function(e,t){"LI"===t.nodeName&&q(t).hasClass("just-posted")&&q("#"+q(t).prop("id")).length&&q("#"+q(t).prop("id")).remove()}),(0<(i=q(e.delegateTarget).find(".activity-list .activity-item").first()).length&&i.hasClass("bb-pinned")?q(i).after(this.heartbeat_data.newest):q(e.delegateTarget).find(".activity-list").prepend(this.heartbeat_data.newest)).find("li.activity-item").each(bp.Nouveau.hideSingleUrl).trigger("bp_heartbeat_prepend",this.heartbeat_data),this.heartbeat_data.newest="","all"===s&&q(bp.Nouveau.objectNavParent+' [data-bp-scope="all"]').find("a span").html(""),"mentions"===s&&(bp.Nouveau.ajax({action:"activity_clear_new_mentions"},"activity"),this.mentions_count=0),q(bp.Nouveau.objectNavParent+' [data-bp-scope="'+s+'"]').find("a span").html(""),void 0!==this.heartbeat_data.highlights[s]&&(this.heartbeat_data.highlights[s]=[]),setTimeout(function(){q(e.delegateTarget).find("[data-bp-activity-id]").removeClass("newest_"+s+"_activity")},3e3),q(document).prop("title",this.heartbeat_data.document_title),jQuery(window).scroll()):q(e.currentTarget).hasClass("load-more")&&(t=+Number(this.current_page)+1,a=this,i="",e.preventDefault(),(o=q(e.currentTarget)).find("a").first().addClass("loading"),this.just_posted=[],q(e.delegateTarget).children(".just-posted").each(function(){a.just_posted.push(q(this).data("bp-activity-id"))}),q("#buddypress .dir-search input[type=search]").length&&(i=q("#buddypress .dir-search input[type=search]").val()),bp.Nouveau.objectRequest({object:"activity",scope:s,filter:d,search_terms:i,page:t,method:"append",exclude_just_posted:this.just_posted.join(","),target:'#buddypress [data-bp-list]:not( #bb-schedule-posts_modal [data-bp-list="activity"] ) ul.bp-list'}).done(function(e){!0===e.success&&(o.remove(),a.current_page=t,jQuery(window).scroll())})),q(".activity-item.bb-closed-comments").find(".edit-activity, .acomment-edit").parents(".generic-button").hide()},hideComments:function(e){var a,i,o,e=q(e.target).find(".activity-comments");e.length&&e.each(function(e,t){o=q(t).children("ul").not(".conflict-activity-ul-li-comment"),(i=q(o).find("li").not(q(".document-action-class, .media-action-class, .video-action-class"))).length&&(q("body").hasClass("activity-singular")&&""!==window.location.hash&&q(window.location.hash).length&&0!==q(window.location.hash).closest(".activity-comments").length||(a=q(t).closest(".activity-item"),q("#acomment-comment-"+a.data("bp-activity-id")+" span.comment-count").html(),i.each(function(e,t){if(e"),window.location.hash&&"#"+q(t).attr("id")===window.location.hash)return q(t).parents("li.comment-item").show(),!1;q(t).addClass("bp-hidden").hide()}}),q(o).children(".bp-hidden").length===q(o).children("li").length-1&&q(o).find("li.show-all").length&&q(o).children("li:not(.show-all)").removeClass("bp-hidden").toggle()))})},showActivity:function(e){e.preventDefault();var t=q(e.currentTarget).parent(),a=t.data("parent_comment_id"),t=q(t).data("activity_id");q(document).trigger("activityModalOpened",{activityId:t}),q(e.currentTarget).parents(".activity-comments").find(".ac-form").each(function(){var e=q(this),t=q(this).closest(".activity-comments"),a=q(this).closest(".comment-item");e.find(".post-elements-buttons-item.post-emoji").removeClass("active").empty(""),bp.Nouveau.Activity.resetActivityCommentForm(e,"hardReset"),t.append(e),a.find(".acomment-display").removeClass("display-focus"),a.removeClass("comment-item-focus")}),bp.Nouveau.Activity.launchActivityPopup(t,a)},closeActivity:function(e){e.preventDefault();var t=q(e.target).closest(".bb-activity-model-wrapper"),a=t.find(".bb-modal-activity-footer"),i=t.find(".activity-item").data("bp-activity-id"),e=t.find("#ac-form-"+i);bp.Nouveau.Activity.reinitializeActivityCommentForm(e),_.isUndefined(BP_Nouveau.media)||_.isUndefined(BP_Nouveau.media.emoji)||bp.Nouveau.Activity.initializeEmojioneArea(!1,"",i),t.find("#activity-modal").removeClass("bb-closed-comments"),t.closest("body").removeClass("acomments-modal-open"),t.hide(),t.find("ul.activity-list").empty(),a.removeClass("active"),a.find("form.ac-form").remove()},scopeLoaded:function(e,a){this.current_page=1,"mentions"===a.scope&&void 0!==a.response.new_mentions?(q.each(a.response.new_mentions,function(e,t){q("#buddypress #activity-stream").find('[data-bp-activity-id="'+t+'"]').addClass("newest_mentions_activity")}),this.mentions_count=0):void 0!==this.heartbeat_data.highlights[a.scope]&&this.heartbeat_data.highlights[a.scope].length&&q.each(this.heartbeat_data.highlights[a.scope],function(e,t){q("#buddypress #activity-stream").find('[data-bp-activity-id="'+t+'"]').length&&q("#buddypress #activity-stream").find('[data-bp-activity-id="'+t+'"]').addClass("newest_"+a.scope+"_activity")}),this.heartbeat_data.newest="",q.each(q(bp.Nouveau.objectNavParent+" [data-bp-scope]").find("a span"),function(e,t){0===parseInt(q(t).html(),10)&&q(t).html("")}),void 0!==this.heartbeat_data.highlights[a.scope]&&(this.heartbeat_data.highlights[a.scope]=[]),q(document).prop("title",this.heartbeat_data.document_title),setTimeout(function(){q("#buddypress #activity-stream .activity-item").removeClass("newest_"+a.scope+"_activity")},3e3),void 0!==window.instgrm&&window.instgrm.Embeds.process(),void 0!==window.FB&&void 0!==window.FB.XFBML&&window.FB.XFBML.parse(),this.fixAtWhoActivity(),this.openEditActivityPopup(),this.navigateToSpecificComment(),setTimeout(function(){jQuery(window).scroll()},200)},openEditActivityPopup:function(){var e,t;!_.isUndefined(BP_Nouveau.activity.params.is_activity_edit)&&0 ul");if(e.data.redirect)return window.location.href=e.data.redirect;e.data.parent_activity_id&&e.data.activity&&q("body:not(.activity-singular) #buddypress #activity-stream ul.activity-list li#activity-"+e.data.parent_activity_id).replaceWith(e.data.activity),k&&(x=1,i=B.find(".acomments-view-more").data("child-count"),c.append(B.find("form")),q.each(B.find("li.comment-item"),function(){x+=1}),x+=void 0!==i?parseFloat(i):0,N=m.find("span.comments-count"),z=N.text().length?N.text().match(/\d+/)[0]:0,z=Number(z-x),p.length?(i=1 ul").html().trim()&&t.removeClass("has-child-comments")}),k||c.data("bp-timestamp")!==d.Activity.heartbeat_data.last_recorded||(d.Activity.heartbeat_data.newest="",d.Activity.heartbeat_data.last_recorded=0),q(document).trigger("bp_activity_ajax_delete_request",q.extend(A,{response:e})),q(document).trigger("bp_activity_ajax_delete_request_video",q.extend(A,{response:e})),bp.Nouveau.Activity.activityHasUpdates=!0,bp.Nouveau.Activity.currentActivityId=r}j.removeClass("active")})}if(l.closest("span").hasClass("activity-read-more")){var T=l.closest("div"),U=l.closest("span");if(C=null,q(T).hasClass("activity-inner")?C=r:q(T).hasClass("acomment-content")&&(C=l.closest("li").data("bp-activity-comment-id")),!C)return e;e.preventDefault(),q(U).addClass("loading"),d.ajax({action:"get_single_activity_content",id:C},"activity").done(function(e){"object"!=typeof e&&0/gi,"\n").replace(/<\/div>/gi,""),S={action:"new_activity_comment",_wpnonce_new_activity_comment:q("#_wpnonce_new_activity_comment").val(),comment_id:C,form_id:r,content:R};q("#_bp_as_nonce_"+r).val()&&(S["_bp_as_nonce_"+r]=q("#_bp_as_nonce_"+r).val()),this.dropzone_media.length&&(S.media=this.dropzone_media),this.dropzone_document.length&&(S.document=this.dropzone_document),this.dropzone_video.length&&(S.video=this.dropzone_video,_.isEmpty(S.content)&&(S.content="​")),_.isUndefined(this.models[r])||(n=this.models[r],S.gif_data=this.models[r].get("gif_data")),S.content=S.content.replace(/ /g," "),s.hasClass("acomment-edit")&&(S.edit_comment=!0);var H=0"):t.append("
                              ")),H?s.closest("#activity-modal").find(".bb-modal-activity-body .activity-comments, .bb-modal-activity-body .activity-comments .activity-actions").children("ul").append(q(a)):t.children("ul").append(q(a).hide().fadeIn(200)),q(s).find(".ac-input").first().html(""),t.parent().addClass("has-comments"),t.parent().addClass("comments-loaded"),m.addClass("has-comments")),s.removeClass("acomment-edit");t=s.find(".ac-reply-content");if(0'+BP_Nouveau.activity.strings.commentPostError+""):(e=e.responseJSON&&e.responseJSON.message?e.responseJSON.message:e.statusText,s.find(".ac-reply-content").after('
                              '+e+"
                              "))})}if(l.hasClass("edit")&&l.hasClass("edit-activity")&&(e.preventDefault(),R=c.data("bp-activity"),S=""!==c.data("link-url")?c.data("link-url"):null,void 0!==R&&(bp.Nouveau.Activity.postForm.displayEditActivityForm(R,S),l.closest("li").hasClass("groups")?q("#bp-nouveau-activity-form").addClass("group-activity"):q("#bp-nouveau-activity-form").removeClass("group-activity"),void 0!==bp.Nouveau.Media&&void 0!==bp.Nouveau.Media.Theatre&&(bp.Nouveau.Media.Theatre.is_open_media||bp.Nouveau.Media.Theatre.is_open_document)&&(q(document).find(".bb-close-media-theatre").trigger("click"),q(document).find(".bb-close-document-theatre").trigger("click")))),u&&(l.hasClass("bb-open-media-theatre")||l.hasClass("bb-open-video-theatre")||l.hasClass("bb-open-document-theatre")||l.hasClass("document-detail-wrap-description-popup"))&&(e.preventDefault(),l.closest("#activity-modal").find(".bb-modal-activity-header .bb-close-action-popup").trigger("click")),l.hasClass("pin-activity")||l.hasClass("unpin-activity")){if(e.preventDefault(),!r)return e;l.closest(".activity-item").addClass("loading-pin");var O="pin";l.hasClass("unpin-activity")&&(O="unpin"),d.ajax({action:"activity_update_pinned_post",id:r,pin_action:O},"activity").done(function(e){var t,a,i,o,d,s,n;l.closest(".activity-item").removeClass("loading-pin"),void 0!==(e="object"!=typeof e?JSON.parse(e):e).data&&void 0!==e.data.feedback&&(t=l.closest("ul.activity-list"),n=u?l.closest(".buddypress-wrap").find("#activity-stream"):l.closest("#activity-stream"),e.success&&(a=bp.Nouveau.getStorage("bp-activity","scope"),o=i=!1,d="",l.closest("li.activity-item").hasClass("groups")&&(o=!0,d=(d=l.closest("li.activity-item").attr("class").match(/group-\d+/))[0].replace("group-","")),n.hasClass("single-user")?i=!1:(n.hasClass("activity")&&"all"===a&&!o||n.hasClass("single-group"))&&(i=!0),"pin"===O?(i&&t.find("li.activity-item").removeClass("bb-pinned"),s="li.activity-item:not(.groups)",o&&!n.hasClass("single-group")?s="li.activity-item.group-"+d:o&&n.hasClass("single-group")&&(s="li.activity-item"),t.find(s).each(function(){var e=q(this).find(".unpin-activity");e.removeClass("unpin-activity").addClass("pin-activity"),o?e.find("span").html(BP_Nouveau.activity.strings.pinGroupPost):e.find("span").html(BP_Nouveau.activity.strings.pinPost)}),i&&l.closest("li.activity-item").addClass("bb-pinned"),l.addClass("unpin-activity"),l.removeClass("pin-activity"),l.closest("li.activity-item").hasClass("groups")?l.find("span").html(BP_Nouveau.activity.strings.unpinGroupPost):l.find("span").html(BP_Nouveau.activity.strings.unpinPost)):"unpin"===O&&(l.closest("li.activity-item").removeClass("bb-pinned"),l.addClass("pin-activity"),l.removeClass("unpin-activity"),l.closest("li.activity-item").hasClass("groups")?l.find("span").html(BP_Nouveau.activity.strings.pinGroupPost):l.find("span").html(BP_Nouveau.activity.strings.pinPost)),"all"===a&&i&&(bp.Nouveau.Activity.heartbeat_data.last_recorded=0,bp.Nouveau.refreshActivities())),q(document).trigger("bb_trigger_toast_message",["","
                              "+e.data.feedback+"
                              ","success",null,!0]))}).fail(function(){l.closest(".activity-item").removeClass("loading-pin"),q(document).trigger("bb_trigger_toast_message",["","
                              "+BP_Nouveau.activity.strings.pinPostError+"
                              ","error",null,!0])})}if(l.hasClass("bb-icon-bell-slash")||l.hasClass("bb-icon-bell")){if(e.preventDefault(),!r)return e;l.closest(".activity-item").addClass("loading-mute");var Q="mute";l.hasClass("bb-icon-bell")&&(Q="unmute"),d.ajax({action:"toggle_activity_notification_status",id:r,notification_toggle_action:Q},"activity").done(function(e){l.closest(".activity-item").removeClass("loading-mute"),void 0!==(e="object"!=typeof e?JSON.parse(e):e).data&&void 0!==e.data.feedback&&(e.success&&("mute"===Q?(l.closest("li.activity-item").addClass("bb-muted"),l.removeClass("bb-icon-bell-slash"),l.addClass("bb-icon-bell"),l.attr("title",BP_Nouveau.activity.strings.unmuteNotification),l.find("span").html(BP_Nouveau.activity.strings.unmuteNotification)):"unmute"===Q&&(l.closest("li.activity-item").removeClass("bb-muted"),l.removeClass("bb-icon-bell"),l.addClass("bb-icon-bell-slash"),l.attr("title",BP_Nouveau.activity.strings.muteNotification),l.find("span").html(BP_Nouveau.activity.strings.muteNotification)),void 0!==bp.Nouveau.Activity.activityHasUpdates&&(bp.Nouveau.Activity.activityHasUpdates=!0)),q(document).trigger("bb_trigger_toast_message",["","
                              "+e.data.feedback+"
                              ","success",null,!0])),u&&(bp.Nouveau.Activity.activityPinHasUpdates=!0),bp.Nouveau.Activity.activityHasUpdates=!0,bp.Nouveau.Activity.currentActivityId=r}).fail(function(){l.closest(".activity-item").removeClass("loading-pin"),q(document).trigger("bb_trigger_toast_message",["","
                              "+BP_Nouveau.activity.strings.pinPostError+"
                              ","error",null,!0])})}if(l.hasClass("close-activity-comment")||l.hasClass("unclose-activity-comment")){if(e.preventDefault(),!r)return e;l.closest(".activity-item").addClass("loading-pin");var V="close_comments";l.hasClass("unclose-activity-comment")&&(V="unclose_comments"),d.ajax({action:"activity_update_close_comments",id:r,close_comments_action:V},"activity").done(function(e){var t;l.closest(".activity-item").removeClass("loading-pin"),void 0!==(e="object"!=typeof e?JSON.parse(e):e).data&&void 0!==e.data.feedback&&(e.success&&(t=q("#activity-stream > .activity-list").find("[data-bp-activity-id="+r+"]"),l.closest(".activity-item").find(".bb-activity-closed-comments-notice").remove(),"close_comments"===V?(l.closest("li.activity-item").addClass("bb-closed-comments"),0'+e.data.feedback+""),0'+e.data.feedback+""))):"unclose_comments"===V&&(l.closest("li.activity-item.bb-closed-comments").find(".edit-activity, .acomment-edit").parents(".generic-button").show(),l.closest("li.activity-item").removeClass("bb-closed-comments"),0"+e.data.feedback+"",e.success?"success":"error",null,!0]))}).fail(function(){l.closest(".activity-item").removeClass("loading-pin"),q(document).trigger("bb_trigger_toast_message",["","
                              "+BP_Nouveau.activity.strings.closeCommentsError+"
                              ","error",null,!0])})}},commentFormAction:function(e){var t,a;return(e=e||window.event).target?t=e.target:e.srcElement&&(t=e.srcElement),3===t.nodeType&&(t=t.parentNode),!0!==e.altKey&&!0!==e.metaKey&&"TEXTAREA"===t.tagName&&q(t).hasClass("ac-input")?void(27===(a=e.keyCode||e.which)&&!1===e.ctrlKey?"TEXTAREA"===t.tagName&&q(t).closest("form").slideUp(200):e.ctrlKey&&13===a&&q(t).val()&&q(t).closest("form").find("[type=submit]").first().trigger("click")):e},togglePopupDropdown:function(e){var t;return(e=e||window.event).target?t=e.target:e.srcElement&&(t=e.srcElement),3===t.nodeType&&(t=t.parentNode),!0===e.altKey||!0===e.metaKey||q(t).hasClass("privacy-wrap")||q(t).parent().hasClass("privacy-wrap")?e:void q("ul.activity-privacy").removeClass("bb-open")},loadMoreActivities:function(){var e,t=q(".load-more:visible").last(),a=q(window);t.closest(".activity-list").length&&t.get(0)&&!t.data("bp-autoloaded")&&(e=t.offset().top-50,a.scrollTop()+a.height()>e&&(t.data("bp-autoloaded",1),t.find("a").text(BP_Nouveau.activity.strings.loadingMore),t.find("a").trigger("click")))},destroyCommentMediaUploader:function(e){_.isNull(this.dropzone_obj)||(this.dropzone_obj.destroy(),q("#ac-reply-post-media-uploader-"+e).html(""),q("#ac-reply-post-media-uploader-1-"+e).html("")),this.dropzone_media=[],q("#ac-reply-post-media-uploader-"+e).removeClass("open").addClass("closed"),q("#ac-reply-media-button-"+e).removeClass("active")},destroyCommentDocumentUploader:function(e){_.isNull(this.dropzone_document_obj)||(this.dropzone_document_obj.destroy(),q("#ac-reply-post-document-uploader-"+e).html("")),this.dropzone_document=[],q("#ac-reply-post-document-uploader-"+e).removeClass("open").addClass("closed"),q("#ac-reply-document-button-"+e).removeClass("active")},destroyCommentVideoUploader:function(e){_.isNull(this.dropzone_video_obj)||(this.dropzone_video_obj.destroy(),q("#ac-reply-post-video-uploader-"+e).html("")),this.dropzone_video=[],q("#ac-reply-post-video-uploader-"+e).removeClass("open").addClass("closed"),q("#ac-reply-video-button-"+e).removeClass("active")},resetGifPicker:function(e){q("#ac-reply-gif-button-"+e).closest(".post-gif").find(".gif-media-search-dropdown").removeClass("open").empty(),q("#ac-reply-gif-button-"+e).removeClass("active"),q(".gif-media-search-dropdown-standalone").removeClass("open").empty(),_.isUndefined(this.models[e])||(this.models[e].set("gif_data",{}),q("#ac-reply-post-gif-"+e).find(".activity-attached-gif-container").removeAttr("style"))},openCommentsMediaUploader:function(e){var l=this,o=q(e.currentTarget),t=o.data("ac-id"),a=o.closest(".bp-ac-form-container").find("#ac-reply-post-media-uploader-"+t),i=0'+t+""),this.removeFile(e),a.removeClass("media-uploading"))}),l.dropzone_obj.on("removedfile",function(e){if(l.dropzone_media.length)for(var t in l.dropzone_media)if(e.upload.uuid==l.dropzone_media[t].uuid){void 0===l.dropzone_media[t].saved||l.dropzone_media[t].saved||bp.Nouveau.Media.removeAttachment(l.dropzone_media[t].id),l.dropzone_media.splice(t,1);break}var a,i;_.isNull(l.dropzone_obj)||_.isNull(l.dropzone_obj.files)||0!==l.dropzone_obj.files.length?o.closest(".ac-form").addClass("has-content"):(a=o.parents(".ac-reply-toolbar"),(i=o.closest(".ac-form")).removeClass("has-media"),a.find(".ac-reply-document-button")&&a.find(".ac-reply-document-button").parents(".post-elements-buttons-item").removeClass("disable"),a.find(".ac-reply-video-button")&&a.find(".ac-reply-video-button").parents(".post-elements-buttons-item").removeClass("disable"),a.find(".ac-reply-gif-button")&&a.find(".ac-reply-gif-button").parents(".post-elements-buttons-item").removeClass("disable"),a.find(".ac-reply-media-button")&&a.find(".ac-reply-media-button").parents(".post-elements-buttons-item").removeClass("no-click").find(".toolbar-button").removeClass("active"),q(l.dropzone_obj.element).removeClass("files-uploaded dz-progress-view").find(".dz-global-progress").remove(),l.validateCommentContent(i.find(".ac-textarea").children(".ac-input")))}),l.dropzone_obj.on("complete",function(){0===this.getUploadingFiles().length&&0===this.getQueuedFiles().length&&0'+t+""),this.removeFile(e),a.removeClass("media-uploading"))}),l.dropzone_document_obj.on("removedfile",function(e){if(l.dropzone_document.length)for(var t in l.dropzone_document)if(e.upload.uuid==l.dropzone_document[t].uuid){void 0===l.dropzone_document[t].saved||l.dropzone_document[t].saved||bp.Nouveau.Media.removeAttachment(l.dropzone_document[t].id),l.dropzone_document.splice(t,1);break}var a,i;_.isNull(l.dropzone_document_obj)||_.isNull(l.dropzone_document_obj.files)||0!==l.dropzone_document_obj.files.length?o.closest(".ac-form").addClass("has-content"):(a=o.parents(".ac-reply-toolbar"),(i=o.closest(".ac-form")).removeClass("has-media"),a.find(".ac-reply-media-button")&&a.find(".ac-reply-media-button").parents(".post-elements-buttons-item").removeClass("disable"),a.find(".ac-reply-video-button")&&a.find(".ac-reply-video-button").parents(".post-elements-buttons-item").removeClass("disable"),a.find(".ac-reply-gif-button")&&a.find(".ac-reply-gif-button").parents(".post-elements-buttons-item").removeClass("disable"),a.find(".ac-reply-document-button")&&a.find(".ac-reply-document-button").parents(".post-elements-buttons-item").removeClass("no-click").find(".toolbar-button").removeClass("active"),q(l.dropzone_document_obj.element).removeClass("files-uploaded dz-progress-view").find(".dz-global-progress").remove(),l.validateCommentContent(i.find(".ac-textarea").children(".ac-input")))}),l.dropzone_document_obj.on("complete",function(){0===this.getUploadingFiles().length&&0===this.getQueuedFiles().length&&0'),q(e.previewElement).closest(".dz-preview").addClass("dz-has-thumbnail")):bp.Nouveau.getVideoThumb&&bp.Nouveau.getVideoThumb(e,".dz-video-thumbnail")}),l.dropzone_video_obj.on("uploadprogress",function(){o.closest(".ac-form").addClass("media-uploading"),bp.Nouveau.dropZoneGlobalProgress&&bp.Nouveau.dropZoneGlobalProgress(this)}),l.dropzone_video_obj.on("success",function(e,t){if(100===e.upload.progress&&(q(e.previewElement).find(".dz-progress-ring circle")[0].style.strokeDashoffset=0,q(e.previewElement).find(".dz-progress-count").text("100% "+BP_Nouveau.video.i18n_strings.video_uploaded_text),q(e.previewElement).closest(".dz-preview").addClass("dz-complete")),t.data.id)return e.id=t.id,t.data.uuid=e.upload.uuid,t.data.menu_order=q(e.previewElement).closest(".dropzone").find(e.previewElement).index()-1,t.data.album_id=void 0!==BP_Nouveau.video&&void 0!==BP_Nouveau.video.album_id&&BP_Nouveau.video.album_id,t.data.group_id=void 0!==BP_Nouveau.video&&void 0!==BP_Nouveau.video.group_id&&BP_Nouveau.video.group_id,t.data.saved=!1,t.data.js_preview=q(e.previewElement).find(".dz-video-thumbnail img").attr("src"),l.dropzone_video.push(t.data),e.previewElement.classList.add("dz-success");var a,i,o,d,s,n=t.data.feedback;for(e.previewElement.classList.add("dz-error"),s=[],i=0,o=(d=e.previewElement.querySelectorAll("[data-dz-errormessage]")).length;i'+t+""),this.removeFile(e),a.removeClass("media-uploading"))}),l.dropzone_video_obj.on("removedfile",function(e){if(l.dropzone_video.length)for(var t in l.dropzone_video)if(e.upload.uuid==l.dropzone_video[t].uuid){void 0===l.dropzone_video[t].saved||l.dropzone_video[t].saved||bp.Nouveau.Media.removeAttachment(l.dropzone_video[t].id),l.dropzone_video.splice(t,1);break}var a,i;_.isNull(l.dropzone_video_obj)||_.isNull(l.dropzone_video_obj.files)||0!==l.dropzone_video_obj.files.length?o.closest(".ac-form").addClass("has-content"):(a=o.parents(".ac-reply-toolbar"),(i=o.closest(".ac-form")).removeClass("has-media"),a.find(".ac-reply-media-button")&&a.find(".ac-reply-media-button").parents(".post-elements-buttons-item").removeClass("disable"),a.find(".ac-reply-document-button")&&a.find(".ac-reply-document-button").parents(".post-elements-buttons-item").removeClass("disable"),a.find(".ac-reply-gif-button")&&a.find(".ac-reply-gif-button").parents(".post-elements-buttons-item").removeClass("disable"),a.find(".ac-reply-video-button")&&a.find(".ac-reply-video-button").parents(".post-elements-buttons-item").removeClass("no-click").find(".toolbar-button").removeClass("active"),q(l.dropzone_video_obj.element).removeClass("files-uploaded dz-progress-view").find(".dz-global-progress").remove(),l.validateCommentContent(i.find(".ac-textarea").children(".ac-input")))}),l.dropzone_video_obj.on("complete",function(){0===this.getUploadingFiles().length&&0===this.getQueuedFiles().length&&0/gi,"\n").replace(/<\/div>/gi,""))).replace(/ /g," ");""!==e.text().trim()||0<=t.indexOf("emojioneemoji")||e.closest("form").hasClass("acomment-edit")?e.closest("form").addClass("has-content"):e.closest("form").removeClass("has-content")},ReactionStatePopupTab:function(e){e.preventDefault(),q(this).closest(".activity-state-popup").find(".activity-state-popup_tab_panel li a").removeClass("active"),q(this).addClass("active"),q(this).closest(".activity-state-popup").find(".activity-state-popup_tab_content .activity-state-popup_tab_item").removeClass("active"),q(this).closest(".activity-state-popup").find("."+q(this).data("tab")).addClass("active")},closeActivityState:function(){q(".activity-state-popup").hide().removeClass("active")},listenCommentInput:function(e){var t,a;0/gi,"\n").replace(/<\/div>/gi,""));t=t.replace(/ /g," "),""!==jQuery(e.currentTarget).text().trim()||0<=t.indexOf("emojioneemoji")?jQuery(e.currentTarget).closest("form").addClass("has-content"):jQuery(e.currentTarget).closest("form").removeClass("has-content")}),q(t).closest("form").addClass("events-initiated"),this.InitiatedCommentForms.push(a)))},activityRootComment:function(e){var t=q(e.currentTarget).closest("#activity-modal"),a=t.find(".activity-item").data("bp-activity-id"),e=t.find("#ac-form-"+a);bp.Nouveau.Activity.resetActivityCommentForm(e,"hardReset"),t.find(".acomment-display").removeClass("display-focus"),t.find(".comment-item").removeClass("comment-item-focus"),t.find(".bb-modal-activity-footer").addClass("active").append(e),e.addClass("root"),e.find("#ac-input-"+a).focus(),bp.Nouveau.Activity.clearFeedbackNotice(e)},clearFeedbackNotice:function(e){e.find(".bp-ac-form-container").find(".bp-feedback").length&&e.find(".bp-ac-form-container").find(".bp-feedback").remove()},launchActivityPopup:function(e,t){var a=q("#activity-"+e),i=q(".bb-activity-model-wrapper"),o=a[0].outerHTML,d='[data-parent_comment_id="'+t+'"]',t=a.data("activity-popup-title");bp.Nouveau.Activity.activityHasUpdates=!1,bp.Nouveau.Activity.currentActivityId=null,bp.Nouveau.Activity.activityPinHasUpdates=!1,i.closest("body").addClass("acomments-modal-open"),i.show(),i.find("ul.activity-list").html(o),i.find(".bb-modal-activity-header h2").text(t),i.find(".bb-activity-video-elem").each(function(e,t){var o=q(t);o.find("video").each(function(e,t){var a=q(t),i=a.attr("id")+Math.floor(1e4*Math.random());a.attr("id",i);t=o.find(".video-action-wrap");a.insertAfter(t),o.find(".video-js").remove(),a.addClass("video-js"),videojs(i,{controls:!0,aspectRatio:"16:9",fluid:!0,playbackRates:[.5,1,1.5,2],fullscreenToggle:!1})})}),a.hasClass("bb-closed-comments")&&i.find("#activity-modal").addClass("bb-closed-comments");t=i.find("#ac-form-"+e);i.find(".acomment-display").removeClass("display-focus"),i.find(".comment-item").removeClass("comment-item-focus"),i.find(".bb-modal-activity-footer").addClass("active").append(t),t.removeClass("not-initialized").addClass("root"),t.find("#ac-input-"+e).focus(),bp.Nouveau.Activity.clearFeedbackNotice(t),t.removeClass("events-initiated");a=i.find(".bb-modal-activity-footer").find(".ac-input[contenteditable]");bp.Nouveau.Activity.listenCommentInput(a),i.find(".bb-activity-more-options-wrap .bb-activity-more-options-action, .bb-pin-action_button, .bb-mute-action_button").attr("data-balloon-pos","left"),i.find(".privacy-wrap").attr("data-bp-tooltip-pos","right"),i.find(d).children(".acomments-view-more").first().trigger("click"),_.isUndefined(BP_Nouveau.media)||_.isUndefined(BP_Nouveau.media.emoji)||bp.Nouveau.Activity.initializeEmojioneArea(!0,"#activity-modal ",e),void 0!==bp.Nouveau&&bp.Nouveau.reportPopUp(),bp.Nouveau.Activity.toggleMultiMediaOptions(t,"",".bb-modal-activity-footer")},viewMoreComments:function(e){e.preventDefault();var t=q(e.currentTarget).parent(),i=q(e.currentTarget),o=q(t).data("activity_id"),d=q(e.currentTarget).closest(".activity-comments"),s=q(e.currentTarget).closest(".activity-item"),n=q(t).data("parent_comment_id"),l="";i.addClass("loading").removeClass("acomments-view-more--hide"),d.addClass("active"),s.addClass("active"),i.html('
                              ');var a={action:"activity_loadmore_comments",activity_id:o,parent_comment_id:n,offset:q(e.currentTarget).parents(".activity-comments").find('ul[data-parent_comment_id ="'+n+'"] > li.comment-item:not(.bb-recent-comment)').length,activity_type_is_blog:1"+e.data.message+"

                              ").removeClass("acomments-view-more--hide"),d.removeClass("active"),s.removeClass("active")):void 0!==e.data&&void 0!==e.data.comments&&(t=q(".bb-internal-model .activity-comments").find("[data-activity_id='"+o+"'][data-parent_comment_id='"+n+"']"),a=q(q.parseHTML(e.data.comments)),0"+e.statusText+"

                              ").removeClass("acomments-view-more--hide"),d.removeClass("active"),s.removeClass("active")})},autoloadMoreComments:function(){var e,t,a,i,o;0 ul > li.acomments-view-more:not(.loading), .bb-modal-activity-body .activity-comments .activity-actions > ul > li.acomments-view-more:not(.loading)"),o=q(".bb-activity-model-wrapper .bb-modal-activity-body"),i=q(".bb-activity-model-wrapper .bb-modal-activity-body").find(".activity-comments:not(.active)"),0a&&q(e).trigger("click").addClass("loading")),setTimeout(function(){jQuery(window).scroll()},200))},activitySyncOnModalClose:function(e,t){e.preventDefault();var e=(q(e.currentTarget).is(document)?q(".bb-activity-model-wrapper"):q(e.currentTarget).parents(".bb-activity-model-wrapper")).find("ul.activity-list > li").data("bp-activity-id"),e=void 0!==t?t:e,a=q("#activity-stream li.activity-item[data-bp-activity-id="+e+"]");0 .bb-modal-activity-body .activity-item").data("bp-activity-id");0/gi,"\n").replace(/<\/div>/gi,""));t=t.replace(/ /g," "),""!==e.text()||0<=t.indexOf("emojioneemoji")?e.closest("form").addClass("has-content"):e.closest("form").removeClass("has-content")},picker_show:function(){q(this.button[0]).closest(".post-emoji").addClass("active"),q(".emojionearea-theatre").removeClass("hide").addClass("show")},picker_hide:function(){q(this.button[0]).closest(".post-emoji").removeClass("active"),q(".emojionearea-theatre").removeClass("show").addClass("hide")}}})}},bp.Nouveau.Activity.start())}((bp,jQuery)); \ No newline at end of file +window.bp=window.bp||{},function(H){"undefined"!=typeof BP_Nouveau&&(bp.Nouveau=bp.Nouveau||{},bp.Models=bp.Models||{},bp.Models.ACReply=Backbone.Model.extend({defaults:{gif_data:{}}}),bp.Nouveau.Activity={start:function(){this.setupGlobals(),this.addListeners()},setupGlobals:function(){this.just_posted=[],this.current_page=1,this.mentions_count=Number(H(bp.Nouveau.objectNavParent+' [data-bp-scope="mentions"]').find("a span").html())||0,this.heartbeat_data={newest:"",highlights:{},last_recorded:0,first_recorded:0,document_title:H(document).prop("title")},void 0!==window.Dropzone&&void 0!==BP_Nouveau.media&&(window.Dropzone.autoDiscover=!1,this.dropzone_options={url:BP_Nouveau.ajaxurl,timeout:108e5,dictFileTooBig:BP_Nouveau.media.dictFileTooBig,dictDefaultMessage:BP_Nouveau.media.dropzone_media_message,acceptedFiles:"image/*",autoProcessQueue:!0,addRemoveLinks:!0,uploadMultiple:!1,maxFiles:void 0!==BP_Nouveau.media.maxFiles?BP_Nouveau.media.maxFiles:10,maxFilesize:void 0!==BP_Nouveau.media.max_upload_size?BP_Nouveau.media.max_upload_size:2,dictMaxFilesExceeded:BP_Nouveau.media.media_dict_file_exceeded,dictCancelUploadConfirmation:BP_Nouveau.media.dictCancelUploadConfirmation,maxThumbnailFilesize:void 0!==BP_Nouveau.media.max_upload_size?BP_Nouveau.media.max_upload_size:2},void 0!==BP_Nouveau.media.dropzone_options)&&Object.assign(this.dropzone_options,BP_Nouveau.media.dropzone_options),this.dropzone_obj=null,this.dropzone_media=[],this.dropzone_document_obj=null,this.dropzone_document=[],this.dropzone_video_obj=null,this.dropzone_video=[],this.models=[],this.InitiatedCommentForms=[],this.activityHasUpdates=!1,this.currentActivityId=null,this.activityPinHasUpdates=!1},addListeners:function(){H("body").hasClass("activity-singular")||H("#buddypress").on("bp_heartbeat_send",this.heartbeatSend.bind(this)),H("#buddypress").on("bp_heartbeat_tick",this.heartbeatTick.bind(this)),H('#buddypress [data-bp-list="activity"]:not( #bb-schedule-posts_modal [data-bp-list="activity"] )').on("click","li.load-newest, li.load-more",this.injectActivities.bind(this)),H("#buddypress").on("bp_ajax_request",'[data-bp-list="activity"]',this.scopeLoaded.bind(this)),H("#activity-stream").on("click",".acomments-view-more",this.showActivity),H("body").on("click",".bb-close-action-popup",this.closeActivity),H(document).on("activityModalOpened",function(e,t){var a=t.activityId;H(document).on("click",function(e){0li.bb-edit-privacy a",bp.Nouveau,this.activityPrivacyRedirect.bind(this)),H('#buddypress [data-bp-list="activity"], #activity-modal').on("click",".activity-privacy>li:not(.bb-edit-privacy)",bp.Nouveau,this.activityPrivacyChange.bind(this)),H('#buddypress [data-bp-list="activity"], #bb-media-model-container .activity-list, #activity-modal').on("click","span.privacy",bp.Nouveau,this.togglePrivacyDropdown.bind(this)),H("#bb-media-model-container .activity-list").on("click",".activity-item",bp.Nouveau,this.activityActions.bind(this)),H(".bb-activity-model-wrapper").on("click",".ac-form-placeholder",bp.Nouveau,this.activityRootComment.bind(this)),H(document).keydown(this.commentFormAction),H(document).click(this.togglePopupDropdown),H('#buddypress [data-bp-list="activity"], #bb-media-model-container .activity-list, #activity-modal .activity-list, .bb-modal-activity-footer').on("click",".ac-reply-media-button",this.openCommentsMediaUploader.bind(this)),H('#buddypress [data-bp-list="activity"], #bb-media-model-container .activity-list, #activity-modal .activity-list, .bb-modal-activity-footer').on("click",".ac-reply-document-button",this.openCommentsDocumentUploader.bind(this)),H('#buddypress [data-bp-list="activity"], #bb-media-model-container .activity-list, #activity-modal .activity-list, .bb-modal-activity-footer').on("click",".ac-reply-video-button",this.openCommentsVideoUploader.bind(this)),H('#buddypress [data-bp-list="activity"], #bb-media-model-container .activity-list, #activity-modal .activity-list, .bb-modal-activity-footer').on("click",".ac-reply-gif-button",this.openGifPicker.bind(this)),H(document).on("click",this.toggleActivityOption.bind(this)),H(document).on("click",".activity-state-popup_overlay",bp.Nouveau,this.closeActivityState.bind(this)),H(document).on("click",".activity-state-popup .activity-state-popup_tab_panel a",this.ReactionStatePopupTab),_.isUndefined(BP_Nouveau.activity.params.autoload)||H(window).scroll(this.loadMoreActivities),H(".bb-activity-model-wrapper, .bb-media-model-wrapper").on("click",".acomments-view-more",this.viewMoreComments.bind(this)),H(document).on("click","#activity-stream .activity-comments .view-more-comments, #activity-stream .activity-state-comments > .comments-count",function(e){e.preventDefault(),H(this).parents("li.activity-item").find(".activity-comments > ul > li.acomments-view-more, .activity-comments > .activity-actions > ul > li.acomments-view-more").trigger("click")}),H("#activity-modal > .bb-modal-activity-body").on("scroll",this.autoloadMoreComments.bind(this)),H("#activity-modal > .bb-modal-activity-body").on("scroll",this.discardGifEmojiPicker.bind(this)),H(".bb-activity-model-wrapper .bb-model-close-button").on("click",this.activitySyncOnModalClose.bind(this)),void 0!==BP_Nouveau.is_send_ajax_request&&"1"===BP_Nouveau.is_send_ajax_request?H("#buddypress").on("bp_ajax_request",'[data-bp-list="activity"]',function(){setTimeout(function(){H(".ac-form.not-initialized").each(function(){var e=H(this),t=e.find(".ac-textarea");bp.Nouveau.Activity.toggleMultiMediaOptions(e,t)})},1e3)}):setTimeout(function(){H(".ac-form.not-initialized").each(function(){var e=H(this),t=e.find(".ac-textarea");bp.Nouveau.Activity.toggleMultiMediaOptions(e,t)})},1e3)},heartbeatSend:function(e,t){this.heartbeat_data.first_recorded=H("#buddypress [data-bp-list] [data-bp-activity-id]:not(.bb-pinned)").first().data("bp-timestamp")||0;var a=H("#buddypress [data-bp-list] [data-bp-activity-id]").first().data("bp-timestamp")||0;a>this.heartbeat_data.first_recorded&&(this.heartbeat_data.first_recorded=a),(0===this.heartbeat_data.last_recorded||this.heartbeat_data.first_recorded>this.heartbeat_data.last_recorded)&&(this.heartbeat_data.last_recorded=this.heartbeat_data.first_recorded),t.bp_activity_last_recorded=this.heartbeat_data.last_recorded,H("#buddypress .dir-search input[type=search]").length&&(t.bp_activity_last_recorded_search_terms=H("#buddypress .dir-search input[type=search]").val()),H.extend(t,{bp_heartbeat:bp.Nouveau.getStorage("bp-activity")})},heartbeatTick:function(e,t){var a,i,o=bp.Nouveau.objects,d=bp.Nouveau.getStorage("bp-activity","scope"),s=this;void 0!==t&&t.bp_activity_newest_activities&&(this.heartbeat_data.newest=H.trim(t.bp_activity_newest_activities.activities)+this.heartbeat_data.newest,this.heartbeat_data.last_recorded=Number(t.bp_activity_newest_activities.last_recorded),t=H(this.heartbeat_data.newest).filter(".activity-item"),a=Number(t.length),o.push("mentions"),"all"===d?(H.each(t,function(e,a){a=H(a),H.each(o,function(e,t){-1!==H.inArray("bp-my-"+t,a.get(0).classList)&&(void 0===s.heartbeat_data.highlights[t]?s.heartbeat_data.highlights[t]=[a.data("bp-activity-id")]:-1===H.inArray(a.data("bp-activity-id"),s.heartbeat_data.highlights[t])&&s.heartbeat_data.highlights[t].push(a.data("bp-activity-id")))})}),i=new RegExp("bp-my-("+o.join("|")+")","g"),this.heartbeat_data.newest=this.heartbeat_data.newest.replace(i,""),H(bp.Nouveau.objectNavParent+' [data-bp-scope="all"]').find("a span").html(a)):(this.heartbeat_data.highlights[d]=[],H.each(t,function(e,t){s.heartbeat_data.highlights[d].push(H(t).data("bp-activity-id"))})),H.each(o,function(e,t){var a;void 0!==s.heartbeat_data.highlights[t]&&s.heartbeat_data.highlights[t].length&&(a=0,"mentions"===t&&(a=s.mentions_count),H(bp.Nouveau.objectNavParent+' [data-bp-scope="'+t+'"]').find("a span").html(Number(s.heartbeat_data.highlights[t].length)+a))}),o.pop(),H(document).prop("title","("+a+") "+this.heartbeat_data.document_title),H('#buddypress [data-bp-list="activity"]').first().hasClass("load-newest")?(i=H('#buddypress [data-bp-list="activity"] .load-newest a').html(),H('#buddypress [data-bp-list="activity"] .load-newest a').html(i.replace(/([0-9]+)/,a))):H('#buddypress [data-bp-list="activity"] ul.activity-list').prepend('
                            • '+BP_Nouveau.newest+" ("+a+")
                            • "),H('#buddypress [data-bp-list="activity"] li.load-newest').trigger("click"),H('#buddypress [data-bp-list="activity"]').trigger("bp_heartbeat_pending",this.heartbeat_data),void 0!==bp.Nouveau)&&bp.Nouveau.reportPopUp()},injectActivities:function(e){var t,a,i,o,d=bp.Nouveau.getStorage("bp-activity"),s=d.scope||null,d=d.filter||null;H(e.currentTarget).hasClass("load-newest")?(e.preventDefault(),H(e.currentTarget).remove(),i=H.parseHTML(this.heartbeat_data.newest),H.each(i,function(e,t){"LI"===t.nodeName&&H(t).hasClass("just-posted")&&H("#"+H(t).prop("id")).length&&H("#"+H(t).prop("id")).remove()}),(0<(i=H(e.delegateTarget).find(".activity-list .activity-item").first()).length&&i.hasClass("bb-pinned")?H(i).after(this.heartbeat_data.newest):H(e.delegateTarget).find(".activity-list").prepend(this.heartbeat_data.newest)).find("li.activity-item").each(bp.Nouveau.hideSingleUrl).trigger("bp_heartbeat_prepend",this.heartbeat_data),this.heartbeat_data.newest="","all"===s&&H(bp.Nouveau.objectNavParent+' [data-bp-scope="all"]').find("a span").html(""),"mentions"===s&&(bp.Nouveau.ajax({action:"activity_clear_new_mentions"},"activity"),this.mentions_count=0),H(bp.Nouveau.objectNavParent+' [data-bp-scope="'+s+'"]').find("a span").html(""),void 0!==this.heartbeat_data.highlights[s]&&(this.heartbeat_data.highlights[s]=[]),setTimeout(function(){H(e.delegateTarget).find("[data-bp-activity-id]").removeClass("newest_"+s+"_activity")},3e3),H(document).prop("title",this.heartbeat_data.document_title),jQuery(window).scroll()):H(e.currentTarget).hasClass("load-more")&&(t=+Number(this.current_page)+1,a=this,i="",e.preventDefault(),(o=H(e.currentTarget)).find("a").first().addClass("loading"),this.just_posted=[],H(e.delegateTarget).children(".just-posted").each(function(){a.just_posted.push(H(this).data("bp-activity-id"))}),H("#buddypress .dir-search input[type=search]").length&&(i=H("#buddypress .dir-search input[type=search]").val()),bp.Nouveau.objectRequest({object:"activity",scope:s,filter:d,search_terms:i,page:t,method:"append",exclude_just_posted:this.just_posted.join(","),target:'#buddypress [data-bp-list]:not( #bb-schedule-posts_modal [data-bp-list="activity"] ) ul.bp-list'}).done(function(e){!0===e.success&&(o.remove(),a.current_page=t,jQuery(window).scroll())})),H(".activity-item.bb-closed-comments").find(".edit-activity, .acomment-edit").parents(".generic-button").hide()},hideComments:function(e){var a,i,o,e=H(e.target).find(".activity-comments");e.length&&e.each(function(e,t){o=H(t).children("ul").not(".conflict-activity-ul-li-comment"),!(i=H(o).find("li").not(H(".document-action-class, .media-action-class, .video-action-class"))).length||H("body").hasClass("activity-singular")&&""!==window.location.hash&&H(window.location.hash).length&&0!==H(window.location.hash).closest(".activity-comments").length||(a=H(t).closest(".activity-item"),H("#acomment-comment-"+a.data("bp-activity-id")+" span.comment-count").html(),i.each(function(e,t){if(e"),window.location.hash&&"#"+H(t).attr("id")===window.location.hash)return H(t).parents("li.comment-item").show(),!1;H(t).addClass("bp-hidden").hide()}}),H(o).children(".bp-hidden").length===H(o).children("li").length-1&&H(o).find("li.show-all").length&&H(o).children("li:not(.show-all)").removeClass("bp-hidden").toggle())})},showActivity:function(e){e.preventDefault();var t=H(e.currentTarget).parent(),a=t.data("parent_comment_id"),t=H(t).data("activity_id");H(document).trigger("activityModalOpened",{activityId:t}),H(e.currentTarget).parents(".activity-comments").find(".ac-form").each(function(){var e=H(this),t=H(this).closest(".activity-comments"),a=H(this).closest(".comment-item");e.find(".post-elements-buttons-item.post-emoji").removeClass("active").empty(""),bp.Nouveau.Activity.resetActivityCommentForm(e,"hardReset"),t.append(e),a.find(".acomment-display").removeClass("display-focus"),a.removeClass("comment-item-focus")}),bp.Nouveau.Activity.launchActivityPopup(t,a)},closeActivity:function(e){e.preventDefault();var e=H(e.target).closest(".bb-activity-model-wrapper"),t=e.find(".bb-modal-activity-footer"),a=e.find(".activity-item").data("bp-activity-id"),i=e.find("#ac-form-"+a);bp.Nouveau.Activity.reinitializeActivityCommentForm(i),_.isUndefined(BP_Nouveau.media)||_.isUndefined(BP_Nouveau.media.emoji)||bp.Nouveau.Activity.initializeEmojioneArea(!1,"",a),e.find("#activity-modal").removeClass("bb-closed-comments"),e.closest("body").removeClass("acomments-modal-open"),e.hide(),e.find("ul.activity-list").empty(),t.removeClass("active"),t.find("form.ac-form").remove()},scopeLoaded:function(e,a){this.current_page=1,"mentions"===a.scope&&void 0!==a.response.new_mentions?(H.each(a.response.new_mentions,function(e,t){H("#buddypress #activity-stream").find('[data-bp-activity-id="'+t+'"]').addClass("newest_mentions_activity")}),this.mentions_count=0):void 0!==this.heartbeat_data.highlights[a.scope]&&this.heartbeat_data.highlights[a.scope].length&&H.each(this.heartbeat_data.highlights[a.scope],function(e,t){H("#buddypress #activity-stream").find('[data-bp-activity-id="'+t+'"]').length&&H("#buddypress #activity-stream").find('[data-bp-activity-id="'+t+'"]').addClass("newest_"+a.scope+"_activity")}),this.heartbeat_data.newest="",H.each(H(bp.Nouveau.objectNavParent+" [data-bp-scope]").find("a span"),function(e,t){0===parseInt(H(t).html(),10)&&H(t).html("")}),void 0!==this.heartbeat_data.highlights[a.scope]&&(this.heartbeat_data.highlights[a.scope]=[]),H(document).prop("title",this.heartbeat_data.document_title),setTimeout(function(){H("#buddypress #activity-stream .activity-item").removeClass("newest_"+a.scope+"_activity")},3e3),void 0!==window.instgrm&&window.instgrm.Embeds.process(),void 0!==window.FB&&void 0!==window.FB.XFBML&&window.FB.XFBML.parse(),this.fixAtWhoActivity(),this.openEditActivityPopup(),this.navigateToSpecificComment(),setTimeout(function(){jQuery(window).scroll()},200)},openEditActivityPopup:function(){var e,t;!_.isUndefined(BP_Nouveau.activity.params.is_activity_edit)&&0 ul"));if(e.data.redirect)return window.location.href=e.data.redirect;e.data.parent_activity_id&&e.data.activity&&H("body:not(.activity-singular) #buddypress #activity-stream ul.activity-list li#activity-"+e.data.parent_activity_id).replaceWith(e.data.activity),B&&(k=1,a=P.find(".acomments-view-more").data("child-count"),c.append(P.find("form")),H.each(P.find("li.comment-item"),function(){k+=1}),k+=void 0!==a?parseFloat(a):0,w=m.find("span.comments-count"),N=w.text().length?w.text().match(/\d+/)[0]:0,N=Number(N-k),p.length?(a=1 ul").html().trim()&&t.removeClass("has-child-comments")}),B||c.data("bp-timestamp")!==d.Activity.heartbeat_data.last_recorded||(d.Activity.heartbeat_data.newest="",d.Activity.heartbeat_data.last_recorded=0),H(document).trigger("bp_activity_ajax_delete_request",H.extend(x,{response:e})),H(document).trigger("bp_activity_ajax_delete_request_video",H.extend(x,{response:e})),bp.Nouveau.Activity.activityHasUpdates=!0,bp.Nouveau.Activity.currentActivityId=r}j.removeClass("active")})}if(l.closest("span").hasClass("activity-read-more")){var A=l.closest("div"),I=l.closest("span");if(g=null,H(A).hasClass("activity-inner")?g=r:H(A).hasClass("acomment-content")&&(g=l.closest("li").data("bp-activity-comment-id")),!g)return e;e.preventDefault(),H(I).addClass("loading"),d.ajax({action:"get_single_activity_content",id:g},"activity").done(function(e){"object"!=typeof e&&0/gi,"\n").replace(/<\/div>/gi,""),a={action:"new_activity_comment",_wpnonce_new_activity_comment:H("#_wpnonce_new_activity_comment").val(),comment_id:g,form_id:r,content:h},S=(H("#_bp_as_nonce_"+r).val()&&(a["_bp_as_nonce_"+r]=H("#_bp_as_nonce_"+r).val()),this.dropzone_media.length&&(a.media=this.dropzone_media),this.dropzone_document.length&&(a.document=this.dropzone_document),this.dropzone_video.length&&(a.video=this.dropzone_video,_.isEmpty(a.content))&&(a.content="​"),_.isUndefined(this.models[r])||(n=this.models[r],a.gif_data=this.models[r].get("gif_data")),a.content=a.content.replace(/ /g," "),s.hasClass("acomment-edit")&&(a.edit_comment=!0),0"):t.append("
                                ")),S?s.closest("#activity-modal").find(".bb-modal-activity-body .activity-comments, .bb-modal-activity-body .activity-comments .activity-actions").children("ul").append(H(a)):t.children("ul").append(H(a).hide().fadeIn(200)),H(s).find(".ac-input").first().html(""),t.parent().addClass("has-comments"),t.parent().addClass("comments-loaded"),m.addClass("has-comments")),s.removeClass("acomment-edit"),s.find(".ac-reply-content"));if(0'+BP_Nouveau.activity.strings.commentPostError+""):(e=e.responseJSON&&e.responseJSON.message?e.responseJSON.message:e.statusText,s.find(".ac-reply-content").after('
                                '+e+"
                                "))})}if(l.hasClass("edit")&&l.hasClass("edit-activity")&&(e.preventDefault(),T=c.data("bp-activity"),y=""!==c.data("link-url")?c.data("link-url"):null,void 0!==T)&&(bp.Nouveau.Activity.postForm.displayEditActivityForm(T,y),l.closest("li").hasClass("groups")?H("#bp-nouveau-activity-form").addClass("group-activity"):H("#bp-nouveau-activity-form").removeClass("group-activity"),void 0!==bp.Nouveau.Media)&&void 0!==bp.Nouveau.Media.Theatre&&(bp.Nouveau.Media.Theatre.is_open_media||bp.Nouveau.Media.Theatre.is_open_document)&&(H(document).find(".bb-close-media-theatre").trigger("click"),H(document).find(".bb-close-document-theatre").trigger("click")),v&&(l.hasClass("bb-open-media-theatre")||l.hasClass("bb-open-video-theatre")||l.hasClass("bb-open-document-theatre")||l.hasClass("document-detail-wrap-description-popup"))&&(e.preventDefault(),l.closest("#activity-modal").find(".bb-modal-activity-header .bb-close-action-popup").trigger("click")),l.hasClass("pin-activity")||l.hasClass("unpin-activity")){if(e.preventDefault(),!r)return e;l.closest(".activity-item").addClass("loading-pin");var M="pin";l.hasClass("unpin-activity")&&(M="unpin"),d.ajax({action:"activity_update_pinned_post",id:r,pin_action:M},"activity").done(function(e){var t,a,i,o,d,s,n;l.closest(".activity-item").removeClass("loading-pin"),void 0!==(e="object"!=typeof e?JSON.parse(e):e).data&&void 0!==e.data.feedback&&(t=l.closest("ul.activity-list"),n=v?l.closest(".buddypress-wrap").find("#activity-stream"):l.closest("#activity-stream"),e.success&&(a=bp.Nouveau.getStorage("bp-activity","scope"),o=i=!1,d="",l.closest("li.activity-item").hasClass("groups")&&(o=!0,d=(d=l.closest("li.activity-item").attr("class").match(/group-\d+/))[0].replace("group-","")),n.hasClass("single-user")?i=!1:(n.hasClass("activity")&&"all"===a&&!o||n.hasClass("single-group"))&&(i=!0),"pin"===M?(i&&t.find("li.activity-item").removeClass("bb-pinned"),s="li.activity-item:not(.groups)",o&&!n.hasClass("single-group")?s="li.activity-item.group-"+d:o&&n.hasClass("single-group")&&(s="li.activity-item"),t.find(s).each(function(){var e=H(this).find(".unpin-activity");e.removeClass("unpin-activity").addClass("pin-activity"),o?e.find("span").html(BP_Nouveau.activity.strings.pinGroupPost):e.find("span").html(BP_Nouveau.activity.strings.pinPost)}),i&&l.closest("li.activity-item").addClass("bb-pinned"),l.addClass("unpin-activity"),l.removeClass("pin-activity"),l.closest("li.activity-item").hasClass("groups")?l.find("span").html(BP_Nouveau.activity.strings.unpinGroupPost):l.find("span").html(BP_Nouveau.activity.strings.unpinPost)):"unpin"===M&&(l.closest("li.activity-item").removeClass("bb-pinned"),l.addClass("pin-activity"),l.removeClass("unpin-activity"),l.closest("li.activity-item").hasClass("groups")?l.find("span").html(BP_Nouveau.activity.strings.pinGroupPost):l.find("span").html(BP_Nouveau.activity.strings.pinPost)),"all"===a)&&i&&(bp.Nouveau.Activity.heartbeat_data.last_recorded=0,bp.Nouveau.refreshActivities()),H(document).trigger("bb_trigger_toast_message",["","
                                "+e.data.feedback+"
                                ","success",null,!0]))}).fail(function(){l.closest(".activity-item").removeClass("loading-pin"),H(document).trigger("bb_trigger_toast_message",["","
                                "+BP_Nouveau.activity.strings.pinPostError+"
                                ","error",null,!0])})}if(l.hasClass("bb-icon-bell-slash")||l.hasClass("bb-icon-bell")){if(e.preventDefault(),!r)return e;l.closest(".activity-item").addClass("loading-mute");var E="mute";l.hasClass("bb-icon-bell")&&(E="unmute"),d.ajax({action:"toggle_activity_notification_status",id:r,notification_toggle_action:E},"activity").done(function(e){l.closest(".activity-item").removeClass("loading-mute"),void 0!==(e="object"!=typeof e?JSON.parse(e):e).data&&void 0!==e.data.feedback&&(e.success&&("mute"===E?(l.closest("li.activity-item").addClass("bb-muted"),l.removeClass("bb-icon-bell-slash"),l.addClass("bb-icon-bell"),l.attr("title",BP_Nouveau.activity.strings.unmuteNotification),l.find("span").html(BP_Nouveau.activity.strings.unmuteNotification)):"unmute"===E&&(l.closest("li.activity-item").removeClass("bb-muted"),l.removeClass("bb-icon-bell"),l.addClass("bb-icon-bell-slash"),l.attr("title",BP_Nouveau.activity.strings.muteNotification),l.find("span").html(BP_Nouveau.activity.strings.muteNotification)),void 0!==bp.Nouveau.Activity.activityHasUpdates)&&(bp.Nouveau.Activity.activityHasUpdates=!0),H(document).trigger("bb_trigger_toast_message",["","
                                "+e.data.feedback+"
                                ","success",null,!0])),v&&(bp.Nouveau.Activity.activityPinHasUpdates=!0),bp.Nouveau.Activity.activityHasUpdates=!0,bp.Nouveau.Activity.currentActivityId=r}).fail(function(){l.closest(".activity-item").removeClass("loading-pin"),H(document).trigger("bb_trigger_toast_message",["","
                                "+BP_Nouveau.activity.strings.pinPostError+"
                                ","error",null,!0])})}if(l.hasClass("close-activity-comment")||l.hasClass("unclose-activity-comment")){if(e.preventDefault(),!r)return e;l.closest(".activity-item").addClass("loading-pin");var D="close_comments";l.hasClass("unclose-activity-comment")&&(D="unclose_comments"),d.ajax({action:"activity_update_close_comments",id:r,close_comments_action:D},"activity").done(function(e){var t;l.closest(".activity-item").removeClass("loading-pin"),void 0!==(e="object"!=typeof e?JSON.parse(e):e).data&&void 0!==e.data.feedback&&(e.success&&(t=H("#activity-stream > .activity-list").find("[data-bp-activity-id="+r+"]"),l.closest(".activity-item").find(".bb-activity-closed-comments-notice").remove(),"close_comments"===D?(l.closest("li.activity-item").addClass("bb-closed-comments"),0'+e.data.feedback+""),0'+e.data.feedback+""))):"unclose_comments"===D&&(l.closest("li.activity-item.bb-closed-comments").find(".edit-activity, .acomment-edit").parents(".generic-button").show(),l.closest("li.activity-item").removeClass("bb-closed-comments"),0"+e.data.feedback+"",e.success?"success":"error",null,!0]))}).fail(function(){l.closest(".activity-item").removeClass("loading-pin"),H(document).trigger("bb_trigger_toast_message",["","
                                "+BP_Nouveau.activity.strings.closeCommentsError+"
                                ","error",null,!0])})}},commentFormAction:function(e){var t,a;return(e=e||window.event).target?t=e.target:e.srcElement&&(t=e.srcElement),3===t.nodeType&&(t=t.parentNode),!0!==e.altKey&&!0!==e.metaKey&&"TEXTAREA"===t.tagName&&H(t).hasClass("ac-input")?void(27===(a=e.keyCode||e.which)&&!1===e.ctrlKey?"TEXTAREA"===t.tagName&&H(t).closest("form").slideUp(200):e.ctrlKey&&13===a&&H(t).val()&&H(t).closest("form").find("[type=submit]").first().trigger("click")):e},togglePopupDropdown:function(e){var t;return(e=e||window.event).target?t=e.target:e.srcElement&&(t=e.srcElement),3===t.nodeType&&(t=t.parentNode),!0===e.altKey||!0===e.metaKey||H(t).hasClass("privacy-wrap")||H(t).parent().hasClass("privacy-wrap")?e:void H("ul.activity-privacy").removeClass("bb-open")},loadMoreActivities:function(){var e,t=H(".load-more:visible").last(),a=H(window);t.closest(".activity-list").length&&t.get(0)&&!t.data("bp-autoloaded")&&(e=t.offset().top-50,a.scrollTop()+a.height()>e)&&(t.data("bp-autoloaded",1),t.find("a").text(BP_Nouveau.activity.strings.loadingMore),t.find("a").trigger("click"))},destroyCommentMediaUploader:function(e){_.isNull(this.dropzone_obj)||(this.dropzone_obj.destroy(),H("#ac-reply-post-media-uploader-"+e).html(""),H("#ac-reply-post-media-uploader-1-"+e).html("")),this.dropzone_media=[],H("#ac-reply-post-media-uploader-"+e).removeClass("open").addClass("closed"),H("#ac-reply-media-button-"+e).removeClass("active")},destroyCommentDocumentUploader:function(e){_.isNull(this.dropzone_document_obj)||(this.dropzone_document_obj.destroy(),H("#ac-reply-post-document-uploader-"+e).html("")),this.dropzone_document=[],H("#ac-reply-post-document-uploader-"+e).removeClass("open").addClass("closed"),H("#ac-reply-document-button-"+e).removeClass("active")},destroyCommentVideoUploader:function(e){_.isNull(this.dropzone_video_obj)||(this.dropzone_video_obj.destroy(),H("#ac-reply-post-video-uploader-"+e).html("")),this.dropzone_video=[],H("#ac-reply-post-video-uploader-"+e).removeClass("open").addClass("closed"),H("#ac-reply-video-button-"+e).removeClass("active")},resetGifPicker:function(e){H("#ac-reply-gif-button-"+e).closest(".post-gif").find(".gif-media-search-dropdown").removeClass("open").empty(),H("#ac-reply-gif-button-"+e).removeClass("active"),H(".gif-media-search-dropdown-standalone").removeClass("open").empty(),_.isUndefined(this.models[e])||(this.models[e].set("gif_data",{}),H("#ac-reply-post-gif-"+e).find(".activity-attached-gif-container").removeAttr("style"))},openCommentsMediaUploader:function(e){var t,l=this,o=H(e.currentTarget),a=o.data("ac-id"),a=o.closest(".bp-ac-form-container").find("#ac-reply-post-media-uploader-"+a),i=0'+t+""),this.removeFile(e),a.removeClass("media-uploading"))}),l.dropzone_obj.on("removedfile",function(e){if(l.dropzone_media.length)for(var t in l.dropzone_media)if(e.upload.uuid==l.dropzone_media[t].uuid){void 0===l.dropzone_media[t].saved||l.dropzone_media[t].saved||bp.Nouveau.Media.removeAttachment(l.dropzone_media[t].id),l.dropzone_media.splice(t,1);break}var a,i;_.isNull(l.dropzone_obj)||_.isNull(l.dropzone_obj.files)||0!==l.dropzone_obj.files.length?o.closest(".ac-form").addClass("has-content"):(a=o.parents(".ac-reply-toolbar"),(i=o.closest(".ac-form")).removeClass("has-media"),a.find(".ac-reply-document-button")&&a.find(".ac-reply-document-button").parents(".post-elements-buttons-item").removeClass("disable"),a.find(".ac-reply-video-button")&&a.find(".ac-reply-video-button").parents(".post-elements-buttons-item").removeClass("disable"),a.find(".ac-reply-gif-button")&&a.find(".ac-reply-gif-button").parents(".post-elements-buttons-item").removeClass("disable"),a.find(".ac-reply-media-button")&&a.find(".ac-reply-media-button").parents(".post-elements-buttons-item").removeClass("no-click").find(".toolbar-button").removeClass("active"),H(l.dropzone_obj.element).removeClass("files-uploaded dz-progress-view").find(".dz-global-progress").remove(),l.validateCommentContent(i.find(".ac-textarea").children(".ac-input")))}),l.dropzone_obj.on("complete",function(){0===this.getUploadingFiles().length&&0===this.getQueuedFiles().length&&0'+t+""),this.removeFile(e),a.removeClass("media-uploading"))}),l.dropzone_document_obj.on("removedfile",function(e){if(l.dropzone_document.length)for(var t in l.dropzone_document)if(e.upload.uuid==l.dropzone_document[t].uuid){void 0===l.dropzone_document[t].saved||l.dropzone_document[t].saved||bp.Nouveau.Media.removeAttachment(l.dropzone_document[t].id),l.dropzone_document.splice(t,1);break}var a,i;_.isNull(l.dropzone_document_obj)||_.isNull(l.dropzone_document_obj.files)||0!==l.dropzone_document_obj.files.length?o.closest(".ac-form").addClass("has-content"):(a=o.parents(".ac-reply-toolbar"),(i=o.closest(".ac-form")).removeClass("has-media"),a.find(".ac-reply-media-button")&&a.find(".ac-reply-media-button").parents(".post-elements-buttons-item").removeClass("disable"),a.find(".ac-reply-video-button")&&a.find(".ac-reply-video-button").parents(".post-elements-buttons-item").removeClass("disable"),a.find(".ac-reply-gif-button")&&a.find(".ac-reply-gif-button").parents(".post-elements-buttons-item").removeClass("disable"),a.find(".ac-reply-document-button")&&a.find(".ac-reply-document-button").parents(".post-elements-buttons-item").removeClass("no-click").find(".toolbar-button").removeClass("active"),H(l.dropzone_document_obj.element).removeClass("files-uploaded dz-progress-view").find(".dz-global-progress").remove(),l.validateCommentContent(i.find(".ac-textarea").children(".ac-input")))}),l.dropzone_document_obj.on("complete",function(){0===this.getUploadingFiles().length&&0===this.getQueuedFiles().length&&0'),H(e.previewElement).closest(".dz-preview").addClass("dz-has-thumbnail")):bp.Nouveau.getVideoThumb&&bp.Nouveau.getVideoThumb(e,".dz-video-thumbnail")}),l.dropzone_video_obj.on("uploadprogress",function(){o.closest(".ac-form").addClass("media-uploading"),bp.Nouveau.dropZoneGlobalProgress&&bp.Nouveau.dropZoneGlobalProgress(this)}),l.dropzone_video_obj.on("success",function(e,t){if(100===e.upload.progress&&(H(e.previewElement).find(".dz-progress-ring circle")[0].style.strokeDashoffset=0,H(e.previewElement).find(".dz-progress-count").text("100% "+BP_Nouveau.video.i18n_strings.video_uploaded_text),H(e.previewElement).closest(".dz-preview").addClass("dz-complete")),t.data.id)return e.id=t.id,t.data.uuid=e.upload.uuid,t.data.menu_order=H(e.previewElement).closest(".dropzone").find(e.previewElement).index()-1,t.data.album_id=void 0!==BP_Nouveau.video&&void 0!==BP_Nouveau.video.album_id&&BP_Nouveau.video.album_id,t.data.group_id=void 0!==BP_Nouveau.video&&void 0!==BP_Nouveau.video.group_id&&BP_Nouveau.video.group_id,t.data.saved=!1,t.data.js_preview=H(e.previewElement).find(".dz-video-thumbnail img").attr("src"),l.dropzone_video.push(t.data),e.previewElement.classList.add("dz-success");var a,i,o,d,s,n=t.data.feedback;for(e.previewElement.classList.add("dz-error"),s=[],i=0,o=(d=e.previewElement.querySelectorAll("[data-dz-errormessage]")).length;i'+t+""),this.removeFile(e),a.removeClass("media-uploading"))}),l.dropzone_video_obj.on("removedfile",function(e){if(l.dropzone_video.length)for(var t in l.dropzone_video)if(e.upload.uuid==l.dropzone_video[t].uuid){void 0===l.dropzone_video[t].saved||l.dropzone_video[t].saved||bp.Nouveau.Media.removeAttachment(l.dropzone_video[t].id),l.dropzone_video.splice(t,1);break}var a,i;_.isNull(l.dropzone_video_obj)||_.isNull(l.dropzone_video_obj.files)||0!==l.dropzone_video_obj.files.length?o.closest(".ac-form").addClass("has-content"):(a=o.parents(".ac-reply-toolbar"),(i=o.closest(".ac-form")).removeClass("has-media"),a.find(".ac-reply-media-button")&&a.find(".ac-reply-media-button").parents(".post-elements-buttons-item").removeClass("disable"),a.find(".ac-reply-document-button")&&a.find(".ac-reply-document-button").parents(".post-elements-buttons-item").removeClass("disable"),a.find(".ac-reply-gif-button")&&a.find(".ac-reply-gif-button").parents(".post-elements-buttons-item").removeClass("disable"),a.find(".ac-reply-video-button")&&a.find(".ac-reply-video-button").parents(".post-elements-buttons-item").removeClass("no-click").find(".toolbar-button").removeClass("active"),H(l.dropzone_video_obj.element).removeClass("files-uploaded dz-progress-view").find(".dz-global-progress").remove(),l.validateCommentContent(i.find(".ac-textarea").children(".ac-input")))}),l.dropzone_video_obj.on("complete",function(){0===this.getUploadingFiles().length&&0===this.getQueuedFiles().length&&0/gi,"\n").replace(/<\/div>/gi,""))).replace(/ /g," ");""!==e.text().trim()||0<=t.indexOf("emojioneemoji")||e.closest("form").hasClass("acomment-edit")?e.closest("form").addClass("has-content"):e.closest("form").removeClass("has-content")},ReactionStatePopupTab:function(e){e.preventDefault(),H(this).closest(".activity-state-popup").find(".activity-state-popup_tab_panel li a").removeClass("active"),H(this).addClass("active"),H(this).closest(".activity-state-popup").find(".activity-state-popup_tab_content .activity-state-popup_tab_item").removeClass("active"),H(this).closest(".activity-state-popup").find("."+H(this).data("tab")).addClass("active")},closeActivityState:function(){H(".activity-state-popup").hide().removeClass("active")},listenCommentInput:function(e){var t,a;0/gi,"\n").replace(/<\/div>/gi,""));t=t.replace(/ /g," "),""!==jQuery(e.currentTarget).text().trim()||0<=t.indexOf("emojioneemoji")?jQuery(e.currentTarget).closest("form").addClass("has-content"):jQuery(e.currentTarget).closest("form").removeClass("has-content")}),H(e).closest("form").addClass("events-initiated"),this.InitiatedCommentForms.push(t)))},activityRootComment:function(e){var e=H(e.currentTarget).closest("#activity-modal"),t=e.find(".activity-item").data("bp-activity-id"),a=e.find("#ac-form-"+t);bp.Nouveau.Activity.resetActivityCommentForm(a,"hardReset"),e.find(".acomment-display").removeClass("display-focus"),e.find(".comment-item").removeClass("comment-item-focus"),e.find(".bb-modal-activity-footer").addClass("active").append(a),a.addClass("root"),a.find("#ac-input-"+t).focus(),bp.Nouveau.Activity.clearFeedbackNotice(a)},clearFeedbackNotice:function(e){e.find(".bp-ac-form-container").find(".bp-feedback").length&&e.find(".bp-ac-form-container").find(".bp-feedback").remove()},launchActivityPopup:function(e,t){var a=H("#activity-"+e),i=H(".bb-activity-model-wrapper"),o=a[0].outerHTML,t='[data-parent_comment_id="'+t+'"]',d=a.data("activity-popup-title");bp.Nouveau.Activity.activityHasUpdates=!1,bp.Nouveau.Activity.currentActivityId=null,bp.Nouveau.Activity.activityPinHasUpdates=!1,i.closest("body").addClass("acomments-modal-open"),i.show(),i.find("ul.activity-list").html(o),i.find(".bb-modal-activity-header h2").text(d);i.find(".bb-activity-video-elem").each(function(e,t){var o=H(t);o.find("video").each(function(e,t){var t=H(t),a=t.attr("id")+Math.floor(1e4*Math.random()),i=(t.attr("id",a),o.find(".video-action-wrap"));t.insertAfter(i),o.find(".video-js").remove(),t.addClass("video-js"),videojs(a,{controls:!0,aspectRatio:"16:9",fluid:!0,playbackRates:[.5,1,1.5,2],fullscreenToggle:!1})})}),a.hasClass("bb-closed-comments")&&i.find("#activity-modal").addClass("bb-closed-comments");o=i.find("#ac-form-"+e),i.find(".acomment-display").removeClass("display-focus"),i.find(".comment-item").removeClass("comment-item-focus"),i.find(".bb-modal-activity-footer").addClass("active").append(o),o.removeClass("not-initialized").addClass("root"),o.find("#ac-input-"+e).focus(),bp.Nouveau.Activity.clearFeedbackNotice(o),o.removeClass("events-initiated"),d=i.find(".bb-modal-activity-footer").find(".ac-input[contenteditable]");bp.Nouveau.Activity.listenCommentInput(d),i.find(".bb-activity-more-options-wrap .bb-activity-more-options-action, .bb-pin-action_button, .bb-mute-action_button").attr("data-balloon-pos","left"),i.find(".privacy-wrap").attr("data-bp-tooltip-pos","right"),i.find(t).children(".acomments-view-more").first().trigger("click"),_.isUndefined(BP_Nouveau.media)||_.isUndefined(BP_Nouveau.media.emoji)||bp.Nouveau.Activity.initializeEmojioneArea(!0,"#activity-modal ",e),void 0!==bp.Nouveau&&bp.Nouveau.reportPopUp(),bp.Nouveau.Activity.toggleMultiMediaOptions(o,"",".bb-modal-activity-footer")},viewMoreComments:function(e){e.preventDefault();var t,a=H(e.currentTarget).parent(),i=H(e.currentTarget),o=H(a).data("activity_id"),d=H(e.currentTarget).closest(".activity-comments"),s=H(e.currentTarget).closest(".activity-item"),n=H(a).data("parent_comment_id"),l="",a=(i.addClass("loading").removeClass("acomments-view-more--hide"),d.addClass("active"),s.addClass("active"),i.html('
                                '),{action:"activity_loadmore_comments",activity_id:o,parent_comment_id:n,offset:H(e.currentTarget).parents(".activity-comments").find('ul[data-parent_comment_id ="'+n+'"] > li.comment-item:not(.bb-recent-comment)').length,activity_type_is_blog:1"+e.data.message+"

                                ").removeClass("acomments-view-more--hide"),d.removeClass("active"),s.removeClass("active")):void 0!==e.data&&void 0!==e.data.comments&&(t=H(".bb-internal-model .activity-comments").find("[data-activity_id='"+o+"'][data-parent_comment_id='"+n+"']"),e=H(H.parseHTML(e.data.comments)),0"+e.statusText+"

                                ").removeClass("acomments-view-more--hide"),d.removeClass("active"),s.removeClass("active")})},autoloadMoreComments:function(){var e,t,a,i,o;0 ul > li.acomments-view-more:not(.loading), .bb-modal-activity-body .activity-comments .activity-actions > ul > li.acomments-view-more:not(.loading)"),t=H(".bb-activity-model-wrapper .bb-modal-activity-body"),o=H(".bb-activity-model-wrapper .bb-modal-activity-body").find(".activity-comments:not(.active)"),0a&&H(e).trigger("click").addClass("loading"),setTimeout(function(){jQuery(window).scroll()},200))},activitySyncOnModalClose:function(e,t){e.preventDefault();var e=(H(e.currentTarget).is(document)?H(".bb-activity-model-wrapper"):H(e.currentTarget).parents(".bb-activity-model-wrapper")).find("ul.activity-list > li").data("bp-activity-id"),t=void 0!==t?t:e,a=H("#activity-stream li.activity-item[data-bp-activity-id="+t+"]");0 .bb-modal-activity-body .activity-item").data("bp-activity-id");0/gi,"\n").replace(/<\/div>/gi,""));t=t.replace(/ /g," "),""!==e.text()||0<=t.indexOf("emojioneemoji")?e.closest("form").addClass("has-content"):e.closest("form").removeClass("has-content")},picker_show:function(){H(this.button[0]).closest(".post-emoji").addClass("active"),H(".emojionearea-theatre").removeClass("hide").addClass("show")},picker_hide:function(){H(this.button[0]).closest(".post-emoji").removeClass("active"),H(".emojionearea-theatre").removeClass("show").addClass("hide")}}})}},bp.Nouveau.Activity.start())}((bp,jQuery)); \ No newline at end of file diff --git a/src/bp-templates/bp-nouveau/js/buddypress-nouveau.min.js b/src/bp-templates/bp-nouveau/js/buddypress-nouveau.min.js index 59298eb56e..954c55d2e8 100644 --- a/src/bp-templates/bp-nouveau/js/buddypress-nouveau.min.js +++ b/src/bp-templates/bp-nouveau/js/buddypress-nouveau.min.js @@ -1 +1 @@ -window.wp=window.wp||{},window.bp=window.bp||{},function(f){"undefined"!=typeof BP_Nouveau&&(bp.Nouveau={start:function(){this.setupGlobals(),this.prepareDocument(),this.initObjects(),this.setHeartBeat(),this.addListeners(),this.switchGridList(),this.sendInvitesRevokeAccess(),this.sentInvitesFormValidate(),this.registerPopUp(),this.loginPopUp(),this.reportPopUp(),this.reportActions(),this.reportedPopup(),this.togglePassword(),this.enableSubmitOnLegalAgreement(),this.profileNotificationSetting(),this.xProfileBlock(),"undefined"!=typeof BB_Nouveau_Presence&&this.userPresenceStatus();var r=this;f(document).on("bb_trigger_toast_message",function(e,t,i,a,n,o,s){r.bbToastMessage(t,i,a,n,o,s)}),bp.Nouveau.lazyLoad(".lazy"),f(window).on("scroll resize",function(){bp.Nouveau.lazyLoad(".lazy")})},bbToastMessage:function(e,t,i,a,n,o){var s,r,d,l,c,p;function u(){f(r).removeClass("pull-animation").addClass("close-item").delay(500).remove()}t&&""!=t.trim()&&(s="unique-"+Math.floor(1e6*Math.random()),r="."+s,c=l=d="",o=o&&"number"==typeof o?1e3*o:5e3,i&&("success"===(l=i)?c="check":"warning"===i?c="exclamation-triangle":"delete"===i?(c="trash",l="error"):c="info"),null!==a&&(d="has-url"),i="",i+='
                                ',i+='
                                ',e&&(i+=''+e+""),t&&(i+=''+t+""),i+="
                                ",i+='
                                ',i+=a?'':"",f((f(".bb-toast-messages-enable").length||(f(".bb-onscreen-notification-enable ul.notification-list").length?(p=f(".bb-onscreen-notification").hasClass("bb-position-left")?"left":"right",p=f('
                                  '),f(".bb-onscreen-notification").show(),f(p).insertBefore(".bb-onscreen-notification-enable ul.notification-list")):(p=f('
                                    '),f("body").append(p))),".bb-toast-messages-enable .toast-messages-list")).append('
                                  • '+i+"
                                  • "),n&&setInterval(function(){u()},o),f(r+" .actions .action-close").on("click",function(){u()}))},setupGlobals:function(){this.ajax_request=null,this.objects=f.map(BP_Nouveau.objects,function(e){return e}),this.objectNavParent=BP_Nouveau.object_nav_parent,this.heartbeat=wp.heartbeat||!1,this.querystring=this.getLinkParams(),this.bbServerTimeDiff=new Date(BP_Nouveau.wpTime).getTime()-(new Date).getTime()},prepareDocument:function(){var i;f("body").hasClass("no-js")&&f("body").removeClass("no-js").addClass("js"),BP_Nouveau.warnings&&"undefined"!=typeof console&&console.warn&&f.each(BP_Nouveau.warnings,function(e,t){console.warn(t)}),f(".buddypress_object_nav .widget-title").length&&(i=f(".buddypress_object_nav .widget-title").html(),f("body").find('*:contains("'+i+'")').each(function(e,t){f(t).hasClass("widget-title")||i!==f(t).html()||f(t).is("a")||f(t).remove()}))},getStorage:function(e,t){e=(e=sessionStorage.getItem(e))?JSON.parse(e):{};return void 0!==t?e[t]||!1:e},setStorage:function(e,t,i){var a=this.getStorage(e);return void 0===i&&void 0!==a[t]?delete a[t]:a[t]=i,sessionStorage.setItem(e,JSON.stringify(a)),null!==sessionStorage.getItem(e)},getLinkParams:function(e,t){e=e?-1!==e.indexOf("?")?"?"+e.split("?")[1]:"":document.location.search;if(!e)return null;e=e.replace(/(^\?)/,"").split("&").map(function(e){return this[(e=e.split("="))[0]]=e[1],this}.bind({}))[0];return t?e[t]:e},urlDecode:function(e,t){var i=t||{amp:"&",lt:"<",gt:">",quot:'"',"#039":"'"};return decodeURIComponent(e.replace(/\+/g," ")).replace(/&([^;]+);/g,function(e,t){return i[t]||""})},ajax:function(e,t,i){this.ajax_request&&void 0===i&&"scheduled"!==e.status&&this.ajax_request.abort();e=f.extend({},bp.Nouveau.getStorage("bp-"+t),{nonce:BP_Nouveau.nonces[t]},e);return void 0!==BP_Nouveau.customizer_settings&&(e.customized=BP_Nouveau.customizer_settings),void 0!==BP_Nouveau.modbypass&&(e.modbypass=BP_Nouveau.modbypass),this.ajax_request=f.post(BP_Nouveau.ajaxurl,e,"json"),this.ajax_request},inject:function(e,t,i){f(e).length&&t&&(("append"===(i=i||"reset")?f(e).append(t):"prepend"===i?f(e).prepend(t):"after"===i?f(e).after(t):f(e).html(t)).find("li.activity-item").each(this.hideSingleUrl),"undefined"==typeof bp_mentions&&void 0===bp.mentions||(f(".bp-suggestions").bp_mentions(bp.mentions.users),f("#whats-new").on("inserted.atwho",function(){var e;window.getSelection&&document.createRange?(e=window.getSelection&&window.getSelection())&&0 p").removeAttr("br").removeAttr("a").text(),t="",i="",a="",n=0;if(0<=e.indexOf("http://")?(a=e.indexOf("http://"),n=1):0<=e.indexOf("https://")?(a=e.indexOf("https://"),n=1):0<=e.indexOf("www.")&&(a=e.indexOf("www"),n=1),1===n){for(var o=a;o p:first").hide()}},objectRequest:function(a){var e,n,o=this;if((a=f.extend({object:"",scope:null,filter:null,target:"#buddypress [data-bp-list]",search_terms:"",page:1,extras:null,caller:null,template:null,method:"reset"},a)).object&&a.target)return"activity"==a.object&&"#buddypress [data-bp-list] ul.bp-list"==a.target&&(a.target="#buddypress [data-bp-list] ul.bp-list:not(#bb-media-model-container ul.bp-list)"),["members","activity","media","document"].includes(a.object)&&!f(this.objectNavParent+' [data-bp-scope="'+a.scope+'"]').length&&(a.scope="all"),a.search_terms&&(a.search_terms=a.search_terms.replace(//g,">")),null!==a.scope&&this.setStorage("bp-"+a.object,"scope",a.scope),null!==a.filter&&this.setStorage("bp-"+a.object,"filter",a.filter),null!==a.extras&&this.setStorage("bp-"+a.object,"extras",a.extras),f(this.objectNavParent+" [data-bp-object]").each(function(){f(this).removeClass("selected loading")}),(f(this.objectNavParent+' [data-bp-scope="'+a.scope+'"]').length?f(this.objectNavParent+' [data-bp-scope="'+a.scope+'"], #object-nav li.current'):f(this.objectNavParent+" [data-bp-scope]:eq(0), #object-nav li.current")).addClass("selected loading"),0===f(this.objectNavParent+' [data-bp-scope="'+a.scope+'"]').length&&(e=["group_members"===a.object&&f("body").hasClass("group-members"),"activity"===a.object&&f("body.groups").hasClass("activity"),"document"===a.object&&f("body").hasClass("documents"),"manage_group_members"===a.object&&f("body").hasClass("manage-members"),"document"===a.object&&(f("body").hasClass("document")||f("body").hasClass("documents"))],n=[f(".groups .group-search.members-search"),f(".groups .group-search.activity-search"),f(".documents .bp-document-listing .bb-title"),f(".groups .group-search.search-wrapper"),f("#bp-media-single-folder .bb-title")],e.forEach(function(e,t){e&&n[t].addClass("loading")})),f('#buddypress [data-bp-filter="'+a.object+'"] option[value="'+a.filter+'"]').prop("selected",!0),"friends"===a.object||"group_members"===a.object||"manage_group_members"===a.object?(a.template=a.object,a.object="members"):"group_requests"===a.object?(a.object="groups",a.template="group_requests"):"group_subgroups"===a.object?(a.object="groups",a.template="group_subgroups"):"notifications"===a.object&&(a.object="members",a.template="member_notifications"),e=f.extend({action:a.object+"_filter"},a),this.ajax(e,a.object).done(function(e){if(!1!==e.success&&!_.isUndefined(e.data)){if("scheduled"===a.status&&(f(e.data.contents).hasClass("bp-feedback")?f(a.target).parent().addClass("has-no-content"):f(a.target).parent().addClass("has-content")),_.isUndefined(e.data.layout)||(f(".layout-view").removeClass("active"),f(".layout-"+e.data.layout+"-view").addClass("active")),!f("body.group-members.members.buddypress").length||_.isUndefined(e.data)||_.isUndefined(e.data.count)||f("body.group-members.members.buddypress ul li#members-groups-li").find("span").text(e.data.count),f(o.objectNavParent+' [data-bp-scope="'+a.scope+'"]').removeClass("loading"),f(o.objectNavParent+' [data-bp-scope="'+a.scope+'"]').find("span").text(""),0===f(o.objectNavParent+' [data-bp-scope="'+a.scope+'"]').length&&n.forEach(function(e){e.removeClass("loading")}),_.isUndefined(e.data)||_.isUndefined(e.data.count)||f(o.objectNavParent+' [data-bp-scope="'+a.scope+'"]').find("span").text(e.data.count),!_.isUndefined(e.data)&&!_.isUndefined(e.data.scopes))for(var t in e.data.scopes)f(o.objectNavParent+' [data-bp-scope="'+t+'"]').find("span").text(e.data.scopes[t]);var i;"reset"!==a.method?(o.inject(a.target,e.data.contents,a.method),f(a.target).trigger("bp_ajax_"+a.method,f.extend(a,{response:e.data}))):"pag-bottom"===a.caller?(i=null,i=f("#subnav").length?f("#subnav").parent():f(a.target),f("html,body").animate({scrollTop:i.offset().top},"slow",function(){f(a.target).fadeOut(100,function(){o.inject(this,e.data.contents,a.method),f(this).fadeIn(100),f(a.target).trigger("bp_ajax_request",f.extend(a,{response:e.data})),bp.Nouveau.lazyLoad&&setTimeout(function(){bp.Nouveau.lazyLoad(".lazy")},1e3)})})):f(a.target).fadeOut(100,function(){o.inject(this,e.data.contents,a.method),f(this).fadeIn(100),f(a.target).trigger("bp_ajax_request",f.extend(a,{response:e.data})),bp.Nouveau.lazyLoad&&setTimeout(function(){bp.Nouveau.lazyLoad(".lazy")},1e3)}),setTimeout(function(){o.reportPopUp(),o.reportedPopup(),f(".activity-item.bb-closed-comments").find(".edit-activity, .acomment-edit").parents(".generic-button").hide()},1e3)}})},initObjects:function(){var a,n=this,o={},s="all",r="",d=null,l=null;f.each(this.objects,function(e,t){var i;f('#buddypress [data-bp-list="'+t+'"][data-ajax="false"]').length||(a=n.getStorage("bp-"+t),void 0!==(i=window.location.hash.substr(1))&&"following"==i?s=i:void 0!==a.scope&&(s=a.scope),void 0!==a.extras&&"notifications"!==t&&(d=a.extras),f('#buddypress [data-bp-filter="'+t+'"]').length&&(void 0!==a.filter?(l=a.filter,f('#buddypress [data-bp-filter="'+t+'"] option[value="'+l+'"]').prop("selected",!0)):"-1"!==f('#buddypress [data-bp-filter="'+t+'"]').val()&&"0"!==f('#buddypress [data-bp-filter="'+t+'"]').val()&&(l=f('#buddypress [data-bp-filter="'+t+'"]').val())),f(this.objectNavParent+' [data-bp-object="'+t+'"]').length&&(f(this.objectNavParent+' [data-bp-object="'+t+'"]').each(function(){f(this).removeClass("selected")}),f(this.objectNavParent+' [data-bp-scope="'+t+'"], #object-nav li.current').addClass("selected")),null!==n.querystring&&(void 0!==n.querystring[t+"_search"]?r=decodeURI(n.querystring[t+"_search"]):void 0!==n.querystring.s&&(r=decodeURI(n.querystring.s)),r&&f('#buddypress [data-bp-search="'+t+'"] input[type=search]').val(r)),f('#buddypress [data-bp-list="'+t+'"]').length&&(o={object:t,scope:s,filter:l,search_terms:r,extras:d},f('#buddypress [data-bp-member-type-filter="'+t+'"]').length?o.member_type_id=f('#buddypress [data-bp-member-type-filter="'+t+'"]').val():f('#buddypress [data-bp-group-type-filter="'+t+'"]').length&&(o.group_type=f('#buddypress [data-bp-group-type-filter="'+t+'"]').val()),n.objectRequest(o)))})},setHeartBeat:function(){void 0!==BP_Nouveau.pulse&&this.heartbeat&&(this.heartbeat.interval(Number(BP_Nouveau.pulse)),f.fn.extend({"heartbeat-send":function(){return this.bind("heartbeat-send")}}),f.fn.extend({"heartbeat-tick":function(){return this.bind("heartbeat-tick")}}))},addListeners:function(){f("[data-bp-disable-input]").on("change",this.toggleDisabledInput),f(this.objectNavParent+" .bp-navs").on("click","a",this,this.scopeQuery),f(document).on("change","#buddypress [data-bp-filter]",this,this.filterQuery),f(document).on("change","#buddypress [data-bp-group-type-filter]",this,this.typeGroupFilterQuery),f(document).on("change","#buddypress [data-bp-member-type-filter]",this,this.typeMemberFilterQuery),f("#buddypress [data-bp-search]").on("submit","form",this,this.searchQuery),f("#buddypress [data-bp-search]").on("keyup","input[name=group_members_search]",this,_.throttle(this.searchQuery,900)),f("#buddypress [data-bp-search] form").on("search","input[type=search]",this.resetSearch),f("#buddypress [data-bp-list], #buddypress #item-header, #buddypress.bp-shortcode-wrap .dir-list, #buddypress .bp-messages-content").on("click","[data-bp-btn-action]",this,this.buttonAction),f("#buddypress [data-bp-list], #buddypress #item-header, #buddypress.bp-shortcode-wrap .dir-list, #buddypress .messages-screen").on("blur","[data-bp-btn-action]",this,this.buttonRevert),f("#buddypress [data-bp-list], #buddypress #item-header, #buddypress.bp-shortcode-wrap .dir-list, #buddypress .messages-screen").on("mouseover","[data-bp-btn-action]",this,this.buttonHover),f("#buddypress [data-bp-list], #buddypress #item-header, #buddypress.bp-shortcode-wrap .dir-list, #buddypress .messages-screen").on("mouseout","[data-bp-btn-action]",this,this.buttonHoverout),f("#buddypress [data-bp-list], #buddypress #item-header, #buddypress.bp-shortcode-wrap .dir-list, #buddypress .messages-screen").on("mouseover",".awaiting_response_friend",this,this.awaitingButtonHover),f("#buddypress [data-bp-list], #buddypress #item-header, #buddypress.bp-shortcode-wrap .dir-list, #buddypress .messages-screen").on("mouseout",".awaiting_response_friend",this,this.awaitingButtonHoverout),f(document).on("click","#buddypress .bb-leave-group-popup .bb-confirm-leave-group",this.leaveGroupAction),f(document).on("click","#buddypress .bb-leave-group-popup .bb-close-leave-group",this.leaveGroupClose),f(document).on("click","#buddypress .bb-remove-connection .bb-confirm-remove-connection",this.removeConnectionAction),f(document).on("click","#buddypress .bb-remove-connection .bb-close-remove-connection",this.removeConnectionClose),f(document).on("click","#buddypress table.invite-settings .field-actions .field-actions-remove, #buddypress table.invite-settings .field-actions-add",this,this.addRemoveInvite),f(document).on("click",".show-action-popup",this.showActionPopup),f(document).on("click","#message-threads .block-member",this.threadListBlockPopup),f(document).on("click","#message-threads .report-content",this.threadListReportPopup),f(document).on("click",".bb-close-action-popup, .action-popup-overlay",this.closeActionPopup),f(document).on("keyup",'.search-form-has-reset input[type="search"], .search-form-has-reset input#bbp_search',_.throttle(this.directorySearchInput,900)),f(document).on("click",".search-form-has-reset .search-form_reset",this.resetDirectorySearch),f(document).on("keyup",this,this.keyUp),f("[data-bp-close]").on("click",this,this.closeNotice),f("#buddypress [data-bp-list]").on("click","[data-bp-pagination] a",this,this.paginateAction),f(document).on("click",this.closePickersOnClick),document.addEventListener("keydown",this.closePickersOnEsc),f(document).on("click","#item-header a.position-change-cover-image, .header-cover-reposition-wrap a.cover-image-save, .header-cover-reposition-wrap a.cover-image-cancel",this.coverPhotoCropper),f(document).on("click","#cover-photo-alert .bb-model-close-button",this.coverPhotoCropperAlert),f(document).on("click",this.toggleMoreOption.bind(this)),f(document).on("heartbeat-send",this.bbHeartbeatSend.bind(this)),f(document).on("heartbeat-tick",this.bbHeartbeatTick.bind(this)),bp.Nouveau.notificationRemovedAction(),bp.Nouveau.removeAllNotification(),bp.Nouveau.setTitle(),f(document).on("click",".more-following .count-more",this.bbWidgetMoreFollowing),f(".bb-accordion .bb-accordion_trigger").on("click",this.toggleAccordion)},bbHeartbeatSend:function(e,t){t.onScreenNotifications=!0,f("#buddypress").trigger("bb_heartbeat_send",t)},bbHeartbeatTick:function(e,t){bp.Nouveau.bbInjectOnScreenNotifications(e,t)},bbInjectOnScreenNotifications:function(e,t){var i,a,n,o,s,r;"1"==f(".bb-onscreen-notification").data("enable")&&(void 0===t.on_screen_notifications&&""===t.on_screen_notifications||(i=f(".bb-onscreen-notification"),r=(a=i.find(".notification-list")).data("removed-items"),n=a.data("animated-items"),o=[],s=f(f.parseHTML("
                                      "+t.on_screen_notifications+"
                                    ")),f.each(r,function(e,t){t=s.find("[data-notification-id="+t+"]");t.length&&t.closest(".read-item").remove()}),(r=s.find(".read-item")).each(function(e,t){var i=f(t).find(".actions .action-close").data("notification-id");"-1"==f.inArray(i,n)?(f(t).addClass("pull-animation"),n.push(i),o.push(i)):f(t).removeClass("pull-animation")}),o.length&&r.each(function(e,t){var i=f(t).find(".actions .action-close").data("notification-id");"-1"==f.inArray(i,o)&&(f(t).removeClass("recent-item"),(t=a.data("border-items")).push(i),a.attr("data-border-items",JSON.stringify(t)))}),a.attr("data-animated-items",JSON.stringify(n)),r.length&&(i.removeClass("close-all-items"),r.eq(2).nextAll().addClass("bb-more-item"),3 li").each(function(){f(this).removeClass("pull-animation").addClass("close-item").delay(500).remove()}),f(".toast-messages-list > li").each(function(){f(this).removeClass("pull-animation").addClass("close-item").delay(500).remove()}),t.removeClass("bb-more-than-3")})},setTitle:function(){var e=f("html head").find("title").text();f(".bb-onscreen-notification").attr("data-title-tag",e)},visibilityOnScreenClearButton:function(){var e=f(".bb-onscreen-notification");1 tbody > tr").each(function(){f(this).find('input[type="text"]').removeAttr("style"),f(this).find('input[type="email"]').removeAttr("style")}),f("body.send-invites #send-invite-form #member-invites-table > tbody > tr").each(function(){e=f.trim(f(this).find('input[type="text"]').val()),i=f(this).find("input").attr("id"),t=f.trim(f(this).find('input[type="email"]').val()),""===e&&""===t?0:""!==e&&""===t?(i=f(this).find('input[type="email"]').attr("id"),a.push(i)):""===e&&""!==t?(i=f(this).find('input[type="text"]').attr("id"),a.push(i)):l.test(t)?n.push(1):(i=f(this).find('input[type="email"]').attr("id"),a.push(i))}),f(".span_error").remove(),0!==a.length)return a.forEach(function(e){f("#"+e).attr("style","border:1px solid #ef3e46"),-1!==e.indexOf("email_")?f("#"+e).after(''+p+""):f("#"+e).after(''+c+"")}),f("html, body").animate({scrollTop:f("#item-body").offset().top},2e3),alert(u),!1;if(f("#email_0_email_error").length&&f("#email_0_email_error").remove(),0===n.length){o=f("#invitee_0_title").val(),s=f("#email_0_email").val();return""===o&&""===s?(f("#invitee_0_title").attr("style","border:1px solid #ef3e46"),f("#invitee_0_title").focus(),f("#email_0_email").attr("style","border:1px solid #ef3e46"),!1):(""!==o&&""===s?(f("#email_0_email").attr("style","border:1px solid #ef3e46"),f("#email_0_email").focus()):(l.test(s)||(f("#email_0_email").attr("style","border:1px solid #ef3e46"),f("#email_0_email").focus(),f("#email_0_email_error").remove(),f("#email_0_email").after(''+p+"")),alert(u)),!1)}})},sendInvitesRevokeAccess:function(){f("body.sent-invites #member-invites-table").length&&f("body.sent-invites #member-invites-table tr td span a.revoked-access").click(function(e){e.preventDefault();var t=f(this).attr("data-name"),i=f(this).attr("id"),e=f(this).attr("data-revoke-access");if(!confirm(t))return!1;f.ajax({url:e,type:"post",data:{item_id:i},success:function(){window.location.reload(!0)}})})},toggleDisabledInput:function(){var e=f(this).attr("data-bp-disable-input");f(e).prop("disabled",!0)&&!f(this).hasClass("enabled")?(f(this).addClass("enabled").removeClass("disabled"),f(e).prop("disabled",!1)):f(e).prop("disabled",!1)&&f(this).hasClass("enabled")&&(f(this).removeClass("enabled").addClass("disabled"),f(e).attr("disabled","disabled"))},keyUp:function(e){var t=e.data;27===e.keyCode&&t.buttonRevertAll()},scopeQuery:function(e){var t,i,a=e.data,n=f(e.currentTarget).parent(),o="",s=null,r={};if(n.hasClass("no-ajax")||f(e.currentTarget).hasClass("no-ajax")||!n.attr("data-bp-scope"))return e;if(t=n.data("bp-scope"),i=n.data("bp-object"),!t||!i)return e;e.preventDefault();var e=a.getStorage("bp-"+i);void 0!==e.extras&&"notifications"!==i&&(s=e.extras),e=f("#buddypress").find('[data-bp-filter="'+i+'"]').first().val(),f('#buddypress [data-bp-search="'+i+'"] input[type=search]').length&&(o=f('#buddypress [data-bp-search="'+i+'"] input[type=search]').val()),n.hasClass("dynamic")&&n.find("a span").html(""),r={object:i,scope:t,filter:e,search_terms:o,page:1,extras:s},f('#buddypress [data-bp-member-type-filter="'+i+'"]').length?r.member_type_id=f('#buddypress [data-bp-member-type-filter="'+i+'"]').val():f('#buddypress [data-bp-group-type-filter="'+i+'"]').length&&(r.group_type=f('#buddypress [data-bp-group-type-filter="'+i+'"]').val()),a.objectRequest(r)},filterQuery:function(e){var t=e.data,i=f(e.target).data("bp-filter"),a="all",n=f(e.target).val(),o="",s=!1;if(!i)return e;f(t.objectNavParent+" [data-bp-object].selected").length&&(a=f(t.objectNavParent+" [data-bp-object].selected").data("bp-scope")),f('#buddypress [data-bp-search="'+i+'"] input[type=search]').length&&(o=f('#buddypress [data-bp-search="'+i+'"] input[type=search]').val());e=t.getStorage("bp-"+(i="friends"===i?"members":i));void 0!==e.extras&&"notifications"!==i&&(s=e.extras),"members"===i?t.objectRequest({object:i,scope:a,filter:n,search_terms:o,page:1,extras:s,template:null,member_type_id:f('#buddypress [data-bp-member-type-filter="'+i+'"]').val()}):"groups"===i?t.objectRequest({object:i,scope:a,filter:n,search_terms:o,page:1,extras:s,template:null,group_type:f('#buddypress [data-bp-group-type-filter="'+i+'"]').val()}):t.objectRequest({object:i,scope:a,filter:n,search_terms:o,page:1,extras:s,template:null})},typeGroupFilterQuery:function(e){var t=e.data,i=f(e.target).data("bp-group-type-filter"),a="all",n=null,o=null,s="";if(!i)return e;void 0!==(e=t.getStorage("bp-"+i)).extras&&"notifications"!==i&&(o=e.extras),f('#buddypress [data-bp-filter="'+i+'"]').length&&(void 0!==e.filter?(n=e.filter,f('#buddypress [data-bp-filter="'+i+'"] option[value="'+n+'"]').prop("selected",!0)):"-1"!==f('#buddypress [data-bp-filter="'+i+'"]').val()&&"0"!==f('#buddypress [data-bp-filter="'+i+'"]').val()&&(n=f('#buddypress [data-bp-filter="'+i+'"]').val())),f(t.objectNavParent+" [data-bp-object].selected").length&&(a=f(t.objectNavParent+" [data-bp-object].selected").data("bp-scope")),f('#buddypress [data-bp-search="'+i+'"] input[type=search]').length&&(s=f('#buddypress [data-bp-search="'+i+'"] input[type=search]').val()),t.objectRequest({object:i,scope:a,filter:n,search_terms:s,page:1,template:null,extras:o,group_type:f('#buddypress [data-bp-group-type-filter="'+i+'"]').val()})},typeMemberFilterQuery:function(e){var t=e.data,i=f(e.target).data("bp-member-type-filter"),a="all",n=null,o=null,s="";if(!i)return e;void 0!==(e=t.getStorage("bp-"+(i="friends"===i?"members":i))).extras&&"notifications"!==i&&(o=e.extras),f('#buddypress [data-bp-filter="'+i+'"]').length&&(void 0!==e.filter?(n=e.filter,f('#buddypress [data-bp-filter="'+i+'"] option[value="'+n+'"]').prop("selected",!0)):"-1"!==f('#buddypress [data-bp-filter="'+i+'"]').val()&&"0"!==f('#buddypress [data-bp-filter="'+i+'"]').val()&&(n=f('#buddypress [data-bp-filter="'+i+'"]').val())),f(t.objectNavParent+" [data-bp-object].selected").length&&(a=f(t.objectNavParent+" [data-bp-object].selected").data("bp-scope")),f('#buddypress [data-bp-search="'+i+'"] input[type=search]').length&&(s=f('#buddypress [data-bp-search="'+i+'"] input[type=search]').val()),t.objectRequest({object:i,scope:a,filter:n,search_terms:s,page:1,template:null,extras:o,member_type_id:f('#buddypress [data-bp-member-type-filter="'+i+'"]').val()})},searchQuery:function(e){var t,i,a,n=e.data,o="all",s=!1;if(f(e.delegateTarget).hasClass("no-ajax")||void 0===f(e.delegateTarget).data("bp-search"))return e;e.preventDefault(),t=f(e.delegateTarget).data("bp-search"),i=f("#buddypress").find('[data-bp-filter="'+t+'"]').first().val(),a=f(e.delegateTarget).find("input[type=search]").first().val(),f(n.objectNavParent+" [data-bp-object]").length&&(o=f(n.objectNavParent+' [data-bp-object="'+t+'"].selected').data("bp-scope"));e=n.getStorage("bp-"+t);void 0!==e.extras&&"notifications"!==t&&(s=e.extras),n.objectRequest({object:t,scope:o,filter:i,search_terms:a,page:1,extras:s,template:null})},showSearchSubmit:function(e){f(e.delegateTarget).find("[type=submit]").addClass("bp-show"),f("[type=submit]").hasClass("bp-hide")&&f("[type=submit]").removeClass("bp-hide")},resetSearch:function(e){f(e.target).val()?f(e.delegateTarget).find("[type=submit]").show():f(e.delegateTarget).submit()},buttonAction:function(e){var a=e.data,n=f(e.currentTarget),o=n.data("bp-btn-action"),t=n.data("bp-nonce"),s=n.closest("[data-bp-item-id]"),i=s.data("bp-item-id"),r=n.closest(".list-wrap"),d=s.data("bp-item-component"),l="",c=s.data("bp-used-to-component");if(!o||!i||!d)return e;if(e.preventDefault(),n.hasClass("bp-toggle-action-button"))return f(document.body).hasClass("buddyboss-theme")&&void 0!==n.data("balloon")?n.attr("data-balloon",n.data("title")):n.text(n.data("title")),n.removeClass("bp-toggle-action-button"),n.addClass("bp-toggle-action-button-clicked"),!1;if(void 0!==n.data("only-admin"))return void 0!==BP_Nouveau.only_admin_notice&&window.alert(BP_Nouveau.only_admin_notice),!1;if("is_friend"!==o&&(void 0!==BP_Nouveau[o+"_confirm"]&&!1===window.confirm(BP_Nouveau[o+"_confirm"])||n.hasClass("pending")))return!1;var p=f(".bb-leave-group-popup"),u=f(n).data("bb-group-name"),b=f(n).data("bb-group-link");if("leave_group"===o&&"true"!==f(n).attr("data-popup-shown")){if(p.length){var m=p.find(".bb-leave-group-content"),e=!!s.hasClass("has-child");return m.html(e?BP_Nouveau.parent_group_leave_confirm:BP_Nouveau.group_leave_confirm),e||m.find(".bb-group-name").html(''+u+""),f("body").find('[data-current-anchor="true"]').removeClass("bp-toggle-action-button bp-toggle-action-button-hover").addClass("bp-toggle-action-button-clicked"),p.show(),f(n).attr("data-current-anchor","true"),f(n).attr("data-popup-shown","true"),!1}}else f("body").find('[data-popup-shown="true"]').attr("data-popup-shown","false"),f("body").find('[data-current-anchor="true"]').attr("data-current-anchor","false"),p.find(".bb-leave-group-content .bb-group-name").html(""),p.hide();b={};f(n).closest("#item-header").length?b=f("#item-header .bb-remove-connection"):f(n).closest('.members[data-bp-list="members"]').length?b=f('.members[data-bp-list="members"] .bb-remove-connection'):f(n).closest('.group_members[data-bp-list="group_members"]').length&&(b=f('.group_members[data-bp-list="group_members"] .bb-remove-connection'));u=f(n).data("bb-user-name"),p=f(n).data("bb-user-link");if("is_friend"===o&&"opened"!==f(n).attr("data-popup-shown")){if(b.length)return b.find(".bb-remove-connection-content .bb-user-name").html(''+u+""),f("body").find('[data-current-anchor="true"]').removeClass("bp-toggle-action-button bp-toggle-action-button-hover").addClass("bp-toggle-action-button-clicked"),b.show(),f(n).attr("data-current-anchor","true"),f(n).attr("data-popup-shown","opened"),!1}else f("body").find('[data-popup-shown="opened"]').attr("data-popup-shown","closed"),f("body").find('[data-current-anchor="true"]').attr("data-current-anchor","false"),b.length&&(b.find(".bb-remove-connection-content .bb-user-name").html(""),b.hide());l=t?a.getLinkParams(t,"_wpnonce"):void 0===n.prop("href")?a.getLinkParams(n.attr("href"),"_wpnonce"):a.getLinkParams(n.prop("href"),"_wpnonce"),u={is_friend:"remove_friend",not_friends:"add_friend",pending:"withdraw_friendship",accept_friendship:"accept_friendship",reject_friendship:"reject_friendship"};"members"===d&&void 0!==u[o]&&(o=u[o],d="friends");b={not_following:"follow",following:"unfollow"};"members"===d&&void 0!==b[o]&&(o=b[o],d="follow"),n.addClass("pending loading");t="";f(document.body).hasClass("directory")&&f(document.body).hasClass("members")||f(document.body).hasClass("group-members")?t="directory":f(document.body).hasClass("bp-user")&&(t="single");u="primary",b="single"===t?n.closest(".header-dropdown"):n.closest(".footer-button-wrap");void 0!==b.length&&0"+e.data.feedback+"","info",null,!0])}var t,i;return(f("#friends-personal-li").length&&(i=f("#friends-personal-li a span"),t=f("#friends-personal-li a"),(void 0!==e.data.is_user&&e.data.is_user&&void 0!==e.data.friend_count||void 0!==e.data.friend_count)&&("0"!==e.data.friend_count?i.length?f(i).html(e.data.friend_count):f(t).append(''+e.data.friend_count+""):f(i).hide())),void 0!==e.data.is_user&&e.data.is_user)?(n.parent().html(e.data.feedback),void s.fadeOut(1500)):void 0!==e.data.is_user&&!e.data.is_user&&void 0!==e.data.group_url&&e.data.group_url?window.location=e.data.group_url:(f(a.objectNavParent+' [data-bp-scope="personal"]').length&&(i=Number(f(a.objectNavParent+' [data-bp-scope="personal"] span').html())||0,-1!==f.inArray(o,["leave_group","remove_friend"])?--i:-1!==f.inArray(o,["join_group"])&&(i+=1),i<0&&(i=0),f(a.objectNavParent+' [data-bp-scope="personal"] span').html(i)),"follow"===d&&0"+e.data.feedback+"","error",null,!0])}).fail(function(){var e,t;["unsubscribe","subscribe"].includes(o)&&(25<(e=f(n).data("bb-group-name")).length&&(e=e.substring(0,25)+"..."),t="
                                    "+BP_Nouveau.subscriptions.error+""+e+".
                                    ","subscribe"===o&&(t="
                                    "+BP_Nouveau.subscriptions.subscribe_error+""+e+"
                                    "),jQuery(document).trigger("bb_trigger_toast_message",["",t,"error",null,!0])),n.removeClass("pending loading")})},buttonRevert:function(e){e=f(e.currentTarget);e.hasClass("bp-toggle-action-button-clicked")&&!e.hasClass("loading")&&(f(document.body).hasClass("buddyboss-theme")&&void 0!==e.data("balloon")?e.attr("data-balloon",e.data("title-displayed")):e.text(e.data("title-displayed")),e.removeClass("bp-toggle-action-button-clicked"),e.addClass("bp-toggle-action-button"))},buttonHover:function(e){var t=f(e.currentTarget),i=t.data("bp-btn-action"),a=t.closest("[data-bp-item-id]"),n=a.data("bp-item-id"),a=a.data("bp-item-component");return i&&n&&a?(e.preventDefault(),t.hasClass("bp-toggle-action-button")?(t.hasClass("group-subscription")&&void 0!==t.data("title")&&void 0!==t.data("title-displayed")&&0===t.data("title").replace(/<(.|\n)*?>/g,"").length&&0===t.data("title-displayed").replace(/<(.|\n)*?>/g,"").length||(f(document.body).hasClass("buddyboss-theme")&&void 0!==t.data("balloon")&&(t.hasClass("following")||t.attr("data-balloon",t.data("title").replace(/<(.|\n)*?>/g,"")),t.find("span").html(t.data("title"))),t.html(t.data("title"))),t.removeClass("bp-toggle-action-button"),t.addClass("bp-toggle-action-button-hover"),!1):void 0):e},buttonHoverout:function(e){e=f(e.currentTarget);if(e.hasClass("bp-toggle-action-button-hover")&&!e.hasClass("loading")){if(e.hasClass("group-subscription")&&void 0!==e.data("title")&&void 0!==e.data("title-displayed")&&0===e.data("title").replace(/<(.|\n)*?>/g,"").length&&0===e.data("title-displayed").replace(/<(.|\n)*?>/g,"").length)return e.removeClass("bp-toggle-action-button-hover"),e.addClass("bp-toggle-action-button"),!1;f(document.body).hasClass("buddyboss-theme")&&void 0!==e.data("balloon")&&(e.hasClass("following")||e.attr("data-balloon",e.data("title-displayed").replace(/<(.|\n)*?>/g,"")),e.find("span").html(e.data("title-displayed"))),e.html(e.data("title-displayed")),e.removeClass("bp-toggle-action-button-hover"),e.addClass("bp-toggle-action-button")}},awaitingButtonHover:function(e){var t=f(e.currentTarget);if(e.preventDefault(),t.hasClass("bp-toggle-action-button"))return f(document.body).hasClass("buddyboss-theme")&&void 0!==t.data("balloon")&&(t.hasClass("following")||t.attr("data-balloon",t.data("title").replace(/<(.|\n)*?>/g,"")),t.find("span").html(t.data("title"))),t.html(t.data("title")),t.removeClass("bp-toggle-action-button"),t.addClass("bp-toggle-action-button-hover"),!1},awaitingButtonHoverout:function(e){e=f(e.currentTarget);e.hasClass("bp-toggle-action-button-hover")&&!e.hasClass("loading")&&(f(document.body).hasClass("buddyboss-theme")&&void 0!==e.data("balloon")&&(e.hasClass("following")||e.attr("data-balloon",e.data("title-displayed").replace(/<(.|\n)*?>/g,"")),e.find("span").html(e.data("title-displayed"))),e.html(e.data("title-displayed")),e.removeClass("bp-toggle-action-button-hover"),e.addClass("bp-toggle-action-button"))},leaveGroupAction:function(e){e.preventDefault(),f("body").find('[data-current-anchor="true"]').removeClass("bp-toggle-action-button bp-toggle-action-button-hover").addClass("bp-toggle-action-button-clicked"),f("body").find('[data-current-anchor="true"]').trigger("click")},leaveGroupClose:function(e){e.preventDefault();e=f(e.currentTarget),e=f(e).closest(".bb-leave-group-popup");f("body").find('[data-current-anchor="true"]').attr("data-current-anchor","false"),f("body").find('[data-popup-shown="true"]').attr("data-popup-shown","false"),e.find(".bb-leave-group-content .bb-group-name").html(""),e.hide()},removeConnectionAction:function(e){e.preventDefault(),f("body").find('[data-current-anchor="true"]').removeClass("bp-toggle-action-button bp-toggle-action-button-hover").addClass("bp-toggle-action-button-clicked"),f("body").find('[data-current-anchor="true"]').trigger("click")},removeConnectionClose:function(e){e.preventDefault();e=f(e.currentTarget),e=f(e).closest(".bb-remove-connection");f("body").find('[data-current-anchor="true"]').attr("data-current-anchor","false"),f("body").find('[data-popup-shown="opened"]').attr("data-popup-shown","closed"),e.find(".bb-remove-connection-content .bb-user-name").html(""),e.hide()},buttonRevertAll:function(){f.each(f("#buddypress [data-bp-btn-action]"),function(){f(this).hasClass("bp-toggle-action-button-clicked")&&!f(this).hasClass("loading")&&(f(document.body).hasClass("buddyboss-theme")&&void 0!==f(this).data("balloon")?f(this).attr("data-balloon",f(this).data("title-displayed")):f(this).text(f(this).data("title-displayed")),f(this).removeClass("bp-toggle-action-button-clicked"),f(this).addClass("bp-toggle-action-button"),f(this).trigger("blur"))})},addRemoveInvite:function(e){var t=e.currentTarget,i=f(t).closest("tbody");if(f(t).hasClass("field-actions-remove")){if(!(1"+e+"").insertBefore(f(this).closest("tr")),20 input").attr("name","invitee["+e+"][]"),f(this).find(".field-name > input").attr("id","invitee_"+e+"_title"),f(this).find(".field-email > input").attr("name","email["+e+"][]"),f(this).find(".field-email > input").attr("id","email_"+e+"_email"),f(this).find(".field-member-type > select").attr("name","member-type["+e+"][]"),f(this).find(".field-member-type > select").attr("id","member_type_"+e+"_member_type")})},closeNotice:function(e){var t=f(e.currentTarget);e.preventDefault(),"clear"===t.data("bp-close")&&(void 0!==f.cookie("bp-message")&&f.removeCookie("bp-message"),void 0!==f.cookie("bp-message-type")&&f.removeCookie("bp-message-type")),t.closest(".bp-feedback").hasClass("bp-sitewide-notice")&&bp.Nouveau.ajax({action:"messages_dismiss_sitewide_notice"},"messages"),t.closest(".bp-feedback").remove()},paginateAction:function(e){var t,i=e.data,a=f(e.currentTarget),n=null,o=null,s=null,r=null,d=a.closest("[data-bp-pagination]").data("bp-pagination")||null;if(null===d)return e;e.preventDefault(),null!==(e=f(e.delegateTarget).data("bp-list")||null)&&(void 0!==(t=i.getStorage("bp-"+e)).scope&&(n=t.scope),void 0!==t.filter&&(o=t.filter),void 0!==t.extras&&(r=t.extras)),null!==e&&(void 0!==(t=i.getStorage("bp-"+e)).scope&&(n=t.scope),void 0!==t.filter&&(o=t.filter),void 0!==t.extras&&(r=t.extras));d={object:e,scope:n,filter:o,search_terms:s=f('#buddypress [data-bp-search="'+e+'"] input[type=search]').length?f('#buddypress [data-bp-search="'+e+'"] input[type=search]').val():s,extras:r,caller:a.closest("[data-bp-pagination]").hasClass("bottom")?"pag-bottom":"",page:i.getLinkParams(a.prop("href"),d)||1};f("#buddypress [data-bp-group-type-filter]").length&&(d.group_type=f("#buddypress [data-bp-group-type-filter]").val()),f("#buddypress [data-bp-member-type-filter]").length&&(d.member_type_id=f("#buddypress [data-bp-member-type-filter]").val()),i.objectRequest(d)},enableSubmitOnLegalAgreement:function(){f("body #buddypress #register-page #signup-form #legal_agreement").length&&(f("body #buddypress #register-page #signup-form .submit #signup_submit").prop("disabled",!0),f(document).on("change","body #buddypress #register-page #signup-form #legal_agreement",function(){f(this).prop("checked")?f("body #buddypress #register-page #signup-form .submit #signup_submit").prop("disabled",!1):f("body #buddypress #register-page #signup-form .submit #signup_submit").prop("disabled",!0)}))},registerPopUp:function(){f(".popup-modal-register").length&&f(".popup-modal-register").magnificPopup({type:"inline",preloader:!1,fixedBgPos:!0,fixedContentPos:!0}),f(".popup-modal-dismiss").length&&f(".popup-modal-dismiss").click(function(e){e.preventDefault(),f.magnificPopup.close()})},loginPopUp:function(){f(".popup-modal-login").length&&f(".popup-modal-login").magnificPopup({type:"inline",preloader:!1,fixedBgPos:!0,fixedContentPos:!0}),f(".popup-modal-dismiss").length&&f(".popup-modal-dismiss").click(function(e){e.preventDefault(),f.magnificPopup.close()})},threadListBlockPopup:function(e){e.preventDefault();var t=f(this).data("bp-content-id"),i=f(this).data("bp-content-type"),a=f(this).data("bp-nonce"),n=f(this).attr("href");void 0!==t&&void 0!==i&&void 0!==a&&(f(document).find(".bp-report-form-err").empty(),(e=f(n)).find(".bp-content-id").val(t),e.find(".bp-content-type").val(i),e.find(".bp-nonce").val(a)),0"),void e.preventDefault();t=f(e.currentTarget).closest("#header-cover-image").height(),i=f(e.currentTarget).closest("#header-cover-image").width(),a=Number(f(e.currentTarget).closest("#cover-image-container").find(".header-cover-img").css("top").replace("px","")),n=f(e.currentTarget).closest("#header-cover-image").width()/f(e.currentTarget).closest("#header-cover-image").find(".header-cover-reposition-wrap img")[0].width,l.closest("#cover-image-container").find(".header-cover-reposition-wrap").show(),(r=f(".header-cover-reposition-wrap img")).guillotine({width:i,height:t,eventOnChange:"guillotinechange",init:{scale:n,y:a&&f(e.currentTarget).closest("#header-cover-image").hasClass("has-position")?-a:d,w:i,h:t}}),r.on("guillotinechange",function(e,t){l.closest("#cover-image-container").find(".header-cover-img").attr("data-top",-t.y)})}else f(e.currentTarget).hasClass("cover-image-save")?(o=f(e.currentTarget),s=f(e.currentTarget).closest("#cover-image-container").find(".header-cover-img"),o.addClass("loading"),f.post(BP_Nouveau.ajaxurl,{action:"save_cover_position",position:s.attr("data-top")}).done(function(e){e.success&&e.data&&""!==e.data.content?(o.removeClass("loading"),o.closest("#cover-image-container").find(".header-cover-reposition-wrap").hide(),o.closest("#header-cover-image:not(.has-position)").addClass("has-position"),s.css({top:e.data.content+"px"})):(o.removeClass("loading"),o.closest("#cover-image-container").find(".header-cover-reposition-wrap").hide())}).fail(function(){o.removeClass("loading"),o.closest("#cover-image-container").find(".header-cover-reposition-wrap").hide()})):f(e.currentTarget).hasClass("cover-image-cancel")&&((r=f(".header-cover-reposition-wrap img")).guillotine({width:0,height:0,init:{scale:1,y:0,w:0,h:0}}),r.guillotine("remove"),f(e.currentTarget).closest("#cover-image-container").find(".header-cover-reposition-wrap").hide(),f(e.currentTarget).closest("#cover-image-container").find(".header-cover-img").attr("data-top",""));e.preventDefault()},coverPhotoCropperAlert:function(e){e.preventDefault(),f("#cover-photo-alert").remove()},toggleMoreOption:function(e){f(e.target).hasClass("bb_more_options_action")||f(e.target).parent().hasClass("bb_more_options_action")?(e.preventDefault(),f(e.target).closest(".bb_more_options").find(".bb_more_options_list").hasClass("is_visible")?f(".bb_more_options").find(".bb_more_options_list").removeClass("is_visible"):(f(".bb_more_options").find(".bb_more_options_list").removeClass("is_visible"),f(e.target).closest(".bb_more_options").find(".bb_more_options_list").addClass("is_visible"))):(f(".bb_more_options").find(".bb_more_options_list").removeClass("is_visible"),f(".optionsOpen").removeClass("optionsOpen"))},getVideoThumb:function(d,l){var e,i=new FileReader;i.onload=function(){var t,e=new Blob([i.result],{type:d.type}),n=URL.createObjectURL(e),o=document.createElement("video");o.src=n;var s=0,r=setInterval(function(){var e;05e4;if(i){var a=document.createElement("img");a.src=t;if(d.previewElement){if(f(d.previewElement).find(l).find("img").length)f(d.previewElement).find(l).find("img").attr("src",t);else f(d.previewElement).find(l).append(a);f(d.previewElement).closest(".dz-preview").addClass("dz-has-thumbnail")}else if(f(l).find("img").length)f(l).find("img").attr("src",t);else f(l).append(a);URL.revokeObjectURL(n)}else{if(s>=2){f(d.previewElement).closest(".dz-preview").addClass("dz-has-no-thumbnail");clearInterval(r)}s++}return i}()||(o.removeEventListener("timeupdate",e),o.pause())}),o.preload="metadata",o.src=n,o.muted=!0,o.playsInline=!0,null!=t&&(o.currentTime=Math.floor(t)),o.play(),clearInterval(r)),2<=s&&(f(d.previewElement).closest(".dz-preview").addClass("dz-has-no-thumbnail"),clearInterval(r)),s++},500)},d.dataURL?((e=new XMLHttpRequest).open("GET",d.dataURL,!0),e.responseType="blob",e.onload=function(){var e;200==this.status&&(e=this.response,i.readAsArrayBuffer(e))},e.send()):i.readAsArrayBuffer(d)},bbWidgetMoreFollowing:function(e){e=f(e.currentTarget).attr("href").split("#");if(1 li").each(function(){t+=f(this).outerWidth()}),t>e.width()-10?(e.data("childerWith",t),t>e.width()&&(0===e.find(".medium-editor-toolbar-actions .medium-editor-action-more").length&&e.find(".medium-editor-toolbar-actions").append('
                                    • '),e.find(".medium-editor-action-more").show(),t+=e.find(".medium-editor-toolbar-actions .medium-editor-action-more").outerWidth(),f(e.find(".medium-editor-action").get().reverse()).each(function(){f(this).hasClass("medium-editor-action-more-button")||t>e.width()&&(t-=f(this).outerWidth(),e.find(".medium-editor-action-more > ul").prepend(f(this).parent()))}))):e.find(".medium-editor-toolbar-actions .medium-editor-action-more").length&&(f(e.find(".medium-editor-action-more ul > li")).each(function(){t+35 li").length&&e.find(".medium-editor-action-more").hide()),f(e).find(".medium-editor-action-more-button").on("click",function(e){e.preventDefault(),f(this).parent(".medium-editor-action-more").toggleClass("active")}),f(e).find(".medium-editor-action-more ul .medium-editor-action").on("click",function(e){e.preventDefault(),f(this).closest(".medium-editor-action-more").toggleClass("active")}),f(window).one("resize",function(){e.removeClass("wrappingInitialised"),f(e).find(".medium-editor-action-more ul .medium-editor-action").unbind("click")}))},isURL:function(e){return/^(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,24}(:[0-9]{1,5})?(\/.*)?$/.test(f.trim(e))},closeActionPopup:function(e){e.preventDefault(),f(this).closest(".bb-action-popup").hide()},directorySearchInput:function(){var e,t;f(this).val()===f(this).data("last-value")||""===f(this).val()&&void 0===f(this).data("last-value")||(f(this).data("last-value",f(this).val()),t=(e=f(this).closest(".search-form-has-reset")).find(".search-form_reset"),0"),f(this).hasClass("disabled")||f(this).find("input:checked").length&&(a+=""===a?f(this).find('input[type="checkbox"] + label').text().trim():", "+f(this).find('input[type="checkbox"] + label').text().trim(),o++)}),o===f(this).find(e+':not(:first-child) input[type="checkbox"]').length?1==f(this).find(e+':not(:first-child) input[type="checkbox"]').length||(a=t):a=""===a?i:a,0===f(this).find(e+":first-child .bb-mobile-setting").length?f(this).find(e+":first-child").append('
                                      '+a+"
                                        "):f(this).find(e+":first-child .bb-mobile-setting .bb-mobile-setting-anchor").text(a),f(this).find(e+":first-child .bb-mobile-setting ul").html(""),f(this).find(e+":first-child .bb-mobile-setting ul").append(n)})},dropZoneGlobalProgress:function(i){0==f(i.element).find(".dz-global-progress").length&&(f(i.element).append('

                                        '),f(i.element).addClass("dz-progress-view"),f(i.element).find(".dz-remove-all").click(function(){f.each(i.files,function(e,t){i.removeFile(t)})}));var e="",t=0,a=0;1==i.files.length?(f(i.element).addClass("dz-single-view"),e="Uploading "+i.files[0].name+"",t=i.files[0].upload.progress):(f(i.element).removeClass("dz-single-view"),a=0,f.each(i.files,function(e,t){a+=t.upload.progress}),t=a/i.files.length,e="Uploading "+i.files.length+" files"),f(i.element).find(".dz-global-progress .dz-progress").css("width",t+"%"),f(i.element).find(".dz-global-progress > p").html(e)},userPresenceStatus:function(){window.bb_is_user_active=!0;var e=1e3*parseInt(BB_Nouveau_Presence.idle_inactive_span);bp.Nouveau.userPresenceChecker(e),""!==BB_Nouveau_Presence.heartbeat_enabled&&parseInt(BB_Nouveau_Presence.presence_interval)<=60?(f(document).on("heartbeat-send",function(e,t){var i;void 0!==window.bb_is_user_active&&!0===window.bb_is_user_active&&(i=bp.Nouveau.getPageUserIDs(),t.presence_users=i.join(","))}),f(document).on("heartbeat-tick",function(e,t){t.users_presence&&bp.Nouveau.updateUsersPresence(t.users_presence)})):setInterval(function(){var e,t={};void 0!==window.bb_is_user_active&&!0===window.bb_is_user_active&&(t.ids=bp.Nouveau.getPageUserIDs()),void 0!==t.ids&&void 0!==t.ids.length&&0
                                        '),n.currentPreviewParent=t.find(".bb-url-scrapper-container")),0
                                        ").html(e)).find("a.bp-suggestions-mention").remove(),i.find('[rel="nofollow"]').remove(),0<=(e=0<=(e=i.html()).indexOf("/g,""):e).indexOf("http://")?o=this.getURL("http://",e):0<=e.indexOf("https://")?o=this.getURL("https://",e):0<=e.indexOf("www.")&&(o=this.getURL("www",e)),""===o&&""===s||(""!==o&&((e=document.createElement("a")).href=o,e=e.hostname,void 0!==BP_Nouveau.forums.params.excluded_hosts&&-1!==BP_Nouveau.forums.params.excluded_hosts.indexOf(e)&&(o="")),""!==o?this.loadURLPreview(o):s&&this.loadURLPreview(s)))},getURL:function(e,t){var i="",a=(t=t.replace(/ /g,"")).indexOf(e),n="";if(_.isUndefined(jQuery(f.parseHTML(t)).attr("href"))){for(var o=a;o"===t[o+1]||"<"===t[o]&&"b"===t[o+1]&&"r"===t[o+2]);o++)i+=t[o];"www"===e&&(i=(e="http://")+i)}else i=jQuery(t).attr("href");e=document.createElement("div");e.innerHTML=i;for(var s=e.getElementsByTagName("*");s[0];)s[0].parentNode.removeChild(s[0]);return n=0
                                        ',e&&(i+=''+e+""),t&&(i+=''+t+""),i=(i+="
                                        ")+'
                                        '+(a?'':""),f((f(".bb-toast-messages-enable").length||(f(".bb-onscreen-notification-enable ul.notification-list").length?(p=f(".bb-onscreen-notification").hasClass("bb-position-left")?"left":"right",p=f('
                                          '),f(".bb-onscreen-notification").show(),f(p).insertBefore(".bb-onscreen-notification-enable ul.notification-list")):(p=f('
                                            '),f("body").append(p))),".bb-toast-messages-enable .toast-messages-list")).append('
                                          • '+i+"
                                          • "),n&&setInterval(function(){u()},o),f(r+" .actions .action-close").on("click",function(){u()}))},setupGlobals:function(){this.ajax_request=null,this.objects=f.map(BP_Nouveau.objects,function(e){return e}),this.objectNavParent=BP_Nouveau.object_nav_parent,this.heartbeat=wp.heartbeat||!1,this.querystring=this.getLinkParams(),this.bbServerTimeDiff=new Date(BP_Nouveau.wpTime).getTime()-(new Date).getTime()},prepareDocument:function(){var i;f("body").hasClass("no-js")&&f("body").removeClass("no-js").addClass("js"),BP_Nouveau.warnings&&"undefined"!=typeof console&&console.warn&&f.each(BP_Nouveau.warnings,function(e,t){console.warn(t)}),f(".buddypress_object_nav .widget-title").length&&(i=f(".buddypress_object_nav .widget-title").html(),f("body").find('*:contains("'+i+'")').each(function(e,t){f(t).hasClass("widget-title")||i!==f(t).html()||f(t).is("a")||f(t).remove()}))},getStorage:function(e,t){e=(e=sessionStorage.getItem(e))?JSON.parse(e):{};return void 0!==t?e[t]||!1:e},setStorage:function(e,t,i){var a=this.getStorage(e);return void 0===i&&void 0!==a[t]?delete a[t]:a[t]=i,sessionStorage.setItem(e,JSON.stringify(a)),null!==sessionStorage.getItem(e)},getLinkParams:function(e,t){var e=e?-1!==e.indexOf("?")?"?"+e.split("?")[1]:"":document.location.search;return e?(e=e.replace(/(^\?)/,"").split("&").map(function(e){return this[(e=e.split("="))[0]]=e[1],this}.bind({}))[0],t?e[t]:e):null},urlDecode:function(e,t){var i=t||{amp:"&",lt:"<",gt:">",quot:'"',"#039":"'"};return decodeURIComponent(e.replace(/\+/g," ")).replace(/&([^;]+);/g,function(e,t){return i[t]||""})},ajax:function(e,t,i){this.ajax_request&&void 0===i&&"scheduled"!==e.status&&this.ajax_request.abort();i=f.extend({},bp.Nouveau.getStorage("bp-"+t),{nonce:BP_Nouveau.nonces[t]},e);return void 0!==BP_Nouveau.customizer_settings&&(i.customized=BP_Nouveau.customizer_settings),void 0!==BP_Nouveau.modbypass&&(i.modbypass=BP_Nouveau.modbypass),this.ajax_request=f.post(BP_Nouveau.ajaxurl,i,"json"),this.ajax_request},inject:function(e,t,i){f(e).length&&t&&(("append"===(i=i||"reset")?f(e).append(t):"prepend"===i?f(e).prepend(t):"after"===i?f(e).after(t):f(e).html(t)).find("li.activity-item").each(this.hideSingleUrl),"undefined"==typeof bp_mentions&&void 0===bp.mentions||(f(".bp-suggestions").bp_mentions(bp.mentions.users),f("#whats-new").on("inserted.atwho",function(){var e;window.getSelection&&document.createRange?(e=window.getSelection&&window.getSelection())&&0 p").removeAttr("br").removeAttr("a").text(),t="",i="",a="",n=0;if(0<=e.indexOf("http://")?(a=e.indexOf("http://"),n=1):0<=e.indexOf("https://")?(a=e.indexOf("https://"),n=1):0<=e.indexOf("www.")&&(a=e.indexOf("www"),n=1),1===n){for(var o=a;o p:first").hide()}},objectRequest:function(a){var e,n,o=this;if((a=f.extend({object:"",scope:null,filter:null,target:"#buddypress [data-bp-list]",search_terms:"",page:1,extras:null,caller:null,template:null,method:"reset"},a)).object&&a.target)return"activity"==a.object&&"#buddypress [data-bp-list] ul.bp-list"==a.target&&(a.target="#buddypress [data-bp-list] ul.bp-list:not(#bb-media-model-container ul.bp-list)"),["members","activity","media","document"].includes(a.object)&&!f(this.objectNavParent+' [data-bp-scope="'+a.scope+'"]').length&&(a.scope="all"),a.search_terms&&(a.search_terms=a.search_terms.replace(//g,">")),null!==a.scope&&this.setStorage("bp-"+a.object,"scope",a.scope),null!==a.filter&&this.setStorage("bp-"+a.object,"filter",a.filter),null!==a.extras&&this.setStorage("bp-"+a.object,"extras",a.extras),f(this.objectNavParent+" [data-bp-object]").each(function(){f(this).removeClass("selected loading")}),(f(this.objectNavParent+' [data-bp-scope="'+a.scope+'"]').length?f(this.objectNavParent+' [data-bp-scope="'+a.scope+'"], #object-nav li.current'):f(this.objectNavParent+" [data-bp-scope]:eq(0), #object-nav li.current")).addClass("selected loading"),0===f(this.objectNavParent+' [data-bp-scope="'+a.scope+'"]').length&&(e=["group_members"===a.object&&f("body").hasClass("group-members"),"activity"===a.object&&f("body.groups").hasClass("activity"),"document"===a.object&&f("body").hasClass("documents"),"manage_group_members"===a.object&&f("body").hasClass("manage-members"),"document"===a.object&&(f("body").hasClass("document")||f("body").hasClass("documents"))],n=[f(".groups .group-search.members-search"),f(".groups .group-search.activity-search"),f(".documents .bp-document-listing .bb-title"),f(".groups .group-search.search-wrapper"),f("#bp-media-single-folder .bb-title")],e.forEach(function(e,t){e&&n[t].addClass("loading")})),f('#buddypress [data-bp-filter="'+a.object+'"] option[value="'+a.filter+'"]').prop("selected",!0),"friends"===a.object||"group_members"===a.object||"manage_group_members"===a.object?(a.template=a.object,a.object="members"):"group_requests"===a.object?(a.object="groups",a.template="group_requests"):"group_subgroups"===a.object?(a.object="groups",a.template="group_subgroups"):"notifications"===a.object&&(a.object="members",a.template="member_notifications"),e=f.extend({action:a.object+"_filter"},a),this.ajax(e,a.object).done(function(e){if(!1!==e.success&&!_.isUndefined(e.data)){if("scheduled"===a.status&&(f(e.data.contents).hasClass("bp-feedback")?f(a.target).parent().addClass("has-no-content"):f(a.target).parent().addClass("has-content")),_.isUndefined(e.data.layout)||(f(".layout-view").removeClass("active"),f(".layout-"+e.data.layout+"-view").addClass("active")),!f("body.group-members.members.buddypress").length||_.isUndefined(e.data)||_.isUndefined(e.data.count)||f("body.group-members.members.buddypress ul li#members-groups-li").find("span").text(e.data.count),f(o.objectNavParent+' [data-bp-scope="'+a.scope+'"]').removeClass("loading"),f(o.objectNavParent+' [data-bp-scope="'+a.scope+'"]').find("span").text(""),0===f(o.objectNavParent+' [data-bp-scope="'+a.scope+'"]').length&&n.forEach(function(e){e.removeClass("loading")}),_.isUndefined(e.data)||_.isUndefined(e.data.count)||f(o.objectNavParent+' [data-bp-scope="'+a.scope+'"]').find("span").text(e.data.count),!_.isUndefined(e.data)&&!_.isUndefined(e.data.scopes))for(var t in e.data.scopes)f(o.objectNavParent+' [data-bp-scope="'+t+'"]').find("span").text(e.data.scopes[t]);var i;"reset"!==a.method?(o.inject(a.target,e.data.contents,a.method),f(a.target).trigger("bp_ajax_"+a.method,f.extend(a,{response:e.data}))):"pag-bottom"===a.caller?(i=null,i=f("#subnav").length?f("#subnav").parent():f(a.target),f("html,body").animate({scrollTop:i.offset().top},"slow",function(){f(a.target).fadeOut(100,function(){o.inject(this,e.data.contents,a.method),f(this).fadeIn(100),f(a.target).trigger("bp_ajax_request",f.extend(a,{response:e.data})),bp.Nouveau.lazyLoad&&setTimeout(function(){bp.Nouveau.lazyLoad(".lazy")},1e3)})})):f(a.target).fadeOut(100,function(){o.inject(this,e.data.contents,a.method),f(this).fadeIn(100),f(a.target).trigger("bp_ajax_request",f.extend(a,{response:e.data})),bp.Nouveau.lazyLoad&&setTimeout(function(){bp.Nouveau.lazyLoad(".lazy")},1e3)}),setTimeout(function(){o.reportPopUp(),o.reportedPopup(),f(".activity-item.bb-closed-comments").find(".edit-activity, .acomment-edit").parents(".generic-button").hide()},1e3)}})},initObjects:function(){var a,n=this,o={},s="all",r="",d=null,l=null;f.each(this.objects,function(e,t){var i;f('#buddypress [data-bp-list="'+t+'"][data-ajax="false"]').length||(a=n.getStorage("bp-"+t),void 0!==(i=window.location.hash.substr(1))&&"following"==i?s=i:void 0!==a.scope&&(s=a.scope),void 0!==a.extras&&"notifications"!==t&&(d=a.extras),f('#buddypress [data-bp-filter="'+t+'"]').length&&(void 0!==a.filter?(l=a.filter,f('#buddypress [data-bp-filter="'+t+'"] option[value="'+l+'"]').prop("selected",!0)):"-1"!==f('#buddypress [data-bp-filter="'+t+'"]').val()&&"0"!==f('#buddypress [data-bp-filter="'+t+'"]').val()&&(l=f('#buddypress [data-bp-filter="'+t+'"]').val())),f(this.objectNavParent+' [data-bp-object="'+t+'"]').length&&(f(this.objectNavParent+' [data-bp-object="'+t+'"]').each(function(){f(this).removeClass("selected")}),f(this.objectNavParent+' [data-bp-scope="'+t+'"], #object-nav li.current').addClass("selected")),null!==n.querystring&&(void 0!==n.querystring[t+"_search"]?r=decodeURI(n.querystring[t+"_search"]):void 0!==n.querystring.s&&(r=decodeURI(n.querystring.s)),r)&&f('#buddypress [data-bp-search="'+t+'"] input[type=search]').val(r),f('#buddypress [data-bp-list="'+t+'"]').length&&(o={object:t,scope:s,filter:l,search_terms:r,extras:d},f('#buddypress [data-bp-member-type-filter="'+t+'"]').length?o.member_type_id=f('#buddypress [data-bp-member-type-filter="'+t+'"]').val():f('#buddypress [data-bp-group-type-filter="'+t+'"]').length&&(o.group_type=f('#buddypress [data-bp-group-type-filter="'+t+'"]').val()),n.objectRequest(o)))})},setHeartBeat:function(){void 0!==BP_Nouveau.pulse&&this.heartbeat&&(this.heartbeat.interval(Number(BP_Nouveau.pulse)),f.fn.extend({"heartbeat-send":function(){return this.bind("heartbeat-send")}}),f.fn.extend({"heartbeat-tick":function(){return this.bind("heartbeat-tick")}}))},addListeners:function(){f("[data-bp-disable-input]").on("change",this.toggleDisabledInput),f(this.objectNavParent+" .bp-navs").on("click","a",this,this.scopeQuery),f(document).on("change","#buddypress [data-bp-filter]",this,this.filterQuery),f(document).on("change","#buddypress [data-bp-group-type-filter]",this,this.typeGroupFilterQuery),f(document).on("change","#buddypress [data-bp-member-type-filter]",this,this.typeMemberFilterQuery),f("#buddypress [data-bp-search]").on("submit","form",this,this.searchQuery),f("#buddypress [data-bp-search]").on("keyup","input[name=group_members_search]",this,_.throttle(this.searchQuery,900)),f("#buddypress [data-bp-search] form").on("search","input[type=search]",this.resetSearch),f("#buddypress [data-bp-list], #buddypress #item-header, #buddypress.bp-shortcode-wrap .dir-list, #buddypress .bp-messages-content").on("click","[data-bp-btn-action]",this,this.buttonAction),f("#buddypress [data-bp-list], #buddypress #item-header, #buddypress.bp-shortcode-wrap .dir-list, #buddypress .messages-screen").on("blur","[data-bp-btn-action]",this,this.buttonRevert),f("#buddypress [data-bp-list], #buddypress #item-header, #buddypress.bp-shortcode-wrap .dir-list, #buddypress .messages-screen").on("mouseover","[data-bp-btn-action]",this,this.buttonHover),f("#buddypress [data-bp-list], #buddypress #item-header, #buddypress.bp-shortcode-wrap .dir-list, #buddypress .messages-screen").on("mouseout","[data-bp-btn-action]",this,this.buttonHoverout),f("#buddypress [data-bp-list], #buddypress #item-header, #buddypress.bp-shortcode-wrap .dir-list, #buddypress .messages-screen").on("mouseover",".awaiting_response_friend",this,this.awaitingButtonHover),f("#buddypress [data-bp-list], #buddypress #item-header, #buddypress.bp-shortcode-wrap .dir-list, #buddypress .messages-screen").on("mouseout",".awaiting_response_friend",this,this.awaitingButtonHoverout),f(document).on("click","#buddypress .bb-leave-group-popup .bb-confirm-leave-group",this.leaveGroupAction),f(document).on("click","#buddypress .bb-leave-group-popup .bb-close-leave-group",this.leaveGroupClose),f(document).on("click","#buddypress .bb-remove-connection .bb-confirm-remove-connection",this.removeConnectionAction),f(document).on("click","#buddypress .bb-remove-connection .bb-close-remove-connection",this.removeConnectionClose),f(document).on("click","#buddypress table.invite-settings .field-actions .field-actions-remove, #buddypress table.invite-settings .field-actions-add",this,this.addRemoveInvite),f(document).on("click",".show-action-popup",this.showActionPopup),f(document).on("click","#message-threads .block-member",this.threadListBlockPopup),f(document).on("click","#message-threads .report-content",this.threadListReportPopup),f(document).on("click",".bb-close-action-popup, .action-popup-overlay",this.closeActionPopup),f(document).on("keyup",'.search-form-has-reset input[type="search"], .search-form-has-reset input#bbp_search',_.throttle(this.directorySearchInput,900)),f(document).on("click",".search-form-has-reset .search-form_reset",this.resetDirectorySearch),f(document).on("keyup",this,this.keyUp),f("[data-bp-close]").on("click",this,this.closeNotice),f("#buddypress [data-bp-list]").on("click","[data-bp-pagination] a",this,this.paginateAction),f(document).on("click",this.closePickersOnClick),document.addEventListener("keydown",this.closePickersOnEsc),f(document).on("click","#item-header a.position-change-cover-image, .header-cover-reposition-wrap a.cover-image-save, .header-cover-reposition-wrap a.cover-image-cancel",this.coverPhotoCropper),f(document).on("click","#cover-photo-alert .bb-model-close-button",this.coverPhotoCropperAlert),f(document).on("click",this.toggleMoreOption.bind(this)),f(document).on("heartbeat-send",this.bbHeartbeatSend.bind(this)),f(document).on("heartbeat-tick",this.bbHeartbeatTick.bind(this)),bp.Nouveau.notificationRemovedAction(),bp.Nouveau.removeAllNotification(),bp.Nouveau.setTitle(),f(document).on("click",".more-following .count-more",this.bbWidgetMoreFollowing),f(".bb-accordion .bb-accordion_trigger").on("click",this.toggleAccordion)},bbHeartbeatSend:function(e,t){t.onScreenNotifications=!0,f("#buddypress").trigger("bb_heartbeat_send",t)},bbHeartbeatTick:function(e,t){bp.Nouveau.bbInjectOnScreenNotifications(e,t)},bbInjectOnScreenNotifications:function(e,t){var i,a,n,o,s,r;"1"!=f(".bb-onscreen-notification").data("enable")||void 0===t.on_screen_notifications&&""===t.on_screen_notifications||(i=f(".bb-onscreen-notification"),n=(a=i.find(".notification-list")).data("removed-items"),o=a.data("animated-items"),s=[],r=f(f.parseHTML("
                                              "+t.on_screen_notifications+"
                                            ")),f.each(n,function(e,t){t=r.find("[data-notification-id="+t+"]");t.length&&t.closest(".read-item").remove()}),(t=r.find(".read-item")).each(function(e,t){var i=f(t).find(".actions .action-close").data("notification-id");"-1"==f.inArray(i,o)?(f(t).addClass("pull-animation"),o.push(i),s.push(i)):f(t).removeClass("pull-animation")}),s.length&&t.each(function(e,t){var i=f(t).find(".actions .action-close").data("notification-id");"-1"==f.inArray(i,s)&&(f(t).removeClass("recent-item"),(t=a.data("border-items")).push(i),a.attr("data-border-items",JSON.stringify(t)))}),a.attr("data-animated-items",JSON.stringify(o)),t.length&&(i.removeClass("close-all-items"),t.eq(2).nextAll().addClass("bb-more-item"),3 li").each(function(){f(this).removeClass("pull-animation").addClass("close-item").delay(500).remove()}),f(".toast-messages-list > li").each(function(){f(this).removeClass("pull-animation").addClass("close-item").delay(500).remove()}),e.removeClass("bb-more-than-3")})},setTitle:function(){var e=f("html head").find("title").text();f(".bb-onscreen-notification").attr("data-title-tag",e)},visibilityOnScreenClearButton:function(){var e=f(".bb-onscreen-notification");1 tbody > tr").each(function(){f(this).find('input[type="text"]').removeAttr("style"),f(this).find('input[type="email"]').removeAttr("style")}),f("body.send-invites #send-invite-form #member-invites-table > tbody > tr").each(function(){e=f.trim(f(this).find('input[type="text"]').val()),i=f(this).find("input").attr("id"),t=f.trim(f(this).find('input[type="email"]').val()),""===e&&""===t?0:""!==e&&""===t?(i=f(this).find('input[type="email"]').attr("id"),a.push(i)):""===e&&""!==t?(i=f(this).find('input[type="text"]').attr("id"),a.push(i)):l.test(t)?n.push(1):(i=f(this).find('input[type="email"]').attr("id"),a.push(i))}),f(".span_error").remove(),0!==a.length?(a.forEach(function(e){f("#"+e).attr("style","border:1px solid #ef3e46"),-1!==e.indexOf("email_")?f("#"+e).after(''+p+""):f("#"+e).after(''+c+"")}),f("html, body").animate({scrollTop:f("#item-body").offset().top},2e3),alert(u),!1):(f("#email_0_email_error").length&&f("#email_0_email_error").remove(),0===n.length?(h=f("#invitee_0_title").val(),r=f("#email_0_email").val(),""===h&&""===r?(f("#invitee_0_title").attr("style","border:1px solid #ef3e46"),f("#invitee_0_title").focus(),f("#email_0_email").attr("style","border:1px solid #ef3e46")):""!==h&&""===r?(f("#email_0_email").attr("style","border:1px solid #ef3e46"),f("#email_0_email").focus()):(l.test(r)||(f("#email_0_email").attr("style","border:1px solid #ef3e46"),f("#email_0_email").focus(),f("#email_0_email_error").remove(),f("#email_0_email").after(''+p+"")),alert(u)),!1):void 0)})},sendInvitesRevokeAccess:function(){f("body.sent-invites #member-invites-table").length&&f("body.sent-invites #member-invites-table tr td span a.revoked-access").click(function(e){e.preventDefault();var e=f(this).attr("data-name"),t=f(this).attr("id"),i=f(this).attr("data-revoke-access");if(!confirm(e))return!1;f.ajax({url:i,type:"post",data:{item_id:t},success:function(){window.location.reload(!0)}})})},toggleDisabledInput:function(){var e=f(this).attr("data-bp-disable-input");f(e).prop("disabled",!0)&&!f(this).hasClass("enabled")?(f(this).addClass("enabled").removeClass("disabled"),f(e).prop("disabled",!1)):f(e).prop("disabled",!1)&&f(this).hasClass("enabled")&&(f(this).removeClass("enabled").addClass("disabled"),f(e).attr("disabled","disabled"))},keyUp:function(e){var t=e.data;27===e.keyCode&&t.buttonRevertAll()},scopeQuery:function(e){var t,i,a=e.data,n=f(e.currentTarget).parent(),o="",s=null,r={};if(n.hasClass("no-ajax")||f(e.currentTarget).hasClass("no-ajax")||!n.attr("data-bp-scope"))return e;if(t=n.data("bp-scope"),i=n.data("bp-object"),!t||!i)return e;e.preventDefault();var e=a.getStorage("bp-"+i);void 0!==e.extras&&"notifications"!==i&&(s=e.extras),e=f("#buddypress").find('[data-bp-filter="'+i+'"]').first().val(),f('#buddypress [data-bp-search="'+i+'"] input[type=search]').length&&(o=f('#buddypress [data-bp-search="'+i+'"] input[type=search]').val()),n.hasClass("dynamic")&&n.find("a span").html(""),r={object:i,scope:t,filter:e,search_terms:o,page:1,extras:s},f('#buddypress [data-bp-member-type-filter="'+i+'"]').length?r.member_type_id=f('#buddypress [data-bp-member-type-filter="'+i+'"]').val():f('#buddypress [data-bp-group-type-filter="'+i+'"]').length&&(r.group_type=f('#buddypress [data-bp-group-type-filter="'+i+'"]').val()),a.objectRequest(r)},filterQuery:function(e){var t=e.data,i=f(e.target).data("bp-filter"),a="all",n=f(e.target).val(),o="",s=!1;if(!i)return e;f(t.objectNavParent+" [data-bp-object].selected").length&&(a=f(t.objectNavParent+" [data-bp-object].selected").data("bp-scope")),f('#buddypress [data-bp-search="'+i+'"] input[type=search]').length&&(o=f('#buddypress [data-bp-search="'+i+'"] input[type=search]').val());e=t.getStorage("bp-"+(i="friends"===i?"members":i));void 0!==e.extras&&"notifications"!==i&&(s=e.extras),"members"===i?t.objectRequest({object:i,scope:a,filter:n,search_terms:o,page:1,extras:s,template:null,member_type_id:f('#buddypress [data-bp-member-type-filter="'+i+'"]').val()}):"groups"===i?t.objectRequest({object:i,scope:a,filter:n,search_terms:o,page:1,extras:s,template:null,group_type:f('#buddypress [data-bp-group-type-filter="'+i+'"]').val()}):t.objectRequest({object:i,scope:a,filter:n,search_terms:o,page:1,extras:s,template:null})},typeGroupFilterQuery:function(e){var t=e.data,i=f(e.target).data("bp-group-type-filter"),a="all",n=null,o=null,s="";if(!i)return e;void 0!==(e=t.getStorage("bp-"+i)).extras&&"notifications"!==i&&(o=e.extras),f('#buddypress [data-bp-filter="'+i+'"]').length&&(void 0!==e.filter?(n=e.filter,f('#buddypress [data-bp-filter="'+i+'"] option[value="'+n+'"]').prop("selected",!0)):"-1"!==f('#buddypress [data-bp-filter="'+i+'"]').val()&&"0"!==f('#buddypress [data-bp-filter="'+i+'"]').val()&&(n=f('#buddypress [data-bp-filter="'+i+'"]').val())),f(t.objectNavParent+" [data-bp-object].selected").length&&(a=f(t.objectNavParent+" [data-bp-object].selected").data("bp-scope")),f('#buddypress [data-bp-search="'+i+'"] input[type=search]').length&&(s=f('#buddypress [data-bp-search="'+i+'"] input[type=search]').val()),t.objectRequest({object:i,scope:a,filter:n,search_terms:s,page:1,template:null,extras:o,group_type:f('#buddypress [data-bp-group-type-filter="'+i+'"]').val()})},typeMemberFilterQuery:function(e){var t=e.data,i=f(e.target).data("bp-member-type-filter"),a="all",n=null,o=null,s="";if(!i)return e;void 0!==(e=t.getStorage("bp-"+(i="friends"===i?"members":i))).extras&&"notifications"!==i&&(o=e.extras),f('#buddypress [data-bp-filter="'+i+'"]').length&&(void 0!==e.filter?(n=e.filter,f('#buddypress [data-bp-filter="'+i+'"] option[value="'+n+'"]').prop("selected",!0)):"-1"!==f('#buddypress [data-bp-filter="'+i+'"]').val()&&"0"!==f('#buddypress [data-bp-filter="'+i+'"]').val()&&(n=f('#buddypress [data-bp-filter="'+i+'"]').val())),f(t.objectNavParent+" [data-bp-object].selected").length&&(a=f(t.objectNavParent+" [data-bp-object].selected").data("bp-scope")),f('#buddypress [data-bp-search="'+i+'"] input[type=search]').length&&(s=f('#buddypress [data-bp-search="'+i+'"] input[type=search]').val()),t.objectRequest({object:i,scope:a,filter:n,search_terms:s,page:1,template:null,extras:o,member_type_id:f('#buddypress [data-bp-member-type-filter="'+i+'"]').val()})},searchQuery:function(e){var t,i,a=e.data,n="all",o=!1;if(f(e.delegateTarget).hasClass("no-ajax")||void 0===f(e.delegateTarget).data("bp-search"))return e;e.preventDefault(),t=f(e.delegateTarget).data("bp-search"),i=f("#buddypress").find('[data-bp-filter="'+t+'"]').first().val(),e=f(e.delegateTarget).find("input[type=search]").first().val(),f(a.objectNavParent+" [data-bp-object]").length&&(n=f(a.objectNavParent+' [data-bp-object="'+t+'"].selected').data("bp-scope"));var s=a.getStorage("bp-"+t);void 0!==s.extras&&"notifications"!==t&&(o=s.extras),a.objectRequest({object:t,scope:n,filter:i,search_terms:e,page:1,extras:o,template:null})},showSearchSubmit:function(e){f(e.delegateTarget).find("[type=submit]").addClass("bp-show"),f("[type=submit]").hasClass("bp-hide")&&f("[type=submit]").removeClass("bp-hide")},resetSearch:function(e){f(e.target).val()?f(e.delegateTarget).find("[type=submit]").show():f(e.delegateTarget).submit()},buttonAction:function(e){var a=e.data,n=f(e.currentTarget),o=n.data("bp-btn-action"),t=n.data("bp-nonce"),s=n.closest("[data-bp-item-id]"),i=s.data("bp-item-id"),r=n.closest(".list-wrap"),d=s.data("bp-item-component"),l="",c=s.data("bp-used-to-component");if(!o||!i||!d)return e;if(e.preventDefault(),n.hasClass("bp-toggle-action-button"))return f(document.body).hasClass("buddyboss-theme")&&void 0!==n.data("balloon")?n.attr("data-balloon",n.data("title")):n.text(n.data("title")),n.removeClass("bp-toggle-action-button"),n.addClass("bp-toggle-action-button-clicked"),!1;if(void 0!==n.data("only-admin"))return void 0!==BP_Nouveau.only_admin_notice&&window.alert(BP_Nouveau.only_admin_notice),!1;if("is_friend"!==o&&(void 0!==BP_Nouveau[o+"_confirm"]&&!1===window.confirm(BP_Nouveau[o+"_confirm"])||n.hasClass("pending")))return!1;var e=f(".bb-leave-group-popup"),p=f(n).data("bb-group-name"),u=f(n).data("bb-group-link");if("leave_group"===o&&"true"!==f(n).attr("data-popup-shown")){if(e.length)return m=e.find(".bb-leave-group-content"),b=!!s.hasClass("has-child"),m.html(b?BP_Nouveau.parent_group_leave_confirm:BP_Nouveau.group_leave_confirm),b||m.find(".bb-group-name").html(''+p+""),f("body").find('[data-current-anchor="true"]').removeClass("bp-toggle-action-button bp-toggle-action-button-hover").addClass("bp-toggle-action-button-clicked"),e.show(),f(n).attr("data-current-anchor","true"),f(n).attr("data-popup-shown","true"),!1}else f("body").find('[data-popup-shown="true"]').attr("data-popup-shown","false"),f("body").find('[data-current-anchor="true"]').attr("data-current-anchor","false"),e.find(".bb-leave-group-content .bb-group-name").html(""),e.hide();var b={},m=(f(n).closest("#item-header").length?b=f("#item-header .bb-remove-connection"):f(n).closest('.members[data-bp-list="members"]').length?b=f('.members[data-bp-list="members"] .bb-remove-connection'):f(n).closest('.group_members[data-bp-list="group_members"]').length&&(b=f('.group_members[data-bp-list="group_members"] .bb-remove-connection')),f(n).data("bb-user-name")),u=f(n).data("bb-user-link");if("is_friend"===o&&"opened"!==f(n).attr("data-popup-shown")){if(b.length)return b.find(".bb-remove-connection-content .bb-user-name").html(''+m+""),f("body").find('[data-current-anchor="true"]').removeClass("bp-toggle-action-button bp-toggle-action-button-hover").addClass("bp-toggle-action-button-clicked"),b.show(),f(n).attr("data-current-anchor","true"),f(n).attr("data-popup-shown","opened"),!1}else f("body").find('[data-popup-shown="opened"]').attr("data-popup-shown","closed"),f("body").find('[data-current-anchor="true"]').attr("data-current-anchor","false"),b.length&&(b.find(".bb-remove-connection-content .bb-user-name").html(""),b.hide());l=t?a.getLinkParams(t,"_wpnonce"):void 0===n.prop("href")?a.getLinkParams(n.attr("href"),"_wpnonce"):a.getLinkParams(n.prop("href"),"_wpnonce"),p={is_friend:"remove_friend",not_friends:"add_friend",pending:"withdraw_friendship",accept_friendship:"accept_friendship",reject_friendship:"reject_friendship"},"members"===d&&void 0!==p[o]&&(o=p[o],d="friends"),e={not_following:"follow",following:"unfollow"},"members"===d&&void 0!==e[o]&&(o=e[o],d="follow"),n.addClass("pending loading"),u="",f(document.body).hasClass("directory")&&f(document.body).hasClass("members")||f(document.body).hasClass("group-members")?u="directory":f(document.body).hasClass("bp-user")&&(u="single"),m="primary",b="single"===u?n.closest(".header-dropdown"):n.closest(".footer-button-wrap");void 0!==b.length&&0"+e.data.feedback+"","error",null,!0]);else{if("groups"===d){if(void 0!==e.data.is_group&&e.data.is_group)return void 0!==e.data.group_url&&e.data.group_url?window.location=e.data.group_url:window.location.reload();void 0!==e.data.is_group&&e.data.is_parent&&f("#buddypress .groups-nav li.selected a").trigger("click"),void 0!==e.data.is_group_subscription&&!0===e.data.is_group_subscription&&void 0!==e.data.feedback&&f(document).trigger("bb_trigger_toast_message",["","
                                            "+e.data.feedback+"
                                            ","info",null,!0])}var t,i;if(f("#friends-personal-li").length&&(t=f("#friends-personal-li a span"),i=f("#friends-personal-li a"),void 0!==e.data.is_user&&e.data.is_user&&void 0!==e.data.friend_count||void 0!==e.data.friend_count)&&("0"!==e.data.friend_count?t.length?f(t).html(e.data.friend_count):f(i).append(''+e.data.friend_count+""):f(t).hide()),void 0!==e.data.is_user&&e.data.is_user)n.parent().html(e.data.feedback),s.fadeOut(1500);else{if(void 0!==e.data.is_user&&!e.data.is_user&&void 0!==e.data.group_url&&e.data.group_url)return window.location=e.data.group_url;f(a.objectNavParent+' [data-bp-scope="personal"]').length&&(i=Number(f(a.objectNavParent+' [data-bp-scope="personal"] span').html())||0,-1!==f.inArray(o,["leave_group","remove_friend"])?--i:-1!==f.inArray(o,["join_group"])&&(i+=1),i<0&&(i=0),f(a.objectNavParent+' [data-bp-scope="personal"] span').html(i)),"follow"===d&&0"+BP_Nouveau.subscriptions.error+""+e+".","subscribe"===o&&(t="
                                            "+BP_Nouveau.subscriptions.subscribe_error+""+e+"
                                            "),jQuery(document).trigger("bb_trigger_toast_message",["",t,"error",null,!0])),n.removeClass("pending loading")})},buttonRevert:function(e){e=f(e.currentTarget);e.hasClass("bp-toggle-action-button-clicked")&&!e.hasClass("loading")&&(f(document.body).hasClass("buddyboss-theme")&&void 0!==e.data("balloon")?e.attr("data-balloon",e.data("title-displayed")):e.text(e.data("title-displayed")),e.removeClass("bp-toggle-action-button-clicked"),e.addClass("bp-toggle-action-button"))},buttonHover:function(e){var t=f(e.currentTarget),i=t.data("bp-btn-action"),a=t.closest("[data-bp-item-id]"),n=a.data("bp-item-id"),a=a.data("bp-item-component");return i&&n&&a?(e.preventDefault(),t.hasClass("bp-toggle-action-button")?(t.hasClass("group-subscription")&&void 0!==t.data("title")&&void 0!==t.data("title-displayed")&&0===t.data("title").replace(/<(.|\n)*?>/g,"").length&&0===t.data("title-displayed").replace(/<(.|\n)*?>/g,"").length||(f(document.body).hasClass("buddyboss-theme")&&void 0!==t.data("balloon")&&(t.hasClass("following")||t.attr("data-balloon",t.data("title").replace(/<(.|\n)*?>/g,"")),t.find("span").html(t.data("title"))),t.html(t.data("title"))),t.removeClass("bp-toggle-action-button"),t.addClass("bp-toggle-action-button-hover"),!1):void 0):e},buttonHoverout:function(e){e=f(e.currentTarget);if(e.hasClass("bp-toggle-action-button-hover")&&!e.hasClass("loading")){if(e.hasClass("group-subscription")&&void 0!==e.data("title")&&void 0!==e.data("title-displayed")&&0===e.data("title").replace(/<(.|\n)*?>/g,"").length&&0===e.data("title-displayed").replace(/<(.|\n)*?>/g,"").length)return e.removeClass("bp-toggle-action-button-hover"),e.addClass("bp-toggle-action-button"),!1;f(document.body).hasClass("buddyboss-theme")&&void 0!==e.data("balloon")&&(e.hasClass("following")||e.attr("data-balloon",e.data("title-displayed").replace(/<(.|\n)*?>/g,"")),e.find("span").html(e.data("title-displayed"))),e.html(e.data("title-displayed")),e.removeClass("bp-toggle-action-button-hover"),e.addClass("bp-toggle-action-button")}},awaitingButtonHover:function(e){var t=f(e.currentTarget);if(e.preventDefault(),t.hasClass("bp-toggle-action-button"))return f(document.body).hasClass("buddyboss-theme")&&void 0!==t.data("balloon")&&(t.hasClass("following")||t.attr("data-balloon",t.data("title").replace(/<(.|\n)*?>/g,"")),t.find("span").html(t.data("title"))),t.html(t.data("title")),t.removeClass("bp-toggle-action-button"),t.addClass("bp-toggle-action-button-hover"),!1},awaitingButtonHoverout:function(e){e=f(e.currentTarget);e.hasClass("bp-toggle-action-button-hover")&&!e.hasClass("loading")&&(f(document.body).hasClass("buddyboss-theme")&&void 0!==e.data("balloon")&&(e.hasClass("following")||e.attr("data-balloon",e.data("title-displayed").replace(/<(.|\n)*?>/g,"")),e.find("span").html(e.data("title-displayed"))),e.html(e.data("title-displayed")),e.removeClass("bp-toggle-action-button-hover"),e.addClass("bp-toggle-action-button"))},leaveGroupAction:function(e){e.preventDefault(),f("body").find('[data-current-anchor="true"]').removeClass("bp-toggle-action-button bp-toggle-action-button-hover").addClass("bp-toggle-action-button-clicked"),f("body").find('[data-current-anchor="true"]').trigger("click")},leaveGroupClose:function(e){e.preventDefault();e=f(e.currentTarget),e=f(e).closest(".bb-leave-group-popup");f("body").find('[data-current-anchor="true"]').attr("data-current-anchor","false"),f("body").find('[data-popup-shown="true"]').attr("data-popup-shown","false"),e.find(".bb-leave-group-content .bb-group-name").html(""),e.hide()},removeConnectionAction:function(e){e.preventDefault(),f("body").find('[data-current-anchor="true"]').removeClass("bp-toggle-action-button bp-toggle-action-button-hover").addClass("bp-toggle-action-button-clicked"),f("body").find('[data-current-anchor="true"]').trigger("click")},removeConnectionClose:function(e){e.preventDefault();e=f(e.currentTarget),e=f(e).closest(".bb-remove-connection");f("body").find('[data-current-anchor="true"]').attr("data-current-anchor","false"),f("body").find('[data-popup-shown="opened"]').attr("data-popup-shown","closed"),e.find(".bb-remove-connection-content .bb-user-name").html(""),e.hide()},buttonRevertAll:function(){f.each(f("#buddypress [data-bp-btn-action]"),function(){f(this).hasClass("bp-toggle-action-button-clicked")&&!f(this).hasClass("loading")&&(f(document.body).hasClass("buddyboss-theme")&&void 0!==f(this).data("balloon")?f(this).attr("data-balloon",f(this).data("title-displayed")):f(this).text(f(this).data("title-displayed")),f(this).removeClass("bp-toggle-action-button-clicked"),f(this).addClass("bp-toggle-action-button"),f(this).trigger("blur"))})},addRemoveInvite:function(e){var e=e.currentTarget,t=f(e).closest("tbody");if(f(e).hasClass("field-actions-remove")){if(!(1"+i+"").insertBefore(f(this).closest("tr")),20 input").attr("name","invitee["+e+"][]"),f(this).find(".field-name > input").attr("id","invitee_"+e+"_title"),f(this).find(".field-email > input").attr("name","email["+e+"][]"),f(this).find(".field-email > input").attr("id","email_"+e+"_email"),f(this).find(".field-member-type > select").attr("name","member-type["+e+"][]"),f(this).find(".field-member-type > select").attr("id","member_type_"+e+"_member_type")})},closeNotice:function(e){var t=f(e.currentTarget);e.preventDefault(),"clear"===t.data("bp-close")&&(void 0!==f.cookie("bp-message")&&f.removeCookie("bp-message"),void 0!==f.cookie("bp-message-type"))&&f.removeCookie("bp-message-type"),t.closest(".bp-feedback").hasClass("bp-sitewide-notice")&&bp.Nouveau.ajax({action:"messages_dismiss_sitewide_notice"},"messages"),t.closest(".bp-feedback").remove()},paginateAction:function(e){var t=e.data,i=f(e.currentTarget),a=null,n=null,o=null,s=null,r=i.closest("[data-bp-pagination]").data("bp-pagination")||null;if(null===r)return e;e.preventDefault(),null!==(e=f(e.delegateTarget).data("bp-list")||null)&&(void 0!==(d=t.getStorage("bp-"+e)).scope&&(a=d.scope),void 0!==d.filter&&(n=d.filter),void 0!==d.extras)&&(s=d.extras),null!==e&&(void 0!==(d=t.getStorage("bp-"+e)).scope&&(a=d.scope),void 0!==d.filter&&(n=d.filter),void 0!==d.extras)&&(s=d.extras);var d={object:e,scope:a,filter:n,search_terms:o=f('#buddypress [data-bp-search="'+e+'"] input[type=search]').length?f('#buddypress [data-bp-search="'+e+'"] input[type=search]').val():o,extras:s,caller:i.closest("[data-bp-pagination]").hasClass("bottom")?"pag-bottom":"",page:t.getLinkParams(i.prop("href"),r)||1};f("#buddypress [data-bp-group-type-filter]").length&&(d.group_type=f("#buddypress [data-bp-group-type-filter]").val()),f("#buddypress [data-bp-member-type-filter]").length&&(d.member_type_id=f("#buddypress [data-bp-member-type-filter]").val()),t.objectRequest(d)},enableSubmitOnLegalAgreement:function(){f("body #buddypress #register-page #signup-form #legal_agreement").length&&(f("body #buddypress #register-page #signup-form .submit #signup_submit").prop("disabled",!0),f(document).on("change","body #buddypress #register-page #signup-form #legal_agreement",function(){f(this).prop("checked")?f("body #buddypress #register-page #signup-form .submit #signup_submit").prop("disabled",!1):f("body #buddypress #register-page #signup-form .submit #signup_submit").prop("disabled",!0)}))},registerPopUp:function(){f(".popup-modal-register").length&&f(".popup-modal-register").magnificPopup({type:"inline",preloader:!1,fixedBgPos:!0,fixedContentPos:!0}),f(".popup-modal-dismiss").length&&f(".popup-modal-dismiss").click(function(e){e.preventDefault(),f.magnificPopup.close()})},loginPopUp:function(){f(".popup-modal-login").length&&f(".popup-modal-login").magnificPopup({type:"inline",preloader:!1,fixedBgPos:!0,fixedContentPos:!0}),f(".popup-modal-dismiss").length&&f(".popup-modal-dismiss").click(function(e){e.preventDefault(),f.magnificPopup.close()})},threadListBlockPopup:function(e){e.preventDefault();var t,e=f(this).data("bp-content-id"),i=f(this).data("bp-content-type"),a=f(this).data("bp-nonce"),n=f(this).attr("href");void 0!==e&&void 0!==i&&void 0!==a&&(f(document).find(".bp-report-form-err").empty(),(t=f(n)).find(".bp-content-id").val(e),t.find(".bp-content-type").val(i),t.find(".bp-nonce").val(a)),0"),void e.preventDefault();r=f(e.currentTarget).closest("#header-cover-image").height(),i=f(e.currentTarget).closest("#header-cover-image").width(),a=Number(f(e.currentTarget).closest("#cover-image-container").find(".header-cover-img").css("top").replace("px","")),n=f(e.currentTarget).closest("#header-cover-image").width()/f(e.currentTarget).closest("#header-cover-image").find(".header-cover-reposition-wrap img")[0].width,l.closest("#cover-image-container").find(".header-cover-reposition-wrap").show(),(t=f(".header-cover-reposition-wrap img")).guillotine({width:i,height:r,eventOnChange:"guillotinechange",init:{scale:n,y:a&&f(e.currentTarget).closest("#header-cover-image").hasClass("has-position")?-a:d,w:i,h:r}}),t.on("guillotinechange",function(e,t){l.closest("#cover-image-container").find(".header-cover-img").attr("data-top",-t.y)})}else f(e.currentTarget).hasClass("cover-image-save")?(o=f(e.currentTarget),s=f(e.currentTarget).closest("#cover-image-container").find(".header-cover-img"),o.addClass("loading"),f.post(BP_Nouveau.ajaxurl,{action:"save_cover_position",position:s.attr("data-top")}).done(function(e){e.success&&e.data&&""!==e.data.content?(o.removeClass("loading"),o.closest("#cover-image-container").find(".header-cover-reposition-wrap").hide(),o.closest("#header-cover-image:not(.has-position)").addClass("has-position"),s.css({top:e.data.content+"px"})):(o.removeClass("loading"),o.closest("#cover-image-container").find(".header-cover-reposition-wrap").hide())}).fail(function(){o.removeClass("loading"),o.closest("#cover-image-container").find(".header-cover-reposition-wrap").hide()})):f(e.currentTarget).hasClass("cover-image-cancel")&&((t=f(".header-cover-reposition-wrap img")).guillotine({width:0,height:0,init:{scale:1,y:0,w:0,h:0}}),t.guillotine("remove"),f(e.currentTarget).closest("#cover-image-container").find(".header-cover-reposition-wrap").hide(),f(e.currentTarget).closest("#cover-image-container").find(".header-cover-img").attr("data-top",""));e.preventDefault()},coverPhotoCropperAlert:function(e){e.preventDefault(),f("#cover-photo-alert").remove()},toggleMoreOption:function(e){f(e.target).hasClass("bb_more_options_action")||f(e.target).parent().hasClass("bb_more_options_action")?(e.preventDefault(),f(e.target).closest(".bb_more_options").find(".bb_more_options_list").hasClass("is_visible")?f(".bb_more_options").find(".bb_more_options_list").removeClass("is_visible"):(f(".bb_more_options").find(".bb_more_options_list").removeClass("is_visible"),f(e.target).closest(".bb_more_options").find(".bb_more_options_list").addClass("is_visible"))):(f(".bb_more_options").find(".bb_more_options_list").removeClass("is_visible"),f(".optionsOpen").removeClass("optionsOpen"))},getVideoThumb:function(d,l){var e,i=new FileReader;i.onload=function(){var t,e=new Blob([i.result],{type:d.type}),n=URL.createObjectURL(e),o=document.createElement("video"),s=(o.src=n,0),r=setInterval(function(){var e;05e4;if(i){var a=document.createElement("img");a.src=t;if(d.previewElement){if(f(d.previewElement).find(l).find("img").length)f(d.previewElement).find(l).find("img").attr("src",t);else f(d.previewElement).find(l).append(a);f(d.previewElement).closest(".dz-preview").addClass("dz-has-thumbnail")}else if(f(l).find("img").length)f(l).find("img").attr("src",t);else f(l).append(a);URL.revokeObjectURL(n)}else{if(s>=2){f(d.previewElement).closest(".dz-preview").addClass("dz-has-no-thumbnail");clearInterval(r)}s++}return i}()||(o.removeEventListener("timeupdate",e),o.pause())}),o.preload="metadata",o.src=n,o.muted=!0,o.playsInline=!0,null!=t&&(o.currentTime=Math.floor(t)),o.play(),clearInterval(r)),2<=s&&(f(d.previewElement).closest(".dz-preview").addClass("dz-has-no-thumbnail"),clearInterval(r)),s++},500)},d.dataURL?((e=new XMLHttpRequest).open("GET",d.dataURL,!0),e.responseType="blob",e.onload=function(){var e;200==this.status&&(e=this.response,i.readAsArrayBuffer(e))},e.send()):i.readAsArrayBuffer(d)},bbWidgetMoreFollowing:function(e){e=f(e.currentTarget).attr("href").split("#");if(1 li").each(function(){t+=f(this).outerWidth()}),t>e.width()-10?(e.data("childerWith",t),t>e.width()&&(0===e.find(".medium-editor-toolbar-actions .medium-editor-action-more").length&&e.find(".medium-editor-toolbar-actions").append('
                                            • '),e.find(".medium-editor-action-more").show(),t+=e.find(".medium-editor-toolbar-actions .medium-editor-action-more").outerWidth(),f(e.find(".medium-editor-action").get().reverse()).each(function(){f(this).hasClass("medium-editor-action-more-button")||t>e.width()&&(t-=f(this).outerWidth(),e.find(".medium-editor-action-more > ul").prepend(f(this).parent()))}))):e.find(".medium-editor-toolbar-actions .medium-editor-action-more").length&&(f(e.find(".medium-editor-action-more ul > li")).each(function(){t+35 li").length)&&e.find(".medium-editor-action-more").hide(),f(e).find(".medium-editor-action-more-button").on("click",function(e){e.preventDefault(),f(this).parent(".medium-editor-action-more").toggleClass("active")}),f(e).find(".medium-editor-action-more ul .medium-editor-action").on("click",function(e){e.preventDefault(),f(this).closest(".medium-editor-action-more").toggleClass("active")}),f(window).one("resize",function(){e.removeClass("wrappingInitialised"),f(e).find(".medium-editor-action-more ul .medium-editor-action").unbind("click")}))},isURL:function(e){return/^(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,24}(:[0-9]{1,5})?(\/.*)?$/.test(f.trim(e))},closeActionPopup:function(e){e.preventDefault(),f(this).closest(".bb-action-popup").hide()},directorySearchInput:function(){var e,t;f(this).val()===f(this).data("last-value")||""===f(this).val()&&void 0===f(this).data("last-value")||(f(this).data("last-value",f(this).val()),t=(e=f(this).closest(".search-form-has-reset")).find(".search-form_reset"),0"),f(this).hasClass("disabled")||f(this).find("input:checked").length&&(a+=""===a?f(this).find('input[type="checkbox"] + label').text().trim():", "+f(this).find('input[type="checkbox"] + label').text().trim(),o++)}),o===f(this).find(e+':not(:first-child) input[type="checkbox"]').length?1!=f(this).find(e+':not(:first-child) input[type="checkbox"]').length&&(a=t):a=""===a?i:a,0===f(this).find(e+":first-child .bb-mobile-setting").length?f(this).find(e+":first-child").append('
                                              '+a+"
                                                "):f(this).find(e+":first-child .bb-mobile-setting .bb-mobile-setting-anchor").text(a),f(this).find(e+":first-child .bb-mobile-setting ul").html(""),f(this).find(e+":first-child .bb-mobile-setting ul").append(n)})},dropZoneGlobalProgress:function(i){0==f(i.element).find(".dz-global-progress").length&&(f(i.element).append('

                                                '),f(i.element).addClass("dz-progress-view"),f(i.element).find(".dz-remove-all").click(function(){f.each(i.files,function(e,t){i.removeFile(t)})}));var e="",t=0,a=0;1==i.files.length?(f(i.element).addClass("dz-single-view"),e="Uploading "+i.files[0].name+"",t=i.files[0].upload.progress):(f(i.element).removeClass("dz-single-view"),a=0,f.each(i.files,function(e,t){a+=t.upload.progress}),t=a/i.files.length,e="Uploading "+i.files.length+" files"),f(i.element).find(".dz-global-progress .dz-progress").css("width",t+"%"),f(i.element).find(".dz-global-progress > p").html(e)},userPresenceStatus:function(){window.bb_is_user_active=!0;var e=1e3*parseInt(BB_Nouveau_Presence.idle_inactive_span);bp.Nouveau.userPresenceChecker(e),""!==BB_Nouveau_Presence.heartbeat_enabled&&parseInt(BB_Nouveau_Presence.presence_interval)<=60?(f(document).on("heartbeat-send",function(e,t){var i;void 0!==window.bb_is_user_active&&!0===window.bb_is_user_active&&(i=bp.Nouveau.getPageUserIDs(),t.presence_users=i.join(","))}),f(document).on("heartbeat-tick",function(e,t){t.users_presence&&bp.Nouveau.updateUsersPresence(t.users_presence)})):setInterval(function(){var e,t={};void 0!==window.bb_is_user_active&&!0===window.bb_is_user_active&&(t.ids=bp.Nouveau.getPageUserIDs()),void 0!==t.ids&&void 0!==t.ids.length&&0
                                                '),n.currentPreviewParent=t.find(".bb-url-scrapper-container")),0
                                                ").html(e)).find("a.bp-suggestions-mention").remove(),a.find('[rel="nofollow"]').remove(),0<=(e=0<=(e=a.html()).indexOf("/g,""):e).indexOf("http://")?o=this.getURL("http://",e):0<=e.indexOf("https://")?o=this.getURL("https://",e):0<=e.indexOf("www.")&&(o=this.getURL("www",e)),""===o&&""===s||(""!==(o=""!==o&&((t=document.createElement("a")).href=o,n=t.hostname,void 0!==BP_Nouveau.forums.params.excluded_hosts)&&-1!==BP_Nouveau.forums.params.excluded_hosts.indexOf(n)?"":o)?this.loadURLPreview(o):s&&this.loadURLPreview(s)))},getURL:function(e,t){var i="",a=(t=t.replace(/ /g,"")).indexOf(e),n="";if(_.isUndefined(jQuery(f.parseHTML(t)).attr("href"))){for(var o=a;o"===t[o+1]||"<"===t[o]&&"b"===t[o+1]&&"r"===t[o+2]);o++)i+=t[o];"www"===e&&(i=(e="http://")+i)}else i=jQuery(t).attr("href");for(var a=document.createElement("div"),s=(a.innerHTML=i,a.getElementsByTagName("*"));s[0];)s[0].parentNode.removeChild(s[0]);return n=0