/*=======================================================================*\
|| ###################################################################### ||
|| # vBulletin 5.5.2
|| # ------------------------------------------------------------------ # ||
|| # Copyright 2000-2019 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   # ||
|| ###################################################################### ||
\*========================================================================*/
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,["action","active","ad_list_description","add_modules","add_subforum","adding_multiple_modules_not_allowed","all","applying_new_template","are_you_sure_want_to_delete_ad_x","cancel","cannot_add_system_module","cannot_convert_channel","cannot_remove_system_module","channels","check_to_hide_module","choose_base_module","choose_options_site_logo","click_text_edit_title","confirm_deletion_gcpglobal","confirm_deletion_x","confirm_remove_page_desc","content_types","create_ad","create_new_custom_module","delete","display_order","do_you_want_to_cancel_editing_search_module","do_you_want_to_exit_without_saving_page","do_you_want_to_remove_channel","do_you_want_to_remove_forum","do_you_want_to_remove_module","do_you_want_to_remove_tab","drag_and_drop_module_here","drop_page_here","dropping_container_module_into_container_module_not_allowed","edit","edit_ad_x","edit_blog_categories","edit_custom_html_module","edit_navigation_item","edit_search_module","edit_site_logo","error_adding_widgets","error_cloning_widget","error_deleting_page","error_fetching_channels","error_loading_search_config_script","error_processing_site_logo","error_renaming_module_title","error_retrieving_cloned_widget_template","error_retrieving_configuration","error_retrieving_list_user_groups","error_retrieving_modules","error_retrieving_navigation_bar_configuration","error_retrieving_page_map","error_retrieving_templates","error_saving_configuration_module","error_saving_forums","error_saving_forums_code","error_saving_navigation_bar_configuration","error_saving_page","error_saving_search_config","error_saving_site_logo","error_uploading_logo","exit_without_saving_page","expand","forum_changes_will_be_lost","input_navigation_item_name","input_target_url","invalid_image_url","main_navigation_bar","make_category","make_forum","manage_ads","module_configuration","module_icon","move_not_allowed","moving_main_nav_to_own_sub_nav_error","moving_main_nav_with_sub_nav_error","new_navigation_item","new_subnavigation_item","next","no","no_ad_added","no_configurations_found","no_modules","no_permission","none","overwrite_template_continue","page_template_title_cannot_be_empty","page_title_cannot_be_empty","please_choose_overwrite_template_options","please_enter_channel_title","please_enter_new_module_title","please_enter_new_template_name","please_enter_page_name","previous","remove_channel","remove_channel_q","remove_forum","remove_forum_q","remove_module_q","rename","rename_custom_module","reset","save","save_new_page","save_page","search_results","select_edit_link_header","special_options","sub_navigation_bar","subchannels_will_be_deleted","switch_template","template_changes_will_be_lost","this_url_is_already_used","title","unable_to_delete_widget_instances","uncheck_to_unhide_module","url_too_long","user_group_settings","warning","warning_gcpuser","yes","you_are_here","you_can_also_drag_and_drop_modules_here","you_cannot_revert_this_layout_confirm","you_must_specify_a_screen_layout"]);(function(AV){var f,AU,o,Ad,AF,b,AB=[],AD,AJ,t=false,x=false,p={},z=false,AG=false,m=false,v=false,Aa=false,S=false,u=false,h={},y={},AO={},H={},c,AN,r,Ab={saveNewWidgetInstance:false},A=AV("<div>"),P;function Ak(){window.setTimeout(function(){if(vBulletin.vBScroller&&vBulletin.vBScroller.initializeScroller){AV(".js-vbscroller-wrapper:visible").each(function(){vBulletin.vBScroller.initializeScroller(AV(this))})}},0)}function Aj(){var Am=AV("#edit-page-dropdown .panel .panel-main-content:visible");if(Am.length>0){var Al=parseFloat(Am.css("margin-left"))+parseFloat(Am.css("margin-right"))+parseFloat(Am.css("border-left-width"))+parseFloat(Am.css("border-right-width"))+parseFloat(Am.css("padding-left"))+parseFloat(Am.css("padding-right"));AV("#edit-page-dropdown .panel .panel-main-content").width(AV("#edit-page-dropdown .panel:visible").width()-AV("#edit-page-dropdown .panel .panel-header-text:visible").outerWidth(true)-Al-1);AV("#edit-page-dropdown form .form-gutter-right").width(Math.ceil((AV("#edit-page-dropdown form:visible").width()-AV("#edit-page-dropdown .panel:visible").outerWidth(true))/2));Ak()}}function AW(Am,Ao){if(AV.isEmptyObject(Ao)){return }var An=Am.find(".js-admin-widget-list"),Al=false;AV.each(Ao,function(){An.append(this.rendered_template);Al=true});if(Al){An.closest(".js-widget-content").removeClass("h-hide")}An.closest(".js-widget-content").css({minHeight:"35px"});An.css({minHeight:"0",height:"auto",paddingBottom:"10px"})}function AM(Ao,Al,Aq){var Am=Ao.attr("data-widget-id"),Ap=Ao.attr("data-widget-instance-id")||"",An={widgetinstanceid:Ap,widgetid:Am,guid:"",userid:0,channelId:0,withTemplate:false,};if(typeof Aq=="undefined"){Aq=false}else{Aq=Boolean(Aq)}vBulletin.AJAX({call:"/ajax/api/widget/fetchConfigAndIsUserEditable",data:An,success:function(Ar){console.log("fetchConfig in getModuleConfig() successful! result:"+JSON.stringify(Ar));var As=Ar;if(!Aq){As=Ar.config}if(typeof Al=="function"){Al(As)}}})}function AC(Am){if(!Am.tab_data){Am.tab_data=[]}if(!Am.default_tab){Am.default_tab=0}if(!Am.submodules_key){console.log({msg:"Missing submodules key!",config:Am,});Am.submodules_key="tabbedContainerSubModules__temp"}if(!Am.display_tabs){Am.display_tabs=""}if(Am.display_tabs==""){var Al={};AV.each(Am.tab_data,function(Ao,An){Al[Ao]="1"});Am.display_tabs=Al}return Am}function W(){if(typeof r=="undefined"){r=AV("#config_pagetemplateid").val()||AV("#select-template input[type=radio]:checked").val()||""}return r}function d(Al){Al=parseInt(Al,10);r=Al;AV("#config_pagetemplateid, #save-page-form #pagetemplateid-yes, #save-page-form #pagetemplateid-new").val(r)}function a(Am,Al){console.log({msg:"saveModuleConfig()",$module:Am,config:Al,});vBulletin.AJAX({call:"/ajax/api/widget/saveAdminConfig",data:{widgetid:Am.attr("data-widget-id"),widgetinstanceid:Am.attr("data-widget-instance-id")||"",pagetemplateid:W(),data:Al},complete:function(){AV("body").css("cursor","auto")},success:function(An){console.log("saveAdminConfig in saveModuleConfig() successful! result:"+JSON.stringify(An))}})}function s(Am){var Al=Am.parents(".canvas-widget");if(Al.length){$parentModule=AV(Al[0]);return parseInt($parentModule.data("widget-instance-id"),10)}return 0}function R(Am){var Al=Am.parents(".canvas-widget[data-is-tabbed-container='true']");if(Am.data("is-tabbed-container")){console.log("---updating self tabbed container config");V(Am)}if(Al.length==0){console.log("---no parent tabbed container to update");return }console.log("---updating parent tabbed container config");V(AV(Al[0]))}function g(Am){var Al={};Am.find("> .js-admin-widget-content > .js-admin-widget-tab").each(function(){var Aq=AV(this),Ap=[],An=Aq&&Aq.data("tab-number")||0,Ao=Aq&&Aq.data("tab-title")||"";Al[An]={title:Ao};Aq.find("> .widget-content > .canvas-layout-row > .canvas-widget-list > .canvas-widget:not(.dummy-widget)").each(function(){var Au=AV(this),Ar=Au.data("widget-id"),As=Au.data("widget-instance-id")||Au.attr("data-widget-instance-id"),At={};if(As){At.widgetinstanceid=As}if(Ar){At.widgetid=Ar}if(!AV.isEmptyObject(At)){Ap.push(At)}});Al[An]["widgets"]=Ap});return Al}function V(Am){var Al=function(An){var An=AC(An);An.tab_data=g(Am);if(!AV.isEmptyObject(An)){a(Am,An)}};AM(Am,Al)}function AQ(Al){vBulletin.AJAX({call:"/ajax/api/widget/deleteWidgetInstances",data:{widgetInstanceIds:Al},success:function(Am){console.log("saveAdminConfig in saveModuleConfig() successful! removeInstances: "+JSON.stringify(Al)+" result:"+JSON.stringify(Am))},emptyResponse:function(Am){console.log("Empty response from deleteWidgetInstances after parent tab delete.")},api_error:vBulletin.ajaxtools.logApiError,})}function k(Ap,Ao,Am,Aq){var Ar=W(),An=(Ar==""||Ar==0),Al="save-new-widgetinstance-pagetemplateid-ready";if(An){if(!Ab.saveNewWidgetInstance){Ab.saveNewWidgetInstance=true}else{A.one(Al,function(As){k(Ap,Ao,Am,Aq)});return }}vBulletin.AJAX({call:"/ajax/api/widget/saveNewWidgetInstance",data:{containerinstanceid:Ap,widgetid:Ao,pagetemplateid:Ar,subWidgetConfig:Am,},success:function(As){console.log({msg:"/ajax/api/widget/saveNewWidgetInstance success!",result:As,});if(An&&As.pagetemplateid){d(As.pagetemplateid);A.trigger(Al)}if(As.widgetinstanceid){if(typeof Aq=="function"){Aq(As.widgetinstanceid)}}}})}function i(At){if(!At.data("is-tabbed-container")){return }var Ar=At.attr("data-widget-instance-id");if(!Ar){var An=s(At),Am=function(Az){console.log({msg:"added missing tabbed container widgetinstance",widgetinstanceid:Az,parentContainerinstanceid:An,});At.attr("data-widget-instance-id",Az);return i(At)};return k(An,At.attr("data-widget-id"),{},Am)}if(AV.isEmptyObject(AO)){return n(i,[At])}if(At.data("tabbed-container-initialized")){return }var Ax=At.find(".js-admin-widget-tab-panel-template"),Aw=Ax.find(".js-admin-widget-list"),Aq=At.find(".js-admin-widget-tab-header-template"),Au=At.find(".js-admin-widget-content"),Ao=Au.find(".js-tab-headers"),Ay=Ao.find(".js-tab-add"),As,Al;Ax.detach().removeClass("js-admin-widget-tab-panel-template");Aq.detach().removeClass("js-admin-widget-tab-header-template");Au.tabs({beforeActivate:function(Az,A0){if(AV(A0.newTab).hasClass("js-tab-add")){return false}},});As=Au.tabs("widget");Aw.css({minHeight:"60px",height:"auto",paddingBottom:"10px"});Ao.find(".js-tab-add").on("click",function(){var Az=function(A1){var A3=AC(A1.config),A4=A3.tab_data,A5=A4.length||0,A2=A5,A0=A1.isusereditable.tab_data||false;openPromptDialog({title:vBulletin.phrase.get("enter_tab_title"),message:"",buttonLabel:{okLabel:vBulletin.phrase.get("ok"),cancelLabel:vBulletin.phrase.get("cancel")},onClickOK:function(A6){if(!A6){return false}Ap(A6,[],A2,A2,A0);A3.display_tabs[A2]="1";A3.tab_data=g(At);if(!AV.isEmptyObject(A3)){a(At,A3)}}})};AM(At,Az,true)});Aq.find(".js-edit-tab-button").on("click",function(){var A3=AV(this),Az=A3.closest("li[aria-controls]"),A0=Az.attr("aria-controls"),A2=As.find(".js-admin-widget-tab[id='"+A0+"']"),A1=A2&&A2.data("tab-title")||"";var A4=function(A5){var A6=AC(A5),A7=A6.tab_data;openPromptDialog({title:vBulletin.phrase.get("enter_tab_title"),message:"",initialValue:A1,buttonLabel:{okLabel:vBulletin.phrase.get("ok"),cancelLabel:vBulletin.phrase.get("cancel")},onClickOK:function(A8){Az.find("span.js-tab-title").text(A8);A2.data("tab-title",A8);A6.tab_data=g(At);if(!AV.isEmptyObject(A6)){a(At,A6)}}})};AM(At,A4);return false});Aq.find(".js-remove-tab-button").on("click",function(){var A3=AV(this),A0=A3.closest("li[aria-controls]"),A1=A0.attr("aria-controls"),A2=As.find(".js-admin-widget-tab[id='"+A1+"']");var Az=function(A4){var A6=AC(A4.config),A7=A6.tab_data,A8=A7.length||0,A5=A2.data("tab-number");openConfirmDialog({title:vBulletin.phrase.get("remove_tab_q"),message:vBulletin.phrase.get("do_you_want_to_remove_tab",A2.data("tab-title")),iconType:"warning",onClickYes:function(){if(A6.default_tab==A5){A6.default_tab=0}if(!Array.isArray(A6.display_tabs)){A6.display_tabs=AV.map(A6.display_tabs,function(BA){return BA})}A6.display_tabs.splice(A5,1);var A9=[];A2.find(".canvas-widget").each(function(BA,BC){var BB=AV(this).data("widget-instance-id");if(BB){A9.push(BB)}});if(A9.length){AQ(A9)}A0.remove();A2.remove();Ao.find("li:not('.js-tab-add')").each(function(BA,BE){var BB=AV(this),BD=BB.attr("aria-controls"),BC=As.find(".js-admin-widget-tab[id='"+BD+"']");if(BC.length){BC.data("tab-number",BA)}});As.tabs("refresh");A6.tab_data=g(At);if(!AV.isEmptyObject(A6)){a(At,A6)}AA();M();t=true}})};AM(At,Az,true);return false});var Ap=function(BG,A6,BF,A9,A7){if(typeof BG=="undefined"){BG="Untitled Tab"}if(typeof A6=="undefined"){A6=[]}if(typeof BF=="undefined"){var A3=At.find(".js-admin-widget-tab");BF=A3.length}var A8=[];for(BC in A6){if(A6.hasOwnProperty(BC)){A8.push(BC)}}A8.sort(function(BI,BH){return BI-BH});var BE=A8.length,Az=Ax.clone().uniqueId().removeClass("h-hide").data("tab-number",BF).data("tab-title",BG),BD=Az.find(".js-admin-widget-list"),A1=Az.attr("id"),A2=Aq.clone(true).removeClass("h-hide");A2.children("a.js-tab-header-link").attr("href","#"+A1);A2.find("span.js-tab-title").text(BG);for(j=0;j<BE;j++){var BC=A8[j],A0=A6[BC],BA=A0.widgetid||AO[A0.guid],A5=A0.widgetinstanceid||"",A4=AV('<div data-widget-id="'+BA+'" />');A4.attr("data-tab-number",BF);A4.attr("data-widget-order",BC);A4.attr("data-widget-instance-id",A5);A4.append(AV('<img src="images/loader-box-blue.gif" /> '));BD.append(A4);if(BA){var BB=(function(BK,BI,BJ,BH){return function(BQ){BQ=BQ.filter(function(){return this.nodeType===Node.ELEMENT_NODE});if(!BJ){var BL=BK.adminconfig||{},BO=function(BT){BQ.attr("data-widget-instance-id",BT);V(At)};k(Ar,BI,BL,BO)}else{BQ.attr("data-widget-instance-id",BJ)}if(!A7){var BR=BQ.find(".js-move-button"),BM=BQ.find(".js-edit-button"),BS=BQ.find(".js-remove-button"),BN=BQ.find(".js-edit-tab-button"),BP=BQ.find(".js-remove-tab-button");BR.hide();BM.hide();BS.hide();BN.hide();BP.hide();BQ.addClass("js-widget-non-sortable")}BH.replaceWith(BQ);BQ.filter(":not(.container-widget)").find(".toggle-button").trigger("click",[true]);i(BQ)}})(A0,BA,A5,A4);Ai(A4,BB)}}Ay.before(A2);As.append(Az);As.tabs("refresh");As.tabs("option","active",A9);BD.prepend('<div class="canvas-widget dummy-widget dummy-widget--no-fixed-height"><span>{0}</span></div>'.format(vBulletin.phrase.get("drag_and_drop_modules_below")))};var Av=function(A5){var A1=AC(A5.config),A9=A1.tab_data,A7=A9.length,A8=A1.default_tab,A2=A5.isusereditable.tab_data||false;for(var A4=0;A4<A7;A4++){Ap(A9[A4].title,A9[A4].widgets,A4,A8,A2)}if(A2){var A0,A3,Az,A6;Ao.sortable({helper:"clone",opacity:1,axis:"x",items:"li:not('.js-tab-add')",cancel:".js-edit-tab-button, .js-remove-tab-button",start:function(){old_numidx_to_controls={};new_controls_to_numidx={};As.find(".js-admin-widget-tab").each(function(BA,BB){old_numidx_to_controls[BA]=AV(this).attr("id")})},stop:function(){Ao.find("li:not('.js-tab-add')").each(function(BB,BF){var BC=AV(this),BE=BC.attr("aria-controls"),BD=As.find(".js-admin-widget-tab[id='"+BE+"']");if(BD.length){BD.data("tab-number",BB);As.append(BD)}new_controls_to_numidx[BE]=BB});As.tabs("refresh");var BA=function(BB){A8=new_controls_to_numidx[old_numidx_to_controls[A8]];BB.default_tab=A8;var BE={};for(var BF in BB.display_tabs){var BC=new_controls_to_numidx[old_numidx_to_controls[BF]],BD=BB.display_tabs[BF];BE[BC]=BD}BB.display_tabs=BE;BB.tab_data=g(At);if(!AV.isEmptyObject(BB)){a(At,BB)}};AM(At,BA)},})}else{Ay.hide()}};AM(At,Av,true);At.data("tabbed-container-initialized",true)}function I(Am,An){var Al=AV(".js-canvas-layout-container > .canvas-layout").attr("id");if(!vBulletin.sitebuilder.tempModuleHTMLCache){vBulletin.sitebuilder.tempModuleHTMLCache={};AV(".js-canvas-layout-container .canvas-widget").each(function(){var Ao=AV(this).data("widget-instance-id");vBulletin.sitebuilder.tempModuleHTMLCache["widgetinstance_"+Ao]=this.outerHTML})}AV(".js-canvas-layout-container").text("");vBulletin.AJAX({call:"/ajax/get-layouts-for-sitebuilder",data:{pagetemplateid:pageData.pagetemplateid,channelid:pageData.channelid},success:function(Ao){console.log("ajax/get-layouts-for-sitebuilder result:");console.dir(Ao);var Ap=AV(".js-canvas-layout-container");Ap.html(Ao.screenlayoutlist);if(Ao.widgets&&Ao.widgets.length>0){var Aq=AV("#"+Al);AV.each(Ao.widgets,function(Ar,As){var At=Aq.find(".canvas-widget-list.section-"+Ar);AV.each(As,function(Au,Aw){At.append(Aw.rendered_template);var Av=At.find(".canvas-widget").filter(function(){return AV(this).data("widget-instance-id")==Aw.widgetinstanceid});if(typeof Aw.subModules!="undefined"){AW(Av,Aw.subModules)}i(Av)})})}if(vBulletin.inlinemod&&vBulletin.inlinemod.initModMenuHover){vBulletin.inlinemod.initModMenuHover()}if(typeof An=="function"){An()}},title_phrase:"sitebuilder",error_phrase:"unable_to_load_layouts"})}function L(An,Ap){var Al=Ap.enableButtons,Ao=AV(".js-top-menu-sitebuilder--list .js-top-menu-link");if(Al){AV(".js-top-menu-user").removeClass("h-hide");Ao.removeClass("b-top-menu__item-link--selected b-top-menu__item-link--disabled")}else{var Am=AV(Ap.currentButton);Ao.removeClass("b-top-menu__item-link--selected").addClass("b-top-menu__item-link--disabled");Am.addClass("b-top-menu__item-link--selected");AV(".js-top-menu-user").addClass("h-hide")}}AV(document).on("vb-toggle-sitebuilder-menu",L);function Ag(Ao){var An=AV(Ao.target),Al=An.data("panel-name");if(An.is(".b-top-menu__item-link--disabled")){this.blur();Ao.stopPropagation();return false}if(An.is(".js-top-menu-tab--admincp")){return true}var Am="vb-sitebuilder-panel--"+Al;AV(document).trigger(Am);return false}AV(document).on("click",".js-top-menu-sitebuilder--list .js-top-menu-link",Ag);function AX(An,Am){var Al=AV(".js-top-menu-sitebuilder .js-top-menu-link");L(null,{enableButtons:!Am,currentButton:An});AV(document.body).toggleClass("edit-mode "+An.id,Am).toggleClass("view-mode",!Am);AV(".js-top-menu-user").toggleClass("h-hide",Am)}function e(){if(!AV(this).hasClass("selected")&&!AV(document.body).hasClass("edit-mode")){AX(this,true)}return false}vBulletin.sitebuilder.activateSB=e;function D(){AX(this,false);return false}function Z(An,Am){var Al=AV("<div />").append(An.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,'<span class="axd-placeholder">{0}'.format(vBulletin.phrase.get("x_will_show_up_here_when_saved",Am))).replace(/<vb\:/g,"&lt;vb:").replace(/<\/vb\:/g,"&lt;/vb:"));Al.find("span.axd-placeholder").not(":first").remove();Al.find("iframe").remove();return Al.html()}function AT(){var Ao=null,Am=null,A1=null,A2="",Ay="",Aw="",Ar="";var A0=function(A3){if(!A3){A3=""}if(A3.match(/^https?:\/\//i)){return A3}if(A3.substr(0,1)=="/"){return pageData.baseurl+A3}return pageData.baseurl+"/"+A3};var An=function(A9,A5,A6,A8,A3,A4){A3=A3||[];console.log("createNavbarItem... Name: "+A5+" Url: "+A6+" NewWindow: "+A8+" UserGroups: "+A3+" itemAttr: "+A4);A5=JShtmlEncode(A5);var A7=AV("<li />").append("<label>{0}</label>".format(A5)).append(AV("<div />").addClass("nav-item-controls h-right").append('<i>|</i><span class="navbar-item-delete b-icon b-icon__trash b-icon--active" title="{0}"></span>'.format(vBulletin.phrase.get("delete"))).append('<i>|</i><span class="navbar-item-edit b-icon b-icon__pencil b-icon--active" title="{0}"></span>'.format(vBulletin.phrase.get("edit"))).append('<i>|</i><span class="navbar-item-opensubnav b-icon b-icon__arrow-right-m" title="{0}"></span>'.format(vBulletin.phrase.get("expand")))).data({"item-phrase":A9,"item-name":A5,"item-url":A6,"item-newwindow":A8,"item-usergroups":A3,"item-attr":A4});return A7};var Aq=function(A3){return A3.prevAll("li").size()};var Ax=function(){var A4=(Ar=="navbar"),A3=A4?AV("#channel-tabbar ul"):AV("#footer-tabbar ul.nav-list"),A5=A4?AV("#channel-subtabbar ul"):AV();A3.html("");A5.html("");var A6=function(BC,BA,A7){var A9=BA.data("item-newwindow")?' target="_blank"':"",BB=BA.hasClass("selected")&&A7?' class="current"':"",A8=AV("<li{0}><a {1}>{2}</a></li>".format(BB,A9,BA.data("item-name")));A8.find("a").prop("href",A0(BA.data("item-url")));BC.append(A8)};AV("#edit-navbar .navbar-ui-wrapper ul li").each(function(){var A7=AV(this);A6(A3,A7,A4);if(A7.hasClass("selected")){AV(A7.data("subnav-element")).find("li").each(function(){A6(A5,AV(this),true)})}})};var Ap=function(A9,BB,A4,A5,A7,BA,A6){var A3=An(A9,BB,A4,A5,A7,A6);console.log("insertNavbarItem... Name: "+A3.data("item-name")+" Url: "+A3.data("item-url")+" NewWindow: "+A3.data("item-newwindow")+" UserGroups: "+A3.data("item-usergroups")+" itemAttr: "+A3.data("item-attr"));A3.appendTo(Am);var A8=AV("<ul />").addClass("sub-navbar-list navbar-list sortable");AV(BA).each(function(){var BI=this.phrase?this.phrase:"",BD=this.title?this.title:"",BG=this.url?this.url:"",BH=this.newWindow?this.newWindow:false,BC=this.usergroups?this.usergroups:[],BF=this.attr?this.attr:"";var BE=An(BI,BD,BG,BH,BC,BF);BE.appendTo(A8)});(function(){var BC=null;A8.sortable({start:function(BD,BE){BE.placeholder.html(vBulletin.phrase.get("drop_page_here")).height(BE.item.height()-2)},stop:function(BD,BE){Ax()},receive:function(BD,BE){var BF=BE.item.data("subnav-element")||AV();if(BF.is(":visible")){BE.sender.sortable("cancel");vBulletin.warning("move_not_allowed","moving_main_nav_to_own_sub_nav_error")}else{if(BF.find("li").length>0){BE.sender.sortable("cancel");vBulletin.warning("move_not_allowed","moving_main_nav_with_sub_nav_error")}}},connectWith:".sortable",placeholder:"sortable-highlight",forcePlaceholderSize:true}).disableSelection()})();A8.hide();A8.appendTo("#navbar-ui-container .subnavbar-list-container");A3.data("subnav-element",A8);Ax()};var At=function(A4,A6,A7,A8,A3,A5){$newItem=An(A4.data("item-phrase"),A6,A7,A8,A3,A5);console.log("updateNavbarItem... Name: "+$newItem.data("item-name")+" Url: "+$newItem.data("item-url")+" NewWindow: "+$newItem.data("item-newwindow")+" itemAttr: "+$newItem.data("item-attr"));if(A4.data("subnav-element")){$newItem.data("subnav-element",A4.data("subnav-element"))}if(A4.hasClass("selected")){$newItem.addClass("selected")}A4.replaceWith($newItem);Ax()};var Az=function(A4){Ar=A4;if(Ar=="navbar"){A2=AV("#channel-tabbar ul").html();Ay=AV("#channel-subtabbar ul").html();Aw=AV("#channel-tabbar ul li.current a").attr("href");AV("#channel-subtabbar.h-hide").toggleClass("h-hide default-hide")}else{A2=AV("#footer-tabbar ul.nav-list").html();Aw=AV("#footer-tabbar ul.nav-list li.current a").attr("href")}AV("#admin-navbar-strip-gutter").removeClass().addClass("navbar-"+Ar);AV("#header").add("#header-axd").hide();AV("#navbar-ui-container").find(".navbar-ui-wrapper, .subnavbar-ui-wrapper").remove();var A3=AV("#edit-navbar");A3.find(".panel-header-text").hide();AV("#edit-navbar #panel-header-"+Ar).show();A3.slideDown("slow",function(){vBulletin.AJAX({call:"/ajax/api/site/"+(Ar=="navbar"?"loadHeaderNavbar":"loadFooterNavbar"),data:({siteId:1,edit:1}),success:function(A5){var A8=AV("<ul />").addClass("main-navbar-list navbar-list sortable "+Ar),A7=AV("<div />").addClass("new-nav-item main-nav").html(vBulletin.phrase.get("new_navigation_item")),A6=AV("<h4 />").text(vBulletin.phrase.get("main_navigation_bar"));AV("<div />").addClass("navbar-ui-wrapper").append(A6).append(A8).append(A7).appendTo("#navbar-ui-container");var BB=null;A8.sortable({start:function(BD,BE){BE.placeholder.html(vBulletin.phrase.get("drop_page_here")).height(BE.item.height()-2)},stop:function(BD,BE){Ax()},connectWith:".sortable",placeholder:"sortable-highlight",forcePlaceholderSize:true}).disableSelection();Am=A8;var BC=AV("<div />").addClass("subnavbar-list-container"),BA=AV("<div />").addClass("new-nav-item sub-nav").html(vBulletin.phrase.get("new_subnavigation_item")),A9=AV("<h4 />").text(vBulletin.phrase.get("sub_navigation_bar"));AV("<div />").addClass("subnavbar-ui-wrapper").append(A9).append(BC).append(BA).appendTo("#navbar-ui-container").hide();if(A5){console.log("result:",A5);AV(A5).each(function(){var BJ=this.phrase?this.phrase:"",BE=this.title?this.title:"",BH=this.url?this.url:"",BI=this.newWindow?true:false,BD=this.usergroups?this.usergroups:[],BG=this.subnav?this.subnav:[],BF=this.attr?this.attr:"";Ap(BJ,BE,BH,BI,BD,BG,BF)})}AV("#edit-navbar .navbar-ui-wrapper ul li").first().find(".navbar-item-opensubnav").filter(":visible").click()},error_phrase:"error_retrieving_navigation_bar_configuration"})})};AV(document).on("vb-sitebuilder-panel--navbar",function(){var A3=AV(".js-top-menu-tab--navbar").get(0);if(AV("#edit-navbar").is(":hidden")){vBulletin.assertUserHasAdminPermission("canusesitebuilder",A3,function(){e.apply(A3);Az("navbar")})}return false});AV(document).on("vb-sitebuilder-panel--footer",function(){var A3=AV(".js-top-menu-tab--footer").get(0);if(AV("#edit-navbar").is(":hidden")){vBulletin.assertUserHasAdminPermission("canusesitebuilder",A3,function(){e.apply(A3);Az("footer")})}return false});var Al=function(A3){AV("#navbar-edit-item").dialog({autoOpen:true,modal:true,resizable:false,closeOnEscape:false,showCloseButton:false,width:400,dialogClass:"dialog-container navbar-item-dialog-container",open:function(){AV("#navbar-edit-name").focus()}}).dialog("option","title",A3||vBulletin.phrase.get("edit_navigation_item")).dialog("open")};AV("#edit-navbar").on("click",".new-nav-item",function(){Ao=null;if(AV(this).closest(".navbar-ui-wrapper").size()>0){Am=AV(this).closest(".navbar-ui-wrapper").find("ul")}else{Am=AV(this).closest(".subnavbar-ui-wrapper").find("ul").filter(":visible")}AV("#navbar-edit-name").val("");AV("#navbar-edit-url").val("");AV("#navbar-edit-attr").val("");AV("#navbar-edit-newwindow").prop("checked",false);Al(AV(this).html());return false});AV(document).on("click","#navbar-edit-save",function(){if(AV("#navbar-edit-name").val()==""){vBulletin.warning("edit_navigation_item","input_navigation_item_name",function(){AV("#navbar-edit-name").focus()})}else{if(AV("#navbar-edit-url").val()==""){vBulletin.warning("edit_navigation_item","input_target_url",function(){AV("#navbar-edit-url").focus()})}else{console.log("Saving new/edited navbar item");if(!Ao){Ap("",AV("#navbar-edit-name").val(),AV("#navbar-edit-url").val(),AV("#navbar-edit-newwindow").prop("checked"),AV("#navbar-edit-item").data("edit-usergroups"),[],AV("#navbar-edit-attr").val())}else{At(Ao,AV("#navbar-edit-name").val(),AV("#navbar-edit-url").val(),AV("#navbar-edit-newwindow").prop("checked"),AV("#navbar-edit-item").data("edit-usergroups"),AV("#navbar-edit-attr").val())}Ao=null;Am=null;AV("#navbar-edit-item").dialog("close");console.log("Done saving new/edited navbar item")}}return false});AV(document).on("click","#navbar-edit-cancel",function(){AV("#navbar-edit-item").dialog("close");return false});var As=false;AV(document).on("click","#navbar-edit-usergroups",function(){var A4=function(){var A8=AV("#navbar-edit-usergroups-dialog .select_all"),A5=AV("#navbar-edit-usergroups-dialog .navbar-usergroup-checkbox");A5.prop("checked",false);var A6=function(){var A9=(A5.filter(":checked").length==A5.length&&A5.eq(0).is(":checked"));A8.prop("checked",A9)};A5.off("change").on("change",A6);A8.off("change").on("change",function(){A5.prop("checked",AV(this).prop("checked"))});if(!Ao){return false}console.log("Prefilling checked usergroups");console.log(Ao.data("item-name"));console.log(Ao.data("item-url"));console.log(Ao.data("item-usergroups"));if(Ao.data("item-usergroups-temp")){var A7=Ao.data("item-usergroups-temp")}else{var A7=Ao.data("item-usergroups")}console.log(A7);AV.each(A7,function(A9,BA){AV("#navbar-usergroup-checkbox-"+BA).prop("checked",true)});A6()};var A3=function(){var A5=[];AV("#navbar-edit-usergroups-dialog .dialog-body input[type=checkbox]").each(function(){if(AV(this).prop("checked")){A5.push(AV(this).val())}});AV("#navbar-edit-item").data("edit-usergroups",A5);if(Ao){Ao.data("item-usergroups-temp",A5)}console.log("Saving checked usergroups")};if(!As){AV("#navbar-edit-usergroups-dialog").dialog({title:vBulletin.phrase.get("user_group_settings"),autoOpen:true,modal:true,resizable:false,closeOnEscape:false,showCloseButton:false,width:500,dialogClass:"dialog-container pagemap-dialog-container input-dialog",create:function(){AV("#navbar-edit-usergroups-dialog .cancel-button").on("click",function(){AV("#navbar-edit-usergroups-dialog").dialog("close")});AV("#navbar-edit-usergroups-dialog .save-button").on("click",function(){A3();AV("#navbar-edit-usergroups-dialog").dialog("close")});vBulletin.AJAX({call:"/ajax/api/usergroup/fetchUsergroupList",complete:function(){AV("body").css("cursor","auto")},success:function(A5){var A6=[];AV(A5).each(function(){A6.push('<div class="blockrow"><label><input type="checkbox" class="navbar-usergroup-checkbox" id="navbar-usergroup-checkbox-{0}" value="{0}"><span>{1}</span></label></div>'.format(this.usergroupid,this.title))});AV("#navbar-edit-usergroups-dialog .dialog-body").html(A6.join(""));AV("#navbar-edit-usergroups-dialog").dialog("option","position",{of:window});console.log("Done adding usergroups");A4()},error_phrase:"error_retrieving_list_user_groups",after_error:function(){AV("#navbar-edit-usergroups-dialog").dialog("close")}})},close:function(){},open:function(){A4()}});As=true}else{AV("#navbar-edit-usergroups-dialog").dialog("open")}return false});AV("#edit-navbar").on("click",".navbar-item-delete",function(){AV(this).closest("li").remove();Ax();return false});AV("#edit-navbar").on("click",".navbar-item-edit",function(){var A3=AV(this).closest("li");console.log("Click to edit item... Name: "+A3.data("item-name")+" Url: "+A3.data("item-url")+" NewWindow: "+A3.data("item-newwindow")+" UserGroups: "+A3.data("item-usergroups"));Ao=A3;Am=A3.closest("ul");Ao.data("item-usergroups-temp",null);AV("#navbar-edit-name").val(A3.data("item-name"));AV("#navbar-edit-url").val(A3.data("item-url"));AV("#navbar-edit-attr").val(A3.data("item-attr"));AV("#navbar-edit-newwindow").prop("checked",A3.data("item-newwindow"));Al(AV(this).html());return false});AV("#edit-navbar").on("click",".navbar-item-opensubnav",function(){var A5=AV(this),A6=A5.closest("li"),A4=AV("#edit-navbar"),A3=A4.find(".subnavbar-ui-wrapper");console.log("Click to open item subnav ... Name: "+A6.data("item-name")+" Url: "+A6.data("item-url")+" NewWindow: "+A6.data("item-newwindow")+" UserGroups: "+A6.data("item-usergroups"));A4.find("li").removeClass("h-disabled selected");A4.find(".navbar-item-opensubnav").removeClass("b-icon--active");A6.addClass("selected");A5.addClass("b-icon--active");A3.find("ul").hide();AV(A6.data("subnav-element")).show();A3.show();Ax();return false});AV(document).on("click",".navbar-navbar #admin-navbar-strip .lnkExitWithoutSaving, .navbar-footer #admin-navbar-strip .lnkExitWithoutSaving",function(){AV("#edit-navbar").slideUp();AV("#header").add("#header-axd").show();if(Ar=="navbar"){AV("#channel-tabbar ul").html(A2);AV("#channel-subtabbar ul").html(Ay).parent(".default-hide").toggleClass("h-hide default-hide")}else{AV("#footer-tabbar ul.nav-list").html(A2)}});var Au=function(){var A3=[];AV("#edit-navbar .navbar-ui-wrapper ul li").each(function(){var A7=AV(this);var A5=function(A8){return{phrase:A8.data("item-phrase"),title:A8.data("item-name"),url:A8.data("item-url"),newWindow:A8.data("item-newwindow"),usergroups:A8.data("item-usergroups"),attr:A8.data("item-attr")}};var A6=[];A7.data("subnav-element").find("li").each(function(){$subLi=AV(this);A6.push(A5($subLi))});var A4=A5(A7);A4.subnav=A6;A3.push(A4)});vBulletin.AJAX({call:"/ajax/api/site/"+(Ar=="navbar"?"saveHeaderNavbar":"saveFooterNavbar"),data:({siteId:1,data:A3}),success:function(A5){AV("#edit-navbar").slideUp();AV("#header").add("#header-axd").show();AV("#admin-navbar-strip-gutter").addClass("h-hide");AV(document.body).removeClass("edit-mode lnkEditPage lnkNewPage lnkHeader lnkNavBar lnkFooter").addClass("view-mode");L(null,{enableButtons:true,currentButton:null});if(Ar=="navbar"){var A4=false;AV("#edit-navbar .navbar-ui-wrapper ul li").each(function(){var A6=AV(this);if(A0(A6.data("item-url"))==A0(Aw)){A4=true;AV("#edit-navbar .navbar-ui-wrapper ul li").removeClass("selected");A6.addClass("selected");return false}});if(A4){Ax()}else{AV("#channel-tabbar ul li").removeClass("current");AV("#channel-subtabbar ul").html("")}}},error_phrase:"error_saving_navigation_bar_configuration"})};var Av="#admin-navbar-strip .lnkSaveChanges";AV(document).on("click",".navbar-navbar "+Av+", .navbar-footer "+Av,function(){Au()})}function AL(){bindFormReset("#edit-page-dropdown form").trigger("reset",function(){AV("#save-content .template-name").addClass("h-hide");AV("input[type=hidden]",this).each(function(){this.value=this.defaultValue})});AV(".js-top-menu-sitebuilder--list .js-top-menu-link").removeClass("b-top-menu__item-link--disabled");AV(document).on("click","#sitebuilder-wrapper .lnkExitWithoutSaving",function(){if(AV(this).closest("#edit-page-dropdown").length==0){L(null,{enableButtons:true,currentButton:null})}});AV(document).on("vb-sitebuilder-panel--channels",function(){var As=AV(".js-top-menu-tab--channels").get(0);vBulletin.assertUserHasAdminPermission("canusesitebuilder",As,function(){e.apply(As);Y(false);AV(".edit-mode .canvas-widget-list .canvas-widget").addClass("shadow");AV("#header, #header-axd, #save-content").hide();AV("#manage-page").show();AV("#edit-page-dropdown .lnkDeletePage").removeClass("h-hide");AV("#manage-page-dropdown").removeClass("h-hide").slideDown("slow",AE)});return false});function Aq(){var As=AV(".js-sbpanel-pagelist-wrapper");As.find(".tab-item a").on("click",function(At){At.preventDefault()});As.tabs()}function Ap(){var Av=AV(".js-sbpanel-pagelist-wrapper"),At=Av.find(".js-delayed-template-render-insert-here"),Au=Av.find(".js-loading-placeholder"),As={};Av.find(".js-simple-pagination-wrapper").each(function(){var Aw=AV(this);As[Aw.attr("id")]=Aw.find(".js-pagenum").val()||0});Av.tabs("disable");At.html("");Au.removeClass("h-hide");vBulletin.AJAX({call:"/ajax/render/admin_sbpanel_pagelist_content_wrapper",data:{isAjaxTemplateRenderWithData:true},success:function(Aw){At.html(Aw.template);Av.tabs("refresh");Av.tabs("enable");Av.find(".js-simple-pagination-wrapper").each(function(){var Ax=AV(this);Ao(Ax,As[Ax.attr("id")]);Al(Ax);Ar(Ax)})},error_phrase:"error_fetching_dialog",complete:function(){Au.addClass("h-hide")}})}AV(document).on("vb-sitebuilder-panel--pages",function(){var As=AV(".js-top-menu-tab--pages").get(0),At=AV(".js-sbpanel-pagelist-wrapper");if(!At.data("panel-initialized")){At.data("tabspanel-initialized",true);Aq()}vBulletin.assertUserHasAdminPermission("canusesitebuilder",As,function(){if(At.hasClass("h-hide")){e.apply(As);At.removeClass("h-hide").slideDown("slow");Ap()}else{D.apply(As);At.slideUp("fast",function(){At.addClass("h-hide")})}});return false});AV(document).on("click",".js-sbpanel-pagelist-wrapper .js-button--close-panel",function(){var As=AV("#lnkPageList")[0],At=AV(".js-sbpanel-pagelist-wrapper");if(!At.hasClass("h-hide")){D.apply(As);At.slideUp("fast",function(){At.addClass("h-hide")})}});function Al(At){var As=At.data("select-all-checkboxes-initialized")||false;if(As){console.log({msg:"Skipping checkbox init because it's already done.",$wrapper:At,});return }else{At.data("select-all-checkboxes-initialized",true)}At.find(".js-checkbox--checkall").each(function(){var Au=AV(this),Aw=Au.data("group-id"),Ay=At.find(".js-checkbox[data-group-id='"+Aw+"']"),Ax=Ay.length,Av=Ay;Au.on("change",function(Az){var A0=AV(this).prop("checked");Au.prop("indeterminate",false);if(A0){Ay.prop("checked",true)}else{Ay.prop("checked",false)}});Ay.on("change",function(Az){var A1=AV(this).prop("checked"),A0=Ay.filter(":checked").length;if(Ax>A0){if(Au.prop("checked")&&A0>0){Au.prop("indeterminate",true)}Au.prop("checked",false)}else{Au.prop("indeterminate",false);Au.prop("checked",true)}})})}function Ar(At){var As=At.data("actions-initialized")||false;if(As){console.log({msg:"Skipping actions init because it's already done.",$wrapper:At,});return }else{At.data("actions-initialized",true)}At.find(".js-delete-orphaned-pagetemplates").on("click",function(Au){var Ay=AV(this),Aw=Ay.data("group-id"),Av=At.find(".js-checkbox[data-group-id='"+Aw+"']:checked"),Ax={};Av.each(function(){Ax[this.name]=AV(this).val()});if(Av.length<1){vBulletin.error("error","delete_orphaned_pagetemplates_please_select_one")}else{openConfirmDialog({title:vBulletin.phrase.get("delete"),message:vBulletin.phrase.get("delete_orphaned_pagetemplates_prompt_x",Av.length),iconType:"warning",onClickYes:function(){vBulletin.AJAX({call:"/ajax/api/page/deleteOrphanedPagetemplates",data:Av.serializeArray(),success:function(Az){console.log({msg:"/ajax/api/widget/deleteOrphanedPagetemplates success!",result:Az,});Ap()}})}})}})}function Ao(Ax,Ay){var Av=Ax.data("pagination-initialized")||false;if(Av){console.log({msg:"Skipping pagination init because it's already done.",$wrapper:Ax,});return }else{Ax.data("pagination-initialized",true)}var As=Ax.find(".js-pagenav-goprev");var Az=Ax.find(".js-pagenav-gopost");var At=Ax.find(".js-pagenum");var Ay=(Ay&&parseInt(Ay,10))||parseInt(At.val(),10);var A0=Ax.find(".js-paginated-page");var Aw={};var A1=0;A0.each(function(){A1++;Aw[A1]=AV(this)});At.on("blur keyup",function(A3){if(A3.type=="blur"||A3.keyCode=="13"){var A2=parseInt(At.val(),10);Au(A2)}});As.on("click",function(A3){var A2=parseInt(At.val(),10);A2--;Au(A2)});Az.on("click",function(A3){var A2=parseInt(At.val(),10);A2++;Au(A2)});function Au(A2){if(A2<1){A2=1}if(A2>A1){A2=A1}A0.addClass("h-hide");if(Aw[A2]){Aw[A2].removeClass("h-hide")}At.val(A2)}Au(Ay)}AV(document).on("vb-sitebuilder-panel--editpage",function(){var As=AV(".js-top-menu-tab--editpage").get(0);if(AV("#edit-page-dropdown-gutter").is(":hidden")){vBulletin.assertUserHasAdminPermission("canusesitebuilder",As,function(){function At(){u=false;Au();M();Y(false,".container-widget");AV(".edit-mode .canvas-widget-list .canvas-widget").addClass("shadow");f.tabs("option","active",0);AV("#header, #header-axd, #save-content").hide();AV("#edit-content").show();AV("#edit-page-dropdown .lnkSaveChanges .label").text(vBulletin.phrase.get("save_page"));AV("#edit-page-dropdown .lnkDeletePage").removeClass("h-hide");AV("#edit-page-dropdown-gutter").removeClass("h-hide").slideDown("slow",Q);AV(".canvas-widget.axd-widget .widget-content").each(function(){AV(this).html(Z(AV(this).html(),vBulletin.phrase.get("ad")))})}function Au(){var Av=[];AV(".hidden-widget-placeholder").each(function(){Av.push(AV(this).attr("data-widget-instance-id"))});if(Av.length<1){return }vBulletin.AJAX({call:"/ajax/fetch-hidden-modules",data:({modules:Av}),complete:function(){At()},success:function(Aw){if(Aw.length>0){AV.each(Aw,function(Ax,Az){var Ay=AV(Az.template).addClass("hidden-widget");AV('.hidden-widget-placeholder[data-widget-instance-id="'+Az.widgetinstanceid+'"]').replaceWith(Ay)})}}})}e.apply(As);I(false,At)})}return false});AV(document).on("vb-sitebuilder-panel--newpage",function(){var As=AV(".js-top-menu-tab--newpage").get(0);if(AV("#edit-page-dropdown-gutter").is(":hidden")){vBulletin.assertUserHasAdminPermission("canusesitebuilder",As,function(){function At(){u=true;AV(".canvas-widget-list").empty();f.tabs("option","active",0);AV("#change-layout .layout-border.selected").removeClass("selected");AV("#layout-wide-narrow").prev().trigger("click");t=false;AV("#header, #header-axd, #save-content").hide();AV("#edit-content").show();AV("#edit-page-dropdown .lnkSaveChanges .label").text(vBulletin.phrase.get("save_new_page"));AV("#edit-page-dropdown .lnkDeletePage").addClass("h-hide");AV("#edit-page-dropdown-gutter").removeClass("h-hide").slideDown("slow",Q)}e.apply(As);I(true,At)})}return false});var An=false;AV(document).on("vb-sitebuilder-panel--header",function(){var As=AV(".js-top-menu-tab--header").get(0);if(AV("#admin-navbar-strip-gutter").is(":hidden")){vBulletin.assertUserHasAdminPermission("canusesitebuilder",As,function(){e.apply(As);An=false;AV("#admin-navbar-strip-gutter").addClass("navbar-header").removeClass("h-hide").find(".prompt-text").text(vBulletin.phrase.get("select_edit_link_header"));var At=AV("#header"),Au=AV(".header-cell",At);$siteLogoEditStrip=AV("> .admin-only",Au).addClass("h-hide-imp"),w=Au.outerWidth();AV(".disable-overlay",At).width(At.innerWidth()-w).height(At.innerHeight()).show();$siteLogoEditStrip.width(w-(parseInt($siteLogoEditStrip.css("padding-left"),10)+parseInt($siteLogoEditStrip.css("padding-right"),10))).removeClass("h-hide-imp");AV(document).on("focus click mousedown",".edit-mode.lnkHeader #header .site-logo > a",function(Av){this.blur();Av.stopPropagation();return false})})}return false});AT();AV(".js-top-menu-sitebuilder").removeClass("h-hide");AV(document).on("click",".lnkHeader #admin-navbar-strip .lnkSaveChanges",function(){AV("body").css("cursor","wait");if(Number(AV("#header .site-logo img").attr("data-fileid"))>0){var As=An?function(){location.reload(true)}:null;AI(As)}else{if(An){location.reload(true)}else{AV("body").css("cursor","auto");AV("#admin-navbar-strip-gutter").addClass("h-hide").find(".prompt-text").text("");AV(document.body).removeClass("edit-mode lnkHeader").addClass("view-mode");AV("#header .disable-overlay").hide();L(null,{enableButtons:true,currentButton:null})}}});AV(document).on("click",".lnkHeader #admin-navbar-strip .lnkExitWithoutSaving",function(At){if(An){At.stopImmediatePropagation();location.reload(true);return false}else{var As=AV("#header .site-logo img");if(As.attr("src")!=As.attr("data-orig-src")){As.attr("src",As.attr("data-orig-src")).removeAttr("data-fileid")}AV("#admin-navbar-strip-gutter").find(".prompt-text").text("");AV("#header .disable-overlay").hide();L(null,{enableButtons:true,currentButton:null})}});AV(document).on("click","#admin-navbar-strip .lnkExitWithoutSaving",function(){AV("#admin-navbar-strip-gutter").addClass("h-hide");AV(document.body).removeClass("edit-mode lnkEditPage lnkNewPage lnkHeader lnkNavBar lnkFooter").addClass("view-mode");AV("#header").add("#header-axd").show();AV("#edit-navbar").hide();L(null,{enableButtons:true,currentButton:null})});AV("#header-axd .axdnum").change(function(){var As=AV(this),At=parseInt(As.val());window.vBulletin.loadingIndicator.show();vBulletin.AJAX({call:"/ajax/api/ad/saveNumberOfHeaderAds",data:{number:At},success:function(Au){if(At==1){AV("#header-axd").removeClass("axdnum_2").addClass("axdnum_1")}else{AV("#header-axd").removeClass("axdnum_1").addClass("axdnum_2")}},complete:function(){window.vBulletin.loadingIndicator.hide()}})});AV(document).off("click",".axd-edit-button").on("click",".axd-edit-button",function(){var At=AV(this).attr("data-location"),Ay=AV(this).closest(".axd-container");if(Ay.length==0){Ay=AV('.axd-container[data-widget-instance-id="'+At+'"]')}Ax();function Ax(Az){Az=Az||false;AV("body").css("cursor","wait");vBulletin.AJAX({call:"/ajax/api/ad/listAdsByLocation",data:{adlocation:At},cache:false,success:Au,emptyResponse:function(){if(!Az){Av({adlocation:At})}else{Au([])}},complete:function(){AV("body").css("cursor","default")}})}function Au(Az){if(typeof h.axd_list_dialog=="undefined"){vBulletin.AJAX({call:"/ajax/render/dialog_axd_list",success:function(A0){h.axd_list_dialog=A0;AV("body").append(A0);Au(Az)},error_phrase:"error_fetching_dialog"});return }AV("#axd-list-dialog").dialog({title:vBulletin.phrase.get("manage_ads"),autoOpen:true,modal:true,resizable:false,closeOnEscape:false,showCloseButton:false,width:600,dialogClass:"dialog-container ad-list-dialog-container input-dialog",open:function(){var A0=AV(this),A2=[];var A3=function(){A0.dialog("close");A0.dialog("destroy")};for(var A1 in Az){A2.push([Az[A1].title,Az[A1].active,Az[A1].displayorder,Az[A1].adid])}AV(".title",A0).text(vBulletin.phrase.get("ad_list_description"));AV(".axdtable",A0).dataTable({bPaginate:false,bLengthChange:false,bInfo:false,bAutoWidth:false,bDestroy:true,aaSorting:[[2,"asc"]],aoColumns:[{sTitle:vBulletin.phrase.get("title")+"<span></span>",sClass:"axdtable-title axd-cell"},{sTitle:vBulletin.phrase.get("active"),sClass:"axdtable-active axd-cell",bSortable:false,bSearchable:false,fnRender:function(A5,A4){return'<input type="checkbox" class="isactive" data-id="{0}"{1} />'.format(A5.aData[3],((A4=="1")?' checked="checked"':""))}},{sTitle:vBulletin.phrase.get("display_order")+"<span></span>",sClass:"axdtable-display-order axd-cell",bSearchable:false,bUseRendered:false,fnRender:function(A5,A4){return'<input type="text" class="displayorder textbox" value="{0}" data-id="{1}" />'.format(A5.aData[2],A5.aData[3])}},{sTitle:vBulletin.phrase.get("action"),sClass:"axdtable-action axd-cell",bSearchable:false,bSortable:false,bUseRendered:false,fnRender:function(A5,A4){return'<a href="#" class="editlink" data-id="{0}" title="{1}"><span></span></a> <a href="#" class="deletelink" data-id="{0}" title="{2}"><span></span></a>'.format(A5.aData[3],vBulletin.phrase.get("edit"),vBulletin.phrase.get("delete"))}}],aaData:A2});AV(".dataTables_filter input[type=text]",A0).addClass("axdfilter textbox").on("keyup",function(){AV(this).next()[this.value!=""?"removeClass":"addClass"]("h-hide")}).after('<button type="button" class="axdSearchBtn b-button b-button--secondary b-button--sitebuilder h-hide">{0}</button>'.format(vBulletin.phrase.get("reset")));AV(".axdSearchBtn",A0).on("click",function(){AV(this).addClass("h-hide").prev().val("").trigger("keyup")});AV(".axdtable .editlink",A0).off("click").on("click",function(){var A4=AV(this).attr("data-id");A3();Av(Az[A4]);return false});AV(".axdtable .deletelink",A0).off("click").on("click",function(){var A4=AV(this).attr("data-id"),A5=AV(this).closest("tr").find(".isactive").prop("checked");A3();openConfirmDialog({title:vBulletin.phrase.get("confirm_deletion_x",Az[A4].title),message:vBulletin.phrase.get("are_you_sure_want_to_delete_ad_x",Az[A4].title,"adid",A4),iconType:"warning",onClickYes:function(){AV("body").css("cursor","wait");vBulletin.AJAX({call:"/ajax/api/ad/delete",data:{adid:A4},success:function(A6){Ax(true);if(A5){An=true}}})},onClickNo:function(){Ax()}});return false});AV(".axdlist",A0).show();AV(".btnAddAxd",A0).off("click").on("click",function(){A3();Av({adlocation:At});return false});AV(".btnCancelAxd",A0).off("click").on("click",function(){A3()});AV(".btnSaveAxd",A0).off("click").on("click",function(){if(AV(".isactive",A0).length==0){A3();return false}AV("body").css("cursor","wait");var A4={},A5=[];AV(".isactive",A0).each(function(){var A6=AV(this).attr("data-id");A4[A6]={};A4[A6]["displayorder"]=AV('.displayorder[data-id="'+A6+'"]',A0).val();if(AV(this).is(":checked")){A4[A6]["active"]=1;var A7=A4[A6];A7.snippet=Az[A6].snippet;A7.title=Az[A6].title;A5.push(A7)}else{A4[A6]["active"]=0}});vBulletin.AJAX({call:"/ajax/api/ad/quickSave",data:{data:A4},success:function(A6){var A7=AV(".axd_"+At,Ay);if(A7.length==0){A7=AV(".widget-content",Ay)}if(A5.length>0){A5.sort(function(BB,BA){return BB.displayorder-BA.displayorder});var A9="",A8="";AV.map(A5,function(BB,BA){if(BB.snippet){A8+=Z(BB.snippet,BB.title);A9+=BB.snippet}});A7.html(A8);An=Aw(A9)}else{A7.html("")}A7.show();A3();AV("html,body").animate({scrollTop:0},"slow")},complete:function(){AV("body").css("cursor","default")}})})}})}function Av(Az){vBulletin.AJAX({call:"/ajax/render/dialog_axd_config",data:{isAjaxTemplateRenderWithData:true},success:function(A0){h.axd_config_dialog=A0.template;AV("body").append(A0.template);As(Az)},error_phrase:"error_fetching_dialog"})}function As(A0){var Az=A0.adlocation;AV("#axd-config-dialog").dialog({title:vBulletin.phrase.get(A0.adid?["edit_ad_x",A0.title]:"create_ad"),autoOpen:true,modal:true,resizable:false,closeOnEscape:false,showCloseButton:false,width:720,dialogClass:"dialog-container axd-dialog-container input-dialog",open:function(){var A1=AV(this);if(A0.adid){AV(".title",A1).val(A0.title);AV(".axd_html",A1).val(A0.snippet);AV(".active",A1).prop("checked",(A0.active=="1"));AV(".axdid",A1).val(A0.adid);for(var A2 in A0.criterias){var A3=A0.criterias[A2],A4=A3.criteriaid;AV("[name=data\\[criteria\\]\\["+A4+"\\]\\[active\\]]",A1).prop("checked",true);AV("."+A4,A1).each(function(){var A7=AV(this),A6=A7.attr("name").match(/condition\d/);if(A6){A7.val(A3[A6[0]])}})}}else{AV(".axdid",A1).val(0);AV(".configform",A1).trigger("reset")}AV(".axd_location",A1).val(Az);AV(".blockrow select.custom-dropdown",A1).selectBox();AV(".blockrow a.custom-dropdown, .blockrow input[type=text]",A1).on("click",function(A6){return false});AV(".btnAttachHtmlAxd",A1).off("click").on("click",function(){var A6=AV(".configform",A1).serialize();AV("body").css("cursor","wait");vBulletin.AJAX({call:"/ajax/api/ad/save",data:A6,success:function(A7){A5();An=Aw(AV(".configform .axd_html",A1).val())},complete:function(){AV("body").css("cursor","default")}})});AV(".btnCancelEditHtmlAxd",A1).off("click").on("click",function(){A5(true)});function A5(A6){A6=A6||false;AV(":checkbox",A1).prop("checked",false);AV("select",A1).val("");A1.dialog("close");A1.dialog("destroy");AV("#axd-config-dialog").remove();Ax(A6)}}})}function Aw(A1){var A0=AV("<div>"+A1+"</div>");if(A0.filter("script").length>0){return true}else{var Az=A0.find("*").filter(function(){return(this.nodeName.toLowerCase().indexOf("vb:")==0)?this:null});return(Az.length>0||(/\{vb\s*\:\s*[a-z]+\s+.*\}/).test(A1))}}return false});AV("#header .header-cell .js-edit-logo").on("click",function(){AV(".header-edit-box.selected").removeClass("selected");AV(this).closest(".header-edit-box").addClass("selected");AV("#edit-site-logo-dialog").dialog({title:vBulletin.phrase.get("edit_site_logo"),autoOpen:true,modal:true,resizable:false,closeOnEscape:false,showCloseButton:false,width:520,dialogClass:"dialog-container site-logo-dialog-container input-dialog",create:function(){var As=AV(this).closest(".ui-dialog").find(".ui-dialog-title");As.append('<span class="dialog-subtitle"></span>');As.children("span.dialog-subtitle").text(vBulletin.phrase.get("choose_options_site_logo"));AV("#btnCancelEditSiteLogo").on("click",function(){AV("#edit-site-logo-dialog").dialog("close")});AV("#btnSaveEditSiteLogo").on("click",function(){if(Number(AV("#header .site-logo img").attr("data-fileid"))>0){AI(function(){AV("#edit-site-logo-dialog").dialog("close")})}else{AV("#edit-site-logo-dialog").dialog("close")}});AV("#edit-site-logo-dialog .styleselection").change(function(){AV("#header .site-logo img").attr({"data-styleselection":AV(this).val()})});AV("#edit-site-logo-dialog").fileupload({dropZone:null,dataType:"json",add:function(Au,At){AV("body").css("cursor","wait");AV(Au.target).find(".js-upload-progress:first").removeClass("h-hide");At.submit()},done:function(Au,At){if(At.result&&At.result.filedataid){AV("#header .site-logo img").attr({src:At.result.imageUrl,"data-fileid":At.result.filedataid,"data-styleselection":AV("#edit-site-logo-dialog .styleselection:checked").val()})}else{vBulletin.error("error","error_uploading_logo")}},fail:function(Au,At){vBulletin.error("error","error_uploading_logo")},always:function(Au,At){AV("body").css("cursor","auto");AV(Au.target).find(".js-upload-progress:first").addClass("h-hide")}});AV("#edit-site-logo-dialog #btnAttachLogo").on("click",function(){var At=AV.trim(AV("#edit-site-logo-dialog #imageUrl").val());if(At){AV("body").css("cursor","wait");AV(this).closest(".dialog-content").find(".js-upload-progress:last").removeClass("h-hide");vBulletin.AJAX({call:"/uploader/Url",data:({urlupload:At}),complete:function(){AV("body").css("cursor","auto");AV("#edit-site-logo-dialog .js-upload-progress:last").addClass("h-hide")},success:function(Au){AV("#header .site-logo img").attr({src:Au.imageUrl,"data-fileid":Au.filedataid,"data-styleselection":AV("#edit-site-logo-dialog .styleselection:checked").val()})},title_phrase:"edit_site_logo",error_phrase:"error_processing_site_logo",after_error:function(){AV("#edit-site-logo-dialog #imageUrl").focus()}})}else{AV("#edit-site-logo-dialog #imageUrl").focus()}})}})});AV(".admin-button-flat").disableSelection();var Am=function(As){Aj()};f=AV("#edit-content .tabs").tabs({beforeActivate:function(At,Au){AV("#save-content").hide();if(Au.newTab.index()==1){if(m){AV("#edit-page-dropdown .layout-list .layout-border.selected").removeClass("selected");var As=AV("#edit-page-dropdown .layout-list input[type=radio][value={0}]".format(AV(".canvas-layout:visible").attr("data-layout-id")));As.prev().addClass("selected");Ad="canvas-"+As.attr("id")}}},create:function(As,At){Am(At.tab.index())},activate:function(As,At){Am(At.newTab.index())}});AV("#lnkAddModules").on("click",function(){f.tabs("option","active",0);return false});AS();AV(document).on("click",".module-buttons .hide-icon input",function(){var At=AV(this);At.closest(".canvas-widget")[this.checked?"addClass":"removeClass"]("hidden-widget");var As=At.attr("title");At.attr("title",At.data("toggle-title")).data("toggle-title",As)});AV(".canvas-layout-container .canvas-layout").each(function(){AB[this.id]=AV("#"+this.id+' div[class*="section-"]').length});if(!u){Ad="canvas-"+AV("#edit-page-dropdown .layout-list input[type=radio][value={0}]".format(AV(".canvas-layout:visible").attr("data-layout-id"))).prop("checked",true).attr("id")}AF=AV("#edit-page-dropdown .layout-list input[type=radio]").thumbnailRadioCheckbox({thumbnailClass:"layout-border"});AF.thumbnailRadioCheckbox("option","select",function(At,As){AV(".canvas-layout").addClass("h-hide");AV("#canvas-"+As.attr("id")).removeClass("h-hide");B("canvas-"+As.attr("id"));O();AA();t=true})}function B(Ao){if(!Ad){AV(".canvas-layout.h-hide input[type=hidden]").prop("disabled",true);AV("#"+Ao+" input[type=hidden]").prop("disabled",false);Ad=Ao;return }else{if(Ad==Ao){return }else{AV(".canvas-layout.h-hide input[type=hidden]").prop("disabled",true);AV("#"+Ao+" input[type=hidden]").prop("disabled",false);var Am=AB[Ao];var Al=false;var An=0;AV("#"+Ad+" > .canvas-layout-row > .canvas-widget-list").each(function(){var At=AV(this);Al=AR(At,AV("#"+Ao+" > .canvas-layout-row > .canvas-widget-list"));if(!Al.length){An=J(this);Al=AV("#"+Ao+" > .canvas-layout-row > div.section-"+An)}if(!Al.length){var Ap=Am;while(Ap>=0&&AV("#"+Ao+" > .canvas-layout-row > div.section-"+Ap).length==0){Ap--}Al=AV("#"+Ao+" > .canvas-layout-row > div.section-"+Ap)}var Ar=At.children(".canvas-widget");var Au=parseInt(Math.ceil(Ar.length/Al.length),10);console.log("Moving {0} widgets to {1} sections; ChunkSize {2}".format(Ar.length,Al.length,Au));if(Au>0){var As=0,Aq=0;Ar.each(function(){AV(this).appendTo(Al.eq(Aq));++As;if(As>=Au){As=0;++Aq}})}})}}Ad=Ao}function AR(Al,An){var Ap=["js-sectiontype-notice","js-sectiontype-primary","js-sectiontype-secondary","js-sectiontype-extra"],Am,Ao;for(Am in Ap){if(Al.is("."+Ap[Am])){Ao=Ap[Am];break}}return An.filter(function(){return AV(this).is("."+Ao)})}function J(An){var Am=/section-(\d+)/gi;var Al=null;AV(AV(An).attr("class").split(" ")).each(function(Ap,Aq){var Ao=Am.exec(Aq);if(Ao&&!isNaN(Ao[1])){Al=Ao[1]}});return Al}function Ae(Al){if(!AV.isArray(Al)||Al.length==0){return }vBulletin.AJAX({call:"/ajax/admin-template/widget",data:({widgets:Al,pagetemplateid:AV("#save-page-form #pagetemplateid-yes").val()}),success:function(Am){if(AV.isArray(Am.widgets)){AV.each(Am.widgets,function(An,Ap){if(!Ap.widgetid||Number(Ap.widgetid)<1||!AV.trim(Ap.template)){return true}var Aq=(Ap.displaysection&&Number(Ap.displaysection)>0)?Ap.displaysection:0,Ao=AV(Ap.template);Ao.appendTo(AV(".canvas-layout:not(.h-hide) .canvas-widget-list.section-"+Aq).height("auto")).filter(":not(.container-widget)").find(".toggle-button").trigger("click",[true]);Ao.find(".tabs").tabs()})}},error_phrase:"error_adding_widgets",});return false}function Ac(Al,Am){var An=Al.closest(".channel-item-container").children(".sub-channel-container").children(".channel-item-container");if(Al.text()=="<"){Al.text(">");An.slideDown(150)}else{if(typeof (Am)==="undefined"||!Am){Al.text("<");itemContainer.slideUp(150)}}}function K(){AV(".channel-config-dialog .channel-list").sortable({placeholder:"main-channel-container-highlight drag-highlight h-clear",update:function(Al,Am){Am.item.css("z-index","0");p.forum=true;x=true},sort:function(Al,Am){},start:function(Al,Am){if(AV.browser.msie&&parseInt(AV.browser.version,10)==8){Am.item.height(Am.item.height()-4)}Am.item.css("z-index","99999");Am.placeholder.height(Am.item.outerHeight())},over:function(Al,Am){},receive:function(Al,Am){},out:function(Al,Am){},handle:".grip-icon-main",items:".main-channel-container"})}function F(Al){AD=Al.find(".main-channel-container").sortable({connectWith:".sub-channel-container",placeholder:"channel-item-highlight drag-highlight",revert:true,update:function(Am,An){var Ao=An.item.closest(".main-channel-container");if(An.sender&&An.sender.hasClass("main-channel-container")){if(AV("> .channel-item-container",An.sender).length==0){An.sender.slideUp("fast",function(){AV(this).remove()})}}p.forum=true;x=true},sort:function(Am,An){},activate:function(Am,An){},start:function(Am,An){},stop:function(Am,An){AV(".main-channel-container, .sub-channel-container").height("auto")},over:function(Am,An){},receive:function(Am,An){},out:function(Am,An){},handle:".channel-item-inner > .grip-icon-item",items:".channel-item-container"})}function U(Al){AJ=Al.find(".sub-channel-container").sortable({connectWith:".sub-channel-container",revert:true,placeholder:"channel-item-highlight drag-highlight",update:function(Am,An){if(An.sender&&An.sender.hasClass("main-channel-container")){if(AV("> .channel-item-container",An.sender).length==0){An.sender.slideUp("fast",function(){AV(this).remove()})}}p.forum=true;x=true},sort:function(Am,An){},start:function(Am,An){},stop:function(Am,An){AV(".main-channel-container, .sub-channel-container").height("auto")},over:function(An,Ao){var Am=AV(this).closest(".channel-item-container").children(".channel-item").find(".toggle-button");Ac(Am,true)},receive:function(Am,An){},out:function(Am,An){},handle:".channel-item-inner > .grip-icon-item",items:".channel-item-container"})}function Af(Al,Ao,Ap,Aq,At,Av,As){var Ar='<div class="'+(At?"category-to-channel":"channel-to-category")+'"><a href="#">'+vBulletin.phrase.get((At?"make_forum":"make_category"))+"</a></div>";var Au=AV(('<div class="main-channel-container">				<div class="grip-icon grip-icon-main h-left"><div>&uml;</div><div>&uml;</div><div>&uml;</div><div>&uml;</div><div>&uml;</div></div>				<div class="channel-item-container">					<div class="channel-item shadow" data-channel-id="{0}" data-parent-id="{2}">						<div class="channel-item-inner">							<div class="grip-icon grip-icon-item h-left"><div>&uml;</div><div>&uml;</div><div>&uml;</div><div>&uml;</div><div>&uml;</div></div>							<div class="channel-title"><div title="'+vBulletin.phrase.get("click_text_edit_title")+'">{1}</div><input type="text" name="channeltitle" value="{1}" /></div>							<div class="close-button" title="'+vBulletin.phrase.get("remove_forum")+'">x</div>							<div class="toggle-button"><</div>							<div class="num-subchannels">'+As+'</div>							<div class="add-subchannel-button h-right" title="'+vBulletin.phrase.get("add_subforum")+'"><a href="#">+</a></div>							'+Ar+'							<div class="h-clear"></div>						</div>					</div>					<div class="sub-channel-container"></div>				</div>		 </div>').format(Ao,Aq,Ap)).appendTo(Al);if(Av){var Am=AV("#top-level-forum .channel-config-dialog .channel-list");var An=Am.find(".main-channel-container").last();AV("html, body").animate({scrollTop:An.offset().top},"fast")}p.forum=true;x=true;return Au}function AP(An,Ao,Ap,As,Am,Ar){var Aq='<div class="'+(As?"category-to-channel":"channel-to-category")+'"><a href="#">'+vBulletin.phrase.get((As?"make_forum":"make_category"))+"</a></div>";var At=Am.hasClass("main-channel-container")?AV("> .channel-item-container > .sub-channel-container",Am):AV("> .sub-channel-container",Am);var Al=AV(('<div class="channel-item-container">				<div class="channel-item shadow" data-channel-id="{0}" data-parent-id="{2}">					<div class="channel-item-inner">						<div class="grip-icon grip-icon-item h-left"><div>&uml;</div><div>&uml;</div><div>&uml;</div><div>&uml;</div><div>&uml;</div></div>						<div class="channel-title"><div title="Click text to edit title">{1}</div><input type="text" name="channeltitle" value="{1}" /></div>						<div class="close-button" title="'+vBulletin.phrase.get("remove_forum")+'">x</div>						<div class="toggle-button"><</div>						<div class="num-subchannels">'+Ar+'</div>						<div class="add-subchannel-button h-right" title="'+vBulletin.phrase.get("add_subforum")+'"><a href="#">+</a></div>						'+Aq+'						<div class="h-clear"></div>					</div>			 </div>			 <div class="sub-channel-container"></div>			</div>').format(An,Ap,Ao)).hide().appendTo(At);p.forum=true;x=true;return Al}function AZ(){vBulletin.AJAX({call:"/ajax/fetch-widget-admin-template-list",complete:function(){Aj();AV(window).resize(Aj)},success:function(An){AG=true;if(AV.isArray(An)){if(An.length>0){var Ao={},Ar=0;AV.each(An,function(At,Au){if(!Au.widgetid||Number(Au.widgetid)<1){return true}Ar++;if(!Ao[Au.category]){Ao[Au.category]={count:1,title:Au.category_title}}else{Ao[Au.category].count++}var As=AV("#edit-page-dropdown .module-list .module-icon-template").clone();As.attr("data-widget-id",Au.widgetid).attr("data-title",AV.trim(Au.title).toLowerCase()).data("canbemultiple",Au.canbemultiple).removeClass("module-icon-template").addClass(("module-item category-{0}"+(Au.cloneable=="1"?" module-cloneable":"")).format(Au.category));AV(".module-icon",As).html(AV("<img />").attr("src",pageData.baseurl+"/images/sitebuilder/"+AV.trim(Au.icon)).attr("height",60).attr("width",60).attr("alt",vBulletin.phrase.get("module_icon")));AV(".module-title .main-title",As).html(AV.trim(Au.title));As.appendTo("#edit-page-dropdown .module-list").removeClass("h-hide")});AV(('<div class="category-arrow-left h-left" title="'+vBulletin.phrase.get("previous")+'">&lsaquo;</div>							<div class="scroller category h-left">								<div class="categories h-left">									<div id="category-all" class="category selected">'+vBulletin.phrase.get("all")+' ({0})</div>									<div id="category-result" class="category h-hide">'+vBulletin.phrase.get("search_results")+' (<span></span>)</div>								</div>							</div>							<div class="category-arrow-right h-left" title="'+vBulletin.phrase.get("next")+'">&rsaquo;</div>							<div class="h-clear"></div>').format(Ar)).insertBefore("#edit-page-dropdown .module-list-container .scroller");var Am=0;AV.each(Ao,function(At,Au){var As=AV('<div id="category-{0}" class="category">{1} ({2})</div>'.format(At,Au.title,Au.count)).insertBefore("#category-result");Am+=As.outerWidth(true)});var Aq=Am+AV("#category-all").outerWidth(true);AV(".categories").width(Aq);if(AV(".categories").width()<=AV(".scroller.category").width()){AV(".category-arrow-left, .category-arrow-right").css("visibility","hidden")}else{AV(".category-arrow-right").css("visibility","visible")}Ak();c=AV("#edit-page-dropdown .module-list .module-item").not(".non-module-item");c.draggable({connectToSortable:".canvas-layout-row > .canvas-widget-list:visible",helper:"clone",revert:"invalid",appendTo:"#add-modules .module-list-container",zIndex:2000,start:function(As,At){if(AV(this).data("canbemultiple")=="0"&&AV("#content .canvas-layout .canvas-widget[data-widget-id={0}]".format(AV(this).attr("data-widget-id"))).length>0){vBulletin.warning("move_not_allowed",["adding_multiple_modules_not_allowed",AV(".main-title",this).html()]);return false}v=true},stop:function(As,At){v=false}}).disableSelection();var Al=false;AV("#search-module-keyword").on("keyup",function(As,A0){var Az=AV("#add-modules"),Aw=AV("#category-result"),At=AV(".categories",Az),Au=AV(".scroller.category",Az),Av=false;AV(".module-item",Az).hide();if(!A0){AV(".category.selected",Az).removeClass("selected")}var Ay=AV.trim(this.value.toLowerCase());if(Ay){AV('.module-item[data-title*="{0}"]'.format(Ay),Az).show();Aw.removeClass("h-hide").addClass("selected")}else{AV(".module-item",Az).show();AV("#category-all").removeClass("h-hide").addClass("selected");Aw.addClass("h-hide").removeClass("selected");Av=true}var A1=AV(".module-item:visible",Az).length;AV("span",Aw).text(A1);Ak();if(A1==0){AV(".empty-module",Az).show()}else{AV(".empty-module",Az).hide()}if(Av){At.width(Aq)}else{At.width(Aq+Aw.outerWidth(true))}if(At.width()<=Au.width()){AV(".category-arrow-left, .category-arrow-right",Az).css("visibility","hidden");Au.scrollLeft(0)}else{if(Av){AV(".category-arrow-left",Az).css("visibility","hidden");AV(".category-arrow-right",Az).css("visibility","visible");Au.scrollLeft(0)}else{AV(".category-arrow-left",Az).css("visibility","visible");AV(".category-arrow-right",Az).css("visibility","hidden");var Ax=Au.get(0);Au.scrollLeft(Ax.scrollWidth-Ax.clientWidth)}}return true});AV("#add-modules .categories .category").on("click",function(Au){Au.stopPropagation();if(AV(this).hasClass("selected")){return false}var As=AV(this).closest(".module-list-container"),Av=AV(".module-item",As);AV(".category.selected",As).removeClass("selected");AV(this).addClass("selected");Av.hide();AV(".empty-module",As).hide();var At=this.id;if(At=="category-all"){Av.show();AV(".non-module-item",As).hide()}else{if(At=="category-result"){AV("#search-module-keyword").triggerHandler("keyup",[true])}else{AV(".module-item.{0}".format(At),As).show()}}Ak();return false}).disableSelection();var Ap;AV(".category-arrow-left").on({mousedown:function(){AV(".category-arrow-right").css("visibility","visible");Ap=setInterval(function(){var As=AV(".scroller.category");As.scrollLeft(As.scrollLeft()-20);if(As.scrollLeft()==0){AV(".category-arrow-left").css("visibility","hidden");clearInterval(Ap)}},50)},mouseup:function(){clearInterval(Ap)}}).disableSelection();AV(".category-arrow-right").on({mousedown:function(){AV(".category-arrow-left").css("visibility","visible");Ap=setInterval(function(){var At=AV(".scroller.category");At.scrollLeft(At.scrollLeft()+20);var As=At.get(0);if(At.scrollLeft()==As.scrollWidth-As.clientWidth){AV(".category-arrow-right").css("visibility","hidden");clearInterval(Ap)}},50)},mouseup:function(){clearInterval(Ap)}}).disableSelection()}else{AV('<div class="empty-module">'+vBulletin.phrase.get("no_modules")+"</div>").appendTo("#edit-page-dropdown .module-list")}}},error_phrase:"error_retrieving_modules",})}function n(Am,Al){vBulletin.AJAX({call:"/ajax/api/widget/fetchWidgetGuidToWidgetidMap",success:function(An){if(An.map){AO=An.map}else{AO={error_result:An}}if(typeof Am=="function"){Am.apply(this,Al)}}})}function q(){AV("#edit-page-dropdown .template-list").empty();vBulletin.AJAX({call:"/ajax/api/pagetemplate/fetchPageTemplateList",data:{pagetemplateid:AV("#save-page-form #pagetemplateid-yes").val()},success:function(Am){z=true;if(AV.isArray(Am)&&Am.length>0){var Al=false;AV.each(Am,function(An,Ao){AV('<div class="template-item">								<input type="radio" id="pagetemplateid-{0}" name="pagetemplateid" value="{0}" data-thumbnail="{1}/images/sitebuilder/icon-layout-{4}.png"{2} />								<label class="label">{3}</label>							</div>'.format(Ao.pagetemplateid,pageData.baseurl,(!u&&AV("#save-page-form #pagetemplateid-yes").val()==Ao.pagetemplateid)?' checked="checked"':"",Ao.title,Ao.screenlayoutvarname)).appendTo("#edit-page-dropdown .template-list").data({screenlayoutid:Ao.screenlayoutid,widgetinstances:Ao.widgetinstances});if(AV("#save-page-form #pagetemplateid-yes").val()==Ao.pagetemplateid){Al=true;if(Ao.title==""){window.console.warn("The page template for this page does not have a title.")}}});if(!u&&!Al){window.console.error("The page template for this page was not in the list returned by fetchPageTemplateList! Expected pagetemplateid: {0}. Please ensure that this page template has a title.".format(AV("#save-page-form #pagetemplateid-yes").val()))}AV(".template-item",AV("#edit-page-dropdown .template-list")).each(function(An){AV(this).attr("data-title",AV(".label",AV(this)).text().toLowerCase())});AV("#search-template-keyword").on("keyup",function(Ar){if(Ar.keyCode==13){Ar.preventDefault();return false}var Ao=AV("#select-template"),As=AV(".scroller",Ao),Aq=false;AV(".template-item",Ao).hide();var An=AV.trim(this.value.toLowerCase());if(An){AV('.template-item[data-title*="{0}"]'.format(An),Ao).show()}else{AV(".template-item",Ao).show();Aq=true}var Ap=AV(".template-item:visible",Ao).length;Ak();AV(".empty-template",Ao).toggle(Ap==0);return true});AV("#search-template-keyword").on("keydown",function(An){if(An.keyCode==13){An.preventDefault();return false}});b=AV("#edit-page-dropdown .template-list .template-item input[type=radio]").thumbnailRadioCheckbox({thumbnailClass:"template-border",preselect:function(Ao,An){if(An.is(":checked")){return false}if(t||x){openConfirmDialog({title:vBulletin.phrase.get("switch_template"),message:vBulletin.phrase.get("template_changes_will_be_lost"),iconType:"warning",onClickYes:function(){t=false;x=false;m=true;b.thumbnailRadioCheckbox("check",An,true)}});return false}m=true;return true},select:function(Ar,An){AV(".canvas-layout").addClass("h-hide");var Ap=An.closest(".template-item").data("screenlayoutid");AV(".canvas-layout[data-layout-id="+Ap+"]").removeClass("h-hide");O();AA();AV("#save-page-form #pagetemplateid-yes, #config_pagetemplateid").val(An.val());AV("#save-page-form .page-template-name").html(vBulletin.phrase.get("page_template_name_id",An.closest(".template-item").find(".label").html(),An.val()));if(m){AV(".canvas-widget-list").empty();var Ao=An.closest(".template-item").data("widgetinstances");if(AV.isArray(Ao)&&Ao.length>0){var Aq=[];AV.each(Ao,function(As,At){Aq.push({widgetid:At.widgetid,widgetinstanceid:At.widgetinstanceid})});Ae(Aq,true);M()}else{window.vBulletin.loadingIndicator.hide()}}AV("body").removeClass("lnkNewPage").addClass("lnkEditPage");AV("#save-page-form .new-page-template input").prop("disabled",true);AV("#save-page-form .edit-page-template input").prop("disabled",false);m=true},unselect:function(){}});Ak()}},})}function AI(Al){vBulletin.AJAX({call:"/uploader/setlogo",data:({filedataid:AV("#header .site-logo img").attr("data-fileid"),styleselection:AV("#header .site-logo img").attr("data-styleselection")}),complete:function(){AV("body").css("cursor","auto")},success:function(Am){if(AV.trim(Am)==="true"){AV("#header .site-logo img").removeAttr("data-styleselection").removeAttr("data-fileid").attr("data-orig-src",AV("#header .site-logo img").attr("src"));AV("#admin-navbar-strip-gutter").addClass("h-hide").find(".prompt-text").text("");AV(document.body).removeClass("edit-mode lnkHeader").addClass("view-mode");AV("#header .disable-overlay").hide();L(null,{enableButtons:true,currentButton:null});if(typeof Al=="function"){Al()}}},error_phrase:"error_saving_site_logo"})}function N(Al,Am){AV.each(Al,function(Ao,An){var Ap=AV(('<div class="sub-channel channel" data-channel-id="{0}" data-parent-id="{6}">				<div class="avatar h-left"></div>				<div class="title"><a href="{1}{2}">{3}</a></div>				<div class="info">					<span class="label">'+vBulletin.phrase.get("last_post")+':</span>					<span class="title">{4}</span>				</div>				<div class="h-clear"></div>').format(An.nodeid,pageData.baseurl,An.url,An.title,(An.lastPostTitle?An.lastPostTitle:"<em>"+vBulletin.phrase.get("none")+"</em>"),pageData.baseurl_core,An.parentid)).appendTo(Am);N(Al[Ao].subchannels,Ap.eq(0))})}function AH(Am,Al){AV.each(Am,function(An,Ap){var Ao=AV.map(Ap.subchannels,function(As,Ar){return Ar}).length;var Aq=AP(Ap.nodeid,Ap.parentid,Ap.title,Ap.category,Al,Ao);AH(Ap.subchannels,Aq)})}function AY(){f.tabs("option","active",0);var Ar=AV("#add-modules").height();f.tabs("option","active",1);var Al=AV("#change-layout").height();f.tabs("option","active",2);var Am=AV("#select-template").height();AV("#edit-page-dropdown .lnkSaveChanges").trigger("click");var Ao=AV("#save-page-form").height();f.tabs("option","active",0);var Aq=Math.max(Ar,Al,Am,Ao);var An=AV("#edit-page-dropdown .panel-header-text");An.each(function(){var As=AV(this);As.css("min-height",Aq-parseFloat(As.css("margin-top"))-parseFloat(As.css("margin-bottom"))-parseFloat(As.css("padding-top"))-parseFloat(As.css("padding-bottom")))});var Ap=AV("#edit-page-dropdown .panel-main-content");Ap.each(function(){var As=AV(this);As.css("min-height",Aq-parseFloat(As.css("margin-top"))-parseFloat(As.css("margin-bottom"))-parseFloat(As.css("padding-top"))-parseFloat(As.css("padding-bottom")))})}function Y(Al,Am){var An=(Am&&Am.length>0)?AV(".canvas-layout .canvas-widget").not(Am).find(".widget-content"):AV(".canvas-layout .canvas-widget .widget-content");if(Al){An.each(function(){if(AV(this).is(":hidden")){AV(this).closest(".canvas-widget").find(".widget-header .toggle-button").trigger("click",[true])}})}else{An.each(function(){if(!AV(this).is(":hidden")){AV(this).closest(".canvas-widget").find(".widget-header .toggle-button").trigger("click",[true])}})}}function l(Am,Al){if(Al){if(Am.find(".widget-content").is(":hidden")){Am.find(".toggle-button").trigger("click",[true])}}else{if(!Am.find(".widget-content").is(":hidden")){Am.find(".toggle-button").trigger("click",[true])}}}function M(){if(!u){var Al=AV(".canvas-layout:visible .canvas-widget.subchannel-widget");if(Al.length==1){Al.find(".close-button").hide()}else{Al.find(".close-button").show()}}}function Ai(An,Al){var Am=An.attr("data-widget-id");if(y[Am]==null){vBulletin.AJAX({call:"/ajax/fetch-widget-template",data:({widgetid:Am}),success:function(Ao){var Aq=AV.trim(Ao);if(Aq){var Ap=AV(Aq.replace(/\<\s*script[^\>]*\>(.*?)\<\s*\/\s*script\>/g,""));Ap.attr("data-title",function(){var Ar=AV(".module-title",Ap).clone();Ar.find(".hide-on-viewmode").children().unwrap();Ar.find("*:hidden").remove();return AV.trim(Ar.text()).toLowerCase()});y[Am]=Ap;if(typeof Al=="function"){Al(Ap.clone(true))}}},error_phrase:"error_retrieving_cloned_widget_template",})}else{if(typeof Al=="function"){Al(y[Am].clone(true))}}}function E(Al,Am){AV(".edit-mode .canvas-widget.youtube-widget .widget-content").css("visibility",Al);if(Am){Am.find(".widget-content").css("visibility",(Al=="hidden"?"visible":"hidden"))}}function C(Al){var Ao="js-sb-module-config--viewpermissions--template";if(!Ao.length){return""}if(!Al.hasOwnProperty("defaultvalue")){Al.defaultvalue={show:"all",}}var As=AV("."+Ao).clone().removeClass(Ao+" h-hide"),Au=Al.defaultvalue,At=(Au.hasOwnProperty("hide")?"hide":"show"),Aq=(At=="show"&&typeof Au[At]=="string"&&Au[At]=="all"),Am=As.find("input.js-module_viewpermissions__key[value='show_all']"),Ar=As.find("input.js-module_viewpermissions__key[value='show']"),An=As.find("input.js-module_viewpermissions__key[value='hide']"),Ap=As.find(".js-module_viewpermissions_ugchecklist");if(At=="hide"){At="show";Aq=true;Am.prop("checked",false);Ar.prop("checked",true)}if(At=="hide"){Am.prop("checked",false);Ar.prop("checked",false);An.prop("checked",true)}else{if(Aq){Am.prop("checked",true);Ar.prop("checked",false);An.prop("checked",false);Ap.addClass("h-hide")}else{Am.prop("checked",false);Ar.prop("checked",true);An.prop("checked",false)}}if(!Aq){AV.each(Au[At],function(Av,Aw){Ap.find("input.js-module_viewpermissions__value[value='"+Aw+"']").prop("checked",true)})}As.find("input.js-module_viewpermissions__key").on("change",function(Av){if(this.value=="show_all"){Ap.addClass("h-hide")}else{Ap.removeClass("h-hide")}});return As}function X(Am){var Ao="js-sb-module-config--filter_nodes--template";if(!Ao.length){return""}if(!Am.hasOwnProperty("defaultvalue")){Am.defaultvalue={include:["all"],}}var Ax=AV("."+Ao).clone().removeClass(Ao+" h-hide"),Az=Am.defaultvalue,Ay=(Az.hasOwnProperty("exclude")?"exclude":"include"),An=Az.hasOwnProperty("include_children")?Az.include_children:true,Aw=Ax.find("input[name='data[module_filter_nodes][include_children]']"),A0=Ax.find("input.js-module_filter_nodes__key[value='include']"),Av=Ax.find("input.js-module_filter_nodes__key[value='exclude']"),Aq=Ax.find("select.js-module_filter_nodes-values"),Al=Ax.find("input[name='data[module_filter_nodes][selection_type]']"),Au=Ax.find("*[data-disable-on='exclude']"),As=Ax.find("*[data-disable-on='include']"),Ap=function(A2,A3){var A1=Aq.data("selectBox-control")||{};A2.each(function(){var A4=AV(this);A4.attr("disabled","disabled");if(A4.is("option")&&A1.length>0){A1.find("li:has(> a[rel='"+A4.val()+"'])").removeClass("selectBox-selected").addClass("selectBox-disabled")}});A3.each(function(){var A5=AV(this);A5.removeAttr("disabled");if(A5.is("option")&&A1.length>0){var A4="";if(A5.is(":selected")){A4="selectBox-selected"}A1.find("li:has(> a[rel='"+A5.val()+"'])").removeClass("selectBox-disabled").addClass(A4)}})},At=Ax.find("*[data-hide-on='exclude']"),Ar=Ax.find("*[data-hide-on='include']");Al.on("change vb-init",function(A1){var A3=AV(this),A4=A3.val(),A2=Aq.data("selectBox-control")||{};if(!A3.is(":checked")){return }if(A4=="all"||A4=="current"){Aq.attr("disabled","disabled");if(A2.length>0){A2.addClass("selectBox-disabled")}}else{Aq.removeAttr("disabled");if(A2.length>0){A2.removeClass("selectBox-disabled")}}});Ax.find("input.js-module_filter_nodes__key").on("change",function(A1){if(this.value=="exclude"){Ap(Au,As);At.hide();Ar.show()}else{Ap(As,Au);Ar.hide();At.show()}});if(Ay=="exclude"){A0.prop("checked",false);Av.prop("checked",true);Av.change()}else{Av.prop("checked",false);A0.prop("checked",true);A0.change()}if(!Az.hasOwnProperty(Ay)){Az.key=[]}else{if(typeof Az[Ay]=="string"||typeof Az[Ay]=="number"){Az[Ay]=[Az[Ay]]}}AV.each(Az[Ay],function(A1,A2){if(A2==="all"){Al.filter("[value='all']").prop("checked",true);return false}else{if(A2==="current"){Al.filter("[value='current']").prop("checked",true);return false}else{Al.filter("[value='custom']").prop("checked",true);Aq.find("option[value='"+A2+"']").prop("selected",true)}}});Al.trigger("vb-init");Aw.prop("checked",An);return Ax}function AS(){AV(document).off("click",".canvas-widget.default-widget:not(.js-search-widget) .edit-button").on("click",".canvas-widget.default-widget:not(.js-search-widget) .edit-button",function(){var As=AV(this).closest(".canvas-widget"),Am=As;var An=AV("> .widget-header .module-title",As);(function(){var At=As.data("widget-instance-id");if(vBulletin.sitebuilder.tempModuleHTMLCache["widgetinstance_"+At]){if(AV("#sb-temp-module-cache").length==0){AV('<div id="sb-temp-module-cache" class="h-hide"></div>').appendTo("body")}var Au=AV(vBulletin.sitebuilder.tempModuleHTMLCache["widgetinstance_"+At]);if(Au.find(".widget-tabs").length>0||Au.is(".widget-tabs")){AV("#sb-temp-module-cache").append(Au);delete vBulletin.sitebuilder.tempModuleHTMLCache["widgetinstance_"+At]}}var Av=AV("#sb-temp-module-cache .canvas-widget").filter(function(){return AV(this).data("widget-instance-id")==At});if(Av.length==1&&(Av.find(".widget-tabs").length>0||Av.is(".widget-tabs"))){As=Av}})();if(As.is(".js-search-widget")){return }var Ap=As.attr("data-widget-id");var Ao;if(AV("span.admin-only",An).length>0){Ao=AV("span.admin-only",An).text()}else{Ao=AV(".hide-on-viewmode",An).length>0?AV(".hide-on-viewmode",An).text():An.text()}var Ar=As.data("widget-type")||"";AV("#config-dialog .loader").show();AV("#config-dialog .widget-name h1").html(Ao);AV("#config-dialog .dialog-content .widget-config-container").hide().empty().removeClass("error notice");AV("#config-dialog").data("selected-module",Am);E("hidden");AV("#config-dialog").dialog("open");var Aq=Am.attr("data-widget-instance-id")||"";vBulletin.AJAX({call:"/ajax/api/widget/fetchConfigSchema",data:({widgetid:Ap,widgetinstanceid:Aq,pagetemplateid:W(),configtype:"admin"}),success:function(A9){AV("#config_widgetid").val(A9.widgetid);AV("#config_widgetinstanceid").val(A9.widgetinstanceid);d(A9.pagetemplateid);Am.attr("data-widget-instance-id",A9.widgetinstanceid);if(!Aq){R(Am)}var BA=AV("#config-dialog .dialog-content .widget-config-container");if(!A9.configs||A9.configs.length==0){AV("#config-dialog .widget-config-container").html(vBulletin.phrase.get("no_configurations_found")).addClass("notice");AV("#btnSaveConfig").prop("disabled",true);AV("#btnCloseConfig").focus()}else{var BB=0;AV('<input type="hidden" name="data[widget_type]" />').addClass("widget-type").val(Ar).appendTo(BA);var BG=false,Av=false,A5=false,Az=false,BI,BH=false,A4=Am.data("is-tabbed-container"),A6={display_tabs:false,default_tab:false},A3=(AV("#debug-information").length==1),A2=vBulletin.isRtl();AV.each(A9.configs,function(BU,BN){var BM=null;switch(BN.type){case"Text":var BO=typeof (BN.defaultvalue!="undefined")?BN.defaultvalue:"";BM=AV('<input type="text" name="data[{0}]" id="data[{0}]" />'.format(BN.name)).addClass("textbox config-textbox").val(BO);break;case"LongText":var BO=typeof (BN.defaultvalue!="undefined")?BN.defaultvalue:"";BM=AV('<textarea name="data[{0}]" id="data[{0}]" rows="3" />'.format(BN.name)).addClass("textbox config-textbox").val(BO);break;case"YesNo":var BS={option_1:AV('<input type="radio" value="1" name="data[{0}]" id="data[{0}_1]" />'.format(BN.name)),label_1:AV("<label />").attr({"for":"data["+BN.name+"_1]"}).text(vBulletin.phrase.get("yes")),option_0:AV('<input type="radio" value="0" name="data[{0}]" id="data[{0}_0]" />'.format(BN.name)),label_0:AV("<label />").attr({"for":"data["+BN.name+"_0]"}).text(vBulletin.phrase.get("no"))};var BY=BS["option_"+BN.defaultvalue];if(BY){BY.prop("checked",true)}BM=AV("<div />").append(BS.option_1,BS.label_1,BS.option_0,BS.label_0);break;case"Checkboxes":BM=AV("<div />");AV.each(BN.data,function(Ba,Bc){var Bb="";if(BN.defaultvalue&&typeof BN.defaultvalue[Ba]!="undefined"&&BN.defaultvalue[Ba]==1){Bb=' checked="checked"'}var Bd=AV('<div><label><input type="checkbox" name="data[{0}][{1}]"{2} value="1" class="js-checkbox-always-send" /> {3}</label></div>'.format(BN.name,Ba,Bb,Bc));BM.append(Bd)});break;case"Select":BH=true;BM=AV('<select name="data[{0}]" />'.format(BN.name));var BR;if(BN.data!=""){for(BR in BN.data){if(BN.defaultvalue==BR){AV("<option />").attr("value",BR).attr("selected","selected").text(BN.data[BR]).appendTo(BM)}else{AV("<option />").attr("value",BR).text(BN.data[BR]).appendTo(BM)}}}break;case"ChannelSelect":BH=true;BM=AV('<select name="data[{0}]" />'.format(BN.name));var BW=AV('<optgroup label="{0}" />'.format(vBulletin.phrase.get("special_options"))),BP=AV('<optgroup label="{0}" />'.format(vBulletin.phrase.get("channels"))),BV=false,BX=false;if(BN.data){AV.each(BN.data,function(Ba,Bb){var Bc=null;if(BN.defaultvalue==Bb.nodeid){Bc=AV("<option />").attr("value",Bb.nodeid).attr("selected","selected").html(Bb.text)}else{Bc=AV("<option />").attr("value",Bb.nodeid).html(Bb.text)}if(Bb.nodeid<1){Bc.appendTo(BW);BV=true}else{Bc.appendTo(BP);BX=true}});if(BV){BW.appendTo(BM)}if(BX){BP.appendTo(BM)}}break;case"ContentTypeSelect":BH=true;BM=AV('<select name="data[{0}]" />'.format(BN.name));var BW=AV('<optgroup label="{0}" />'.format(vBulletin.phrase.get("special_options"))),BT=AV('<optgroup label="{0}" />'.format(vBulletin.phrase.get("content_types"))),BV=false,BQ=false;if(BN.data){AV.each(BN.data,function(Ba,Bc){var Bb=null;if(BN.defaultvalue==Bc.value){Bb=AV("<option />").attr("value",Bc.value).attr("selected","selected").html(vBulletin.phrase.get(Bc.phrase))}else{Bb=AV("<option />").attr("value",Bc.value).html(vBulletin.phrase.get(Bc.phrase))}if(Bc.special){Bb.appendTo(BW);BV=true}else{Bb.appendTo(BT);BQ=true}});if(BV){BW.appendTo(BM)}if(BQ){BT.appendTo(BM)}}break;case"ProfileFieldSelect":BH=true;BM=AV('<select name="data[{0}]" />'.format(BN.name));if(BN.data){AV.each(BN.data,function(Ba,Bc){var Bb=null;if(BN.defaultvalue==Bc.field){Bb=AV("<option />").attr("value",Bc.field).attr("selected","selected").html(Bc.title)}else{Bb=AV("<option />").attr("value",Bc.field).html(Bc.title)}Bb.appendTo(BM)})}break;case"Slider":BM=(function(Bg){var Bb,Ba,Bj=0,Bk=0,Bf=1,Bd=0.1,Bc="",Bh="",Bi="";if(Bg.defaultvalue){Bj=Bg.defaultvalue}if(Bg.data&&typeof Bg.data=="object"){var Be=Bg.data;if(Be.hasOwnProperty("min")){Bk=parseFloat(Be.min)}if(Be.hasOwnProperty("max")){Bf=parseFloat(Be.max)}if(Be.hasOwnProperty("interval")){Bd=parseFloat(Be.interval)}if(Be.hasOwnProperty("leftlabel")&&Be.leftlabel){Bi+='<span class="h-left">'+Be.leftlabel+"</span>"}if(Be.hasOwnProperty("rightlabel")&&Be.rightlabel){Bi+='<span class="h-right">'+Be.rightlabel+"</span>"}if(Bi!=""){Bi='<div class="config-slider-label">'+Bi+'<div class="h-clear"></div></div>'}}Bc='data-min="{0}" data-max="{1}" data-interval="{2}"'.format(Bk,Bf,Bd);Bh=Bi+'<div class="js-module-config-slider config-slider" '+Bc+" >"+'	<input type="hidden" name="data[{0}]" value="{1}" />'.format(Bg.name,Bj)+"</div>";Bb=AV(Bh);return Bb})(BN);break;case"ChannelIncludeExclude":BM=X(BN);BH=true;break;case"Custom":switch(BN.name){case"tab_data":BM=AV("<div />");var BZ=g(Am),BL=AV("<div />");AV.each(BZ,function(Bd,Ba){var Bb="[tab_data]["+Bd+"][title]",Bc=Ba.title,Be=AV('<input type="text" name="data{0}" id="data{0}" />'.format(Bb)).addClass("textbox config-textbox").attr("value",Bc);BM.append(Be);AV.each(Ba.widgets,function(Bf,Bg){AV.each(Bg,function(Bi,Bh){Bb="[tab_data]["+Bd+"][widgets]["+Bf+"]["+Bi+"]";Bc=Bh;Be=AV('<input type="text" name="data{0}" id="data{0}" />'.format(Bb)).addClass("textbox config-textbox").attr("value",Bc);BM.append(Be)})})});break;case"module_viewpermissions":BM=C(BN);break;default:break}break;default:console.log("hit default");return ;break}$requiredMark=AV("<div />").addClass("config-required-mark h-left").append(function(){return(BN.isRequired==1)?"*":"&nbsp;"});if(BN.isEditable==0&&BM){BM.find("input").prop("readonly",true);if(!BM.is("input")){BM.prop("disabled",true)}}var BK=AV("<div />").addClass("config-label h-left").addClass(BN.name).html(BN.label);if(A3){BK.prop("title",BN.name)}if(BN.description){AV("<div />").addClass("config-description").html(BN.description).appendTo(BK)}if(BN.ishiddeninput&&BM){BM.attr("hidden",true);BA.append(BM)}else{BA.append(AV("<div></div>").addClass(function(){return"h-clearfix config-row"+(((++BB)%2!=0)?" odd":"")}).append(BK,$requiredMark,AV("<div></div>").addClass("config-value h-left").addClass(BN.name).append(BM)))}if(BN.name=="default_tab"){if(A4){A6.default_tab=BN}else{BG=true}}if(BN.name=="display_tabs"){if(A4){A6.display_tabs=BN}else{Av=true}}if(BN.name=="tab_order"){if(!A4){A5=true}}if(BN.name=="axd"){Az=true}});var BF=null;var Aw=function(){BI=Al(As);var BN=As.attr("data-widget-default-tab"),BL=AV('select[name="data[default_tab]"]',BA),BM;BL.empty();for(var BK in BI){if(Av){if(!AV('input:checkbox[value="'+BI[BK].selector+'"]',BC).is(":checked")){continue}}else{if(!BI[BK].displayed){continue}}BM=AV('<option value="'+BI[BK].selector+'">'+BI[BK].label+"</option>");if(BF&&BF==BI[BK].selector){BM.attr("selected","selected")}else{if(BN==BI[BK].selector){BM.attr("selected","selected")}}BL.append(BM)}};var BD=function(){BI=Al(As);var BL=AV(".config-value.tab_order",BA),BM,BN;BL.empty().append("<ul>");for(var BK in BI){if(Av){if(!AV('input:checkbox[value="'+BI[BK].selector+'"]',BC).is(":checked")){continue}}else{if(!BI[BK].displayed){continue}}BM=AV('<li id="'+BI[BK].selector+'">'+BI[BK].label+"</li>");AV("ul",BL).append(BM);BN=AV('<input name="data[tab_order]['+BI[BK].selector.substring(1)+']" value="'+BK+'" type="hidden">');BL.append(BN)}AV("ul",BL).sortable({stop:function(){var BO=AV(this).sortable("toArray");BL.find("input:hidden").remove();for(BK in BO){BN=AV('<input name="data[tab_order]['+BO[BK].substring(1)+']" value="'+BK+'" type="hidden">');BL.append(BN)}}});AV("ul",BL).disableSelection()};if(Av){BI=Al(As);var BC=AV(".config-value.display_tabs",BA),Ay;for(var BE in BI){Ay=AV('<label><input type="checkbox" name="data[display_tabs][]" value="'+BI[BE].selector+'">'+BI[BE].label+"</label>");if(BI[BE].displayed){Ay.find("input:checkbox").attr("checked","checked")}BC.append(Ay)}if(BG){AV("input:checkbox",BC).on("click",function(){Aw();BD()})}}if(A5){BD();AV('select[name="data[default_tab]"]',BA).change(function(){BF=AV(this).val()})}if(BG){Aw()}var Au=s(Am);if(Au){AV("<input type='hidden' name='data[containerinstanceid]' value='"+Au+"' />").appendTo(BA)}if(A4){var A1=g(Am),Ax=AV('select[name="data[default_tab]"]',BA),BJ=AV(".config-value.display_tabs",BA),At=A6.display_tabs&&A6.display_tabs.defaultvalue||"";if(At==""){At={};AV.each(A1,function(BL,BK){At[BL]="1"})}var A8=function(){var BK;Ax.empty();AV.each(A1,function(BM,BL){BK=AV('<option value="'+BM+'">'+BL.title+"</option>");if(At[BM]=="0"){BK.prop("disabled",true)}else{if(A6.default_tab.defaultvalue==BM){BK.attr("selected","selected")}}Ax.append(BK)});if(Ax.is(".selectBox")){Ax.selectBox("refresh")}};if(A6.default_tab){A8()}if(A6.display_tabs){var A0;BJ.empty();AV.each(At,function(BM,BL){var BK="data[display_tabs]["+BM+"]";A0=AV("<label />").append(AV('<input type="hidden" name="'+BK+"\" value='0'/>")).append(AV('<input type="checkbox" name="'+BK+"\" value='1' data-tab-number=\""+BM+'" />')).append(document.createTextNode(A1[BM]["title"]));if(BL=="1"){A0.find("input:checkbox").prop("checked",true)}BJ.append(A0)});AV("input:checkbox",BJ).on("click",function(){var BO=AV(this),BL=BO.prop("checked"),BN=BO.data("tab-number"),BK=Ax.find("option[value='"+BN+"']"),BM=(BK.prop("disabled")!=!BL);At[BN]=BL;if(BM){A8()}})}}if(Az){var A7=AV(".config-value.axd",BA);A7.append('<button class="axd-edit-button b-button b-button--secondary b-button--sitebuilder" data-location="'+A9.widgetinstanceid+'">'+vBulletin.phrase.get("edit")+"</button>")}}BA.show();AV("#config-dialog .loader").hide();if(BH){BA.find("select").selectBox()}BA.find(".js-module-config-slider").each(function(BM){var BL=AV(this),BQ=BL.find("input"),BP=BL.parent().find(".js-slider-output"),BO=BL.data("min"),BK=BL.data("max"),BN=BL.data("interval");if(BQ.length){BL.slider({min:BO,max:BK,step:BN,value:BQ.val(),isRTL:A2,change:function(BR,BS){var BT=BS.value;if(BP.length){BP.val(BT)}BQ.val(BT)},})}});(function(){function BK(){var BL=AV(this),BM=BL.next(".js-checkbox-always-send-hidden");if(BM.length==0&&!BL.prop("checked")){AV('<input type="hidden" name="{0}" class="js-checkbox-always-send-hidden" value="0" />'.format(BL.prop("name"))).insertAfter(BL)}else{BM.remove()}}AV(".js-checkbox-always-send").off("click").on("click",BK);AV(".js-checkbox-always-send").each(BK)})();AV("#config-dialog .dialog-content .widget-config-container input,						#config-dialog .dialog-content .widget-config-container textarea,						#config-dialog .dialog-content .widget-config-container select,						#config-dialog .dialog-content .widget-config-container button").filter(function(){return AV(this).is(":visible")}).first().focus()},error_phrase:["error_retrieving_configuration",Ao],after_error:function(){AV("#config-dialog .loader").hide();AV("#config-dialog").dialog("close")},});return false});function Al(An){var Am=[];AV("ul.widget-tabs-nav li a, .widget-header ul.ui-tabs-nav li a, .widget-tabs-nav ul.ui-tabs-nav li a",An).each(function(){var Ao=AV(this),Ap;if(AV(this).closest("li").hasClass("h-hide")){Ap=false}else{Ap=true}Am.push({selector:Ao.attr("href"),label:Ao.text(),displayed:Ap})});return Am}}function O(){AV(".edit-mode .canvas-layout:visible > .canvas-widget-list").width("").each(function(){AV(this).width(AV(this).width())})}function AA(){if(AV.browser.msie&&parseInt(AV.browser.version,10)==8){var Al=AV(".edit-mode .canvas-layout:visible > .canvas-widget-list");Al.each(function(){var Am=AV(".canvas-widget",this),As=AV(this);var An=Am.outerHeight(true)||50;var Ao=Am.length*Am.outerHeight(true);var Ar=As.height()-Ao;console.log("offset:",Ar);if(Ar>=0&&Ar<An){var Aq=AV(window);var Ap=Aq.scrollTop();As.height(As.height()+(An-Ar));Aq.scrollTop(Ap);return false}else{if((Ar>An&&As.height()>parseInt(As.css("min-height"),10))||Ar<0){var Aq=AV(window);var Ap=Aq.scrollTop();As.height(Ao+An);Aq.scrollTop(Ap);return false}}})}}function AK(){window.console.log("Fetching page manager forums (initializeForumEditor)");vBulletin.AJAX({call:"/ajax/api/widget/fetchPageManagerForums",complete:function(){AV("#config-dialog .loader").hide()},success:function(Al){G=true;var An=AV("<div>").addClass("channel-list");AV.each(Al,function(Ap,Ar){var Aq=AV.map(Ar.subchannels,function(At,As){return As}).length;var Ao=Af(An,Ar.nodeid,Ar.parentid,Ar.title,Ar.category,false,Aq);AH(Ar.subchannels,Ao)});var Am=AV("#top-level-forum .channel-config-dialog");Am.find(".channel-list").remove();F(An);U(An);Am.append(An);AV(document).on("mousedown",".main-channel-container > .channel-item-container > .channel-item .grip-icon",function(){AV(this).closest(".main-channel-container").height(AV(this).closest(".main-channel-container").height())});AV(document).on("mousedown",".sub-channel-container > .channel-item-container > .channel-item .grip-icon",function(){AV(this).closest(".sub-channel-container").height(AV(this).closest(".sub-channel-container").height())});x=false;K()},error_phrase:"error_fetching_channels"});AV(document).on("click keydown",".channel-config-dialog .add-channel-fieldset .add-button, .channel-config-dialog .add-channel-fieldset input",function(Al){if(((Al.type=="click"||Al.which!=13)&&this.type=="text")||(Al.type=="keydown"&&this.type=="button"&&Al.which!=13)){return true}var Ao=(this.type=="text")?AV(this):AV(this).prev();var Am=AV.trim(Ao.val());if(Am&&Am!=Ao.prop("defaultValue")){var An=AV("#top-level-forum .channel-config-dialog .channel-list");Af(An,"","",vBulletin.htmlEntities(Am),0,true,0);F(An);K();Ao.val("");if(this.type=="button"){Ao.focus()}}else{vBulletin.warning("warning_gcpuser","please_enter_channel_title",function(){Ao.focus()})}});AV(document).on("click",".channel-config-dialog .main-channel-container .channel-item .channel-title div",function(){AV(this).hide();var Al=AV(this).next();Al.show();Al.select();Al.focus()});AV(document).on("keydown blur",".channel-config-dialog .main-channel-container .channel-item .channel-title input",function(Al){if(Al.type=="focusout"||(Al.type=="keydown"&&Al.which==13)){if(!AV.trim(this.value)&&Al.type=="focusout"){this.value=this.defaultValue}if(AV.trim(this.value)){AV(this).hide();AV(this).prev().text(this.value);AV(this).prev().show()}}});AV(document).on("click",".channel-config-dialog .channel-item .category-to-channel a",function(){var Al=AV(this).closest(".channel-item");Al.attr("data-switch-category",0);AV(this).parent().removeClass("category-to-channel").addClass("channel-to-category");AV(this).html(vBulletin.phrase.get("make_category"));return false});AV(document).on("click",".channel-config-dialog .channel-item .channel-to-category a",function(){var Al=AV(this).closest(".channel-item");Al.attr("data-switch-category",1);AV(this).parent().removeClass("channel-to-category").addClass("category-to-channel");AV(this).html(vBulletin.phrase.get("make_forum"));return false});AV(document).on("click",".channel-config-dialog .channel-item .toggle-button",function(){Ac(AV(this));return false});AV(document).on("click",".channel-config-dialog .channel-item .add-subchannel-button a",function(){var Al=AV(this).parent().siblings(".toggle-button");Ac(Al,true);var An=AV(this).closest(".channel-item-container");var Am=AP("","",vBulletin.phrase.get("new_channel"),0,An,0);U(An);Am.slideDown(100,function(){var Ao=An.find(".channel-item-inner").first().find(".num-subchannels");Ao.text(parseInt(Ao.text())+1);AV(".channel-title div",Am).click();AV(".channel-title input",Am).get(0).scrollIntoView(false);K()});return false});AV(document).on("click",".channel-config-dialog .channel-list .channel-item .close-button",function(){var Am=AV(this),An=AV("> .sub-channel-container > .channel-item-container",Am.closest(".channel-item-container")).length>0,Al=vBulletin.htmlEntities(Am.prev().text());openConfirmDialog({title:vBulletin.phrase.get("remove_forum_q"),message:vBulletin.phrase.get("do_you_want_to_remove_forum",Al,(An)?" "+vBulletin.phrase.get("subchannels_will_be_deleted"):""),iconType:"warning",onClickYes:function(){var Ar=Am.closest(".channel-item-container"),Aq=Ar.parent(),Ap=Am.closest(".channel-item").attr("data-channel-id");var Ao=function(){Ar.remove();if(Aq.hasClass("main-channel-container")){Aq.slideUp("fast",function(){AV(this).remove()})}};if(Ap){vBulletin.AJAX({call:"/ajax/api/content_channel/delete",data:{nodeid:Ap},success:function(As){Ao()},})}else{Ao()}}})})}function Ah(Am){function Al(Ao,Ap,An){vBulletin.AJAX({call:"/ajax/render/{0}_list".format(Ao),data:{page:Ap,isAjaxTemplateRenderWithData:true},complete:function(){AV("#config-dialog .loader").hide();AV("body").css("cursor","auto")},success:function(Aq){AV(("#top-level-{0} .channel-config-dialog").format(Ao)).html(Aq.template);if(An){vBulletin.pagination({context:("#top-level-{0} .channel-config-dialog").format(Ao),onPageChanged:function(Ar,As){Al(Ao,Ar)}})}},error_phrase:"error_fetching_channels"})}Al(Am,1,true);AV(document).on("click",".page_manager_table .channel_name div",function(){AV(this).hide();var An=AV(this).next();An.show();An.select();An.focus()});AV(document).on("keydown blur",".page_manager_table .channel_name input",function(Ap){if(Ap.type=="focusout"||(Ap.type=="keydown"&&Ap.which==13)){if(!AV.trim(this.value)&&Ap.type=="focusout"){this.value=this.defaultValue}var Ao=AV.trim(this.value),An=AV(this);if(Ao&&An.prev().html()!=Ao){AV("body").css("cursor","wait");vBulletin.AJAX({call:"/ajax/api/Content_Channel/update",data:{nodeid:An.parents(".channel_row").data("nodeid"),data:{title:Ao}},complete:function(){AV("#config-dialog .loader").hide();AV("body").css("cursor","auto")},success:function(Aq){An.hide();An.prev().html(Ao);An.prev().show()},error_phrase:"error_saving_page"})}}});AV(document).on("click",".page_manager_table .delete",function(){var An=AV(this);openConfirmDialog({title:vBulletin.phrase.get("remove_channel_q"),message:vBulletin.phrase.get("do_you_want_to_remove_channel",An.parents(".channel_row").find(".channel_name_val").text()),iconType:"warning",onClickYes:function(){vBulletin.AJAX({call:"/ajax/api/content_channel/delete",data:{nodeid:An.parents(".channel_row").data("nodeid")},success:function(Ao){An.parents(".channel_row").remove()}})}})})}var G=false;function AE(){AV("body").css("cursor","wait");var Al=function(An){var Am=An.index();if(Am==0&&!G){AK()}if((Am==1||Am==2)){Ah(AV(An.context).data("top-level"))}};o=AV("#manage-pages").tabs({beforeActivate:function(Ao,Ap){var An=Ap.newTab.index();if(An!=0&&x){var Am=openConfirmDialog({title:vBulletin.phrase.get("exit_without_saving_page"),message:vBulletin.phrase.get("forum_changes_will_be_lost"),iconType:"warning",onClickYes:function(){x=false;o.tabs("option","active",An)}});return false}},create:function(Am,An){Al(An.tab)},activate:function(Am,An){Al(An.newTab)}});o.tabs("option","active",0);AV("#manage-page-dropdown .lnkSaveChanges").on("click",function(){console.log("Saving forum/channel data");var Am=AV(this);if(Am.hasClass("h-disabled")){console.log("We're busy saving already. Try again later.");return }Am.addClass("h-disabled");vBulletin.loadingIndicator.show();AV("body").css("cursor","wait");var An=[];function Ao(Ar,Ap,Aq){var As=AV("> .channel-item-container",Ar);if(As.length>0){As.each(function(Au){var At=AV("> .channel-item",this);var Av=At.attr("data-channel-id");var Aw=At.attr("data-parent-id");subchannelObj={nodeid:Av||"0",previousParentId:Aw,title:AV(".channel-title div",At).html(),displayorder:Au+1,parentid:Aq||"0",subchannels:[]};if(At.attr("data-switch-category")!=null){subchannelObj.switchCategory=At.attr("data-switch-category")}Ap.subchannels.push(subchannelObj);Ao(At.next(".sub-channel-container"),Ap.subchannels[Au],Av)})}}if(p.forum){AV(".channel-config-dialog .channel-list .main-channel-container").each(function(Ar){var Aq=AV("> .channel-item-container > .channel-item",this);var As=Aq.attr("data-channel-id");var At=Aq.attr("data-parent-id");var Ap={nodeid:As,previousParentId:At,title:AV(".channel-title div",Aq).html(),displayorder:Ar+1,subchannels:[]};if(Aq.attr("data-switch-category")!=null){Ap.switchCategory=Aq.attr("data-switch-category")}Ao(Aq.next(".sub-channel-container"),Ap,As);An.push(Ap)});vBulletin.AJAX({call:"/ajax/api/widget/saveForums",data:{data:JSON.stringify(An)},complete:function(){AV("body").css("cursor","auto");vBulletin.loadingIndicator.hide();Am.removeClass("h-disabled")},success:function(Ap){console.log("Forum/channel changes successfully saved");if(Ap&&Ap.forums&&Ap.forums.length>0){x=false;p.forum=false;location.reload(true)}else{openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("error_saving_forums"),iconType:"error"});return false}},error_phrase:"error_saving_channels_code"})}else{console.log("No forum/channel changes to save");vBulletin.loadingIndicator.hide();AV("body").css("cursor","auto");Am.removeClass("h-disabled")}});AV(document).on("click","#manage-page-dropdown .lnkExitWithoutSaving",function(){if(x){openConfirmDialog({title:vBulletin.phrase.get("exit_without_saving_page"),message:vBulletin.phrase.get("do_you_want_to_exit_without_saving_page"),iconType:"warning",onClickYes:function(){location.reload(true)}})}else{location.reload(true)}})}function Q(){AV(document).on("focus click",".edit-mode .widget-content a, .edit-mode #channel-tabbar a, .edit-mode #btnSearch, .edit-mode #q",function(As){this.blur();return false});if(!AG){AZ()}if(!z){q()}else{b.thumbnailRadioCheckbox("check",AV("#select-template .template-border.selected").next("input"),false);if(!u){AV("#select-template .template-item input[value={0}]".format(AV("#pagetemplateid-yes").val())).prev().trigger("click")}}if(AV.isEmptyObject(AO)){n()}Ak();AV("#config_pagetemplateid").val("");r=undefined;if(u){AV("#save-page-form #pagetitle").val("");AV("#save-page-form #pageurl").val("");AV("#save-page-form #pagetemplateid").val("0");AV("#save-page-form #pageid").val("0");AV("#save-page-form #ishomeroute").prop("disabled",false).prop("checked",false)}AV("#edit-page-dropdown .lnkDeletePage").on("click",function(){openConfirmDialog({title:vBulletin.phrase.get("confirm_deletion_gcpglobal"),message:vBulletin.phrase.get("confirm_remove_page_desc"),buttonLabel:{yesLabel:vBulletin.phrase.get("delete_page"),noLabel:vBulletin.phrase.get("cancel")},iconType:"warning",onClickYes:function(){vBulletin.AJAX({call:"/ajax/api/page/delete",data:{pageid:pageData.pageid},dataType:"json",complete:function(){AV("body").css("cursor","auto")},success:function(As){console.log("deleted page "+pageData.pageid);window.location.href=pageData.baseurl},error:function(Au,At,As){console.log("page delete  failed! result:"+As);openAlertDialog({title:vBulletin.phrase.get("error"),message:vBulletin.phrase.get("error_deleting_page",Au.status),iconType:"error"})}})}})});AV("#edit-page-dropdown .lnkSaveChanges").on("click",function(){AV("#edit-page-dropdown .tabs li").removeClass("ui-tabs-active ui-state-active");AV("#edit-page-dropdown .tabs .tab").addClass("ui-tabs-hide");AV("#save-content").show();AV("#save-page-form .edit-page-template").css("display","");AV("#save-page-form .edit-page-template").prev("label").css("display","");if(AV("body").hasClass("lnkNewPage")){AV("#save-page-form .new-page-template input").prop("disabled",false);AV("#save-page-form .edit-page-template input").prop("disabled",true)}else{if(!AV("#pagetemplateid-yes").prop("checked")&&!AV("#pagetemplateid-no").prop("checked")){AV("#pagetemplateid-yes").prop("checked",true)}AV("#save-page-form .edit-page-template input").prop("disabled",false);AV("#save-page-form .new-page-template input").prop("disabled",true);if(u&&(!t&&!x)){AV("#save-page-form .edit-page-template").css("display","none");AV("#save-page-form .edit-page-template").prev("label").css("display","none")}if(AV("#pagetemplateid-yes").prop("checked")){AV("#save-page-form #templatetitle").prop("disabled",false);AV("#save-page-form #templatetitle-edit").prop("disabled",true);AV("#save-page-form .page-template-name").removeClass("h-hide")}else{AV("#save-page-form #templatetitle").prop("disabled",true);AV("#save-page-form #templatetitle-edit").prop("disabled",false);AV("#save-page-form .page-template-name").addClass("h-hide")}}});AV(document).on("click","#edit-page-dropdown .lnkExitWithoutSaving",function(){if(t||x||m||(!u&&(AV("#pagetitle").val()!=AV("#pagetitle").prop("defaultValue")||AV("#pageurl").val()!=AV("#pageurl").prop("defaultValue")))||(u&&(AV("#pagetitle").val()!=""||AV("#pageurl").val()!=""))){openConfirmDialog({title:vBulletin.phrase.get("exit_without_saving_page"),message:vBulletin.phrase.get("do_you_want_to_exit_without_saving_page"),iconType:"warning",onClickYes:function(){var As=parseInt(AV("input#pagetemplateid-new").val(),10);if(!isNaN(As)&&As>0){vBulletin.AJAX({call:"/ajax/api/page/deleteOrphanedPagetemplates",data:{pagetemplateids:[As]},success:function(At){console.log({msg:"/ajax/api/widget/deleteOrphanedPagetemplates success!",result:At,})},complete:function(){location.reload(true)},})}else{location.reload(true)}}})}else{location.reload(true)}});var Al=0;AV(window).on("resize.canvas",function(){clearTimeout(Al);Al=setTimeout(O,200)});var Ao=function(As){return'<label class="hide-icon module-button-item"><input type="checkbox" title="{0}" data-toggle-title="{1}"{2} /></label>'.format(vBulletin.phrase.get("check_to_hide_module"),vBulletin.phrase.get("uncheck_to_unhide_module"),As?' checked="checked"':"")};AV(".canvas-widget.container-widget .canvas-widget:not(.dummy-widget)").each(function(){var As=AV(this).hasClass("hidden-widget");AV(".module-buttons .admin-only",this).prepend(Ao(As));if(As){AV(".module-buttons .admin-only .hide-icon input",this).trigger("click").prop("checked",true)}});var Ar=function(Au,Av,Ax){var Aw=Av.item,Ax=Av.item.hasClass("module-item");var As=AV("> .canvas-widget.container-widget {0}".format(Ax?".module-item":".canvas-widget.container-widget"),this);if(As.length>0){var At=As.closest(".canvas-widget.container-widget");if(At.attr("data-widget-id")==As.attr("data-widget-id")){if(Ax){As.remove()}else{if(Av.sender){Av.sender.sortable("cancel")}else{AV(this).sortable("cancel")}}Ap=true;openAlertDialog({title:vBulletin.phrase.get("move_not_allowed"),message:vBulletin.phrase.get("dropping_container_module_into_container_module_not_allowed"),iconType:"warning"});return true}return false}return false};var An=function(As){if(As.parents(".canvas-widget.container-widget").length>0){if(AV(".module-buttons .admin-only .hide-icon",As).length==0){AV(".module-buttons .admin-only",As).prepend(Ao())}}else{As.removeClass("hidden-widget").find("> .widget-header .module-buttons .admin-only .hide-icon").remove()}};var Ap=false;AN=AV(".edit-mode .canvas-layout .canvas-widget-list:not(.js-draggable-module-target)");AN.sortable({revert:true,tolerance:"pointer",connectWith:".edit-mode .canvas-layout:visible .canvas-widget-list",placeholder:"canvas-widget canvas-widget-highlight drag-highlight",create:function(){O();AA()},update:function(At,Au){var Ax=this;if(Aa){if(!Ap){Ai(Au.item,function(A1){A1=A1.filter(function(){return this.nodeType===Node.ELEMENT_NODE});Au.item.replaceWith(A1);A1.filter(":not(.container-widget)").find(".toggle-button").trigger("click",[true]);if(!Ar.apply(Ax,[At,Au])){An(A1);A1.addClass("shadow").find(".widget-tabs").andSelf().filter(".widget-tabs").tabs();M();A1.parents(".canvas-widget.container-widget").find(".canvas-widget.dummy-widget").remove();var A2=A1.parents(".canvas-widget.container-widget");if(A2.length==1){A2.find(".canvas-widget-highlight").remove();A2.find(".module-item").remove()}}var Az=A1.data("widget-id"),Ay=s(A1),A0=function(A3){A1.attr("data-widget-instance-id",A3);if(Ay){R(A1)}i(A1)};if(Az){k(Ay,Az,{},A0)}})}}else{if(!Ar.apply(Ax,[At,Au])){An(Au.item);M()}if(AV.contains(this,Au.item[0])){var Aw=Au.item.closest(".canvas-widget"),As=s(Aw),Av=Aw.data("widget-instance-id")||0;R(Aw);if(Av){vBulletin.AJAX({call:"/ajax/api/widget/saveWidgetinstanceContainerinstanceid",data:{widgetinstanceid:Av,containerinstanceid:As},success:function(Ay){console.log("saveWidgetinstanceContainerinstanceid success: "+JSON.stringify(Ay))}})}}}if(Au.sender){var Aw=Au.sender.closest(".canvas-widget");if(Aw.length){R(Aw)}}t=true},out:function(As,At){AV(this).css("overflow","")},sort:function(As,At){if(v){Aa=true}var Au=At.placeholder.closest(".canvas-widget.container-widget");if(Au.length==1&&Au.find(".canvas-widget:last-child").hasClass("canvas-widget-highlight")){At.placeholder.css({"margin-bottom":0,"margin-top":-3})}else{At.placeholder.css({"margin-bottom":"","margin-top":""})}},start:function(As,At){E("hidden",At.item)},over:function(As,At){},stop:function(At,Au){AV(this).css("overflow","");Ap=false;AA();Aa=false;Au.item.height("auto");E("visible");AV(".canvas-layout .canvas-widget-list .canvas-widget-highlight").remove();var As=AV(".canvas-layout > .canvas-layout-row .canvas-widget-list > .canvas-widget.container-widget");AV(".canvas-layout > .canvas-layout-row .canvas-widget-list > .canvas-widget.container-widget").each(function(){var Av=AV(".canvas-widget-list",this);if(Av.children().length==0){Av.append('<div class="canvas-widget dummy-widget"><span>{0}</span></div>'.format(vBulletin.phrase.get("you_can_also_drag_and_drop_modules_here")))}else{if(Av.find(".canvas-widget.dummy-widget").length>0&&Av.find(".canvas-widget:not(.dummy-widget,.canvas-widget-highlight)").length>0){Av.find(".canvas-widget.dummy-widget").remove()}}})},receive:function(As,At){if(At.item.hasClass("module-item")){Ar.apply(this,[As,At,true])}},handle:".move-icon",items:".canvas-widget:not(.js-widget-non-sortable,.js-widget-pinned-sortable)",}).find(".canvas-widget .widget-header").disableSelection();AV(document).on("click",".edit-mode .canvas-widget .js-pin-module-button",function(){var Ax=AV(this),Aw=Ax.closest(".canvas-widget"),As=Aw.find("js-move-button"),Av="js-widget-pinned-sortable",Au="pin-icon--pinned",At=Aw.hasClass(Av);Aw.toggleClass(Av,!At);Ax.toggleClass(Au,!At)});AV(document).on("click",".edit-mode .canvas-widget .close-button",function(){var As=AV(this);openConfirmDialog({title:vBulletin.phrase.get("remove_module_q"),message:vBulletin.phrase.get("do_you_want_to_remove_module",As.closest(".widget-header").find(".module-title").text()),iconType:"warning",onClickYes:function(){var Aw=As.closest(".canvas-widget"),Av=Aw.data("widget-instance-id"),Au=Aw.parent(),At=Aw.parents(".canvas-widget.container-widget");Aw.remove();AA();M();t=true;AQ([Av]);R(Au);if(At.find(".canvas-widget").length==0){At.find(".canvas-widget-list").append('<div class="canvas-widget dummy-widget"><span>{0}</span></div>'.format(vBulletin.phrase.get("you_can_also_drag_and_drop_modules_here")))}}})});AV(document).on("click",".edit-mode .js-search-widget .edit-button",function(){E("hidden");Am(AV(this).closest(".js-search-widget"));AV("#search-config-dialog").dialog("open");return false});function Aq(A4,A3){var As=AV("#edit-page-dropdown .lnkSaveChanges .label").text();if(!A3){if(!AV.trim(AV("#save-page-form #pagetitle").val())){openAlertDialog({title:As,message:vBulletin.phrase.get("please_enter_page_name"),iconType:"warning",onAfterClose:function(){AV("#save-page-form #pagetitle").focus()}});return false}if(AV("body").hasClass("lnkEditPage")){var A2=AV("#save-page-form #pagetemplateid-yes");var At=AV("#save-page-form #pagetemplateid-no");if(!A2.prop("checked")&&!At.prop("checked")){openAlertDialog({title:As,message:vBulletin.phrase.get("please_choose_overwrite_template_options"),iconType:"warning",onAfterClose:function(){AV("#save-page-form #pagetemplateid-yes").focus()}});return false}else{if(At.prop("checked")){var Au=AV("#save-page-form #templatetitle-edit");var A7=AV.trim(Au.val());if(!A7||A7==Au.prop("defaultValue")){openAlertDialog({title:As,message:vBulletin.phrase.get("please_enter_new_template_name"),iconType:"warning",onAfterClose:function(){AV("#save-page-form #templatetitle-edit").focus()}});return false}openConfirmDialog({title:As,message:vBulletin.phrase.get("applying_new_template",AV("#save-page-form #templatetitle-edit").val()),buttonLabel:{yesLabel:vBulletin.phrase.get("save_page"),noLabel:vBulletin.phrase.get("cancel")},iconType:"warning",onClickYes:function(){},onAfterClose:function(){if(AV(this).attr("id")=="btnConfirmDialogYes"){AV("#save-page-form #btnOK").trigger("click",true)}}});return false}else{if(A2.prop("checked")){if(u&&(!t&&!x)){AV("#save-page-form #btnOK").trigger("click",true)}else{openConfirmDialog({title:As,message:vBulletin.phrase.get("overwrite_template_continue"),buttonLabel:{yesLabel:vBulletin.phrase.get("save_page"),noLabel:vBulletin.phrase.get("cancel")},iconType:"warning",onClickYes:function(){},onAfterClose:function(){if(AV(this).attr("id")=="btnConfirmDialogYes"){AV("#save-page-form #btnOK").trigger("click",true)}}})}return false}}}}else{var Au=AV("#save-page-form #templatetitle-new");var A7=AV.trim(Au.val());if(!A7||A7==Au.prop("defaultValue")){openAlertDialog({title:As,message:vBulletin.phrase.get("please_enter_new_template_name"),iconType:"warning",onAfterClose:function(){AV("#save-page-form #templatetitle-new").focus()}});return false}}}var A6=AV(".canvas-layout:visible");Ad=A6.attr("id");var A1=parseInt(A6.attr("data-layout-id"),10);AV("#save-page-form #screenlayoutid").val(A1);function Av(BB){var BC={widgetId:BB.attr("data-widget-id"),widgetInstanceId:(BB.attr("data-widget-instance-id")||"0")};if(BB.hasClass("container-widget")){var A8=[];var BA=[];AV("div.canvas-widget-list > div.canvas-widget",BB).each(function(BD){if(!AV(this).hasClass("hidden-widget")){BA.push(AV(this).attr("data-widget-instance-id"))}A8.push(Av(AV(this)))});BC.subModules=A8;BC.displaySubModules=BA}if(BB.data("is-tabbed-container")){var A9=[];BB.find("> .js-admin-widget-content > .js-admin-widget-tab").each(function(){var BD=AV(this);BD.find("> .widget-content > .canvas-layout-row > .canvas-widget-list > .canvas-widget:not(.dummy-widget)").each(function(){var BE=AV(this);A9.push(Av(BE))})});BC.tabbedContainerSubModules=A9}return BC}AV('input[type=hidden][name*="displaysections"]',A6).clone().appendTo(AV("#moduleData").empty());AV("#"+Ad+" > .canvas-layout-row > div.canvas-widget-list").each(function(){var A8=[],A9=J(this);AV(this).children("div.canvas-widget").each(function(){A8.push(Av(AV(this)))});AV('#save-page-form input[name="displaysections['+A9+']"]').val(JSON.stringify(A8))});var A0=AV("#save-page-form"),Az=A0.find("#ishomepage"),Ax={};if(!Az.prop("disabled")){Ax.ishomepage=0}AV.each(A0.serializeArray(),function(A8,A9){Ax[A9.name]=A9.value});function A5(A8){vBulletin.AJAX({call:"/admin/savepage",data:{input:A8,url:window.location.href},complete:function(){AV("body").css("cursor","auto")},success:function(A9){if(A9.url!=null){window.location.href=A9.url}},error_phrase:"error_saving_page",})}var Aw=AV("input[name='screenlayoutid'][value='"+A1+"']");if(Aw.length>0&&Aw.attr("data-guid")=="vbulletin-screenlayout-bare-full-57433eecd10803.93763070"){var Ay={title:vBulletin.phrase.get("warning"),message:vBulletin.phrase.get("you_cannot_revert_this_layout_confirm"),onClickYes:function(){A5(Ax)}};openConfirmDialog(Ay)}else{A5(Ax)}}AV(document).on("click","#save-page-form #btnOK",Aq);AV("#config-dialog").dialog({title:vBulletin.phrase.get("module_configuration"),autoOpen:false,modal:true,resizable:false,closeOnEscape:false,showCloseButton:false,height:500,width:800,dialogClass:"dialog-container config-dialog-container input-dialog",open:function(){AV("#config-dialog .loader").show();AV("body").css("cursor","wait")},create:function(){AV(document).on("submit",".sitebuilder-widget-form",function(){function At(Av){AV("body").css("cursor","wait");AV("#config-dialog .js-button").prop("disabled",true);var Aw=AV("#config-dialog").data("selected-module");var Au=Av.action;vBulletin.AJAX({url:Au,type:Av.method,data:(AV(Av).serializeArray()),success:function(Ay){AV("body").css("cursor","auto");if(Ay.data){var Ax=Ay.data.title||Ay.data.searchResultTitle||Ay.data.searchTitle;if(Ax){Aw.find(".module-title .admin-only").text(vBulletin.phrase.get("x_module",Ax))}switch(Ay.data.widget_type){case"custom-html-widget":Aw.find(".widget-content").html(Ay.data.html);l(Aw,true);break;case"video-widget":var Az=Ay.data.embed_data;if(Az){var A2=Aw.find(".widget-content .videocontainer");if(A2.length==0){A2=AV("<div />").addClass("videocontainer").appendTo(Aw.find(".widget-content"))}var A1={code:Az.code,provider:Az.provider,width:"100%",height:260};AV.post(vBulletin.getAjaxBaseurl()+"/ajax/render/bbcode_video",A1,function(A3){if(A3){A2.empty().append(A3);l(Aw,true)}},"json");Aw.find(".widget-content").find(".note").addClass("h-hide")}break}var A0=AV('select[name="data[default_tab]"]',AV(Av));if(A0.length>0){Aw.attr("data-widget-default-tab",A0.val())}x=true}AV("#config-dialog").dialog("close")},after_error:function(){AV("#config-dialog .loader").hide();AV("#config-dialog .js-button").prop("disabled",false)},error_phrase:["error_saving_configuration_module",AV("#config-dialog .widget-name h1").text()],})}var As=this;At(As);return false});AV("#btnCloseConfig").on("click",function(){AV("#config-dialog").dialog("close")})},close:function(){E("visible");AV("#config-dialog .js-button").prop("disabled",false)}});AV("#pagetitle").on("keyup blur",function(As){if(u){AV("#pageurl").val(this.value.replace(/[^\w-]+/g,""))}return true});AV("#save-page-form #pagetemplateid-yes").on("click",function(){AV("#save-page-form .template-name").addClass("h-hide");AV("#save-page-form #templatetitle").prop("disabled",false);AV("#save-page-form #templatetitle-edit").prop("disabled",true);AV("#save-page-form .page-template-name").removeClass("h-hide")});AV("#save-page-form #pagetemplateid-no").on("click",function(){AV("#save-page-form .template-name").removeClass("h-hide");AV("#save-page-form #templatetitle").prop("disabled",true);AV("#save-page-form #templatetitle-edit").prop("disabled",false);AV("#save-page-form .page-template-name").addClass("h-hide")});function Am(As){if(typeof h.search_config_dialog=="undefined"){vBulletin.AJAX({call:"/ajax/render/dialog_search_config",success:function(At){h.search_config_dialog=At;AV("body").append(At);Am(As)},error_phrase:"error_fetching_dialog"});return }if(As){AV("#search-config-dialog").data("search-widget",As)}AV("#search-config-dialog").dialog({title:vBulletin.phrase.get("edit_search_module"),autoOpen:true,modal:true,resizable:false,closeOnEscape:false,showCloseButton:false,width:800,dialogClass:"dialog-container search-config-dialog-container input-dialog",close:function(){E("visible")},open:function(){var At=this;AV("#customSearchDialog",At).addClass("h-invisible");AV("body").css("cursor","wait");setTimeout(function(){vBulletin.search=vBulletin.search||{};var Aw=function(){S=new vBulletin.search.SearchControl("#customSearchDialog");T(S)};var Av=AV("#search-config-dialog").data("search-widget");var Ay={id:Av.attr("data-widget-id"),instanceid:Av.attr("data-widget-instance-id")};if(typeof vBulletin.search.SearchControl=="undefined"){var Ax=["/js/jquery/jquery.qtip.min.js","/js/tag-editor.js","/js/sb_search.js"];var Au=function(){if(Ax.length==0){AV("body").css("cursor","auto");AV("#customSearchDialog",At).removeClass("h-invisible");Aw();return }var Az=Ax.shift();AV.getScript(vBulletin.getAjaxBaseurl()+Az+"?"+pageData.simpleversion,Au).error(function(A3,A2,A0){var A1=(A0&&A0.message)?"{0}: {1}".format(vBulletin.phrase.get("error"),A0.message):"HTTP {0}: {1}".format(A3.status,A3.statusText);AV("#search-config-dialog").dialog("close");openAlertDialog({title:vBulletin.phrase.get("error"),message:"{0}<br /><br />({1})".format(vBulletin.phrase.get("error_loading_search_config_script"),A1),iconType:"error"})}).complete(function(){})};Au()}else{AV("#customSearchDialog",At).removeClass("h-invisible");Aw()}},1);x=false},create:function(){AV("#btnSaveSearchConfig").on("click",function(){AV("body").css("cursor","wait");var Av=AV("#search-config-dialog").data("search-widget");var A3={id:Av.attr("data-widget-id"),instanceid:Av.attr("data-widget-instance-id")};var Ay={pageid:pageData.pageid,widgetid:A3.id,widgetinstanceid:A3.instanceid,pagetemplateid:AV("#select-template input[type=radio]:checked").val(),searchJSON:{}};var A7=AV("#searchTitle");if(A7.length>0&&AV.trim(A7.val()).length>0){Ay.searchTitle=AV.trim(A7.val());A7.data("defaultValue",Ay.searchTitle)}var A0=AV("#resultsPerPage");if(A0.length>0&&AV.trim(A0.val()).length>0){Ay.resultsPerPage=AV.trim(A0.val());A0.data("defaultValue",Ay.resultsPerPage)}var Aw=["hide_avatars","hide_module_when_empty","hide_usernames","displayFooter"];for(var Az=0;Az<Aw.length;Az++){var At=Aw[Az],Ax=AV("input[name='"+At+"'][value='1']");if(Ax.length>0&&Ax.prop("checked")){Ay[At]="1";Ax.data("defaultValue","1")}else{Ay[At]="0";Ax.data("defaultValue","0")}}var A2=AV(".js-searchmodule-show-at-breakpoints");if(A2.length>0){Ay.show_at_breakpoints={desktop:1,small:1,xsmall:1};A2.find("input").each(function(){var A8=AV(this);switch(A8.prop("name")){case"show_at_breakpoints[desktop]":Ay.show_at_breakpoints.desktop=A8.prop("checked")?1:0;break;case"show_at_breakpoints[small]":Ay.show_at_breakpoints.small=A8.prop("checked")?1:0;break;case"show_at_breakpoints[xsmall]":Ay.show_at_breakpoints.xsmall=A8.prop("checked")?1:0;break}});A2.data("defaultValue",Ay.show_at_breakpoints)}var A6=AV("#search-config-dialog .js-sb-module-config--viewpermissions");if(A6.length>0){Ay.module_viewpermissions={};var A1=A6.find("input.js-module_viewpermissions__key:checked"),A5="show_all",Au=A6.find("input.js-module_viewpermissions__value:checked"),A4="all";if(A1.length){A5=A1.prop("value")}if(Au.length){A4=[];AV.each(Au,function(A8,A9){A4.push(AV(A9).prop("value"))})}Ay.module_viewpermissions={key:A5,value:A4,}}Ay.searchJSON=S.load();vBulletin.AJAX({call:"/ajax/api/widget/saveSearchWidgetConfig",data:{data:JSON.stringify(Ay)},complete:function(){AV("body").css("cursor","auto")},success:function(A8){if(A8.widgetinstanceid>0&&A8.searchJSON){Av.attr("data-widget-instance-id",A8.widgetinstanceid);Av.find(".main-title").text(Ay.searchTitle);AV("#config_widgetinstanceid").val(A8.widgetinstanceid);AV("#config_pagetemplateid").val(A8.pagetemplateid);AV("#pagetemplateid-new").val(A8.pagetemplateid);AV("#search-config-dialog").dialog("close");l(Av,true);x=true}},error_phrase:"error_saving_search_config",})});AV("#btnCancelSearchConfig").on("click",function(){function At(){AV("#search-config-dialog").dialog("close");S.set("{}");var A3=AV("#search-config-dialog #searchTitle");A3.val(A3.data("defaultValue"));var Az=AV("#search-config-dialog #resultsPerPage");Az.val(Az.data("defaultValue"));var Aw=["hide_avatars","hide_module_when_empty","hide_usernames","displayFooter"];for(var Ay=0;Ay<Aw.length;Ay++){var Av=Aw[Ay],Ax=AV("#search-config-dialog input[name='"+Av+"'][value='1']"),A0=AV("#search-config-dialog input[name='"+Av+"'][value='0']");if(Ax.data("defaultValue")=="1"){Ax.prop("checked",true)}else{A0.prop("checked",true)}}var A1=AV("#search-config-dialog .js-searchmodule-show-at-breakpoints");if(A1.length>0){var A2=A1.data("defaultValue");if(typeof (A2)!="undefined"){A1.find("input").each(function(){var A4=AV(this);switch(A4.prop("name")){case"show_at_breakpoints[desktop]":A4.prop("checked",A2.desktop?"checked":"");break;case"show_at_breakpoints[small]":A4.prop("checked",A2.small?"checked":"");break;case"show_at_breakpoints[xsmall]":A4.prop("checked",A2.xsmall?"checked":"");break}})}}}if(x){var Au=AV(this);openConfirmDialog({title:vBulletin.phrase.get("cancel_edit"),message:vBulletin.phrase.get("do_you_want_to_cancel_editing_search_module"),iconType:"warning",onClickYes:At})}else{At()}})}})}AV("#blog-category-dialog").dialog({title:vBulletin.phrase.get("edit_blog_categories"),autoOpen:false,modal:true,resizable:false,closeOnEscape:false,showCloseButton:false,width:800,dialogClass:"dialog-container blog-category-dialog-container input-dialog",close:function(){E("visible")},open:function(){var As=this;x=false},create:function(){AV("#blog-category-dialog #btnSaveCategories").on("click",function(){AV("body").css("cursor","wait");AV("#blog-category-dialog dialog-content loader").show();var As=AV("#search-config-dialog").data("blog-category-widget");var At={id:As.attr("data-widget-id"),instanceid:As.attr("data-widget-instance-id")};vBulletin.AJAX({call:"/ajax/api/widget/saveBlogCategories",data:{},complete:function(){AV("body").css("cursor","auto");AV("#blog-category-dialog dialog-content loader").hide()},success:function(Au){AV("#blog-category-dialog dialog-content widget-config-container").html(Au)},error_phrase:"error_saving_blog_categories"})});AV("#blog-category-dialog #btnNewCategory").on("click",function(){});AV("#blog-category-dialog #btnCloseCategories").on("click",function(){if(x){var As=AV(this);openConfirmDialog({title:vBulletin.phrase.get("cancel_edit"),message:vBulletin.phrase.get("do_you_want_to_cancel_editing_blog_categories_module"),iconType:"warning",onClickYes:AV("#blog-category-dialog").dialog("close")})}else{AV("#blog-category-dialog").dialog("close")}})}})}function T(Al){var An=AV(this).closest(".canvas-widget"),Am=AV("#search-config-dialog").data("search-widget"),Ao={id:Am.attr("data-widget-id"),instanceid:Am.attr("data-widget-instance-id")};vBulletin.AJAX({call:"/ajax/api/widget/fetchSearchConfig",data:({widgetid:Ao.id,widgetinstanceid:Ao.instanceid||"",pagetemplateid:W(),configtype:"admin"}),complete:function(){AV("body").css("cursor","auto")},success:function(Ap){if(Ap.searchTitle){AV("#searchTitle").val(Ap.searchTitle)}if(Ap.resultsPerPage){AV("#resultsPerPage").val(Ap.resultsPerPage)}var Au=["hide_avatars","hide_module_when_empty","hide_usernames","displayFooter"];for(var At=0;At<Au.length;At++){var Ar=Au[At];value=((Ap[Ar]&&parseInt(Ap[Ar],10)==1)?1:0);AV("input[name='"+Ar+"'][value='"+value+"']").prop("checked",true)}if(Ap.show_at_breakpoints){var Av=AV("#search-config-dialog .js-searchmodule-show-at-breakpoints");if(Av.length>0){Av.find("input").each(function(){var Aw=AV(this);switch(Aw.prop("name")){case"show_at_breakpoints[desktop]":Aw.prop("checked",Ap.show_at_breakpoints.desktop?"checked":"");break;case"show_at_breakpoints[small]":Aw.prop("checked",Ap.show_at_breakpoints.small?"checked":"");break;case"show_at_breakpoints[xsmall]":Aw.prop("checked",Ap.show_at_breakpoints.xsmall?"checked":"");break}})}if(Ap.module_viewpermissions){var Aq=AV("#search-config-dialog .js-searchmodule-module_viewpermissions--replaceme"),As=C({defaultvalue:Ap.module_viewpermissions});Aq.replaceWith(As)}}Al.set(Ap.searchJSON||{},Ap.contentTypes||{},Ap.channels||{});AV("#config-dialog .dialog-content .widget-config-container").show();AV("#search-config-dialog .form_layout .form_row .field_column select").selectBox();AV("#config-dialog .loader").hide()},after_error:function(){AV("#config-dialog .loader").hide();AV("#config-dialog").dialog("close")}})}AV(document).ready(function(){AL()})})(jQuery);