1jQuery( document ).ready(function() { 2 /* For cart page */ 3 function ean_display_barcode_cart_checkout() { 4 jQuery('.euaifw_cart_barcode').each(function() { 5 var barcodeContainer = jQuery(this); 6 var eanNumber = barcodeContainer.data('ean-number'); 7 var eanFormat = barcodeContainer.data('ean-format'); 8 var ean_frontend_barcode_color = ean_barcode_setting.ean_frontend_barcode_color; 9 var ean_frontend_barcode_bg_color = ean_barcode_setting.ean_frontend_barcode_bg_color; 10 var ean_frontend_barcode_width = ean_barcode_setting.ean_frontend_barcode_width; 11 var ean_frontend_barcode_height = ean_barcode_setting.ean_frontend_barcode_height; 12 var ean_frontend_barcode_display_label = ean_barcode_setting.ean_frontend_barcode_display_label; 13 var ean_front_barcode_label_font_size = ean_barcode_setting.ean_front_barcode_label_font_size; 14 var ean_front_barcode_label_margin = ean_barcode_setting.ean_front_barcode_label_margin; 15 var ean_front_barcode_label_font_style = ean_barcode_setting.ean_front_barcode_label_font_style; 16 var ean_front_barcode_label_text_align = ean_barcode_setting.ean_front_barcode_label_text_align; 17 var ean_front_barcode_label_text_position = ean_barcode_setting.ean_front_barcode_label_text_position; 18 var ean_front_barcode_label_font_family = ean_barcode_setting.ean_front_barcode_label_font_family; 19 20 // Check if the EAN number is valid 21 if (eanNumber) { 22 // Generate the barcode 23 JsBarcode(barcodeContainer[0], eanNumber, { 24 format: eanFormat, 25 lineColor: ean_frontend_barcode_color, 26 background: ean_frontend_barcode_bg_color, 27 displayValue: ean_frontend_barcode_display_label, 28 font: ean_front_barcode_label_font_family, 29 fontOptions: ean_front_barcode_label_font_style, 30 fontSize: ean_front_barcode_label_font_size, 31 textAlign: ean_front_barcode_label_text_align, 32 textPosition: ean_front_barcode_label_text_position, 33 textMargin: ean_front_barcode_label_margin, 34 width: ean_frontend_barcode_width, 35 height: ean_frontend_barcode_height, 36 }); 37 } 38 }); 39 } 40 41 // Initial generation and display of the barcode 42 ean_display_barcode_cart_checkout(); 43 44 // Listen for WooCommerce cart update events 45 jQuery(document.body).on('updated_cart_totals', function() { 46 // Regenerate and display the barcode when the cart is updated 47 ean_display_barcode_cart_checkout(); 48 }); 49 50 /* For order page */ 51 function ean_order_generate_barcode() { 52 jQuery('.ean_order_thankyou_barcode').each(function() { 53 var barcodeContainer = jQuery(this); 54 var eanNumber = barcodeContainer.data('ean-number'); 55 var eanFormat = barcodeContainer.data('ean-format'); 56 var ean_frontend_barcode_color = ean_barcode_setting.ean_frontend_barcode_color; 57 var ean_frontend_barcode_bg_color = ean_barcode_setting.ean_frontend_barcode_bg_color; 58 var ean_frontend_barcode_width = ean_barcode_setting.ean_frontend_barcode_width; 59 var ean_frontend_barcode_height = ean_barcode_setting.ean_frontend_barcode_height; 60 var ean_frontend_barcode_display_label = ean_barcode_setting.ean_frontend_barcode_display_label; 61 var ean_front_barcode_label_font_size = ean_barcode_setting.ean_front_barcode_label_font_size; 62 var ean_front_barcode_label_margin = ean_barcode_setting.ean_front_barcode_label_margin; 63 var ean_front_barcode_label_font_style = ean_barcode_setting.ean_front_barcode_label_font_style; 64 var ean_front_barcode_label_text_align = ean_barcode_setting.ean_front_barcode_label_text_align; 65 var ean_front_barcode_label_text_position = ean_barcode_setting.ean_front_barcode_label_text_position; 66 var ean_front_barcode_label_font_family = ean_barcode_setting.ean_front_barcode_label_font_family; 67 68 // Check if the EAN number is valid 69 if (eanNumber) { 70 // Generate the barcode 71 JsBarcode(barcodeContainer[0], eanNumber, { 72 format: eanFormat, 73 lineColor: ean_frontend_barcode_color, 74 background: ean_frontend_barcode_bg_color, 75 displayValue: ean_frontend_barcode_display_label, 76 font: ean_front_barcode_label_font_family, 77 fontOptions: ean_front_barcode_label_font_style, 78 fontSize: ean_front_barcode_label_font_size, 79 textAlign: ean_front_barcode_label_text_align, 80 textPosition: ean_front_barcode_label_text_position, 81 textMargin: ean_front_barcode_label_margin, 82 width: ean_frontend_barcode_width, 83 height: ean_frontend_barcode_height, 84 }); 85 } 86 }); 87 } 88 89 // Initial generation and display of the barcode 90 ean_order_generate_barcode(); 91});
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.