wiki-plugin-rcnmap 0.4.3 → 0.5.0
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/client/rcnmap.js +241 -19
- package/package.json +1 -1
- package/pages/about-rcnmap-plugin +16 -0
package/client/rcnmap.js
CHANGED
|
@@ -1,5 +1,163 @@
|
|
|
1
1
|
(function () {
|
|
2
2
|
|
|
3
|
+
// BEGIN rcn-lineup-follow — pasted from tools/rcn-lineup-follow.js by tools/paste-lineup-follow.js. Edit that file, never this block.
|
|
4
|
+
/* rcn-lineup-follow — the timeline, map and drawing items on a wiki page follow
|
|
5
|
+
* each other, across the whole lineup and into the full tools open in other tabs.
|
|
6
|
+
*
|
|
7
|
+
* ONE SOURCE. tools/paste-lineup-follow.js pastes this file into the three
|
|
8
|
+
* plugins (rcntimeline, rcnmap, rcngraph) between the BEGIN/END marker lines,
|
|
9
|
+
* so each plugin stays one file. Edit this file, then run
|
|
10
|
+
* node tools/paste-lineup-follow.js
|
|
11
|
+
*
|
|
12
|
+
* WHY IT IS EASY ON A WIKI. A FedWiki lineup is one browser document: every
|
|
13
|
+
* page beside the others is a .page inside .main, even pages from other sites.
|
|
14
|
+
* So items on different pages can call each other directly. The first plugin
|
|
15
|
+
* to load makes window.rcnLineup; the others use it.
|
|
16
|
+
*
|
|
17
|
+
* WHAT GOES OUT. The same two messages the full tools send (tools/rcn-switch.js):
|
|
18
|
+
* { type:'rcn-walk', src, lead, k, all, label, ids, places, eips } a walk step
|
|
19
|
+
* { type:'rcn-walk', src, lead, k, end:true } the walk stopped
|
|
20
|
+
* { type:'rcn-follow', src, k, click:true, id, place, eip, ids, places, eips, clear? }
|
|
21
|
+
* ids are timeline bars, places map points, eips drawing nodes. The sender
|
|
22
|
+
* widens what it lights one hop through every timeline in the lineup: each bar
|
|
23
|
+
* names a place and a node, so a map step on the Magma mine lights the Magma
|
|
24
|
+
* bars and the Magma Copper box. x:1 marks a message already widened.
|
|
25
|
+
*
|
|
26
|
+
* HOW IT TRAVELS. As a bubbling DOM event 'rcnwalkStream' from the item (the
|
|
27
|
+
* naming FedWiki's Frame plugin uses for its LINEUP topics), heard once at the
|
|
28
|
+
* document and handed to every joined item but the sender; and over the
|
|
29
|
+
* BroadcastChannel 'rcn-follow', where the full tools of the same site listen.
|
|
30
|
+
*
|
|
31
|
+
* Marc Pierson with Claude Opus 5.5, Nov 2026. MIT licence.
|
|
32
|
+
*/
|
|
33
|
+
const RL = (function () {
|
|
34
|
+
if (typeof window === 'undefined' || typeof document === 'undefined') return null
|
|
35
|
+
if (window.rcnLineup) return window.rcnLineup
|
|
36
|
+
const R = window.rcnLineup = { v: 1, members: [], heard: {} }
|
|
37
|
+
const CH = ('BroadcastChannel' in window) ? new BroadcastChannel('rcn-follow') : null
|
|
38
|
+
const none = () => ({ ids: [], places: [], eips: [] })
|
|
39
|
+
|
|
40
|
+
// The bridges: every bar of every timeline item in the lineup.
|
|
41
|
+
R.bars = function () {
|
|
42
|
+
const out = []
|
|
43
|
+
document.querySelectorAll('.rcntimeline-source').forEach(el => {
|
|
44
|
+
if (!el.timelineData) return
|
|
45
|
+
try {
|
|
46
|
+
(el.timelineData().intervals || []).forEach(iv => {
|
|
47
|
+
const x = iv.extra || {}
|
|
48
|
+
out.push({ id: String(iv.id), place: iv.place || x.place || null, eip: iv.eip || x.eip || null })
|
|
49
|
+
})
|
|
50
|
+
} catch (e) {}
|
|
51
|
+
})
|
|
52
|
+
return out
|
|
53
|
+
}
|
|
54
|
+
// One hop: a bar named, or at a lit place, or about a lit node, adds its bar, place and node.
|
|
55
|
+
R.expand = function (o) {
|
|
56
|
+
const I = {}, P = {}, E = {}, i0 = {}, p0 = {}, e0 = {}
|
|
57
|
+
;(o.ids || []).filter(Boolean).forEach(x => { I[x] = i0[x] = 1 })
|
|
58
|
+
;(o.places || []).filter(Boolean).forEach(x => { P[x] = p0[x] = 1 })
|
|
59
|
+
;(o.eips || []).filter(Boolean).forEach(x => { E[x] = e0[x] = 1 })
|
|
60
|
+
R.bars().forEach(b => {
|
|
61
|
+
if (i0[b.id] || (b.place && p0[b.place]) || (b.eip && e0[b.eip])) {
|
|
62
|
+
I[b.id] = 1; if (b.place) P[b.place] = 1; if (b.eip) E[b.eip] = 1
|
|
63
|
+
}
|
|
64
|
+
})
|
|
65
|
+
return { ids: Object.keys(I), places: Object.keys(P), eips: Object.keys(E) }
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// An item joins: fn(m) hears the others and returns true when it lit something.
|
|
69
|
+
// Joining again (a redraw) replaces the item's old listener.
|
|
70
|
+
R.join = function (el, src, fn) {
|
|
71
|
+
R.members = R.members.filter(x => x.el !== el && document.contains(x.el))
|
|
72
|
+
R.members.push({ el, src, fn })
|
|
73
|
+
}
|
|
74
|
+
R.others = el => R.members.filter(x => x.el !== el && document.contains(x.el)).length
|
|
75
|
+
|
|
76
|
+
function deliver (m, fromEl) {
|
|
77
|
+
if (!m || !m.k || R.heard[m.k]) return 0
|
|
78
|
+
R.heard[m.k] = 1
|
|
79
|
+
R.members = R.members.filter(x => document.contains(x.el))
|
|
80
|
+
let n = 0
|
|
81
|
+
R.members.slice().forEach(x => {
|
|
82
|
+
if (x.el === fromEl) return
|
|
83
|
+
try { if (x.fn(m)) n++ } catch (e) { console.warn('rcn-lineup-follow:', e) }
|
|
84
|
+
})
|
|
85
|
+
return n
|
|
86
|
+
}
|
|
87
|
+
// Returns how many items in this lineup lit something.
|
|
88
|
+
function send (el, m) {
|
|
89
|
+
m.k = Date.now() + ':' + Math.random()
|
|
90
|
+
let n = 0
|
|
91
|
+
try {
|
|
92
|
+
const ev = new CustomEvent('rcnwalkStream', { bubbles: true, detail: m })
|
|
93
|
+
el.dispatchEvent(ev)
|
|
94
|
+
n = ev.rcnLit || 0
|
|
95
|
+
} catch (e) {}
|
|
96
|
+
try { if (CH) CH.postMessage(m) } catch (e) {}
|
|
97
|
+
return n
|
|
98
|
+
}
|
|
99
|
+
document.addEventListener('rcnwalkStream', e => { e.rcnLit = deliver(e.detail, e.target) })
|
|
100
|
+
// The full tools in other tabs: their walks come widened through their set;
|
|
101
|
+
// their clicks name one thing, so widen those here.
|
|
102
|
+
if (CH) CH.addEventListener('message', ev => {
|
|
103
|
+
const m = ev.data
|
|
104
|
+
if (!m || !m.k) return
|
|
105
|
+
if (m.type === 'rcn-walk') { deliver(m, null); return }
|
|
106
|
+
if (m.type !== 'rcn-follow' || !m.click) return
|
|
107
|
+
if (m.x) { deliver(m, null); return }
|
|
108
|
+
const x = m.id ? R.expand({ ids: m.src === 'timeline' ? [m.id] : [], places: [m.place], eips: [m.eip] }) : none()
|
|
109
|
+
deliver(Object.assign({}, m, x, { x: 1, clear: !m.id }), null)
|
|
110
|
+
})
|
|
111
|
+
|
|
112
|
+
// A step of this item's walk. o: {ids|places|eips: [...], all, label}
|
|
113
|
+
R.step = function (el, src, o) {
|
|
114
|
+
if (!el.rcnLead) el.rcnLead = src + ':' + Date.now().toString(36) + Math.random().toString(36).slice(2, 6)
|
|
115
|
+
const x = o.all ? none() : R.expand(o)
|
|
116
|
+
return send(el, Object.assign({ type: 'rcn-walk', src, lead: el.rcnLead, all: !!o.all, pointer: false, label: o.label || null, x: 1 }, x))
|
|
117
|
+
}
|
|
118
|
+
// This item's walk stopped. Sends nothing if it was not leading.
|
|
119
|
+
R.end = function (el, src) {
|
|
120
|
+
if (!el.rcnLead) return
|
|
121
|
+
const lead = el.rcnLead
|
|
122
|
+
el.rcnLead = null
|
|
123
|
+
send(el, { type: 'rcn-walk', src, lead, end: true })
|
|
124
|
+
}
|
|
125
|
+
// A click on one thing, or {clear:true} to let go. o: {id} for a bar (it
|
|
126
|
+
// lights the bar's own place and node), {place} for a map point (the bars there
|
|
127
|
+
// and their nodes), {eip} for a drawing box (the bars about it and their places).
|
|
128
|
+
// Returns how many items in this lineup lit something.
|
|
129
|
+
R.click = function (el, src, o) {
|
|
130
|
+
el.rcnClicked = !o.clear
|
|
131
|
+
const x = o.clear ? none() : R.expand({ ids: o.id ? [o.id] : [], places: [o.place], eips: [o.eip] })
|
|
132
|
+
const bar = o.id && R.bars().find(b => b.id === String(o.id))
|
|
133
|
+
return send(el, Object.assign({ type: 'rcn-follow', src, click: true, clear: !!o.clear,
|
|
134
|
+
id: o.clear ? null : (o.id || o.place || o.eip || null), label: o.label || null,
|
|
135
|
+
place: o.place || (bar && bar.place) || null, eip: o.eip || (bar && bar.eip) || null, x: 1 }, x))
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// A follower's state after hearing m. f: {lead, lit:Set|null, seen:Set, click}
|
|
139
|
+
// or null. mine: the ids of this item that m names. Returns the new state; the
|
|
140
|
+
// same object means nothing changes (a step about nothing here leaves it be).
|
|
141
|
+
R.update = function (f, m, mine) {
|
|
142
|
+
if (m.type === 'rcn-walk' && m.end) return f && f.lead === m.lead ? null : f
|
|
143
|
+
if (m.type === 'rcn-follow' && m.clear) return f && f.click ? null : f
|
|
144
|
+
const same = f && m.lead && f.lead === m.lead
|
|
145
|
+
if (m.all) return { lead: m.lead || null, lit: null, seen: same ? f.seen : new Set(), click: false }
|
|
146
|
+
if (!mine.length) return f
|
|
147
|
+
const seen = same ? new Set([...f.seen, ...(f.lit || [])]) : new Set()
|
|
148
|
+
return { lead: m.lead || null, lit: new Set(mine), seen, click: m.type === 'rcn-follow' }
|
|
149
|
+
}
|
|
150
|
+
// How strongly to draw one thing: lit full, seen half, the rest faded
|
|
151
|
+
// (less faded after a click than in a walk).
|
|
152
|
+
R.op = function (f, id) {
|
|
153
|
+
if (!f || !f.lit || f.lit.has(id)) return 1
|
|
154
|
+
if (f.seen.has(id)) return 0.42
|
|
155
|
+
return f.click ? 0.3 : 0.13
|
|
156
|
+
}
|
|
157
|
+
return R
|
|
158
|
+
})()
|
|
159
|
+
// END rcn-lineup-follow
|
|
160
|
+
|
|
3
161
|
// RCN Map — a small map on a wiki page that draws points AND the ties between
|
|
4
162
|
// them. FedWiki's own Map plugin draws points only; the full RCN Map is a
|
|
5
163
|
// full-screen tool in the site's assets. This sits between the two: the item
|
|
@@ -260,10 +418,13 @@
|
|
|
260
418
|
|
|
261
419
|
// Restyle the drawn map for the open step, or put it back (no walk open).
|
|
262
420
|
// el.rcnmDrawn is what draw() made: {map, markers:{id}, ties:[{key,layer,weight}], home()}.
|
|
263
|
-
|
|
421
|
+
// stay: put the styles back but leave the view where it is.
|
|
422
|
+
function walkPaint (el, item, stay) {
|
|
264
423
|
const d = el.rcnmDrawn, wk = el.rcnmWalk
|
|
265
424
|
if (!d) return
|
|
266
425
|
const L = window.L, walk = wk && wk.w !== null ? walkList(item)[wk.w] : null
|
|
426
|
+
const f = !walk && el.rcnmFollow && el.rcnmFollow.lit ? el.rcnmFollow : null
|
|
427
|
+
if (f) { followPaint(d, item, f); return }
|
|
267
428
|
const st = walk && walk.steps[wk.i], lit = st ? stepLit(st) : null
|
|
268
429
|
const seenP = new Set(), seenT = new Set()
|
|
269
430
|
if (walk) walk.steps.slice(0, wk.i).forEach(s => { const x = stepLit(s); if (x) { x.P.forEach(v => seenP.add(v)); x.T.forEach(v => seenT.add(v)) } })
|
|
@@ -281,23 +442,50 @@
|
|
|
281
442
|
})
|
|
282
443
|
const tiles = d.map.getPane('tilePane')
|
|
283
444
|
if (tiles) tiles.style.opacity = walk ? '0.55' : ''
|
|
284
|
-
|
|
285
|
-
if (
|
|
286
|
-
if (lit && lit.P.size <= WALK_LABELS_MAX) {
|
|
287
|
-
const byId = {}
|
|
288
|
-
model(item).parcels.forEach(p => { byId[p.id] = p })
|
|
289
|
-
d.labels = L.layerGroup([...lit.P].filter(id => d.markers[id] && byId[id]).map(id =>
|
|
290
|
-
L.marker(d.markers[id].getLatLng(), { interactive: false, keyboard: false,
|
|
291
|
-
icon: L.divIcon({ className: 'rcnm-label', iconSize: [0, 0], html: `<span>${esc(byId[id].label)}</span>` }) }))).addTo(d.map)
|
|
292
|
-
walkDeclutter(d)
|
|
293
|
-
}
|
|
294
|
-
if (!walk) { d.home(); return }
|
|
445
|
+
walkLabels(d, item, lit ? lit.P : null)
|
|
446
|
+
if (!walk) { if (!stay) d.home(); return }
|
|
295
447
|
if (st.view && Array.isArray(st.view.center)) { d.map.flyTo(st.view.center, st.view.zoom || 12, { duration: 1.1 }); return }
|
|
296
448
|
const pts = lit ? [...lit.P].map(id => d.markers[id] && d.markers[id].getLatLng()).filter(Boolean) : []
|
|
297
449
|
if (!pts.length) d.home()
|
|
298
450
|
else if (pts.length === 1) d.map.flyTo(pts[0], Math.max(d.map.getZoom(), 13), { duration: 1.1 })
|
|
299
451
|
else d.map.flyToBounds(L.latLngBounds(pts), { padding: [30, 30], maxZoom: 14, duration: 1.1 })
|
|
300
452
|
}
|
|
453
|
+
// Name the points a step is about, unless so many are lit the names would pile up.
|
|
454
|
+
function walkLabels (d, item, P) {
|
|
455
|
+
const L = window.L
|
|
456
|
+
if (d.labels) { d.map.removeLayer(d.labels); d.labels = null }
|
|
457
|
+
if (!P || P.size > WALK_LABELS_MAX) return
|
|
458
|
+
const byId = {}
|
|
459
|
+
model(item).parcels.forEach(p => { byId[p.id] = p })
|
|
460
|
+
d.labels = L.layerGroup([...P].filter(id => d.markers[id] && byId[id]).map(id =>
|
|
461
|
+
L.marker(d.markers[id].getLatLng(), { interactive: false, keyboard: false,
|
|
462
|
+
icon: L.divIcon({ className: 'rcnm-label', iconSize: [0, 0], html: `<span>${esc(byId[id].label)}</span>` }) }))).addTo(d.map)
|
|
463
|
+
walkDeclutter(d)
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
// Following another item in the lineup (see rcn-lineup-follow): the points it
|
|
467
|
+
// lights here at full strength and named, a tie between two of them heavier,
|
|
468
|
+
// what it lit before at half, the rest faded; the map flies to the lit points.
|
|
469
|
+
function followPaint (d, item, f) {
|
|
470
|
+
const L = window.L, op = id => RL.op(f, id)
|
|
471
|
+
d.ties.forEach(t => {
|
|
472
|
+
const [a, b] = t.key.split('>'), on = f.lit.has(a) && f.lit.has(b)
|
|
473
|
+
t.layer.setStyle({ opacity: on ? 1 : 0.85 * Math.min(op(a), op(b)), weight: on ? Math.max(5, t.weight * 2) : t.weight })
|
|
474
|
+
if (on) t.layer.bringToFront()
|
|
475
|
+
})
|
|
476
|
+
Object.keys(d.markers).forEach(id => {
|
|
477
|
+
const o = op(id)
|
|
478
|
+
d.markers[id].setStyle({ opacity: o, fillOpacity: 0.95 * o })
|
|
479
|
+
if (o === 1) d.markers[id].bringToFront()
|
|
480
|
+
})
|
|
481
|
+
const tiles = d.map.getPane('tilePane')
|
|
482
|
+
if (tiles) tiles.style.opacity = '0.55'
|
|
483
|
+
walkLabels(d, item, f.lit)
|
|
484
|
+
const pts = [...f.lit].map(id => d.markers[id] && d.markers[id].getLatLng()).filter(Boolean)
|
|
485
|
+
if (pts.length === 1) d.map.flyTo(pts[0], Math.max(d.map.getZoom(), 13), { duration: 1.1 })
|
|
486
|
+
else if (pts.length) d.map.flyToBounds(L.latLngBounds(pts), { padding: [30, 30], maxZoom: 14, duration: 1.1 })
|
|
487
|
+
}
|
|
488
|
+
|
|
301
489
|
// Downtown, lit points sit within a block of each other: try each name right
|
|
302
490
|
// of its dot, then left, above and below, and keep the first place that
|
|
303
491
|
// covers no name already placed. Runs again whenever the map settles.
|
|
@@ -355,8 +543,10 @@
|
|
|
355
543
|
if (!walk) return
|
|
356
544
|
wk.i = Math.max(0, Math.min(walk.steps.length - 1, i))
|
|
357
545
|
wk.token++; stopVoice()
|
|
546
|
+
el.rcnmFollow = null // leading now, not following
|
|
358
547
|
walkPaint(el, item)
|
|
359
548
|
const st = walk.steps[wk.i]
|
|
549
|
+
if (RL) { const lit = stepLit(st); RL.step(el, 'map', { places: lit ? [...lit.P] : [], all: !lit, label: walk.name }) }
|
|
360
550
|
$item.find('.walk-say').text(st.say || '').css({ color: st.ask ? '#7c2d12' : '#1e1b4b', fontStyle: st.ask ? 'italic' : 'normal' })
|
|
361
551
|
ui()
|
|
362
552
|
if (wk.playing) speak()
|
|
@@ -376,10 +566,25 @@
|
|
|
376
566
|
const end = () => {
|
|
377
567
|
wk.playing = false; wk.token++; wk.w = null; wk.heard = null
|
|
378
568
|
if (window.rcnActiveWalk === wk) { stopVoice(); window.rcnActiveWalk = null }
|
|
569
|
+
if (RL) RL.end(el, 'map')
|
|
379
570
|
walkPaint(el, item)
|
|
380
571
|
ui()
|
|
381
572
|
}
|
|
382
573
|
wk.end = end
|
|
574
|
+
// Follow the other timeline, map and drawing items in the lineup, and the full
|
|
575
|
+
// tools in other tabs. A walk played elsewhere stops this one; a click elsewhere
|
|
576
|
+
// is ignored while this item's own walk is open. A point is lit by its own id,
|
|
577
|
+
// as a place or as a drawing node (a sketch area and its map area share one id).
|
|
578
|
+
if (RL) RL.join(el, 'map', msg => {
|
|
579
|
+
if (wk.w !== null) { if (msg.type !== 'rcn-walk' || msg.end) return false; end() }
|
|
580
|
+
const have = el.rcnmDrawn ? el.rcnmDrawn.markers : {}
|
|
581
|
+
const mine = [...new Set([...(msg.places || []), ...(msg.eips || [])])].filter(id => have[id])
|
|
582
|
+
const was = el.rcnmFollow || null, f = RL.update(was, msg, mine)
|
|
583
|
+
if (f === was) return false
|
|
584
|
+
el.rcnmFollow = f
|
|
585
|
+
walkPaint(el, item)
|
|
586
|
+
return !!(f && f.lit)
|
|
587
|
+
})
|
|
383
588
|
$item.off('.rcnmwalk')
|
|
384
589
|
$item.on('click.rcnmwalk', '.walk-start', e => {
|
|
385
590
|
e.stopPropagation()
|
|
@@ -472,7 +677,7 @@
|
|
|
472
677
|
const blob = await (await fetch(dataUrl)).blob()
|
|
473
678
|
const sum = new Uint8Array(await crypto.subtle.digest('SHA-256', await blob.arrayBuffer()))
|
|
474
679
|
const hex = [...sum.slice(0, 12)].map(b => b.toString(16).padStart(2, '0')).join('')
|
|
475
|
-
const ext = /mp4|m4a|aac/.test(blob.type) ? 'm4a' : /wav/.test(blob.type) ? 'wav' : /ogg/.test(blob.type) ? 'ogg' : 'webm'
|
|
680
|
+
const ext = /mpeg|mp3/.test(blob.type) ? 'mp3' : /mp4|m4a|aac/.test(blob.type) ? 'm4a' : /wav/.test(blob.type) ? 'wav' : /ogg/.test(blob.type) ? 'ogg' : 'webm'
|
|
476
681
|
const name = hex + '.' + ext
|
|
477
682
|
const url = location.origin + '/assets/' + VOICE_FOLDER + '/' + name
|
|
478
683
|
const have = await fetch(url, { method: 'HEAD', cache: 'no-store' }).then(r => r.ok, () => false)
|
|
@@ -623,18 +828,32 @@
|
|
|
623
828
|
drawn.ties.push({ key: l.from + '>' + l.to, layer: line, weight: k.weight || 2.5 })
|
|
624
829
|
})
|
|
625
830
|
|
|
626
|
-
const $page = $item.parents('.page:first')
|
|
831
|
+
const $page = $item.parents('.page:first'), el = $item.get(0)
|
|
627
832
|
m.parcels.forEach(p => {
|
|
628
833
|
const t = (m.types || {})[p.type] || {}
|
|
629
834
|
const c = p.contact || {}
|
|
630
835
|
const tip = `<b>${esc(p.label)}</b>` + (t.label ? `<br>${esc(t.label)}` : '')
|
|
631
836
|
+ (c.website ? `<br>${esc(c.website.replace(/^https?:\/\/(www\.)?/, '').replace(/\/$/, ''))}` : '')
|
|
632
837
|
+ (c.phone ? `<br>${esc(c.phone)}` : '')
|
|
633
|
-
|
|
838
|
+
const hint = () => RL && RL.others(el)
|
|
839
|
+
? '<br><i style="color:#64748b">click to light it beside · shift-click to open its page</i>'
|
|
840
|
+
: '<br><i style="color:#64748b">click to open its page</i>'
|
|
841
|
+
// A click lights the point in the items beside it; it opens the point's page
|
|
842
|
+
// when nothing beside it lights up. Shift-click opens the page at the end of
|
|
843
|
+
// the lineup, keeping the pages already open.
|
|
634
844
|
drawn.markers[p.id] = L.circleMarker(p.latLng, {
|
|
635
845
|
radius: 7, fillColor: t.color || DEFAULT_COLOR, color: '#fff', weight: 1.5, fillOpacity: 0.95
|
|
636
|
-
}).bindTooltip(tip, { direction: 'top', offset: [0, -6] })
|
|
637
|
-
.on('click',
|
|
846
|
+
}).bindTooltip(() => tip + hint(), { direction: 'top', offset: [0, -6] })
|
|
847
|
+
.on('click', e => {
|
|
848
|
+
L.DomEvent.stopPropagation(e)
|
|
849
|
+
if (e.originalEvent && e.originalEvent.shiftKey) { wiki.doInternalLink(p.wikiTitle || p.label, null); return }
|
|
850
|
+
if (RL && !(el.rcnmWalk && el.rcnmWalk.w !== null)) {
|
|
851
|
+
if (el.rcnmFollow) { el.rcnmFollow = null; walkPaint(el, item, true) }
|
|
852
|
+
if (RL.click(el, 'map', { place: p.id, label: p.label })) return
|
|
853
|
+
}
|
|
854
|
+
// beside items that follow, open it at the end so they stay open
|
|
855
|
+
wiki.doInternalLink(p.wikiTitle || p.label, RL && RL.others(el) ? null : $page)
|
|
856
|
+
})
|
|
638
857
|
.addTo(map)
|
|
639
858
|
})
|
|
640
859
|
|
|
@@ -646,13 +865,16 @@
|
|
|
646
865
|
else map.fitBounds(L.latLngBounds(m.parcels.map(p => p.latLng)), { padding: [24, 24], maxZoom: 15 })
|
|
647
866
|
}
|
|
648
867
|
drawn.home()
|
|
649
|
-
const el = $item.get(0)
|
|
650
868
|
el.rcnmDrawn = drawn
|
|
869
|
+
// A click on the map itself lets go of what this map last lit beside it.
|
|
870
|
+
map.on('click', () => { if (RL && el.rcnClicked) RL.click(el, 'map', { clear: true }) })
|
|
651
871
|
map.on('zoomend moveend', () => walkDeclutter(drawn))
|
|
652
872
|
|
|
653
873
|
// Dragging the map must not drag the item, and a double-click on the map
|
|
654
874
|
// should open the editor, as it does anywhere else on the item.
|
|
655
|
-
L.DomEvent.disableClickPropagation
|
|
875
|
+
// (Not L.DomEvent.disableClickPropagation: its one-shot click guard makes the
|
|
876
|
+
// map ignore every second click, so a click on the map could not let go.)
|
|
877
|
+
L.DomEvent.on(document.getElementById(id), 'mousedown touchstart dblclick', L.DomEvent.stopPropagation)
|
|
656
878
|
map.doubleClickZoom.disable()
|
|
657
879
|
}
|
|
658
880
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wiki-plugin-rcnmap",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Federated Wiki plugin: a small RCN map on a page that draws points and the ties between them; each point opens its page",
|
|
5
5
|
"keywords": ["wiki", "federated wiki", "plugin", "rcn", "map"],
|
|
6
6
|
"author": "RCN Network <rcn@relocalizecreativity.net>",
|
|
@@ -133,6 +133,11 @@
|
|
|
133
133
|
"text": "Walks. A map made from an RCN Map issue can carry walks: a reading of the map, one step at a time. Press \u25b6 Walk under the map. Each step flies the map to the points and ties it is about, names those points, fades the rest (the ones already visited stay half lit) and reads one or two sentences aloud, shown as a caption too. Space plays or pauses, \u2190 and \u2192 step, Esc stops. Voice on or off and the choice of voice are kept in this browser and shared with the Graph Tool and Timeline walks. To write or change them, press \ud83d\uddfa Open in RCN Map: the full map opens with this map in it, a blue banner names this page, and after \ud83d\udeb6 Walk \u2192 \u270e Edit, \u2b06 Save to wiki brings the walks back into the item as an ordinary edit. Only walks come back; points and ties are edited in the item's text for now. a LINEUP or frozen map plays none, because its points are gathered from other pages.",
|
|
134
134
|
"id": "acad2aaf540683fe"
|
|
135
135
|
},
|
|
136
|
+
{
|
|
137
|
+
"type": "paragraph",
|
|
138
|
+
"id": "b6ab902739e74ee2",
|
|
139
|
+
"text": "Following. Put this page in a lineup beside pages with an RCN timeline, map or drawing, and the items follow each other. Press \u25b6 Walk in any of them: each step lights what it is about there, and the others light what is related to it: full strength for this step, half for earlier steps, the rest faded. Click a point and the timeline lights the bars there, and the drawing their boxes. The others light where it is for them. Click empty space to let go. The timeline's bars are the bridges: each bar names a place on the map (place) and a box in the drawing (eip). One walk plays at a time, and starting one stops the others. A click that lights nothing beside it opens its page as before; beside items that follow, the page opens at the end of the lineup so they stay open, and shift-click always opens it. The full Timeline, Map and Graph Tool, opened from this wiki's assets in another tab, follow too, and lead too."
|
|
140
|
+
},
|
|
136
141
|
{
|
|
137
142
|
"type": "paragraph",
|
|
138
143
|
"id": "22dca488818d034f",
|
|
@@ -350,6 +355,17 @@
|
|
|
350
355
|
},
|
|
351
356
|
"after": "acad2aaf540683fe",
|
|
352
357
|
"date": 1792642784633
|
|
358
|
+
},
|
|
359
|
+
{
|
|
360
|
+
"type": "add",
|
|
361
|
+
"id": "b6ab902739e74ee2",
|
|
362
|
+
"item": {
|
|
363
|
+
"type": "paragraph",
|
|
364
|
+
"id": "b6ab902739e74ee2",
|
|
365
|
+
"text": "Following. Put this page in a lineup beside pages with an RCN timeline, map or drawing, and the items follow each other. Press \u25b6 Walk in any of them: each step lights what it is about there, and the others light what is related to it: full strength for this step, half for earlier steps, the rest faded. Click a point and the timeline lights the bars there, and the drawing their boxes. The others light where it is for them. Click empty space to let go. The timeline's bars are the bridges: each bar names a place on the map (place) and a box in the drawing (eip). One walk plays at a time, and starting one stops the others. A click that lights nothing beside it opens its page as before; beside items that follow, the page opens at the end of the lineup so they stay open, and shift-click always opens it. The full Timeline, Map and Graph Tool, opened from this wiki's assets in another tab, follow too, and lead too."
|
|
366
|
+
},
|
|
367
|
+
"after": "acad2aaf540683fe",
|
|
368
|
+
"date": 1794193621097
|
|
353
369
|
}
|
|
354
370
|
]
|
|
355
371
|
}
|