<commit_before>(function($) {
	function changeMultiple(method, arg) {
		// Apply the same method and arg to multiple objects
		return function() {
			var args = arguments;
			if(!args.length) return false; // no args
			for(var i = 0; i < args.length; i++) {
				if(args[i] && args[i][method]) args[i][method](arg);
			}
			return true;
		};
	}
	var show = changeMultiple("removeClass", "jshidden");
	var hide = changeMultiple("addClass", "jshidden");
	function visible(el) {
		return (el ? !el.hasClass("jshidden") : null);
	}
	function MenuLabel(label) {
		// Object for manipulating menulabel
		label.click(function(e) {
			e.preventDefault();
		});
		var labeltext;
		function init() {
			labeltext = label.contents().get(0).nodeValue;
		}
		this.obj = label;
		this.addColon = function() {
			// Show colon in label when expanded
			init();
			if(labeltext.indexOf(":") == -1) {
				label.contents().get(0).nodeValue = $.trim(labeltext) + ":";
			}
		};
		this.removeColon = function() {
			// Remove colon in label when collapsed
			init();
			label.contents().get(0).nodeValue = labeltext.replace(":", "");
		};
		this.removeColon();
	}
	function RichSelect(el, opts) {
		// Object for rich menu functionality
		opts = opts || {};
		var settings = $.extend({
			imagePath : ""
		}, opts);
		var imgpath = settings.imagePath;
		var rs = this;
		function MenuBox(menubox) {
			// Add empty element for holding option text
			menubox.prepend("<span />");
			var menutext = menubox.children().first();
			var richopt = menubox.find(".richopt");
			hide(menubox, richopt);
			// Add remove button
			menubox.append($("<span />", {
				"class" : "removeval",
				click : function() {
					rs.removeVal();
				}
			}));
			menubox.children().last().html($("<img />", {
				src : imgpath + "remove.png",
				alt : "remove"
			}));
			this.update = function(option) {
				// Shows selected option. If option is a richopt show that element.
				rs.menulabel.addColon();
				if(option.hasClass("richopt")) {
					menutext.text("");
					show(richopt, menubox);
				}
				else {
					if(!richopt.hasClass("jshidden")) hide(richopt);
					menutext.text(option.text());
					show(menubox);
				}
				rs.menu.position();
			};
			this.show = function() {
				rs.menulabel.addColon();
				show(menubox);
			};
			this.hide = function() {
				rs.menulabel.removeColon();
				hide(menubox);
			};
			this.reset = function() {
				this.hide();
				menutext.text("");
			};
			this.focus = function() {
				if(!visible(richopt)) return false;
				var inputs = richopt.find("input");
				// Select form element for added usability
				if(inputs.size()) {
					inputs.first().select();
				}
				return true;
			};
		}
		function Menu(menu) {
			var self = this;
			menu = (menu && menu.size()) ? menu : null; // Check for existence of menu
			this.name = menu ? menu.attr("name") : "";
			this.position = function() {
				// Set menu to show below button
				if(menu) menu.css("top", el.innerHeight() - 2);
			};
			this.visible = function() {
				return menu ? visible(menu) : false;
			};
			this.show = function() {
				if(menu) {
					show(menu);
					menu.focus();
				}
				else rs.menubox.show();
			};
			this.hide = function() {
				if(menu) {
					hide(menu);
					rs.menubox.focus();
				}
				else rs.menubox.hide();
			};
			this.update = function() {
				// Update selected menu option from valstore value
				if(!menu) return false;<commit_msg>Return menubox visibility from Menu.visible() if there is no menu.<commit_after>(function($) {
	function changeMultiple(method, arg) {
		// Apply the same method and arg to multiple objects
		return function() {
			var args = arguments;
			if(!args.length) return false; // no args
			for(var i = 0; i < args.length; i++) {
				if(args[i] && args[i][method]) args[i][method](arg);
			}
			return true;
		};
	}
	var show = changeMultiple("removeClass", "jshidden");
	var hide = changeMultiple("addClass", "jshidden");
	function visible(el) {
		return (el ? !el.hasClass("jshidden") : null);
	}
	function MenuLabel(label) {
		// Object for manipulating menulabel
		label.click(function(e) {
			e.preventDefault();
		});
		var labeltext;
		function init() {
			labeltext = label.contents().get(0).nodeValue;
		}
		this.obj = label;
		this.addColon = function() {
			// Show colon in label when expanded
			init();
			if(labeltext.indexOf(":") == -1) {
				label.contents().get(0).nodeValue = $.trim(labeltext) + ":";
			}
		};
		this.removeColon = function() {
			// Remove colon in label when collapsed
			init();
			label.contents().get(0).nodeValue = labeltext.replace(":", "");
		};
		this.removeColon();
	}
	function RichSelect(el, opts) {
		// Object for rich menu functionality
		opts = opts || {};
		var settings = $.extend({
			imagePath : ""
		}, opts);
		var imgpath = settings.imagePath;
		var rs = this;
		function MenuBox(menubox) {
			// Add empty element for holding option text
			menubox.prepend("<span />");
			var menutext = menubox.children().first();
			var richopt = menubox.find(".richopt");
			hide(menubox, richopt);
			// Add remove button
			menubox.append($("<span />", {
				"class" : "removeval",
				click : function() {
					rs.removeVal();
				}
			}));
			menubox.children().last().html($("<img />", {
				src : imgpath + "remove.png",
				alt : "remove"
			}));
			this.update = function(option) {
				// Shows selected option. If option is a richopt show that element.
				rs.menulabel.addColon();
				if(option.hasClass("richopt")) {
					menutext.text("");
					show(richopt, menubox);
				}
				else {
					if(!richopt.hasClass("jshidden")) hide(richopt);
					menutext.text(option.text());
					show(menubox);
				}
				rs.menu.position();
			};
			this.visible = function() {
				return visible(menubox);
			};
			this.show = function() {
				rs.menulabel.addColon();
				show(menubox);
			};
			this.hide = function() {
				rs.menulabel.removeColon();
				hide(menubox);
			};
			this.reset = function() {
				this.hide();
				menutext.text("");
			};
			this.focus = function() {
				if(!visible(richopt)) return false;
				var inputs = richopt.find("input");
				// Select form element for added usability
				if(inputs.size()) {
					inputs.first().select();
				}
				return true;
			};
		}
		function Menu(menu) {
			var self = this;
			menu = (menu && menu.size()) ? menu : null; // Check for existence of menu
			this.name = menu ? menu.attr("name") : "";
			this.position = function() {
				// Set menu to show below button
				if(menu) menu.css("top", el.innerHeight() - 2);
			};
			this.visible = function() {
				return menu ? visible(menu) : rs.menubox.visible();
			};
			this.show = function() {
				if(menu) {
					show(menu);
					menu.focus();
				}
				else rs.menubox.show();
			};
			this.hide = function() {
				if(menu) {
					hide(menu);
					rs.menubox.focus();
				}
				else rs.menubox.hide();
			};
			this.update = function() {
				// Update selected menu option from valstore value
				if(!menu) return false;
{'fraction_non_alphanumeric': 0.1725512528473804, 'fraction_numerical': 0.0017084282460136675, 'mean_word_length': 2.826252723311547, 'pattern_counts': {'":': 6, '<': 11, '<?xml version=': 0, '>': 9, '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': '593493', 'n_tokens_mistral': 2893, 'n_tokens_neox': 2340, 'n_words': 530}