diff --git a/scripts/scripts.js b/scripts/scripts.js index 7e07ba4..9f5c9e0 100644 --- a/scripts/scripts.js +++ b/scripts/scripts.js @@ -234,7 +234,7 @@ function hookupProjectDetailButtons() { function hookupGitHubContributionsCalendar() { // Basic implementation // e - statistics are all 0 - GitHubCalendar(".github-calendar", "Teddy-1024"); + // GitHubCalendar(".github-calendar", "Teddy-1024"); // Or with responsive option enabled: // 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'); + scrollableElement.scrollLeft = scrollableElement.scrollWidth - scrollableElement.clientWidth; + }) + ; + /* const scrollableElement = document.querySelector('.github-calendar .js-calendar-graph-table'); scrollableElement.scrollLeft = scrollableElement.scrollWidth - scrollableElement.clientWidth; -} \ No newline at end of file + */ +}