1var gaiForms = (function($) { 2 var t = {}; 3 4 t.form = null; 5 6 t.setup = function() { 7 var invalid_class = 'fl-wrap--invalid'; 8 9 t.form[0].noValidate = true; 10 t.form.submit(function(e) { 11 if(!this.checkValidity()) { 12 e.preventDefault(); 13 var firstInvalid = $('input, select, textarea', t.form).filter(function() { 14 return !this.checkValidity(); 15 }).first(); 16 if(firstInvalid.length) { 17 firstInvalid.focus(); 18 } 19 } 20 }); 21 22 $('.fl-wrap', t.form).append('<div class="fl-error"></div>'); 23 24 var inputs = $('input, select, textarea', t.form); 25 26 inputs.each(function() { 27 var element = $(this); 28 var dom_element = element[0]; 29 30 dom_element.oninvalid = function() { 31 var element = $(this); 32 var dom_element = this; 33 34 element.parents('.fl-wrap').addClass(invalid_class); 35 element.siblings('.fl-error').text(dom_element.validationMessage); 36 37 dom_element.oninput = function() { 38 dom_element.oninput = null; 39 element.parents('.fl-wrap').removeClass(invalid_class); 40 element.siblings('.fl-error').text(''); 41 dom_element.checkValidity(); 42 }; 43 }; 44 }); 45 46 inputs.blur(function() { 47 this.checkValidity(); 48 }); 49 }; 50 51 t.init = function() { 52 t.form = $('.ts-content form'); 53 54 if(t.form.length) { 55 setTimeout(t.setup, 1000); 56 } 57 }; 58 59 return t; 60})(jQuery); 61 62jQuery(function() { 63 gaiForms.init(); 64});
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.