wiki-plugin-rcntimeline 0.3.4 → 0.3.6
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/README.md +2 -1
- package/client/rcntimeline.js +178 -20
- package/package.json +19 -4
package/README.md
CHANGED
|
@@ -30,6 +30,7 @@ and restart the wiki. The Factory then offers **RCN Timeline**.
|
|
|
30
30
|
|
|
31
31
|
- `timeline` is the RCN Timeline's own export format, so a timeline saved from the tool drops straight in. Fields the plugin does not use (`coops`, say) are left alone.
|
|
32
32
|
- `page` names the wiki page a bar opens. A bar without one is not a link.
|
|
33
|
+
- `bands`, `band` and `sort` (optional): a timeline that names its story bands gets a **Rows: By band · By time** switch under the drawing. By band, each band's bars sit under its name; by time, one bar per row, earliest at the top. The file's `sort` is the default; the reader's choice is not saved.
|
|
33
34
|
- `rel` may be one relation (`meets`) or a list (`["before", "meets"]`, "one of"), drawn dashed. Lists are not built in the tool yet; the plugin accepts them so it will not break when they are.
|
|
34
35
|
- `text`: the first line is the caption; the rest lists the intervals and links in words, for search and for a wiki without this plugin.
|
|
35
36
|
- An item with no `timeline` — a fresh one from the Factory — is drawn from its text in the tool's own sentence form: `Label = Jan 2020 .. Jun 2021`, or `Label = 1970 .. 2026`.
|
|
@@ -48,6 +49,6 @@ Part of the [RCN toolset](https://github.com/marpie1/rcn), MIT.
|
|
|
48
49
|
|
|
49
50
|
Marc Pierson and Claude Opus 5.5 · September 2026
|
|
50
51
|
|
|
51
|
-
**Walks** (0.3.0). A timeline made in the full tool can carry `walks`: readings that play one step at a time. **▶ Walk** under the timeline redraws each step's years, fades the other bars,
|
|
52
|
+
**Walks** (0.3.0). A timeline made in the full tool can carry `walks`: readings that play one step at a time. **▶ Walk** under the timeline redraws each step's years, fades the other bars, rings the step's bars, and moves one pointer from bar to bar as the words reach each one: a ▼ over the bar, a line up to the axis and the bar's dates there (0.3.5; the pointer glides and the ring pulses, unless the reader has asked for reduced motion), and reads the words aloud with a caption; Space, ← →, Esc. Open in RCN Timeline and Save to wiki carry the walks both ways.
|
|
52
53
|
|
|
53
54
|
**Recorded voices** (0.3.1). A step may carry `voices`, people's own recordings of its words, made with ● Record in the timeline's walk editor: `{"<name>": {audio, say}}`. The walk plays a step's recording when it has one and the computer voice otherwise; a chooser in the walk bar picks whose, or the computer voice only (kept in `rcnWalkPrefs.speaker`). On Save to wiki the plugin moves each recording into the site's assets, `assets/voice-files/<content hash>.webm`, uploaded once however often the page is saved, and the step keeps only the file's full address, so pages and their history never hold audio and a forked page still plays from the original site. If the upload fails (not signed in), the recording stays inside the walk until the next save that can upload it.
|
package/client/rcntimeline.js
CHANGED
|
@@ -77,7 +77,9 @@
|
|
|
77
77
|
// The item's own intervals and links, as stored (or read from its text).
|
|
78
78
|
function rawOf (item) {
|
|
79
79
|
if (item.timeline && Array.isArray(item.timeline.intervals)) {
|
|
80
|
-
|
|
80
|
+
const t = item.timeline
|
|
81
|
+
return Object.assign({ intervals: t.intervals, links: t.links || [] },
|
|
82
|
+
Array.isArray(t.bands) && t.bands.length ? { bands: t.bands } : {}, t.sort ? { sort: t.sort } : {})
|
|
81
83
|
}
|
|
82
84
|
const ivs = []
|
|
83
85
|
String(item.text || '').split('\n').forEach((line, i) => {
|
|
@@ -134,10 +136,23 @@
|
|
|
134
136
|
return out
|
|
135
137
|
}
|
|
136
138
|
|
|
137
|
-
function model (item, $item) { return normalize(effective($item, item)) }
|
|
139
|
+
function model (item, $item) { return normalize(effective($item, item), rowsHow($item, item)) }
|
|
140
|
+
|
|
141
|
+
// How the rows are arranged: 'band' (story bands, each under its name — only
|
|
142
|
+
// when the timeline names bands), 'time' (one row per bar, earliest first), or
|
|
143
|
+
// null (the rows as the file has them). The reader's choice is kept on the
|
|
144
|
+
// item's element for this visit; the file's own "sort" is the default.
|
|
145
|
+
function rowsHow ($item, item) {
|
|
146
|
+
const t = item.timeline || {}, el = $item && $item.get(0)
|
|
147
|
+
const how = (el && el.rcntRows) || t.sort || null
|
|
148
|
+
return how === 'band' && !(Array.isArray(t.bands) && t.bands.length) ? null : how
|
|
149
|
+
}
|
|
138
150
|
|
|
139
151
|
// Dates as fractional years, lanes packed top to bottom.
|
|
140
|
-
|
|
152
|
+
// how 'time': one lane per bar in date order. how 'band': each band (in the
|
|
153
|
+
// file's order, then "Other") gets a heading lane with its name, then the rows
|
|
154
|
+
// its bars use, in their order. heads: [{lane, label}].
|
|
155
|
+
function normalize (raw, how) {
|
|
141
156
|
const ivs = raw.intervals, links = raw.links
|
|
142
157
|
const out = []
|
|
143
158
|
ivs.forEach((v, i) => {
|
|
@@ -150,10 +165,30 @@
|
|
|
150
165
|
color: v.color || PALETTE[i % PALETTE.length], row: v.row == null ? i : v.row
|
|
151
166
|
}))
|
|
152
167
|
})
|
|
168
|
+
if (how === 'time') {
|
|
169
|
+
out.slice().sort((a, b) => a.s - b.s || a.e - b.e).forEach((v, k) => { v.lane = k })
|
|
170
|
+
return { intervals: out, links, lanes: out.length, heads: [] }
|
|
171
|
+
}
|
|
172
|
+
if (how === 'band' && raw.bands && raw.bands.length) {
|
|
173
|
+
const ids = raw.bands.map(b => b.id), groups = raw.bands.map(b => ({ label: b.label || b.id, ivs: [] }))
|
|
174
|
+
const other = { label: 'Other', ivs: [] }
|
|
175
|
+
out.forEach(v => { const k = ids.indexOf(v.band); (k < 0 ? other : groups[k]).ivs.push(v) })
|
|
176
|
+
if (other.ivs.length) groups.push(other)
|
|
177
|
+
const heads = []
|
|
178
|
+
let lane = 0
|
|
179
|
+
groups.forEach(g => {
|
|
180
|
+
if (!g.ivs.length) return
|
|
181
|
+
heads.push({ lane: lane++, label: g.label })
|
|
182
|
+
const rows = Array.from(new Set(g.ivs.map(v => v.row))).sort((a, b) => a - b)
|
|
183
|
+
g.ivs.forEach(v => { v.lane = lane + rows.indexOf(v.row) })
|
|
184
|
+
lane += rows.length
|
|
185
|
+
})
|
|
186
|
+
return { intervals: out, links, lanes: lane, heads }
|
|
187
|
+
}
|
|
153
188
|
// Lanes in use, packed top to bottom in their original order.
|
|
154
189
|
const lanes = Array.from(new Set(out.map(v => v.row))).sort((a, b) => a - b)
|
|
155
190
|
out.forEach(v => { v.lane = lanes.indexOf(v.row) })
|
|
156
|
-
return { intervals: out, links, lanes: lanes.length }
|
|
191
|
+
return { intervals: out, links, lanes: lanes.length, heads: [] }
|
|
157
192
|
}
|
|
158
193
|
|
|
159
194
|
// A tick step that gives four to seven labels across the span.
|
|
@@ -213,6 +248,11 @@
|
|
|
213
248
|
parts.push(`<text x="${x(k.t) + 3}" y="${AXIS_H - 8}" font-size="10" fill="#94a3b8">${esc(k.label)}</text>`)
|
|
214
249
|
})
|
|
215
250
|
parts.push(`<line x1="0" y1="${AXIS_H - 4}" x2="${W}" y2="${AXIS_H - 4}" stroke="#e2e8f0"/>`)
|
|
251
|
+
// band names, on their own lane at the left edge
|
|
252
|
+
;(m.heads || []).forEach(h => {
|
|
253
|
+
parts.push(`<line x1="0" y1="${yMid(h.lane) + 7}" x2="${W}" y2="${yMid(h.lane) + 7}" stroke="#cbd5e1"/>`)
|
|
254
|
+
parts.push(`<text x="${PAD}" y="${yMid(h.lane) + 3}" font-size="10" font-weight="700" letter-spacing=".06em" fill="#475569">${esc(h.label.toUpperCase())}</text>`)
|
|
255
|
+
})
|
|
216
256
|
|
|
217
257
|
// bars: the fuzz shoulders fade in and out, the core is solid
|
|
218
258
|
m.intervals.forEach((v, i) => {
|
|
@@ -311,25 +351,123 @@
|
|
|
311
351
|
walkMark($item, lit)
|
|
312
352
|
}
|
|
313
353
|
|
|
314
|
-
//
|
|
315
|
-
//
|
|
316
|
-
//
|
|
354
|
+
// Each bar the step is about gets a pale ring. One pointer then moves to the bar the
|
|
355
|
+
// words have reached: a ▼ over it, a line up to the date axis and its dates on the
|
|
356
|
+
// axis, so it shows the thing and the time together; that bar's ring turns strong and
|
|
357
|
+
// pulses as the pointer arrives. Indigo, like the caption box. Same as the tool.
|
|
358
|
+
const PTR = '#4f46e5', PALE = '#c7d2fe'
|
|
359
|
+
const still = () => { try { return matchMedia('(prefers-reduced-motion: reduce)').matches } catch (e) { return false } }
|
|
360
|
+
const svgEl = (tag, a) => { const n = document.createElementNS(NS, tag); for (const k in a) n.setAttribute(k, a[k]); return n }
|
|
317
361
|
function walkMark ($item, lit) {
|
|
318
362
|
const svg = $item.find('.rcnt-canvas svg')[0]
|
|
319
363
|
if (!svg) return
|
|
320
|
-
const W = +svg.getAttribute('width')
|
|
321
|
-
const mk = (tag, a) => { const n = document.createElementNS(NS, tag); for (const k in a) n.setAttribute(k, a[k]); return n }
|
|
364
|
+
const W = +svg.getAttribute('width')
|
|
322
365
|
$item.find('.rcnt-canvas g.rcnt-bar').each(function () {
|
|
323
|
-
|
|
366
|
+
const id = this.getAttribute('data-iv')
|
|
367
|
+
if (!lit.has(id)) return
|
|
324
368
|
const b = this.getBBox()
|
|
325
369
|
if (b.x + b.width < 0 || b.x > W) return
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
370
|
+
svg.appendChild(svgEl('rect', { 'data-wkring': id, x: b.x - 3, y: b.y - 3, width: Math.max(8, b.width + 6), height: b.height + 6, rx: 5, fill: 'none', stroke: PALE, 'stroke-width': 1.5, 'pointer-events': 'none' }))
|
|
371
|
+
})
|
|
372
|
+
const wk = $item.get(0).rcntWalk
|
|
373
|
+
if (wk && wk.ptr) ptrDraw($item, wk.ptr, false)
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
// Where the words reach each bar: the first place they use a clue only that bar's label
|
|
377
|
+
// has. Clues, strongest first: acronyms (BHP), words (first five letters, so "reopens"
|
|
378
|
+
// finds "reopened"), then the start year. A bar never named takes its turn in list order.
|
|
379
|
+
const PTR_STOP = new Set(['with', 'from', 'that', 'this', 'into', 'over', 'again', 'first', 'begins', 'their', 'after', 'still', 'about'])
|
|
380
|
+
function ptrClues (v) {
|
|
381
|
+
const caps = (String(v.label).match(/\b[A-Z]{2,5}\b/g) || []).map(x => x.toLowerCase())
|
|
382
|
+
const words = (String(v.label).toLowerCase().match(/[a-z\u00c0-\u024f]{4,}/g) || []).filter(x => !PTR_STOP.has(x)).map(x => x.slice(0, 5))
|
|
383
|
+
return [caps, words, [fmt(v.s).split(' ').pop()]]
|
|
384
|
+
}
|
|
385
|
+
function ptrCues (m, st) {
|
|
386
|
+
const byId = {}; m.intervals.forEach(v => { byId[String(v.id)] = v })
|
|
387
|
+
const ids = (st.intervals || []).map(String).filter(id => byId[id]), text = String(st.say || '').toLowerCase(), n = ids.length
|
|
388
|
+
const C = {}; ids.forEach(id => { C[id] = ptrClues(byId[id]) })
|
|
389
|
+
const cues = ids.map((id, k) => {
|
|
390
|
+
const others = new Set(); ids.forEach(o => { if (o !== id) C[o].forEach(t => t.forEach(x => others.add(x))) })
|
|
391
|
+
let at = -1
|
|
392
|
+
C[id].some(tier => {
|
|
393
|
+
tier.forEach(x => {
|
|
394
|
+
if (others.has(x)) return
|
|
395
|
+
const i = x.length < 4 ? text.search(new RegExp('\\b' + x + '\\b')) : text.indexOf(x)
|
|
396
|
+
if (i >= 0 && (at < 0 || i < at)) at = i
|
|
397
|
+
})
|
|
398
|
+
return at >= 0
|
|
399
|
+
})
|
|
400
|
+
return { id, k, at: at >= 0 ? at / Math.max(1, text.length) : k / n, v: byId[id] }
|
|
401
|
+
})
|
|
402
|
+
cues.sort((a, b) => a.at - b.at || a.k - b.k)
|
|
403
|
+
if (cues.length) cues[0].at = 0
|
|
404
|
+
return cues
|
|
405
|
+
}
|
|
406
|
+
// When: a recording's own clock, the voice's word boundaries when the browser sends
|
|
407
|
+
// them, otherwise an estimate from the length of the words at the chosen rate.
|
|
408
|
+
function ptrStart ($item, m, st) {
|
|
409
|
+
const wk = $item.get(0).rcntWalk
|
|
410
|
+
ptrStop(wk)
|
|
411
|
+
if (!st || st.all) return
|
|
412
|
+
const cues = ptrCues(m, st)
|
|
413
|
+
if (!cues.length) return
|
|
414
|
+
const len = Math.max(1, String(st.say || '').length)
|
|
415
|
+
const p = wk.ptr = { cues, k: 0, len, t0: performance.now(), est: len * 1000 / (14 * walkPrefs().rate), spoken: null, geo: null, raf: 0 }
|
|
416
|
+
ptrDraw($item, p, true)
|
|
417
|
+
const tick = () => {
|
|
418
|
+
if (wk.ptr !== p) return
|
|
419
|
+
const f = recAudio && recAudio.duration > 0 && isFinite(recAudio.duration) ? recAudio.currentTime / recAudio.duration
|
|
420
|
+
: p.spoken != null ? p.spoken / p.len : (performance.now() - p.t0) / p.est
|
|
421
|
+
let k = p.k
|
|
422
|
+
while (k + 1 < p.cues.length && p.cues[k + 1].at <= f) k++
|
|
423
|
+
if (k !== p.k) { p.k = k; ptrDraw($item, p, true) }
|
|
424
|
+
if (p.k < p.cues.length - 1) p.raf = requestAnimationFrame(tick)
|
|
425
|
+
}
|
|
426
|
+
tick()
|
|
427
|
+
}
|
|
428
|
+
function ptrStop (wk) { if (wk && wk.ptr) { cancelAnimationFrame(wk.ptr.raf); wk.ptr = null } }
|
|
429
|
+
// The dates as the pointer shows them: the day when it is known, else the year.
|
|
430
|
+
function ptrWhen (v) {
|
|
431
|
+
const one = (y, f) => f >= 0.1 ? fmt(y).split(' ').pop() : fmt(y)
|
|
432
|
+
return v.e - v.s < 1 / 365 ? one(v.s, v.sf) : one(v.s, v.sf) + ' – ' + one(v.e, v.ef)
|
|
433
|
+
}
|
|
434
|
+
function ptrDraw ($item, p, animate) {
|
|
435
|
+
const svg = $item.find('.rcnt-canvas svg')[0]
|
|
436
|
+
if (!svg) return
|
|
437
|
+
$(svg).find('.rcnt-ptr').remove()
|
|
438
|
+
const cue = p.cues[p.k], bar = $(svg).find('g.rcnt-bar').filter(function () { return this.getAttribute('data-iv') === cue.id })[0]
|
|
439
|
+
if (!bar) return
|
|
440
|
+
const W = +svg.getAttribute('width'), b = bar.getBBox(), core = bar.lastElementChild.getBBox()
|
|
441
|
+
if (b.x + b.width < 0 || b.x > W) return
|
|
442
|
+
const to = { x: Math.max(8, Math.min(W - 8, core.x)), y: b.y - 3 }
|
|
443
|
+
const from = animate && p.geo && !still() ? p.geo : to
|
|
444
|
+
p.geo = to
|
|
445
|
+
const when = ptrWhen(cue.v), cw = textWidth(when) + 12
|
|
446
|
+
const line = svgEl('line', { class: 'rcnt-ptr', stroke: PTR, 'stroke-width': 1.2, 'stroke-dasharray': '3 3', opacity: 0.8, 'pointer-events': 'none' })
|
|
447
|
+
const tri = svgEl('path', { class: 'rcnt-ptr', fill: PTR, stroke: '#fff', 'stroke-width': 1, 'stroke-linejoin': 'round', 'pointer-events': 'none' })
|
|
448
|
+
const cr = svgEl('rect', { class: 'rcnt-ptr', y: 2, height: 15, width: cw, rx: 7, fill: PTR, 'pointer-events': 'none' })
|
|
449
|
+
const ct = svgEl('text', { class: 'rcnt-ptr', y: 13, fill: '#fff', 'font-size': 10, 'font-weight': 600, 'text-anchor': 'middle', 'pointer-events': 'none' })
|
|
450
|
+
ct.textContent = when
|
|
451
|
+
;[line, tri, cr, ct].forEach(n => svg.appendChild(n))
|
|
452
|
+
const place = (x, y) => {
|
|
453
|
+
line.setAttribute('x1', x); line.setAttribute('x2', x); line.setAttribute('y1', AXIS_H - 4); line.setAttribute('y2', y - 9)
|
|
454
|
+
tri.setAttribute('d', `M${x - 6},${y - 8} L${x + 6},${y - 8} L${x},${y} Z`)
|
|
455
|
+
const cx = Math.max(cw / 2 + 2, Math.min(W - cw / 2 - 2, x)); cr.setAttribute('x', cx - cw / 2); ct.setAttribute('x', cx)
|
|
456
|
+
}
|
|
457
|
+
$(svg).find('[data-wkring]').each(function () {
|
|
458
|
+
const on = this.getAttribute('data-wkring') === cue.id
|
|
459
|
+
this.setAttribute('stroke', on ? PTR : PALE); this.setAttribute('stroke-width', on ? 2 : 1.5)
|
|
460
|
+
if (on && animate && !still()) { const a = svgEl('animate', { attributeName: 'stroke-width', values: '5;2', dur: '0.9s', begin: 'indefinite', fill: 'freeze' }); this.appendChild(a); try { a.beginElement() } catch (e) {} }
|
|
332
461
|
})
|
|
462
|
+
if (from === to) { place(to.x, to.y); return }
|
|
463
|
+
const t0 = performance.now()
|
|
464
|
+
const step = now => {
|
|
465
|
+
if (!line.parentNode) return
|
|
466
|
+
const u = Math.min(1, (now - t0) / 450), e = u < 0.5 ? 2 * u * u : 1 - Math.pow(-2 * u + 2, 2) / 2
|
|
467
|
+
place(from.x + (to.x - from.x) * e, from.y + (to.y - from.y) * e)
|
|
468
|
+
if (u < 1) requestAnimationFrame(step)
|
|
469
|
+
}
|
|
470
|
+
step(t0)
|
|
333
471
|
}
|
|
334
472
|
|
|
335
473
|
// Voice and speed are the listener's: kept in this browser, the same keys the Graph Tool uses.
|
|
@@ -346,6 +484,7 @@
|
|
|
346
484
|
['Samantha', 'Daniel', 'Karen', 'Moira', 'Google UK English Female', 'Google US English', 'Microsoft Aria']
|
|
347
485
|
.map(p => vs.find(v => v.name.indexOf(p) === 0)).find(Boolean) || vs[0] || null
|
|
348
486
|
}
|
|
487
|
+
let spokenHook = null // the walk pointer's ear on the voice's word boundaries
|
|
349
488
|
const stopVoice = () => { recHush(); try { if (window.speechSynthesis) speechSynthesis.cancel() } catch (e) {} }
|
|
350
489
|
// Say the words; done() runs once when they have been said. One utterance per
|
|
351
490
|
// sentence, because Chrome stops a long one after about fifteen seconds.
|
|
@@ -358,10 +497,13 @@
|
|
|
358
497
|
if (!prefs.on || !window.speechSynthesis || !text) { setTimeout(after, text ? words * 400 + 2000 : 1200); return }
|
|
359
498
|
const v = walkVoice(prefs.voice)
|
|
360
499
|
const parts = text.match(/[^.!?]+[.!?]+["'”’)]*\s*|[^.!?]+$/g) || [text]
|
|
500
|
+
let off = 0
|
|
361
501
|
parts.forEach((s, k) => {
|
|
362
|
-
const u = new SpeechSynthesisUtterance(s.trim())
|
|
502
|
+
const u = new SpeechSynthesisUtterance(s.trim()), o = off
|
|
503
|
+
off += s.length
|
|
363
504
|
if (v) { u.voice = v; u.lang = v.lang }
|
|
364
505
|
u.rate = prefs.rate
|
|
506
|
+
u.onboundary = e => { if (isCurrent() && spokenHook) spokenHook(o + (e.charIndex || 0)) }
|
|
365
507
|
if (k === parts.length - 1) u.onend = after
|
|
366
508
|
speechSynthesis.speak(u)
|
|
367
509
|
})
|
|
@@ -416,6 +558,16 @@
|
|
|
416
558
|
if (p && p.catch) p.catch(() => fin(false))
|
|
417
559
|
}
|
|
418
560
|
|
|
561
|
+
// Rows: By band | By time — only for a timeline that names story bands.
|
|
562
|
+
function rowsBar ($item, item) {
|
|
563
|
+
const t = item.timeline || {}
|
|
564
|
+
if (!(Array.isArray(t.bands) && t.bands.length)) return ''
|
|
565
|
+
const how = rowsHow($item, item) || 'file'
|
|
566
|
+
const b = (h, label, title) => `<button class="rcnt-rows" data-how="${h}" title="${title}" style="cursor:pointer;font-size:12px;padding:2px 8px;${how === h ? 'background:#dbeafe;color:#1d4ed8;font-weight:600;' : ''}">${label}</button>`
|
|
567
|
+
return `<div style="display:flex;gap:6px;align-items:center;justify-content:center;padding:6px 0 0;font-size:12px;color:#475569">Rows:
|
|
568
|
+
${b('band', 'By band', 'One band of rows per story, each under its name')}${b('time', 'By time', 'One row per bar, earliest at the top')}</div>`
|
|
569
|
+
}
|
|
570
|
+
|
|
419
571
|
function walkBar (item) {
|
|
420
572
|
const ws = walkList(item)
|
|
421
573
|
if (!ws.length) return ''
|
|
@@ -465,6 +617,8 @@
|
|
|
465
617
|
const tok = ++wk.token, walk = cur(), st = walk && walk.steps[wk.i]
|
|
466
618
|
if (!st) return
|
|
467
619
|
wk.heard = wk.i
|
|
620
|
+
if (!wk.ptr || wk.ptr.k > 0 || performance.now() - wk.ptr.t0 > 300) ptrStart($item, el.rcntModel, st)
|
|
621
|
+
spokenHook = c => { if (wk.ptr) wk.ptr.spoken = c }
|
|
468
622
|
walkSayStep(st, () => tok === wk.token && window.rcnActiveWalk === wk, () => {
|
|
469
623
|
const last = wk.i >= walk.steps.length - 1
|
|
470
624
|
if (st.ask || last) { wk.playing = false; ui(last && !st.ask ? 'End of the walk. ← to go back, Esc to stop.' : 'Over to you. Press Space or ▶ to go on.'); return }
|
|
@@ -475,9 +629,10 @@
|
|
|
475
629
|
const walk = cur()
|
|
476
630
|
if (!walk) return
|
|
477
631
|
wk.i = Math.max(0, Math.min(walk.steps.length - 1, i))
|
|
478
|
-
wk.token++; stopVoice()
|
|
632
|
+
wk.token++; stopVoice(); ptrStop(wk)
|
|
479
633
|
if (el.rcntPaint) el.rcntPaint()
|
|
480
634
|
const st = walk.steps[wk.i]
|
|
635
|
+
ptrStart($item, el.rcntModel, st)
|
|
481
636
|
$item.find('.walk-say').text(st.say || '').css({ color: st.ask ? '#7c2d12' : '#1e1b4b', fontStyle: st.ask ? 'italic' : 'normal' })
|
|
482
637
|
ui()
|
|
483
638
|
if (wk.playing) speak()
|
|
@@ -495,7 +650,7 @@
|
|
|
495
650
|
ui(); speak()
|
|
496
651
|
}
|
|
497
652
|
const end = () => {
|
|
498
|
-
wk.playing = false; wk.token++; wk.w = null; wk.heard = null
|
|
653
|
+
wk.playing = false; wk.token++; wk.w = null; wk.heard = null; ptrStop(wk)
|
|
499
654
|
if (window.rcnActiveWalk === wk) { stopVoice(); window.rcnActiveWalk = null }
|
|
500
655
|
if (el.rcntPaint) el.rcntPaint()
|
|
501
656
|
ui()
|
|
@@ -562,7 +717,7 @@
|
|
|
562
717
|
: 'Collected from ' + collect($item).length + ' timeline(s) to the left.'}</p>` : ''
|
|
563
718
|
$item.append(`<div style="background:#f5f5f5;padding:8px;">
|
|
564
719
|
<div class="rcnt-canvas" style="background:#fff;border:1px solid #ddd;overflow-x:auto"></div>
|
|
565
|
-
${walkBar(item)}
|
|
720
|
+
${rowsBar($item, item)}${walkBar(item)}
|
|
566
721
|
<p class="caption" style="margin:4px 0 0;">${cap}</p>${note}
|
|
567
722
|
<div style="padding:6px 0 0;text-align:center;">${controls}<button class="rcnt-open" style="cursor:pointer;">Open in RCN Timeline ↗</button></div></div>`)
|
|
568
723
|
// Width is known only once the item is in the page. A walk step draws just
|
|
@@ -590,6 +745,8 @@
|
|
|
590
745
|
links: raw.links
|
|
591
746
|
}
|
|
592
747
|
const doc = Object.assign({ name: caption(item) || 'Timeline' }, tl, walkList(item).length ? { walks: item.timeline.walks } : {})
|
|
748
|
+
// carry the file's own extras (story bands, sort, place/eip on the bars ride along already)
|
|
749
|
+
if (item.timeline && !lineupOn(item)) ['bands', 'sort', 'note'].forEach(k => { if (item.timeline[k] != null && doc[k] == null) doc[k] = item.timeline[k] })
|
|
593
750
|
const hash = '#tl=' + b64(JSON.stringify(doc))
|
|
594
751
|
// Open the window now, while the click still counts, and point it at the
|
|
595
752
|
// tool once we know which copy to use; otherwise popup blockers stop it.
|
|
@@ -721,6 +878,7 @@
|
|
|
721
878
|
bindWalk($item, item)
|
|
722
879
|
$item.on('click', '.rcnt-open', e => { e.stopPropagation(); openTool($item, item) })
|
|
723
880
|
$item.on('click', '.rcnt-refresh', e => { e.stopPropagation(); emit($item, item) })
|
|
881
|
+
$item.on('click', '.rcnt-rows', function (e) { e.stopPropagation(); $item.get(0).rcntRows = this.getAttribute('data-how'); emit($item, item) })
|
|
724
882
|
$item.on('click', '.rcnt-freeze', e => {
|
|
725
883
|
e.stopPropagation()
|
|
726
884
|
if (e.shiftKey) { if (item.frozen) { delete item.frozen; save($item, item) } return }
|
package/package.json
CHANGED
|
@@ -1,12 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wiki-plugin-rcntimeline",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.6",
|
|
4
4
|
"description": "Federated Wiki plugin: a small RCN timeline on a page — intervals with fuzzy edges, the links between them, a date axis; each bar opens its page",
|
|
5
|
-
"keywords": [
|
|
5
|
+
"keywords": [
|
|
6
|
+
"wiki",
|
|
7
|
+
"federated wiki",
|
|
8
|
+
"plugin",
|
|
9
|
+
"rcn",
|
|
10
|
+
"timeline"
|
|
11
|
+
],
|
|
6
12
|
"author": "RCN Network <rcn@relocalizecreativity.net>",
|
|
7
13
|
"license": "MIT",
|
|
8
14
|
"main": "index.js",
|
|
9
|
-
"files": [
|
|
10
|
-
|
|
15
|
+
"files": [
|
|
16
|
+
"client/rcntimeline.js",
|
|
17
|
+
"factory.json",
|
|
18
|
+
"index.js",
|
|
19
|
+
"pages",
|
|
20
|
+
"README.md"
|
|
21
|
+
],
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "git+https://github.com/marpie1/rcn.git"
|
|
25
|
+
},
|
|
11
26
|
"homepage": "https://github.com/marpie1/rcn/tree/master/wiki-plugin-rcntimeline"
|
|
12
27
|
}
|