client/scripts/client.js
changeset 10 ab694dc54515
parent 9 44d912089ce1
     1.1 --- a/client/scripts/client.js	Sat Oct 08 01:05:50 2011 +0200
     1.2 +++ b/client/scripts/client.js	Sun Dec 11 02:27:29 2011 +0100
     1.3 @@ -1,9 +1,8 @@
     1.4  //--allow-file-access-from-files
     1.5 -var server = "http://127.0.0.1:8080";
     1.6 +var server = "http://localhosts:8080";
     1.7  var view_left = "<view-left><h2>Machine</h2><p>Be yourself within Machine.</p></view-left>";
     1.8  
     1.9 -function command()
    1.10 -{
    1.11 +function command() {
    1.12      var com = document.getElementById("com");
    1.13      $.ajax({url: server + "/com",
    1.14  	    data: com.value,
    1.15 @@ -12,26 +11,20 @@
    1.16      com.value = ""; 
    1.17  }
    1.18  
    1.19 -function callback(data, status, xhr)
    1.20 -{
    1.21 +function callback(data, status, xhr) {
    1.22      view_left = "<view-left><h2>Machine</h2><p>" + data.time + "</p></view-left>";
    1.23      $("view-left").replaceWith(view_left);   
    1.24  }
    1.25  
    1.26 -$(document).ready
    1.27 -(
    1.28 -    function()
    1.29 -    {
    1.30 +$(document).ready (
    1.31 +    function() {
    1.32  	$("view-left").replaceWith(view_left);
    1.33      }
    1.34  );
    1.35  
    1.36 -$(document).keypress
    1.37 -(
    1.38 -    function(event) 
    1.39 -    {
    1.40 -	if (event.which == 13) 
    1.41 -	{
    1.42 +$(document).keypress (
    1.43 +    function(event) {
    1.44 +	if (event.which == 13) {
    1.45  	    event.preventDefault();
    1.46  	    command();
    1.47  	}