Feat: Updated hookup method for GitHub contributions calendar with new element structure

This commit is contained in:
2025-07-07 14:54:52 +01:00
parent 32565c1a2d
commit ece6ca8c9c

View File

@@ -234,7 +234,7 @@ function hookupProjectDetailButtons() {
function hookupGitHubContributionsCalendar() { function hookupGitHubContributionsCalendar() {
// Basic implementation // Basic implementation
// e - statistics are all 0 // e - statistics are all 0
GitHubCalendar(".github-calendar", "Teddy-1024"); // GitHubCalendar(".github-calendar", "Teddy-1024");
// Or with responsive option enabled: // Or with responsive option enabled:
// e - statistics are all 0 // e - statistics are all 0
@@ -252,6 +252,26 @@ function hookupGitHubContributionsCalendar() {
}); });
*/ */
new Promise((resolve) => {
GitHubCalendar(".github-calendar", "Teddy-1024");
const checkLoaded = () => {
const calendar = document.querySelector('.github-calendar .js-calendar-graph-table');
if (calendar) {
resolve();
} else {
setTimeout(checkLoaded, 100);
}
};
checkLoaded();
})
.then(() => {
const scrollableElement = document.querySelector('.github-calendar .js-calendar-graph-table'); const scrollableElement = document.querySelector('.github-calendar .js-calendar-graph-table');
scrollableElement.scrollLeft = scrollableElement.scrollWidth - scrollableElement.clientWidth; scrollableElement.scrollLeft = scrollableElement.scrollWidth - scrollableElement.clientWidth;
})
;
/*
const scrollableElement = document.querySelector('.github-calendar .js-calendar-graph-table');
scrollableElement.scrollLeft = scrollableElement.scrollWidth - scrollableElement.clientWidth;
*/
} }