<commit_before><div id="freq-table-selector" style="position:relative">
	<div class="map-key-ww"><div class="map-key-w" style="padding:8px">
		<div id="m-key" class="ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix">
			<table>
				<tbody>
					<tr>
						<td class="selectors">
							<div class="selector-wrap">Rows
								<select id="freq-rows"></select>
							</div>
							<div class="selector-wrap">Columns
								<select id="freq-cols"></select>
							</div>
							<a href="#" style="margin-left:20px" id="get-table">Get Chart</a>
						</td>
					</tr>
				</tbody>
			</table>
		</div>
	</div></div>
</div>
<div id="freq-table" style="padding:65px 15px 10px 15px;"></div>

<script type="text/javascript" charset="utf-8">

function parseFreqTable(data) {
	var columns = data.column_headers,
		rows = data.row_headers;
	
	var table = $("<table />");
	var thead = $("<thead />"),
		tbody = $("<tbody />");
	var curRow = $("<tr />").html("<th />");
	$.each(columns, function(k, v){
		curRow.append($("<th />").html(v.text));
	});
	thead.append(curRow);
	table.append(thead);

	
	$.each(rows, function(k, v){
		curRow = $("<tr />");
		var rowId = v.id,
			rowData = data.cells[rowId],
				rowHeader = $("<td />").html(v.text);
		curRow.append(rowHeader);
		$.each(columns, function(k, v){
			var colId = v.id, text = "";
			if($.type(rowData)!=='undefined' && rowData && rowData[colId]) {
				text = rowData[colId];
			}
			curRow.append($("<td />", {'class':'data'}).html(text));
		})
		
		tbody.append(curRow);
	})
	table.append(tbody);
	return table;
}


	(function($){
		$.fn.thinButton = function(){
			this.button();
			$('span.ui-button-text', this).css({'padding':'1px 5px'});
			return this;
		}
	})(jQuery);
	
	$(function(){
		$('#get-table').thinButton();
		$('#get-table').click(function(evt){
			evt.preventDefault();
		})
	})
	var tableTypes = {{table_types|safe}};
	
	dashboard.get("#/frequency-tables", function(context){
		this.switchTo("frequency-tables");
        this.title("Frequency Tables");
    });
	dashboard.get("#/frequency-tables/:row/:col", function(context){
		this.switchTo("frequency-tables");
        this.title("Frequency Tables");

		var row = this.params['row'],
			col = this.params['col'],
			freqTable = $("#freq-table");
			
		$('#freq-rows').val(row);
		$('#freq-cols').val(col);
		$.getJSON("/submission-counts/"+row+"/"+col, function(tableData){
			var table = parseFreqTable(tableData);

			table.addClass('ptable');
			$('tr td', table).each(function(ct, elm){
				var td = $(elm);
				if(td.index()==0) {
					td.addClass('rname');
				} else {
					td.addClass('centered data');
					if(td.text()!=="") {
						td.wrapInner("<div class='dwrap' />")
					}
				}<commit_msg>using localstorage and jquery.offline to cache freq table json.<commit_after><div id="freq-table-selector" style="position:relative">
	<div class="map-key-ww"><div class="map-key-w" style="padding:8px">
		<div id="m-key" class="ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix">
			<table>
				<tbody>
					<tr>
						<td class="selectors">
							<div class="selector-wrap">Rows
								<select id="freq-rows"></select>
							</div>
							<div class="selector-wrap">Columns
								<select id="freq-cols"></select>
							</div>
							<a href="#" style="margin-left:20px" id="get-table">Get Chart</a>
						</td>
					</tr>
				</tbody>
			</table>
		</div>
	</div></div>
</div>
<div id="freq-table" style="padding:65px 15px 10px 15px;"></div>

<script type="text/javascript" charset="utf-8">

function parseFreqTable(data) {
	var columns = data.column_headers,
		rows = data.row_headers;
	
	var table = $("<table />");
	var thead = $("<thead />"),
		tbody = $("<tbody />");
	var curRow = $("<tr />").html("<th />");
	$.each(columns, function(k, v){
		curRow.append($("<th />").html(v.text));
	});
	thead.append(curRow);
	table.append(thead);

	
	$.each(rows, function(k, v){
		curRow = $("<tr />");
		var rowId = v.id,
			rowData = data.cells[rowId],
				rowHeader = $("<td />").html(v.text);
		curRow.append(rowHeader);
		$.each(columns, function(k, v){
			var colId = v.id, text = "";
			if($.type(rowData)!=='undefined' && rowData && rowData[colId]) {
				text = rowData[colId];
			}
			curRow.append($("<td />", {'class':'data'}).html(text));
		})
		
		tbody.append(curRow);
	})
	table.append(tbody);
	return table;
}


	(function($){
		$.fn.thinButton = function(){
			this.button();
			$('span.ui-button-text', this).css({'padding':'1px 5px'});
			return this;
		}
	})(jQuery);
	
	$(function(){
		$('#get-table').thinButton();
		$('#get-table').click(function(evt){
			evt.preventDefault();
		})
	})
	var tableTypes = {{table_types|safe}};
	
	dashboard.get("#/frequency-tables", function(context){
		this.switchTo("frequency-tables");
        this.title("Frequency Tables");
    });
	dashboard.get("#/frequency-tables/:row/:col", function(context){
		this.switchTo("frequency-tables");
        this.title("Frequency Tables");

		var row = this.params['row'],
			col = this.params['col'],
			freqTable = $("#freq-table");
			
		$('#freq-rows').val(row);
		$('#freq-cols').val(col);
		$.retrieveJSON("/submission-counts/"+row+"/"+col, function(tableData){
			var table = parseFreqTable(tableData);

			table.addClass('ptable');
			$('tr td', table).each(function(ct, elm){
				var td = $(elm);
				if(td.index()==0) {
					td.addClass('rname');
				} else {
					td.addClass('centered data');
					if(td.text()!=="") {
						td.wrapInner("<div class='dwrap' />")
					}
				}
{'fraction_non_alphanumeric': 0.23446785521339816, 'fraction_numerical': 0.005402485143165856, 'mean_word_length': 3.504460665044607, 'pattern_counts': {'":': 0, '<': 81, '<?xml version=': 0, '>': 81, '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': '653510', 'n_tokens_mistral': 2368, 'n_tokens_neox': 1975, 'n_words': 336}