Skip to content

Add Releases tab to the repo page - #12

Closed
hkdobrev wants to merge 9 commits into
refined-github:masterfrom
hkdobrev:releases-tab
Closed

hkdobrev wants to merge 9 commits into
refined-github:masterfrom
hkdobrev:releases-tab

Conversation

@hkdobrev

@hkdobrev hkdobrev commented Feb 16, 2016 •

Copy link
Copy Markdown
Contributor

Closes #8

I've successfully added a releases tab.
However I have some concerns which I hope I'd be able to address with your help.

  • Adding just <span class="octicon octicon-tag"> does not render an icon. I needed to add a full SVG markup like the rest of the icons I could find on github.com.
  • Appending the Releases tab and activating it instead of Code is rather slow and you could visually see the change after the page loads. Feedback appreciated.
  • If you have an idea how to easily count the number of releases (or tags) to put next to the label on the tab, that would be great.

P.S. This also adds a new shortcut g r for navigating to the releases page of a repo 😺

Comment thread extension/content.js Outdated
@@ -59,6 +83,7 @@ document.addEventListener('DOMContentLoaded', () => {

if (isRepo) {
gitHubInjection(window, () => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gitHubInjection(window, {wait: 1}, () => {

To make it appear faster.

@sindresorhus

Copy link
Copy Markdown
Member

Nice work!

When I click the tab and then click the back button in the browser, the Releases tab is duplicated. We need to somehow guard it. @stefanbuck Any tips on how to handle this? Something the injection module could handle for us maybe?

This way we do not wait for the defaul 250ms before adding a Releases
tab.
This works around the browser behaviour of the back button
which puts the previous DOM and the Releases button gets put again.
@hkdobrev

Copy link
Copy Markdown
Contributor Author

@sindresorhus I think I've addressed your comments. I've also added a quick check if the Releases tab is not already present which solves the back button behaviour. It should also work if GitHub decides to add a Releases tab themselves 😄

P.S. Let me know if you want to squash my commits.

@hkdobrev

Copy link
Copy Markdown
Contributor Author

I've also fixed the activation of Releases tab when visiting the Tags page, e.g. https://github.com/sindresorhus/refined-github/tags.

@stefanbuck

Copy link
Copy Markdown
Contributor

GitHub.com use some kind of cache for pages that you visited before. So if you navigate back and forth you just switch between the cache pages. That's the reason why the button was added multiple times, because in the cache version it was already there.

The quick check that @hkdobrev implemented looks simple and solid 👍

@sindresorhus

Copy link
Copy Markdown
Member

@stefanbuck Thanks for chiming in. I'm aware of the caching. I was wondering more in the direction of a general solution than having to check everything you add.

@stefanbuck

Copy link
Copy Markdown
Contributor

Ahh I see, let me think about it.

@sindresorhus

Copy link
Copy Markdown
Member

@stefanbuck Ok, cool. Let's continue in OctoLinker/injection#2.

@sindresorhus sindresorhus changed the title Add releases tab to every repo page Add Releases tab to the repo page Feb 18, 2016
@sindresorhus

Copy link
Copy Markdown
Member

Perfect! Thank you @hkdobrev. This is a really nice addition.

Adding you to the repo per the open open source idea because of this awesome contribution.

If you have an idea how to easily count the number of releases (or tags) to put next to the label on the tab, that would be great.

We could scrape it from the repo landing page when the user goes there, persist it in localstorage, and then have it available to any repo page. Not sure whether it's worth the trouble, though.

@hkdobrev
hkdobrev deleted the releases-tab branch February 18, 2016 20:36
hkdobrev added a commit that referenced this pull request Mar 22, 2016
hkdobrev added a commit that referenced this pull request Mar 22, 2016
hkdobrev added a commit that referenced this pull request Mar 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Add link to releases on every repository page

3 participants