Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

55
LINES

< > BotCompany Repo | #1002150 // Eleutheria Splash Page (with last interactions, OLD)

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Libraryless. Click here for Pure Java version (643L/6K/17K).

1  
!752
2  
3  
static O mainBot;
4  
5  
static S talkPageID = "#1002123";
6  
7  
static int maxQuestionLength = 500;
8  
static int maxAnswerLength = 200;
9  
10  
static S html(S subUri, Map<S, S> params) {
11  
  S id = params.get("id");
12  
  S slogan = params.get("slogan");
13  
  S sloganStyle = params.get("sloganStyle");
14  
  S bottomLink = params.get("bottomLink");
15  
  S imgLink = "http://tinybrain.de/";
16  
  if (id == null) ret "please specify id";
17  
  S imgURL = snippetImageURL(id);
18  
  new StringBuilder buf;
19  
  buf.append("<html><head><title>" + slogan + "</title></head>\n" +
20  
    "<table width='100%' height='100%' border=0><tr><td align=center>");
21  
  buf.append("<a href=" + htmlQuote(imgLink) + "><img src=" + htmlQuote(imgURL) + " border=0></a>");
22  
  if (!empty(slogan)) {
23  
    buf.append("<br><br><br>");
24  
    buf.append("<span style=" + htmlQuote(sloganStyle) + ">" + slogan + "</span>");
25  
    
26  
    int i = l((L) get(mainBot, "bots"));
27  
    int n = l((L) get(mainBot, "botIDs"));
28  
    buf.append("<br><br><b>" + "<a href=" + htmlQuote("http://tinybrain.de:8080/getraw.php?id=" + parseSnippetID(talkPageID) + "&contentType=text/html") + ">" + i + "/" + n + " bots ready to talk. TALK TO ELEUTHERIA HERE.</a></b>");
29  
30  
    L history = cast get(mainBot, "history");
31  
    if (!empty(history)) pcall {
32  
      buf.append("<br><br><br><b>Last dialogs:</b><br><br>");
33  
      int x = max(l(history)-5, 0);
34  
      for (i = x; i < l(history); i++) {
35  
        O dialog = history.get(i);
36  
        S q = shorten(getString(dialog, "question"), maxQuestionLength);
37  
        S a = shorten(getString(dialog, "answer"), maxAnswerLength);
38  
        buf.append("User: <b>" + htmlencode(q) + "</b><br>\n");
39  
        buf.append("Eleutheria: <b>" + htmlencode(a) + "</b><br>\n");
40  
      }
41  
    }
42  
    buf.append("<br><br>");
43  
    //buf.append("<a href=" + htmlQuote("https://www.reddit.com/r/learnprogramming/comments/3vnf1w/programmer_friends/") + ">Join our community!</a>");
44  
    buf.append([[<center><form action="http://bots.tinybrain.de/1002018/submit"><input type="text" name="email" value="my@email.com"> <input type="submit" value="Join our community!">
45  
</form></center>]]);
46  
47  
    buf.append("<br><br>");
48  
    buf.append("<a target=_blank href=" + htmlQuote("http://bots.tinybrain.de") + ">Bot list.</a>");
49  
  }
50  
  if (!empty(bottomLink))
51  
    buf.append("</td></tr> <tr height=1><td align=center>" + bottomLink);
52  
  buf.append("</td></tr></table>\n" +
53  
    "<body></body></html>");
54  
  ret str(buf);
55  
}

Author comment

Began life as a copy of #1002142

download  show line numbers  debug dex  old transpilations   

Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, jtubtzbbkimh, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1002150
Snippet name: Eleutheria Splash Page (with last interactions, OLD)
Eternal ID of this version: #1002150/1
Text MD5: 21ea8c6c5362e4873f0b14a10dcb764e
Transpilation MD5: 9be014ab0de7c6e6c42d9af14e1dfb1c
Author: stefan
Category: javax
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-12-29 21:01:38
Source code size: 2470 bytes / 55 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 643 / 1176
Referenced in: [show references]