/*=======================================================================*\
|| ###################################################################### ||
|| # vBulletin 5.1.9 Patch Level 4
|| # ------------------------------------------------------------------ # ||
|| # Copyright 2000-2016 vBulletin Solutions Inc. All Rights Reserved.  # ||
|| # This file may not be redistributed in whole or significant part.   # ||
|| # ----------------- VBULLETIN IS NOT FREE SOFTWARE ----------------- # ||
|| # http://www.vbulletin.com | http://www.vbulletin.com/license.html   # ||
|| ###################################################################### ||
\*========================================================================*/
window.vBulletin=window.vBulletin||{};window.vBulletin.phrase=window.vBulletin.phrase||{};window.vBulletin.phrase.precache=window.vBulletin.phrase.precache||[];window.vBulletin.phrase.precache=$.merge(window.vBulletin.phrase.precache,["add_folder","add_folder","are_you_sure_move_to_trash","are_you_sure_permanently_delete_messages","delete_folder","edit_folder","error","error_deleting_folder","error_editing_folder","error_x","folder_name","follow_request_denied","invalid_node_id","messages_updated_desc","need_folder_name","no_moderate_permissions","no_publish_permissions","page_does_not_exist","pending_posts","delete_pending_posts","please_enter_a_valid_page_number","please_select_messages","pm_ajax_error_desc","selected_folder_and_contents_will_be_deleted","sent_follow_request","private_messages","mark_message_status_text_for_move","mark_messages_status_text_for_move","mark_message_status_text_for_delete","mark_messages_status_text_for_delete","mark_message_status_text_for_read","mark_messages_status_text_for_read","mark_message_status_text_for_unread","mark_messages_status_text_for_unread","mark_message_status_text_generic","mark_messages_status_text_generic","mark_report_status_text_for_delete","mark_reports_status_text_for_delete","mark_report_status_text_for_open","mark_reports_status_text_for_open","mark_report_status_text_for_closed","mark_reports_status_text_for_closed","mark_report_status_text_generic","mark_reports_status_text_generic","messages_header","following","following_pending","follow","members_in_this_message","all_changes_made_will_be_lost_would_you_like_to_continue","cancel","need_privatemessage_text","invalid_pm_recipients"]);var $pmWidget;(function(A){window.vBulletin=window.vBulletin||{};window.vBulletin.privateMessage=window.vBulletin.privateMessage||{};vBulletin.privateMessage.updatePaginationLinks=function(K,O,E){var M=K.find(".js-pagenav");if(M.length>0){var C=M.find(".js-pagenav-button"),G=M.find(".js-pagenav-next-button"),D=M.find(".js-pagenav-prev-button"),J=/\/(\d+)\/?$/,N=0;var L=G.clone().removeClass().addClass("js-pagenav-button button secondary");var F=0;if(typeof (E)!="undefined"&&E){C.not(".js-pagenav-next-button").each(function(){pageNum=A(this).data("page");if(pageNum>1&&pageNum>E){A(this).remove()}F=Math.max(F,pageNum)});if(F<E&&L!=null){for(var H=F+1;H<=E;H++){var B=L.attr("href").replace(J,"/"+H);var I=L.clone().attr("data-page",H).text(H).attr("href",B);I.insertBefore(G);A(document.createTextNode("\n")).insertBefore(G)}C=M.find(".js-pagenav-button")}F=E}else{C.each(function(){F=Math.max(F,A(this).data("page"))})}N=parseInt(O,10)-1;D.data("page",N);D.attr("href",D.attr("href").replace(J,"/"+N));N=parseInt(O,10)+1;N=N<=F?N:0;G.data("page",N);G.attr("href",G.attr("href").replace(J,"/"+N));C.removeClass("primary").addClass("secondary");C.filter(function(){return A(this).data("page")==O}).removeClass("secondary").addClass("primary");D.removeClass("h-hide h-hide-imp");G.removeClass("h-hide h-hide-imp");if(O==1){D.addClass("h-hide-imp")}if(O==F){G.addClass("h-hide-imp")}if(typeof (E)!="undefined"){if(E>1){M.closest(".pagenav-container").removeClass("h-hide");M.closest(".js-pagenav-wrapper").removeClass("h-hide")}else{M.closest(".pagenav-container").addClass("h-hide");M.closest(".js-pagenav-wrapper").addClass("h-hide")}}}};A(document).ready(function(){$pmWidget=A(".private-message-widget");var C=A(".content-entry-box"),G=A(".js-editor",C);A(document).off("focus",".js-editor.js-focus-on-page-load").on("focus",".ckeditor-bare-box.ckeditor-load-on-focus",function(){vBulletin.ckeditor.initEditor(A(this).attr("id"),{error:function(N){A("#"+N).prop("disabled",false).removeClass("ckeditor-load-on-focus").closest(".content-entry-box").addClass("no-ckeditor")}})});if(G.length>0&&(C.hasClass("msg-type-new")||C.hasClass("msg-type-forward"))){vBulletin.ckeditor.initEditor(G.attr("id"),{success:function(N){this.setData(G.prev(".js-editor-parsed-text").html());setTimeout(function(){A(".autocompleteHelper",C)[0].focus()},200)},error:function(N){A("#"+N).prop("disabled",false).removeClass("ckeditor-load-on-focus").closest(".content-entry-box").addClass("no-ckeditor")}})}A(".folder-list.custom-folder-list form",$pmWidget).trigger("reset");$pmWidget.off("click",".folder-item.custom-folder .edit-icon-wrapper").on("click",".folder-item.custom-folder .edit-icon-wrapper",function(P){P.stopPropagation();var N=A(this).closest(".custom-folder").addClass("edit-folder-mode");var O=N.find(".edit-folder-box").select().focus();O.val(vBulletin.htmlEntities_decode(O.val()));O.data({origFolderName:O.val(),updateFlag:true});M(true);return false});var H;$pmWidget.off("keydown blur",".folder-item.custom-folder .edit-folder-box").on("keydown",".folder-item.custom-folder .edit-folder-box",function(P){var O=A(this);var N=false;switch(P.which){case 27:O.data("updateFlag",false);O.closest(".custom-folder").removeClass("edit-folder-mode");M(false);O.val(O.data("origFolderName"));N=true;break;case 13:O.data("updateFlag",true);O.trigger("blur",[true]);N=true;break;default:}return !N}).on("blur",".folder-item.custom-folder .edit-folder-box",function(Q,N){var O=A(this);var P=function(){if(!O.data("updateFlag")){return false}O.data("updateFlag",false);if(!isFolderNameValid(O,"Edit Folder")){O.data("updateFlag",true);return false}M(false);var R=O.closest(".custom-folder");var S=O.val().trim();if(S!=O.data("origFolderName")){A("body").css("cursor","wait");A.ajax({url:vBulletin.getAjaxBaseurl()+"/ajax/api/content_privatemessage/updateFolderTitle",type:"POST",data:{folderName:S,folderid:O.data("nodeId")},dataType:"json",success:function(U){if(U!=null){console.log(U);if(U&&!U.errors){var T=R.find(".label").text(S);var V=R.detach();K(V)}else{if(A.isArray(U.errors)&&U.errors.length>0){openAlertDialog({title:vBulletin.phrase.get("add_folder"),message:vBulletin.phrase.get("error_x",vBulletin.phrase.get(U.errors[0][0])),iconType:"error"})}}}},complete:function(){R.removeClass("edit-folder-mode");A("body").css("cursor","default")},error:function(){O.val(O.data("origFolderName"));openAlertDialog({title:vBulletin.phrase.get("edit_folder"),message:vBulletin.phrase.get("error_editing_folder"),iconType:"error"})}})}else{R.removeClass("edit-folder-mode")}};if(!N){H=setTimeout(P,200)}else{P()}});$pmWidget.off("click",".folder-item.custom-folder .delete-icon").on("click",".folder-item.custom-folder .delete-icon",function(P,N){clearTimeout(H);P.stopPropagation();var Q=A(this);var O=Q.prev(".edit-folder-box");if(!N){openConfirmDialog({title:vBulletin.phrase.get("edit_folder"),message:vBulletin.phrase.get("selected_folder_and_contents_will_be_deleted"),iconType:"warning",onClickYes:function(){Q.trigger("click",[true])},onClickNo:function(){O.select().focus()}});return false}A("body").css("cursor","wait");A.ajax({url:vBulletin.getAjaxBaseurl()+"/ajax/api/content_privatemessage/deleteFolder",type:"POST",data:{folderid:O.attr("data-node-id")},dataType:"json",success:function(R){if(R&&!R.errors){M(false);var T=Q.closest(".custom-folder");var S=T.find("a").hasClass("selected");T.remove();if(S){A(".nav-pane .folder-list .folder-item.messages a",$pmWidget).click()}}else{if(A.isArray(R.errors)&&R.errors.length>0){openAlertDialog({title:vBulletin.phrase.get("delete_folder"),message:vBulletin.phrase.get("error_x",R.errors[0][0]),iconType:"error"})}}},complete:function(){A("body").css("cursor","default")},error:function(){openAlertDialog({title:vBulletin.phrase.get("delete_folder"),message:vBulletin.phrase.get("error_deleting_folder"),iconType:"error"})}})});$pmWidget.off("click",".folder-list .folder-item > a[href]").on("click",".folder-list .folder-item > a[href]",function(O){var N=A(".folder-list .custom-folder.edit-folder-mode",$pmWidget);if(N.length>0){N.trigger("blur",[true]);return false}var P=A(this);if(P.parent().hasClass("edit-folder-mode")||(!P.parent().hasClass("special-folder")&&P.hasClass("selected"))){return false}if(!P.parent().hasClass("add-folder")){A(".folder-list .folder-item > a.selected",$pmWidget).removeClass("selected");P.addClass("selected")}return true});$pmWidget.off("click",".folder-list .folder-item.add-folder > a[href]").on("click",".folder-list .folder-item.add-folder > a[href]",function(N){createNewFolder.apply(this,[N,function(P,S){var R=A(".folder-item.custom-folder.template",$pmWidget).clone(true).removeClass("h-hide template");var Q=R.find("a");Q.attr("href",Q.attr("href").replace(/\/list\/0\//i,"/list/"+P+"/"));var O=R.find(".label").text(S);R.find(".edit-folder-box").attr("data-node-id",P).val(S);K(R);S=vBulletin.htmlEntities(S);F(P,S)},function(){A(this).removeClass("selected")}]);return false});function K(P){var N=false;var O=P.find(".edit-folder-box").val().toLowerCase();A(".folder-list.custom-folder-list .folder-item",$pmWidget).each(function(){var Q=A(this);if(O<Q.find(".label").text().toLowerCase()){Q.before(P);N=true;return false}});if(!N){A(".folder-list.custom-folder-list",$pmWidget).append(P)}}function F(Q,P){var O=false;var S=P.toLowerCase();var N;var R=A("#pmMoveToFolder li.pmMoveToFolder").length;A("#pmMoveToFolder li.pmMoveToFolder").each(function(T){N=A(this);if(T>0&&S<N.html().trim().toLowerCase()){N.before(A('<li class="pmMoveToFolder" id="folder_'+Q+'"> '+P+" </li>"));O=true;return false}});if(!O&&N){N.after(A('<li class="pmMoveToFolder" id="folder_'+Q+'"> '+P+" </li>"))}}function M(P){var O,N;if(P){O="data-href";N="href"}else{O="href";N="data-href"}A(".folder-list .folder-item a",$pmWidget).each(function(){var Q=A(this);var R={};R[O]=Q.attr(N);Q.attr(R).removeAttr(N)})}function L(O,S,R,N,P,Q){O=parseInt(O,10);S=parseInt(S,10);R=parseInt(R,10);N=parseInt(N,10);P=parseInt(P,10);if(isNaN(O)||isNaN(S)||isNaN(R)||isNaN(N)||isNaN(P)){return false}A.ajax({url:vBulletin.getAjaxBaseurl()+"/ajax/render/privatemessage_pendingpost_overlay",type:"POST",data:{nodeid:O,contenttypeid:S,currentPosition:R,maxPosition:N,postType:Q},dataType:"json",success:function(T){A(".pending-post-overlay").html(T).dialog({title:vBulletin.phrase.get("pending_posts"),modal:true,resizable:false,closeOnEscape:false,showCloseButton:false,width:700,dialogClass:"dialog-container pending-post-overlay-container dialog-box",}).dialog("open");A(".pending-post-overlay-container .ui-dialog-titlebar .nav-buttons").remove();var U=A(".pending-post-overlay-container .pending-post-overlay .nav-buttons").detach();A(".pending-post-overlay-container .ui-dialog-titlebar").append(U);A(".pending-post-overlay .list-item").data("user-id",P).data("post-type",Q).prepend(A(".pending-posts-container .list-container .list-item[data-node-id={0}] .list-item-header".format(O)).clone());vBulletin.ckeditor.initEditor("ckeditor-bare",{success:function(W,V){if(!V){V=vBulletin.ckeditor.getEditor(W)}V.setData(A(".pending-post-overlay .list-item .ckeditor-bare-box").html())}})},error:function(){openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("unable_to_contact_server_please_try_again"),iconType:"error"})}})}function E(S,Q){var W=parseInt(S.data("nodeId"),10);var O=parseInt(S.data("userId"),10);var N=S.data("postType");Q=parseInt(Q,10);if(isNaN(W)||isNaN(Q)){return false}var R=-1;var P=0;A(".conversation-list .list-item",$pmWidget).filter(function(X){P++;if(A(this).attr("data-node-id")==W){R=X;return true}});if(R==-1){return false}R=R+Q;var T=A(".conversation-list .list-item",$pmWidget).filter(function(X){if(R==X){return true}});if(T.length>0){var U=parseInt(T.attr("data-node-id"),10);var V=parseInt(T.attr("data-node-contenttype-id"));O=T.data("userId");N=T.data("postType");R++;return{postId:U,postContentTypeId:V,currentPosition:R,maxPosition:P,userId:O,postType:N}}else{return false}}function I(Q,P){var S=Q.closest(".pending-posts-paginator");var N=S.find("#maxPageNum").filter(":input[type=hidden]").val();if(isNaN(P)||isNaN(N)){return false}if(P<1||P>N){openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("please_enter_a_valid_page_number"),iconType:"error"});return false}else{if(P==pmPageNum){return false}else{var R="/"+routeAction+"/"+folderid+"/"+pmPageNum;var O="/"+routeAction+"/"+folderid+"/"+P;newpage=window.location.href.replace(R,O);window.location=newpage}}}function D(N,Q,V){if(!N){N=A("#private-message-toolbar .pending-posts-paginator .pendingpostsPageTo");if(N.length==0){return false}}if(!V){V=0}var S=N.closest(".pending-posts-paginator");var U=A("#privateMessageContainer .main-pane .pending-posts-container");var P=S.find("#maxPageNum").filter(":input[type=hidden]").val();var R=parseInt(S.find(":input[type=hidden][name=pagenum]").val(),10);var T=parseInt(S.find(":input[type=hidden][name=per-page]").val(),10);var W=S.find("input[name=routeInfoJson]").val();Q=parseInt(Q,10);if(isNaN(Q)||isNaN(P)||isNaN(R)){return false}if((Q<1)||(Q>P)){openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("please_enter_a_valid_page_number"),iconType:"error"});return false}else{if((Q==R)&&!V){return false}}var O={setCurrentPage:Q,setPerPage:T,getPagingInfo:V,options:{},routeInfoJson:W};A("#pendingFilters input:checked").each(function(){O.options[this.name]=this.value});A.ajax({url:vBulletin.getAjaxBaseurl()+"/ajax/render/privatemessage_pendingpost_main",type:"POST",data:O,dataType:"json",success:function(Z){U.html(Z);var Y=0;var X=0;if(Q<P){if(Q>1){X=Q+1;Y=Q-1}else{X=Q+1}}else{Y=Q-1}S.find(":input[type=hidden][name=pagenum]").val(Q);S.find(":input[type=hidden][name=next-page]").val(X);S.find(":input[type=hidden][name=prev-page]").val(Y);if(X){S.find(".pendingpostsNext").removeClass("h-disabled")}else{S.find(".pendingpostsNext").addClass("h-disabled")}if(Y){S.find(".pendingpostsPrev").removeClass("h-disabled")}else{S.find(".pendingpostsPrev").addClass("h-disabled")}S.find(".pendingpostsPageTo").val(Q);if(V){var a=A("#privateMessageContainer .main-pane .pending-posts-container .pending-posts-pageinfo");S.find("#maxPageNum").filter(":input[type=hidden]").val(parseInt(a.find(".totalpages").val(),10));S.find("div.pendingpostsPageCount").text(parseInt(a.find(".totalpages").val(),10));A(".folder-list .folder-item.pending-posts .count",$pmWidget).text(parseInt(a.find(".totalcount").val(),10))}},error:function(){openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("unable_to_contact_server_please_try_again"),iconType:"error"})}})}A("#pmBtnMarkRead").off("click").on("click",function(N){markMessages.apply(this,["setRead","read",1,false])});A("#pmBtnMarkUnRead").off("click").on("click",function(N){markMessages.apply(this,["setRead","read",0,false])});A("#pmBtnDelete").off("click").on("click",function(O){if(typeof (messageDetailPage)!="undefined"&&messageDetailPage){goBack=true}else{goBack=false}$button=this;var N=getSelectedMessages();console.log(N);if(N.length>0){openConfirmDialog({title:vBulletin.phrase.get("messages_header"),message:vBulletin.phrase.get("are_you_sure_move_to_trash"),iconType:"warning",onClickYes:function(){markMessages.apply($button,["toTrashcan",false,false,goBack,N])}})}else{return }});A(".pmBtnDeletePermanently").off("click").on("click",function(O){$button=this;var N=getSelectedMessages();if(N.length>0){openConfirmDialog({title:vBulletin.phrase.get("messages_header"),message:vBulletin.phrase.get("are_you_sure_permanently_delete_messages"),iconType:"warning",onClickYes:function(){markMessages.apply($button,["deleteMessages",false,false,false,N])}})}else{return }});A(".pmBtnUndelete").off("click").on("click",function(N){markMessages.apply(this,["undeleteMessage",false,false,false])});A(".topic-list-container").off("click",".following_remove").on("click",".following_remove",function(){var O=parseInt(A(this).attr("data-follow-id"));var N=vBulletin.getAjaxBaseurl()+"/profile/follow_button?do=delete&follower="+O+"&type=follow_contents";A.ajax({url:N,type:"POST",dataType:"json",success:function(P){if(P==true){location.reload()}else{if(P.errors){console.log(P.errors);openAlertDialog({title:vBulletin.phrase.get("following"),message:vBulletin.phrase.get("unable_to_contact_server_please_try_again"),iconType:"error"})}}},error:function(){openAlertDialog({title:vBulletin.phrase.get("following"),message:vBulletin.phrase.get("unable_to_contact_server_please_try_again"),iconType:"error"})}});return false});A("#pmBtnMarkReadChannel").off("click").on("click",function(Q){var P=this;var O=getSelectedMessages();console.log(O);if(O.length>0){for(var N in O){vBulletin.markchannelsread(O[N],{success:function(){location.reload()},failed:function(){openAlertDialog({title:vBulletin.phrase.get("forum"),message:"Mark Channels Read failed: {0}".format(result),iconType:"error"})}})}}else{return }});A("#reportBtnMarkOpen").off("click").on("click",function(N){markReports.apply(this,["openClose","op","open"])});A("#reportBtnMarkClosed").off("click").on("click",function(N){markReports.apply(this,["openClose","op","closed"])});A("#reportBtnDelete").off("click").on("click",function(N){markReports.apply(this,["bulkdelete",false,false])});$pmWidget.off("click",".split-button .move-button-set button").on("click",".split-button .move-button-set button",startMove);A("#pmBtnForward").off("click").on("click",startForward);A("#pmInfoClose").off("click").on("click",function(N){A("#pmInfoDialog").dialog("close")});A("#privatemessagePageto").bind("keydown blur",gotoPage);A(".btnPmCancel").off("click").on("click",function(N){openConfirmDialog({title:vBulletin.phrase.get("cancel"),message:vBulletin.phrase.get("all_changes_made_will_be_lost_would_you_like_to_continue"),iconType:"warning",onClickYes:function(){history.back()}})});A(".pmRequestAccept").off("click").on("click",acceptRequest);A(".pmRequestDeny").off("click").on("click",denyRequest);A("#pmBtnReply").off("click").on("click",function(Q){var P=A(".content-entry-box .js-editor"),O=P.attr("id"),N=vBulletin.ckeditor.editorExists(O)?vBulletin.ckeditor.getEditor(O):null;A("body,html").animate({scrollTop:A(".content-entry-box").offset().top},"slow",function(){(N||P[0]||A()).focus()})});A("#pmFloatingBarContent .toolbar-filter").off("click").bind("click",function(O){var N=A(this),P=A(".filter-wrapper",N).toggleClass("selected");A(".arrow .vb-icon",N).toggleClass("vb-icon-triangle-down-wide vb-icon-triangle-up-wide");N.closest(".toolbar-wrapper").find(".toolbar-filter-overlay").slideToggle("slow",function(){var Q="pm_filter",T=this;if(A(T).is(":visible")){A("body").off("click."+Q).bind("click."+Q,function(U){if(A(U.target).closest(".toolbar-filter-overlay").length==0&&A(U.target).closest(".toolbar-filter").length==0){A("body").off("click."+Q);N.triggerHandler("click")}});var R=true;var S={};R=vBulletin.isScrolledIntoView(T,S);if(!R){A("html,body").animate({scrollTop:"+="+Math.abs(S.bottom)},"fast")}}else{A("body").off("click."+Q)}})});A(".list-controls .select-all").off("click").on("click",function(N){A(".privateMessageActionCheck").prop("checked",true)});A(".list-controls .select-none").off("click").on("click",function(N){A(".privateMessageActionCheck").prop("checked",false)});if(typeof messageDetailPage!="undefined"&&messageDetailPage){A("#pmBtnBackToMessage").off("click").on("click",function(O){if(pmParentFolderId){location.href="{0}/privatemessage/list/{1}/1".format(pageData.baseurl,pmParentFolderId)}else{var N=A(".nav-pane .folder-list .folder-item.special-folder.messages a").attr("href");location.href=N}})}A("#notificationFilters").trigger("reset").find(".filter-options input").off("click").on("click",notificationsFilter);A("#pmBtnNotificationDismissAll").off("click").on("click",dismissNotifications);A("#pmBtnNotificationDismissPage").off("click").on("click",dismissNotifications);A("#iconNotificationNext").off("click").on("click",function(N){N.preventDefault();pmPageNum=parseInt(pmPageNum);if(pmPageNum<pmPages){var O=getNotificationsFilterParams();O.page++;A.ajax({url:vBulletin.getAjaxBaseurl()+"/ajax/render/privatemessage_notificationcontent",type:"POST",dataType:"json",data:{params:O},success:function(P){A("#notificationContent").html(P);pmPageNum++;A("#notificationPageto").val(pmPageNum);A("#iconNotificationPrevious").removeClass("h-disabled");if(pmPageNum>=pmPages){A("#iconNotificationNext").addClass("h-disabled")}vBulletin.privateMessage.updatePaginationLinks(A("#notificationContent").parent(),A("#notificationPageto").val())}})}});A("#iconNotificationPrevious").off("click").on("click",function(N){N.preventDefault();pmPageNum=parseInt(pmPageNum);if(pmPageNum>1){var O=getNotificationsFilterParams();O.page--;A.ajax({url:vBulletin.getAjaxBaseurl()+"/ajax/render/privatemessage_notificationcontent",type:"POST",dataType:"json",data:{params:O},success:function(P){A("#notificationContent").html(P);pmPageNum--;A("#notificationPageto").val(pmPageNum);A("#iconNotificationNext").removeClass("h-disabled");if(pmPageNum<=1){A("#iconNotificationPrevious").addClass("h-disabled")}vBulletin.privateMessage.updatePaginationLinks(A("#notificationContent").parent(),A("#notificationPageto").val())}})}});A("#notificationContent").on("click",".js-notification-dismiss",dismissSingleNotification);A("#notificationContent").on("click",".js-notification-others-dialog",toggleOthersDialog);if(A("#notificationContent").length==0){A("ul.pm-notification-list").on("click",".js-notification-dismiss",dismissSingleNotification);A("ul.pm-notification-list").on("click",".js-notification-others-dialog",toggleOthersDialog)}function J(O){var Q=A(this);if(O.type=="blur"||(O.type=="keydown"&&O.keyCode==13)){var N=Number(Q.val());if(!isNaN(N)&&N!=pmPageNum&&N>0&&N<=pmPages){var P=getNotificationsFilterParams();P.page=N;A.ajax({url:vBulletin.getAjaxBaseurl()+"/ajax/render/privatemessage_notificationcontent",type:"POST",dataType:"json",data:{params:P},success:function(R){A("#notificationContent").html(R);pmPageNum=N;A("#iconNotificationNext")[N>=pmPages?"addClass":"removeClass"]("h-disabled");A("#iconNotificationPrevious")[N<=1?"addClass":"removeClass"]("h-disabled");vBulletin.privateMessage.updatePaginationLinks(A("#notificationContent").parent(),A("#notificationPageto").val())}});if(O.type=="keydown"&&O.keyCode==13){Q.off("blur");Q.blur();Q.bind("blur",J)}}else{Q.val(pmPageNum)}return false}return true}A("#notificationPageto").bind("keydown blur",J);searchAuthorAutocomplete=new vBulletin_Autocomplete(A(".privatemessage_author"),{apiClass:"user"});A(document).off("click",".pmNotifDlgLink").on("click",".pmNotifDlgLink",openParticipants);A("#pmSearch").submit(function(N){return(A("#pmSearchText").val().length>3)});var B=false;A(document).off("click",".view-post").on("click",".view-post",function(S){var R=A(this);var U=A(this).closest(".list-item");var V=parseInt(U.data("nodeId"),10);var O=parseInt(U.data("userId"),10);var Q=parseInt(U.data("nodeContenttypeId"),10);var N=U.data("postType");var T=A("ul.conversation-list li.list-item",$pmWidget).index(U)+1;var P=U.closest("ul.conversation-list").find("li.list-item").length;B=false;L(V,Q,T,P,O,N)});A(document).off("click",".pending-post-approve").on("click",".pending-post-approve",function(){var P=[];var U;var T=A(this);var R=T.closest(".pending-post-overlay").find("li.list-item");if(R.length==0){R=T.closest("li.list-item")}if(R.length!=0){P.push(parseInt(R.data("nodeId"),10));U=R.data("postType")}else{if(T.closest("#pmFloatingBarContent").length){A(".pending-posts-container .list-item .privateMessageActionCheck:checked").each(function(){R=A(this).closest("li.list-item");P.push(parseInt(R.data("nodeId"),10))});if(P.length==0){return false}U="selected_posts"}else{return false}}var S={nodeid:P,approved:1};var Q=A(".title-field",R);var O=A(".text-field",R);var N=A(".notes-field",R);if(Q.length){S.title=Q.val()}if(O.length){S.text=O.val()}if(N.length){S.reason=N.val()}vBulletin.AJAX({url:vBulletin.getAjaxBaseurl()+"/ajax/api/node/setApprovedPost",data:S,error_phrase:"unable_to_contact_server_please_try_again",success:function(V){var W;if(A(".pending-post-overlay:visible").length){W=E(R,1);if(!W){W=E(R,-1)}}A(V).each(function(){A(".pending-posts-container .list-container .list-item[data-node-id={0}]".format(this)).remove()});B=true;if(W){L(W.postId,W.postContentTypeId,W.currentPosition,W.maxPosition,W.userId,W.postType)}else{A(".pending-post-close").trigger("click")}}})});A(document).off("click",".pending-post-delete").on("click",".pending-post-delete",function(){var O=[];var S;var Q=[];var R=A(this);var P=R.closest(".pending-post-overlay").find("li.list-item");if(P.length==0){P=R.closest("li.list-item")}if(P.length!=0){O.push(parseInt(P.data("nodeId"),10));S=P.data("postType");Q.push(parseInt(P.data("userId"),10))}else{if(R.closest("#pmFloatingBarContent").length){A(".pending-posts-container .list-item .privateMessageActionCheck:checked").each(function(){P=A(this).closest("li.list-item");O.push(parseInt(P.data("nodeId"),10));Q.push(parseInt(P.data("userId"),10))});if(O.length==0||Q.lenght==0){return false}S="selected_posts"}else{return false}}var N=vBulletin.phrase.get("delete_x",vBulletin.phrase.get("posttype_"+S));vBulletin.inlinemod.delete_dialog(O,function(T){var U;if(A(".pending-post-overlay:visible").length){U=E(P,1);if(!U){U=E(P,-1)}}A(T).each(function(){A(".pending-posts-container .list-container .list-item[data-node-id={0}]".format(this)).remove()});B=true;if(U){L(U.postId,U.postContentTypeId,U.currentPosition,U.maxPosition,U.userId,U.postType)}else{A(".pending-post-close").trigger("click")}})});A(document).off("click",".pending-post-next").on("click",".pending-post-next",function(){var N=A(this).closest(".pending-post-overlay-container").find(".pending-post-overlay li.list-item");var O=E(N,1);if(O!==false){A("pending-post-overlay").dialog("close");L(O.postId,O.postContentTypeId,O.currentPosition,O.maxPosition,O.userId,O.postType)}else{console.log("next element not found")}});A(document).off("click",".pending-post-previous").on("click",".pending-post-previous",function(){var N=A(this).closest(".pending-post-overlay-container").find(".pending-post-overlay li.list-item");var O=E(N,-1);if(O!==false){A("pending-post-overlay").dialog("close");L(O.postId,O.postContentTypeId,O.currentPosition,O.maxPosition,O.userId,O.postType)}else{console.log("prev element not found")}});A(document).off("click",".pending-post-close").on("click",".pending-post-close",function(){A(".pending-post-overlay").dialog("close");if(B){D(false,1,true)}});A(document).off("click",".pending-posts-paginator .pendingpostsPrev").on("click",".pending-posts-paginator .pendingpostsPrev",function(O){O.preventDefault();var N=A(this).closest(".pending-posts-paginator").find(':input[type=hidden][name="prev-page"]').val();D(A(this),N)});A(document).off("click",".pending-posts-paginator .pendingpostsNext").on("click",".pending-posts-paginator .pendingpostsNext",function(O){O.preventDefault();var N=A(this).closest(".pending-posts-paginator").find(':input[type=hidden][name="next-page"]').val();D(A(this),N)});A(document).off("keypress",".pending-posts-paginator .pendingpostsPageTo").on("keypress",".pending-posts-paginator .pendingpostsPageTo",function(O){if(O.keyCode==13){O.preventDefault();var P=A(this);var N=parseInt(P.val(),10);if(isNaN(N)){openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("please_enter_a_valid_page_number"),iconType:"error"});return false}D(P,N)}});$pmWidget.off("click",".private-message-toolbar .message-filters .filter-options :input[type=radio]").on("click",".private-message-toolbar .message-filters .filter-options :input[type=radio]",function(O){var N=A(this).closest("form.toolbar-filter-overlay");N.attr("action",(N.attr("action")+"?sortDir="+A(this).val()));N.submit()});A("#pendingFilters").trigger("reset").find(".filter-options input").off("click").on("click",pendingFilter);vBulletin.truncatePostContent(A(".pm-message-list"))})})(jQuery);isFolderNameValid=function(D,B,E){var C,G=$.trim(D.val()).toLowerCase();if(G==""){C="Please enter a folder name."}else{$(".folder-list.custom-folder-list .folder-item .edit-folder-box",$pmWidget).each(function(){if(D.hasClass("edit-folder-box")&&D.get(0)==this){return true}if(G==this.value.toLowerCase()){C="A folder with that name already exists. Please enter another name.";return false}})}if(C){if(E===true){var A=D.closest("#prompt-dialog"),F=A.find("div.error-msg-box");if(F.length==0){F=$("<div></div>").addClass("error-msg-box error");$(".dialog-content",A).before(F)}F.text("").text(C).removeClass("h-hide")}else{openAlertDialog({title:B,message:C,iconType:"warning",onAfterClose:function(){D.focus()}})}return false}else{if(E&&E==true){var A=D.closest("#prompt-dialog"),F=A.find("div.error-msg-box");if(F.length!=0){F.addClass("h-hide").text("")}}}return true};getSelectedMessages=function(B){var A=[];if(!B&&$("#privateMessageNodeid").val()){A.push($("#privateMessageNodeid").val())}else{A=$(".privateMessageActionCheck:checked").map(function(){return this.value}).get()}if(A.length==0){openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("please_select_messages"),iconType:"warning"})}return A};markMessages=function(A,F,E,B,D){if(!D){D=getSelectedMessages()}var C=this;if(D.length>0){if(F){data=[{name:F,value:E},{name:"nodeid",value:D.join(",")}]}else{data=[{name:"nodeid",value:D.join(",")}]}$.ajax({url:vBulletin.getAjaxBaseurl()+"/ajax/api/content_privatemessage/"+A,type:"POST",data:data,success:function(G){var H=(D.length>1)?"s":"",I;switch(A){case"moveMessage":I="mark_message"+H+"_status_text_for_move";break;case"toTrashcan":I="mark_message"+H+"_status_text_for_delete";break;case"setRead":I="mark_message"+H+"_status_text_for_"+(E?"read":"unread");break;case"undeleteMessage":I="mark_message"+H+"_status_text_for_undelete";break;case"deleteMessages":I="mark_message"+H+"_status_text_for_delete_permanently";break;default:I="mark_message"+H+"_status_text_generic"}openAlertDialog({title:$(C).text(),message:vBulletin.phrase.get(I),iconType:"",onAfterClose:function(){if(B){if(pmParentFolderId){location.replace("{0}/privatemessage/list/{1}/1".format(pageData.baseurl,pmParentFolderId))}else{var J=$(".nav-pane .folder-list .folder-item.special-folder.messages a").attr("href");location.replace(J)}}else{location.reload(true)}}})}})}return false};markReports=function(A,D,C){var E=getSelectedMessages(),B=this;if(E.length>0){if(D){data=[{name:D,value:C},{name:"nodeids",value:E.join(",")}]}else{data=[{name:"nodeids",value:E.join(",")}]}$.ajax({url:vBulletin.getAjaxBaseurl()+"/ajax/api/content_report/"+A,type:"POST",data:data,success:function(F){if(!F){var G=(E.length>1)?"s":"",H;switch(A){case"bulkdelete":H="mark_report"+G+"_status_text_for_delete";break;case"openClose":H="mark_report"+G+"_status_text_for_"+C;break;default:H="mark_report"+G+"_status_text_generic"}openAlertDialog({title:$(B).text(),message:vBulletin.phrase.get(H),iconType:""});if(A=="bulkdelete"){location.replace(pageData.baseurl+"/privatemessage/report/1")}else{location.reload(true)}}else{if(F.errors){console.log("/ajax/api/content_report/"+A+" error. response: "+F);openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("pm_ajax_error_desc"),iconType:"error"})}}},error:function(H,G,F){console.log("/ajax/api/content_report/"+A+" not successful. error:"+F);openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("pm_ajax_error_desc"),iconType:"error"})}})}return false};gotoPage=function(E){var F=$(this);if(E.type=="blur"||(E.type=="keydown"&&E.keyCode==13)){var C=Number(F.val());var A=$("#maxPageNum").val();if(!isNaN(C)&&C!=pmPageNum&&C>0&&C<=A){var D="/"+routeAction+"/"+folderid+"/"+pmPageNum;var B="/"+routeAction+"/"+folderid+"/"+C;newpage=window.location.href.replace(D,B);window.location=newpage}else{F.val(pmPageNum)}return false}return true};startMove=function(B){var A=this;if(typeof (messageDetailPage)!="undefined"&&messageDetailPage){goBack=true}else{goBack=false}$(".pmMoveToFolder").off("click").on("click",function(C){var D=parseInt(this.id.substr(7),10);if(D){if(!$(A).text()){A=$(A).closest(".move-button-set").find(".button-text").get(0)}markMessages.apply(A,["moveMessage","newFolderid",D,goBack])}});$("#pmOpenNewFolderName").off("click").on("click",function(D){var C=getSelectedMessages();if(C.length>0){createNewFolder.apply(this,[D,function(E,F){A=$(this).closest(".split-button").find(".button-text").get(0);markMessages.apply(A,["moveMessage","newFolderid",E,goBack])}])}return false})};createNewFolder=function(D,C,B){var A=this;$promtDlg=openPromptDialog({title:vBulletin.phrase.get("add_folder"),message:vBulletin.phrase.get("folder_name"),buttonLabel:{okLabel:vBulletin.phrase.get("ok"),cancelLabel:vBulletin.phrase.get("cancel")},validation:{custom:function(E){return isFolderNameValid(E,vBulletin.phrase.get("add_folder"),true)},override:true},dontCloseOnOk:true,onClickOK:function(E){$("body").css("cursor","wait");$.ajax({url:vBulletin.getAjaxBaseurl()+"/ajax/api/content_privatemessage/createMessageFolder",type:"POST",data:{folderName:E},dataType:"json",success:function(F){var G=$promtDlg.find(".error-msg-box");if(F&&!F.errors){console.log("/ajax/api/content_privatemessage/createMessageFolder successful. response: "+F);$promtDlg.dialog("close");if(G.length!=0){G.addClass("h-hide").text("")}if(typeof C=="function"){C.apply(A,[F,E])}}else{if(!F||F.errors){console.log("/ajax/api/content_privatemessage/createMessageFolder error. response: "+F);if(G.length==0){G=$("<div></div>").addClass("error-msg-box error");$(".dialog-content",$promtDlg).before(G)}G.text(vBulletin.phrase.get("pm_ajax_error_desc"))}}},complete:function(){$("body").css("cursor","default")}})},onAfterClose:function(){var E=$promtDlg.find(".error-msg-box");if(E.length!=0){E.text("").addClass("h-hide")}if(typeof B=="function"){B.apply(A)}}});return false};createNewPm=function(F){var I=$(this.form),A=$(this).closest(".content-entry-box"),H=A.hasClass("msg-type-reply")?"post_reply":(A.hasClass("msg-type-forward")?"forward_message":"new_message");if(H!="post_reply"&&$(".privatemessage_author",I).val()==""){openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("invalid_pm_recipients"),iconType:"warning",onAfterClose:function(){$(".autocompleteHelper",I)[0].focus()}});return false}else{var B=$("textarea[name=rawtext]",I),C=B.attr("id"),D=$.trim(B.val());if(vBulletin.ckeditor.editorExists(C)){var G=vBulletin.ckeditor.getEditor(C);var E=G.getData();D=$.trim($("<div />").html(E).text())}if(D.length==""){openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("need_privatemessage_text"),iconType:"warning",onAfterClose:function(){if(G){G.focus()}else{B[0].focus()}}});return false}}var E=I.serialize();$.ajax({url:vBulletin.getAjaxBaseurl()+"/createcontent/privatemessage",type:"POST",data:E,dataType:"json",success:function(J){if(!J.errormessage){$("#privateMessageContainer .main-pane").html("");openAlertDialog({title:vBulletin.phrase.get(H),message:J.message});if(H!="post_reply"){var K=$(".nav-pane .folder-list .folder-item.special-folder.messages a").attr("href");location.replace(K)}else{location.reload(true)}}else{openAlertDialog({title:vBulletin.phrase.get("error"),message:J.errormessage,iconType:"error"})}},error:function(L,K,J){console.log("/createcontent/privatemessage not successful. error:"+J);openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("pm_ajax_error_desc"),iconType:"error"})}});return false};startForward=function(B){if($(".privateMessageDetail .list-item").length==1){var A=getSelectedMessages();window.location=pageData.baseurl+"/privatemessage/forward/"+A[0]}else{$("#pmBtnReply").addClass("h-hide-imp");$("#pmBtnDelete").addClass("h-hide-imp");$("#pmMoveBlock").addClass("h-hide");$("#pmForwardPrompt").removeClass("h-hide");$("#pmBtnCancel").removeClass("h-hide-imp");$("#btnMove").closest(".split-button").addClass("h-hide");$(".pmViewCb").removeClass("h-hide");$("#pmBtnCancel").off("click").on("click",function(C){$("#pmBtnReply").removeClass("h-hide-imp");$("#pmBtnForward").off("click").bind("click",startForward);$("#pmBtnDelete").removeClass("h-hide-imp");$("#pmMoveBlock").removeClass("h-hide");$("#pmForwardPrompt").addClass("h-hide");$("#pmBtnCancel").addClass("h-hide-imp");$("#btnMove").closest(".split-button").removeClass("h-hide");$(".pmViewCb").addClass("h-hide");$(".conversation-content.private-message-detail").removeClass("show-subcontrols")});$(".conversation-content.private-message-detail").addClass("show-subcontrols");$("#pmBtnForward").off("click").bind("click",function(D){var C=getSelectedMessages(true);if(C.length>0){window.location=pageData.baseurl+"/privatemessage/forward/"+C.join(",")}})}};acceptRequest=function(B){var A=parseInt(B.target.id.substr(16));$.ajax({url:vBulletin.getAjaxBaseurl()+"/ajax/api/content_privatemessage/acceptRequest",type:"POST",data:{nodeid:A},success:function(C){if(C.errors){openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("pm_ajax_error_desc"),iconType:"warning"})}else{openAlertDialog({title:vBulletin.phrase.get("private_messages"),message:C,iconType:""});$("#msgSummary_"+A).remove()}}})};denyRequest=function(B){var A=parseInt(B.target.id.substr(14));$.ajax({url:vBulletin.getAjaxBaseurl()+"/ajax/api/content_privatemessage/denyRequest",type:"POST",data:{nodeid:A},dataType:"json",success:function(C){if(C.errors){openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("pm_ajax_error_desc"),iconType:"warning"})}else{if(C!==true){openAlertDialog({title:vBulletin.phrase.get("private_messages"),message:vBulletin.phrase.get(C),iconType:""})}$("#msgSummary_"+A).remove()}}})};sendPM=function(B){var A=parseInt(B.target.id.substr(12));if(A){url=$("#userlink_"+A).val();if(url){window.location=url}}};notificationFadeOut=function(A){A.animate({opacity:"0.0"},{duration:500,complete:function(){A.empty();A.animate({height:0,width:0,"padding-top":0,"padding-right":0,"padding-bottom":0,"padding-left":0,},{duration:100,complete:function(){A.remove()}})}})};notificationFadeIn=function(A,B,C){if(!A){return }$container=$("#notificationContent").find(".pm-notification-list");$temp=$(A).hide();$container.append($temp);$temp.fadeIn()};getNotificationsFilterParams=function(B){var A={};$("#notificationFilters").find("input[type=radio]:checked").each(function(C){if(this.value!=""){A[this.name]=this.value}});if(typeof (pmPageNum)!="undefined"){A.page=parseInt(pmPageNum)}if(typeof (pmPerPage)!="undefined"){A.perpage=parseInt(pmPerPage)}return A};var currentFilter="";var readFilter="";notificationsFilter=function(A){$(this).closest(".filter-options").find(":input[type=radio]").removeAttr("checked");if(this.name=="about"){currentFilter=this.value}$(this).attr("checked","checked");var B=getNotificationsFilterParams();B.page=1;$.ajax({url:vBulletin.getAjaxBaseurl()+"/ajax/render/privatemessage_notificationcontent",type:"POST",dataType:"json",data:{params:B},success:function(C){$("#notificationContent").html(C);pmPageNum=1;$("#notificationPageto").val(pmPageNum);$("#iconNotificationPrevious").addClass("h-disabled");var D={folderid:folderid,page:1,perpage:pmPerPage,about:"",filterParams:B};vBulletin.privateMessage.updatePaginationLinks($("#notificationContent").parent(),$("#notificationPageto").val());$.ajax({url:vBulletin.getAjaxBaseurl()+"/ajax/api/content_privatemessage/getFolderMsgCount",type:"POST",data:D,dataType:"json",success:function(F){console.log("/ajax/api/content_privatemessage/getFolderMsgCount successful. response: "+F);if(F){pmPageNum=F.pagenum;pmPages=F.pages;pmNotificationCount=F.count}if(F&&F.pages>0){var E=F.pages;$("#privatemessagePaging").removeClass("h-hide");$("#notificationPageCount").html(E);vBulletin.privateMessage.updatePaginationLinks($("#notificationContent").parent(),$("#notificationPageto").val(),E);if(E>1){$("#iconNotificationNext").removeClass("h-disabled")}else{$("#iconNotificationNext").addClass("h-disabled")}}else{vBulletin.privateMessage.updatePaginationLinks($("#notificationContent").parent(),$("#notificationPageto").val(),0);$("#privatemessagePaging").addClass("h-hide")}}})}})};decrementNotificationCount=function(){var A=$(".inbox .count").text();var B=$(".notifications .count").text();A=A-1;if(A<=0){$(".inbox .count").hide()}B=B-1;if(B<=0){$(".notifications .count").hide()}$(".inbox .count").text(A);$(".notifications .count").text(B);var C=$("span.notifications-count").text();C=C-1;if(C<=0){$("span.notifications-count").addClass("h-hide-imp")}$("span.notifications-count").text(C)};toggleOthersDialog=function(A){var B=$(A.currentTarget).closest("li.message-item");$othersBox=B.find(".js-others-wrapper");if($othersBox){var C=$othersBox.data("titlephrase")||"members_in_this_message";$(this).qtip({content:{title:{text:vBulletin.phrase.get(C),button:true,},text:$othersBox.html(),},position:{my:"top center",at:"bottom center",viewport:$(window)},show:{event:"click",solo:true},events:{show:function(E,D){},visible:function(E,D){$(".pmBtnFollowRequest").off("click").on("click",sendFollowRequest)},hide:function(E,D){}},hide:{event:"unfocus",fixed:true},style:{classes:"ui-tooltip-shadow ui-tooltip-light ui-tooltip-notification-others"}});$(this).qtip("api").show()}};dismissSingleNotification=function(B){var D=$(B.currentTarget).closest("li.message-item");var A=D.data("notificationid");if(A==null){return }var E={};$(".pm-notification-list").find("li.message-item.notification-unread").each(function(F){var G=$(this).data("notificationid");if(G!=null){E[G]=G}});var C={readIds:A,idsOnPage:E,filterParams:getNotificationsFilterParams()};if(C.filterParams.readFilter!="unread_only"){C.skipFetch=true}D.find(".js-waiting-for-ajax-response").removeClass("h-hide");$.ajax({url:vBulletin.getAjaxBaseurl()+"/ajax/api/notification/dismissNotification",type:"POST",data:C,dataType:"json",success:function(H){if(H&&!H.errors){var L=H.insertNotification||"",K=H.lastsenttime||-1,G=C.filterParams.sortDir;D.removeClass("notification-unread js-notification-dismiss-touch");D.find("button.js-notification-dismiss").remove();decrementNotificationCount();if(C.filterParams.readFilter=="unread_only"){notificationFadeOut(D);notificationFadeIn(L,K,G);pmNotificationCount--;if(pmNotificationCount>=0){if(C.filterParams.page>1){var F=(C.filterParams.page-1)*C.filterParams.perpage+1;if(pmNotificationCount<F){var I=C.filterParams.page-1;$("#notificationPageto").val(I);$("#notificationPageto").trigger("blur")}}if(pmPages>1){var J=(pmPages-1)*C.filterParams.perpage+1;if(pmNotificationCount<J){pmPages--;$("#notificationPageCount").text(pmPages);vBulletin.privateMessage.updatePaginationLinks($("#notificationContent").parent(),$("#notificationPageto").val(),pmPages)}}}}}else{if($.isArray(H.errors)&&H.errors.length>0){openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("error_x",H.errors[0][0]),iconType:"error"})}}},complete:function(){$("body").css("cursor","default");D.find(".js-waiting-for-ajax-response").addClass("h-hide")},error:function(){openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("error_dismissing_notification"),iconType:"error"})}})};dismissNotifications=function(C){if(C.currentTarget.id=="pmBtnNotificationDismissAll"){var A=parseInt($("div.folder-item.special-folder.notifications .count").text());if(isNaN(A)||A<=0){openAlertDialog({title:vBulletin.phrase.get("dismiss_notification_all"),message:vBulletin.phrase.get("nothing_to_dismiss"),iconType:"warning"});return }openConfirmDialog({title:vBulletin.phrase.get("dismiss_notification_all"),message:vBulletin.phrase.get("confirm_about_to_dismiss_x_notifications",A),iconType:"warning",onClickYes:function(E){$.ajax({url:vBulletin.getAjaxBaseurl()+"/ajax/api/notification/dismissAllNotifications",type:"POST",data:{},dataType:"json",success:function(F){if(F&&!F.errors){location.reload()}else{if($.isArray(F.errors)&&F.errors.length>0){openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("error_x",F.errors[0][0]),iconType:"error"})}}},error:function(){openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("error_dismissing_notification"),iconType:"error"})}})}})}else{if(C.currentTarget.id=="pmBtnNotificationDismissPage"){var D={};$(".pm-notification-list").find(".js-notification-dismiss").each(function(E){var F=$(this).data("notificationid");if(F!=null){D[F]=F}});if($.isEmptyObject(D)){openAlertDialog({title:vBulletin.phrase.get("dismiss_notification_page"),message:vBulletin.phrase.get("nothing_to_dismiss"),iconType:"warning"});return }var B={readIds:D,idsOnPage:D,filterParams:getNotificationsFilterParams(),skipFetch:true,};$.ajax({url:vBulletin.getAjaxBaseurl()+"/ajax/api/notification/dismissNotification",type:"POST",data:B,dataType:"json",success:function(E){if(E&&!E.errors){$(".pm-notification-list").find(".js-notification-dismiss").each(function(F){$(this).removeClass("notification-unread")});location.reload()}else{if($.isArray(E.errors)&&E.errors.length>0){openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("error_x",E.errors[0][0]),iconType:"error"})}}},error:function(){openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("error_dismissing_notification"),iconType:"error"})}})}}};openParticipants=function(C){var A=C.target.id.substring(15);A=parseInt(A);if(!isNaN(A)){var D=(typeof messageDetailPage!="undefined"&&messageDetailPage)?0:1,B="";if($(C.target).hasClass("rate")){D=1;B="rate"}$.ajax({url:vBulletin.getAjaxBaseurl()+"/ajax/render/privatemessage_participants",type:"POST",data:{nodeid:A,showFollowButtons:D,notificationType:B},dataType:"json",success:function(E){if(E&&!E.error){$("#pmInfoContent").html(E);$(".pmBtnFollowRequest").off("click").on("click",sendFollowRequest);$("#pmInfoDialog").dialog({title:vBulletin.phrase.get("members_in_this_message"),autoOpen:false,modal:true,resizable:false,closeOnEscape:true,showCloseButton:true,width:500,dialogClass:"dialog-container member-list-dialog-container dialog-box"}).dialog("open")}else{console.log("/ajax/render/privatemessage_participants not successful. response:"+E);openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("pm_ajax_error_desc"),iconType:"error"})}},error:function(G,F,E){console.log("ajax/render/privatemessage_participants not successful. error:"+E);openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("pm_ajax_error_desc"),iconType:"error"})}})}};sendFollowRequest=function(C){var B=$(this);var A=Number(B.data("userid"));if(!isNaN(A)){$.ajax({url:vBulletin.getAjaxBaseurl()+"/ajax/api/follow/add",type:"POST",data:{follow_item:A},success:function(D){if(D&&!D.error){if(D=="1"){B.removeClass("secondary").addClass("isSubscribed").prop("disabled",true).find(".button-text-primary").html(vBulletin.phrase.get("following"))}else{if(D=="2"){B.addClass("subscribe_pending").prop("disabled",true).find(".button-text-primary").html(vBulletin.phrase.get("following_pending"))}}}else{console.log("/ajax/api/follow/add not successful. response:"+D);openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("pm_ajax_error_desc"),iconType:"error"})}},error:function(F,E,D){console.log("/ajax/api/follow/add not successful. error:"+D);openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("pm_ajax_error_desc"),iconType:"error"})}})}};pendingFilter=function(A){$(this).closest(".filter-options").find(":input[type=radio]").removeAttr("checked");$(this).attr("checked","checked");var B={options:{}};$("#pendingFilters input:checked").each(function(){B.options[this.name]=this.value});$.ajax({url:vBulletin.getAjaxBaseurl()+"/ajax/render/privatemessage_pendingpost_main",type:"POST",dataType:"json",data:B,success:function(C){$("#privateMessageContainer .pending-posts-container").html(C);pmPageNum=1;$("#pendingpostsPageTo").val(pmPageNum);$(".privatemessagePaging .pendingpostsPrev").addClass("h-disabled");data={folderid:folderid,page:1,perpage:pmPerPage};if(currentFilter!=""){data.about=currentFilter}$.ajax({url:vBulletin.getAjaxBaseurl()+"/ajax/api/content_privatemessage/getFolderMsgCount",type:"POST",data:data,dataType:"json",success:function(E){console.log("/ajax/api/content_privatemessage/getFolderMsgCount successful. response: "+E);if(E){pmPageNum=E.pagenum;pmPages=E.pages;pmNotificationCount=E.count}if(E&&E.pages>0){var D=E.pages;$("#privatemessagePaging").removeClass("h-hide");$("#pendingpostsPageCount").html(D);if(D>1){$(".privatemessagePaging .pendingpostsNext").removeClass("h-disabled")}else{$(".privatemessagePaging .pendingpostsNext").addClass("h-disabled")}}else{$("#privatemessagePaging").addClass("h-hide")}}})}})};