Shywim / github-repo-size

A Firefox addon showing the size of a Github repository.
https://addons.mozilla.org/en-US/firefox/addon/github-repo-size/
MIT License
69 stars 9 forks source link

Fix css selector, center the size element, and wait one second for GitHub to finish loading #44

Open Quipyowert2 opened 4 months ago

Quipyowert2 commented 4 months ago

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.