/*=======================================================================*\
|| ###################################################################### ||
|| # 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,["cancel","delete_posts","delete_thread","error_moving_threads_x","inline_moved","inlinemod_auth","inlinemod_auth_login_failed","inlinemod_auth_login_first","inlinemod_auth_password_empty","loading","login","manage_content","manage_deleted","merge_posts","merge_threads_ginlinemod","move_posts","move_threads_ginlinemod","not_much_would_be_accomplished_by_merging","options","please_select_at_least_one_post","please_select_at_least_two_posts","this_post_has_been_successfully_approved","this_post_has_been_successfully_unapproved","this_topic_has_been_stuck","this_topic_has_been_successfully_approved","this_topic_has_been_successfully_opened","this_topic_has_been_successfully_unapproved","this_topic_has_been_successfully_unstuck","this_topic_is_closed","this_topic_is_deleted","this_topic_is_undeleted","unapproved","you_did_not_select_any_valid_threads"]);(function(D){vBulletin.inlinemod=vBulletin.inlinemod||{};vBulletin.inlinemod.openAuthDialog=function(F){window.vBulletin.openAuthDialog(function(){var G=D(F).attr("data-action");if(!G){return false}var I=vBulletin.inlinemod[G];if(typeof I=="function"){var H=D(F).attr("data-params");H=H?H.split(","):[];I.apply(F,H)}else{alert("Not yet implemented.")}})};vBulletin.inlinemod.delete_form_thread=function(){var G=this;var F=(D(G).attr("data-node-id"))?[D(G).attr("data-node-id")]:B();if(F.length==0){openAlertDialog({title:vBulletin.phrase.get("delete_thread"),message:vBulletin.phrase.get("please_select_at_least_one_post"),iconType:"warning"});return }var H=openConfirmDialog({title:vBulletin.phrase.get("delete_thread"),message:vBulletin.phrase.get("loading")+"...",width:500,dialogClass:"inlinemod-delete-dialog loading",buttonLabel:{yesLabel:vBulletin.phrase.get("delete_thread"),noLabel:vBulletin.phrase.get("cancel")},onClickYes:function(){var K=H.find(".delete-posts-form");var L=K.find("input:radio[name=deletetype]:checked").val()||1;var I={hard:(L==2?1:0),reason:K.find(":input[name=deletereason]").val(),nodeids:F,deleteother:K.find(":input[name=deleteother]").is(":checked")?1:0,report:K.find(":input[name=report]").is(":checked")?1:0,banusers:(K.find("input:radio[name=useraction]:checked").val()=="ban")?1:0};var J;if(I.deleteother||I.banusers||I.report){var M=function(){var N=openConfirmDialog({title:vBulletin.phrase.get("spam_management"),message:vBulletin.phrase.get("loading")+"...",width:500,dialogClass:"inlinemod-spam-dialog loading",buttonLabel:{yesLabel:vBulletin.phrase.get("proceed_ellipsis"),noLabel:vBulletin.phrase.get("cancel")},onClickYes:function(){var O=N.find(".spam-form");I.userids=new Array();O.find(":input[name=userids[]]:checked").each(function(){I.userids.push(D(this).val())});I.banusergroupid=O.find(":input[name=usergroupid]").val();I.period=O.find(":input[name=period]").val();I.banreason=O.find(":input[name=banreason]").val();I.report=K.find(":input[name=report]").is(":checked")?1:0;D.ajax({url:vBulletin.normalizeAjaxUrl(O.attr("action")),data:I,type:"POST",dataType:"json",success:function(P){if(P.errors){if(P.errors[0]=="inlinemodauth_required"){return vBulletin.inlinemod.openAuthDialog(G)}openAlertDialog({title:vBulletin.phrase.get("spam_management"),message:P.errors.join("\n"),iconType:"error"})}else{D.cookie(C,null,{path:pageData.cookie_path,domain:pageData.cookie_domain});if(A=="thread"&&L==2){location.replace(D("#breadcrumbs .crumb a:last").attr("href"))}else{var Q=D(".filter-wrapper",D(G).parents(".conversation-toolbar")).data("object-instance");if(Q&&typeof Q.applyFilters=="function"){Q.forceApplyFilters()}else{location.reload()}}}},error:function(R,Q,P){console.log("/ajax/api/search/deleteNodesAsSpam failed, error: "+P);openAlertDialog({title:vBulletin.phrase.get("spam_management"),message:vBulletin.phrase.get("error_deleting_posts_x",R.status),iconType:"error"})}})}});D.ajax({url:vBulletin.getAjaxBaseurl()+"/ajax/render/inlinemod_delete_spam",data:({nodeIds:F,banusers:I.banusers}),type:"POST",dataType:"json",success:function(O){console.log("/ajax/render/inlinemod_delete_spam");if(O&&!O.errors){D(".inlinemod-spam-dialog").removeClass("loading");D(".dialog-content .message",N).html(O).find("[placeholder]").placeholder();N.dialog("option","position","center")}else{console.log("/ajax/render/inlinemod_delete_spam successful, but response was not valid");openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("invalid_server_response_please_try_again"),iconType:"error",onAfterClose:function(){H.dialog("close")}})}},error:function(Q,P,O){console.log("/ajax/render/inlinemod_delete_spam failed, error: "+O);openAlertDialog({title:vBulletin.phrase.get("spam_management"),message:vBulletin.phrase.get("error_loading_spam_form_x",Q.status),iconType:"error",onAfterClose:function(){H.dialog("close")}})}})};setTimeout(M,500)}else{D.ajax({url:vBulletin.normalizeAjaxUrl(K.attr("action")),data:I,type:"POST",dataType:"json",success:function(N){if(N.errors){if(N.errors[0]=="inlinemodauth_required"){return vBulletin.inlinemod.openAuthDialog(G)}openAlertDialog({title:vBulletin.phrase.get("delete_thread"),message:N.errors.join("\n"),iconType:"error"})}else{D.cookie(C,null,{path:pageData.cookie_path,domain:pageData.cookie_domain});if(A=="thread"&&L==2){if(D.inArray(D(G).attr("data-node-id"),N)!=-1||D.inArray(pageData.nodeid,N)!=-1){location.replace(D("#breadcrumbs .crumb a:last").attr("href"))}else{D("input.cb_inlinemod[type=checkbox]:checked",E).each(function(){if(D.inArray(D(this).val(),N)!=-1){D(this).parents(".inlinemod-item").remove()}})}}else{var O=D(".filter-wrapper",D(G).parents(".conversation-toolbar")).data("object-instance");if(O&&typeof O.applyFilters=="function"){O.forceApplyFilters()}else{location.reload()}}}},error:function(P,O,N){console.log("/ajax/api/search/moderationDelete failed, error: "+N);openAlertDialog({title:vBulletin.phrase.get("delete_thread"),message:vBulletin.phrase.get("error_deleting_posts_x",P.status),iconType:"error"})}})}}});D.ajax({url:vBulletin.getAjaxBaseurl()+"/ajax/render/inlinemod_delete_form",data:({postcount:F.length,nodeids:F,deleteposts:1,removeposts:1,firstpost:1}),type:"POST",dataType:"json",success:function(I){console.log("/ajax/render/inlinemod_delete_form");if(I&&!I.errors){D(".inlinemod-delete-dialog").removeClass("loading");D(".dialog-content .message",H).html(I).find("[placeholder]").placeholder();H.dialog("option","position","center");D("select",H).selectBox()}else{console.log("/ajax/render/inlinemod_delete_form successful, but response was not valid");openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("invalid_server_response_please_try_again"),iconType:"error",onAfterClose:function(){H.dialog("close")}})}},error:function(K,J,I){console.log("/ajax/render/inlinemod_delete_form failed, error: "+I);openAlertDialog({title:vBulletin.phrase.get("delete_thread"),message:vBulletin.phrase.get("error_loading_delete_form_x",K.status),iconType:"error",onAfterClose:function(){H.dialog("close")}})}})};vBulletin.inlinemod.delete_dialog=function(G,F){var H=openConfirmDialog({title:vBulletin.phrase.get("delete_posts"),message:vBulletin.phrase.get("loading")+"...",width:500,dialogClass:"inlinemod-delete-dialog loading",buttonLabel:{yesLabel:vBulletin.phrase.get("delete_posts"),noLabel:vBulletin.phrase.get("cancel")},onClickYes:function(){var K=H.find(".delete-posts-form");var L=K.find("input:radio[name=deletetype]:checked").val()||1;var I={hard:(L==2?1:0),reason:K.find(":input[name=deletereason]").val(),nodeids:G,deleteother:K.find(":input[name=deleteother]").is(":checked")?1:0,report:K.find(":input[name=report]").is(":checked")?1:0,banusers:(K.find("input:radio[name=useraction]:checked").val()=="ban")?1:0};var J;if(I.deleteother||I.banusers||I.report){var M=function(){var N=openConfirmDialog({title:vBulletin.phrase.get("spam_management"),message:vBulletin.phrase.get("loading")+"...",width:500,dialogClass:"inlinemod-spam-dialog loading",buttonLabel:{yesLabel:vBulletin.phrase.get("proceed_ellipsis"),noLabel:vBulletin.phrase.get("cancel")},onClickYes:function(){var O=N.find(".spam-form");I.userids=new Array();O.find(":input[name=userids[]]:checked").each(function(){I.userids.push(D(this).val())});I.banusergroupid=O.find(":input[name=usergroupid]").val();I.period=O.find(":input[name=period]").val();I.banreason=O.find(":input[name=banreason]").val();I.report=K.find(":input[name=report]").is(":checked")?1:0;vBulletin.AJAX({url:vBulletin.normalizeAjaxUrl(O.attr("action")),data:I,error_phrase:"spam_management",success:function(P){if(typeof F=="function"){F(P,I)}vBulletin.inlinemod.clear()},error:function(R,Q,P){console.log("/ajax/api/search/deleteNodesAsSpam failed, error: "+P);openAlertDialog({title:vBulletin.phrase.get("spam_management"),message:vBulletin.phrase.get("error_deleting_posts_x",R.status),iconType:"error"})}})}});D.ajax({url:vBulletin.getAjaxBaseurl()+"/ajax/render/inlinemod_delete_spam",data:({nodeIds:G,banusers:I.banusers}),type:"POST",dataType:"json",success:function(O){console.log("/ajax/render/inlinemod_delete_spam");vBulletin.inlinemod.clear();if(O&&!O.errors){D(".inlinemod-spam-dialog").removeClass("loading");D(".dialog-content .message",N).html(O).find("[placeholder]").placeholder();N.dialog("option","position","center");D("select",N).selectBox()}else{console.log("/ajax/render/inlinemod_delete_spam successful, but response was not valid");openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("invalid_server_response_please_try_again"),iconType:"error",onAfterClose:function(){H.dialog("close")}})}},error:function(Q,P,O){console.log("/ajax/render/inlinemod_delete_spam failed, error: "+O);openAlertDialog({title:vBulletin.phrase.get("spam_management"),message:vBulletin.phrase.get("error_loading_spam_form_x",Q.status),iconType:"error",onAfterClose:function(){H.dialog("close")}})}})};setTimeout(M,500)}else{vBulletin.AJAX({url:vBulletin.normalizeAjaxUrl(K.attr("action")),data:I,error_phrase:"delete_posts",success:function(N){if(typeof F=="function"){F(N,I)}vBulletin.inlinemod.clear()},error:function(P,O,N){console.log("/ajax/api/search/moderationDelete failed, error: "+N);openAlertDialog({title:vBulletin.phrase.get("delete_posts"),message:vBulletin.phrase.get("error_deleting_posts_x",P.status),iconType:"error"})}})}}});vBulletin.AJAX({url:vBulletin.getAjaxBaseurl()+"/ajax/render/inlinemod_delete_form",data:({postcount:G.length,nodeids:G,deleteposts:1,removeposts:1,firstpost:1}),success:function(I){D(".inlinemod-delete-dialog").removeClass("loading");D(".dialog-content .message",H).html(I).find("[placeholder]").placeholder();H.dialog("option","position","center");D("select",H).selectBox()}})};vBulletin.inlinemod.delete_form=function(){var G=D(this);var F=(G.attr("data-node-id"))?[G.attr("data-node-id")]:B();if(F.length==0){openAlertDialog({title:vBulletin.phrase.get("delete_posts"),message:vBulletin.phrase.get("please_select_at_least_one_post"),iconType:"warning"});return }vBulletin.inlinemod.delete_dialog(F,function(I,J){if(J.nodeids&&D.isArray(J.nodeids)){var H=false;D.each(J.nodeids,function(L,M){if(D.inArray(M,I)==-1){H=true}});if(H){openAlertDialog({title:vBulletin.phrase.get("delete_posts"),message:vBulletin.phrase.get("error_deleting_one_or_more_posts"),iconType:"warning"})}}D.cookie(C,null,{path:pageData.cookie_path,domain:pageData.cookie_domain});if(A&&A=="thread"&&J.hard==1){if(G&&(D.inArray(G.attr("data-node-id"),I)!=-1||D.inArray(pageData.nodeid,I)!=-1)){location.replace(D("#breadcrumbs .crumb a:last").attr("href"))}else{D("input.cb_inlinemod[type=checkbox]:checked",E).each(function(){if(D.inArray(D(this).val(),I)!=-1){D(this).closest(".inlinemod-item").remove()}})}}else{var K=D(".filter-wrapper",G.parents(".conversation-toolbar")).data("object-instance");if(K&&typeof K.applyFilters=="function"){K.forceApplyFilters()}else{location.reload()}}})};vBulletin.inlinemod.moveThreads=function(){var H=this;var G=(D(H).attr("data-node-id"))?[D(H).attr("data-node-id")]:B();if(G.length==0){openAlertDialog({title:vBulletin.phrase.get("move_threads_ginlinemod"),message:vBulletin.phrase.get("please_select_at_least_one_post"),iconType:"warning"});return }var F=openConfirmDialog({title:vBulletin.phrase.get("move_threads_ginlinemod"),message:vBulletin.phrase.get("loading")+"...",width:500,dialogClass:"inlinemod-move-dialog loading",buttonLabel:{yesLabel:vBulletin.phrase.get("move_threads_ginlinemod"),noLabel:vBulletin.phrase.get("cancel")},onClickYes:function(){var J=F.find(".move-posts-form");var K={};if(J.find("input[name=enableredirect]").prop("checked")){K.redirect=J.find("#rb_redirect_perm").prop("checked")?"perm":"expires";if(K.redirect=="expires"){K.period=J.find("select[name=period]").val();K.frame=J.find("select[name=frame]").val()}console.log("Redirect data compiled:");console.dir(K)}var I={to_parent:J.find("select[name=destchannelid]").val(),nodeids:G,leaveRedirectData:K};D.ajax({url:vBulletin.normalizeAjaxUrl(J.attr("action")),data:I,type:J.attr("method"),dataType:"json",success:function(L){if(L.errors){if(L.errors[0]=="inlinemodauth_required"){return vBulletin.inlinemod.openAuthDialog(H)}openAlertDialog({title:vBulletin.phrase.get("move_threads_ginlinemod"),message:vBulletin.phrase.get(L.errors[0]),iconType:"error"})}else{D.cookie(C,null,{path:pageData.cookie_path,domain:pageData.cookie_domain});openAlertDialog({title:vBulletin.phrase.get("move_threads_ginlinemod"),message:vBulletin.phrase.get("inline_moved"),onAfterClose:function(){location.reload()}})}},error:function(N,M,L){console.log("Move threads failed, error: "+L);openAlertDialog({title:vBulletin.phrase.get("move_threads_ginlinemod"),message:vBulletin.phrase.get("error_moving_threads_x",N.status),iconType:"error"})}})}});D.ajax({url:vBulletin.getAjaxBaseurl()+"/ajax/render/inlinemod_move_form",data:({postcount:G.length,moveposts:1,removeposts:1,firstpost:1}),type:"POST",dataType:"json",success:function(I){console.log("/ajax/render/inlinemod_move_form");if(I&&!I.errors){D(".inlinemod-move-dialog").removeClass("loading");D(".dialog-content .message",F).html(I).find("[placeholder]").placeholder();F.dialog("option","position","center");D("select",F).selectBox()}else{console.log("/ajax/render/inlinemod_move_form successful, but response was not valid");openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("invalid_server_response_please_try_again"),iconType:"error",onAfterClose:function(){F.dialog("close")}})}},error:function(K,J,I){console.log("/ajax/render/inlinemod_move_form failed, error: "+I);openAlertDialog({title:vBulletin.phrase.get("move_threads_ginlinemod"),message:vBulletin.phrase.get("error_loading_move_form_x",K.status),iconType:"error",onAfterClose:function(){F.dialog("close")}})}})};vBulletin.inlinemod.movePosts=function(){var H=this;var G=(D(H).attr("data-node-id"))?[D(H).attr("data-node-id")]:B();if(G.length==0){openAlertDialog({title:vBulletin.phrase.get("move_posts"),message:vBulletin.phrase.get("please_select_at_least_one_post"),iconType:"warning"});return }var F=openConfirmDialog({title:vBulletin.phrase.get("move_posts"),message:vBulletin.phrase.get("loading")+"...",width:500,dialogClass:"inlinemod-moveposts-dialog loading",buttonLabel:{yesLabel:vBulletin.phrase.get("move_posts"),noLabel:vBulletin.phrase.get("cancel")},onClickYes:function(){var J=F.find(".move-posts-form");var K=J.find("input:radio[name=type]:checked").val()||0;var I={newtitle:J.find(':input[name="title"]').val(),to_parent:(K==0)?J.find(':input[name="destchannelid"]').val():J.find(':input[name="mergethreadurl"]').val().replace(pageData.baseurl+"/",""),nodeids:G};D.ajax({url:vBulletin.normalizeAjaxUrl(J.attr("action")),data:I,type:J.attr("method"),dataType:"json",success:function(L){if(L.errors){if(L.errors[0]=="inlinemodauth_required"){return vBulletin.inlinemod.openAuthDialog(H)}openAlertDialog({title:vBulletin.phrase.get("move_posts"),message:L.errors.join("\n"),iconType:"error"})}else{D.cookie(C,null,{path:pageData.cookie_path,domain:pageData.cookie_domain});if(A=="thread"){if(D.inArray(D(H).attr("data-node-id"),L)!=-1||D.inArray(pageData.nodeid,L)!=-1){location.replace(D("#breadcrumbs .crumb a:last").attr("href"))}else{D("input.cb_inlinemod[type=checkbox]:checked",E).each(function(){if(D.inArray(D(this).val(),L)!=-1){D(this).parents(".inlinemod-item").remove()}})}}else{var M=D(".filter-wrapper",D(H).parents(".conversation-toolbar")).data("object-instance");if(M&&typeof M.applyFilters=="function"){M.forceApplyFilters()}}D.ajax({url:vBulletin.getAjaxBaseurl()+"/ajax/api/route/getNodeUrl",data:{nodeid:L[0]},type:"POST",dataType:"json",complete:function(){},success:function(N){if(N&&!N.errors){location.href=pageData.baseurl+N}},error:function(P,O,N){console.log("Unable to get URL for node "+L[0]+":"+N)}})}},error:function(N,M,L){console.log("/ajax/api/node/movePosts failed, error: "+L);openAlertDialog({title:vBulletin.phrase.get("move_posts"),message:vBulletin.phrase.get("error_moving_posts_x",N.status),iconType:"error"})}})}});D.ajax({url:vBulletin.getAjaxBaseurl()+"/ajax/render/inlinemod_movePosts",data:({postcount:G.length,deleteposts:1,removeposts:1,firstpost:1}),type:"POST",dataType:"json",success:function(I){console.log("/ajax/render/inlinemod_movePosts");if(I&&!I.errors){D(".inlinemod-moveposts-dialog").removeClass("loading");D(".dialog-content .message",F).html(I).find("[placeholder]").placeholder();F.dialog("option","position","center");D("select",F).selectBox()}else{console.log("/ajax/render/inlinemod_movePosts successful, but response was not valid");openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("invalid_server_response_please_try_again"),iconType:"error",onAfterClose:function(){F.dialog("close")}})}},error:function(K,J,I){console.log("/ajax/render/inlinemod_movePosts failed, error: "+I);openAlertDialog({title:vBulletin.phrase.get("move_posts"),message:vBulletin.phrase.get("error_loading_move_form_x",K.status),iconType:"error",onAfterClose:function(){F.dialog("close")}})}})};vBulletin.inlinemod.stickThreads=function(H){var G=this;if(!H){H="stick"}var F=(D(G).attr("data-node-id"))?[D(G).attr("data-node-id")]:B();if(F.length==0){openAlertDialog({title:vBulletin.phrase.get(H+"_threads"),message:vBulletin.phrase.get("please_select_at_least_one_post"),iconType:"warning"});return }D.ajax({url:vBulletin.getAjaxBaseurl()+"/ajax/api/node/setSticky",data:{nodeids:F,stick:(H=="stick"?1:0)},type:"POST",dataType:"json",success:function(I){if(I.errors){if(I.errors[0]=="inlinemodauth_required"){return vBulletin.inlinemod.openAuthDialog(G)}openAlertDialog({title:vBulletin.phrase.get("error"),message:I.errors.join("<br />"),iconType:"error"})}else{vBulletin.inlinemod.clear.apply(G);if(A=="thread"){var J;if(H=="stick"){D(".canvas-widget").addClass("sticky");J=vBulletin.phrase.get("this_topic_has_been_stuck")}else{D(".canvas-widget").removeClass("sticky");J=vBulletin.phrase.get("this_topic_has_been_successfully_unstuck")}showStatusMessage(J,"stick")}else{var K=D(".filter-wrapper",D(G).parents(".conversation-toolbar")).data("object-instance");if(K&&typeof K.applyFilters=="function"){if(A=="topic"){K.updatePageNumber(1)}K.forceApplyFilters()}}}},error:function(K,J,I){console.log("/ajax/api/node/setSticky failed, error: "+I);openAlertDialog({title:vBulletin.phrase.get(H+"_threads"),message:vBulletin.phrase.get("error_sticking_topics_x",K.status),iconType:"error"})}});return false};vBulletin.inlinemod.unstickThreads=function(){return vBulletin.inlinemod.stickThreads.apply(this,["unstick"])};vBulletin.inlinemod.openCloseThreads=function(H){var G=this;if(!H){H="open"}var F=(D(G).attr("data-node-id"))?[D(G).attr("data-node-id")]:B();if(F.length==0){openAlertDialog({title:vBulletin.phrase.get(H+"_threads"),message:vBulletin.phrase.get("please_select_at_least_one_post"),iconType:"warning"});return false}D.ajax({url:vBulletin.getAjaxBaseurl()+"/ajax/api/node/"+H+"Node",data:{nodeid:F},type:"POST",dataType:"json",success:function(I){if(I.errors){if(I.errors[0]=="inlinemodauth_required"){return vBulletin.inlinemod.openAuthDialog(G)}openAlertDialog({title:vBulletin.phrase.get(H+"_threads"),message:I.errors.join("<br />"),iconType:"error"})}else{vBulletin.inlinemod.clear.apply(G);if(A=="thread"){var J,K=D(".canvas-widget");if(H=="open"){K.removeClass("showclosed");if(D(".canvas-widget #canmoderate").val()=="0"){K.removeClass("closed_content-entry-box")}J=vBulletin.phrase.get("this_topic_has_been_successfully_opened")}else{K.addClass("showclosed");if(D(".canvas-widget #canmoderate").val()=="0"){K.addClass("closed_content-entry-box")}J=vBulletin.phrase.get("this_topic_is_closed")}showStatusMessage(J,"close")}else{var L=D(".filter-wrapper",D(G).parents(".conversation-toolbar")).data("object-instance");if(L&&typeof L.applyFilters=="function"){L.forceApplyFilters()}}}},error:function(K,J,I){console.log("/ajax/api/node/"+H+" failed, error: "+I);openAlertDialog({title:vBulletin.phrase.get(H+"_threads"),message:vBulletin.phrase.get("error_open_close_topic_x",K.status),iconType:"error"})}});return false};vBulletin.inlinemod.approvePosts=function(H){var G=this;if(!H){H="approve"}var F=(D(G).attr("data-node-id"))?[D(G).attr("data-node-id")]:B();if(F.length==0){openAlertDialog({title:vBulletin.phrase.get(H+"_threads"),message:vBulletin.phrase.get("please_select_at_least_one_post"),iconType:"warning"});return }D.ajax({url:vBulletin.getAjaxBaseurl()+"/ajax/api/node/setApproved",data:{nodeids:F,approved:(H=="approve"?1:0)},type:"POST",dataType:"json",success:function(I){if(I.errors){if(I.errors[0]=="inlinemodauth_required"){return vBulletin.inlinemod.openAuthDialog(G)}openAlertDialog({title:vBulletin.phrase.get("error"),message:I.errors.join("<br />"),iconType:"error"})}else{vBulletin.inlinemod.clear.apply(G);if(A=="thread"){var J;if(H=="approve"){if(D.inArray(D(G).attr("data-node-id"),I)!=-1){D(".canvas-widget").removeClass("unapproved")}D(".inlinemod-item .cb_inlinemod",E).each(function(){if(D.inArray(this.value,I)!=-1){D(this).closest(".js-post").removeClass("unapproved b-post--unapproved");D(this).prev(".js-unapprove-label").remove()}});J=vBulletin.phrase.get("this_post_has_been_successfully_approved")}else{if(D.inArray(D(G).attr("data-node-id"),I)!=-1){D(".canvas-widget").addClass("unapproved")}D(".inlinemod-item .cb_inlinemod",E).each(function(){if(D.inArray(this.value,I)!=-1){D(this).closest(".js-post").addClass("unapproved b-post--unapproved");D('<span class="js-unapprove-label b-post__inlinemod-text">{0}</span>'.format(vBulletin.phrase.get("unapproved"))).insertBefore(this)}});J=vBulletin.phrase.get("this_post_has_been_successfully_unapproved")}showStatusMessage(J,"approve")}else{var K=D(".filter-wrapper",D(G).parents(".conversation-toolbar")).data("object-instance");if(K&&typeof K.applyFilters=="function"){K.forceApplyFilters()}}}},error:function(K,J,I){console.log("/ajax/api/node/setApproved failed, error: "+I);openAlertDialog({title:vBulletin.phrase.get(H+"_threads"),message:vBulletin.phrase.get("error_un_approve_topics_x",K.status),iconType:"error"})}});return false};vBulletin.inlinemod.approveThreads=function(H){var G=this;if(!H){H="approve"}var F=(D(G).attr("data-node-id"))?[D(G).attr("data-node-id")]:B();if(F.length==0){openAlertDialog({title:vBulletin.phrase.get(H+"_threads"),message:vBulletin.phrase.get("please_select_at_least_one_post"),iconType:"warning"});return }D.ajax({url:vBulletin.getAjaxBaseurl()+"/ajax/api/node/setApproved",data:{nodeids:F,approved:(H=="approve"?1:0)},type:"POST",dataType:"json",success:function(I){if(I.errors){if(I.errors[0]=="inlinemodauth_required"){return vBulletin.inlinemod.openAuthDialog(G)}openAlertDialog({title:vBulletin.phrase.get("error"),message:I.errors.join("<br />"),iconType:"error"})}else{vBulletin.inlinemod.clear.apply(G);if(A=="thread"){var J;if(H=="approve"){if(D.inArray(D(G).attr("data-node-id"),I)!=-1){D(".canvas-widget").removeClass("unapproved")}D(".inlinemod-item .cb_inlinemod",E).each(function(){if(D.inArray(this.value,I)!=-1){D(this).closest(".list-item").removeClass("unapproved");D(this).prev(".js-unapprove-label").remove()}});J=vBulletin.phrase.get("this_topic_has_been_successfully_approved")}else{if(D.inArray(D(G).attr("data-node-id"),I)!=-1){D(".canvas-widget").addClass("unapproved")}D(".inlinemod-item .cb_inlinemod",E).each(function(){if(D.inArray(this.value,I)!=-1){D(this).closest(".list-item").addClass("unapproved");D('<span class="js-unapprove-label b-post__inlinemod-text">{0}</span>'.format(vBulletin.phrase.get("unapproved"))).insertBefore(this)}});J=vBulletin.phrase.get("this_topic_has_been_successfully_unapproved")}showStatusMessage(J,"approve")}else{var K=D(".filter-wrapper",D(G).parents(".conversation-toolbar")).data("object-instance");if(K&&typeof K.applyFilters=="function"){K.forceApplyFilters()}}}},error:function(K,J,I){console.log("/ajax/api/node/setApproved failed, error: "+I);openAlertDialog({title:vBulletin.phrase.get(H+"_threads"),message:vBulletin.phrase.get("error_un_approve_topics_x",K.status),iconType:"error"})}});return false};vBulletin.inlinemod.unfeatureThreads=function(F){vBulletin.inlinemod.featureThreads.apply(this,["unfeature"])};vBulletin.inlinemod.featureThreads=function(H){var G=this;if(!H){H="feature"}var F=(D(G).attr("data-node-id"))?[D(G).attr("data-node-id")]:B();if(F.length==0){openAlertDialog({title:vBulletin.phrase.get(H+"_threads"),message:vBulletin.phrase.get("please_select_at_least_one_post"),iconType:"warning"});return }D.ajax({url:vBulletin.getAjaxBaseurl()+"/ajax/api/node/setFeatured",data:{nodeids:F,set:(H=="feature"?1:0)},type:"POST",dataType:"json",success:function(I){if(I.errors){if(I.errors[0]=="inlinemodauth_required"){return vBulletin.inlinemod.openAuthDialog(G)}openAlertDialog({title:vBulletin.phrase.get("error"),message:I.errors.join("<br />"),iconType:"error"})}else{vBulletin.inlinemod.clear.apply(G);if(A=="thread"){var J;if(H=="feature"){if(D.inArray(D(G).attr("data-node-id"),I)!=-1){D(".canvas-widget").addClass("featured")}D(".inlinemod-item .cb_inlinemod",E).each(function(){if(D.inArray(this.value,I)!=-1){D(this).closest(".list-item").removeClass("unfeatured")}});J=vBulletin.phrase.get("this_topic_has_been_featured")}else{if(D.inArray(D(G).attr("data-node-id"),I)!=-1){D(".canvas-widget").removeClass("featured")}D(".inlinemod-item .cb_inlinemod",E).each(function(){if(D.inArray(this.value,I)!=-1){D(this).closest(".list-item").addClass("unfeatured")}});J=vBulletin.phrase.get("this_topic_has_been_unfeatured")}showStatusMessage(J,"feature")}else{var K=D(".filter-wrapper",D(G).parents(".conversation-toolbar")).data("object-instance");if(K&&typeof K.applyFilters=="function"){K.forceApplyFilters()}}}},error:function(K,J,I){console.log("/ajax/api/node/setFeatured failed, error: "+I);openAlertDialog({title:vBulletin.phrase.get(H+"_threads"),message:vBulletin.phrase.get("error_featuring_topics_x",K.status),iconType:"error"})}});return false};vBulletin.inlinemod.undelete=function(){var G=this;var F=(D(G).attr("data-node-id"))?[D(G).attr("data-node-id")]:B();if(F.length==0){openAlertDialog({title:vBulletin.phrase.get("undelete_threads"),message:vBulletin.phrase.get("please_select_at_least_one_post"),iconType:"warning"});return }D.ajax({url:vBulletin.getAjaxBaseurl()+"/ajax/api/node/undeleteNodes",data:{nodeids:F},type:"POST",dataType:"json",success:function(H){if(H.errors){if(H.errors[0]=="inlinemodauth_required"){return vBulletin.inlinemod.openAuthDialog(G)}openAlertDialog({title:vBulletin.phrase.get("error"),message:H.errors.join("<br />"),iconType:"error"})}else{vBulletin.inlinemod.clear.apply(G);if(A=="thread"){var I;if(D.inArray(D(G).attr("data-node-id"),H)!=-1){D(".canvas-widget").removeClass("deleted")}D(".inlinemod-item .cb_inlinemod",E).each(function(){if(D.inArray(this.value,H)!=-1){D(this).closest(".js-post").removeClass("deleted b-post--deleted")}});I=vBulletin.phrase.get("this_topic_is_undeleted");showStatusMessage(I,"delete")}else{var J=D(".filter-wrapper",D(G).parents(".conversation-toolbar")).data("object-instance");if(J&&typeof J.applyFilters=="function"){J.forceApplyFilters()}}}},error:function(J,I,H){console.log("/ajax/api/node/undeleteNodes failed, error: "+H);openAlertDialog({title:vBulletin.phrase.get("undelete_threads"),message:vBulletin.phrase.get("error_undeleting_topics_x",J.status),iconType:"error"})}});return false};vBulletin.inlinemod.unapprovePosts=function(){return vBulletin.inlinemod.approvePosts.apply(this,["unapprove"])};vBulletin.inlinemod.unapproveThreads=function(){return vBulletin.inlinemod.approveThreads.apply(this,["unapprove"])};vBulletin.inlinemod.viewSelectedPosts=function(){window.location=pageData.baseurl+"/search?cookie="+C};vBulletin.inlinemod.mergePosts=function(){var G=this;var F=(D(G).attr("data-node-id"))?[D(G).attr("data-node-id")]:B();if(F.length<2){openAlertDialog({title:vBulletin.phrase.get("merge_posts"),message:vBulletin.phrase.get("please_select_at_least_two_posts"),iconType:"warning"});return }var H=openConfirmDialog({title:vBulletin.phrase.get("merge_posts"),message:vBulletin.phrase.get("loading")+"...",width:600,dialogClass:"inlinemod-mergeposts-dialog loading",buttonLabel:{yesLabel:vBulletin.phrase.get("merge_posts"),noLabel:vBulletin.phrase.get("cancel")},onClickYes:function(){var J=H.find("#hiddenVar_mergePosts").closest("form");J.find("[name=securitytoken]").remove();var I=J.serializeArray();I.push({name:"destnodeid",value:H.find(':input[name="destnodeid"]').val()});I.push({name:"destauthorid",value:H.find(':input[name="destauthorid"]').val()});I.push({name:"contenttype",value:J.attr("data-content-type")});D.ajax({url:vBulletin.getAjaxBaseurl()+"/ajax/api/node/mergePosts",data:({input:I}),type:"POST",dataType:"json",success:function(K){if(K.errors){if(K.errors[0]=="inlinemodauth_required"){return vBulletin.inlinemod.openAuthDialog(G)}openAlertDialog({title:vBulletin.phrase.get("merge_posts"),message:K.errors.join("\n"),iconType:"error"})}else{D.cookie(C,null,{path:pageData.cookie_path,domain:pageData.cookie_domain});var L=D(".filter-wrapper",D(G).parents(".conversation-toolbar")).data("object-instance");if(L&&typeof L.applyFilters=="function"){L.forceApplyFilters()}else{location.reload()}}},error:function(M,L,K){console.log("/ajax/api/node/mergePosts failed, error: "+K);openAlertDialog({title:vBulletin.phrase.get("merge_posts"),message:vBulletin.phrase.get("error_merging_posts_x",M.status),iconType:"error"})}})}});D.ajax({url:vBulletin.getAjaxBaseurl()+"/ajax/render/inlinemod_mergePosts",data:({posts:F.join(","),postcount:F.length}),type:"POST",dataType:"json",success:function(I){console.log("/ajax/render/inlinemod_mergePosts");if(I&&!I.errors){D(".inlinemod-mergeposts-dialog").removeClass("loading");D(".dialog-content .message",H).html(I).find("[placeholder]").placeholder();H.dialog("option","position","center");D("select",H).selectBox();vBulletin.contentEntryBox.init();var J=D(".js-content-entry form",H).data("content-type");D("body").trigger(J+"_editform_onload",[H,function(){}])}else{console.log("/ajax/render/inlinemod_mergePosts successful, but response was not valid");openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("invalid_server_response_please_try_again"),iconType:"error",onAfterClose:function(){H.dialog("close")}})}},error:function(K,J,I){console.log("/ajax/render/inlinemod_mergePosts failed, error: "+I);openAlertDialog({title:vBulletin.phrase.get("merge_posts"),message:vBulletin.phrase.get("error_loading_merge_form_x",K.status),iconType:"error",onAfterClose:function(){H.dialog("close")}})}})};vBulletin.inlinemod.copyPosts=function(){var G=this;var F=(D(G).attr("data-node-id"))?[D(G).attr("data-node-id")]:B();if(F.length==0){openAlertDialog({title:vBulletin.phrase.get("copy_posts"),message:vBulletin.phrase.get("please_select_at_least_one_post"),iconType:"warning"});return }var H=openConfirmDialog({title:vBulletin.phrase.get("copy_posts"),message:vBulletin.phrase.get("loading")+"...",width:500,dialogClass:"inlinemod-copyposts-dialog loading",buttonLabel:{yesLabel:vBulletin.phrase.get("copy_posts"),noLabel:vBulletin.phrase.get("cancel")},onClickYes:function(){var J=H.find(".copy-posts-form");var K=J.find("input:radio[name=type]:checked").val()||0;var I={newtitle:J.find(':input[name="title"]').val(),to_parent:(K==0)?J.find(':input[name="destchannelid"]').val():J.find(':input[name="mergethreadurl"]').val().replace(pageData.baseurl+"/",""),nodeids:F};D.ajax({url:vBulletin.normalizeAjaxUrl(J.attr("action")),data:I,type:J.attr("method"),dataType:"json",success:function(L){if(L.errors){if(L.errors[0]=="inlinemodauth_required"){return vBulletin.inlinemod.openAuthDialog(G)}if(D.isArray(L.errors)&&D.isArray(L.errors[0])){D.each(L.errors,function(O,P){D.each(P,function(R,Q){if(R>0){P[R]=vBulletin.phrase.get(Q)}});L.errors[O]=vBulletin.phrase.get(P)});msg=L.errors.join("<br />")}else{msg=vBulletin.phrase.get(response.error)}openAlertDialog({title:vBulletin.phrase.get("copy_posts"),message:L.errors.join("\n"),iconType:"error"})}else{D.cookie(C,null,{path:pageData.cookie_path,domain:pageData.cookie_domain});if(A=="thread"){if(D.isPlainObject(L)){var M=0;D.each(L,function(O,P){if(D(".js-post[data-node-id={0}]".format(O)).hasClass("js-conversation-starter")){M=P;return false}});if(!M){D.each(L,function(O,P){M=P;return false})}vBulletin.AJAX({url:vBulletin.getAjaxBaseurl()+"/ajax/api/route/getNodeUrl",data:({nodeid:M}),success:function(O){if(O&&!O.errors){location.href=pageData.baseurl+O}}})}}else{var N=D(".filter-wrapper",D(G).parents(".conversation-toolbar")).data("object-instance");if(N&&typeof N.applyFilters=="function"){N.forceApplyFilters()}else{location.reload()}}}},error:function(N,M,L){console.log("/ajax/api/node/cloneNodes failed, error: "+L);openAlertDialog({title:vBulletin.phrase.get("copy_posts"),message:vBulletin.phrase.get("error_copy_posts_x",N.status),iconType:"error"})}})}});D.ajax({url:vBulletin.getAjaxBaseurl()+"/ajax/render/inlinemod_copyPosts",data:({postcount:F.length,deleteposts:1,removeposts:1,firstpost:1}),type:"POST",dataType:"json",success:function(I){console.log("/ajax/render/inlinemod_copyPosts");if(I&&!I.errors){D(".inlinemod-copyposts-dialog").removeClass("loading");D(".dialog-content .message",H).html(I).find("[placeholder]").placeholder();H.dialog("option","position","center");D("select",H).selectBox()}else{console.log("/ajax/render/inlinemod_copyPosts successful, but response was not valid");openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("invalid_server_response_please_try_again"),iconType:"error",onAfterClose:function(){H.dialog("close")}})}},error:function(K,J,I){console.log("/ajax/render/inlinemod_copyPosts failed, error: "+I);openAlertDialog({title:vBulletin.phrase.get("copy_posts"),message:vBulletin.phrase.get("error_loading_copy_posts_form_x",K.status),iconType:"error",onAfterClose:function(){H.dialog("close")}})}})};vBulletin.inlinemod.mergeThreads=function(){var H=this;var G=B();if(G.length==0){openAlertDialog({title:vBulletin.phrase.get("merge_threads_ginlinemod"),message:vBulletin.phrase.get("you_did_not_select_any_valid_threads"),iconType:"warning"});return }if(G.length==1){openAlertDialog({title:vBulletin.phrase.get("merge_threads_ginlinemod"),message:vBulletin.phrase.get("not_much_would_be_accomplished_by_merging"),iconType:"warning"});return }var F=openConfirmDialog({title:vBulletin.phrase.get("merge_threads_ginlinemod"),message:vBulletin.phrase.get("loading")+"...",width:500,dialogClass:"inlinemod-merge-dialog loading",buttonLabel:{yesLabel:vBulletin.phrase.get("merge_threads_ginlinemod"),noLabel:vBulletin.phrase.get("cancel")},onClickYes:function(){var K=F.find(".merge-threads-form");var J={};if(K.find("input[name=enableredirect]").prop("checked")){J.redirect=K.find("#rb_redirect_perm").prop("checked")?"perm":"expires";if(J.redirect=="expires"){J.period=K.find("select[name=period]").val();J.frame=K.find("select[name=frame]").val()}console.log("Redirect data compiled:");console.dir(J)}var I={targetnodeid:K.find('select[name="targetnodeid"]').val(),nodeids:G,leaveRedirectData:J};D.ajax({url:vBulletin.normalizeAjaxUrl(K.attr("action")),data:I,type:K.attr("method"),dataType:"json",success:function(L){if(L.errors){if(L.errors[0]=="inlinemodauth_required"){return vBulletin.inlinemod.openAuthDialog(H)}openAlertDialog({title:vBulletin.phrase.get("merge_threads_ginlinemod"),message:L.errors.join("\n"),iconType:"error"})}else{D.cookie(C,null,{path:pageData.cookie_path,domain:pageData.cookie_domain});var M=D(".filter-wrapper",D(H).parents(".conversation-toolbar")).data("object-instance");if(M&&typeof M.applyFilters=="function"){M.forceApplyFilters()}else{location.reload()}}},error:function(N,M,L){console.log("/ajax/api/node/mergeTopics failed, error: "+L);openAlertDialog({title:vBulletin.phrase.get("merge_threads_ginlinemod"),message:vBulletin.phrase.get("error_merging_threads_x",N.status),iconType:"error"})}})}});D.ajax({url:vBulletin.getAjaxBaseurl()+"/ajax/render/inlinemod_mergeThreads",data:({postcount:G.length,nodeids:G}),type:"POST",dataType:"json",success:function(I){console.log("/ajax/render/inlinemod_mergeThreads");if(I&&!I.errors){D(".inlinemod-merge-dialog").removeClass("loading");D(".dialog-content .message",F).html(I).find("[placeholder]").placeholder();F.dialog("option","position","center");D("select",F).selectBox()}else{console.log("/ajax/render/inlinemod_mergeThreads successful, but response was not valid");openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("invalid_server_response_please_try_again"),iconType:"error",onAfterClose:function(){F.dialog("close")}})}},error:function(K,J,I){console.log("/ajax/render/inlinemod_mergeThreads failed, error: "+I);openAlertDialog({title:vBulletin.phrase.get("merge_threads_ginlinemod"),message:vBulletin.phrase.get("error_loading_merge_form_x",K.status),iconType:"error",onAfterClose:function(){F.dialog("close")}})}})};vBulletin.inlinemod.manage_deleted_form=function(G){var H=D(this);var J=(G)?G:H.parents(".js-post").attr("data-node-id");var I=openConfirmDialog({title:(G)?vBulletin.phrase.get("manage_content"):vBulletin.phrase.get("manage_deleted"),message:vBulletin.phrase.get("loading")+"...",width:510,dialogClass:"inlinemod-delete-dialog loading",buttonLabel:{yesLabel:vBulletin.phrase.get("save"),noLabel:vBulletin.phrase.get("cancel")},onClickYes:function(){var K=I.find(".manage-deleted-form");vBulletin.AJAX({url:vBulletin.normalizeAjaxUrl(K.attr("action")),data:{nodeid:J,params:{deletetype:K.find("input:radio[name=deletetype]:checked").val()||0,reason:K.find(":input[name=deletereason]").val(),prefixid:K.find("select[name=prefixid]").val()||0,topictitle:K.find("input:text[name=topic_title]").val()||"",moderator_notes:K.find("textarea[name=moderator_notes]").val()||"",post_icon:K.find("input:radio[name=iconid]:checked").val()||0,keep_attachments:(K.find("input:checkbox[name=keep_attachments]:checked").val())?1:0,option_open:(K.find("input:checkbox[name=topicopen]:checked").val())?1:0,option_sticky:(K.find("input:checkbox[name=topicsticky]:checked").val())?1:0,option_visible:(K.find("input:checkbox[name=topicvisible]:checked").val())?1:0}},success:function(L){D.cookie(C,null,{path:pageData.cookie_path,domain:pageData.cookie_domain});var M=D(".conversation-toolbar .filter-wrapper",D(H).parents(".inlinemod-container")).data("object-instance");if(M&&typeof M.applyFilters=="function"){M.forceApplyFilters()}else{location.reload()}},error_phrase:"error_moderating_post_x",element:H})}});vBulletin.AJAX({url:vBulletin.getAjaxBaseurl()+"/ajax/render/inlinemod_manage_deleted",data:({nodeid:J,isblogcomment:(H.parents(".js-comments--blog").length==1)?1:0,isarticlecomment:(H.parents(".js-comments--article").length==1)?1:0}),success:function(K){if(K){D(".inlinemod-delete-dialog").removeClass("loading");D(".dialog-content .message",I).html(K).find("[placeholder]").placeholder();I.dialog("option","position","center");D(document).off("click",".manage-deleted-form input:radio[name=deletetype]").on("click",".manage-deleted-form input:radio[name=deletetype]",F);F()}}});function F(){var K=D(".manage-deleted-form"),L=D(".manage-deleted-form input:radio[name=deletetype]:checked").val();if(L){D("input:checkbox[name=keep_attachments]",K).prop("disabled",L!=1);D("input:checkbox[name=topicopen]",K).prop("disabled",L!=2);D("input:checkbox[name=topicsticky]",K).prop("disabled",L!=2);D("input:checkbox[name=topicvisible]",K).prop("disabled",L!=2)}K.find("select.prefixid").selectBox()}};vBulletin.inlinemod.editTopic=function(){var F=D(this).attr("data-node-id");vBulletin.inlinemod.manage_deleted_form(F)};vBulletin.inlinemod.selectAll=function(){D(".inlinemod-item .cb_inlinemod",D(this).parents(".inlinemod-container")).each(function(){D(this).prop("checked",true);vBulletin.inlinemod.check.apply(this)})};vBulletin.inlinemod.selectNone=function(){D(".inlinemod-item .cb_inlinemod",D(this).parents(".inlinemod-container")).each(function(){D(this).prop("checked",false);vBulletin.inlinemod.check.apply(this)})};vBulletin.inlinemod.selectClass=function(F){D(".inlinemod-item."+F+" .cb_inlinemod",D(this).parents(".inlinemod-container")).each(function(){D(this).prop("checked",true);vBulletin.inlinemod.check.apply(this)})};vBulletin.inlinemod.invertSelection=function(){D(".inlinemod-item .cb_inlinemod",D(this).parents(".inlinemod-container")).each(function(){D(this).prop("checked",!D(this).prop("checked"));vBulletin.inlinemod.check.apply(this)})};vBulletin.inlinemod.clear=function(){var F=D(this).parents(".inlinemod-container");D(".inlinemod-item .cb_inlinemod:checked",F).each(function(){D(this).prop("checked",false).closest(".inlinemod-item").removeClass("inlinemod_highlight")});D(".cb_inlinemod_main",F).prop("checked",false);D.cookie(C,null,{path:pageData.cookie_path,domain:pageData.cookie_domain})};vBulletin.inlinemod.check=function(){var G=D(this);var J=G.val();var I=B();if(G.prop("checked")){G.closest(".inlinemod-item").addClass("inlinemod_highlight");if(D.inArray(J,I)==-1){I.push(J)}var H=D(".inlinemod-item .cb_inlinemod",E);if(H.length==H.filter(":checked").length){D(".cb_inlinemod_main",E).prop("checked",true)}}else{G.closest(".inlinemod-item").removeClass("inlinemod_highlight");var K=new Array();for(var F=0;F<I.length;F++){if(I[F]!=J){K.push(I[F])}}I=K;D(".cb_inlinemod_main",E).prop("checked",false)}cookie_str=I.join(",");D.cookie(C,cookie_str,{path:pageData.cookie_path,domain:pageData.cookie_domain})};vBulletin.inlinemod.markRead=function(){var F=D(this).closest(".channel-content-widget").attr("data-node-id");vBulletin.markchannelsread(F,{success:function(){location.reload()},failed:function(){openAlertDialog({title:vBulletin.phrase.get("forum"),message:"Mark Channels Read failed: {0}".format(result),iconType:"error"})}})};vBulletin.inlinemod.init=function(F){F=(F instanceof D)?F:D(F);if(F.length==0){F=D("body")}E=F.hasClass("inlinemod-container")?F:D(".inlinemod-container",F);A=D(".moderationmenu_container",E).attr("data-view");C=pageData.cookie_prefix+pageData.inlinemod_cookie_name+"_"+A;var H=B();if(H.length>0){var I=0;var G=D(".inlinemod-item .cb_inlinemod",E).each(function(){if(D.inArray(this.value,H)!=-1){I++;D(this).prop("checked",true);D(this).closest(".inlinemod-item").addClass("inlinemod_highlight")}});D(".cb_inlinemod_main",E).prop("checked",(I>0&&I==G.length))}vBulletin.inlinemod.addAttachClassToPost(F)};vBulletin.inlinemod.addAttachClassToPost=function(F){F=(F instanceof D)?F:D(F);if(F.length==0){F=D("body")}D(".inlinemod-container .inlinemod-item",F).each(function(){var G=D(this);if(G.hasClass("list-item-gallery")){G.addClass("im-attach")}else{var J=D(".conversation-body .post-content",this);var I=D("img",J);var K=D(".bbcode_container img",J);if(I.length>0&&I.length!=K.length){G.addClass("im-attach")}else{var L=D("iframe.restrain",J);var H=D(".bbcode_container iframe.restrain",J);if(L.length>0&&L.length!=H.length){G.addClass("im-attach")}}}})};function B(){var G=D.cookie(C);var F=[];if(G){F=G.split(",")}return F}var C,A,E;D(document).ready(function(){E=D(".inlinemod-container");if(!C){if(E.is(":visible")){vBulletin.inlinemod.init(E)}else{C=pageData.cookie_prefix+pageData.inlinemod_cookie_name}}D(".inlinemod-container .cb_inlinemod_main").off("click mouseover").on("click",function(){vBulletin.inlinemod[this.checked?"selectAll":"selectNone"].apply(this)}).on("mouseover",function(){this.title=(this.checked)?D(this).attr("data-title-unselect"):D(this).attr("data-title-select")});D(".inlinemod-container").off("click",".inlinemod-item input.cb_inlinemod").on("click",".inlinemod-item input.cb_inlinemod",function(G){vBulletin.inlinemod.check.apply(this)});function F(){var G;var H=true;D(".moderationmenu_container .moderation-mainmenu .mainmenu").off("mouseenter mouseleave").on("mouseenter",function(I){var J=D(this);if(D(".toolbar-filter-overlay",J.closest(".conversation-toolbar-wrapper")).is(":visible")){D(".toolbar-filter",J.closest(".conversation-toolbar")).triggerHandler("click",[0])}G=setTimeout(function(){J.removeClass("pos-top").addClass("hover").closest(".moderation-mainmenu").find(".mainmenu .submenu").hide().css("top","");var P={},M=D(".submenu",J).show();if(H&&M.find("li").length>10){H=false;var N=M.find("li").outerWidth();var Q=M.find("li").outerHeight()+1;var R=M.find("li.col1").length;M.addClass("splitmenu");M.find("li").css("width",N);M.find("li.col1").css("margin-"+pageData.textDirRight,N);M.find("li.col2").css("margin-"+pageData.textDirLeft,N+1);var K=-(Q*R);M.find("li.col2").each(function(T,U){D(U).css("margin-top",(K+(T*Q)))});M.find("li.col2").first().css("border-top-color","transparent")}if(!vBulletin.isScrolledIntoView(M,P)){var L=D(document).height()-D(window).height(),S=D(document).scrollTop(),O=Math.abs(P.bottom);if(O<=(L-S)){D("html,body").animate({scrollTop:"+="+(S+O)},"slow")}else{M.css("top",-(M.height()+1)).parent().addClass("pos-top");if(!vBulletin.isScrolledIntoView(M,P)){D("html,body").animate({scrollTop:"-="+Math.abs(P.top)},"slow")}}}},200)}).on("mouseleave",function(I){clearTimeout(G);D(".submenu",this).hide();D(this).removeClass("hover")})}vBulletin.inlinemod.initModMenuHover=F;F();D(".moderationmenu_container .submenu .moderation-action a[data-action]").off("click").on("click",function(K){K.stopPropagation();D(this).closest(".submenu").hide();var I=E.find(".list-item-body-wrapper.edit-post .edit-conversation-container");if(I.length>0){openAlertDialog({title:vBulletin.phrase.get("edit_conversation"),message:vBulletin.phrase.get("you_have_a_pending_edit_unsaved"),iconType:"warning",onAfterClose:function(){vBulletin.animateScrollTop(I.closest(".list-item").offset().top,{duration:"slow"})}});return false}var G=D(this).attr("data-action");if(!G){console.warn("Unable to find the inline moderation function name.");return false}var J=vBulletin.inlinemod[G];if(typeof J=="function"){var H=D(this).attr("data-params");H=H?H.split(","):[];J.apply(this,H)}else{console.warn('Unable to find the inline moderation function "{0}". Please ensure that it is defined in inlinemod.js.'.format("vBulletin.inlinemod."+G))}return false});D(".conversation-content-widget").off("click",".conversation-status-message .close").on("click",".conversation-status-message .close",function(){D(this).parent().fadeOut("slow")});return false})})(jQuery);