|
1
|
|
-window.Patchstack=window.Patchstack||{},function(t,a,c,e){var n={},i=null,o=!1,s=0;e.init=function(){e.cache(),e.bindEvents()},e.cache=function(){n.window=c(t),n.body=c(a.body)},e.poller=function(){i=setInterval(()=>{o||0!=s||(e.autoActivate(),s=5),s--},1e3)},e.autoActivate=function(){o=!0;var a={action:"patchstack_activate_auto",PatchstackNonce:PatchstackVars.nonce};c.post(PatchstackVars.ajaxurl,a,function(a){var e={action:"patchstack_activation_status",PatchstackNonce:PatchstackVars.nonce};c.post(PatchstackVars.ajaxurl,e,function(a){a.activated&&(t.location=t.location.href.replace("&ps_autoa=1","")+"&resync=1"),o=!1})})},e.bindEvents=function(){c("input#patchstack-activate").on("click",function(a){a.preventDefault();var e={action:"patchstack_activate_license",key:""==c(".patchstack-auto-activate").attr("style")?c("#patchstack_api_key2").val():c("#patchstack_api_key").val(),PatchstackNonce:PatchstackVars.nonce};if(0==c.trim(e.key).length)return alert("Please enter the API key."),!1;c(".patchstack-resync").hide(),c("#patchstack-activate").hide(),c(".patchstack-loading").show(),c(".is-polling-section").hide(),o=!0,c.post(PatchstackVars.ajaxurl,e,function(a){o=!1,s=5,"error"==a.result?(c("#patchstack-activate, .is-polling-section").show(),c(".patchstack-loading").hide(),a.error_message?alert(a.error_message):alert(PatchstackVars.error_message)):t.location=t.location.href+"&resync=1"})}),c(".patchstack-retry-link").on("click",function(a){a.preventDefault();var t=c(this);if(t.hasClass("is-loading"))return;t.addClass("is-loading");c.post(PatchstackVars.ajaxurl,{action:"patchstack_check_connection",PatchstackNonce:PatchstackVars.nonce},function(a){if(!a)return;var e=c(".patchstack-connection-status");e.toggleClass("is-connected",!!a.connected);e.toggleClass("is-disconnected",!a.connected);if(typeof a.label==="string")c(".patchstack-last-sync").text(a.label)}).always(function(){t.removeClass("is-loading")})})},c(e.init)}(window,document,jQuery,window.Patchstack); |
|
1
|
+window.Patchstack=window.Patchstack||{},function(a,t,c,e){var _={};e.init=function(){e.cache(),e.bindEvents()},e.cache=function(){_.window=c(a),_.body=c(t.body)},e.bindEvents=function(){if(c("input#patchstack-activate").on("click",function(t){t.preventDefault();var e={action:"activate_license",clientid:c("#patchstack_api_client_id").val(),secretkey:c("#patchstack_api_client_secret_key").val(),PatchstackNonce:PatchstackVars.nonce};if(0==c.trim(e.clientid).length||0==c.trim(e.secretkey).length)return alert("Please enter the site id and secret key."),!1;c.post(PatchstackVars.ajaxurl,e,function(t){"error"==t.result?alert(PatchstackVars.error_message):t.response&&!1===t.response.free?a.location.reload():(c(".patchstack-license-status").text("Active").css({color:"#B2D675"}),c(".patchstack-sub-type").text("Community (Free) "),c(".ps-b1, .ps-b3, .ps-p1").hide(),c(".ps-b2, .ps-b4, .ps-p2").show())})}),void 0!==jQuery.fn.dataTable&&-1!==a.location.href.indexOf("patchstack")&&(c(".table-firewall-log").DataTable({processing:!0,serverSide:!0,ajax:{url:PatchstackVars.ajaxurl,type:"POST",data:function(a){a.action="firewall_log_table",a.PatchstackNonce=c("meta[name=patchstack_nonce]").attr("value")}},responsive:!0,columns:[{data:"fid"},{data:"referer"},{data:"method"},{data:"ip",render:c.fn.dataTable.render.text()},{data:"log_date"}],order:[[0,"desc"]],searching:!1,ordering:!1,drawCallback:function(a){c(".titletip").tooltip()},columnDefs:[{render:function(a,t,c){var e=a||"Unknown";return'<span class=" titletip" title="'+(c.description?c.description:"No Explanation")+'">'+e+"</span>"},targets:0},{render:function(a,t,c){return decodeURIComponent(a).replace(/</g,"<").replace(/>/g,">").replace("+"," ")},targets:1}]}),c(".table-user-log").DataTable({processing:!0,serverSide:!0,ajax:{url:PatchstackVars.ajaxurl,type:"POST",data:function(a){a.action="users_log_table",a.PatchstackNonce=c("meta[name=patchstack_nonce]").attr("value")}},responsive:!0,columns:[{data:"author"},{data:"action",render:c.fn.dataTable.render.text()},{data:"object",render:c.fn.dataTable.render.text()},{data:"object_name",render:c.fn.dataTable.render.text()},{data:"ip",render:c.fn.dataTable.render.text()},{data:"date",render:c.fn.dataTable.render.text()}],order:[[0,"desc"]],searching:!0,ordering:!1})),"v2"==c("#patchstack_captcha_type").val()?(c("#patchstack_captcha_public_key_v3, #patchstack_captcha_private_key_v3, #patchstack_captcha_public_key_v3_new, #patchstack_captcha_private_key_v3_new").hide(),c("#patchstack_captcha_public_key, #patchstack_captcha_private_key").show()):"invisible"==c("#patchstack_captcha_type").val()?(c("#patchstack_captcha_public_key, #patchstack_captcha_private_key, #patchstack_captcha_public_key_v3_new, #patchstack_captcha_private_key_v3_new").hide(),c("#patchstack_captcha_public_key_v3, #patchstack_captcha_private_key_v3").show()):(c("#patchstack_captcha_public_key, #patchstack_captcha_private_key, #patchstack_captcha_public_key_v3, #patchstack_captcha_private_key_v3").hide(),c("#patchstack_captcha_public_key_v3_new, #patchstack_captcha_private_key_v3_new").show()),c("#patchstack_captcha_type").change(function(){"v2"==c("#patchstack_captcha_type").val()?(c("#patchstack_captcha_public_key_v3, #patchstack_captcha_private_key_v3, #patchstack_captcha_public_key_v3_new, #patchstack_captcha_private_key_v3_new").hide(),c("#patchstack_captcha_public_key, #patchstack_captcha_private_key").show()):"invisible"==c("#patchstack_captcha_type").val()?(c("#patchstack_captcha_public_key, #patchstack_captcha_private_key, #patchstack_captcha_public_key_v3_new, #patchstack_captcha_private_key_v3_new").hide(),c("#patchstack_captcha_public_key_v3, #patchstack_captcha_private_key_v3").show()):(c("#patchstack_captcha_public_key, #patchstack_captcha_private_key, #patchstack_captcha_public_key_v3, #patchstack_captcha_private_key_v3").hide(),c("#patchstack_captcha_public_key_v3_new, #patchstack_captcha_private_key_v3_new").show())}),c("#geo-countries").length>0){var t=[];""!=c("#geo-countries").data("selected")&&(t=c("#geo-countries").data("selected").split(",")),c("#geo-countries").selectize({maxItems:null,delimiter:",",plugins:["remove_button"],items:t})}},c(e.init)}(window,document,jQuery,window.Patchstack); |