Skip to content

Commit bce2fd4

Browse files
click to preview one place
1 parent 15df8be commit bce2fd4

1 file changed

Lines changed: 19 additions & 3 deletions

File tree

pages/parks-by-compass-points/far-from-home.html

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div id=result>working</div>
22
<script type=module>
3-
3+
import * as frame from 'http://code.fed.wiki/assets/v1/frame.js'
44
const home = {lat:45.4701282, lon:-122.7462476}
55
const site = `http://found.ward.fed.wiki`
66
const slug = `places-winter-25`
@@ -30,14 +30,14 @@
3030
rows.push(row)
3131

3232
const table = `
33-
<table style="border-collapse: collapse;">
33+
<table style="border-collapse: collapse;" onclick=preview(event)>
3434
${`<tr>${quads.map(quad => `<th style="text-align: center">
3535
${quad}`).join("")}`}
3636
${rows.map((row, r) =>
3737
`<tr>${quads.map((quad, c) => format(row[quad],r,c)).join("")}`
3838
).join("")}
3939
</table>`
40-
40+
window.preview = preview
4141
window.result.innerHTML = `
4242
${table}
4343
<br>
@@ -102,4 +102,20 @@
102102
return false
103103
}
104104

105+
function preview(event) {
106+
const target = event.target
107+
const c = target.cellIndex
108+
const r = target.parentNode.rowIndex - 1
109+
if(r<0 || !(quads[c] in rows[r])) return
110+
const {day,date,month,coord} = rows[r][quads[c]]
111+
const detail = `${dist(coord).toFixed(2)} miles ${quads[c]} at ${bearing(coord)}`
112+
const title = `Place on ${day} ${date}`
113+
console.log(title, detail)
114+
const story = [
115+
{type:'paragraph', text:detail},
116+
{type:'map',text:`${coord} ${detail}`}
117+
]
118+
frame.open({title,story},event.shiftKey)
119+
}
120+
105121
</script>

0 commit comments

Comments
 (0)