1 line
No EOL
1.5 KiB
JavaScript
1 line
No EOL
1.5 KiB
JavaScript
jQuery(document).ready(function(){let t=jQuery(".um-secure-scan-results"),n=jQuery(".um-secure-scan-content"),e=jQuery("input[data-field_id^='banned_capabilities']");var c={init:function(){t.css({"margin-top":"10px",padding:"10px","padding-bottom":"10px","background-color":"#fff",display:"block","max-height":"200px",height:"500px","overflow-y":"scroll"}),n.on("click",function(e){c.effect(),e.preventDefault(),jQuery(this).prop("disabled",!0),t.empty(),c.log(wp.i18n.__("Scanning site..","ultimate-member")),c.ajax("")}),e.on("change",function(){n.after(' <small style="color: red;">'+wp.i18n.__("You can start the scan now but you must save the settings to apply the selected capabilities after the scan is complete.","ultimate-member")+"</small>"),e.off("change")})},ajax:function(e){let a=[];t.parents(".um-form-table").find('input[type="checkbox"][data-field_id^="banned_capabilities_"]:checked').each(function(){a.push(jQuery(this).data("field_id").replace("banned_capabilities_",""))});e={nonce:um_admin_scripts.nonce,capabilities:a,last_scanned_capability:e};wp.ajax.send("um_secure_scan_affected_users",{data:e,success:function(e){e.completed?e.completed&&(t.empty(),c.log(e.recommendations),t.find(".current").removeClass("current"),n.prop("disabled",!1)):(c.ajax(e.last_scanned_capability),c.log(e.message))}})},log:function(e){t.find(".current").removeClass("current"),t.append('<span class="current">'+e+"</span><br/>")},effect:function(){setInterval(function(){t.find(".current").fadeTo(100,.1).fadeTo(200,1)},1e3)}};c.init()}); |