1jQuery(document).ready(function($){ 2 var forms = $(".wpcf7"); 3 4 var signs = []; 5 forms.each(function(k, form){ 6 7 $(form).find(".wpcf7-sign-wrap").each(function(i, wrap){ 8 9 var canvas = $(wrap).find('canvas').get(0), 10 button = $(wrap).find('button.cf7sg-sign'), 11 form_id = $(form).find('[name=_wpcf7]').val(), 12 input = $(wrap).find('input'); 13 // resizeCanvas(canvas); 14 15 var signaturePad = new SignaturePad(canvas, { 16 backgroundColor: 'rgb(252, 228, 92)' 17 }); 18 19 signs[k+'-'+i] = signaturePad; 20 signs[k+'-'+i].addEventListener('endStroke', function(e){ 21 var data = signaturePad.toDataURL('image/png'); 22 input.val(data); 23 }); 24 25 document.addEventListener( 'wpcf7mailsent', function( event ) { 26 if( event.detail.contactFormId != form_id ) return; 27 signs[k+'-'+i].clear(); 28 $('.wpcf7-sign').val(''); 29 }, false ); 30 31 32 $(button).on('click',function(e){ 33 e.preventDefault(); 34 signs[k+'-'+i].clear(); 35 $(wrap).find('input').val(''); 36 }); 37 38 }); 39 }); 40}); 41 42 43function resizeCanvas( canvas ) { 44 const ratio = Math.max(window.devicePixelRatio || 1, 1); 45 canvas.width = canvas.offsetWidth * ratio; 46 canvas.height = canvas.offsetHeight * ratio; 47 canvas.getContext("2d").scale(ratio, ratio); 48}
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.