<commit_before>define([ "jquery", "message-bus" ], function($, bus) {
	var BUTTON_IMAGE_CLASS = "button-image";

	bus.listen("ui-button:create", function(e, msg) {
		var button;
		if (msg.text) {
			button = $("<button>").text(msg.text);
		} else {
			button = $("<div/>");
			var imageDiv = $("<div/>");
			imageDiv.css("background-image", "url(" + msg.image + ")");
			imageDiv.addClass(BUTTON_IMAGE_CLASS);
			button.append(imageDiv);
		}

		if (msg.tooltip) {
			button.attr("title", msg.tooltip);
		}

		button.attr("id", msg.div);
		button.addClass(msg.css);
		button.addClass("button-enabled");

		var parent = $("#" + msg.parentDiv);
		var nextDiv;
		if (msg.priority) {
			button.attr("priority", msg.priority);

			var children = parent.children();
			for (var i = 0; i < children.length; i++) {
				var child = $(children[i]);
				var priority = child.attr("priority");
				if (!priority || priority > msg.priority) {
					nextDiv = child;
					break;
				}
			}<commit_msg>Add background image to buttons only if provided<commit_after>define([ "jquery", "message-bus" ], function($, bus) {
	var BUTTON_IMAGE_CLASS = "button-image";

	bus.listen("ui-button:create", function(e, msg) {
		var button;
		if (msg.text) {
			button = $("<button>").text(msg.text);
		} else {
			button = $("<div/>");
			var imageDiv = $("<div/>");
			if (msg.image) {
				imageDiv.css("background-image", "url(" + msg.image + ")");
			}
			imageDiv.addClass(BUTTON_IMAGE_CLASS);
			button.append(imageDiv);
		}

		if (msg.tooltip) {
			button.attr("title", msg.tooltip);
		}

		button.attr("id", msg.div);
		button.addClass(msg.css);
		button.addClass("button-enabled");

		var parent = $("#" + msg.parentDiv);
		var nextDiv;
		if (msg.priority) {
			button.attr("priority", msg.priority);

			var children = parent.children();
			for (var i = 0; i < children.length; i++) {
				var child = $(children[i]);
				var priority = child.attr("priority");
				if (!priority || priority > msg.priority) {
					nextDiv = child;
					break;
				}
			}
{'fraction_non_alphanumeric': 0.19743968488429345, 'fraction_numerical': 0.0009847365829640572, 'mean_word_length': 3.417391304347826, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '4732372', 'n_tokens_mistral': 811, 'n_tokens_neox': 686, 'n_words': 145}