<commit_before><!doctype html>
<html>
<head>
	<title>Menu Visual Test: Default</title>
	<link rel="stylesheet" href="../visual.css" type="text/css" />
	<link rel="stylesheet" href="../../../themes/base/jquery.ui.all.css" type="text/css" title="ui-theme" />
	<script type="text/javascript" src="../../../jquery-1.4.2.js"></script>
	<script type="text/javascript" src="../../../ui/jquery.ui.core.js"></script>
	<script type="text/javascript" src="../../../ui/jquery.ui.widget.js"></script>
	<script type="text/javascript" src="../../../ui/jquery.ui.position.js"></script>
	<script type="text/javascript" src="../../../ui/jquery.ui.autocomplete.js"></script>
	<script type="text/javascript" src="../../../external/jquery.bgiframe-2.1.1.js"></script>
	<script type="text/javascript" src="http://jqueryui.com/themeroller/themeswitchertool/"></script>
	<script type="text/javascript">
	$(function() {
		$.fn.themeswitcher && $('<div/>').css({
			position: "absolute",
			right: 10,
			top: 10
		}).appendTo(document.body).themeswitcher();
		
		$.fn.position2 = function(options) {
			return this.css({
				top: 0,
				left: 0
			}).position(options);
		}
		var menus = $("#menu").menu().position2({
			my: "left top",
			at: "center bottom",
			of: "button"
		}).find("ul").menu().hide();
		var sub1 = menus.filter(":first").show().position2({
			my: "left top",
			at: "right center",
			of: "#menu"
		});
		sub1.find("ul:first").show().position2({
			of: sub1,
			offset: "-10 50"
		});
	});
	</script>
	<style>
		body { font-size:62.5%; }
		.ui-menu { width: 200px; position: absolute; }
		.ui-menu .ui-icon { float: right; }
		ul, li {margin: 0; padding: 0}
	</style>
</head>
<body>
	
<button>Show context menu</button>
<br/>
<select>
	<option>some option with some text</option>
</select>

<ul id="menu">
	<li>
		<a href="#">Amsterdam</a>
		<ul>
			<li><a href="#">Aberdeen</a></li>
			<li><a href="#">Ada</a></li>
			<li>
				<a href="#">Adamsville</a>
				<ul>
					<li><a href="#">Anaheim</a></li>
					<li>
						<a href="#">Cologne</a>
						<ul>
							<li><a href="#">Mberdeen</a></li>
							<li><a href="#">Mda</a></li>
							<li><a href="#">Mdamsville</a></li>
							<li><a href="#">Mddyston</a></li>
							<li><a href="#">Mmesville</a></li>
						</ul>
					</li>
					<li><a href="#">Frankfurt</a></li>
				</ul>
			</li>
			<li><a href="#">Addyston</a></li>
			<li><a href="#">Amesville</a></li>
		</ul>
	</li>
	<li><a href="#">Anaheim</a></li>
	<li><a href="#">Cologne</a></li>
	<li><a href="#">Frankfurt</a></li>
	<li>
		<a href="#">Magdeburg</a>
		<ul>
			<li><a href="#">Mberdeen</a></li>
			<li><a href="#">Mda</a></li>
			<li><a href="#">Mdamsville</a></li>
			<li><a href="#">Mddyston</a></li>
			<li><a href="#">Mmesville</a></li>
		</ul>
	</li>
	<li><a href="#">Munich</a></li>
	<li><a href="#">Utrecht</a></li>
	<li><a href="#">Zurich</a></li>
</ul>

<div class="ui-widget" style="margin-top:2em; font-family:Arial">
	Log:
	<div id="log" style="height: 400px; width: 300px; overflow: auto;" class="ui-widget-content"></div>
</div>

