create-heresay 0.2.26 → 0.2.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/release/VERSION +1 -1
- package/release/functions/lib/core/chat.js +17 -6
- package/release/functions/lib/core/handler.js +2 -1
- package/release/functions/lib/core/types.js +2 -0
- package/release/functions/lib/core/version.js +1 -1
- package/release/public/dashboard.css +20 -1
- package/release/public/dashboard.js +127 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-heresay",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.27",
|
|
4
4
|
"description": "Set up your own Heresay: in-app feedback that every report gets a hearing. Creates a Firebase project in your Google account and deploys the dashboard, API and SDK to it.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
package/release/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.2.
|
|
1
|
+
0.2.27
|
|
@@ -29,7 +29,8 @@ const INSTRUCTIONS = [
|
|
|
29
29
|
'Sending takes two steps. draft_request prepares one and returns a preview (the app, the type, the text, and the other',
|
|
30
30
|
'apps); nothing is sent. send_draft sends a draft, to the app in the preview or to another one. `text` is the request as',
|
|
31
31
|
'a teammate would read it; `details` is what the conversation worked out (why it matters, what was considered or ruled',
|
|
32
|
-
'out, examples, constraints, open questions)
|
|
32
|
+
'out, examples, constraints, open questions); both may be Markdown. `document` attaches a longer Markdown write-up (a spec,',
|
|
33
|
+
'a summary of the whole conversation), up to 100,000 characters. A sent request stays open until someone on the team accepts it; sending',
|
|
33
34
|
'does not start any work. my_requests says what happened to the ones this member sent.',
|
|
34
35
|
].join(' ');
|
|
35
36
|
/** How long a draft waits to be sent. */
|
|
@@ -53,7 +54,9 @@ const TOOLS = [
|
|
|
53
54
|
app: { type: 'string', description: 'The app\'s id or name, from list_apps, when the conversation names it' },
|
|
54
55
|
type: { type: 'string', enum: [...REPORT_TYPES], description: 'broken: doesn\'t work. confusing: works, but people can\'t tell how. improvement: works, could be better. idea: doesn\'t exist yet.' },
|
|
55
56
|
text: { type: 'string', maxLength: LIMITS.textMax, description: 'The request in a few plain sentences, as a teammate would read it.' },
|
|
56
|
-
details: { type: 'string', maxLength: LIMITS.detailsMax, description: 'Context from the conversation: why, what was considered or ruled out, examples, constraints, open questions.' },
|
|
57
|
+
details: { type: 'string', maxLength: LIMITS.detailsMax, description: 'Context from the conversation: why, what was considered or ruled out, examples, constraints, open questions. Markdown.' },
|
|
58
|
+
document: { type: 'string', maxLength: LIMITS.documentMax, description: 'A longer Markdown document attached to the request: a spec, a write-up of the conversation, notes. Optional.' },
|
|
59
|
+
document_title: { type: 'string', maxLength: LIMITS.documentTitleMax, description: 'The attached document\'s title.' },
|
|
57
60
|
},
|
|
58
61
|
required: ['type', 'text'],
|
|
59
62
|
additionalProperties: false,
|
|
@@ -198,6 +201,12 @@ async function draftRequest(a, member, via, deps) {
|
|
|
198
201
|
if (!text)
|
|
199
202
|
throw new ToolError('Say what the request is, in text.');
|
|
200
203
|
const details = str(a.details, LIMITS.detailsMax);
|
|
204
|
+
// Refused rather than cut, so a long write-up isn't silently missing its end.
|
|
205
|
+
if (typeof a.document === 'string' && a.document.length > LIMITS.documentMax) {
|
|
206
|
+
throw new ToolError(`The document is ${a.document.length} characters; the limit is ${LIMITS.documentMax}. Shorten it or split it across requests.`);
|
|
207
|
+
}
|
|
208
|
+
const markdown = typeof a.document === 'string' && a.document.trim() ? a.document.replace(/\r\n/g, '\n').trim() : null;
|
|
209
|
+
const document = markdown ? { title: str(a.document_title, LIMITS.documentTitleMax), markdown } : null;
|
|
201
210
|
const all = (await deps.store.listProjects()).sort((x, y) => x.created_at.localeCompare(y.created_at));
|
|
202
211
|
if (!str(a.app, 100)) {
|
|
203
212
|
return result(`No app named, so no draft yet. The apps on this Heresay: ${appNames(all) || 'none yet'}. Which one is it for?`, { draft: null, apps: all.map((p) => ({ id: p.id, name: p.name, platform: p.platform })) });
|
|
@@ -206,17 +215,19 @@ async function draftRequest(a, member, via, deps) {
|
|
|
206
215
|
const id = createHash('sha256').update(`${member.email}${deps.now()}${Math.random()}`).digest('hex').slice(0, 24);
|
|
207
216
|
await deps.store.putAuth({
|
|
208
217
|
kind: 'draft', id, expires_at: new Date(deps.now() + DRAFT_TTL_MS).toISOString(),
|
|
209
|
-
data: { email: member.email, project_id: project.id, type: a.type, text, details, via },
|
|
218
|
+
data: { email: member.email, project_id: project.id, type: a.type, text, details, document, via },
|
|
210
219
|
});
|
|
211
220
|
const others = all.filter((p) => p.id !== project.id);
|
|
212
221
|
return result([
|
|
213
222
|
`Draft, not sent yet. App: ${project.name} (${project.platform}). Type: ${a.type}.`,
|
|
214
223
|
`Text: ${text}`,
|
|
215
224
|
details ? `Details: ${details}` : null,
|
|
225
|
+
document ? `Attached document: ${document.title ? `"${document.title}", ` : ''}${document.markdown.length} characters of Markdown.` : null,
|
|
216
226
|
others.length ? `Other apps it could go to instead: ${appNames(others)}.` : null,
|
|
217
227
|
`send_draft with draft_id ${id} sends it${others.length ? ' (with app set to send it elsewhere)' : ''}. Drafts last two hours.`,
|
|
218
228
|
].filter(Boolean).join('\n'), {
|
|
219
229
|
draft_id: id, sent: false, app: project.name, type: a.type, text, details,
|
|
230
|
+
document: document ? { title: document.title, characters: document.markdown.length } : null,
|
|
220
231
|
other_apps: others.map((p) => ({ id: p.id, name: p.name, platform: p.platform })),
|
|
221
232
|
});
|
|
222
233
|
}
|
|
@@ -232,9 +243,9 @@ async function sendDraft(a, member, req, deps) {
|
|
|
232
243
|
// Once only, however many times it's called.
|
|
233
244
|
if (!(await deps.store.takeAuth('draft', id)))
|
|
234
245
|
throw new ToolError('That draft was already sent.');
|
|
235
|
-
return createChatReport(project, d.data.type, String(d.data.text), d.data.details ?? null, member, String(d.data.via ?? 'a chat app'), req, deps);
|
|
246
|
+
return createChatReport(project, d.data.type, String(d.data.text), d.data.details ?? null, d.data.document ?? null, member, String(d.data.via ?? 'a chat app'), req, deps);
|
|
236
247
|
}
|
|
237
|
-
async function createChatReport(project, type, text, details, member, via, req, deps) {
|
|
248
|
+
async function createChatReport(project, type, text, details, document, member, via, req, deps) {
|
|
238
249
|
const now = deps.now();
|
|
239
250
|
for (const l of CHAT_LIMITS) {
|
|
240
251
|
const start = Math.floor(now / l.windowMs) * l.windowMs;
|
|
@@ -246,7 +257,7 @@ async function createChatReport(project, type, text, details, member, via, req,
|
|
|
246
257
|
const report = {
|
|
247
258
|
id: `r_${createHash('sha256').update(`${member.email}${now}${Math.random()}`).digest('base64url').slice(0, 16)}`,
|
|
248
259
|
project_id: project.id, device_id: chatDevice(member.email), type, text,
|
|
249
|
-
source: 'chat', from_member: member.email, via: str(via, 80), details,
|
|
260
|
+
source: 'chat', from_member: member.email, via: str(via, 80), details, document,
|
|
250
261
|
context: {
|
|
251
262
|
route: null, app_version: null, platform: 'chat', os: null, browser: null,
|
|
252
263
|
user_id: null, user_label: null, user_email: null, framework: null,
|
|
@@ -129,6 +129,7 @@ export function agentPrompt(project, t) {
|
|
|
129
129
|
fence,
|
|
130
130
|
t.text.replaceAll(fence, "''"),
|
|
131
131
|
...(t.details ? ['', 'Context from the conversation:', t.details.replaceAll(fence, "''")] : []),
|
|
132
|
+
...(t.document ? ['', `Attached document${t.document.title ? ` "${t.document.title.replaceAll(fence, "''")}"` : ''} (Markdown):`, t.document.markdown.replaceAll(fence, "''")] : []),
|
|
132
133
|
...(t.reporter_note ? ['', `About their setup: ${t.reporter_note.replaceAll(fence, "''")}`] : []),
|
|
133
134
|
...(worst ? ['', `Last thing that went wrong, ${duration(worst.ago)} before ${worst.run === 'last' ? 'the previous run ended' : 'they sent it'}: ${worst.text.replaceAll(fence, "''")}`] : []),
|
|
134
135
|
...(t.trail?.length ? ['', 'What happened in the app before they sent it, recorded by the SDK on their device (oldest first):',
|
|
@@ -585,7 +586,7 @@ async function triage(project, report_id, action, uid, req, deps) {
|
|
|
585
586
|
id: report.id, project_id: project.id, report_id: report.id, type: report.type,
|
|
586
587
|
text: report.text, context: report.context, reporter_note: report.reporter?.note ?? null,
|
|
587
588
|
trail: report.trail ?? null,
|
|
588
|
-
...(report.source === 'chat' ? { source: 'chat', from_member: report.from_member ?? null, via: report.via ?? null, details: report.details ?? null } : {}),
|
|
589
|
+
...(report.source === 'chat' ? { source: 'chat', from_member: report.from_member ?? null, via: report.via ?? null, details: report.details ?? null, document: report.document ?? null } : {}),
|
|
589
590
|
note: str(body.note, LIMITS.reasonMax),
|
|
590
591
|
accepted_by: uid, accepted_at: at, repo: asked ?? repos[0] ?? null, claim: null, notes: [],
|
|
591
592
|
};
|
|
@@ -440,7 +440,26 @@ a.platform:hover { border-color:var(--acc); box-shadow:0 0 0 3px var(--mist); }
|
|
|
440
440
|
.pill.chat-pill { background:#eef2ff; color:#3730a3; }
|
|
441
441
|
.chat-details { margin-top:8px; font-size:14px; }
|
|
442
442
|
.chat-details summary { cursor:pointer; color:var(--mute); font-size:13px; }
|
|
443
|
-
.chat-details
|
|
443
|
+
.chat-details > .md { margin:6px 0 0; padding:10px 14px; border-radius:10px; background:var(--soft, #f5f6f7); }
|
|
444
|
+
.chat-doc > .md { max-height:520px; overflow:auto; }
|
|
445
|
+
/* Markdown from chat apps */
|
|
446
|
+
.md { font-size:14px; line-height:1.55; word-break:break-word; }
|
|
447
|
+
.md > :first-child { margin-top:0; } .md > :last-child { margin-bottom:0; }
|
|
448
|
+
.md p { margin:0 0 8px; }
|
|
449
|
+
.md h3, .md h4, .md h5, .md h6 { margin:14px 0 6px; line-height:1.3; }
|
|
450
|
+
.md h3 { font-size:17px; } .md h4 { font-size:15px; } .md h5, .md h6 { font-size:14px; }
|
|
451
|
+
.md ul, .md ol { margin:0 0 8px; padding-left:22px; }
|
|
452
|
+
.md li { margin:2px 0; } .md li.task { list-style:none; margin-left:-20px; } .md li.task .check { margin-right:6px; }
|
|
453
|
+
.md code { font:12.5px var(--mono, ui-monospace, monospace); padding:1px 5px; border-radius:5px; background:rgba(127,127,127,.14); }
|
|
454
|
+
.md pre.md-code { margin:0 0 8px; padding:10px 12px; border-radius:8px; background:rgba(127,127,127,.12); overflow:auto; }
|
|
455
|
+
.md pre.md-code code { padding:0; background:none; white-space:pre; }
|
|
456
|
+
.md blockquote { margin:0 0 8px; padding:2px 0 2px 12px; border-left:3px solid var(--line); color:var(--mute); }
|
|
457
|
+
.md hr { border:0; border-top:1px solid var(--line); margin:12px 0; }
|
|
458
|
+
.md a { color:var(--deep, #0b5e57); }
|
|
459
|
+
.md-table { overflow:auto; margin:0 0 8px; }
|
|
460
|
+
.md table { border-collapse:collapse; font-size:13px; }
|
|
461
|
+
.md th, .md td { border:1px solid var(--line); padding:4px 8px; text-align:left; vertical-align:top; }
|
|
462
|
+
.report > .md { margin:6px 0 4px; font-size:15px; }
|
|
444
463
|
.howto { margin:0; padding-left:20px; line-height:1.7; }
|
|
445
464
|
.howto li + li { margin-top:4px; }
|
|
446
465
|
.howto .copy-prompt { flex-direction:row; align-items:center; flex-wrap:wrap; }
|
|
@@ -1572,9 +1572,13 @@
|
|
|
1572
1572
|
el('time', { datetime: r.created_at, text: new Date(r.created_at).toLocaleString() }),
|
|
1573
1573
|
status,
|
|
1574
1574
|
]),
|
|
1575
|
-
el('p', { class: 'text', text: r.text }),
|
|
1575
|
+
r.source === 'chat' ? markdown(r.text) : el('p', { class: 'text', text: r.text }),
|
|
1576
1576
|
r.source === 'chat' ? el('div', { class: 'ctx', text: 'From the team: ' + (r.from_member || 'a team member') + ', in a conversation in ' + (r.via || 'a chat app') }) : null,
|
|
1577
|
-
r.details ? el('details', { class: 'chat-details', open: true }, [el('summary', { text: 'From the conversation' }),
|
|
1577
|
+
r.details ? el('details', { class: 'chat-details', open: true }, [el('summary', { text: 'From the conversation' }), markdown(r.details)]) : null,
|
|
1578
|
+
r.document ? el('details', { class: 'chat-details chat-doc' }, [
|
|
1579
|
+
el('summary', { text: 'Attached document' + (r.document.title ? ': ' + r.document.title : '') + ' · ' + (r.document.markdown.length < 1000 ? r.document.markdown.length + ' characters' : Math.round(r.document.markdown.length / 1000) + 'k characters') }),
|
|
1580
|
+
markdown(r.document.markdown),
|
|
1581
|
+
]) : null,
|
|
1578
1582
|
r.source === 'chat' ? null : el('div', { class: 'ctx', text: ctxLine(r.context) }),
|
|
1579
1583
|
r.source !== 'chat' && deviceLine(r.context) ? el('div', { class: 'ctx', text: deviceLine(r.context) }) : null,
|
|
1580
1584
|
r.context.page_url ? el('div', { class: 'ctx' }, [el('a', { href: r.context.page_url, target: '_blank', rel: 'noopener noreferrer', text: r.context.page_url })]) : null,
|
|
@@ -1985,6 +1989,127 @@
|
|
|
1985
1989
|
]);
|
|
1986
1990
|
}
|
|
1987
1991
|
|
|
1992
|
+
// ---- Markdown, for what team members send from chat apps -------------------------------
|
|
1993
|
+
|
|
1994
|
+
/**
|
|
1995
|
+
* A small Markdown renderer: headings, paragraphs, lists (nested by indent), quotes, code
|
|
1996
|
+
* blocks, tables, rules, and inline code, bold, italic, strikethrough and links. It builds
|
|
1997
|
+
* DOM nodes and sets only text, never HTML, so nothing in a request can run or restyle the
|
|
1998
|
+
* page. Links are http(s) or mailto only, and open in a new tab. Used for chat requests from
|
|
1999
|
+
* the team; reports from the public stay plain text.
|
|
2000
|
+
*/
|
|
2001
|
+
function markdown(src) {
|
|
2002
|
+
var root = el('div', { class: 'md' });
|
|
2003
|
+
var lines = String(src || '').replace(/\r\n?/g, '\n').split('\n');
|
|
2004
|
+
var i = 0;
|
|
2005
|
+
var isBlank = function (l) { return !l.trim(); };
|
|
2006
|
+
var startsBlock = function (l) {
|
|
2007
|
+
return /^\s{0,3}(#{1,6}\s|```|~~~|>|[-*+]\s|\d+[.)]\s|(-{3,}|\*{3,}|_{3,})\s*$|\|)/.test(l);
|
|
2008
|
+
};
|
|
2009
|
+
while (i < lines.length) {
|
|
2010
|
+
var line = lines[i];
|
|
2011
|
+
if (isBlank(line)) { i++; continue; }
|
|
2012
|
+
var m;
|
|
2013
|
+
if ((m = /^\s{0,3}(```|~~~)\s*([\w+-]*)\s*$/.exec(line))) {
|
|
2014
|
+
var fence = m[1], code = [];
|
|
2015
|
+
i++;
|
|
2016
|
+
while (i < lines.length && !new RegExp('^\\s{0,3}' + fence + '\\s*$').test(lines[i])) code.push(lines[i++]);
|
|
2017
|
+
i++;
|
|
2018
|
+
root.appendChild(el('pre', { class: 'md-code' }, [el('code', { text: code.join('\n'), 'data-lang': m[2] || null })]));
|
|
2019
|
+
continue;
|
|
2020
|
+
}
|
|
2021
|
+
if ((m = /^\s{0,3}(#{1,6})\s+(.*?)\s*#*\s*$/.exec(line))) {
|
|
2022
|
+
// Shifted down two levels, so a request's "#" never outranks the dashboard's own headings.
|
|
2023
|
+
root.appendChild(inline(el('h' + Math.min(6, m[1].length + 2), {}), m[2]));
|
|
2024
|
+
i++;
|
|
2025
|
+
continue;
|
|
2026
|
+
}
|
|
2027
|
+
if (/^\s{0,3}(-{3,}|\*{3,}|_{3,})\s*$/.test(line)) { root.appendChild(el('hr')); i++; continue; }
|
|
2028
|
+
if (/^\s{0,3}>/.test(line)) {
|
|
2029
|
+
var quote = [];
|
|
2030
|
+
while (i < lines.length && /^\s{0,3}>/.test(lines[i])) quote.push(lines[i++].replace(/^\s{0,3}>\s?/, ''));
|
|
2031
|
+
root.appendChild(el('blockquote', {}, [markdown(quote.join('\n'))]));
|
|
2032
|
+
continue;
|
|
2033
|
+
}
|
|
2034
|
+
if (/^\s*\|.*\|\s*$/.test(line) && i + 1 < lines.length && /^\s*\|?\s*:?-{2,}/.test(lines[i + 1])) {
|
|
2035
|
+
var cells = function (l) { return l.trim().replace(/^\||\|$/g, '').split('|').map(function (c) { return c.trim(); }); };
|
|
2036
|
+
var head = cells(line), body = [];
|
|
2037
|
+
i += 2;
|
|
2038
|
+
while (i < lines.length && /^\s*\|.*\|\s*$/.test(lines[i])) body.push(cells(lines[i++]));
|
|
2039
|
+
root.appendChild(el('div', { class: 'md-table' }, [el('table', {}, [
|
|
2040
|
+
el('thead', {}, [el('tr', {}, head.map(function (c) { return inline(el('th'), c); }))]),
|
|
2041
|
+
el('tbody', {}, body.map(function (r) { return el('tr', {}, r.map(function (c) { return inline(el('td'), c); })); })),
|
|
2042
|
+
])]));
|
|
2043
|
+
continue;
|
|
2044
|
+
}
|
|
2045
|
+
if (/^\s*([-*+]|\d+[.)])\s+/.test(line)) {
|
|
2046
|
+
var block = [];
|
|
2047
|
+
while (i < lines.length && (/^\s*([-*+]|\d+[.)])\s+/.test(lines[i]) || (/^\s{2,}\S/.test(lines[i]) && block.length))) block.push(lines[i++]);
|
|
2048
|
+
root.appendChild(list(block));
|
|
2049
|
+
continue;
|
|
2050
|
+
}
|
|
2051
|
+
var para = [line];
|
|
2052
|
+
i++;
|
|
2053
|
+
while (i < lines.length && !isBlank(lines[i]) && !startsBlock(lines[i])) para.push(lines[i++]);
|
|
2054
|
+
var p = el('p');
|
|
2055
|
+
para.forEach(function (l, k) {
|
|
2056
|
+
if (k) p.appendChild(el('br'));
|
|
2057
|
+
inline(p, l.trim());
|
|
2058
|
+
});
|
|
2059
|
+
root.appendChild(p);
|
|
2060
|
+
}
|
|
2061
|
+
return root;
|
|
2062
|
+
}
|
|
2063
|
+
|
|
2064
|
+
/** List lines into nested <ul>/<ol>, by indent. Task items ("- [x]") get a checkbox mark. */
|
|
2065
|
+
function list(block) {
|
|
2066
|
+
var indent = function (l) { return /^\s*/.exec(l)[0].replace(/\t/g, ' ').length; };
|
|
2067
|
+
var base = indent(block[0]);
|
|
2068
|
+
var ordered = /^\s*\d+[.)]\s/.test(block[0]);
|
|
2069
|
+
var out = el(ordered ? 'ol' : 'ul');
|
|
2070
|
+
var j = 0;
|
|
2071
|
+
while (j < block.length) {
|
|
2072
|
+
var item = block[j].replace(/^\s*([-*+]|\d+[.)])\s+/, '');
|
|
2073
|
+
var li = el('li');
|
|
2074
|
+
var task = /^\[([ xX])\]\s+/.exec(item);
|
|
2075
|
+
if (task) { li.className = 'task'; li.appendChild(el('span', { class: 'check', text: task[1] === ' ' ? '☐' : '☑', 'aria-hidden': 'true' })); item = item.slice(task[0].length); }
|
|
2076
|
+
inline(li, item);
|
|
2077
|
+
j++;
|
|
2078
|
+
var sub = [];
|
|
2079
|
+
while (j < block.length && indent(block[j]) > base) sub.push(block[j++]);
|
|
2080
|
+
if (sub.length) li.appendChild(/^\s*([-*+]|\d+[.)])\s/.test(sub[0]) ? list(sub) : inline(el('div'), sub.join(' ').trim()));
|
|
2081
|
+
out.appendChild(li);
|
|
2082
|
+
}
|
|
2083
|
+
return out;
|
|
2084
|
+
}
|
|
2085
|
+
|
|
2086
|
+
/** Inline Markdown into `node`, as text nodes and elements. Returns `node`. */
|
|
2087
|
+
function inline(node, s) {
|
|
2088
|
+
var re = /(`+)([\s\S]*?)\1|\*\*([^*]+?)\*\*|__([^_]+?)__|~~([^~]+?)~~|\*([^*\s][^*]*?)\*|(^|[^\w])_([^_\s][^_]*?)_(?=[^\w]|$)|\[([^\]]+)\]\(([^)\s]+)\)|(https?:\/\/[^\s<>()]+[^\s<>().,;:!?'"])/g;
|
|
2089
|
+
var at = 0, m;
|
|
2090
|
+
while ((m = re.exec(s))) {
|
|
2091
|
+
var start = m.index + (m[7] !== undefined ? m[7].length : 0);
|
|
2092
|
+
if (start > at) node.appendChild(document.createTextNode(s.slice(at, start)));
|
|
2093
|
+
if (m[1]) node.appendChild(el('code', { text: m[2] }));
|
|
2094
|
+
else if (m[3] || m[4]) node.appendChild(inline(el('strong'), m[3] || m[4]));
|
|
2095
|
+
else if (m[5]) node.appendChild(inline(el('del'), m[5]));
|
|
2096
|
+
else if (m[6]) node.appendChild(inline(el('em'), m[6]));
|
|
2097
|
+
else if (m[8]) node.appendChild(inline(el('em'), m[8]));
|
|
2098
|
+
else if (m[9]) node.appendChild(link(m[10], m[9]));
|
|
2099
|
+
else if (m[11]) node.appendChild(link(m[11], m[11]));
|
|
2100
|
+
at = re.lastIndex;
|
|
2101
|
+
}
|
|
2102
|
+
if (at < s.length) node.appendChild(document.createTextNode(s.slice(at)));
|
|
2103
|
+
return node;
|
|
2104
|
+
}
|
|
2105
|
+
|
|
2106
|
+
/** A link only to the web or an email address; anything else (javascript:, data:) stays text. */
|
|
2107
|
+
function link(href, label) {
|
|
2108
|
+
var ok = /^(https?:\/\/|mailto:)/i.test(href);
|
|
2109
|
+
if (!ok) return document.createTextNode(label === href ? href : label + ' (' + href + ')');
|
|
2110
|
+
return inline(el('a', { href: href, target: '_blank', rel: 'noopener noreferrer nofollow' }), label);
|
|
2111
|
+
}
|
|
2112
|
+
|
|
1988
2113
|
// ---- chat apps -------------------------------------------------------------------------
|
|
1989
2114
|
|
|
1990
2115
|
/**
|