<commit_before>jQuery.fn.definePlugin('Tooltip', function ($) {
	'use strict';

	var styles = {
		className      : 'uilib-tooltip',
		textClassName  : 'uilib-text',
		arrowClassName : 'arrow_box',
		arrowHeight    : 12
	};
	var events = {
		mouseEnter : 'mouseenter',
		mouseLeave : 'mouseleave'
	};

	var placements = ['top', 'right', 'left', 'bottom'];

	return {
		init: function(){
			this.markup();
			this.bindEvents();
		},
		getDefaults: function(){
			return {
				placement : placements[0],
				html      : false,
				template  : '<div class=' + styles.className + '>' +
					'<div class=' + styles.arrowClassName + '>' +
					'<div class='+ styles.textClassName +'></div>' +
					'</div>' +
					'</div>',
				animation : true
			}
		},
		markup: function (){
		},
		bindEvents: function () {
			var tooltip = this;
			var $elm = tooltip.$el;
			$elm.on(events.mouseEnter, function (evt) {
				tooltip.remove();
				var $tooltip = $(tooltip.options.template);
				var $toolTipValue = $tooltip.find("." + styles.textClassName).html($elm.attr("wix-title"));
				if(tooltip.options.html){
					$toolTipValue.html($elm.attr("wix-title"));
				} else {
					$toolTipValue.text($elm.attr("wix-title"));
				}
				$elm.after($tooltip);
				if($.inArray(tooltip.options.placement, placements) > - 1){
					if(tooltip.options.placement === 'top'){
						setTopPlacement($tooltip);
					} else if(tooltip.options.placement === 'right'){
						setRightPlacement($tooltip);
					} else if(tooltip.options.placement === 'left'){
						setLeftPlacement($tooltip);
					} else if(tooltip.options.placement === 'bottom'){
						setBottomPlacement($tooltip);
					}
				} else {
					setTopPlacement($tooltip);
				}

			});

			function setTopPlacement($tooltip){
				$tooltip.find('.' + styles.arrowClassName).addClass('down');
				$tooltip.css('left', $elm.offset().left + calcOffsetLeft($tooltip));
				$tooltip.css('top', $elm.offset().top - ($tooltip.outerHeight() + styles.arrowHeight));
			}

			function setBottomPlacement($tooltip){
				$tooltip.find('.' + styles.arrowClassName).addClass('up');
				$tooltip.css('left', $elm.offset().left + calcOffsetLeft($tooltip));
				$tooltip.css('top', $elm.offset().top + $elm.outerHeight() + styles.arrowHeight);
			}

			function setRightPlacement($tooltip){
				$tooltip.find('.' + styles.arrowClassName).addClass('left');
				$tooltip.css('left', $elm.offset().left + $elm.outerWidth() + styles.arrowHeight);
				$tooltip.css('top', $elm.offset().top + calcOffsetTop($tooltip));
			}

			function setLeftPlacement($tooltip){
				$tooltip.find('.' + styles.arrowClassName).addClass('right');
				$tooltip.css('left', $elm.offset().left - ($tooltip.outerWidth() + styles.arrowHeight));
				$tooltip.css('top', $elm.offset().top + calcOffsetTop($tooltip));
			}

			function calcOffsetLeft($tooltip){
				if($elm.outerWidth() > $tooltip.outerWidth()){
					var diff = $elm.outerWidth() - $tooltip.outerWidth();
					return diff/2;
				} else{
					var diff = $tooltip.outerWidth() - $elm.outerWidth();
					return -diff/2;
				}
			}

			function calcOffsetTop($tooltip){
				if($elm.outerHeight() > $tooltip.outerHeight()){
					var diff = $elm.outerHeight() - $tooltip.outerHeight();
					return diff/2;
				} else{
					var diff = $tooltip.outerHeight() - $elm.outerHeight();
					return -diff/2;
				}
			}

			$elm.on(events.mouseLeave, function (evt) {
				if(tooltip.options.animation){
					$("." + styles.className).fadeOut(function(){
						tooltip.remove();
					});
				} else{
					tooltip.remove();
				}
			});
		},
		getValue: function () {
			return "";
		},
		setValue: function (value) {
			"";
		},
		update: function () {
			return this;
		},
		remove: function(){
			$("." + styles.className).remove();
		}
	};
});

