1(function ($) { 2 "use strict"; 3 Drupal.behaviors.simple_recaptcha_buttons = { 4 attach: function (context, drupalSettings) { 5 function recaptchaButtons(formIds) { 6 for(let formId in formIds) { 7 const $form = $('form[data-recaptcha-id="' + formId + '"]'); 8 // Count submit buttons inside of form 9 // if there's only 1 submit we're good to go. 10 let count = $form.find('input[type="submit"]').length; 11 if(count === 1) { 12 $form.find('[type="submit"]').addClass('simple-recaptcha-submit'); 13 continue; 14 } 15 16 // Lookup for FAPI primary button ( '#button_type' => 'primary' ) 17 // @see https://www.drupal.org/node/1848288 18 const $primary = $form.find('.button--primary'); 19 if($primary.length > 0) { 20 $form.find('.button--primary').addClass('simple-recaptcha-submit'); 21 continue; 22 } 23 24 // Fallback - last available submit element. 25 $form.find('[type="submit"]').last().addClass('simple-recaptcha-submit'); 26 27 } 28 } 29 if (typeof drupalSettings.simple_recaptcha !== 'undefined') { 30 recaptchaButtons(drupalSettings.simple_recaptcha.form_ids); 31 } 32 33 if (typeof drupalSettings.simple_recaptcha_v3 !== 'undefined') { 34 recaptchaButtons(drupalSettings.simple_recaptcha_v3.forms); 35 } 36 37 } 38 } 39})(jQuery);
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.