Files
szkoleniauryzaj.pl/wp-content/plugins/password-protect-page/includes/views/dist/ppw-meta-box.js
2026-04-26 23:47:49 +02:00

1 line
4.8 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
!function(e){var s={};function t(o){if(s[o])return s[o].exports;var r=s[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,t),r.l=!0,r.exports}t.m=e,t.c=s,t.d=function(e,s,o){t.o(e,s)||Object.defineProperty(e,s,{enumerable:!0,get:o})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,s){if(1&s&&(e=t(e)),8&s)return e;if(4&s&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(t.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&s&&"string"!=typeof e)for(var r in e)t.d(o,r,function(s){return e[s]}.bind(null,r));return o},t.n=function(e){var s=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(s,"a",s),s},t.o=function(e,s){return Object.prototype.hasOwnProperty.call(e,s)},t.p="",t(t.s=10)}({10:function(e,s,t){"use strict";t.r(s);t(11);!function(e,s){function t(e){return-1===e.indexOf(" ")}function o(e){s(e).focus(function(){s("#save_password").prop("disabled",!1)})}s(function(){!function(){const e=s(".pda-selected-role-select2").val();if(e){const t=""===s("#post-protection-password-"+e).text()?"":s("#post-protection-password-"+e).text();s("#post-protection-password").val(t)}}(),function(){s("#post-protection-password").change(function(){-1!==s(this).val().indexOf(" ")?(toastr.error(save_password_data.error_message.space_password,"Password Protect WordPress"),s("#save_password").prop("disabled",!0)):s("#save_password").prop("disabled",!1)}),o("#post-protection-password"),s(".ppwp_multiple_password").change(function(){const e=s(this).val().split("\n").filter(e=>e.replace(/\s/g,"").length);return new Set(e).size!==e.length?(toastr.error(save_password_data.error_message.duplicate_password,"Password Protect WordPress"),void s("#save_password").prop("disabled",!0)):(s("#save_password").prop("disabled",!1),e.every(t)?void s("#save_password").prop("disabled",!1):(toastr.error(save_password_data.error_message.space_password,"Password Protect WordPress"),void s("#save_password").prop("disabled",!0)))}),o(".ppwp_multiple_password");let e={};s(".pda-selected-role-select2").on("focus",function(){let t=this.value;e[t]=s("#post-protection-password").val(),s("#"+t).val(s("#post-protection-password").val())}).change(function(){let t,o=s(".pda-selected-role-select2").val();t=void 0!==e[o]?e[o]:""===s("#post-protection-password-"+o).text()?"":s("#post-protection-password-"+o).text(),"global"===o?(s("#post-protection-password").hide(),s("#ppwp_multiple_password").show()):(s("#post-protection-password").show(),s("#ppwp_multiple_password").hide()),s("#post-protection-password").val(t),"global"===s("#is_role_selected").val()?s("#label-password-post").text("Passwords"):s("#label-password-post").text("Password")}),s(".pda-selected-role-select2").trigger("change"),s(".edit-post-protection").click(function(){s("#post-protection").show(),s(this).hide()}),s(".button-cancel").click(function(){s("#post-protection").hide(),s(".edit-post-protection").show()})}(),s("#save_password").click(function(e){e.preventDefault();const o=s(".ppwp_multiple_password").val().split("\n").filter(e=>e.replace(/\s/g,"").length),r=s(".post-protection-password").val(),a=s("#is_role_selected").val();(function(e){if("global"!==s(".pda-selected-role-select2").val())return!1;if(!e.every(t))return toastr.error(save_password_data.error_message.space_password,"Password Protect WordPress"),s("#save_password").prop("disabled",!0),!0;if(new Set(e).size!==e.length)return toastr.error(save_password_data.error_message.duplicate_password,"Password Protect WordPress"),s("#save_password").prop("disabled",!0),!0})(o)||function(e,t){const o={action:"ppw_free_set_password",settings:e,security_check:s("#ppw_meta_box_nonce").val()};s("#save_password").text("Submitting"),s("#save_password").prop("disabled",!0),s.ajax({url:save_password_data.ajax_url,type:"POST",data:o,success:function(e){t(e,null)},error:function(e){t(null,e)},timeout:5e3})}({save_password:r,is_role_selected:a,id_page_post:s("#id_page_post").val(),ppwp_multiple_password:o.length<=0?"":o},function(e,t){s("#save_password").text("Submit"),s("#save_password").prop("disabled",!1);e&&(!function(e){const t=Object.keys(e).filter(function(s){return""!==e[s]}),o=t.map(function(e){return"<span>"+e+"</span>"}).join(" "),r=t.length>1?t.length+" roles":t.length+" role";s("#all_roles_select").html(o),s("#number_roles").text(r)}(e),"global"===a?s("#ppwp_multiple_password").val(o.join("\n")):s("#post-protection-password").val(r),toastr.success("Great! Youve updated the password successfully.","PPWP Lite")),t&&(400===t.status?toastr.error(t.responseJSON.message,"PPWP Lite"):toastr.error("Opps! Something went wrong. Please try again.","PPWP Lite"),console.log("Data error",t))})})})}(window,jQuery)},11:function(e,s,t){}});