1const mwplGenerateCatptcha = function(element_id = null, type = 'number'){ 2 let element = jQuery((element_id ? '#' + element_id : '.mwpl-captcha')), 3 btn = element.parent().find('.mwpl-reload-captcha'), 4 captchaImg = element.closest('.captcha-field-group').find('.captcha-img'); 5 6 jQuery.ajax({ 7 url: mwpl_captcha.ajax_url, 8 data: { 9 action: 'mp_generate_captcha', 10 }, 11 type: 'POST', 12 dataType: 'json', 13 beforeSend: function (){ 14 btn.addClass('mp-show-reload'); 15 }, 16 success: function (response) { 17 btn.removeClass('mp-show-reload'); 18 if (response && typeof response.image !== "undefined"){ 19 captchaImg.attr('src', 'data:image/png;base64,' + response.image).show(); 20 } 21 }, 22 error: function () { 23 btn.removeClass('mp-show-reload'); 24 } 25 }); 26} 27const mwplReGenerateCaptchaCodes = function (){ 28 mwplGenerateCatptcha(); 29} 30 31jQuery(document).ready(function ($){ 32 mwplReGenerateCaptchaCodes(); 33 34 $(document).on('click', '.mwpl-reload-captcha', function (e) { 35 e.preventDefault(); 36 let captchaID = $(this).closest('.captcha-field-group').find('.mwpl-captcha').attr('id'); 37 mwplGenerateCatptcha(captchaID); 38 }); 39 40 $('.captcha-field-group').on("mwpl_open_custom_captcha", function() { 41 let wrap = $(this), 42 captchaID = wrap.find('.mwpl-captcha').attr('id'); 43 wrap.find('input').val(''); 44 mwplGenerateCatptcha(captchaID); 45 }); 46 47 $(document).on('click', '.mp-toggle-form-btn', function() { 48 let btn = $(this); 49 setTimeout(function (){ 50 let form = $('.mwpl-form-wrapper:visible'), 51 captchaID = form.find('.mwpl-captcha').attr('id'); 52 if (captchaID){ 53 mwplGenerateCatptcha(captchaID); 54 } 55 }, 1100); 56 }); 57});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.