Current File : /home/n742ef5/royalanteam.com/wp-content/plugins/security-malware-firewall/js/spbc-settings.min.js |
function spbcSwitchTab(e,t){var s=e.classList[1].replace("spbc_tab_nav-",""),n=new URLSearchParams(window.location.search),c=(n.set("spbc_tab",s),window.location.hash),c=window.location.pathname+"?"+n.toString()+c;if(history.replaceState(null,"",c),"backups"!==n.get("spbc_tab")&&jQuery(".spbc_tab_nav-backups").hide(),jQuery(".spbc_tab_nav").removeClass("spbc_tab_nav--active"),jQuery(".spbc_tab").removeClass("spbc_tab--active"),jQuery(e).addClass("spbc_tab_nav--active"),jQuery(".spbc_tab-"+s).addClass("spbc_tab--active"),jQuery(e).data("loaded")){if(t&&t.action)switch(t.action){case"highlight":spbcHighlightElement(t.target,t.times);break;case"click":setTimeout(function(){jQuery("#"+t.additional.target).click()},500)}}else{c={action:"spbc_settings__draw_elements",tab_name:s,security:spbcSettings.ajax_nonce};t={callback:spbcDrawSettingsCallback,notJson:!0,additional:t||null},spbcSendAJAXRequest(c,t,e)}}function spbcDrawSettingsCallback(e,t,s,n){jQuery(n).data("loaded",!0),jQuery(".spbc_tab-"+t.tab_name).replaceWith(e);n=jQuery(".spbc_tab-"+t.tab_name);if(n.addClass("spbc_tab--active"),jQuery(document).off("click",".spbc_long_description__show"),jQuery(document).on("click",".spbc_long_description__show",function(){spbcSettingsShowDescription(self=jQuery(this),self.attr("setting"))}),jQuery(document).off("click",".spbc_long_recommendation__show"),jQuery(document).on("click",".spbc_long_recommendation__show",function(){spbcSettingsShowRecommendation(self=jQuery(this),self.attr("setting"))}),s.additional)switch(s.additional.action){case"highlight":spbcHighlightElement(s.additional.target,s.additional.times);break;case"click":setTimeout(function(){jQuery("#"+s.additional.target).click()},500)}jQuery(n).on("click",".spbc_hint-send_"+t.tab_name,function(){jQuery(".spbc_hint-send_"+t.tab_name).hide(),spbcSendAJAXRequest({action:"spbc_send_"+t.tab_name,tab_name:t.tab_name},{callback:spbcSendLogsCallback})}),window.location.hash&&document.getElementById(window.location.hash.substring(1)).scrollIntoView(),document.dispatchEvent(new CustomEvent("spbctTabLoaded",{bubbles:!0,detail:{tab:t.tab_name}})),"function"==typeof spbcHighlightCriticalFilesNotice&&spbcHighlightCriticalFilesNotice(!1),spbcSaveSettingsButtonMobileLayout(),window.addEventListener("resize",e=>{spbcSaveSettingsButtonMobileLayout()})}function spbcSaveSettingsButtonMobileLayout(){var e=document.querySelector('div[name="spbc_settings--save_button_custom"]');e&&(900<window.innerWidth?e.style.display="none":e.style.display="flex")}function spbcSendLogsCallback(e,t,s,n){jQuery(".spbc_tab_nav-"+t.tab_name).data("loaded",!1),spbcSwitchTab(document.getElementsByClassName("spbc_tab_nav-"+t.tab_name)[0])}function spbcSettingsDependenciesbyId(e,i){"string"==typeof e&&((tmp=[]).push(e),e=tmp),i=void 0===i?null:+i,e.forEach(function(e,t,s){let n=document.getElementById("spbc_setting_"+e);function c(){n.setAttribute("disabled","disabled")}function o(){n.removeAttribute("disabled")}(null!==i?1===i?o:c:null===n.getAttribute("disabled")?c:o)()})}function spbcSettingsDependencies(e,i){e="string"==typeof e?e.split(","):e,i=void 0===i?+event.target.checked:+i,e.forEach(function(e,t,s){document.getElementsByName("spbc_settings["+e+"]").forEach(function(e,t,s){function n(){e.setAttribute("disabled","disabled")}function c(){e.removeAttribute("disabled")}(null!==i?1===i?c:n:null===e.getAttribute("disabled")?n:c)();var o=e.getAttribute("children");null!==o&&spbcSettingsDependencies(o,i&&e.checked)})})}function spbcSettingsShowDescription(e,t){function c(e){void 0!==e&&(0!=jQuery(e.target).parent(".spbc_long_desc").length&&!jQuery(e.target).hasClass("spbc_long_desc__cancel")||jQuery(e.target).hasClass("spbc_long_description__show"))||(jQuery(".spbc_long_desc").remove(),jQuery(document).off("click",c))}c(),e.after("<div id='spbc_long_desc__"+t+"' class='spbc_long_desc'></div>");var s=jQuery("#spbc_long_desc__"+t);s.append("<i class='spbc-icon-spin1 animate-spin'></i>").append("<div class='spbc_long_desc__angle_top_left'></div>").css({top:e.position().top+25,left:e.position().left+5}),spbcSendAJAXRequest({action:"spbc_settings__get_description",setting_id:t},{spinner:s.children("img"),callback:function(e,t,s,n){n.empty().append("<div class='spbc_long_desc__angle_top_left'></div>").append("<i class='spbc_long_desc__cancel spbc-icon-cancel'></i>").append("<h3 class='spbc_long_desc__title'>"+e.title+"</h3>").append("<p>"+e.desc+"</p>"),jQuery(document).on("click",c)}},s)}function spbcSettingsShowRecommendation(e,t){function c(e){void 0!==e&&(0!=jQuery(e.target).parent(".spbc_long_desc").length&&!jQuery(e.target).hasClass("spbc_long_desc__cancel")||jQuery(e.target).hasClass("spbc_long_recommendation__show"))||(jQuery(".spbc_long_desc").remove(),jQuery(document).off("click",c))}c(),e.after("<div id='spbc_long_desc__"+t+"' class='spbc_long_desc'></div>");var s=jQuery("#spbc_long_desc__"+t);s.append("<i class='spbc-icon-spin1 animate-spin'></i>").append("<div class='spbc_long_desc__angle_top_left'></div>").css({top:e.position().top+25,left:e.position().left+5}),spbcSendAJAXRequest({action:"spbc_settings__get_recommendation",setting_id:t},{spinner:s.children("img"),callback:function(e,t,s,n){n.empty().append("<div class='spbc_long_desc__angle_top_left'></div>").append("<i class='spbc_long_desc__cancel spbc-icon-cancel'></i>").append("<h3 class='spbc_long_desc__title' style='margin-right: 2em;'>"+e.title+"</h3>").append("<p>"+e.desc+"</p>"),jQuery(document).on("click",c)}},s)}function spbcStartShowHide(){jQuery(".spbcShortText").off("mouseover").on("mouseover",function(){jQuery(this).next().show()}).off("mouseout").on("mouseout",function(){jQuery(this).next().hide()}),jQuery(".spbcFullText").off("mouseout").on("mouseout",function(){jQuery(this).hide()}).off("mouseover").on("mouseover",function(){jQuery(this).show()})}function spbctGenerateConfirmationCode(){var e={};let t={success:!1};return e.security=spbcSettings.ajax_nonce,e.action="spbc_generate_confirmation_code",jQuery.ajax({type:"POST",async:!1,url:spbcSettings.ajaxurl,data:e,success:function(e){e.success?t.success=!0:t.text=e.data}}),t}function spbctCheckConfirmationCode(e,t,s){let n=e;e={};e.security=spbcSettings.ajax_nonce,e.action="spbc_check_confirmation_code",e.code=jQuery("#confirmation-code input").val(),jQuery.ajax({type:"POST",async:!1,url:spbcSettings.ajaxurl,data:e,success:function(e){e.success?(jQuery("[name *= 2fa__enable]").attr("checked",""),n.checked=!0,jQuery("#spbc_setting_2fa__roles").removeAttr("disabled"),jQuery("#spbc_setting_2fa__roles > option:first").attr("selected","selected"),clearTimeout(t),s.remove(),jQuery("#confirmation-code").dialog("close")):alert("Code verification failed!")}})}function spbcBannerCheck(){let c=setInterval(function(){spbcSendAJAXRequest({action:"spbc_settings__check_renew_banner"},{callback:function(e,t,s,n){e.close_renew_banner&&(jQuery("#spbc_renew_notice").length&&jQuery("#spbc_renew_notice").hide("slow"),jQuery("#spbc_trial_notice").length&&jQuery("#spbc_trial_notice").hide("slow"),clearInterval(c))}})},6e4)}function spbcToggleClass(t,s){for(let e=0;e<t.length;e++)t[e].classList.toggle(s)}String.prototype.printf=function(){let e=this;for(var t in arguments){var s=e.substring(0,e.indexOf("%s",0)),n=e.substring(e.indexOf("%s",0)+2,e.length);e=s+arguments[t]+n}return e},jQuery(document).ready(function(){document.dispatchEvent(new CustomEvent("spbctPage",{bubbles:!0})),document.dispatchEvent(new CustomEvent("spbctPageTabs",{bubbles:!0})),document.dispatchEvent(new CustomEvent("spbctMobAboutCT",{bubbles:!0})),jQuery(document).on("click","[name*=fa__enable]:not([value=0]),#confirmation-code--resend",function(e){e.preventDefault();jQuery("#confirmation-code--resend").attr("disabled","disabled").append('<div class="circle circle--small -animation--circle -animation--30s "><div class="circle-inner"></div></div>');let t=setTimeout(function(){jQuery("#confirmation-code--resend").removeAttr("disabled"),jQuery("#confirmation-code--resend>.circle").remove()},3e4);var s=spbctGenerateConfirmationCode();s.success?(jQuery("#confirmation-code input").val(""),jQuery("#confirmation-code").dialog({modal:!0,title:"Confirmation code",width:310,buttons:{Cancel:function(){jQuery(this).dialog("close"),clearTimeout(t),jQuery("#confirmation-code--resend>.circle").remove()},Ok:function(){spbctCheckConfirmationCode(e.target,t,jQuery("#confirmation-code--resend>.circle"))}},draggable:!1,resizable:!1})):alert(s.text)}),(jQuery("#spbc_renew_notice").length||jQuery("#spbc_trial_notice").length)&&spbcBannerCheck(),spbcSettings.key_changed&&jQuery("#spbc_button__sync").click(),jQuery(document).on("click","#spbc_setting_get_key_auto",function(){spbcSendAJAXRequest({action:"spbc_get_key_auto",ct_admin_timezone:jQuery("#spbc_admin_timezone").val()},{timeout:25e3,button:document.getElementById("spbc_setting_get_key_auto"),spinner:jQuery("#spbc_setting_get_key_auto .spbc_preloader_button"),callback:function(e,t,s,n){jQuery("#spbc_setting_get_key_auto .spbc_success").show(300),setTimeout(function(){jQuery("#spbc_setting_get_key_auto .spbc_success").hide(300)},2e3),e.reload&&document.location.reload(),e.msg&&spbcModal.open().putError(e.msg),e.getTemplates&&(spbcModal.loaded=e.getTemplates,spbcModal.open(),document.addEventListener("spbcModalClosed",function(e){document.location.reload()}))}})}),jQuery(document).on("click","#spbc_settings_templates_import_button",function(){jQuery("#spbc-ajax-result").remove();var e=jQuery("option:selected",jQuery("#spbc_settings_templates_import"));if(jQuery("#spbc_settings_templates_import_name").css("border-color","inherit"),void 0===e.data("id"))console.log('Attribute "data-id" not set for the option.');else{e={template_id:e.data("id"),template_name:e.data("name"),settings:e.data("settings")};let o=this;spbcSendAJAXRequest({action:"spbc_settings_templates_import",data:e},{timeout:25e3,button:o,spinner:jQuery("#spbc_settings_templates_import_button .spbc_preloader_button"),callback:function(e,t,s,n){let c;e.success?(c="<p id='spbc-ajax-result' class='success'>"+e.data+"</p>",jQuery(c).insertAfter(jQuery(o)),jQuery("#spbc_settings_templates_import_button .spbc_success").show(300),setTimeout(function(){jQuery("#spbc_settings_templates_import_button .spbc_success").hide(300)},2e3),document.addEventListener("spbcModalClosed",function(e){document.location.reload()}),setTimeout(function(){spbcModal.close()},2e3)):(c="<p id='spbc-ajax-result' class='error'>"+e.data+"</p>",jQuery(c).insertAfter(jQuery(o)))}})}}),jQuery(document).on("click","#spbc_settings_templates_export_button",function(){jQuery("#spbc-ajax-result").remove();var t=jQuery("option:selected",jQuery("#spbc_settings_templates_export")),s=jQuery("#spbc_settings_templates_export_name");if(s.css("border-color","inherit"),void 0===t.data("id"))console.log('Attribute "data-id" not set for the option.');else{let e;if("new_template"===t.data("id")){var n=s.val();if(""===n)return void s.css("border-color","red");e={template_name:n}}else e={template_id:t.data("id")};let o=this;spbcSendAJAXRequest({action:"spbc_settings_templates_export",data:e},{timeout:25e3,button:o,spinner:jQuery("#spbc_settings_templates_export_button .spbc_preloader_button"),callback:function(e,t,s,n){let c;e.success?(c="<p id='spbc-ajax-result' class='success'>"+e.data+"</p>",jQuery(c).insertAfter(jQuery(o)),jQuery("#spbc_settings_templates_export_button .spbc_success").show(300),setTimeout(function(){jQuery("#spbc_settings_templates_export_button .spbc_success").hide(300)},2e3),document.addEventListener("spbcModalClosed",function(e){document.location.reload()}),setTimeout(function(){spbcModal.close()},2e3)):(c="<p id='spbc-ajax-result' class='error'>"+e.data+"</p>",jQuery(c).insertAfter(jQuery(o)))}})}}),jQuery(document).on("click","#spbc_settings_templates_reset_button",function(){let o=this;spbcSendAJAXRequest({action:"spbc_settings_templates_reset"},{timeout:25e3,button:o,spinner:jQuery("#spbc_settings_templates_reset_button .spbc_preloader_button"),callback:function(e,t,s,n){let c;e.success?(c="<p id='spbc-ajax-result' class='success'>"+e.data+"</p>",jQuery(c).insertAfter(jQuery(o)),jQuery("#spbc_settings_templates_reset_button .spbc_success").show(300),setTimeout(function(){jQuery("#spbc_settings_templates_reset_button .spbc_success").hide(300)},2e3),document.addEventListener("spbcModalClosed",function(e){document.location.reload()}),setTimeout(function(){spbcModal.close()},2e3)):(c="<p id='spbc-ajax-result' class='error'>"+e.data+"</p>",jQuery(c).insertAfter(jQuery(o)))}})}),jQuery(document).on("change","#spbc_settings_templates_export",function(){"new_template"===jQuery("option:selected",this).data("id")?jQuery(this).parent().parent().find("#spbc_settings_templates_export_name").show():jQuery(this).parent().parent().find("#spbc_settings_templates_export_name").hide()}),jQuery(document).on("click","#spbc-change-account-email",function(e){e.preventDefault();var e=jQuery(this),t=jQuery("#spbc-account-email"),s=t.text();spbcToggleClass(e,"active"),e.hasClass("active")?(e.text(e.data("save-text")),t.attr("contenteditable","true"),t.focus(),t.on("keydown",function(e){"Enter"===e.code&&e.preventDefault()}),t.on("input",function(e){"insertParagraph"===e.inputType&&e.preventDefault()})):(spbcSendAJAXRequest({action:"spbc_update_account_email",accountEmail:s},{timeout:5e3,callback:function(e,t,s,n){void 0!==e.success&&"ok"===e.success&&void 0!==e.manuallyLink&&jQuery("#spbc-key-manually-link").attr("href",e.manuallyLink),void 0!==e.error&&jQuery("#spbc-account-email").css("border-color","red")},errorOutput:function(e){spbcModal.loaded=e,spbcModal.open()}}),t.attr("contenteditable","false"),e.text(e.data("default-text")))}),jQuery(document).on("click",".spbct_notice-dismiss",function(e){var t=this.parentElement.classList;let s=t[t.length-1];document.querySelectorAll("."+s).forEach(e=>{e.parentElement.setAttribute("style","display:none;"),spbcSetCookie(s,1,2592e3)})})});
//# sourceMappingURL=spbc-settings.min.js.map