/*
 =======================================================================*\
|| ###################################################################### ||
|| # vBulletin 6.2.3
|| # ------------------------------------------------------------------ # ||
|| # Copyright 2000-2026 MH Sub I, LLC dba vBulletin. 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   # ||
|| ###################################################################### ||
\*========================================================================*/
vBulletin.precache("add_moderator_gforumdisplay blog_title_exists blogs confirm_delete_blog_channel delete_a_blog_channel delete_blog error_adding_moderator error_deleting_blog kilobytes loading_ellipsis manage_subscribers transfer_blog_ownership unexpected_error".split(" "),[]);var blogIconEditDlg=!1;
(function(a){if(!vBulletin.pageHasSelectors([".blogadmin-widget",".summary-widget"]))return!1;a(document).ready(function(){var g=1,f=function(b){var c=parseInt(a(b.target).closest(".blogAdminSubscriberPaging").attr("data-pagecount")),d=a(b.target),h=d.add(d.parent()),l=d.closest(".blogAdminEditPage"),e,n=function(k,m){k.find(".right-arrow").toggleClass("h-disabled",m>=c);k.find(".left-arrow").toggleClass("h-disabled",1>=m);k.find(".pagenav .textbox").val(m)};h.hasClass("left-arrow")?e=g-1:h.hasClass("right-arrow")?
e=g+1:d.hasClass("textbox")&&(e=parseInt(a(b.target).val()));isNaN(e)||e>c||1>e?n(l,g):vBulletin.AJAX({call:"/ajax/render/blogadmin_subscriberlist",data:{pageno:e,nodeid:l.attr("data-nodeid")},success:function(k){l.find(".subscriberList").html(k);g=e;n(l,e)}})};a(".blogadmin-widget select").selectBox();a(".btnBlogReset").off("click").on("click",function(b){a(".blogIcon .blogIconUrl").val()?(a(".blogIcon .blogIconImg").attr("src",a(".blogIcon .blogIconUrl").val()),a(".blogIcon .blogFileDataId").val(a(".blogIcon .initFiledataid").val())):
(a(".blogIcon .blogIconImg").addClass("h-hide"),a(".blogIcon .blogFileDataId").val(""));b=a(this).closest("form");b=a('input[name="sidebarInfo"]',b).val().split(",");a.each(b,function(c,d){d=d.split(":");c=a('.sidebar-modules-container .widget[data-widget-instance-id="'+d[0]+'"]');d="hide"==d[1];c.toggleClass("hidden-widget",d);a(".module-controls .hide-control",c).prop("checked",d);c.appendTo(".sidebar-modules-container")});return!0});a(".blog-icon-controls .edit-blog-icon").off("click").on("click",
function(b){b.preventDefault();a(".js-blog-admin__upload-icon").trigger("click")});a(".blog-icon-controls .remove-blog-icon").off("click").on("click",function(b){b.preventDefault();a(".blogIcon .blogIconImg").attr("src","").addClass("h-hide");a(".blogIcon .blogFileDataId").val("");a(".blogIcon .blog-icon-controls").addClass("h-hide");a(".js-blog-admin__upload-icon").closest(".b-button--upload").removeClass("h-hide-imp")});moderatorsAutocomplete=new vBulletin_Autocomplete(a(".moderator_input"),{apiClass:"user",
maxItems:1,containerClass:"blog-moderator-autocomplete"});a(document).off("click",".add_moderator").on("click",".add_moderator",function(b){b.stopPropagation();$moderatorForm=a(this).closest("form");$channelid=$moderatorForm.find(':input[name="nodeid"]').val();$recipient=moderatorsAutocomplete.getElements();$recipient=vBulletin.htmlEntities($recipient[0].value);vBulletin.AJAX({call:"/ajax/api/node/requestChannel",data:{channelid:$channelid,recipientname:$recipient,requestType:"moderator_to"},success:function(){location.reload()},
title_phrase:"add_moderator_gforumdisplay",error_phrase:"error_adding_moderator"})});a(document).off("click",".btnRemoveContributor").on("click",".btnRemoveContributor",function(b){b.stopPropagation();$moderatorForm=a(this).closest("form");$channelid=$moderatorForm.find(':input[name="nodeid"]').val();$userid=a(this).attr("userid");$usergroupid=a(this).attr("usergroupid");vBulletin.AJAX({call:"/ajax/api/blog/removeChannelModerator",data:{userId:$userid,channelId:$channelid},success:function(){location.reload()},
title_phrase:"add_moderator_gforumdisplay"})});a(document).off("click",".btnCancelTransfer").on("click",".btnCancelTransfer",function(b){b.stopPropagation();var c=a(this);b=c.closest("form").find(':input[name="nodeid"]').val();c=c.attr("userid");vBulletin.AJAX({call:"/ajax/api/blog/cancelChannelTransfer",error_phrase:"error_transfer_ownership",data:{userId:c,channelId:b},success:function(){location.reload()}})});a(document).off("click",".btnTransferOwnership").on("click",".btnTransferOwnership",function(b){var c=
a(this).closest("form").find(':input[name="nodeid"]').val(),d=openConfirmDialog({title:vBulletin.phrase.get("transfer_blog_ownership"),message:vBulletin.phrase.get("loading_ellipsis"),width:500,dialogClass:"transfer-ownership-dialog loading",buttonLabel:{yesLabel:vBulletin.phrase.get("send_request"),noLabel:vBulletin.phrase.get("cancel")},onClickYes:function(){0<a(".transfer-ownership-dialog .transfer_owner_select:visible").length?($user="",$userid=a(".transfer-ownership-dialog .transfer_owner_select").val()):
($user=vBulletin.htmlEntities(a('.transfer-ownership-dialog :input[name="transfer_owner_autocomplete"]').val()),$userid=0);if(0==$user.length&&(0==$userid.length||0==$userid))return!1;vBulletin.AJAX({call:"/ajax/api/node/requestChannel",data:{channelid:c,recipient:$userid,recipientname:$user,requestType:"owner_to"},success:function(){location.reload()},title_phrase:"transfer_blog_ownership",error_phrase:"error_transfer_ownership"})}});vBulletin.AJAX({call:"/ajax/render/blogadmin_transferownership",
data:{nodeid:c},success:function(h){d.removeClass("loading");a(".dialog-content .message",d).html(h);d.dialog("option","position",{of:window});transferOwnerAutocomplete=new vBulletin_Autocomplete(a(".transfer_owner_autocomplete"),{apiClass:"user",maxItems:1});a(".transfer_ownership_tabs").tabs().trigger("vb-tabinit")},after_error:function(){d.dialog("close")}})});new vBulletin_Autocomplete(a(".moderator_members_input"),{apiClass:"user",containerClass:"blog-moderator-autocomplete"});a(document).off("click",
".blogRemoveSubscriber").on("click",".blogRemoveSubscriber",function(b){var c=a(b.target).closest(".js-member-row"),d=a(b.target).attr("data-userid"),h=a(b.target).attr("data-groupid");b=a(b.target).attr("data-nodeid");d&&0<d&&h&&0<h&&b&&0<b&&vBulletin.AJAX({call:"/ajax/api/blog/removeChannelMember",data:{userId:d,channelId:b},success:function(){c.remove()},title_phrase:"manage_subscribers"})});a(document).off("click",".blogAdminSubscriberPaging .right-arrow, .blogAdminSubscriberPaging .left-arrow").on("click",
".blogAdminSubscriberPaging .right-arrow, .blogAdminSubscriberPaging .left-arrow",f);a(".blogAdminSubscriberPaging .right-arrow ").removeClass("h-disabled");a(".blogAdminSubscriberPaging .pagenav .textbox").change(f);a(".blogAdminSubscriberPaging .pagenav .textbox").on("keypress",function(b){13==b.keyCode&&(b.preventDefault(),b.target.blur())});a(document).off("click",".editBlogIcon").on("click",".editBlogIcon",function(b){a(".editBlogIconDlg").dialog()});a(document).off("click",".btnBlogIconClose").on("click",
".editBlogIconDlg",function(b){a(".editBlogIconDlg").dialog("close")});a(document).off("click","#btnBlogDelete").on("click","#btnBlogDelete",function(b){var c=a(this).closest("form").find(':input[name="nodeid"]').val(),d=openConfirmDialog({title:vBulletin.phrase.get("delete_a_blog_channel"),message:vBulletin.phrase.get("confirm_delete_blog_channel"),iconType:"warning",onClickYes:function(){vBulletin.AJAX({call:"/ajax/api/content_channel/delete",data:{nodeid:c},success:function(){window.location.href=
pageData.baseurl+"/blogs";return!1},after_error:function(){d.dialog("close")},title_phrase:"delete_blog",error_phrase:"error_deleting_blog"});return!1}});return!1});a(".js-blog-admin__upload-icon").fileupload({dropZone:null,dataType:"json",formData:function(b){return[{name:"nodeid",value:b.data("nodeid")},{name:"uploadFrom",value:"blogicon"}]},add:function(b,c){/(gif|jpg|jpeg|jpe|png)$/i.test(c.files[0].type)?(a(".blogIcon .js-upload-progress").removeClass("h-hide"),c.form.attr("action",a(this).data("url")),
c.submit()):vBulletin.error("upload","invalid_image_allowed_filetypes_are")},done:function(b,c){c.result&&c.result.thumbUrl&&(a(".blogIcon .blogIconImg").attr("src",c.result.thumbUrl).removeClass("h-hide"),a(".blogIcon .blogFileDataId").val(c.result.filedataid),a(".blogIcon .blog-icon-controls").removeClass("h-hide"),a(".js-blog-admin__upload-icon").closest(".b-button--upload").addClass("h-hide-imp"));c.result&&c.result.errors&&vBulletin.error("upload",c.result.errors[0])},fail:function(b,c){b="error_uploading_image";
var d="error";if(c&&0<c.files.length)switch(c.files[0].error){case "acceptFileTypes":b="invalid_image_allowed_filetypes_are",d="warning"}vBulletin.alert("upload",b,d)},always:function(){a(".blogIcon .js-upload-progress").addClass("h-hide")}});a(".blogAdminForm button[type=submit]").off("click").on("click",function(){this.form.action=pageData.baseurl+"/create-content/blog"});a(document).off("click",".editBlogIcon").on("click",".editBlogIcon",function(b){blogIconEditDlg||(blogIconEditDlg=a(b.target).closest(".blogSummaryContainer").find(".sgIconUploader").dialog({width:600,
autoOpen:!1,modal:!0,title:vBulletin.phrase.get("edit_blog_icon"),dialogClass:"dialog-container"}));a(blogIconEditDlg).dialog("open");return!1});a(document).off("click",".btnSGIconCancel").on("click",".btnSGIconCancel",function(b){a(b.target).closest(".sgIconUploader").dialog("close")});a(document).off("click",".btnSGIconUrlSubmit").on("click",".btnSGIconUrlSubmit",uploadIconFromUrl);var p=a(".blogIconImg");f=vBulletin.getAjaxBaseurl()+"/uploader/"+(0<p.length?"uploadSGIcon":"upload-file");a(".js-sg-admin__upload-icon").fileupload({dropZone:a(".js-sg-admin__upload-icon").closest(".js-file-chooser"),
formData:function(b){return[{name:"nodeid",value:b.data("nodeid")},{name:"uploadFrom",value:"blogicon"}]},url:f,add:function(b,c){/(gif|jpg|jpeg|jpe|png)$/i.test(c.files[0].type)?(a(".sgIconUploader .js-upload-progress").removeClass("h-hide"),c.submit()):vBulletin.error("upload","invalid_image_allowed_filetypes_are")},done:function(b,c){c?c.result.errors?"undefined"==typeof c.result.errors[0]?vBulletin.error("blog_icon",c.result.errors):vBulletin.error("blog_icon",c.result.errors[0]):c.result.imageUrl?
0<p.length?(a(".blogIconImg").attr("src",c.result.imageUrl),a(blogIconEditDlg).dialog("close")):(a(".sgIconPreview").html('<img src="'+c.result.imageUrl+'" alt="">'),a(".sGIconfiledataid").val(c.result.filedataid),a(sgIconUploadDlg).dialog("close")):vBulletin.error("blog_icon","unable_to_upload_file"):vBulletin.error("blog_icon","invalid_server_response_please_try_again")},fail:function(b,c){b="error_uploading_image";iconType="error";if(c&&0<c.files.length)switch(c.files[0].error){case "acceptFileTypes":b=
"invalid_image_allowed_filetypes_are",iconType="warning"}vBulletin.alert("upload",b,iconType,function(){$editProfilePhotoDlg.find(".fileText").val("");$editProfilePhotoDlg.find(".browse-option").trigger("focus")})},always:function(){a(".sgIconUploader .js-upload-progress").addClass("h-hide")}});a(".sidebar-modules-container").trigger("reset").sortable({revert:!0,tolerance:"pointer",placeholder:"widget module-drag-highlight",handle:!1,items:".widget",cursor:"move",axis:"y"}).disableSelection();a(".sidebar-modules-container .module-controls .hide-control").off("click").on("click",
function(){a(this).closest(".widget")[this.checked?"addClass":"removeClass"]("hidden-widget")});a("form.sidebarForm").off("submit.sidebar").on("submit.sidebar",function(){var b=[];a(".sidebar-modules-container .widget").each(function(){b.push(a(this).attr("data-widget-instance-id")+":"+(a(".module-controls .hide-control",a(this)).prop("checked")?"hide":"show"))});a('input[name="sidebarInfo"]',this).val(b.join())})})})(jQuery);
uploadIconFromUrl=function(a){var g=$(".blogIconImg");$(".sgIconUploader .js-upload-progress").removeClass("h-hide");vBulletin.AJAX({call:"/uploader/"+(0<g.length?"uploadSGIcon":"url"),error_phrase:"upload_errors",data:{nodeid:$(a.target).closest(".sgicon-upload-form").data("nodeid"),url:$(a.target).parent(".sgIconUrlInput").find("#imgUrl").val()},success:function(f){0<g.length?$(".blogIconImg").attr("src",f.imageUrl):($(".sgIconPreview").html('<img src="'+f.imageUrl+'" alt="">'),$(".sGIconfiledataid").val(f.filedataid));
$(blogIconEditDlg).dialog("close")},complete:function(){$(".sgIconUploader .js-upload-progress").addClass("h-hide")}})};
