index.html 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <html>
  2. <head>
  3. <title>crazy email recv srv</title>
  4. <link href="https://cdn.bootcss.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet">
  5. <link href="https://cdn.bootcss.com/bootstrap-table/1.12.1/bootstrap-table.min.css" rel="stylesheet">
  6. </head>
  7. <body>
  8. <div class="container">
  9. <div class="jumbotron" style="padding-top:2px;padding-bottom:2px">
  10. <h1>Crazy Email Reciver Service</h1>
  11. </div>
  12. <div id="toolbar">
  13. <div class="form-inline" role="form">
  14. <div class="form-group">
  15. <input id="from" class="form-control" type="text" placeholder="From">
  16. </div>
  17. <button id="from_btn" type="submit" class="btn btn-success">Search</button>
  18. &nbsp;
  19. &nbsp;
  20. &nbsp;
  21. &nbsp;
  22. &nbsp;
  23. &nbsp;
  24. <div class="form-group">
  25. <input id="to" class="form-control" type="text" placeholder="To">
  26. </div>
  27. <button id="to_btn" type="submit" class="btn btn-success">Search</button>
  28. </div>
  29. </div>
  30. <table id="table" data-toolbar="#toolbar" data-show-columns="true">
  31. <thead>
  32. <tr>
  33. <th data-field="from">From</th>
  34. <th data-field="to0">To[0]</th>
  35. <th data-field="to">To[ALL]</th>
  36. <th data-field="subject">Subject</th>
  37. <th data-field="content">Content</th>
  38. <th data-field="time">Date</th>
  39. </tr>
  40. </thead>
  41. </table>
  42. <div class="jumbotron">
  43. <h2>API</h2>
  44. <b>/all </b> get all emails (limit 100) <br />
  45. <b>/from/{addr}</b> get emails from addr (limit 100)<br />
  46. <b>/to/{addr}</b> get emails to addr(limit 100)<br />
  47. <p class="lead">
  48. example:
  49. <pre>
  50. [{
  51. "from": "a@example.com",
  52. "to0": "b@example.com",
  53. "to": ["b@example.com"],
  54. "subject": "A test",
  55. "content": "xxxxxxxxxxxxxxxxx*
  56. }]
  57. </pre>
  58. </p>
  59. </div>
  60. </div>
  61. <script src="https://cdn.bootcss.com/jquery/1.11.0/jquery.min.js"></script>
  62. <script src="https://cdn.bootcss.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
  63. <script src="https://cdn.bootcss.com/bootstrap-table/1.12.1/bootstrap-table.min.js"></script>
  64. <script>
  65. $.getJSON("all", function (data) {
  66. var $table = $('#table');
  67. $table.bootstrapTable({data: data});
  68. });
  69. $("#from_btn").click(function () {
  70. from = $("#from").val();
  71. if (from == "") {
  72. $.getJSON("all", function (data) {
  73. var $table = $('#table');
  74. $table.bootstrapTable('removeAll');
  75. $table.bootstrapTable('append', data);
  76. });
  77. } else {
  78. $.getJSON("from/" + from, function (data) {
  79. var $table = $('#table');
  80. $table.bootstrapTable('removeAll');
  81. $table.bootstrapTable('append', data);
  82. });
  83. }
  84. });
  85. $("#to_btn").click(function () {
  86. from = $("#to").val();
  87. if (from == "") {
  88. $.getJSON("all", function (data) {
  89. var $table = $('#table');
  90. $table.bootstrapTable('removeAll');
  91. $table.bootstrapTable('append', data);
  92. });
  93. } else {
  94. $.getJSON("to/" + from, function (data) {
  95. var $table = $('#table');
  96. $table.bootstrapTable('removeAll');
  97. $table.bootstrapTable('append', data);
  98. });
  99. }
  100. });
  101. </script>
  102. </body>
  103. </html>