Kouhei Sutou
null+****@clear*****
Sun Jul 20 11:10:49 JST 2014
Kouhei Sutou 2014-07-20 11:10:49 +0900 (Sun, 20 Jul 2014) New Revision: 3c6c361235313fe82ee87b0ce108cc4d75b3b4f1 https://github.com/groonga/heroku-try-groonga/commit/3c6c361235313fe82ee87b0ce108cc4d75b3b4f1 Message: Use 2 spaces for an indent Modified files: public/js/try-groonga.js Modified: public/js/try-groonga.js (+41 -41) =================================================================== --- public/js/try-groonga.js 2014-07-20 11:10:17 +0900 (e454ff3) +++ public/js/try-groonga.js 2014-07-20 11:10:49 +0900 (3fd9f68) @@ -1,51 +1,51 @@ jQuery(function($, undefined) { - var id = Math.random().toString(); - var sendCommandQueue = []; + var id = Math.random().toString(); + var sendCommandQueue = []; - function enqueueCommand(command, onResponse) { - var sendCommand = function() { - var success = function(data, textStatus, jqXHR) { - var response; - if (typeof data == "string") { - response = data; - } else { - response = JSON.stringify(data, undefined, 2); - } - onResponse(response); - - sendCommandQueue.shift(); - if (sendCommandQueue.length > 0) { - sendCommandQueue[0](); - } - }; - $.post("sessions/" + id, command, success); - }; + function enqueueCommand(command, onResponse) { + var sendCommand = function() { + var success = function(data, textStatus, jqXHR) { + var response; + if (typeof data == "string") { + response = data; + } else { + response = JSON.stringify(data, undefined, 2); + } + onResponse(response); - sendCommandQueue.push(sendCommand); - if (sendCommandQueue.length == 1) { - sendCommand(); + sendCommandQueue.shift(); + if (sendCommandQueue.length > 0) { + sendCommandQueue[0](); } + }; + $.post("sessions/" + id, command, success); + }; + + sendCommandQueue.push(sendCommand); + if (sendCommandQueue.length == 1) { + sendCommand(); } + } - $("#terminal").terminal(function(command, term) { - if (command === "") { - return; - } + $("#terminal").terminal(function(command, term) { + if (command === "") { + return; + } - enqueueCommand(command, function(response) { - if (response.length == 0) { - return; - } - term.echo(response); - }); - }, { - greetings: "", - height: 400, - prompt: "groonga> " + enqueueCommand(command, function(response) { + if (response.length == 0) { + return; + } + term.echo(response); }); + }, { + greetings: "", + height: 400, + prompt: "groonga> " + }); - $('#terminal').mousewheel(function(event) { - this.scrollTop += deltaY * -10; - return event.preventDefault(); - }); + $('#terminal').mousewheel(function(event) { + this.scrollTop += deltaY * -10; + return event.preventDefault(); + }); }); -------------- next part -------------- HTML����������������������������...Download