[Groonga-commit] groonga/heroku-try-groonga at 903e323 [master] Use textarea instead of alert to show response

Back to archive index

Masafumi Yokoyama null+****@clear*****
Sat Oct 25 16:01:31 JST 2014


Masafumi Yokoyama	2014-10-25 16:01:31 +0900 (Sat, 25 Oct 2014)

  New Revision: 903e323f7affb2cf08bc882b564a4c3608741fb9
  https://github.com/groonga/heroku-try-groonga/commit/903e323f7affb2cf08bc882b564a4c3608741fb9

  Merged 0f1712c: Merge pull request #7 from myokoym/use-textarea-for-response

  Message:
    Use textarea instead of alert to show response

  Modified files:
    public/index.html
    public/js/try-groonga.js

  Modified: public/index.html (+4 -5)
===================================================================
--- public/index.html    2014-10-24 23:34:42 +0900 (982b0ad)
+++ public/index.html    2014-10-25 16:01:31 +0900 (5d00151)
@@ -35,12 +35,11 @@
           <label for="paste-area">paste area</label>
           <textarea class="form-control" id="paste-area"></textarea>
         </div>
-        <div class="checkbox">
-          <label class="checkbox-inline">
-            <input type="checkbox" id="paste-alert">alert response</input>
-          </label>
-        </div>
         <input type="button" class="btn btn-default" id="paste-submit" value="submit" />
+        <div class="form-group">
+          <label for="paste-response">response</label>
+          <textarea class="form-control" id="paste-response" readonly></textarea>
+        </div>
       </div>
       <hr>
       <nav>

  Modified: public/js/try-groonga.js (+6 -2)
===================================================================
--- public/js/try-groonga.js    2014-10-24 23:34:42 +0900 (90a5f36)
+++ public/js/try-groonga.js    2014-10-25 16:01:31 +0900 (8a6c615)
@@ -50,17 +50,21 @@ jQuery(function($, undefined) {
   });
 
   $("#paste-submit").click(function(event) {
+    $("#paste-response").val("");
     var text = $("#paste-area").val();
     var lines = text.replace(/\r\n|\r/g, "\n").split("\n");
+    var responses = new Array();
     for (var i = 0; i < lines.length; i++) {
       var line = lines[i];
       if (line === "") {
         continue;
       }
       enqueueCommand(line, function(response) {
-        if ($("#paste-alert").prop("checked")) {
-          alert(response);
+        if (response.length == 0) {
+          return;
         }
+        responses.push(response)
+        $("#paste-response").val(responses.join("\n,\n"));
       });
     }
   });
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index