Libraryless. Click here for Pure Java version (902L/6K/22K).
1 | !752 |
2 | |
3 | static int maxQuestionLength = 500; |
4 | static int maxAnswerLength = 200; |
5 | |
6 | static S html(S subUri, Map<S, S> params) { |
7 | L history = cast get(getMainBot(), "history"); |
8 | new StringBuffer buf; |
9 | |
10 | buf.append(pageNav(params, litstringlist(), l(history), "n")); |
11 | |
12 | pcall { |
13 | int x = 0; |
14 | print("l(history)=" + l(history) + ", x=" + x); |
15 | |
16 | int n; |
17 | if (!empty(params.get("n"))) |
18 | n = parseInt(params.get("n")); |
19 | else |
20 | n = max(0, l(history)-1)/100*100; |
21 | for (int i = min(n+100, l(history))-1; i >= n; i--) { |
22 | O dialog = history.get(i); |
23 | S q = shorten(getString(dialog, "question"), maxQuestionLength); |
24 | S a = shorten(getString(dialog, "answer"), maxAnswerLength); |
25 | S user = or(getString(dialog, "user"), "User"); |
26 | buf.append(htag("li", htmlencode(user) + ": <b>" + htmlencode(q) + "</b>", "class", "splash-li") + "\n"); |
27 | buf.append(htag("li", system() + ": <b>" + htmlencode(a) + "</b>", "class", "splash-li") + "\n"); |
28 | } |
29 | } |
30 | ret htag("p", "n=" + l(history)) + htag("ul", buf); |
31 | } |
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1002378 |
Snippet name: | Full History Bot (Web) |
Eternal ID of this version: | #1002378/1 |
Text MD5: | fc7045d8da8a084ddd5e46604aaaa96e |
Transpilation MD5: | 1bbfb48c30392d4a23e71195acab4a0f |
Author: | stefan |
Category: | nl bots |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-02-05 23:36:59 |
Source code size: | 1071 bytes / 31 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 774 / 51698 |
Referenced in: | [show references] |