[Groonga-commit] groonga/heroku-try-groonga at 46da481 [master] Add paste area

Back to archive index

Masafumi Yokoyama null+****@clear*****
Fri Oct 24 23:05:06 JST 2014


Masafumi Yokoyama	2014-10-24 23:05:06 +0900 (Fri, 24 Oct 2014)

  New Revision: 46da4810a022ca3608e115f15a709fca7bfaca06
  https://github.com/groonga/heroku-try-groonga/commit/46da4810a022ca3608e115f15a709fca7bfaca06

  Merged 7979c00: Merge pull request #6 from myokoym/add-paste-area

  Message:
    Add paste area

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

  Modified: public/index.html (+13 -0)
===================================================================
--- public/index.html    2014-09-29 15:53:18 +0900 (e0b1781)
+++ public/index.html    2014-10-24 23:05:06 +0900 (982b0ad)
@@ -30,6 +30,19 @@
     <div class="container-fluid">
       <div id="terminal"></div>
       <hr>
+      <div role="form">
+        <div class="form-group">
+          <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>
+      <hr>
       <nav>
       <h2>Documentations</h2>
       <ul>

  Modified: public/js/try-groonga.js (+16 -0)
===================================================================
--- public/js/try-groonga.js    2014-09-29 15:53:18 +0900 (244da28)
+++ public/js/try-groonga.js    2014-10-24 23:05:06 +0900 (90a5f36)
@@ -48,4 +48,20 @@ jQuery(function($, undefined) {
     this.scrollTop += event.deltaY * -10;
     return event.preventDefault();
   });
+
+  $("#paste-submit").click(function(event) {
+    var text = $("#paste-area").val();
+    var lines = text.replace(/\r\n|\r/g, "\n").split("\n");
+    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);
+        }
+      });
+    }
+  });
 });
-------------- next part --------------
HTML����������������������������...
다운로드 



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