Libraryless. Click here for Pure Java version (4944L/33K).
1 | sS getSnippetTitle(S id) { |
2 | if (id == null) null; |
3 | if (!isSnippetID(id)) ret "?"; |
4 | |
5 | ifndef NoResourceLoader |
6 | IResourceLoader rl = vm_getResourceLoader(); |
7 | if (rl != null) |
8 | ret rl.getSnippetTitle(id); |
9 | endifndef |
10 | |
11 | ret getSnippetTitle_noResourceLoader(id); |
12 | } |
13 | |
14 | sS getSnippetTitle_noResourceLoader(S id) ctex { |
15 | if (isLocalSnippetID(id)) ret localSnippetTitle(id); |
16 | long parsedID = parseSnippetID(id); |
17 | S url; |
18 | if (isImageServerSnippet(parsedID)) |
19 | url = imageServerURL() + "title/" + parsedID + muricaCredentialsQuery(); |
20 | else if (isGeneralFileServerSnippet(parsedID)) |
21 | url = "http://butter.botcompany.de:8080/files/name/" + parsedID; |
22 | else |
23 | url = tb_mainServer() + "/tb-int/getfield.php?id=" + parsedID + "&field=title" + standardCredentials_noCookies(); |
24 | S title = trim(loadPageSilently(url)); |
25 | if (title != null) |
26 | pcall-short { saveTextFileIfChanged(snippetTitle_cacheFile(id), title); } |
27 | return or(title, "?"); |
28 | } |
29 | |
30 | static String getSnippetTitle(long id) { |
31 | ret getSnippetTitle(fsI(id)); |
32 | } |
download show line numbers debug dex old transpilations
Travelled to 25 computer(s): aoiabmzegqzx, ayivmpnvhhik, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ekrmjmnbrukm, elmgxqgtpvxh, gjtlkbvenryc, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, lqnftawlhpir, mowyntqkapby, mqqgnosmbjvj, onxytkatvevr, podlckwnjdmb, ppjhyzlbdabe, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, wnsclhtenguj, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1001012 |
Snippet name: | getSnippetTitle |
Eternal ID of this version: | #1001012/20 |
Text MD5: | 5c8e80a816deef8c3af6529d0aa08f14 |
Transpilation MD5: | d49974b2b6fdb3a9ad772569308bfba2 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-10-14 14:30:43 |
Source code size: | 1058 bytes / 32 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 855 / 5555 |
Version history: | 19 change(s) |
Referenced in: | [show references] |