Skip to content

Conversation

@Quipyowert2
Copy link

The CSS selector has not been updated in the past three years. GitHub has changed the class of the statistics element, which caused the size stat to not show up at all. I fixed that, then noticed the size element was not centered vertically. Fixed that, and then it doesn't show up when switching either between branches or when switching from the main page of a repository (Code tab) and the Issues tab and then back.

The code in the third commit uses a combination of a MutationObserver and setInterval to keep trying to add the element every second after injectRepoSize() is called during a AJAX event.

GitHub changed its HTML in the last three years, which broke the CSS
selector in constants.ts.
Immediately after a pjax event is ready, GitHub does something to its UI
that causes adding the size element to fail. Waiting 1 second and then
trying to add the element again seems to work.
@Quipyowert2 Quipyowert2 changed the title Fix css selector, center the size element, and wait one second for GitHJb to finish loading Fix css selector, center the size element, and wait one second for GitHub to finish loading Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant