Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement infinite scroll on dashboards to fix account switcher closing #27

Closed
wants to merge 1 commit into from

Conversation

paulmolluzzo
Copy link
Contributor

This is an alternative to PR #25 that also fixes Issue #19, just in a different way.

The more() function is gone, and instead there's an infinite scroll on the dashboard. It mashes the button from one page height away, so you shouldn't see the "More" button even with fast scrolling.

Also, this improves the isDashboard definition, catching ~/dashboard and organization dashboards too.

Closes #25
Fixes #19

const wScroll = window.pageYOffset || document.scrollTop;
const btnOffset = $('.ajax-pagination-btn').offset().top;

// mash the button if it's coming close to being in view
Copy link
Contributor

Choose a reason for hiding this comment

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

📝 smash perhaps?

Copy link
Member

Choose a reason for hiding this comment

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

👍

@sindresorhus
Copy link
Member

Good idea!

@sindresorhus sindresorhus changed the title Implement infinite scroll on dashboards to fix acct switcher closing Implement infinite scroll on dashboards to fix account switcher closing Feb 23, 2016
@sindresorhus sindresorhus deleted the infinite-dashboard branch February 23, 2016 03:51
sindresorhus pushed a commit that referenced this pull request Feb 23, 2016
@sindresorhus
Copy link
Member

Just a follow-up question, would it be possible to always have the next page loaded when you scroll down? So you wouldn't have to see the loading indicator and wait.

@paulmolluzzo
Copy link
Contributor Author

I suppose you could just remove the scroll distance if test on line 70:

if (wScroll > (btnOffset - wHeight)) {
    btn.click();
}

Leave only the btn.click() and it'll start (s)mashing that button on every scroll. It's possible that there'll be a performance hit, so I'd want to debounce/throttle it, but it's up to you.

@paulmolluzzo
Copy link
Contributor Author

If you want to do that LMK and I'll make a new PR. Keep in mind that cmd+↓ is an immediate scroll to the botton and the button will show a loading gif as it makes the XHR to GH and then updates the DOM, so there's always some edge there (I think).

@sindresorhus
Copy link
Member

@paulmolluzzo Hmm, not that important. Let's leave it like it is for now.

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.

Account switcher closes itself immediately after click
3 participants