<commit_before><!DOCTYPE html>
<html lang="en">

<head>

<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.2.1/css/bootstrap-combined.min.css" rel="stylesheet">

<title>SuperCollider API</title>

</head>

<body>

<div class="container">


<div class="navbar navbar-inverse">
  <div class="navbar-inner">
    <a class="brand" href="#">SuperCollider API</a>
    <ul class="nav">
    	<li><span class="label" id="connection_status">connection status</span></li>
    </ul>
  </div>
</div>


<div class="row-fluid">
	<div class="span8 well">

		<form class="form form-horizontal" id="callform">
			<div class="control-group">
				<label class="control-label">path</label>
				<div class="controls"><input type="text" name="path" id="path" value="" /></div>
			</div>
			<div class="control-group">
				<label class="control-label">args</label>
				<div class="controls"><textarea name="args" id="args" />[]</textarea></div>
			</div>
			<div class="controls"><input type="submit" value="call" class="btn btn-primary" id="submit" /></div>
		</form>

		<div id="response_time"></div>
		<div id="response" class="info"></div>

	</div>
	<div class="span4" id="api_list">
		<h4>paths</h4>
		<ul class="nav nav-list">
		</ul>
	</div>
</div>

<div class="row-fluid">
	<div class="span12" id="code">
		<h4>View Source</h4>
		<pre class="hidden"><code></code></pre>
	</div>
</div>


<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.4.2/underscore-min.js"></script>

<script src="/socket.io/socket.io.js"></script>
<script src="/media/js/scapi.js"></script>

<script type='text/javascript' id="main">

	var sc = new SCApi("localhost", 4040);

	function timestamp(start) {
		var now = new Date();
		$("#response_time").html(now.toTimeString() + " [" + (now-start) + "ms]");
	}
	$("#callform").submit(function(e) {
		var path = $("#path", this).val(),
			args = $("#args", this).val(),
			start = new Date();
		e.preventDefault();
		if(args) {
			args = eval(args); // evil
		}
		$("#response").html("<i class='icon-time'></i> loading...");
		sc.call(path, args,
			function(data) {
				var formatted;
				timestamp(start);
				if(_.isArray(data)) {
					formatted = $("<ul></ul>");
					_.each(data,function(it) {
						formatted.append("<li>" + it + "</li>");
					});
				} else {
					if(_.isObject(data)) {
						formatted = $("<table class='table table-striped table-hover'></table>");
						_.each(data,function(v, k) {
							formatted.append("<tr><th>" + k + "</th><td>" + v + "</td></tr>");
						});
					} else {
						formatted = data ? data : "OK";
					}
				}
				$("#response").html(formatted).attr('class','alert alert-success');
			},
			function(data) {
				timestamp(start);
				$("#response").html(data).attr('class','alert alert-error');
			}
		);
	});

	// fetch api paths and populate the sidebar
	sc.call("API.paths", [], function(paths) {
		var ul = $("#api_list ul");
		_.each(paths, function(path) {
			ul.append("<li><a>" + path + "</a></li>");
		});
		$("li a",ul).click(function() {
			$("#callform #path").val($(this).html());
		});
	});

	// show connection status
    function setStatus(way) {<commit_msg>reset the args field to [] when clicking to set the API path<commit_after><!DOCTYPE html>
<html lang="en">

<head>

<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.2.1/css/bootstrap-combined.min.css" rel="stylesheet">

<title>SuperCollider API</title>

</head>

<body>

<div class="container">


<div class="navbar navbar-inverse">
  <div class="navbar-inner">
    <a class="brand" href="#">SuperCollider API</a>
    <ul class="nav">
    	<li><span class="label" id="connection_status">connection status</span></li>
    </ul>
  </div>
</div>


<div class="row-fluid">
	<div class="span8 well">

		<form class="form form-horizontal" id="callform">
			<div class="control-group">
				<label class="control-label">path</label>
				<div class="controls"><input type="text" name="path" id="path" value="" /></div>
			</div>
			<div class="control-group">
				<label class="control-label">args</label>
				<div class="controls"><textarea name="args" id="args" />[]</textarea></div>
			</div>
			<div class="controls"><input type="submit" value="call" class="btn btn-primary" id="submit" /></div>
		</form>

		<div id="response_time"></div>
		<div id="response" class="info"></div>

	</div>
	<div class="span4" id="api_list">
		<h4>paths</h4>
		<ul class="nav nav-list">
		</ul>
	</div>
</div>

<div class="row-fluid">
	<div class="span12" id="code">
		<h4>View Source</h4>
		<pre class="hidden"><code></code></pre>
	</div>
</div>


<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.4.2/underscore-min.js"></script>

<script src="/socket.io/socket.io.js"></script>
<script src="/media/js/scapi.js"></script>

<script type='text/javascript' id="main">

	var sc = new SCApi("localhost", 4040);

	function timestamp(start) {
		var now = new Date();
		$("#response_time").html(now.toTimeString() + " [" + (now-start) + "ms]");
	}
	$("#callform").submit(function(e) {
		var path = $("#path", this).val(),
			args = $("#args", this).val(),
			start = new Date();
		e.preventDefault();
		if(args) {
			args = eval(args); // evil
		}
		$("#response").html("<i class='icon-time'></i> loading...");
		sc.call(path, args,
			function(data) {
				var formatted;
				timestamp(start);
				if(_.isArray(data)) {
					formatted = $("<ul></ul>");
					_.each(data,function(it) {
						formatted.append("<li>" + it + "</li>");
					});
				} else {
					if(_.isObject(data)) {
						formatted = $("<table class='table table-striped table-hover'></table>");
						_.each(data,function(v, k) {
							formatted.append("<tr><th>" + k + "</th><td>" + v + "</td></tr>");
						});
					} else {
						formatted = data ? data : "OK";
					}
				}
				$("#response").html(formatted).attr('class','alert alert-success');
			},
			function(data) {
				timestamp(start);
				$("#response").html(data).attr('class','alert alert-error');
			}
		);
	});

	// fetch api paths and populate the sidebar
	sc.call("API.paths", [], function(paths) {
		var ul = $("#api_list ul");
		_.each(paths, function(path) {
			ul.append("<li><a>" + path + "</a></li>");
		});
		$("li a",ul).click(function() {
			$("#callform #path").val($(this).html());
			$("#callform #args").val("[ ]");
		});
	});

	// show connection status
    function setStatus(way) {
{'fraction_non_alphanumeric': 0.2421600122380297, 'fraction_numerical': 0.006424965580541533, 'mean_word_length': 3.751453488372093, 'pattern_counts': {'":': 0, '<': 187, '<?xml version=': 0, '>': 187, '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': '731636', 'n_tokens_mistral': 2669, 'n_tokens_neox': 2326, 'n_words': 429}