Skip to content

Commit d47e535

Browse files
committed
Fetch tool-tip elements and merge with days
1 parent 5818ec0 commit d47e535

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

src/iso.js

+17-3
Original file line numberDiff line numberDiff line change
@@ -167,12 +167,26 @@ const loadStats = () => {
167167
let currentStreakStart = null
168168
let currentStreakEnd = null
169169

170-
const data = [...document.querySelectorAll('.js-calendar-graph-table tbody td.ContributionCalendar-day')].map((d) => {
170+
const days = [...document.querySelectorAll('.js-calendar-graph-table tbody td.ContributionCalendar-day')].map((d) => {
171171
return {
172-
count: getCountFromNode(d),
173172
date: new Date(d.dataset.date),
174173
week: d.dataset.ix,
175-
color: getSquareColor(d)
174+
color: getSquareColor(d),
175+
tid: d.getAttribute('aria-labelledby')
176+
}
177+
})
178+
179+
const tooltips = [...document.querySelectorAll('.js-calendar-graph tool-tip')].map((t) => {
180+
return {
181+
tid: t.id,
182+
count: getCountFromNode(t)
183+
}
184+
})
185+
186+
const data = days.map((d) => {
187+
return {
188+
...d,
189+
...(tooltips.find((t) => t.tid === d.tid) || {})
176190
}
177191
})
178192

0 commit comments

Comments
 (0)