Skip to content

Commit cabc3ea

Browse files
bold border when month changes
1 parent 1e21baf commit cabc3ea

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

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

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,24 @@
4747
`
4848

4949
function format(item, r, c) {
50-
const style = `border: 1px solid black; padding: 6px`
50+
let style = `border: 1px solid black; padding: 6px; `
5151
if (item) {
52-
console.log(item,rows[r][quads[c]])
53-
const {day,date,coord} = item
52+
const {day,date,month,coord} = item
53+
if(diff(month,r-1,c)) style += "border-top:2px solid black; "
54+
if(diff(month,r,c-1)) style += "border-left:2px solid black; "
5455
const title = `${bearing(coord)} on ${date} at ${r},${c}`
5556
const field = `${day}${dist(coord)}`
5657
return `<td title="${title}" style="${style}">${field}`
5758
}
5859
return `<td style="${style}">`
5960
}
6061

62+
function diff(month, r, c) {
63+
if (r<0 || c<0) return false
64+
if (!(quads[c] in rows[r])) return false
65+
return month != rows[r][quads[c]].month
66+
}
67+
6168
function dist(coord) {
6269
const [lat,lon] = coord.split(/,/)
6370
const dx = Math.abs(home.lon - lon) * 49

0 commit comments

Comments
 (0)