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).

!752

static O mainBot;

static S talkPageID = "#1002123";

static int maxQuestionLength = 500;
static int maxAnswerLength = 200;

static S html(S subUri, Map<S, S> params) {
  S id = params.get("id");
  S slogan = params.get("slogan");
  S sloganStyle = params.get("sloganStyle");
  S bottomLink = params.get("bottomLink");
  S imgLink = "http://tinybrain.de/";
  if (id == null) ret "please specify id";
  S imgURL = snippetImageURL(id);
  new StringBuilder buf;
  buf.append("<html><head><title>" + slogan + "</title></head>\n" +
    "<table width='100%' height='100%' border=0><tr><td align=center>");
  buf.append("<a href=" + htmlQuote(imgLink) + "><img src=" + htmlQuote(imgURL) + " border=0></a>");
  if (!empty(slogan)) {
    buf.append("<br><br><br>");
    buf.append("<span style=" + htmlQuote(sloganStyle) + ">" + slogan + "</span>");
    
    int i = l((L) get(mainBot, "bots"));
    int n = l((L) get(mainBot, "botIDs"));
    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>");

    L history = cast get(mainBot, "history");
    if (!empty(history)) pcall {
      buf.append("<br><br><br><b>Last dialogs:</b><br><br>");
      int x = max(l(history)-5, 0);
      for (i = x; i < l(history); i++) {
        O dialog = history.get(i);
        S q = shorten(getString(dialog, "question"), maxQuestionLength);
        S a = shorten(getString(dialog, "answer"), maxAnswerLength);
        buf.append("User: <b>" + htmlencode(q) + "</b><br>\n");
        buf.append("Eleutheria: <b>" + htmlencode(a) + "</b><br>\n");
      }
    }
    buf.append("<br><br>");
    //buf.append("<a href=" + htmlQuote("https://www.reddit.com/r/learnprogramming/comments/3vnf1w/programmer_friends/") + ">Join our community!</a>");
    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!">
</form></center>]]);

    buf.append("<br><br>");
    buf.append("<a target=_blank href=" + htmlQuote("http://bots.tinybrain.de") + ">Bot list.</a>");
  }
  if (!empty(bottomLink))
    buf.append("</td></tr> <tr height=1><td align=center>" + bottomLink);
  buf.append("</td></tr></table>\n" +
    "<body></body></html>");
  ret str(buf);
}

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: 735 / 1310
Referenced in: [show references]