<commit_msg>cleanup @gilo<commit_after>jQuery.fn.definePlugin('Tooltip', function ($) {
	'use strict';

	var styles = {
		className      : 'uilib-tooltip',
		textClassName  : 'uilib-text',
		arrowClassName : 'arrow_box',
		arrowHeight    : 12
	};
	var events = {
		mouseEnter : 'mouseenter',
		mouseLeave : 'mouseleave'
	};

	var placements = ['top', 'right', 'left', 'bottom'];

	return {
		init: function(){
			this.markup();
			this.bindEvents();
		},
		getDefaults: function(){
			return {
				placement : placements[0],
				html      : false,
				template  : '<div class=' + styles.className + '>' +
					'<div class=' + styles.arrowClassName + '>' +
					'<div class='+ styles.textClassName +'></div>' +
					'</div>' +
					'</div>',
				animation : true
			}
		},
		markup: function (){
		},
		bindEvents: function () {
			var tooltip = this;
			var $elm = tooltip.$el;
			$elm.on(events.mouseEnter, function (evt) {
				tooltip.remove();
				var $tooltip = $(tooltip.options.template);
				var $toolTipValue = $tooltip.find("." + styles.textClassName).html($elm.attr("wix-title"));
				if(tooltip.options.html){
					$toolTipValue.html($elm.attr("wix-title"));
				} else {
					$toolTipValue.text($elm.attr("wix-title"));
				}
				$elm.after($tooltip);
				if($.inArray(tooltip.options.placement, placements) > - 1){
					switch(tooltip.options.placement){
						case 'top':
							setTopPlacement($tooltip);
							break;
						case 'right':
							setRightPlacement($tooltip);
							break;
						case 'left':
							setLeftPlacement($tooltip);
							break;
						case 'bottom':
							setLeftPlacement(setBottomPlacement);
							break;
						default :
							setTopPlacement($tooltip);
					}
				} else {
					setTopPlacement($tooltip);
				}

			});

			function setTopPlacement($tooltip){
				$tooltip.find('.' + styles.arrowClassName).addClass('down');
				$tooltip.css('left', $elm.offset().left + calcOffsetLeft($tooltip));
				$tooltip.css('top', $elm.offset().top - ($tooltip.outerHeight() + styles.arrowHeight));
			}

			function setBottomPlacement($tooltip){
				$tooltip.find('.' + styles.arrowClassName).addClass('up');
				$tooltip.css('left', $elm.offset().left + calcOffsetLeft($tooltip));
				$tooltip.css('top', $elm.offset().top + $elm.outerHeight() + styles.arrowHeight);
			}

			function setRightPlacement($tooltip){
				$tooltip.find('.' + styles.arrowClassName).addClass('left');
				$tooltip.css('left', $elm.offset().left + $elm.outerWidth() + styles.arrowHeight);
				$tooltip.css('top', $elm.offset().top + calcOffsetTop($tooltip));
			}

			function setLeftPlacement($tooltip){
				$tooltip.find('.' + styles.arrowClassName).addClass('right');
				$tooltip.css('left', $elm.offset().left - ($tooltip.outerWidth() + styles.arrowHeight));
				$tooltip.css('top', $elm.offset().top + calcOffsetTop($tooltip));
			}

			function calcOffsetLeft($tooltip){
				if($elm.outerWidth() > $tooltip.outerWidth()){
					var diff = $elm.outerWidth() - $tooltip.outerWidth();
					return diff/2;
				} else{
					var diff = $tooltip.outerWidth() - $elm.outerWidth();
					return -diff/2;
				}
			}

			function calcOffsetTop($tooltip){
				if($elm.outerHeight() > $tooltip.outerHeight()){
					var diff = $elm.outerHeight() - $tooltip.outerHeight();
					return diff/2;
				} else{
					var diff = $tooltip.outerHeight() - $elm.outerHeight();
					return -diff/2;
				}
			}

			$elm.on(events.mouseLeave, function (evt) {
				if(tooltip.options.animation){
					$("." + styles.className).fadeOut(function(){
						tooltip.remove();
					});
				} else{
					tooltip.remove();
				}
			});
		},
		getValue: function () {
			return "";
		},
		setValue: function (value) {
			"";
		},
		update: function () {
			return this;
		},
		remove: function(){
			$("." + styles.className).remove();
		}
	};
});


{'fraction_non_alphanumeric': 0.1912826572141263, 'fraction_numerical': 0.002100564526716555, 'mean_word_length': 3.171960569550931, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 21, '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': '6947988', 'n_tokens_mistral': 3085, 'n_tokens_neox': 2424, 'n_words': 401}