From d7280a1b27ebbe29c7850144bd3610ffed5a6ceb Mon Sep 17 00:00:00 2001 From: Amin Charoliya Date: Thu, 9 May 2024 17:00:20 +0530 Subject: [PATCH] [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