<commit_before>(function($){
	$.fn.JsBarcode = function(content,options) {
	
		options = $.extend({}, $.fn.JsBarcode.defaults, options);

		//Create the canvas where the barcode will be drawn on
		var canvas = document.createElement('canvas');
		
		//Abort if the browser does not support HTML5canvas
		if (!canvas.getContext) {
			return this;
		}
		
		//Abort if the barcode format is not supported
		if($.fn.JsBarcode.supportedBarcodes[options.format]==undefined){
			return this;
		}
		
		var encryptor = new $.fn.JsBarcode.supportedBarcodes[options.format](content);
		
		//Abort if the barcode format does not support the content
		if(!encryptor.valid()){
			return this;
		}
		
		var binary = encryptor.encoded();
		var ctx    = canvas.getContext("2d");
		
		canvas.width = binary.length*options.width+2*options.quite;
		canvas.height = options.height;
		
		//Paint the canvas white
		ctx.fillStyle = "#fff";
		ctx.fillRect(0,0,canvas.width,canvas.height);
		
		//NOT A GOOD WAY OF DOING IT, NEED TO BE FIXED
		drawBinary(binary,ctx,options.width,options.height,options.quite);
		
		
		uri = canvas.toDataURL('image/png');
		
		return $(this).attr("src",uri);

		function drawBinary(binaryString, context, width, height, quietZone){
			
			for(var i=0;i<binaryString.length;i++){
			
				var x = i*width+quietZone;
				
				if(binaryString[i] == "1"){
					context.fillStyle = "#000";
				}
				else if(binaryString[i] == "0"){
					context.fillStyle = "#fff";
				}
				else{
					console.log("Not a binary number!");
				}
				
				context.fillRect(x,0,width,height);
			}
		}
	};
	
	$.fn.JsBarcode.defaults = {
		width:	2,
		height:	100,
		quite: 10,
		format:	"CODE128"
	};
		
	$.fn.JsBarcode.supportedBarcodes = {<commit_msg>Put the generation code inside the jQuery function and added comments<commit_after>(function($){
	$.fn.JsBarcode = function(content,options) {
	
		//Merge the user options with the default
		options = $.extend({}, $.fn.JsBarcode.defaults, options);

		//Create the canvas where the barcode will be drawn on
		var canvas = document.createElement('canvas');
		
		//Abort if the browser does not support HTML5canvas
		if (!canvas.getContext) {
			return this;
		}
		
		//Abort if the barcode format is not supported
		if($.fn.JsBarcode.supportedBarcodes[options.format]==undefined){
			return this;
		}
		
		//Create the encoder object
		var encoder = new $.fn.JsBarcode.supportedBarcodes[options.format](content);
		
		//Abort if the barcode format does not support the content
		if(!encoder.valid()){
			return this;
		}
		
		//Encode the content
		var binary = encoder.encoded();
		
		//Get the canvas context
		var ctx    = canvas.getContext("2d");
		
		//Set the width and height of the barcode
		canvas.width = binary.length*options.width+2*options.quite;
		canvas.height = options.height;
		
		//Paint the canvas white
		ctx.fillStyle = "#fff";
		ctx.fillRect(0,0,canvas.width,canvas.height);
		
		//Creates the barcode out of the encoded binary
		for(var i=0;i<binary.length;i++){
		
			var x = i*options.width+options.quite;
			
			if(binary[i] == "1"){
				ctx.fillStyle = "#000";
			}
			else{
				ctx.fillStyle = "#fff";
			}
			
			ctx.fillRect(x,0,options.width,options.height);
		}
		
		//Grab the dataUri from the canvas
		uri = canvas.toDataURL('image/png');
		
		//Put the data uri into the image
		return $(this).attr("src",uri);
	};
	
	$.fn.JsBarcode.defaults = {
		width:	2,
		height:	100,
		quite: 10,
		format:	"CODE128"
	};
		
	$.fn.JsBarcode.supportedBarcodes = {
{'fraction_non_alphanumeric': 0.13969335604770017, 'fraction_numerical': 0.011641113003975015, 'mean_word_length': 3.2191616766467064, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4348047', 'n_tokens_mistral': 1397, 'n_tokens_neox': 1148, 'n_words': 290}