<commit_before>jQuery(function(){
	var $ = jQuery;
	var maxWidth = $("div.field-positionpicker").width();
	$("div.field-positionpicker select").change(function(){
		var id = $(this).val();
		if(id != 0)	{
			if(id == -1) {
                // Static image
                var info = $("div.position_picker_vars var[rel=url]").text().split('*');
                var file = info[0];
                $("div.field-positionpicker select").hide();
            } else {
                var info = $("div.position_picker_vars var[rel=" + id + "]").text().split('*');
                var file = Symphony.WEBSITE + '/workspace' + info[0];
            }
			
			console.log(info);
			
			var originalWidth = info[1];
			var originalHeight = info[2];
			var ratio = maxWidth / originalWidth;
			
			var imageWidth = originalWidth * ratio;
			var imageHeight = originalHeight * ratio;

			// show the image:		
			$("div.position_picker", $(this).parent()).html('<img src="' + Symphony.WEBSITE + '/extensions/position_picker/assets/crosshair.gif" class="crosshair" /><img src="' + file + '" class="pic" />');
			$("div.position_picker img.pic").width(maxWidth);
			$("div.position_picker img.pic").height(originalHeight * ratio);
			
			if($('#unit_type').val() == 'percentage') {
				$("div.position_picker img.pic").click(function(e){
					var pixelOffsetX = e.pageX - $(this).offset().left;
			        var pixelOffsetY = e.pageY - $(this).offset().top;
			        
					var offsetX = (pixelOffsetX / imageWidth)*100;
			        var offsetY = (pixelOffsetY / imageHeight)*100;

					$("img.crosshair", $(this).parent()).css({left: (offsetX -1.6) + '%', top: offsetY + '%'});
					$("input[type=hidden]", $(this).parent().parent()).val(offsetX + ',' + offsetY);
					console.log($("input[type=hidden]", $(this).parent().parent()).val());
					return false;
				});
				coords = $("input[type=hidden]", $(this).parent()).val().split(',');
				if(coords.length == 2) {
					$("div.position_picker img.crosshair", $(this).parent()).css({left: (coords[0] -1.6) + "%", top: (coords[1] -1.6) + "%"});
				}
			} else{
				$("div.position_picker img.pic").click(function(e){
					var offsetX = e.pageX - $(this).offset().left;
					var offsetY = e.pageY - $(this).offset().top;<commit_msg>fixed up the js a little bit<commit_after>jQuery(function(){
	var $ = jQuery;
	var maxWidth = $("div.field-positionpicker").width();
	$("div.field-positionpicker select").change(function(){
		var id = $(this).val();
		if(id != 0)	{
			if(id == -1) {
                // Static image
                var info = $("div.position_picker_vars var[rel=url]").text().split('*');
                var file = info[0];
                $("div.field-positionpicker select").hide();
            } else {
                var info = $("div.position_picker_vars var[rel=" + id + "]").text().split('*');
                var file = Symphony.WEBSITE + '/workspace' + info[0];
            }
			
			var originalWidth = info[1];
			var originalHeight = info[2];
			var ratio = maxWidth / originalWidth;
			
			var imageWidth = originalWidth * ratio;
			var imageHeight = originalHeight * ratio;

			// show the image:		
			$("div.position_picker", $(this).parent()).html('<img src="' + Symphony.WEBSITE + '/extensions/position_picker/assets/crosshair.gif" class="crosshair" /><img src="' + file + '" class="pic" />');
			$("div.position_picker img.pic").width(maxWidth);
			$("div.position_picker img.pic").height(originalHeight * ratio);
			
			if($('#unit_type').val() == 'percentage') {
				$("div.position_picker img.pic").click(function(e){
					var pixelOffsetX = e.pageX - $(this).offset().left;
			        var pixelOffsetY = e.pageY - $(this).offset().top;
			        
					var offsetX = (pixelOffsetX / imageWidth)*100;
			        var offsetY = (pixelOffsetY / imageHeight)*100;
					
					var cursorSize = (3.2 * ratio) / 2;
					
					$("img.crosshair", $(this).parent()).css({left: (offsetX - cursorSize) + '%', top: (offsetY - cursorSize) + '%'});
					$("input[type=hidden]", $(this).parent().parent()).val(offsetX + ',' + offsetY);
					console.log($("input[type=hidden]", $(this).parent().parent()).val());
					return false;
				});
				coords = $("input[type=hidden]", $(this).parent()).val().split(',');
				if(coords.length == 2) {
					var cursorSize = (3.2 * ratio) / 2;
					$("div.position_picker img.crosshair", $(this).parent()).css({left: (coords[0] - cursorSize) + "%", top: (coords[1] - cursorSize) + "%"});
				}
			} else{
				$("div.position_picker img.pic").click(function(e){
					var offsetX = e.pageX - $(this).offset().left;
					var offsetY = e.pageY - $(this).offset().top;
{'fraction_non_alphanumeric': 0.21224489795918366, 'fraction_numerical': 0.009022556390977444, 'mean_word_length': 2.8864774624373957, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '4088256', 'n_tokens_mistral': 1756, 'n_tokens_neox': 1474, 'n_words': 279}