1function drawImage(document_id) { 2 const canvas = document.getElementById('canvas'); 3 const ctx = canvas.getContext('2d'); 4 // ctx.clearRect(0, 0, 600px, 600px); 5 6 canvas.height = 1200; 7 canvas.width = 990; 8 const img = document.querySelector('img.active'); 9 ctx.drawImage(img, 0, 0, canvas.width, canvas.height); 10 11 12 var font = document.querySelector('input[name="penmanship"]:checked').value; 13 ctx.font = "36px " + font; 14 15 var text = document.getElementById('custom-text').value; 16 17 if (document_id == 2) { 18 x = canvas.width/10; 19 y = canvas.height - canvas.height/3.5; 20 } 21 else if (document_id == 1) { 22 x = canvas.width/10; 23 y = canvas.height - canvas.height/8; 24 } 25 else if (document_id == 3) { 26 x = canvas.width/2.5; 27 y = canvas.height - canvas.height/16; 28 } 29 ctx.fillText(text, x, y); 30 url = canvas.toDataURL(); 31 canvas.toBlob(function(blob){ 32 const anchor = document.getElementById('dlink'); 33 anchor.href = URL.createObjectURL(blob); 34 }); 35 36return url; 37} 38 39(function ($) { 40 var document_id = 1; 41 $(document).ready(function() { 42 43 44 $(".box").on('click', function() { 45 $(".box").removeClass("active"); 46 $(".box").children("img").removeClass("active"); 47 $(this).addClass("active"); 48 $(this).children("img").addClass("active"); 49 if ($("#billofrights").hasClass("active")) { 50 $(".custom-text").text("Bill of Rights"); 51 document_id = 3; 52 $(".independence-text").addClass("custom-hide"); 53 } 54 else if ($("#constitution").hasClass("active")) { 55 $(".custom-text").text("Constitution"); 56 document_id = 2; 57 $(".independence-text").addClass("custom-hide"); 58 $(".constitution-text").removeClass("custom-hide"); 59 } 60 else { 61 $(".custom-text").text("Declaration of Independence"); 62 $(".independence-text").removeClass("custom-hide"); 63 $(".constitution-text").addClass("custom-hide"); 64 document_id = 1; 65 } 66 }); 67 68 $("button#sign-button").on('click', function() { 69 $(".download-link").html('<button><a id="dlink" download>Download this image</a></button>'); 70 var img_url = drawImage(document_id); 71 $("#canvas").addClass("canvas-full-width"); 72 //$(".download-link").html('<button><a href="' + img_url + '" download>Download this image</a></button>'); 73 }); 74 75 76 }) 77}(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.