/*
 =======================================================================*\
|| ###################################################################### ||
|| # 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 confirm_delete_group_channel delete_a_group_channel delete_group edit_group_icon error_adding_moderator error_deleting_group group_icon group_title_exists groups kilobytes loading_ellipsis manage_subscribers social_groups_gsocialgroups transfer_group_ownership unexpected_error".split(" "),[]);
(function(b){function p(c){b(".groupIcon .groupIconUrl").val()?(b(".groupIcon .groupIconImg").attr("src",b(".groupIcon .groupIconUrl").val()),b(".groupIcon .groupFileDataId").val(b(".groupIcon .initFiledataid").val())):(b(".groupIcon .groupIconImg").addClass("h-hide"),b(".groupIcon .groupFileDataId").val(""));return!0}function q(c,a){c.stopPropagation();$moderatorForm=b(this).closest("form");c=$moderatorForm.find(':input[name="nodeid"]').val();a=vBulletin.htmlEntities(a.getElements()[0].value);b("body").css("cursor",
"wait");vBulletin.AJAX({call:"/ajax/api/node/requestChannel",data:{channelid:c,recipientname:a,requestType:"sg_moderator_to"},success:function(){location.reload()},complete:function(){b("body").css("cursor","default")},title_phrase:"add_moderator_gforumdisplay",error_phrase:"error_adding_moderator"})}function r(c){c.stopPropagation();c=b(this).closest("form").find(':input[name="nodeid"]').val();var a=b(this).attr("userid");b("body").css("cursor","wait");vBulletin.AJAX({call:"/ajax/api/blog/removeChannelModerator",
data:{userId:a,channelId:c},success:function(d){location.reload()},complete:function(){b("body").css("cursor","default")},title_phrase:"delete_moderator"})}function t(c){c.stopPropagation();var a=b(this);c=a.closest("form").find(':input[name="nodeid"]').val();a=a.attr("userid");b("body").css("cursor","wait");vBulletin.AJAX({call:"/ajax/api/blog/cancelChannelTransfer",error_phrase:"error_transfer_ownership",data:{userId:a,channelId:c},success:function(){location.reload()},complete:function(){b("body").css("cursor",
"default")}})}function u(c){var a=b(this).closest("form").find(':input[name="nodeid"]').val(),d=openConfirmDialog({title:vBulletin.phrase.get("transfer_group_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(){var e="",f=0;0<b(".transfer-ownership-dialog .transfer_owner_select:visible").length?f=b(".transfer-ownership-dialog .transfer_owner_select").val():
e=vBulletin.htmlEntities(b('.transfer-ownership-dialog :input[name="transfer_owner_autocomplete"]').val());if(0==e.length&&(0==f.length||0==f))return!1;vBulletin.AJAX({call:"/ajax/api/node/requestChannel",data:{channelid:a,recipient:f,recipientname:e,requestType:"owner_to"},success:function(){location.reload()},complete:function(){b("body").css("cursor","default")},title_phrase:"transfer_group_ownership",error_phrase:"error_transfer_ownership"})}});vBulletin.AJAX({call:"/ajax/render/sgadmin_transferownership",
data:{nodeid:a},success:function(e){b(".transfer-ownership-dialog").removeClass("loading");b(".dialog-content .message",d).html(e);d.dialog("option","position",{of:window});transferOwnerAutocomplete=new vBulletin_Autocomplete(b(".transfer_owner_autocomplete"),{apiClass:"user",maxItems:1});b(".transfer_ownership_tabs").tabs().trigger("vb-tabinit")},after_error:function(){d.dialog("close")}})}function v(){var c=b(this).closest("form").find(':input[name="nodeid"]').val();openConfirmDialog({title:vBulletin.phrase.get("delete_a_group_channel"),
message:vBulletin.phrase.get("confirm_delete_group_channel"),iconType:"warning",onClickYes:function(){vBulletin.AJAX({call:"/ajax/api/content_channel/delete",data:{nodeid:c},success:function(){window.location.href=pageData.baseurl+"/social-groups";return!1},complete:function(){b("body").css("cursor","default")},title_phrase:"delete_group",error_phrase:"error_deleting_group"});return!1},onClickNo:function(){}});return!1}function w(c){var a=b(".sgIconUploader");"1"!=a.data("dialog-initialized")&&a.dialog({width:600,
autoOpen:!1,modal:!0,title:vBulletin.phrase.get("edit_group_icon"),dialogClass:"dialog-container",showCloseButton:!1}).data("dialog-initialized","1");c=!!b(c.target).closest(".sg-icon-wrapper").find(".groupIconImg").data("filedataid");b(".js-sgicon-remove",a).toggleClass("h-hide-imp",!c);b("input",a).first().trigger("click");a.dialog("open");return!1}function x(c){var a=b(c.target).parent(".sgIconUrlInput").find("#imgUrl").val(),d=b(".sgIconUploader .js-upload-progress"),e=b(".js-sgicon-upload-form").data("update-channel");
d.removeClass("h-hide-imp");vBulletin.AJAX({call:"/uploader/uploadSGIcon",error_phrase:"upload_errors",data:{nodeid:b(c.target).closest(".sgicon-upload-form").data("nodeid"),url:a,urlupload:a,updatechannel:e},success:function(f){k(f.mediumUrl,f.filedataid)},complete:function(){d.addClass("h-hide-imp")}})}function y(c){if(b(".js-sgicon-upload-form").data("update-channel")){var a=b(".sgIconUploader .js-upload-progress").removeClass("h-hide-imp");vBulletin.AJAX({call:"/ajax/api/content_channel/update",
error_phrase:"upload_errors",data:{nodeid:b(c.target).closest(".sgicon-upload-form").data("nodeid"),data:{filedataid:0}},success:function(d){k("",0)},complete:function(){a.addClass("h-hide-imp")}})}else k("",0)}function k(c,a){var d=b(".groupIconImg"),e=!c;e&&(c=d.data("defaultimgurl"),a=0);d.toggleClass("js-frame-image",!e).toggleClass("noGroupIcon",e).data("filedataid",a).attr("src",c);b(".sgIconUploader").dialog("close");b(".sGIconfiledataid").val(a);vBulletin.initFrameImagesWithColor()}function z(c){b(c.target).closest(".sgIconUploader").dialog("close")}
function A(c){var a=b(c.target),d=a.closest(".js-member-row");c=a.attr("data-userid");var e=a.attr("data-groupid");a=a.attr("data-nodeid");c&&0<c&&e&&0<e&&a&&0<a&&vBulletin.AJAX({call:"/ajax/api/blog/removeChannelMember",data:{userId:c,channelId:a},success:function(f){d.remove()},complete:function(){b("body").css("cursor","default")},title_phrase:"manage_subscribers"})}function B(c){var a=b(c.target),d=a.closest(".js-member-row");c=a.attr("data-userid");a=a.attr("data-nodeid");c&&0<c&&a&&0<a&&vBulletin.AJAX({call:"/ajax/api/follow/delete",
data:{follow_item:a,type:"follow_channel",userid:c},success:function(e){d.remove()},complete:function(){b("body").css("cursor","default")},title_phrase:"manage_subscribers"})}function l(c,a){a=a||b(".js-toolbar-pagenav");a.find(".js-pagenum").val(c);a.find(".left-arrow, .right-arrow").removeClass("h-disabled");1>=c&&a.find(".left-arrow").addClass("h-disabled");var d=a.find(".pagetotal").text();c>=d&&a.find(".right-arrow").addClass("h-disabled")}function n(c){c=b(c.currentTarget);var a=c.closest(".js-pagenav-data"),
d=parseInt(a.data("pagecount"),10),e=parseInt(a.data("nodeid"),10),f=a.find(".js-pagenav-update-me");a=f.data("template").replace(/[^a-z0-9-_]/gi,"");var h=parseInt(f.data("current-page"),10)||1,g=h;if(c.hasClass("left-arrow")){if(g=h-1,1>g){l(h);return}}else if(c.hasClass("right-arrow")){if(g=h+1,g>d){l(h);return}}else if(c.hasClass("textbox")){if(g=parseInt(c.val(),10),isNaN(g)||g>d||1>g){l(h);return}}else return;vBulletin.AJAX({call:"/ajax/render/"+a,data:{pageno:g,nodeid:e,isAjaxTemplateRender:!0,
isAjaxTemplateRenderWithData:!0},success:function(m){m&&m.template&&(f.html(m.template),f.data("current-page",g),l(g))}})}function C(c){category=b(c.target).find(".sgCategory");if(0>=parseInt(category.val()))return vBulletin.error("groups","please_select_category"),!1;title=b(c.target).find(".sGtitle");if(title.length&&0>=title.val().trim().length)return vBulletin.error("groups","please_enter_title"),!1;var a=b(c.target).find(".blogAdminNodeId").val();0<a&&b.ajax({url:vBulletin.getAjaxBaseurl()+"/ajax/api/user/hasPermissions",
data:{nodeid:a,group:"forumpermissions2",permission:"canconfigchannel"},type:"POST",dataType:"json",async:!1,success:function(d){if(d.errors)return vBulletin.warning("social_groups_gsocialgroups",d.errors[0][0]),!1;if(!1===d)return c.preventDefault(),vBulletin.warning("social_groups_gsocialgroups","cannot_edit_group_info"),!1}});a=b(c.target);a.find('input[name="securitytoken"]').length?a.find('input[name="securitytoken"]').val(pageData.securitytoken):a.append('<input type="hidden" name="securitytoken" value="'+
pageData.securitytoken+'" />')}if(!vBulletin.pageHasSelectors([".blogadmin-widget",".summary-widget"]))return!1;b(function(){var c=new vBulletin_Autocomplete(b(".moderator_input"),{apiClass:"user",maxItems:1,containerClass:"group-moderator-autocomplete"});b(".moderator_input").data("vbulletin-autocomplete",c);new vBulletin_Autocomplete(b(".moderator_members_input"),{apiClass:"user",containerClass:"group-moderator-autocomplete"});b(".btnGroupReset").off("click").on("click",p);b(document).off("click",
".add_moderator").on("click",".add_moderator",function(a){return q.call(this,a,c)});b(document).off("click",".btnRemoveContributor").on("click",".btnRemoveContributor",r);b(document).off("click",".btnCancelTransfer").on("click",".btnCancelTransfer",t);b(document).off("click",".btnTransferOwnership").on("click",".btnTransferOwnership",u);b(document).on("click",".groupRemoveSubscriber",B);b(document).on("click",".groupRemoveMember",A);b("#btnGroupDelete").off("click").on("click",v);b(".editGroupIcon").off("click").on("click",
w);b(".btnSGIconCancel").off("click").on("click",z);b(".btnSGIconUrlSubmit").off("click").on("click",x);b(".btnSGIconRemoveSubmit").off("click").on("click",y);b(".js-groupadmin-members-paging .arrow").off("click").on("click",n);b(".js-groupadmin-members-paging .js-pagenum").change(n);b(".js-groupadmin-members-paging .js-pagenum").on("keypress",function(a){13==a.keyCode&&(a.preventDefault(),a.target.blur())});b(".groupAdminSubscriberPaging .right-arrow ").removeClass("h-disabled");b(".js-sg-admin__upload-icon").fileupload({dropZone:b(".js-sg-admin__upload-icon").closest(".js-file-chooser"),
formData:function(a){return[{name:"nodeid",value:a.data("nodeid")},{name:"uploadFrom",value:a.find("input[name=uploadFrom]").val()},{name:"securitytoken",value:pageData.securitytoken},{name:"updatechannel",value:a.data("update-channel")}]},dataType:"json",url:vBulletin.getAjaxBaseurl()+"/uploader/uploadSGIcon",add:function(a,d){/(gif|jpg|jpeg|jpe|png)$/i.test(d.files[0].type)?(b(".sgIconUploader .js-upload-progress").removeClass("h-hide-imp"),d.submit()):vBulletin.error("upload","invalid_image_allowed_filetypes_are")},
done:function(a,d){d?(a=d.result.errors,"undefined"!=typeof a?("undefined"!=typeof a[0]&&(a=a[0]),vBulletin.error("group_icon",a)):d.result.mediumUrl?k(d.result.mediumUrl,d.result.filedataid):vBulletin.error("group_icon","unable_to_upload_file")):vBulletin.error("group_icon","invalid_server_response_please_try_again")},fail:function(a,d){a="error_uploading_image";var e="error";d&&0<d.files.length&&"acceptFileTypes"==d.files[0].error&&(a="invalid_image_allowed_filetypes_are",e="warning");vBulletin.alert("upload",
a,e,function(){$editProfilePhotoDlg.find(".fileText").val("");$editProfilePhotoDlg.find(".browse-option").trigger("focus")})},always:function(){b(".sgIconUploader .js-upload-progress").addClass("h-hide-imp")}});b(".sgAdminForm").submit(C)})})(jQuery);
