123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- <html>
- <head>
- <title>crazy email recv srv</title>
- <link href="https://cdn.bootcss.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet">
- <link href="https://cdn.bootcss.com/bootstrap-table/1.12.1/bootstrap-table.min.css" rel="stylesheet">
- </head>
- <body>
- <div class="container">
- <div class="jumbotron" style="padding-top:2px;padding-bottom:2px">
- <h1>Crazy Email Reciver Service</h1>
- </div>
- <div id="toolbar">
- <div class="form-inline" role="form">
- <div class="form-group">
- <input id="from" class="form-control" type="text" placeholder="From">
- </div>
- <button id="from_btn" type="submit" class="btn btn-success">Search</button>
-
-
-
-
-
-
- <div class="form-group">
- <input id="to" class="form-control" type="text" placeholder="To">
- </div>
- <button id="to_btn" type="submit" class="btn btn-success">Search</button>
- </div>
- </div>
- <table id="table" data-toolbar="#toolbar" data-show-columns="true">
- <thead>
- <tr>
- <th data-field="from">From</th>
- <th data-field="to0">To[0]</th>
- <th data-field="to">To[ALL]</th>
- <th data-field="subject">Subject</th>
- <th data-field="content">Content</th>
- <th data-field="time">Date</th>
- </tr>
- </thead>
- </table>
- <div class="jumbotron">
- <h2>API</h2>
- <b>/all </b> get all emails (limit 100) <br />
- <b>/from/{addr}</b> get emails from addr (limit 100)<br />
- <b>/to/{addr}</b> get emails to addr(limit 100)<br />
- <p class="lead">
- example:
- <pre>
- [{
- "from": "a@example.com",
- "to0": "b@example.com",
- "to": ["b@example.com"],
- "subject": "A test",
- "content": "xxxxxxxxxxxxxxxxx*
- }]
- </pre>
- </p>
- </div>
- </div>
- <script src="https://cdn.bootcss.com/jquery/1.11.0/jquery.min.js"></script>
- <script src="https://cdn.bootcss.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
- <script src="https://cdn.bootcss.com/bootstrap-table/1.12.1/bootstrap-table.min.js"></script>
- <script>
- $.getJSON("all", function (data) {
- var $table = $('#table');
- $table.bootstrapTable({data: data});
- });
- $("#from_btn").click(function () {
- from = $("#from").val();
- if (from == "") {
- $.getJSON("all", function (data) {
- var $table = $('#table');
- $table.bootstrapTable('removeAll');
- $table.bootstrapTable('append', data);
- });
- } else {
- $.getJSON("from/" + from, function (data) {
- var $table = $('#table');
- $table.bootstrapTable('removeAll');
- $table.bootstrapTable('append', data);
- });
- }
- });
- $("#to_btn").click(function () {
- from = $("#to").val();
- if (from == "") {
- $.getJSON("all", function (data) {
- var $table = $('#table');
- $table.bootstrapTable('removeAll');
- $table.bootstrapTable('append', data);
- });
- } else {
- $.getJSON("to/" + from, function (data) {
- var $table = $('#table');
- $table.bootstrapTable('removeAll');
- $table.bootstrapTable('append', data);
- });
- }
- });
- </script>
- </body>
- </html>
|