<commit_before>/*
---
description: Creates instances of HtmlTable for any table with the css class .ccs-data_table with additional options for sortability and selectability.
provides: [Behavior.HtmlTable]
requires: [/Behavior, More/HtmlTable.Sort, More/HtmlTable.Zebra, More/HtmlTable.Select, More/HtmlTable.Tree]
script: Behavior.HtmlTable.js
...
*/

Behavior.addGlobalFilters({

	HtmlTable: function(element, methods){
		//make all data tables sortable
		var firstSort;
		element.getElements('thead th').each(function(th, i){
			if (firstSort == null && !th.hasClass('noSort')) firstSort = i;
			if (th.hasClass('defaultSort')) firstSort = i;
		});
		var multiselectable = element.hasClass('multiselect');
		new HtmlTable(element, {
			sortIndex: firstSort,
			sortable: element.hasClass('sortable') && !element.hasClass('treeview'),
			classNoSort: 'noSort',
			selectable: element.hasClass('selectable') || multiselectable,
			allowMultiSelect: multiselectable,
			useKeyboard: !element.hasClass('noKeyboard'),
			enableTree: element.hasClass('treeView'),
			build: element.hasClass('buildTree')
		});
	}

});

HtmlTable.defineParsers({
	//A parser to allow numeric sorting by any value.
	dataSortNumeric: {
		match: /data-sort-numeric/,
		convert: function() {
			return this.getElement('[data-sort-numeric]').get('data', 'sort-numeric').toInt();
		},
		number: true<commit_msg>HtmlTable now relinquishes its keyboard on removal.<commit_after>/*
---
description: Creates instances of HtmlTable for any table with the css class .ccs-data_table with additional options for sortability and selectability.
provides: [Behavior.HtmlTable]
requires: [/Behavior, More/HtmlTable.Sort, More/HtmlTable.Zebra, More/HtmlTable.Select, More/HtmlTable.Tree]
script: Behavior.HtmlTable.js
...
*/

Behavior.addGlobalFilters({

	HtmlTable: function(element, methods){
		//make all data tables sortable
		var firstSort;
		element.getElements('thead th').each(function(th, i){
			if (firstSort == null && !th.hasClass('noSort')) firstSort = i;
			if (th.hasClass('defaultSort')) firstSort = i;
		});
		var multiselectable = element.hasClass('multiselect');
		var table = new HtmlTable(element, {
			sortIndex: firstSort,
			sortable: element.hasClass('sortable') && !element.hasClass('treeview'),
			classNoSort: 'noSort',
			selectable: element.hasClass('selectable') || multiselectable,
			allowMultiSelect: multiselectable,
			useKeyboard: !element.hasClass('noKeyboard'),
			enableTree: element.hasClass('treeView'),
			build: element.hasClass('buildTree')
		});
		this.markForCleanup(table, function(){
			table.keyboard.relinquish();
		});
	}

});

HtmlTable.defineParsers({
	//A parser to allow numeric sorting by any value.
	dataSortNumeric: {
		match: /data-sort-numeric/,
		convert: function() {
			return this.getElement('[data-sort-numeric]').get('data', 'sort-numeric').toInt();
		},
		number: true
{'fraction_non_alphanumeric': 0.1443868739205527, 'fraction_numerical': 0.0, 'mean_word_length': 4.995859213250518, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3295379', 'n_tokens_mistral': 980, 'n_tokens_neox': 898, 'n_words': 206}