</body>
</html>
<commit_msg>Implemented menu/nested2 visual test, implementation doesn't rip DOM apart, way simpler then original approach<commit_after><!doctype html>
<html>
<head>
	<title>Menu Visual Test: Default</title>
	<link rel="stylesheet" href="../visual.css" type="text/css" />
	<link rel="stylesheet" href="../../../themes/base/jquery.ui.all.css" type="text/css" title="ui-theme" />
	<script type="text/javascript" src="../../../jquery-1.4.2.js"></script>
	<script type="text/javascript" src="../../../ui/jquery.ui.core.js"></script>
	<script type="text/javascript" src="../../../ui/jquery.ui.widget.js"></script>
	<script type="text/javascript" src="../../../ui/jquery.ui.position.js"></script>
	<script type="text/javascript" src="../../../ui/jquery.ui.autocomplete.js"></script>
	<script type="text/javascript" src="../../../external/jquery.bgiframe-2.1.1.js"></script>
	<script type="text/javascript" src="http://jqueryui.com/themeroller/themeswitchertool/"></script>
	<script type="text/javascript">
	$(function() {
		$.fn.themeswitcher && $('<div/>').css({
			position: "absolute",
			right: 10,
			top: 10
		}).appendTo(document.body).themeswitcher();
		
		$.widget("ui.nestedmenu", {
			_init: function() {
				var self = this;
				this.active = this.element;
				
				// hide submenus and create indicator icons
				this.element.find("ul").hide().prev("a").prepend('<span class="ui-icon ui-icon-carat-1-e"></span>');	
				
				this.element.find("ul").andSelf().menu({
					selected: this.options.selected,
					focus: function(event, ui) {
						self.active = ui.item.parent();
						self.activeItem = ui.item;
						ui.item.parent().find("ul").hide();
						var nested = $(">ul", ui.item);
						if (nested.length && /^mouse/.test(event.originalEvent.type)) {
							self._open(nested);
						}
					}
				})
			},
			
			_open: function(submenu) {
				submenu.show().css({
					top: 0,
					left: 0
				}).position({
					my: "left top",
					at: "right top",
					of: this.activeItem
				});
			},
			
			up: function(event) {
				this.active = this.active.menu("deactivate").hide().parent().parent();
				this.activeItem = this.active.data("menu").active;
			},
			
			down: function(event) {
				var submenu = $(">ul", this.activeItem);
				this._open(submenu, this.activeItem);
				submenu.menu("activate", event, submenu.children(":first"));
			},
			
			show: function() {
				this.active = this.element;
				this.element.show();
			},
			
			hide: function() {
				this.element.find("ul").andSelf().menu("deactivate").hide();
			}
			
		});
		
		var nestedmenu = $("#menu").nestedmenu({
			selected: function(event, ui) {
				$("#log").append("<div>Selected " + ui.item.text() + "</div>");
			}
		}).hide();
		
		$("button").click(function(event) {
			// TODO required to prevent the click handler below from handling this event
			event.stopPropagation();
			nestedmenu.nestedmenu("show")
				.css({
					top: 0,
					left: 0
				})
				.position({
					my: "left top",
					at: "right top",
					of: this
				});
			$(document).one("click", function() {
				nestedmenu.nestedmenu("hide");
			})
		}).keydown(function(event) {
			var menu = nestedmenu.data("nestedmenu").active.data("menu");
			if (menu.widget().is(":hidden"))
				return;
			event.stopPropagation();
			switch (event.keyCode) {
			case $.ui.keyCode.PAGE_UP:
				menu.previousPage(event);
				break;
			case $.ui.keyCode.PAGE_DOWN:
				menu.nextPage(event);
				break;
			case $.ui.keyCode.UP:
				menu.previous(event);
				break;
			case $.ui.keyCode.LEFT:
				nestedmenu.nestedmenu("up", event);
				break;
			case $.ui.keyCode.RIGHT:
				nestedmenu.nestedmenu("down", event);
				break;
			case $.ui.keyCode.DOWN:
				menu.next(event);
				event.preventDefault();
				break;
			case $.ui.keyCode.ENTER:
			case $.ui.keyCode.TAB:
				menu.select();
				nestedmenu.nestedmenu("hide");
				event.preventDefault();
				break;
			case $.ui.keyCode.ESCAPE:
				nestedmenu.nestedmenu("hide");
				break;
			default:
				clearTimeout(menu.filterTimer);
				var prev = menu.previousFilter || "";
				var character = String.fromCharCode(event.keyCode);
				var skip = false;
				if (character == prev) {
					skip = true;
				} else {
					character = prev + character;
				}
				
				var match = menu.widget().children("li").filter(function() {
					return new RegExp("^" + character, "i").test($("a", this).text());
				});
				var match = skip && match.index(menu.active.next()) != -1 ? match.next() : match;
				if (!match.length) {
					character = String.fromCharCode(event.keyCode);
					match = menu.widget().children("li").filter(function() {
						return new RegExp("^" + character, "i").test($(this).text());
					});
				}
				if (match.length) {
					menu.activate(event, match);
					if (match.length > 1) {
						menu.previousFilter = character;
						menu.filterTimer = setTimeout(function() {
							delete menu.previousFilter;
						}, 1000);
					} else {
						delete menu.previousFilter;
					}
				} else {
					delete menu.previousFilter;
				}
			}
		});
	});
	</script>
	<style>
		body { font-size:62.5%; }
		.ui-menu { width: 200px; position: absolute; }
		.ui-menu .ui-icon { float: right; }
	</style>
</head>
<body>
	
<button>Show context menu</button>
<br/>
<select>
	<option>some option with some text</option>
</select>

<ul id="menu">
	<li>
		<a href="#">Amsterdam</a>
		<ul>
			<li><a href="#">Aberdeen</a></li>
			<li><a href="#">Ada</a></li>
			<li>
				<a href="#">Adamsville</a>
				<ul>
					<li><a href="#">Anaheim</a></li>
					<li>
						<a href="#">Cologne</a>
						<ul>
							<li><a href="#">Mberdeen</a></li>
							<li><a href="#">Mda</a></li>
							<li><a href="#">Mdamsville</a></li>
							<li><a href="#">Mddyston</a></li>
							<li><a href="#">Mmesville</a></li>
						</ul>
					</li>
					<li><a href="#">Frankfurt</a></li>
				</ul>
			</li>
			<li><a href="#">Addyston</a></li>
			<li><a href="#">Amesville</a></li>
		</ul>
	</li>
	<li><a href="#">Anaheim</a></li>
	<li><a href="#">Cologne</a></li>
	<li><a href="#">Frankfurt</a></li>
	<li>
		<a href="#">Magdeburg</a>
		<ul>
			<li><a href="#">Mberdeen</a></li>
			<li><a href="#">Mda</a></li>
			<li><a href="#">Mdamsville</a></li>
			<li><a href="#">Mddyston</a></li>
			<li><a href="#">Mmesville</a></li>
		</ul>
	</li>
	<li><a href="#">Munich</a></li>
	<li><a href="#">Utrecht</a></li>
	<li><a href="#">Zurich</a></li>
</ul>

<div class="ui-widget" style="margin-top:2em; font-family:Arial">
	Log:
	<div id="log" style="height: 400px; width: 300px; overflow: auto;" class="ui-widget-content"></div>
</div>

</body>
</html>

{'fraction_non_alphanumeric': 0.2457915935144067, 'fraction_numerical': 0.007538985851492306, 'mean_word_length': 3.092983939137785, 'pattern_counts': {'":': 3, '<': 317, '<?xml version=': 0, '>': 320, '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': '5876052', 'n_tokens_mistral': 4338, 'n_tokens_neox': 3489, 'n_words': 622}