<commit_before>var hp_corpusChooser = {
	
	options: {
		template : '',
		allSelectedString : 'All corpora selected',
		noneSelectedString : 'No corpus selected',
		selectedString : ' selected',
		selectedMultipleString: ' corpuses selected',
		buttonSelectAll : 'Select all',
		buttonSelectNone : 'Select none'
	},
	
	_create: function() {
			this._transform();
			
			// Make the popup disappear when the user clicks outside it
			$(window).unbind('click.corpusselector');
			$(window).bind('click.corpusselector', function(e) {
				var disp = $(".popupchecks").css("display");
				if(disp != "none" && e.target != self) {
					$(".popupchecks").fadeOut('fast');
					$(".hp_topframe").removeClass("ui-corner-top");
					$(".hp_topframe").addClass("ui-corner-all");
				}
			});
			
			$('.buttonlink, ul#icons li').hover(
				function() { $(this).addClass('ui-state-hover'); }, 
				function() { $(this).removeClass('ui-state-hover'); }
			);
			
			
	},
	isSelected: function(id) {
		// Test if a given id is selected
		var cb = $("#"+id);
		//var cb = item.find("checkbox");
		return cb.hasClass("checked");
	},
	selectedItems: function() {
		// Return all ids that are selected
		var IDArray = new Array();
		var allboxes = $(".boxdiv label .checked");
		allboxes.each(function(){
			var idstring = $(this).attr('id');
			//alert(idstring);
			IDArray.push(idstring.slice(9));
		});
		//alert(allboxes.length);
		return IDArray;
	},
	_transform: function() {	
			var el = this.element;
			var body;
			if(this.options.template != '') {
				body = this.options.template;
			} else {
				body = el.html();
			}
			var newHTML = '<div class="scroll_checkboxes">';
			newHTML += '<div class="hp_topframe buttonlink ui-state-default ui-corner-all"><div style="float:left"><span id="hp_corpora_title">' + this.options.allSelectedString + '</span></div><div style="float:right; width:16px"><span style="text-align:right; left:auto" class="ui-icon ui-icon-triangle-2-n-s"></span></div></div></div>';
			
			newHTML += '<div class="popupchecks ui-corner-bottom">'
			
			newHTML += '<p style="text-align:right; margin-top:10px; margin-right:8px"><a href="#" class="buttonlink ui-state-default ui-corner-all selectall"><span class="ui-icon ui-icon-check"></span> ' + this.options.buttonSelectAll + '</a> <a href="#" class="selectnone buttonlink ui-state-default ui-corner-all"><span class="ui-icon ui-icon-closethick"></span> ' + this.options.buttonSelectNone + '</a></p>';
			
			newHTML += recursive_transform(body,0);
			newHTML += '</div>';<commit_msg>corpus selector widget<commit_after>var hp_corpusChooser = {
	
	options: {
		template : '',
		allSelectedString : 'All corpora selected',
		noneSelectedString : 'No corpus selected',
		selectedString : ' selected',
		selectedMultipleString: ' corpuses selected',
		buttonSelectAll : 'Select all',
		buttonSelectNone : 'Select none'
	},
	
	_create: function() {
			this._transform();
			
			// Make the popup disappear when the user clicks outside it
			$(window).unbind('click.corpusselector');
			$(window).bind('click.corpusselector', function(e) {
				var disp = $(".popupchecks").css("display");
				if(disp != "none" && e.target != self) {
					$(".popupchecks").fadeOut('fast');
					$(".hp_topframe").removeClass("ui-corner-top");
					$(".hp_topframe").addClass("ui-corner-all");
				}
			});
			
			$('.buttonlink, ul#icons li').hover(
				function() { $(this).addClass('ui-state-hover'); }, 
				function() { $(this).removeClass('ui-state-hover'); }
			);
			
			
	},
	isSelected: function(id) {
		// Test if a given id is selected
		var cb = $("#"+id);
		//var cb = item.find("checkbox");
		return cb.hasClass("checked");
	},
	selectedItems: function() {
		// Return all ids that are selected
		var IDArray = new Array();
		var allboxes = $(".boxdiv label .checked");
		allboxes.each(function(){
			var idstring = $(this).attr('id');
			//alert(idstring);
			IDArray.push(idstring.slice(9));
		});
		//alert(allboxes.length);
		return IDArray;
	},
	_transform: function() {	
			var el = this.element;
			var body;
			if(this.options.template != '') {
				body = this.options.template;
			} else {
				body = el.html();
			}
			var newHTML = '<div class="scroll_checkboxes">';
			newHTML += '<div class="hp_topframe buttonlink ui-state-default ui-corner-all"><div style="float:left; padding-top:2px"><span id="hp_corpora_title">' + this.options.allSelectedString + '</span></div><div style="float:right; width:16px"><span style="text-align:right; left:auto" class="ui-icon ui-icon-triangle-2-n-s"></span></div></div></div>';
			
			newHTML += '<div class="popupchecks ui-corner-bottom">'
			
			newHTML += '<p style="text-align:right; margin-top:10px; margin-right:8px"><a href="#" class="buttonlink ui-state-default ui-corner-all selectall"><span class="ui-icon ui-icon-check"></span> ' + this.options.buttonSelectAll + '</a> <a href="#" class="selectnone buttonlink ui-state-default ui-corner-all"><span class="ui-icon ui-icon-closethick"></span> ' + this.options.buttonSelectNone + '</a></p>';
			
			newHTML += recursive_transform(body,0);
			newHTML += '</div>';
{'fraction_non_alphanumeric': 0.19442277691107646, 'fraction_numerical': 0.0033151326053042123, 'mean_word_length': 3.9651500484027107, 'pattern_counts': {'":': 0, '<': 51, '<?xml version=': 0, '>': 51, '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': '3485650', 'n_tokens_mistral': 1909, 'n_tokens_neox': 1636, 'n_words': 330}